private void OnMsg_BattleShop_clickRItem(MobaMessage msg) { RItemData rItemData = msg.Param as RItemData; ShopInfo curShopInfo; if (!BattleEquipTools_op.IsPlayerAlive()) { curShopInfo = rItemData.GetShopByType(BattleEquipTools_op.GetShopTypeByTeamType()); } else { curShopInfo = rItemData.GetAvailableShop(); } MsgData_BattleShop_buy buyInfo = new MsgData_BattleShop_buy(rItemData, BuyingEquipType.eRecommend, curShopInfo); this.DoBuy(buyInfo); }
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); }