Esempio n. 1
0
    /// <summary>
    /// ロード
    /// </summary>
    private void Load()
    {
        //ワールドID順に並び変えておく
        this.response.tSingleWorld = this.response.tSingleWorld.OrderBy(x => x.worldId).ToArray();

        //ワールドデータ
        this.worldData = new WorldData[this.response.tSingleWorld.Length];

        for (int i = 0; i < this.worldData.Length; i++)
        {
            uint worldId = this.response.tSingleWorld[i].worldId;
            this.worldData[i] = new WorldData();
            this.worldData[i].worldServerData = this.response.tSingleWorld[i];
            this.worldData[i].worldMasterData = Masters.SingleWorldDB.FindById(worldId);
            this.worldData[i].stageMasterData = Masters.SingleStageDB.GetList().Where(x => x.worldId == worldId).ToArray();
        }

        for (int i = 0; i < this.worldData.Length; i++)
        {
            /*uint worldId = this.response.tSingleWorld[i].worldId;
             * this.worldData[i] = new WorldData();
             * this.worldData[i].worldServerData = this.response.tSingleWorld[i];
             * this.worldData[i].worldMasterData = Masters.SingleWorldDB.FindById(worldId);
             * this.worldData[i].stageMasterData = Masters.SingleStageDB.GetList().Where(x => x.worldId == worldId).ToArray();*/
            this.worldData[i].stageServerData = this.worldData[i].stageMasterData
                                                .Select(stageMaster =>
            {
                var result = this.response.tSingleStage.FirstOrDefault(stageServer => stageServer.stageId == stageMaster.id);
                if (result == null)
                {
                    result             = new SinglePlayApi.TSingleStage();
                    result.stageId     = stageMaster.id;
                    result.stageStatus = (uint)SinglePlayApi.Status.NotOpen;
                    result.clearRank   = (uint)Rank.None;
                }
                else if (stageMaster.type == (uint)Master.SingleStageData.StageType.Battle && result.IsOpen())
                {
                    this.loader.Add <Sprite>(SharkDefine.GetSingleStageIconSpritePath(stageMaster.key));
                }
                return(result);
            })
                                                .ToArray();

            if (this.worldData[i].worldMasterData.isComingSoon > 0)
            {
                //ComingSoonワールドの場合、ComingSoonじゃないワールドの背景を利用する
                var prev = this.worldData.Last(x => x.worldMasterData.isComingSoon == 0);
                this.worldData[i].bgAssetLoader = prev.bgAssetLoader;
            }
            else
            {
                //背景の読み込み
                string bgPath = SharkDefine.GetStageSelectBgSpritePath(this.worldData[i].worldMasterData.key);
                this.loader.Add(this.worldData[i].bgAssetLoader = new AssetLoader <Sprite>(bgPath));
            }
        }

        //ロード実行
        this.loader.Load(this.OnLoaded);
    }
Esempio n. 2
0
    /// <summary>
    /// 内容構築
    /// </summary>
    public void Set(
        Master.SingleStageData master,
        SinglePlayApi.TSingleStage server,
        int battleStageIndex,
        bool isLastStage,
        Action <SingleStagePanel> onClick)
    {
        this.master  = master;
        this.server  = server;
        this.onClick = onClick;

        //解放済みかどうかでボタンとして押せるか押せないか切り替え
        this.button.interactable = this.isOpen;

        //状態による表示切替
        this.battleBase.gameObject.SetActive(this.isBattle);
        this.storyBase.gameObject.SetActive(this.isStory);
        this.lockImage.enabled = !this.isOpen;
        this.fishImage.enabled = this.isOpen;
        this.starMarkGroup.SetActive(this.isOpen);

        //クリアランクでの星数表示
        if (this.starMarkGroup.activeInHierarchy)
        {
            for (int i = 0; i < this.starMarks.Length; i++)
            {
                this.starMarks[i].enabled = i < (int)this.server.clearRank - 2;
            }
        }

        //ロックの場合グレースケール表示
        foreach (var graphic in this.grayScaleTargets)
        {
            graphic.material = this.isOpen ? null : SharedUI.Instance.grayScaleMaterial;
        }

        //最終ステージ以外はラインを表示
        this.line.SetActive(!isLastStage);

        //バトルステージ番号
        this.stageNoText.text = (battleStageIndex < 0) ? null : (battleStageIndex + 1).ToString();

        if (this.isBattle && this.isOpen)
        {
            //バトルステージの魚アイコン切り替え
            this.fishImage.sprite = AssetManager.FindHandle <Sprite>(SharkDefine.GetSingleStageIconSpritePath(this.master.key)).asset as Sprite;
        }
    }