コード例 #1
0
    public bool IsPassWorldWithId(int stage)
    {
        var modeId = CampaignModeConfig.GetModeId(stage);
        var mode   = GetModeCampaignWithId(modeId);

        return(mode.IsPassModeWithStage(stage));
    }
コード例 #2
0
    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);
    }
コード例 #3
0
    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;
        }
    }
コード例 #4
0
    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);
    }