예제 #1
0
        protected void UpdateData(IList <ItemCraft> itemCrafts)
        {
            int selectedIdx = CacheItemSelectionManager.SelectedUI != null?CacheItemSelectionManager.IndexOf(CacheItemSelectionManager.SelectedUI) : -1;

            CacheItemSelectionManager.DeselectSelectedUI();
            CacheItemSelectionManager.Clear();

            CacheItemList.Generate(itemCrafts, (index, craftItem, ui) =>
            {
                UICraftItem uiCraftItem = ui.GetComponent <UICraftItem>();
                switch (CrafterType)
                {
                case CrafterType.Character:
                    uiCraftItem.SetupForCharacter(craftItem);
                    break;

                case CrafterType.Npc:
                    uiCraftItem.SetupForNpc(craftItem);
                    break;

                case CrafterType.Workbench:
                    uiCraftItem.SetupForWorkbench(BuildingObjectId, craftItem);
                    break;
                }
                uiCraftItem.Show();
                CacheItemSelectionManager.Add(uiCraftItem);
                if (selectedIdx == index)
                {
                    uiCraftItem.OnClickSelect();
                }
            });
        }
예제 #2
0
 protected void OnDeselectCraftItem(UICraftItem ui)
 {
     if (uiCraftItemDialog != null)
     {
         uiCraftItemDialog.onHide.RemoveListener(OnItemDialogHide);
         uiCraftItemDialog.Hide();
         uiCraftItemDialog.onHide.AddListener(OnItemDialogHide);
     }
 }
예제 #3
0
 protected void OnSelectCraftItem(UICraftItem ui)
 {
     if (uiCraftItemDialog != null)
     {
         uiCraftItemDialog.selectionManager = CacheItemSelectionManager;
         uiCraftItemDialog.Data             = ui.Data;
         uiCraftItemDialog.Show();
     }
 }