コード例 #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);
            }
        }
コード例 #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;
        }
コード例 #3
0
 protected virtual void NetFuncUpdateAnotherDealingItems(DealingCharacterItems items)
 {
     if (onUpdateAnotherDealingItems != null)
     {
         onUpdateAnotherDealingItems.Invoke(items);
     }
 }
コード例 #4
0
ファイル: UIDealing.cs プロジェクト: ming81/TheExperiment
        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);
            }
        }
コード例 #5
0
 public void OnUpdateAnotherDealingItems(DealingCharacterItems items)
 {
     if (uiDealing == null)
     {
         return;
     }
     uiDealing.UpdateAnotherDealingItems(items);
 }
コード例 #6
0
 public void UpdateAnotherDealingItems(DealingCharacterItems dealingItems)
 {
     SetupList(CacheAnotherDealingItemsList, dealingItems, tempAnotherDealingItemUIs);
 }
コード例 #7
0
 public virtual void RequestUpdateAnotherDealingItems(DealingCharacterItems dealingItems)
 {
     CallNetFunction(NetFuncUpdateAnotherDealingItems, ConnectionId, dealingItems);
 }
コード例 #8
0
 public bool RequestUpdateAnotherDealingItems(DealingCharacterItems dealingItems)
 {
     CallNetFunction(NetFuncUpdateAnotherDealingItems, ConnectionId, dealingItems);
     return(true);
 }