private void Init() { uIManager = GetComponent <UIManager> (); infoPanel = GetComponent <UIInfoPanel> (); spellsContainer = root.Query <VisualElement> ("spells-container"); spellContainer = root.Query <VisualElement> ("spell-container"); infoContainer = root.Query <VisualElement> ("info-container"); magicPanel = root.Query <VisualElement> ("magic-panel"); info = root.Query <Button> ("info-button"); elem = root.Query <Button> ("elem-button"); nature = root.Query <Button> ("nature-button"); demonology = root.Query <Button> ("demon-button"); necromancy = root.Query <Button> ("necro-button"); defence = root.Query <Button> ("defence-button"); closePanelButton = root.Query <Button> ("close-panel-button"); tabs = new Button [] { info, elem, nature, demonology, necromancy, defence }; itemName = root.Query <Label> ("spells-panel-tab-name"); spellDescription = root.Query <Label> ("spell-desc-value"); FontUtilities.SetFontSize42(spellDescription); spell1 = root.Query <Button> ("spell-level1-but"); spell2 = root.Query <Button> ("spell-level2-but"); spell3 = root.Query <Button> ("spell-level3-but"); spell4 = root.Query <Button> ("spell-level4-but"); spell5 = root.Query <Button> ("spell-level5-but"); spell6 = root.Query <Button> ("spell-level6-but"); spell7 = root.Query <Button> ("spell-level7-but"); spellsButtons = new Button [] { spell1, spell2, spell3, spell4, spell5, spell6, spell7 }; call1 = root.Query <Button> ("call-level1-but"); call2 = root.Query <Button> ("call-level2-but"); call3 = root.Query <Button> ("call-level3-but"); call4 = root.Query <Button> ("call-level4-but"); call5 = root.Query <Button> ("call-level5-but"); call6 = root.Query <Button> ("call-level6-but"); call7 = root.Query <Button> ("call-level7-but"); callsButtons = new Button [] { call1, call2, call3, call4, call5, call6, call7 }; schemaImg = root.Query <IMGUIContainer> ("spell-schema-img"); InitSpellButtons(); closePanelButton.clicked += CloseOrReturn; info.clicked += delegate { TurnTab(0); }; elem.clicked += delegate { TurnTab(1); }; nature.clicked += delegate { TurnTab(2); }; demonology.clicked += delegate { TurnTab(3); }; necromancy.clicked += delegate { TurnTab(4); }; defence.clicked += delegate { TurnTab(5); }; }
/// <summary> /// Adds the info panel to the screen. /// </summary> private void AddInfoPanel() { UIPosition position; UIText uiText; UIInfoPanel infoPanel; position = new UIPosition(0, 0); infoPanel = new UIInfoPanel("info", position, 1); uiText = new UIText("currentPlayer", position, "", 0, 5, UISettings.ColorInfoPanelBg, ConsoleColor.White, ConsoleColor.Red); infoPanel.Add(uiText); uiText = new UIText("availableInput0", position, "Available keys:", 0, 0, UISettings.ColorInfoPanelBg, ConsoleColor.Black, UISettings.ColorInfoPanelBg); infoPanel.Add(uiText); uiText = new UIText("availableInput1", position, " [A] / [D] or [ArrowLeft] / [ArrowRight]", 0, 0, UISettings.ColorInfoPanelBg, ConsoleColor.Black, UISettings.ColorInfoPanelBg); infoPanel.Add(uiText); uiText = new UIText("availableInput2", position, " [Enter]", 0, 0, UISettings.ColorInfoPanelBg, ConsoleColor.Black, UISettings.ColorInfoPanelBg); infoPanel.Add(uiText); uiText = new UIText("availableInput3", position, " [ESC]", 0, 0, UISettings.ColorInfoPanelBg, ConsoleColor.Black, UISettings.ColorInfoPanelBg); infoPanel.Add(uiText); Screen.Add(infoPanel, UITitleRef.BottomRight); this.UIInfoPanelRef = infoPanel; }
private void OnEnable() { uISpellsManager = GetComponent <UISpellsManager> (); uIMenuManager = GetComponent <UIMenuManager> (); uIInfoPanel = GetComponent <UIInfoPanel> (); var rootGameUI = uiGame.rootVisualElement; var rootSpellsUI = uiSpellsPanel.rootVisualElement; uISpellsManager.SetRootAndInit(rootSpellsUI); uIInfoPanel.SetRootAndInit(rootSpellsUI); var rootMenuUI = uiMenu.rootVisualElement; uIMenuManager.SetRootAndInit(rootMenuUI); menuButton = rootGameUI.Query <Button> ("menu"); speedButton = rootGameUI.Query <Button> ("speed"); spellsButton = rootGameUI.Query <Button> ("spells-button"); prepareIcon = rootGameUI.Query <IMGUIContainer> ("prepare-bar-icon"); messageScreen = rootGameUI.Query <VisualElement> ("message-screen"); defenceBar = rootGameUI.Query <VisualElement> ("defence-bar-line"); manaBar = rootGameUI.Query <VisualElement> ("mana-bar-line"); prepareBar = rootGameUI.Query <VisualElement> ("prepare-bar-line"); gamePanel = rootGameUI.Query <VisualElement> ("game-panel"); //Labels messageLabel = rootGameUI.Query <Label> ("message"); manaValue = rootGameUI.Query <Label> ("mana-bar-value"); defenceValue = rootGameUI.Query <Label> ("defence-bar-value"); spellsText = rootGameUI.Query <Label> ("spells-txt"); FontUtilities.SetFontSize42(spellsText); spellsNumber = rootGameUI.Query <Label> ("spells-number"); FontUtilities.SetFontSize42(spellsNumber); xPText = rootGameUI.Query <Label> ("exp-text"); FontUtilities.SetFontSize42(xPText); xPoints = rootGameUI.Query <Label> ("exp-number"); FontUtilities.SetFontSize42(xPoints); }