Exemplo n.º 1
0
        private void Start()
        {
            allSpells   = Resources.LoadAll <Spell>("Spells/");
            rangeSpells = Resources.LoadAll <RangeSpell>("Spells/");
            raySpells   = Resources.LoadAll <RaySpell>("Spells/");
            bonusSpells = Resources.LoadAll <BonusSpell>("Spells/");

            equippedSprite = Resources.Load <Sprite>("Sprites/equipped_arrow");
            spellsLauncher = FindObjectOfType <SpellsLauncher>();

            uiGame   = UIGame.Instance;
            inputMgr = InputManager.Instance;

            NavigableMenu navMenu = transform.Find("MainMenu/SubList").gameObject.GetComponent <NavigableMenu>();

            subList = navMenu.transform.Find("ListContainer").gameObject;

            if (navMenu)
            {
                navMenu.OnUpdateData += PopulateList;
            }

            itemPreview  = transform.Find("MainMenu/PreviewContainer/ItemPreview").gameObject;
            namePrevTxt  = itemPreview.transform.Find("InfoContainer/Name").GetComponent <Text>();
            descPrevTxt  = itemPreview.transform.Find("InfoContainer/Description").GetComponent <Text>();
            costManaTxt  = itemPreview.transform.Find("InfoContainer/CostValue").GetComponent <Text>();
            previewImage = itemPreview.transform.Find("ItemImage").GetComponent <Image>();
            HideShortcutPanel();
            HideItemPreview();
        }
Exemplo n.º 2
0
 private int FindMenuIndex(NavigableMenu menu)
 {
     if (!menu)
     {
         return(-1);
     }
     for (int i = 0; i < menus.Length; i++)
     {
         if (menu == menus[i])
         {
             return(i);
         }
     }
     return(-1);
 }
Exemplo n.º 3
0
        // Use this for initialization
        private void Start()
        {
            listNavMenu = transform.Find("SubList").gameObject.GetComponent <NavigableMenu>();
            if (listNavMenu)
            {
                listNavMenu.OnUpdateData += index =>
                {
                    CleanList();
                    switch (index)
                    {
                    case 0:
                        OnAllClick();
                        break;

                    case 1:
                        OnWeaponsClick();
                        break;

                    case 2:
                        OnClothesClick();
                        break;

                    case 3:
                        UIGame.Instance.ToggleInventoryWindow(inventoryToShow);
                        break;

                    default:
                        break;
                    }
                }
            }
            ;

            namePrevTxt   = transform.Find("ItemPreview/InfoContainer/Name").GetComponent <Text>();
            characPrevTxt = transform.Find("ItemPreview/InfoContainer/Charac").GetComponent <Text>();
            weightPrevTxt = transform.Find("ItemPreview/InfoContainer/WeightValue").GetComponent <Text>();
            valuePrevTxt  = transform.Find("ItemPreview/InfoContainer/ValueValue").GetComponent <Text>();
            previewImage  = transform.Find("ItemPreview/ItemImage").GetComponent <Image>();
        }
Exemplo n.º 4
0
        // Use this for initialization
        private void Awake()
        {
            validateBtn   = transform.Find("AcceptBtn").gameObject;
            cancelBtn     = transform.Find("CancelBtn").gameObject;
            newGameLabel  = transform.Find("NewGameLabel").GetComponent <Text>();
            continueLabel = transform.Find("ContinueLabel").GetComponent <Text>();
            quitLabel     = transform.Find("QuitLabel").GetComponent <Text>();

            navMenu = GetComponent <NavigableMenu>();
            if (navMenu)
            {
                navMenu.OnUpdateData += index =>
                {
                    HideLabels();
                    switch (index)
                    {
                    case 0:
                        OnContinueClick();
                        break;

                    case 1:
                        OnNewGameClick();
                        break;

                    case 2:
                        OnQuitClick();
                        break;

                    default:
                        break;
                    }
                }
            }
            ;

            state = State.None;
        }
Exemplo n.º 5
0
        public void OnClick(NavigableMenu menu, int index)
        {
            if (!menu.GetComponent <CanvasGroup>().interactable)
            {
                return;
            }
            int menuIndex = FindMenuIndex(menu);

            if (index < 0)
            {
                return;
            }

            if (menuIndex != level && !blockPrevList)
            {
                level = menuIndex;
            }
            if (level < menus.Length - 1)
            {
                MakeCanvasTransparent(menus[level].GetComponent <CanvasGroup>());
                MakeCanvasVisible(menus[++level].GetComponent <CanvasGroup>());
            }
            menus[level].UpdateData(index);
        }