Example #1
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);
            }
        }