Beispiel #1
0
        private void SetupList(UIList list, DealingCharacterItems dealingItems, List <UICharacterItem> uiList)
        {
            CacheItemSelectionManager.DeselectSelectedUI();
            List <CharacterItem> filterItems = new List <CharacterItem>();

            foreach (DealingCharacterItem dealingItem in dealingItems)
            {
                CharacterItem characterItem = dealingItem.characterItem;
                filterItems.Add(characterItem);
            }
            uiList.Clear();
            list.Generate(filterItems, (index, characterItem, ui) =>
            {
                UICharacterItem uiCharacterItem = ui.GetComponent <UICharacterItem>();
                uiCharacterItem.Setup(new CharacterItemTuple(characterItem, characterItem.level, InventoryType.NonEquipItems), null, -1);
                uiCharacterItem.Show();
                uiList.Add(uiCharacterItem);
            });
            CacheItemSelectionManager.Clear();
            foreach (UICharacterItem tempDealingItemUI in tempDealingItemUIs)
            {
                CacheItemSelectionManager.Add(tempDealingItemUI);
            }
            foreach (UICharacterItem tempAnotherDealingItemUI in tempAnotherDealingItemUIs)
            {
                CacheItemSelectionManager.Add(tempAnotherDealingItemUI);
            }
        }
Beispiel #2
0
        protected virtual void NetFuncSetDealingItem(short itemIndex, short amount)
        {
            if (DealingState != DealingState.Dealing)
            {
                gameManager.SendServerGameMessage(ConnectionId, GameMessage.Type.InvalidDealingState);
                return;
            }

            if (itemIndex >= nonEquipItems.Count)
            {
                return;
            }

            DealingCharacterItems dealingItems = DealingItems;

            for (int i = dealingItems.Count - 1; i >= 0; --i)
            {
                if (itemIndex == dealingItems[i].nonEquipIndex)
                {
                    dealingItems.RemoveAt(i);
                    break;
                }
            }
            CharacterItem characterItem = nonEquipItems[itemIndex].Clone();

            characterItem.amount = amount;
            DealingCharacterItem dealingItem = new DealingCharacterItem();

            dealingItem.nonEquipIndex = itemIndex;
            dealingItem.characterItem = characterItem;
            dealingItems.Add(dealingItem);
            // Update to clients
            DealingItems = dealingItems;
        }
Beispiel #3
0
 protected virtual void NetFuncUpdateAnotherDealingItems(DealingCharacterItems items)
 {
     if (onUpdateAnotherDealingItems != null)
     {
         onUpdateAnotherDealingItems.Invoke(items);
     }
 }
Beispiel #4
0
        private void SetupList(UIList list, DealingCharacterItems dealingItems, List <UICharacterItem> uiList)
        {
            ItemSelectionManager.DeselectSelectedUI();
            var filterItems = new List <CharacterItem>();

            foreach (var dealingItem in dealingItems)
            {
                var characterItem = new CharacterItem();
                characterItem.dataId     = dealingItem.dataId;
                characterItem.level      = dealingItem.level;
                characterItem.amount     = dealingItem.amount;
                characterItem.durability = dealingItem.durability;
                filterItems.Add(characterItem);
            }
            uiList.Clear();
            list.Generate(filterItems, (index, characterItem, ui) =>
            {
                var uiCharacterItem = ui.GetComponent <UICharacterItem>();
                uiCharacterItem.Setup(new CharacterItemTuple(characterItem, characterItem.level, string.Empty), null, -1);
                uiCharacterItem.Show();
                uiList.Add(uiCharacterItem);
            });
            ItemSelectionManager.Clear();
            foreach (var tempDealingItemUI in tempDealingItemUIs)
            {
                ItemSelectionManager.Add(tempDealingItemUI);
            }
            foreach (var tempAnotherDealingItemUI in tempAnotherDealingItemUIs)
            {
                ItemSelectionManager.Add(tempAnotherDealingItemUI);
            }
        }
 public void OnUpdateAnotherDealingItems(DealingCharacterItems items)
 {
     if (uiDealing == null)
     {
         return;
     }
     uiDealing.UpdateAnotherDealingItems(items);
 }
Beispiel #6
0
 public void UpdateAnotherDealingItems(DealingCharacterItems dealingItems)
 {
     SetupList(CacheAnotherDealingItemsList, dealingItems, tempAnotherDealingItemUIs);
 }
 public virtual void RequestUpdateAnotherDealingItems(DealingCharacterItems dealingItems)
 {
     CallNetFunction(NetFuncUpdateAnotherDealingItems, ConnectionId, dealingItems);
 }
Beispiel #8
0
 public bool RequestUpdateAnotherDealingItems(DealingCharacterItems dealingItems)
 {
     CallNetFunction(NetFuncUpdateAnotherDealingItems, ConnectionId, dealingItems);
     return(true);
 }