private void OnClick_ownShop(GameObject obj)
        {
            this.handlingRItem = null;
            EBattleShopType nearestShopType = BattleEquipTools_op.GetNearestShopType();

            MobaMessageManagerTools.BattleShop_openBattleShop(nearestShopType, EBattleShopOpenType.eFromButton);
        }
Exemple #2
0
        public static TeamType ShopType2TeamType(EBattleShopType e)
        {
            TeamType result = TeamType.None;

            switch (e)
            {
            case EBattleShopType.eLM:
                result = TeamType.LM;
                break;

            case EBattleShopType.eBL:
                result = TeamType.BL;
                break;

            case EBattleShopType.eNeutral:
            case EBattleShopType.eNeutral_2:
                result = TeamType.Neutral;
                break;

            case EBattleShopType.eTeam3:
                result = TeamType.Team_3;
                break;
            }
            return(result);
        }
Exemple #3
0
        public static bool GetShopIDListByScene(string levelID, EBattleShopType type, out Dictionary <EBattleShopType, ShopInfo> shopIDList)
        {
            bool result = false;

            shopIDList = new Dictionary <EBattleShopType, ShopInfo>();
            SysBattleSceneVo sysBattleSceneVo;

            if (BattleEquipTools_config.GetBattleSceneVo(levelID, out sysBattleSceneVo))
            {
                string shop_id = sysBattleSceneVo.shop_id;
                if (!string.IsNullOrEmpty(shop_id))
                {
                    string[] array = shop_id.Split(new char[]
                    {
                        ','
                    });
                    for (int i = 0; i < array.Length; i++)
                    {
                        SysBattleShopVo sysBattleShopVo = null;
                        if (BattleEquipTools_config.GetBattelShopVo(array[i], out sysBattleShopVo))
                        {
                            if ((sysBattleShopVo.type == (int)type || sysBattleShopVo.type == 3 || sysBattleShopVo.type == 5) && !shopIDList.ContainsKey((EBattleShopType)sysBattleShopVo.type))
                            {
                                shopIDList.Add((EBattleShopType)sysBattleShopVo.type, new ShopInfo(sysBattleShopVo, false));
                            }
                        }
                    }
                    result = true;
                }
            }
            return(result);
        }
 public static void BattleShop_openBattleShop(EBattleShopType shopType, EBattleShopOpenType openType)
 {
     MobaMessageManagerTools.SendClientMsg(ClientV2C.BattleShop_openShop, new object[]
     {
         shopType,
         openType
     }, false);
 }
Exemple #5
0
        public ShopInfo GetShopByType(EBattleShopType type)
        {
            ShopInfo result = null;

            if (this.supportShops.ContainsKey(type))
            {
                result = this.supportShops[type];
            }
            return(result);
        }
Exemple #6
0
        public static ShopInfo Get_BattleShop_shopInfo(this ModelManager mmng, EBattleShopType type)
        {
            ShopInfo result = null;
            Dictionary <EBattleShopType, ShopInfo> dictionary = mmng.Get_BattleShop_shops();

            if (dictionary.ContainsKey(type))
            {
                result = dictionary[type];
            }
            return(result);
        }
 private void RefreshUI_CloseShopView()
 {
     if (Singleton <BattleEquipmentView> .Instance.IsOpened)
     {
         bool            flag     = ModelManager.Instance.Get_BattleShop_playerAlive();
         ShopInfo        shopInfo = ModelManager.Instance.Get_BattleShop_openShop();
         bool            inArea   = shopInfo.InArea;
         EBattleShopType shopType = shopInfo.ShopType;
         if ((shopType == EBattleShopType.eNeutral || shopType == EBattleShopType.eNeutral_2) && (!flag || !inArea))
         {
             this.CloseView_ShopView();
         }
     }
 }
 private void OnMainPlayerHitted()
 {
     if (Singleton <BattleEquipmentView> .Instance.IsOpened)
     {
         ShopInfo shopInfo = ModelManager.Instance.Get_BattleShop_openShop();
         if (shopInfo != null)
         {
             EBattleShopType shopType = shopInfo.ShopType;
             if (shopType == EBattleShopType.eNeutral || shopType == EBattleShopType.eNeutral_2)
             {
                 this.CloseView_ShopView();
             }
         }
     }
 }
        public static EBattleShopType GetNearestShopType()
        {
            Dictionary <EBattleShopType, ShopInfo> dictionary = ModelManager.Instance.Get_BattleShop_shops();
            List <ShopInfo> list            = null;
            EBattleShopType eBattleShopType = EBattleShopType.eNone;

            if (BattleEquipTools_op.IsPlayerAlive())
            {
                list = new List <ShopInfo>();
                foreach (KeyValuePair <EBattleShopType, ShopInfo> current in dictionary)
                {
                    if (current.Value.InArea)
                    {
                        list.Add(current.Value);
                    }
                }
                if (list.Count > 0)
                {
                    if (list.Count > 1)
                    {
                        float num    = 1E+07f;
                        float num2   = 0f;
                        Units player = MapManager.Instance.GetPlayer();
                        foreach (ShopInfo current2 in list)
                        {
                            BattleEquipTools_op.IsWithInShopArea(current2.Config, player, out num2);
                            if (num2 < num)
                            {
                                num             = num2;
                                eBattleShopType = current2.ShopType;
                            }
                        }
                    }
                    else
                    {
                        eBattleShopType = list[0].ShopType;
                    }
                }
            }
            if (eBattleShopType == EBattleShopType.eNone)
            {
                eBattleShopType = BattleEquipTools_op.GetShopTypeByTeamType();
            }
            return(eBattleShopType);
        }
        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);
            }
        }
    public static void BattleShop_initData(bool reBack, EBattleShopContex e, string levelID, EBattleShopType teamType, bool bQuickR)
    {
        MsgData_BattleShop_initData param = new MsgData_BattleShop_initData
        {
            reBack       = reBack,
            eBattleType  = e,
            levelID      = levelID,
            teamType     = teamType,
            enableQuickR = bQuickR
        };

        MobaMessageManagerTools.SendClientMsg(ClientC2C.BattleShop_initData, param, false);
    }