private void OnForestBrushPanelVisibilityChanged(UIComponent component, bool visible) { if (visible) { ForestBrushPanel.ClampToScreen(); lastTool = ToolsModifierControl.toolController.CurrentTool; ToolsModifierControl.SetTool <ForestTool>(); } else { if (lastTool != null && lastTool.GetType() != typeof(TreeTool) && ToolsModifierControl.toolController.NextTool == null) { lastTool.enabled = true; } } }
internal void Initialize() { LoadTrees(); LoadTreeAuthors(); UITabstrip tabstrip = ToolsModifierControl.mainToolbar.component as UITabstrip; toggleButtonComponents = CreateToggleButtonComponents(tabstrip); ForestBrushPanel = toggleButtonComponents.TabStripPage.GetComponent <UIPanel>().AddUIComponent <ForestBrushPanel>(); BrushTool = gameObject.AddComponent <ForestBrushTool>(); SetTutorialLocale(); toggleButtonComponents.ToggleButton.eventClick += OnToggleClick; ForestBrushPanel.eventVisibilityChanged += OnForestBrushPanelVisibilityChanged; LocaleManager.eventLocaleChanged += SetTutorialLocale; Initialized = true; }
private void OnToggleClick(UIComponent component, UIMouseEventParameter eventParam) { ForestBrushPanel.BringToFront(); ForestBrushPanel.isVisible = !ForestBrushPanel.isVisible; }