/// <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);
        });
    }
Beispiel #2
0
    /// <summary>
    /// マスターからProductBaseを生成
    /// </summary>
    public static ProductBase Create(Master.ModelBase master, uint buyCount)
    {
        ProductBase product      = null;
        ItemType    mainItemType = 0;

        if (master is Master.BillingData)
        {
            var billingData = master as Master.BillingData;
            mainItemType = (ItemType)Masters.BillingItemDB
                           .GetList()
                           .Find(x => x.billingItemId == billingData.billingItemId)
                           .itemType;
        }
        else if (master is Master.ShopData)
        {
            var shopData = master as Master.ShopData;
            mainItemType = (ItemType)Masters.ShopItemDB
                           .GetList()
                           .Find(x => x.shopItemId == shopData.shopItemId)
                           .itemType;
        }

        if (productTypeDatas.ContainsKey((int)mainItemType))
        {
            product          = productTypeDatas[(int)mainItemType](master);
            product.buyCount = buyCount;

            if (product.payType == 0 && master is Master.ShopData)
            {
                Debug.LogWarningFormat("未対応の支払いタイプが設定されている:{0}:{1}", product.master.GetType(), product.master.id);
                product = null;
            }
        }

        return(product);
    }
Beispiel #3
0
 /// <summary>
 /// construct
 /// </summary>
 protected ProductBase(Master.ModelBase master)
 {
     this.master = master;
 }
    /// <summary>
    /// セットアップ
    /// </summary>
    private void Setup(SimpleDialog dialog, List <FishDataEx> fishDataList, AssetListLoader loader,  Master.ModelBase master)
    {
        this.dialog       = dialog;
        this.fishDataList = fishDataList;
        this.loader       = loader;

        //シングルモード内容構築
        if (master is Master.SingleStageData)
        {
            var stageData = master as Master.SingleStageData;
            //ワールド名
            this.worldNameText.text = Masters.SingleWorldDB.FindById(stageData.worldId).name;
            //ステージ名
            this.stageNameText.text = stageData.name;
            //特殊魚マーク表示OFF
            this.focusedFishSubTextBg.gameObject.SetActive(false);
            // シングルワールドマスターデータキー
            var worldKey = Masters.SingleWorldDB.FindById(stageData.worldId).key;
            // 図鑑の背景イメージ、パース
            string spritePath = SharkDefine.GetZukanBgSpritePath(worldKey);
            // 図鑑の背景イメージ、ロード
            this.worldBgImage.sprite = this.loader[spritePath].handle.asset as Sprite;
        }
        //マルチモード内容構築
        else if (master is Master.MultiWorldData)
        {
            var worldData = master as Master.MultiWorldData;
            //ワールド名
            this.worldNameText.text = worldData.name;
            //ステージ名非表示
            this.stageNameText.gameObject.SetActive(false);
            // 図鑑の背景イメージ、パース
            string spritePath = SharkDefine.GetZukanBgSpritePath(worldData.key);
            // 図鑑の背景イメージ、ロード
            this.worldBgImage.sprite = this.loader[spritePath].handle.asset as Sprite;
        }

        //ダイアログタイトル「図鑑」
        this.dialog.titleText.text = Masters.LocalizeTextDB.Get("Dictionary");

        //Closeボタン表示ON
        this.dialog.closeButtonEnabled = true;

        //ワールド名、ステージ名の幅に合わせてレイアウト調整
        LayoutRebuilder.ForceRebuildLayoutImmediate(this.nameArea);

        //初期フォーカス魚設定
        if (this.fishDataList.Count > 0)
        {
            this.SetFocusedFish(this.fishDataList[0]);
        }

        //スクロールビュー構築
        this.scrollView.Initialize(
            this.thumbnailIconPrefab.gameObject,
            this.fishDataList.Count,
            this.OnUpdateFishThumbnailIconView
            );
    }