/// <summary> /// 初始化通关条件 /// </summary> private void CreateStateHandler() { mIsPause = true; if (mSceneID == 1) { mIsPause = false; mRootHandler = new SelectStageHandler(this, 0); return; } int lv = 0; LevelPO levelPO = LevelData.Instance.GetLevelPO(mSceneID * 100 + Define.GAME_CONFIG_DIFFICULTY); if (levelPO == null) { return; } List <IStageHandler> list = new List <IStageHandler>(); switch (mSceneID) { case 2: for (int i = 0; i < levelPO.CheckPointScores.Length; ++i) { IStageHandler handle = new TownStageHandler(this, lv++); list.Add(handle); } break; case 4: for (int i = 0; i < levelPO.CheckPointScores.Length; ++i) { IStageHandler handle = new BullDemonKingStageHandler(this, lv++); list.Add(handle); } break; case 5: for (int i = 0; i < levelPO.CheckPointScores.Length; ++i) { IStageHandler handle = new FarmStageHandler(this, lv++); list.Add(handle); } break; case 6: break; } for (int i = 0; i < list.Count - 1; ++i) { list[i].SetNextHandler(list[i + 1]); } mRootHandler = list[0]; }
static public void LoadHandler(LoadedData data) { JsonData jsonData = JsonMapper.ToObject(data.Value.ToString()); if (!jsonData.IsArray) { return; } for (int index = 0; index < jsonData.Count; index++) { JsonData element = jsonData[index]; LevelPO po = new LevelPO(element); LevelData.Instance.m_dictionary.Add(po.Id, po); } }
bool LoadCondition(int sceneId, int difficultyId) { curShakeCount = 0; maxShakeCount = 0; maxTriggerCount = 0; curTriggerCount = 0; maxAoeScore = 0; curAoeScore = 0; curPlayerCount = 0; checkPoint = 1; // 为了防止刚开始的时候跳过一些刷怪点 curTotalScore = 0; gameTime = 0; pullWaterCount = 0; pullWaterCount1 = 0; pullWaterTime = 0; pullWaterCountdown = 0; weaponId = 0; killTypeCondition = new Dictionary <string, KillCondition>(); killIdCondition = new Dictionary <int, KillCondition>(); killIdList = new List <int>(); checkPointScores = new List <int>(); int id = sceneId * 1000 + difficultyId; LevelPO dataPO = LevelData.Instance.GetLevelPO(id); if (dataPO == null) { return(false); } // 暂时先去掉怪物数量的条件判断 //if (dataPO.MustKillMonster.Length % 2 == 0) //{ // for (int index = 0; index < dataPO.MustKillMonster.Length; ) // { // string name = dataPO.MustKillMonster[index++]; // int count = dataPO.MustKillMonster[index++].ToInt(); // killTypeCondition.Add(name, count); // } //} if (dataPO.MustKillID.Length % 3 == 0) { for (int index = 0; index < dataPO.MustKillID.Length;) { int stage = dataPO.MustKillID[index++].ToInt(); int key = dataPO.MustKillID[index++].ToInt(); int count = dataPO.MustKillID[index++].ToInt(); killIdCondition.Add(key, new KillCondition(stage, count)); killIdList.Add(key); } } for (int index = 0; index < dataPO.CheckPointScores.Length; ++index) { checkPointScores.Add(dataPO.CheckPointScores[index]); } maxShakeCount = dataPO.ShakeTimes; maxTriggerCount = dataPO.WaterTime; maxAoeScore = dataPO.AOEScores; return(true); }