123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- namespace loyalsoft;
- /**
- * 玩家关卡地图数据
- * @author gwang
- * @deprecated since 2022.3 换开放地图版转 Info_NewMap->Ins_FootHold
- * @version
- * 1.0.0 Created at 2021年3月2日14:32:52 关卡分三层处理 大陆->区域->关卡.
- */
- class Info_Map extends Object_ext {
- /**
- * 大陆数据
- * @var dict<int,Ins_Mainland>
- */
- public $mainlands;
- /**
- * 战斗关卡记录--1.记录剧情关卡记录;2.副本唤灵师关卡 3.副本武器关卡 4.副本言灵关卡
- * @param type $arg
- */
- public $battleRecord = array();
- function __construct($arg = null) {
- if (null === $arg) {
- // $this->battleRecord = new \stdClass();
- // $arr = array();
- // $arr[] = 1;
- // $arr[] = 2;
- // $arr[] = 3;
- // $arr[] = 4;
- // foreach ($arr as $key) {
- // $this->battleRecord->$key = array();
- // }
- // 直接初始化8个大陆的基本数据
- $this->mainlands = ObjectInit();
- foreach (GameConfig::gate_mainland() as $id => $land) {
- $ins = new Ins_Mainland();
- $ins->landId = $id;
- if (1 == $id) { # 第一个大陆, 直接开启第一个区域
- $zones = explode(',', $land->containZones);
- $zoneid = $zones[0];
- $zone = new Ins_Mapzone();
- $zone->zoneid = $zoneid;
- $zonecfg = GameConfig::gate_zone_getItem($zoneid);
- my_Assert($zonecfg, ErrCode::err_const_no);
- $gateIds = explode(',', $zonecfg->contains);
- $zone->gates[] = $gateIds[0];
- $ins->normal->$zoneid = $zone;
- }
- $this->mainlands->$id = $ins;
- }
- } else {
- parent::__construct($arg);
- }
- }
- public function addBattleRecord($gateId) {
- if (!in_array($gateId, $this->battleRecord)) {
- if (strlen($gateId) == 8 && substr($gateId, 0, 3) == 2001) {
- $type = Enum_TargetStatistics::HuanLingShiGateId_ComUserNum;
- } elseif (strlen($gateId) == 8 && substr($gateId, 0, 3) == 2002) {
- $type = Enum_TargetStatistics::WeaponGateId_ComUserNum;
- } elseif (strlen($gateId) == 8 && substr($gateId, 0, 3) == 2003) {
- $type = Enum_TargetStatistics::YanLingGateId_ComUserNum;
- } else {
- $type = Enum_TargetStatistics::storyGateId_ComUserNum;
- }
- $arr = $this->battleRecord;
- $arr[] = $gateId;
- $this->battleRecord = $arr;
- StatisticsProc::TargetStatistics($type, $gateId);
- }
- }
- public function addBattleNumRecord($gateId, $ret) {
- if (strlen($gateId) == 8 && substr($gateId, 0, 3) == 2001) {
- $type = Enum_TargetStatistics::HuanLingShiGateId_BattleNum;
- } elseif (strlen($gateId) == 8 && substr($gateId, 0, 3) == 2002) {
- $type = Enum_TargetStatistics::WeaponGateId_BattleNum;
- } elseif (strlen($gateId) == 8 && substr($gateId, 0, 3) == 2003) {
- $type = Enum_TargetStatistics::YanLingGateId_BattleNum;
- } else {
- $type = Enum_TargetStatistics::storyGateId_BattleNum;
- }
- $battleNum = 0;
- $passNum = 0;
- if ($ret == true) {
- $battleNum = 1;
- $passNum = 1;
- } else {
- $battleNum = 1;
- $passNum = 0;
- }
- $ctx = $battleNum . "/" . $passNum;
- StatisticsProc::TargetStatistics($type, $gateId, $ctx);
- }
- }
|