コード例 #1
0
    private void RefreshBagItems()
    {
        DataModel.BagItems.Clear();

        var playerBags    = PlayerDataManager.Instance.PlayerDataModel.Bags;
        var packItems     = DataModel.BagItems;
        var __enumerator2 = (playerBags.Bags[(int)eBagType.BaseItem].Items).GetEnumerator();

        while (__enumerator2.MoveNext())
        {
            var item = __enumerator2.Current;
            if (item != null && item.ItemId != -1)
            {
                var tbRecord = Table.GetItemBase(item.ItemId);
                if (tbRecord != null && tbRecord.Type == s_SkillItemType)
                {
                    var equipItem = new EquipItemDataModel();
                    equipItem.BagItemData   = item;
                    equipItem.TipButtonShow = (int)eEquipBtnShow.None;
                    packItems.Add(equipItem);
                }
            }
        }

        DataModel.NotHaveItem = (DataModel.BagItems.Count == 0);
    }
コード例 #2
0
    public int ComparerItem(EquipItemDataModel a, EquipItemDataModel b)
    {
        //部位
        var tbEquipA = Table.GetEquipBase(a.BagItemData.ItemId);
        var tbEquipB = Table.GetEquipBase(b.BagItemData.ItemId);
        var bagIdA   = GameUtils.GetEquipBagId(tbEquipA);
        var bagIdB   = GameUtils.GetEquipBagId(tbEquipB);
        var indexA   = EquipOrder2.FindIndex(i => i == bagIdA);
        var indexB   = EquipOrder2.FindIndex(i => i == bagIdB);

        if (indexA != indexB)
        {
            return(indexA - indexB);
        }

        //阶数
        if (tbEquipA.Ladder != tbEquipB.Ladder)
        {
            return(tbEquipB.Ladder - tbEquipA.Ladder);
        }

        //品质
        var tbItemA = Table.GetItemBase(a.BagItemData.ItemId);
        var tbItemB = Table.GetItemBase(b.BagItemData.ItemId);

        if (tbItemA.Quality != tbItemB.Quality)
        {
            return(tbItemB.Quality - tbItemA.Quality);
        }

        //强化等级
        var enhanceA = a.BagItemData.Exdata.Enchance;
        var enhanceB = b.BagItemData.Exdata.Enchance;

        if (enhanceA != enhanceB)
        {
            return(enhanceB - enhanceA);
        }

        //战力
        if (a.BagItemData.FightValue != b.BagItemData.FightValue)
        {
            return(b.BagItemData.FightValue - a.BagItemData.FightValue);
        }

        //item id
        if (a.BagItemData.ItemId != b.BagItemData.ItemId)
        {
            return(a.BagItemData.ItemId - b.BagItemData.ItemId);
        }

        //bag index
        return(a.BagItemData.Index - b.BagItemData.Index);
    }
コード例 #3
0
 private EquipItemDataModel createEquipData(BagItemDataModel bagItem)
 {
     if (bagItem.ItemId != -1)
     {
         var tbRecord = Table.GetEquipBase(bagItem.ItemId);
         if (tbRecord != null && tbRecord.ShowEquip == 1)
         {
             var equipItem = new EquipItemDataModel();
             equipItem.BagItemData   = bagItem;
             equipItem.TipButtonShow = (int)eEquipBtnShow.None;
             return(equipItem);
         }
     }
     return(null);
 }
