Exemple #1
0
        private void OnMsg_BattleShop_onOP(MobaMessage msg)
        {
            MsgData_BattleShop_onOP msgData_BattleShop_onOP = msg.Param as MsgData_BattleShop_onOP;

            if (msgData_BattleShop_onOP != null)
            {
                switch (msgData_BattleShop_onOP.op)
                {
                case EBattleShopOP.eOpen:
                    this.OnOpen(msgData_BattleShop_onOP);
                    break;

                case EBattleShopOP.eClose:
                    this.OnClose(msgData_BattleShop_onOP);
                    break;

                case EBattleShopOP.eBuy:
                    this.OnBuy(msgData_BattleShop_onOP);
                    break;

                case EBattleShopOP.eSell:
                    this.OnSell(msgData_BattleShop_onOP);
                    break;

                case EBattleShopOP.eRevert:
                    this.OnRevert(msgData_BattleShop_onOP);
                    break;
                }
            }
        }
Exemple #2
0
 private void OnClose(MsgData_BattleShop_onOP param)
 {
     if (this.OpenShop != null)
     {
         this.PreOpenShop = this.OpenShop;
         this.OpenShop    = null;
     }
 }
        private void CloseView_ShopView()
        {
            MsgData_BattleShop_onOP param = new MsgData_BattleShop_onOP
            {
                op = EBattleShopOP.eClose
            };

            MobaMessageManagerTools.SendClientMsg(ClientC2C.BattleShop_onOP, param, false);
            CtrlManager.CloseWindow(WindowID.BattleEquipmentView);
        }
Exemple #4
0
        private void OnRevert(MsgData_BattleShop_onOP param)
        {
            Dictionary <EBattleShopType, ShopInfo> shops = this.Shops;

            if (shops.ContainsKey(param.shopType))
            {
                ShopInfo shopInfo = shops[param.shopType];
                shopInfo.State            = EBattleShopState.eRollBack;
                this.DealingShop          = shopInfo;
                this.onWaitingTaskTimeout = new Action(this.OnTimeOut);
                this.StartWaitCoroutine();
            }
        }
Exemple #5
0
        private void OnSell(MsgData_BattleShop_onOP param)
        {
            Dictionary <EBattleShopType, ShopInfo> shops = this.Shops;

            if (shops.ContainsKey(param.shopType))
            {
                ShopInfo shopInfo = shops[param.shopType];
                shopInfo.State            = EBattleShopState.eSelling;
                this.DealingShop          = shopInfo;
                this.CurHItem             = param.targetItem;
                this.data.CurRollbackInfo = this.GetCurRollbackInfo(param);
                this.onWaitingTaskTimeout = new Action(this.OnTimeOut);
                this.StartWaitCoroutine();
            }
        }
        private void DoSell(MsgData_BattleShop_sell sellInfo)
        {
            string text = null;

            if (sellInfo == null || sellInfo.curShop == null)
            {
                text = BattleEquipTools_config.Notice_SystemError;
            }
            else if (sellInfo.targetItem == null)
            {
                text = BattleEquipTools_config.Notice_SystemError;
            }
            else
            {
                EBattleShopState state = sellInfo.curShop.State;
                if (state != EBattleShopState.eIdle)
                {
                    text = BattleEquipTools_config.Notice_ShopBusy;
                }
            }
            if (text == null)
            {
                ItemInfo targetItem           = sellInfo.targetItem;
                MsgData_BattleShop_onOP param = new MsgData_BattleShop_onOP
                {
                    op         = EBattleShopOP.eSell,
                    shopType   = sellInfo.curShop.ShopType,
                    targetItem = targetItem.ID,
                    itemInfo   = targetItem
                };
                MobaMessageManagerTools.SendClientMsg(ClientC2C.BattleShop_onOP, param, false);
                List <string> recommendItems = ModelManager.Instance.Get_BattleShop_rItems();
                if (BattleEquipTools_op.IsOnLineBattle())
                {
                    BattleEquipTools_op.DoPvpSell(sellInfo.curShop, targetItem, recommendItems);
                }
                else
                {
                    Units           player        = MapManager.Instance.GetPlayer();
                    List <ItemInfo> possessItemsP = ModelManager.Instance.Get_BattleShop_pItems();
                    BattleEquipTools_op.DoPveSell(sellInfo.curShop, player, targetItem, possessItemsP);
                }
            }
            else if (!text.Equals(BattleEquipTools_config.Notice_ShopBusy))
            {
                Singleton <TipView> .Instance.ShowViewSetText(text, 1f);
            }
        }
        private void DoRollback(MsgData_BattleShop_rollback rollbackInfo)
        {
            ShopInfo shopInfo = null;
            string   text     = null;

            if (rollbackInfo == null || rollbackInfo.curShop == null)
            {
                text = BattleEquipTools_config.Notice_outOfShoppingArea;
            }
            else
            {
                shopInfo = rollbackInfo.curShop;
                EBattleShopState state = shopInfo.State;
                if (state != EBattleShopState.eIdle)
                {
                    text = BattleEquipTools_config.Notice_ShopBusy;
                }
            }
            if (string.IsNullOrEmpty(text))
            {
                MsgData_BattleShop_onOP param = new MsgData_BattleShop_onOP
                {
                    op       = EBattleShopOP.eRevert,
                    shopType = shopInfo.ShopType
                };
                MobaMessageManagerTools.SendClientMsg(ClientC2C.BattleShop_onOP, param, false);
                if (BattleEquipTools_op.IsOnLineBattle())
                {
                    BattleEquipTools_op.DoPvpRollback();
                }
                else
                {
                    Units player = MapManager.Instance.GetPlayer();
                    BattleEquipTools_op.DoPveRollback(shopInfo, player);
                }
            }
            else if (!text.Equals(BattleEquipTools_config.Notice_ShopBusy))
            {
                Singleton <TipView> .Instance.ShowViewSetText(text, 1f);
            }
        }
        private void OpenBattleShop(EBattleShopType type, EBattleShopOpenType openType)
        {
            Units    player   = MapManager.Instance.GetPlayer();
            ShopInfo shopInfo = ModelManager.Instance.Get_BattleShop_shopInfo(type);
            string   text;

            if (BattleEquipTools_op.CanOpenBattleShop(player, shopInfo, openType, out text))
            {
                AudioMgr.PlayUI("Play_Shop_Open", null, false, false);
                MsgData_BattleShop_onOP param = new MsgData_BattleShop_onOP
                {
                    shopType = type
                };
                MobaMessageManagerTools.SendClientMsg(ClientC2C.BattleShop_onOP, param, false);
                CtrlManager.OpenWindow(WindowID.BattleEquipmentView, null);
            }
            else if (!string.IsNullOrEmpty(text))
            {
                Singleton <TipView> .Instance.ShowViewSetText(text, 1f);
            }
        }
