public bool IsPassWorldWithId(int stage) { var modeId = CampaignModeConfig.GetModeId(stage); var mode = GetModeCampaignWithId(modeId); return(mode.IsPassModeWithStage(stage)); }
public CampaignModeConfig GetModeCampaignWithStageId(int stageId) { var id = CampaignModeConfig.GetModeId(stageId); for (int i = 0; i < modeConfigList.Count; i++) { if (id == modeConfigList[i].modeId) { return(modeConfigList[i]); } } return(null); }
public void Convert() { if (dataGroups.Length > 0) { var modeCount = CampaignModeConfig.GetModeId(dataGroups[dataGroups.Length - 1].stage); var modeConfigList = new CampaignWorldConfig(); for (int i = 0; i < modeCount; i++) { var mode = new CampaignModeConfig(); mode.modeId = i + 1; var mapElement = new CampaignMapConfig(); mapElement.mapId = 1; mode.mapList.Add(mapElement); for (int j = 0; j < dataGroups.Length; j++) { var data = dataGroups[j]; var modeId = CampaignModeConfig.GetModeId(data.stage); if (modeId == mode.modeId) { var mapId = CampaignMapConfig.GetMapId(data.stage); if (mapId == mapElement.mapId) { mapElement.stageList.Add(data); } else { mapElement = new CampaignMapConfig(); mapElement.mapId = mapId; mapElement.stageList.Add(data); mode.mapList.Add(mapElement); } } } modeConfigList.modeConfigList.Add(mode); } worldConfig = modeConfigList; } }
public CampaignStageData GetNextStage(int lastStage) { var modeId = CampaignModeConfig.GetModeId(lastStage); // check mode with current stage var mode = GetModeCampaignWithId(modeId); if (mode == null) { return(null); } // check map with current stage var mapId = CampaignMapConfig.GetMapId(lastStage); var map = mode.GetMapWithId(mapId); if (map == null) { return(null); } var stage = map.GetNextStage(lastStage); if (stage != null) { return(stage); } // check stage in next map mapId += 1; map = mode.GetMapWithId(mapId); if (map == null) { // if not exist next map, check stage in next mode modeId += 1; mode = GetModeCampaignWithId(modeId); if (mode == null) { return(null); } map = mode.GetMapWithId(1); if (map == null) { return(null); } stage = map.GetNextStage(lastStage); if (stage != null) { return(stage); } } else { stage = map.GetNextStage(lastStage); if (stage != null) { return(stage); } } return(null); }