Exemple #1
0
    /// <summary>
    /// セットアップ
    /// </summary>
    public void Setup(FishDataEx fishData, bool isSelected, Action <FishThumbnailIcon> onClick)
    {
        //選択中マーク
        this.selectedImage.enabled = isSelected;

        if (this.fishData == fishData)
        {
            return;
        }

        this.fishData = fishData;

        //魚の名前
        this.nameText.text = this.fishData.Item1.name;

        //クリック時コールバック設定
        this.onClick = onClick;

        //特殊魚かどうか
        bool isSpecialFish = false;

        //マルチモードの場合
        if (this.fishData.Item2 is Master.MultiStageFishData)
        {
            var multiFishStatus = this.fishData.Item2 as Master.MultiStageFishData;
            if (isSpecialFish = multiFishStatus.specialFishId > 0)
            {
                this.subText.text = Masters.LocalizeTextDB.Get("Special");
            }
            else
            {
                this.subText.text = Masters.LocalizeTextDB.GetFormat("Rate", multiFishStatus.rate * 0.01f);
            }
        }

        //特殊魚の場合赤い下地
        if (isSpecialFish)
        {
            this.bgImage.sprite     = SharedUI.Instance.commonAtlas.GetSprite("CmFrm_010_0033");
            this.shadowImage.sprite = SceneChanger.currentScene.sceneAtlas.GetSprite("SsCm_020_0003");
            this.frameImage.sprite  = SceneChanger.currentScene.sceneAtlas.GetSprite("SsCm_020_0004");
        }
        //普通魚の場合青い下地
        else
        {
            this.bgImage.sprite     = SharedUI.Instance.commonAtlas.GetSprite("CmFrm_010_0030");
            this.shadowImage.sprite = SceneChanger.currentScene.sceneAtlas.GetSprite("SsCm_020_0001");
            this.frameImage.sprite  = SceneChanger.currentScene.sceneAtlas.GetSprite("SsCm_020_0002");
        }

        //スプライトのパス
        string spritePath = SharkDefine.GetFishThumbnailSpritePath(this.fishData.Item1.key);

        //ロード済みのはずのスプライトでセット
        this.thumbnailImage.sprite = AssetManager.FindHandle <Sprite>(spritePath).asset as Sprite;
    }
    /// <summary>
    /// フォーカス中魚をセットする
    /// </summary>
    private void SetFocusedFish(FishDataEx fishData)
    {
        this.focusedFishData = fishData;

        //魚の名前
        this.focusedFishNameText.text = fishData.Item1.name;

        //魚の説明文
        this.focusedFishDescriptionText.text = fishData.Item1.description;

        //マルチ魚だったら
        if (fishData.Item2 is Master.MultiStageFishData)
        {
            var multiFishStatus = fishData.Item2 as Master.MultiStageFishData;
            if (multiFishStatus.specialFishId > 0)
            {
                //特殊魚の場合「特殊」表示
                this.focusedFishSubTextBg.sprite = SceneChanger.currentScene.sceneAtlas.GetSprite("SsCm_020_0011");
                this.focusedFishSubText.text     = Masters.LocalizeTextDB.Get("Special");
                this.focusedFishSubText.color    = this.specialFishTextColor;
            }
            else
            {
                //普通魚の場合「{0}倍」表示
                this.focusedFishSubTextBg.sprite = SceneChanger.currentScene.sceneAtlas.GetSprite("SsCm_020_0010");
                this.focusedFishSubText.text     = Masters.LocalizeTextDB.GetFormat("Rate", multiFishStatus.rate * 0.01f);
                this.focusedFishSubText.color    = this.normalFishTextColor;
            }
        }

        //スプライトのパス
        string spritePath = SharkDefine.GetFishThumbnailSpritePath(this.focusedFishData.Item1.key);

        //スプライトセット
        this.focusedFishImage.sprite = this.loader[spritePath].handle.asset as Sprite;
    }
    /// <summary>
    /// 開く
    /// </summary>
    public static void Open(SingleStageFishDictionaryDialogContent prefab, Master.ModelBase master)
    {
        List <FishDataEx> fishDataList = null;
        string            worldKey     = null;

        //シングルモードの場合
        if (master is Master.SingleStageData)
        {
            var stageData = master as Master.SingleStageData;

            fishDataList = Masters.SingleStageFishDB
                           .GetList()
                           .Where(x => x.stageId == stageData.id)
                           .Select(x => new FishDataEx(Masters.FishDB.FindById(x.fishId), x))
                           .ToList();

            worldKey = Masters.SingleWorldDB.FindById(stageData.worldId).key;
        }
        //マルチモードの場合
        else if (master is Master.MultiWorldData)
        {
            var worldData = master as Master.MultiWorldData;

            fishDataList = Masters.MultiStageFishDB
                           .GetList()
                           .Where(x => x.worldId == worldData.id)
                           .Select(x => new FishDataEx(Masters.FishDB.FindById(x.fishId), x))
                           .ToList();

            worldKey = worldData.key;
        }

        var loader = new AssetListLoader(fishDataList.Select(x => new AssetLoader <Sprite>(SharkDefine.GetFishThumbnailSpritePath(x.Item1.key))));

        loader.Add <Sprite>(SharkDefine.GetZukanBgSpritePath(worldKey));

        //ロード中のタッチブロック
        SharedUI.Instance.DisableTouch();

        //ロード
        loader.Load(() =>
        {
            //タッチブロック解除
            SharedUI.Instance.EnableTouch();

            //ダイアログ開く
            var dialog  = SharedUI.Instance.ShowSimpleDialog();
            var content = dialog.AddContent(prefab);
            content.Setup(dialog, fishDataList, loader, master);
        });
    }