示例#1
0
 public void Clear()
 {
     this.inArea      = false;
     this.config      = null;
     this.dealCounter = 0;
     this.state       = EBattleShopState.eIdle;
     this.pveStack    = null;
 }
示例#2
0
        private void OnMsg_BattleShop_waitServerMsgTimeOut(MobaMessage msg)
        {
            EBattleShopState eBattleShopState = (EBattleShopState)((int)msg.Param);

            if (eBattleShopState != EBattleShopState.eIdle)
            {
                string message = "服务器消息未返回,等待超时 state=" + eBattleShopState.ToString();
                ClientLogger.Error(message);
            }
        }
示例#3
0
 public ShopInfo(SysBattleShopVo con, bool inA = false)
 {
     this.bOpen       = false;
     this.inArea      = inA;
     this.config      = con;
     this.dealCounter = 0;
     this.state       = EBattleShopState.eIdle;
     this.pveStack    = new Stack <RollbackInfo>();
     this.ShopItems   = BattleEquipTools_config.GetShopItems(con);
 }
        private void OnMsg_BattleShop_shopStateChanged(MobaMessage msg)
        {
            EBattleShopState eBattleShopState = (EBattleShopState)((int)msg.Param);

            if (this.shopState != eBattleShopState)
            {
                this.shopState = eBattleShopState;
                this.RefreshUI_btnBuy();
                this.RefreshUI_btnSell();
                this.RefreshUI_btnRollback();
            }
        }
示例#5
0
        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 InitData()
        {
            this.curPosseessItem = ModelManager.Instance.Get_BattleShop_curPItem();
            this.curShopItem     = ModelManager.Instance.Get_BattleShop_curSItem();
            this.tItem           = ModelManager.Instance.Get_BattleShop_curTItem();
            this.wallet          = ModelManager.Instance.Get_BattleShop_money();
            this.playerAlive     = ModelManager.Instance.Get_BattleShop_playerAlive();
            ShopInfo shopInfo = ModelManager.Instance.Get_BattleShop_openShop();

            this.brawlCanBuy = ModelManager.Instance.Get_BattleShop_brawlCanBuy();
            if (shopInfo != null)
            {
                this.withDistance = shopInfo.InArea;
                this.dealCounter  = shopInfo.DealCounter;
                this.shopState    = shopInfo.State;
            }
        }
示例#7
0
        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);
            }
        }
 public MsgData_BattelShop_setShopState(TeamType type, EBattleShopState state)
 {
     this.shopType  = type;
     this.shopState = state;
 }
示例#9
0
        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);
            }
        }