Exemple #9
0
        private void OnOpen(MsgData_BattleShop_onOP param)
        {
            Dictionary <EBattleShopType, ShopInfo> shops = this.Shops;

            if (shops.ContainsKey(param.shopType))
            {
                ShopInfo shopInfo = shops[param.shopType];
                if (this.OpenShop != shopInfo)
                {
                    if (this.OpenShop != null)
                    {
                        this.PreOpenShop = this.OpenShop;
                    }
                    this.OpenShop = shopInfo;
                    if (this.PreOpenShop != this.OpenShop)
                    {
                        this.Update_menu(BattleEquipType.recommend);
                        this.Update_curSItem(null);
                        this.Update_sItems();
                    }
                }
            }
        }
        private void DoBuy(MsgData_BattleShop_buy buyInfo)
        {
            string          text     = string.Empty;
            ShopInfo        shopInfo = null;
            bool            flag     = ModelManager.Instance.Get_BattleShop_playerAlive();
            int             num      = ModelManager.Instance.Get_BattleShop_money();
            List <ItemInfo> list     = ModelManager.Instance.Get_BattleShop_pItems();
            string          text2    = null;

            if (buyInfo == null || !buyInfo.Valid)
            {
                text2 = BattleEquipTools_config.Notice_outOfShoppingArea;
            }
            else
            {
                shopInfo = buyInfo.CurShop;
                EBattleShopState state = shopInfo.State;
                if (state != EBattleShopState.eIdle)
                {
                    text2 = BattleEquipTools_config.Notice_ShopBusy;
                }
                else if (!ModelManager.Instance.Get_BattleShop_brawlCanBuy())
                {
                    text2 = BattleEquipTools_config.Notice_brawl;
                }
                else if (num < buyInfo.RealPrice)
                {
                    text2 = BattleEquipTools_config.Notice_DeficientMoney;
                }
                else if (list.Count >= 6 && !buyInfo.Cheaper)
                {
                    text2 = BattleEquipTools_config.Notice_DeficientSpace;
                }
                else if (flag && !shopInfo.InArea)
                {
                    text2 = BattleEquipTools_config.Notice_outOfShoppingArea;
                }
                else
                {
                    text = buyInfo.TargetID;
                }
            }
            if (text2 == null)
            {
                AudioMgr.PlayUI("Play_Shop_Buy", null, false, false);
                MsgData_BattleShop_onOP param = new MsgData_BattleShop_onOP
                {
                    op         = EBattleShopOP.eBuy,
                    shopType   = shopInfo.ShopType,
                    targetItem = text,
                    realPrice  = buyInfo.RealPrice
                };
                MobaMessageManagerTools.SendClientMsg(ClientC2C.BattleShop_onOP, param, false);
                if (BattleEquipTools_op.IsOnLineBattle())
                {
                    BattleEquipTools_op.DoPvpBuy(shopInfo, text);
                }
                else
                {
                    Units player = MapManager.Instance.GetPlayer();
                    BattleEquipTools_op.DoPveBuy(shopInfo, player, text, list, buyInfo.RealPrice);
                }
            }
            else if (!text2.Equals(BattleEquipTools_config.Notice_ShopBusy))
            {
                Singleton <TipView> .Instance.ShowViewSetText(text2, 1f);
            }
        }