public static bool IsWithInShopArea(SysBattleShopVo shopVo, Units player, out float distance)
        {
            bool result = false;

            distance = 0f;
            Vector3 a   = Vector3.zero;
            float   num = 0f;

            if (shopVo != null)
            {
                TeamType  team     = BattleEquipTools_config.ShopType2TeamType((EBattleShopType)shopVo.type);
                Transform spawnPos = MapManager.Instance.GetSpawnPos(team, shopVo.shop_origin);
                if (null != spawnPos)
                {
                    a   = spawnPos.position;
                    num = (float)shopVo.shop_range;
                }
            }
            if (null != player)
            {
                Vector3 position = player.transform.position;
                distance = Vector3.Distance(a, position);
                result   = (distance <= num);
            }
            return(result);
        }
예제 #2
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);
        }
예제 #3
0
 public void Clear()
 {
     this.inArea      = false;
     this.config      = null;
     this.dealCounter = 0;
     this.state       = EBattleShopState.eIdle;
     this.pveStack    = null;
 }
예제 #4
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);
 }
예제 #5
0
 public static bool GetBattleShopVo(string shopID, out SysBattleShopVo vo)
 {
     vo = null;
     if (!string.IsNullOrEmpty(shopID))
     {
         vo = BaseDataMgr.instance.GetDataById <SysBattleShopVo>(shopID);
         if (vo == null)
         {
             Reminder.ReminderStr("battleShop  is Null shopId" + shopID);
         }
     }
     return(vo != null);
 }
예제 #6
0
 public static bool GetBattelShopVo(string id, out SysBattleShopVo battleShop)
 {
     battleShop = null;
     if (!string.IsNullOrEmpty(id))
     {
         battleShop = BaseDataMgr.instance.GetDataById <SysBattleShopVo>(id);
         if (battleShop == null)
         {
             Reminder.ReminderStr("SysBattleShopVo配置表 找不到levelID=" + id);
         }
     }
     return(null != battleShop);
 }
예제 #7
0
        public static List <string> GetShopItems(SysBattleShopVo shopVo)
        {
            List <string> list = null;

            if (shopVo == null)
            {
                Reminder.ReminderStr("根据ID未获取到商店信息SHopID===>" + shopVo);
            }
            else if (shopVo.items == null)
            {
                Reminder.ReminderStr("商店数据为空");
            }
            else
            {
                list = new List <string>(shopVo.items.Split(new char[]
                {
                    ','
                }));
            }
            return((list == null) ? new List <string>() : list);
        }