Info_Map.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * 玩家关卡地图数据
  5. * @author gwang
  6. * @version
  7. * 1.0.0 Created at 2021年3月2日14:32:52 关卡分三层处理 大陆->区域->关卡.
  8. */
  9. class Info_Map extends Object_ext {
  10. /**
  11. * 大陆数据
  12. * @var dict<int,Ins_Mainland>
  13. */
  14. public $mainlands;
  15. /**
  16. * 战斗关卡记录--1.记录剧情关卡记录;2.副本唤灵师关卡 3.副本武器关卡 4.副本言灵关卡
  17. * @param type $arg
  18. */
  19. public $battleRecord = array();
  20. function __construct($arg = null) {
  21. if (null === $arg) {
  22. // $this->battleRecord = new \stdClass();
  23. // $arr = array();
  24. // $arr[] = 1;
  25. // $arr[] = 2;
  26. // $arr[] = 3;
  27. // $arr[] = 4;
  28. // foreach ($arr as $key) {
  29. // $this->battleRecord->$key = array();
  30. // }
  31. // 直接初始化8个大陆的基本数据
  32. $this->mainlands = ObjectInit();
  33. foreach (GameConfig::gate_mainland() as $id => $land) {
  34. $ins = new Ins_Mainland();
  35. $ins->landId = $id;
  36. if (1 == $id) { # 第一个大陆, 直接开启第一个区域
  37. $zones = explode(',', $land->containZones);
  38. $zoneid = $zones[0];
  39. $zone = new Ins_Mapzone();
  40. $zone->zoneid = $zoneid;
  41. $zonecfg = GameConfig::gate_zone_getItem($zoneid);
  42. my_Assert($zonecfg, ErrCode::err_const_no);
  43. $gateIds = explode(',', $zonecfg->contains);
  44. $zone->gates[] = $gateIds[0];
  45. $ins->normal->$zoneid = $zone;
  46. }
  47. $this->mainlands->$id = $ins;
  48. }
  49. } else {
  50. parent::__construct($arg);
  51. }
  52. }
  53. public function addBattleRecord($gateId) {
  54. if(!in_array($gateId,$this->battleRecord)){
  55. if(strlen($gateId) == 8 && substr($gateId,0,3) == 2001){
  56. $type = Enum_TargetStatistics::HuanLingShiGateId_ComUserNum;
  57. } elseif (strlen($gateId) == 8 && substr($gateId,0,3) == 2002) {
  58. $type = Enum_TargetStatistics::WeaponGateId_ComUserNum;
  59. } elseif (strlen($gateId) == 8 && substr($gateId,0,3) == 2003) {
  60. $type = Enum_TargetStatistics::YanLingGateId_ComUserNum;
  61. } else {
  62. $type = Enum_TargetStatistics::storyGateId_ComUserNum;
  63. }
  64. $arr = $this->battleRecord;
  65. $arr[] = $gateId;
  66. $this->battleRecord= $arr;
  67. StatisticsProc::TargetStatistics($type, $gateId);
  68. }
  69. }
  70. public function addBattleNumRecord($gateId,$ret) {
  71. if(strlen($gateId) == 8 && substr($gateId,0,3) == 2001){
  72. $type = Enum_TargetStatistics::HuanLingShiGateId_BattleNum;
  73. } elseif (strlen($gateId) == 8 && substr($gateId,0,3) == 2002) {
  74. $type = Enum_TargetStatistics::WeaponGateId_BattleNum;
  75. } elseif (strlen($gateId) == 8 && substr($gateId,0,3) == 2003) {
  76. $type = Enum_TargetStatistics::YanLingGateId_BattleNum;
  77. } else {
  78. $type = Enum_TargetStatistics::storyGateId_BattleNum;
  79. }
  80. $battleNum = 0;
  81. $passNum = 0;
  82. if($ret == true){
  83. $battleNum = 1;
  84. $passNum = 1;
  85. } else {
  86. $battleNum = 1;
  87. $passNum = 0;
  88. }
  89. $ctx = $battleNum."/".$passNum;
  90. StatisticsProc::TargetStatistics($type, $gateId,$ctx);
  91. }
  92. }