Beispiel #1
0
    public override void Execute(object data)
    {
        GameModel   gm   = GetModel <GameModel>();
        UIShop      shop = GetView <UIShop>();
        BuySkinArgs e    = data as BuySkinArgs;

        gm.TakeonSkin = e.ID;
        //更新UI
        shop.UpdateUI();
        shop.UpdateSkinBuyBtn(e.ID.SkinID);
        //更新Gizmo
        shop.UpdateSkinGizmo();
    }
Beispiel #2
0
    public void OnBuyClothBtnClick()
    {
        Game.Instance.sound.PlayEffect("Se_UI_Button");
        SkinId id = new SkinId
        {
            SkinID  = gm.TakeonSkin.SkinID,
            ClothID = selectIndex
        };

        state = gm.CheckClothState(id);
        switch (state)
        {
        case ItemState.Buy:
            //装备物品
            BuySkinArgs e = new BuySkinArgs
            {
                Coin = Game.Instance.staticData.GetPlayerSkinInfo(gm.TakeonSkin.SkinID, selectIndex).coin,
                ID   = new SkinId {
                    SkinID = gm.TakeonSkin.SkinID, ClothID = selectIndex
                }
            };
            SendEvent(Const.E_EquipCloth, e);
            break;

        case ItemState.UnBuy:
            //发起购买
            BuySkinArgs ee = new BuySkinArgs
            {
                Coin = Game.Instance.staticData.GetPlayerSkinInfo(gm.TakeonSkin.SkinID, selectIndex).coin,
                ID   = new SkinId {
                    SkinID = gm.TakeonSkin.SkinID, ClothID = selectIndex
                }
            };
            SendEvent(Const.E_BuyCloth, ee);
            break;

        case ItemState.Equiped:
            break;

        default:
            break;
        }
    }
Beispiel #3
0
    public override void Execute(object data)
    {
        GameModel   gm   = GetModel <GameModel>();
        UIShop      shop = GetView <UIShop>();
        BuySkinArgs e    = data as BuySkinArgs;

        if (gm.PayCoin(e.Coin))
        {
            //把当前id加入已购买列表
            gm.BuySkin.Add(e.ID);
            foreach (var item in gm.BuySkin)
            {
                Debug.Log("买了" + item.SkinID + "号皮肤" + item.ClothID + "号衣服");
            }
            //更新UI
            shop.UpdateUI();
            shop.UpdateClothBuyBtn(e.ID.ClothID);

            //更新GIzmo
            shop.UpdateClothGizmo();
        }
    }
Beispiel #4
0
    public void OnBuySkinBtnClick()
    {
        Game.Instance.sound.PlayEffect("Se_UI_Button");
        state = gm.CheckSkinState(selectIndex);
        switch (state)
        {
        case ItemState.Buy:
            //装备物品
            BuySkinArgs e = new BuySkinArgs
            {
                Coin = Game.Instance.staticData.GetPlayerSkinInfo(selectIndex, 0).coin,
                ID   = new SkinId {
                    SkinID = selectIndex, ClothID = 0
                }
            };
            SendEvent(Const.E_EquipSkin, e);
            break;

        case ItemState.UnBuy:
            //发起购买
            BuySkinArgs ee = new BuySkinArgs
            {
                Coin = Game.Instance.staticData.GetPlayerSkinInfo(selectIndex, 0).coin,
                ID   = new SkinId {
                    SkinID = selectIndex, ClothID = 0
                }
            };
            SendEvent(Const.E_BuySkin, ee);
            break;

        case ItemState.Equiped:
            break;

        default:
            break;
        }
    }