コード例 #4
0
        private void RefreshForItemType(BagItemDataModel bagItem)
        {
            var playerBags = PlayerDataManager.Instance.PlayerDataModel.Bags;
            var tbItemBase = Table.GetItemBase(bagItem.ItemId);

            var equipItems = new List <EquipItemDataModel>();

            {
                PlayerDataManager.Instance.ForeachEquip(bagData =>
                {
                    if (bagData.ItemId != -1 && bagItem != bagData)
                    {
                        var tb = Table.GetItemBase(bagData.ItemId);
                        if (tbItemBase == null || tb.Type == tbItemBase.Type)
                        {
                            var equipItem         = new EquipItemDataModel();
                            equipItem.BagItemData = bagData;
                            equipItems.Add(equipItem);
                        }
                    }
                });
            }
            DataModel.EquipItems = new ObservableCollection <EquipItemDataModel>(equipItems);

            var packItems = new List <EquipItemDataModel>();

            {
                var __enumerator6 = (playerBags.Bags[(int)eBagType.Equip].Items).GetEnumerator();
                while (__enumerator6.MoveNext())
                {
                    var item = __enumerator6.Current;
                    {
                        if (item.ItemId != -1 && bagItem != item)
                        {
                            var tb = Table.GetItemBase(item.ItemId);
                            if (tbItemBase == null || tb.Type == tbItemBase.Type)
                            {
                                var equipItem = new EquipItemDataModel();
                                equipItem.BagItemData = item;
                                packItems.Add(equipItem);
                            }
                        }
                    }
                }
            }
            packItems.Sort(ComparerItem);
            DataModel.PackItems = new ObservableCollection <EquipItemDataModel>(packItems);
        }
コード例 #5
0
 private EquipItemDataModel createEquipData2(BagItemDataModel bagData)
 {
     if (bagData.ItemId != -1)
     {
         var tbEquip = Table.GetEquipBase(bagData.ItemId);
         if (tbEquip.ShowEquip == 1)
         {
             var equipItem = new EquipItemDataModel();
             equipItem.BagItemData   = bagData;
             equipItem.SelectFlag    = false;
             equipItem.TipButtonShow = (int)eEquipBtnShow.None;
             equipItem.CanAdvance    = (tbEquip.UpdateEquipID != -1) ? 1 : 0;
             return(equipItem);
         }
     }
     return(null);
 }
コード例 #6
0
        private void RefreshForSameEquipUpdateId(int updateId, List <BagItemDataModel> excludeList)
        {
            var playerBags = PlayerDataManager.Instance.PlayerDataModel.Bags;

            Action <BagItemDataModel, ICollection <EquipItemDataModel> > func = (bagData, items) =>
            {
                if (bagData.ItemId != -1)
                {
                    var tbEquip = Table.GetEquipBase(bagData.ItemId);
                    if (updateId == tbEquip.EquipUpdateLogic && !excludeList.Contains(bagData, new BagItemDataModelComParer()))
                    {
                        var equipItem = new EquipItemDataModel();
                        equipItem.BagItemData = bagData;
                        items.Add(equipItem);
                    }
                }
            };

            var equipItems = new ObservableCollection <EquipItemDataModel>();

            {
                PlayerDataManager.Instance.ForeachEquip(bagData => { func(bagData, equipItems); });
            }
            DataModel.EquipItems = equipItems;

            var packItems = new List <EquipItemDataModel>();

            {
                var __enumerator6 = (playerBags.Bags[(int)eBagType.Equip].Items).GetEnumerator();
                while (__enumerator6.MoveNext())
                {
                    var bagData = __enumerator6.Current;
                    {
                        func(bagData, packItems);
                    }
                }
            }
            packItems.Sort(ComparerItem);
            DataModel.PackItems = new ObservableCollection <EquipItemDataModel>(packItems);
        }
コード例 #7
0
        private void RefreshForEvoEquip()
        {
            var playerBags = PlayerDataManager.Instance.PlayerDataModel.Bags;

            Action <BagItemDataModel, ICollection <EquipItemDataModel> > func = (bagData, items) =>
            {
                if (bagData.ItemId != -1)
                {
                    var tbEquip = Table.GetEquipBase(bagData.ItemId);
                    if (tbEquip.UpdateEquipID != -1)
                    {
                        var equipItem = new EquipItemDataModel();
                        equipItem.BagItemData = bagData;
                        items.Add(equipItem);
                    }
                }
            };

            var equipItems = new ObservableCollection <EquipItemDataModel>();

            {
                PlayerDataManager.Instance.ForeachEquip(EquipOrder1, bagData => { func(bagData, equipItems); });
            }
            DataModel.EquipItems = equipItems;

            var packItems = new List <EquipItemDataModel>();

            {
                var __enumerator6 = (playerBags.Bags[(int)eBagType.Equip].Items).GetEnumerator();
                while (__enumerator6.MoveNext())
                {
                    var bagData = __enumerator6.Current;
                    {
                        func(bagData, packItems);
                    }
                }
            }
            packItems.Sort(ComparerItem);
            DataModel.PackItems = new ObservableCollection <EquipItemDataModel>(packItems);
        }
