Пример #1
0
    public void OnBuyFootballBtnClick()
    {
        Game.Instance.sound.PlayEffect("Se_UI_Button");
        state = gm.CheckItemState(selectIndex);
        switch (state)
        {
        case ItemState.Buy:
            //装备物品
            BuyFootballArgs ee = new BuyFootballArgs
            {
                Index = selectIndex
            };
            SendEvent(Const.E_EquipFootball, ee);
            break;

        case ItemState.UnBuy:
            //发起购买
            BuyFootballArgs e = new BuyFootballArgs
            {
                Coin  = Game.Instance.staticData.GetFootballInfo(selectIndex).coin,
                Index = selectIndex
            };
            SendEvent(Const.E_BuyFootball, e);
            break;

        case ItemState.Equiped:
            break;

        default:
            break;
        }
    }
Пример #2
0
    public override void Execute(object data)
    {
        GameModel       gm   = GetModel <GameModel>();
        UIShop          shop = GetView <UIShop>();
        BuyFootballArgs e    = data as BuyFootballArgs;

        gm.TakeonFootball = e.Index;
        shop.UpdateUI();
        shop.UpdateFootballBuyBtn(e.Index);
        //更新Gizmo
        shop.UpdateFootBallGizmo();
    }
Пример #3
0
    public override void Execute(object data)
    {
        GameModel       gm   = GetModel <GameModel>();
        UIShop          shop = GetView <UIShop>();
        BuyFootballArgs e    = data as BuyFootballArgs;

        if (gm.PayCoin(e.Coin))
        {
            //把当前id加入已购买列表
            gm.BuyFootball.Add(e.Index);
            foreach (var item in gm.BuyFootball)
            {
                Debug.Log("买了" + item + "号");
            }
            //更新UI
            shop.UpdateUI();
            shop.UpdateFootballBuyBtn(e.Index);
            //更新GIzmo
            shop.UpdateFootBallGizmo();
        }
    }