コード例 #1
0
 public void Deserialize(JSON_TowerFloorParam json)
 {
     if (json == null)
     {
         throw new InvalidJSONException();
     }
     this.iname           = json.iname;
     this.title           = json.title;
     this.name            = json.name;
     this.expr            = json.expr;
     this.cond            = json.cond;
     this.tower_id        = json.tower_id;
     this.cond_quest      = json.cond_quest;
     this.hp_recover_rate = json.hp_recover_rate;
     this.pt            = (short)json.pt;
     this.lv            = json.lv;
     this.joblv         = json.joblv;
     this.can_help      = (int)json.can_help == 1;
     this.rdy_cnd       = json.rdy_cnd;
     this.reward_id     = json.reward_id;
     this.floor         = json.floor;
     this.is_unit_chg   = json.is_unit_chg;
     this.me_id         = json.me_id;
     this.is_wth_no_chg = json.is_wth_no_chg;
     this.wth_set_id    = json.wth_set_id;
     if (json.rand_tag != null)
     {
         this.rand_tag = new byte[json.rand_tag.Length];
         for (int index = 0; index < json.rand_tag.Length; ++index)
         {
             this.rand_tag[index] = (byte)json.rand_tag[index];
         }
     }
     this.naut = json.naut;
     this.map.Clear();
     if (json.map != null)
     {
         for (int index = 0; index < json.map.Length; ++index)
         {
             MapParam mapParam = new MapParam();
             mapParam.Deserialize(json.map[index]);
             this.map.Add(mapParam);
         }
     }
     this.BaseQuest = MonoSingleton <GameManager> .Instance.FindBaseQuest(QuestTypes.Tower, this.tower_id);
 }
コード例 #2
0
        public void Deserialize(JSON_MultiTowerFloorParam json)
        {
            if (json == null)
            {
                throw new InvalidJSONException();
            }
            this.id            = json.id;
            this.title         = json.title;
            this.name          = json.name;
            this.expr          = json.expr;
            this.cond          = json.cond;
            this.tower_id      = json.tower_id;
            this.cond_floor    = json.cond_floor;
            this.pt            = json.pt;
            this.lv            = json.lv;
            this.joblv         = json.joblv;
            this.reward_id     = json.reward_id;
            this.floor         = json.floor;
            this.unitnum       = json.unitnum;
            this.notcon        = json.notcon;
            this.me_id         = json.me_id;
            this.is_wth_no_chg = json.is_wth_no_chg;
            this.wth_set_id    = json.wth_set_id;
            this.map.Clear();
            if (json.map != null)
            {
                for (int index = 0; index < json.map.Length; ++index)
                {
                    MapParam mapParam = new MapParam();
                    mapParam.Deserialize(json.map[index]);
                    this.map.Add(mapParam);
                }
            }
            GameManager instance = MonoSingleton <GameManager> .Instance;

            this.BaseQuest = instance.FindQuest(this.tower_id);
            QuestParam questParam = this.GetQuestParam();

            instance.AddMTQuest(questParam.iname, questParam);
        }