コード例 #8
0
        private void Refresh()
        {
            var equipItems = new List <EquipItemDataModel>();

            PlayerDataManager.Instance.ForeachEquip(EquipOrder1, bagItem =>
            {
                if (bagItem.ItemId != -1)
                {
                    var equipItem         = new EquipItemDataModel();
                    equipItem.BagItemData = bagItem;
                    equipItems.Add(equipItem);
                }
            });

            DataModel.EquipItems = new ObservableCollection <EquipItemDataModel>(equipItems);

            var packItems = new List <EquipItemDataModel>();

            {
                var playerBags    = PlayerDataManager.Instance.PlayerDataModel.Bags;
                var __enumerator1 = (playerBags.Bags[(int)eBagType.Equip].Items).GetEnumerator();
                while (__enumerator1.MoveNext())
                {
                    var item = __enumerator1.Current;
                    {
                        if (item.ItemId != -1)
                        {
                            var equipItem = new EquipItemDataModel();
                            equipItem.BagItemData = item;
                            packItems.Add(equipItem);
                        }
                    }
                }
            }
            packItems.Sort(ComparerItem);
            DataModel.PackItems = new ObservableCollection <EquipItemDataModel>(packItems);
        }
コード例 #9
0
        private void RefreshForEquipInherit(BagItemDataModel inherit, BagItemDataModel inherited)
        {
            var itemId = -1;

            if (inherit.ItemId != -1)
            {
                itemId = inherit.ItemId;
            }
            else
            {
                if (inherited.ItemId != -1)
                {
                    itemId = inherited.ItemId;
                }
            }
            if (itemId == -1)
            {
                Refresh();
                return;
            }
            var playerBags = PlayerDataManager.Instance.PlayerDataModel.Bags;
            var tbItemBase = Table.GetItemBase(itemId);

            var equipItems = new List <EquipItemDataModel>();

            {
                PlayerDataManager.Instance.ForeachEquip(bagData =>
                {
                    if (bagData.ItemId != -1 && (inherit != bagData && inherited != bagData))
                    {
                        var tb = Table.GetItemBase(bagData.ItemId);
                        if (tbItemBase == null || GameUtils.CheckInheritType(tbItemBase, tb))
                        {
                            var equipItem         = new EquipItemDataModel();
                            equipItem.BagItemData = bagData;
                            equipItems.Add(equipItem);
                        }
                    }
                });
            }
            DataModel.EquipItems = new ObservableCollection <EquipItemDataModel>(equipItems);

            var packItems = new List <EquipItemDataModel>();

            {
                var __enumerator6 = (playerBags.Bags[(int)eBagType.Equip].Items).GetEnumerator();
                while (__enumerator6.MoveNext())
                {
                    var item = __enumerator6.Current;
                    {
                        if (item.ItemId != -1 && (inherit != item && inherited != item))
                        {
                            var tb = Table.GetItemBase(item.ItemId);
                            if (tbItemBase == null || GameUtils.CheckInheritType(tbItemBase, tb))
                            {
                                var equipItem = new EquipItemDataModel();
                                equipItem.BagItemData = item;
                                packItems.Add(equipItem);
                            }
                        }
                    }
                }
            }
            packItems.Sort(ComparerItem);
            DataModel.PackItems = new ObservableCollection <EquipItemDataModel>(packItems);
        }