Beispiel #1
0
        private void CreateTreeNode(Node <EquipmentData> parent)
        {
            string           nodeIndex = parent.NodeIndex;
            SysBattleItemsVo dataById  = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(nodeIndex);

            if (StringUtils.CheckValid(dataById.consumption))
            {
                string[] stringValue = StringUtils.GetStringValue(dataById.consumption, ',');
                if (stringValue != null)
                {
                    string[] array = stringValue;
                    for (int i = 0; i < array.Length; i++)
                    {
                        string           text      = array[i];
                        SysBattleItemsVo dataById2 = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(text);
                        if (dataById2 != null)
                        {
                            EquipmentData        data = new EquipmentData(dataById2.items_id, dataById2.sale, dataById2.sell);
                            Node <EquipmentData> node = new Node <EquipmentData>(data, parent, text, dataById2.describe);
                            parent.AddChildNode(node);
                            this.AddNode(node);
                            this.CreateTreeNode(node);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private bool callback(SysBattleItemsVo info, int depth)
        {
            bool result = depth < this._depth;

            if (depth == 0)
            {
                this._recordList.Clear();
                if (!this._addFirst)
                {
                    return(result);
                }
            }
            if (info == null)
            {
                result = false;
            }
            else if (!this._recordList.Contains(info.items_id))
            {
                if (this._limitList == null || this._limitList.Contains(info.items_id))
                {
                    this._recordList.Add(info.items_id);
                }
            }
            return(result);
        }
 public void SetEquipment(VictPlayerData playerData)
 {
     if (playerData.HeroEquipmentList == null)
     {
         return;
     }
     for (int i = 0; i < this.P_Equips.Length; i++)
     {
         if (i >= playerData.HeroEquipmentList.Count)
         {
             this.P_Equips[i].enabled = false;
         }
         else if (this.P_Equips[i].name != playerData.HeroEquipmentList[i])
         {
             if (playerData.HeroEquipmentList[i] == string.Empty)
             {
                 this.P_Equips[i].spriteName = null;
             }
             else
             {
                 SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(playerData.HeroEquipmentList[i]);
                 if (dataById != null)
                 {
                     this.P_Equips[i].spriteName = dataById.icon;
                 }
             }
         }
     }
 }
    public void RefreshEquips()
    {
        List <ItemDynData> list = null;
        Units unit = MapManager.Instance.GetUnit(this.UniqueId);

        if (unit)
        {
            list = ((Hero)unit).EquipPackage.EquipList;
        }
        for (int i = 0; i < 6; i++)
        {
            this._equipIcons[i].mainTexture = null;
            if (i < list.Count)
            {
                string           typeId   = list[i].typeId;
                SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(typeId);
                if (dataById == null)
                {
                    ClientLogger.Error("item not found for id=" + typeId);
                    return;
                }
                this._equipIcons[i].mainTexture = ResourceManager.Load <Texture>(dataById.icon, true, true, null, 0, false);
            }
        }
    }
Beispiel #5
0
    private void UpdateEquipmentList(MemberBattleInfo rankData)
    {
        if (rankData.playercounter == null || rankData.playercounter.equiplist == null)
        {
            this.Equipment.gameObject.SetActive(false);
            return;
        }
        this.Equipment.gameObject.SetActive(true);
        for (int i = 0; i < this.Equipment.transform.childCount; i++)
        {
            this.Equipment.transform.GetChild(i).gameObject.SetActive(false);
        }
        rankData.playercounter.equiplist.Remove(string.Empty);
        int num = 0;

        while (num < rankData.playercounter.equiplist.Count && num < 6)
        {
            SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(rankData.playercounter.equiplist[num]);
            if (dataById != null)
            {
                this.Equipment.transform.GetChild(num).GetComponent <UITexture>().mainTexture = ResourceManager.Load <Texture>(dataById.icon, true, true, null, 0, false);
                this.Equipment.transform.GetChild(num).gameObject.SetActive(true);
            }
            num++;
        }
    }
        private bool callback(SysBattleItemsVo info, int depth)
        {
            bool result = depth < this._depth;

            if (depth == 0)
            {
                this.equip_need.Clear();
            }
            else if (info != null)
            {
                ItemInfo target;
                int      index;
                if (BattleEquipTools_Travers.GetItem_first(this.equip_has, info.items_id, out target, out index))
                {
                    this.equip_need.Add(info.items_id);
                    BattleEquipTools_op.RemoveItem(this.equip_has, target, index);
                    result = false;
                }
            }
            else
            {
                result = false;
            }
            return(result);
        }
Beispiel #7
0
 private void CaclExtra()
 {
     this.itemVo     = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(this.EquipmentId);
     this.ExtraSpent = this.itemVo.sell;
     if (StringUtils.CheckValid(this.itemVo.consumption))
     {
         string[] stringValue = StringUtils.GetStringValue(this.itemVo.consumption, ',');
         if (stringValue != null)
         {
             string[] array = stringValue;
             for (int i = 0; i < array.Length; i++)
             {
                 string           unikey   = array[i];
                 SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(unikey);
                 if (dataById != null)
                 {
                     this.ExtraSpent -= dataById.sell;
                 }
             }
         }
     }
     else
     {
         this.ExtraSpent = 0;
     }
 }
Beispiel #8
0
		public ItemInfo()
		{
			this.pos = 0;
			this.num = 1;
			this.oid = 0;
			this.config = new SysBattleItemsVo();
		}
 private void SetEquipment(VictPlayerData playerData)
 {
     if (playerData.HeroEquipmentList == null)
     {
         for (int i = 0; i < this.equips.Length; i++)
         {
             this.equips[i].transform.FindChild("NullMask").gameObject.SetActive(true);
         }
         return;
     }
     for (int j = 0; j < this.equips.Length; j++)
     {
         if (j >= playerData.HeroEquipmentList.Count)
         {
             this.equips[j].enabled = false;
         }
         else if (this.equips[j].name != playerData.HeroEquipmentList[j])
         {
             if (playerData.HeroEquipmentList[j] == string.Empty)
             {
                 this.equips[j].transform.FindChild("NullMask").gameObject.SetActive(true);
             }
             else
             {
                 SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(playerData.HeroEquipmentList[j]);
                 if (dataById != null)
                 {
                     this.equips[j].spriteName = dataById.icon;
                     this.equips[j].transform.FindChild("NullMask").gameObject.SetActive(false);
                 }
             }
         }
     }
 }
Beispiel #10
0
        public static string GetAttriDes(SysBattleItemsVo vo, string seporator = "\n", int maxNum = 6)
        {
            string text = string.Empty;

            if (vo != null)
            {
                if (!string.IsNullOrEmpty(vo.attribute))
                {
                    string[] array = vo.attribute.Split(new char[]
                    {
                        ','
                    });
                    int num = 0;
                    while (num < array.Length && num < maxNum)
                    {
                        if (!string.IsNullOrEmpty(array[num]) && !("[]" == array[num]))
                        {
                            string[] array2 = array[num].Split(new char[]
                            {
                                '|'
                            });
                            if (array2.Length < 3)
                            {
                                Reminder.ReminderStr(vo.items_id + " in battle_items.attrbuite.length < 3");
                            }
                            else
                            {
                                string   format = array2[2];
                                AttrType type   = (AttrType)int.Parse(array2[0]);
                                float    num2;
                                if (array2[1].Contains("%"))
                                {
                                    string text2 = array2[1].Trim();
                                    num2 = float.Parse(text2.Substring(0, text2.Length - 1)) / 100f;
                                }
                                else
                                {
                                    num2 = float.Parse(array2[1]);
                                }
                                string text3 = text;
                                text = string.Concat(new string[]
                                {
                                    text3,
                                    "+",
                                    num2.ToString(format),
                                    " ",
                                    CharacterDataMgr.instance.GetChinaName((int)type),
                                    seporator
                                });
                            }
                        }
                        num++;
                    }
                }
            }
            return(text);
        }
Beispiel #11
0
    private void RefreshUI_item()
    {
        ItemInfo         itemInfo = this.ItemData;
        SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(itemInfo.ID);

        if (dataById == null)
        {
            Reminder.ReminderStr("battleItem为空id===>" + this.ItemData);
            return;
        }
        this.mItemIcon.spriteName = dataById.icon;
        this.mNum.gameObject.SetActive(itemInfo.Num > 1);
        this.mNum.text = itemInfo.Num.ToString();
    }
 public void Init(string id)
 {
     if (id != null)
     {
         this.EquipmentID = id;
         SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(id);
         if (dataById == null)
         {
             Reminder.ReminderStr("battleItem为空id===>" + id);
             return;
         }
         this.B_Texture.mainTexture = ResourceManager.Load <Texture>(dataById.icon, true, true, null, 0, false);
         this.B_Frame.gameObject.SetActive(false);
         UIEventListener.Get(base.gameObject).onClick = new UIEventListener.VoidDelegate(this.ClickItem);
     }
 }
Beispiel #13
0
        public static void idsToSItems(ref Dictionary <ColumnType, Dictionary <string, SItemData> > sItems, List <string> ids, BattleEquipType menuType = BattleEquipType.none)
        {
            BattleEquipTools_config.RegularSItems(ref sItems, true);
            SysBattleItemsVo sysBattleItemsVo = null;

            if (ids != null)
            {
                for (int i = 0; i < ids.Count; i++)
                {
                    if (BattleEquipTools_config.GetBattleItemVo(ids[i], out sysBattleItemsVo) && (menuType == BattleEquipType.none || sysBattleItemsVo.type == (int)menuType) && sItems.ContainsKey((ColumnType)sysBattleItemsVo.level))
                    {
                        sItems[(ColumnType)sysBattleItemsVo.level].Add(sysBattleItemsVo.items_id, new SItemData(sysBattleItemsVo));
                    }
                }
            }
        }
Beispiel #14
0
        private EquipmentTree(string name, int idx)
        {
            this.TreeName  = name;
            this.TreeIndex = idx;
            SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(this.TreeName);

            if (dataById == null)
            {
                Debug.LogError("AI.Equipment EquipmentTree TreeName=" + this.TreeName + "  在SysBattleItemsVo中找不到");
                return;
            }
            EquipmentData        data = new EquipmentData(dataById.items_id, dataById.sale, dataById.sell);
            Node <EquipmentData> node = new Node <EquipmentData>(data, null, this.TreeName, dataById.describe);

            this.SetRootNode(node);
            this.CreateTreeNode(node);
        }
Beispiel #15
0
        public static bool GetBattleItemVo(string equipID, out SysBattleItemsVo battleItemVo)
        {
            bool result = false;

            battleItemVo = null;
            if (!string.IsNullOrEmpty(equipID))
            {
                battleItemVo = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(equipID);
                if (battleItemVo == null)
                {
                    Reminder.ReminderStr("未找到 表中 ID=" + equipID + " 的装备");
                }
                else
                {
                    result = true;
                }
            }
            return(result);
        }
Beispiel #16
0
    private void HoverEquip(GameObject go, bool state)
    {
        SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(go.name);

        this.EquipName.text = LanguageManager.Instance.GetStringById(dataById.name);
        this.Sell.text      = dataById.sell.ToString();
        this.Atrib.text     = this.GetAttriDes(go.name, dataById, "\n", 6);
        this.Describ.text   = LanguageManager.Instance.GetStringById(dataById.describe);
        if (go.transform.parent.name == "EquipIconLM")
        {
            this.EquipInfo.localPosition = new Vector3(go.transform.localPosition.x + 314f, go.transform.localPosition.y + 75f, 0f);
        }
        else
        {
            this.EquipInfo.localPosition = new Vector3(go.transform.localPosition.x - 314f, go.transform.localPosition.y + 75f, 0f);
        }
        this.EquipInfo.gameObject.SetActive(state);
        this.EquipMask.gameObject.SetActive(state);
        this.EquipMask.localPosition = go.transform.localPosition;
    }
    public void Init(string id, int money, bool isCanBuy)
    {
        if (id != null)
        {
            this.equipmentID = id;
        }
        SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(id);

        this.B_Name.text           = dataById.name;
        this.B_Texture.mainTexture = ResourceManager.Load <Texture>(dataById.icon, true, true, null, 0, false);
        base.name = id;
        if (this.B_Frame != null)
        {
            this.B_Frame.gameObject.SetActive(false);
        }
        if (this.B_Sign != null)
        {
            this.B_Sign.gameObject.SetActive(false);
        }
        this.B_Name.color = new Color32(255, 255, 255, 255);
        this.ShowPrice(money, isCanBuy);
        UIEventListener.Get(base.gameObject).onClick       = new UIEventListener.VoidDelegate(this.ClickItem);
        UIEventListener.Get(base.gameObject).onDoubleClick = new UIEventListener.BoolDelegate(this.DoubleClick);
    }
Beispiel #18
0
 private void CheckEquipment(VictPlayerData playerData)
 {
     if (playerData.HeroEquipmentList == null)
     {
         return;
     }
     for (int i = 0; i < this.P_Equips.Length; i++)
     {
         if (!(this.P_Equips[i] == null))
         {
             if (i >= playerData.HeroEquipmentList.Count)
             {
                 this.P_Equips[i].spriteName = null;
             }
             else if (this.P_Equips[i].name != playerData.HeroEquipmentList[i])
             {
                 this.P_Equips[i].name = playerData.HeroEquipmentList[i];
                 if (playerData.HeroEquipmentList[i] == string.Empty)
                 {
                     this.P_Equips[i].spriteName = null;
                 }
                 else
                 {
                     SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(playerData.HeroEquipmentList[i]);
                     if (dataById != null)
                     {
                         this.P_Equips[i].spriteName = dataById.icon;
                     }
                     this.P_Equips[i].name = playerData.HeroEquipmentList[i];
                     UIEventListener expr_114 = UIEventListener.Get(this.P_Equips[i].gameObject);
                     expr_114.onMobileHover = (UIEventListener.BoolDelegate)Delegate.Combine(expr_114.onMobileHover, new UIEventListener.BoolDelegate(this.HoverEquip));
                 }
             }
         }
     }
 }
Beispiel #19
0
		public ItemInfo(SysBattleItemsVo vo)
		{
			this.config = vo;
		}
Beispiel #20
0
		public ItemInfo(int pos, int oid, int num, SysBattleItemsVo vo) : this(vo)
		{
			this.pos = pos;
			this.oid = oid;
			this.num = num;
		}
Beispiel #21
0
 public SItemData(SysBattleItemsVo vo)
 {
     this.config = vo;
     this.cItems = BattleEquipTools_config.StringToStringList(this.config.consumption, ',', "[]");
 }