コード例 #3
0
ファイル: BattleMap.cs プロジェクト: zunaalabaya/TAC-BOT
        public bool Initialize(BattleCore core, MapParam param)
        {
            this.mBattle         = core;
            this.MapSceneName    = param.mapSceneName;
            this.BattleSceneName = param.battleSceneName;
            this.EventSceneName  = param.eventSceneName;
            this.BGMName         = param.bgmName;
            this.mWinMonitorCondition.Clear();
            this.mLoseMonitorCondition.Clear();
            if (string.IsNullOrEmpty(param.mapSceneName))
            {
                DebugUtility.LogError("not found mapdata.");
                return(false);
            }
            string path1 = AssetPath.LocalMap(param.mapSceneName);
            string src1  = AssetManager.LoadTextData(path1);

            if (src1 == null)
            {
                DebugUtility.LogError("Failed to load " + path1);
                return(false);
            }
            if (!this.Deserialize(JSONParser.parseJSONObject <JSON_Map>(src1)))
            {
                DebugUtility.LogError("Failed to load " + path1);
                return(false);
            }
            string path2 = AssetPath.LocalMap(param.mapSetName);
            string src2  = AssetManager.LoadTextData(path2);

            if (src2 == null)
            {
                DebugUtility.LogError("マップ配置情報\"" + path2 + "\"に存在しない");
                return(false);
            }
            JSON_MapUnit jsonObject = JSONParser.parseJSONObject <JSON_MapUnit>(src2);

            if (jsonObject == null)
            {
                DebugUtility.LogError("マップ配置情報\"" + path2 + "\"のパースに失敗");
                return(false);
            }
            if (jsonObject.enemy == null && jsonObject.arena == null)
            {
                DebugUtility.LogError("敵ユニットの配置情報がマップ配置情報\"" + path2 + "\"に存在しない");
                return(false);
            }
            if (jsonObject.party != null)
            {
                this.mPartyUnitSettings = new List <UnitSetting>(jsonObject.party.Length);
                for (int index = 0; index < jsonObject.party.Length; ++index)
                {
                    this.mPartyUnitSettings.Add(new UnitSetting(jsonObject.party[index]));
                }
            }
            if (jsonObject.party_subs != null && jsonObject.party_subs.Length != 0)
            {
                this.mPartyUnitSubSettings = new List <UnitSubSetting>(jsonObject.party_subs.Length);
                foreach (JSON_MapPartySubCT partySub in jsonObject.party_subs)
                {
                    this.mPartyUnitSubSettings.Add(new UnitSubSetting(partySub));
                }
            }
            if (jsonObject.tricks != null && jsonObject.tricks.Length != 0)
            {
                this.mTrickSettings = new List <TrickSetting>(jsonObject.tricks.Length);
                foreach (JSON_MapTrick trick in jsonObject.tricks)
                {
                    this.mTrickSettings.Add(new TrickSetting(trick));
                }
            }
            if (jsonObject.enemy != null)
            {
                jsonObject.enemy      = jsonObject.ReplacedRandEnemy(this.mRandDeckResult, true);
                this.mNPCUnitSettings = new List <NPCSetting>(jsonObject.enemy.Length);
                for (int index = 0; index < jsonObject.enemy.Length; ++index)
                {
                    this.mNPCUnitSettings.Add(new NPCSetting(jsonObject.enemy[index]));
                }
            }
            if (jsonObject.arena != null)
            {
                this.mArenaUnitSettings = new List <UnitSetting>(jsonObject.arena.Length);
                for (int index = 0; index < jsonObject.arena.Length; ++index)
                {
                    UnitSetting unitSetting = new UnitSetting();
                    unitSetting.uniqname          = (OString)jsonObject.arena[index].name;
                    unitSetting.ai                = (OString)jsonObject.arena[index].ai;
                    unitSetting.pos.x             = (OInt)jsonObject.arena[index].x;
                    unitSetting.pos.y             = (OInt)jsonObject.arena[index].y;
                    unitSetting.dir               = (OInt)jsonObject.arena[index].dir;
                    unitSetting.waitEntryClock    = (OInt)jsonObject.arena[index].wait_e;
                    unitSetting.waitMoveTurn      = (OInt)jsonObject.arena[index].wait_m;
                    unitSetting.waitExitTurn      = (OInt)jsonObject.arena[index].wait_exit;
                    unitSetting.startCtCalc       = (eMapUnitCtCalcType)jsonObject.arena[index].ct_calc;
                    unitSetting.startCtVal        = (OInt)jsonObject.arena[index].ct_val;
                    unitSetting.DisableFirceVoice = jsonObject.arena[index].fvoff != 0;
                    unitSetting.side              = (OInt)1;
                    unitSetting.ai_pos.x          = (OInt)jsonObject.arena[index].ai_x;
                    unitSetting.ai_pos.y          = (OInt)jsonObject.arena[index].ai_y;
                    unitSetting.ai_len            = (OInt)jsonObject.arena[index].ai_len;
                    unitSetting.parent            = (OString)jsonObject.arena[index].parent;
                    if (jsonObject.arena[index].trg != null)
                    {
                        unitSetting.trigger = new EventTrigger();
                        unitSetting.trigger.Deserialize(jsonObject.arena[index].trg);
                    }
                    this.mArenaUnitSettings.Add(unitSetting);
                }
            }
            if (jsonObject.w_cond != null)
            {
                jsonObject.w_cond.CopyTo(this.mWinMonitorCondition);
            }
            if (jsonObject.l_cond != null)
            {
                jsonObject.l_cond.CopyTo(this.mLoseMonitorCondition);
            }
            if (jsonObject.gs != null)
            {
                this.mGimmickEvents = new List <JSON_GimmickEvent>((IEnumerable <JSON_GimmickEvent>)jsonObject.gs);
            }
            return(true);
        }