コード例 #1
0
ファイル: WEUtilityBar.cs プロジェクト: tarsupin/Nexus
        public void RunTick()
        {
            this.MouseOver = this.GetMouseOverState();
            if (this.MouseOver == UIMouseOverState.On)
            {
                UIComponent.ComponentWithFocus = this;
                WEFuncBut WorldFuncBut = null;

                // Identify which Bar Number is being highlighted:
                byte barIndex = this.GetBarIndex(Cursor.MouseX);

                // Check if a Function Button is highlighted:
                if (buttonMap.ContainsKey(barIndex))
                {
                    WorldFuncBut = buttonMap[barIndex];

                    // Draw the Helper Text associated with the Function Button
                    UIHandler.RunToolTip(WorldFuncBut.title, WorldFuncBut.title, WorldFuncBut.description, UIPrimaryDirection.Top);
                }

                // Mouse was pressed
                if (Cursor.LeftMouseState == Cursor.MouseDownState.Clicked)
                {
                    // Clicked a Tile Tool
                    if (barIndex < 10)
                    {
                        WETools.SetWorldTileToolBySlotGroup(WE_UI.curWESlotGroup, barIndex);
                    }

                    // Clicked a Function Button
                    if (WorldFuncBut != null)
                    {
                        WorldFuncBut.ActivateWorldFuncButton();
                    }
                }
            }

            // If the Mouse just exited this component:
            else if (this.MouseOver == UIMouseOverState.Exited)
            {
                WETools.UpdateHelperText();                 // Update the Helper Text (since it may have changed from overlaps)
            }
        }
コード例 #2
0
        public override void OnClick()
        {
            byte menuOpt = this.GetContextOpt(Cursor.MouseX, Cursor.MouseY);

            // World Tile Tool Options
            if (menuOpt <= 5)
            {
                WE_UI.curWESlotGroup = menuOpt;
                WETools.SetWorldTileToolBySlotGroup(WE_UI.curWESlotGroup);
                WETools.UpdateHelperText();
            }

            // Resize Option
            else if (menuOpt == 6)
            {
                UIHandler.worldEditConsole.Open();
                UIHandler.worldEditConsole.SendCommand("resize ", false);
                ChatConsole.SendMessage("--------------------", Color.White);
                ChatConsole.SendMessage("Resize the World Map", Color.Red);
                ChatConsole.SendMessage("--------------------", Color.White);
            }

            this.CloseMenu();
        }