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

        return(mode.IsPassModeWithStage(stage));
    }
コード例 #2
0
    public void InitOrUpdateView(CampaignModeConfig mode)
    {
        this.mode = mode;
        if (prefab == null)
        {
            prefab = LoadResourceController.GetCampaignMapView();
        }

        int i = 0;

        for (; i < mode.mapList.Count; i++)
        {
            if (i < mapViews.Count)
            {
                mapViews[i].SetupView(mode.mapList[i]);
            }
            else
            {
                var view = Instantiate(prefab, mapViewAnchor);
                view.SetupView(mode.mapList[i]);
                mapViews.Add(view);
                snap.AddRectTransform(view.GetComponent <RectTransform>());
            }
        }
        snap.SetupSnap(RefreshUI);
    }
コード例 #3
0
ファイル: CampaignModeView.cs プロジェクト: bac0264/Z-UIBase
    public void SetupView(CampaignModeConfig mode)
    {
        this.mode = mode;

        icon.sprite = LoadResourceController.GetCampaignModeIcon(mode.modeId);

        describeMapTxt.text = "Describe mode: " + mode.modeId;
        lengthMapTxt.text   = "Length: " + mode.mapList.Count;
    }
コード例 #4
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);
    }
コード例 #5
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;
        }
    }
コード例 #6
0
 private void Awake()
 {
     mode = LoadResourceController.GetCampaignConfigCollection()
            .GetModeCampaignWithId(DataPlayer.GetModule <PlayerCampaign>().GetModePick());
     InitOrUpdateView(mode);
 }
コード例 #7
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);
    }