Пример #1
0
        public GMacroEditorPanel(Client.Macro m) : base(0, 0, 0x103, 230)
        {
            GMainMenu menu;
            GMenuItem menuFrom;

            this.m_Macro   = m;
            base.m_CanDrag = false;
            base.m_NonRestrictivePicking = true;
            base.ShouldHitTest           = false;
            this.m_Ctrl          = new GSystemButton(10, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), SystemColors.ControlText, "Ctrl", Engine.GetUniFont(2));
            this.m_Alt           = new GSystemButton(0x31, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), SystemColors.ControlText, "Alt", Engine.GetUniFont(2));
            this.m_Shift         = new GSystemButton(0x58, 10, 0x2a, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), SystemColors.ControlText, "Shift", Engine.GetUniFont(2));
            this.m_Ctrl.OnClick  = new OnClick(this.Ctrl_OnClick);
            this.m_Alt.OnClick   = new OnClick(this.Alt_OnClick);
            this.m_Shift.OnClick = new OnClick(this.Shift_OnClick);
            this.m_Ctrl.Tooltip  = new Tooltip("Toggles the control key modifier", true);
            this.m_Alt.Tooltip   = new Tooltip("Toggles the alt key modifier", true);
            this.m_Shift.Tooltip = new Tooltip("Toggles the shift key modifier", true);
            base.m_Children.Add(this.m_Ctrl);
            base.m_Children.Add(this.m_Alt);
            base.m_Children.Add(this.m_Shift);
            this.UpdateModifiers();
            GAlphaBackground toAdd = new GAlphaBackground(0x81, 10, 0x4a, 20)
            {
                FillAlpha = 1f,
                FillColor = GumpColors.Window
            };

            base.m_Children.Add(toAdd);
            GMacroKeyEntry entry = new GMacroKeyEntry(GetKeyName(m.Key), 0x81, 10, 0x4a, 20)
            {
                Tooltip = new Tooltip("Press any key here to change the macro", true)
            };

            base.m_Children.Add(entry);
            GSystemButton button = new GSystemButton(10, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), SystemColors.ControlText, "Delete", Engine.GetUniFont(2));

            button.SetBackColor(GumpPaint.Blend(Color.SteelBlue, SystemColors.Control, (float)0.25f));
            button.InactiveColor = GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f);
            button.Tooltip       = new Tooltip("Deletes the entire macro", true);
            button.OnClick       = new OnClick(this.Delete_OnClick);
            button.X             = (this.Width - 10) - button.Width;
            base.m_Children.Add(button);
            base.FillAlpha = 0.15f;
            for (int i = 0; i < m.Actions.Length; i++)
            {
                try
                {
                    Action action = m.Actions[i];
                    if (action.Handler != null)
                    {
                        ActionHandler ah = action.Handler;
                        menu     = new GMainMenu(10, 0x23 + (i * 0x17));
                        menuFrom = new GActionMenu(this, m, action);
                        menu.Add(this.FormatMenu(menuFrom));
                        if (ah.Params == null)
                        {
                            GAlphaBackground background2 = new GAlphaBackground(0x81, 0x23 + (i * 0x17), 120, 0x18)
                            {
                                FillAlpha = 1f,
                                FillColor = GumpColors.Window
                            };
                            base.m_Children.Add(background2);
                            IHue     windowText = GumpHues.WindowText;
                            GTextBox box        = new GMacroParamEntry(action, action.Param, background2.X, background2.Y, background2.Width, background2.Height)
                            {
                                MaxChars = 0xef
                            };
                            base.m_Children.Add(box);
                        }
                        else if (ah.Params.Length != 0)
                        {
                            string name = Find(action.Param, ah.Params);
                            if (name == null)
                            {
                                name = action.Param;
                            }
                            menuFrom          = this.GetMenuFrom(new ParamNode(name, ah.Params), action, ah);
                            menuFrom.DropDown = i == (m.Actions.Length - 1);
                            menu.Add(menuFrom);
                        }
                        menu.LeftToRight = true;
                        base.m_Children.Add(menu);
                    }
                }
                catch
                {
                }
            }
            menu              = new GMainMenu(10, 0x23 + (m.Actions.Length * 0x17));
            menuFrom          = this.GetMenuFrom(ActionHandler.Root);
            menuFrom.Tooltip  = new Tooltip("To create a new instruction pick one from the menu below", false, 200);
            menuFrom.Text     = "New...";
            menuFrom.DropDown = true;
            menu.Add(this.FormatMenu(menuFrom));
            menu.LeftToRight = true;
            base.m_Children.Add(menu);
        }
Пример #2
0
        protected internal override unsafe void Draw(int X, int Y)
        {
            if (this.m_ScrollTexture == null)
            {
                this.m_ScrollTexture = new Texture(0x10, 0x10, true);
                LockData data = this.m_ScrollTexture.Lock(LockFlags.WriteOnly);
                ushort   num  = Engine.C32216(GumpColors.ControlLightLight);
                ushort   num2 = Engine.C32216(GumpColors.ScrollBar);
                for (int i = 0; i < 0x10; i++)
                {
                    ushort *numPtr = (ushort *)(data.pvSrc + (i * data.Pitch));
                    for (int j = 0; j < 0x10; j++)
                    {
                        if ((((i & 1) + j) & 1) == 0)
                        {
                            numPtr++;
                            numPtr[0] = num;
                        }
                        else
                        {
                            numPtr++;
                            numPtr[0] = num2;
                        }
                    }
                }
                this.m_ScrollTexture.Unlock();
            }
            this.m_ScrollTexture.Draw(X, Y, this.Width, this.Height);
            int barHeight = this.GetBarHeight();
            int num6      = Y + 0x10;
            int num7      = this.Height - 0x20;
            int position  = base.GetPosition(num7 - barHeight);

            Renderer.SetTexture(null);
            if (this.m_State == State.LargeScrollUp)
            {
                if (position > 0)
                {
                    Renderer.SetAlphaEnable(true);
                    Renderer.SetAlpha(0.9f);
                    Renderer.SolidRect(GumpColors.ControlDarkDark, X, Y + this.Width, this.Width, position);
                    Renderer.SetAlphaEnable(false);
                    int num9 = base.PointToClient(new Point(Engine.m_xMouse, Engine.m_yMouse)).Y - 0x10;
                    if (position > num9)
                    {
                        base.Value -= base.LargeOffset;
                    }
                    else
                    {
                        this.m_State = State.Inactive;
                    }
                }
            }
            else if ((this.m_State == State.LargeScrollDown) && (((num7 - position) - barHeight) > 0))
            {
                Renderer.SetAlphaEnable(true);
                Renderer.SetAlpha(0.9f);
                Renderer.SolidRect(GumpColors.ControlDarkDark, X, (num6 + position) + barHeight, this.Width, (num7 - position) - barHeight);
                Renderer.SetAlphaEnable(false);
                int num10 = base.PointToClient(new Point(Engine.m_xMouse, Engine.m_yMouse)).Y - 0x10;
                if ((position + barHeight) < num10)
                {
                    base.Value += base.LargeOffset;
                }
                else
                {
                    this.m_State = State.Inactive;
                }
            }
            GumpPaint.DrawRaised3D(X, num6 + position, 0x10, barHeight);
            if (this.m_State == State.SmallScrollUp)
            {
                GumpPaint.DrawFlat(X, Y, this.Width, this.Width);
                Renderer.SetAlphaEnable(true);
                Renderer.SetAlpha(1f);
                Engine.m_WinScrolls[0].Draw(X + 5, Y + 7, GumpColors.ControlText);
                Renderer.SetAlphaEnable(false);
                base.Value -= base.SmallOffset;
            }
            else
            {
                GumpPaint.DrawRaised3D(X, Y, this.Width, this.Width);
                Renderer.SetAlphaEnable(true);
                Renderer.SetAlpha(1f);
                Engine.m_WinScrolls[0].Draw(X + 4, Y + 6, GumpColors.ControlText);
                Renderer.SetAlphaEnable(false);
            }
            Renderer.SetTexture(null);
            if (this.m_State == State.SmallScrollDown)
            {
                GumpPaint.DrawFlat(X, (Y + this.Height) - this.Width, this.Width, this.Width);
                Renderer.SetAlphaEnable(true);
                Renderer.SetAlpha(1f);
                Engine.m_WinScrolls[1].Draw(X + 5, ((Y + this.Height) - this.Width) + 7, GumpColors.ControlText);
                Renderer.SetAlphaEnable(false);
                base.Value += base.SmallOffset;
            }
            else
            {
                GumpPaint.DrawRaised3D(X, (Y + this.Height) - this.Width, this.Width, this.Width);
                Renderer.SetAlphaEnable(true);
                Renderer.SetAlpha(1f);
                Engine.m_WinScrolls[1].Draw(X + 4, ((Y + this.Height) - this.Width) + 6, GumpColors.ControlText);
                Renderer.SetAlphaEnable(false);
            }
        }
Пример #3
0
        protected internal override void Draw(int x, int y)
        {
            Renderer.SetTexture(null);
            int num = 0;

            switch (this.m_Style)
            {
            case WindowsButtonStyle.Normal:
                switch (this.m_State)
                {
                case 0:
                    GumpPaint.DrawRaised3D(x, y, this.m_Width, this.m_Height);
                    this.CaptionDown = false;
                    goto Label_0143;

                case 1:
                    GumpPaint.DrawRaised3D(x, y, this.m_Width, this.m_Height);
                    this.CaptionDown = false;
                    goto Label_0143;

                case 2:
                    GumpPaint.DrawFlat(x, y, this.m_Width, this.m_Height, GumpColors.ControlDark, GumpColors.Control);
                    this.CaptionDown = true;
                    num = 1;
                    goto Label_0143;
                }
                break;

            case WindowsButtonStyle.Flat:
                switch (this.m_State)
                {
                case 0:
                    GumpPaint.DrawFlat(x, y, this.m_Width, this.m_Height, GumpColors.ControlDarkDark, GumpColors.Control);
                    this.CaptionDown = false;
                    goto Label_0143;

                case 1:
                    GumpPaint.DrawFlat(x, y, this.m_Width, this.m_Height, GumpColors.ControlDarkDark, GumpColors.ControlAlternate);
                    this.CaptionDown = false;
                    goto Label_0143;

                case 2:
                    GumpPaint.DrawFlat(x, y, this.m_Width, this.m_Height, GumpColors.ControlDarkDark, GumpPaint.Blend(GumpColors.ControlAlternate, GumpColors.ControlLightLight, 0x80));
                    this.CaptionDown = false;
                    goto Label_0143;
                }
                break;
            }
Label_0143:
            if (this.m_Image != null)
            {
                if (this.m_vCache == null)
                {
                    this.m_vCache = new VertexCache();
                }
                if (this.m_ImageColor == -1)
                {
                    this.m_vCache.Draw(this.m_Image, ((num + x) + ((this.m_Width - ((this.m_Image.xMax - this.m_Image.xMin) + 1)) / 2)) - this.m_Image.xMin, ((num + y) + ((this.m_Height - ((this.m_Image.yMax - this.m_Image.yMin) + 1)) / 2)) - this.m_Image.yMin);
                }
                else
                {
                    Renderer.SetAlphaEnable(true);
                    Renderer.SetAlpha(1f);
                    this.m_vCache.Draw(this.m_Image, ((num + x) + ((this.m_Width - ((this.m_Image.xMax - this.m_Image.xMin) + 1)) / 2)) - this.m_Image.xMin, ((num + y) + ((this.m_Height - ((this.m_Image.yMax - this.m_Image.yMin) + 1)) / 2)) - this.m_Image.yMin, this.m_ImageColor);
                    Renderer.SetAlphaEnable(false);
                }
            }
        }
Пример #4
0
 protected internal override void OnMouseEnter(int X, int Y, MouseButtons mb)
 {
     this.m_NameBack.FillColor  = GumpPaint.Blend(GumpColors.Window, GumpColors.Highlight, (float)0.9f);
     this.m_ValueBack.FillColor = this.m_NameBack.FillColor;
 }
Пример #5
0
 protected internal override void Draw(int X, int Y)
 {
     base.Draw(X, Y);
     Renderer.SetTexture(null);
     GumpPaint.DrawSunken3D(((X + base.Client.X) + this.m_Sunken.X) - 1, ((Y + base.Client.Y) + this.m_Sunken.Y) - 1, this.m_Sunken.Width + 2, this.m_Sunken.Height + 2);
 }
Пример #6
0
        public GMacroKeyboard() : base(0, 0, 0x27f, 0xb8)
        {
            this.m_Bold                  = true;
            this.m_Buttons               = new object[0x100];
            this.m_HighButtons           = new object[0x100];
            base.FillColor               = GumpColors.Control;
            base.FillAlpha               = 1f;
            base.m_NonRestrictivePicking = true;
            int x = this.Width - 0x62;

            this.m_All           = new GSystemButton(x - 0x13, 10, 20, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), Color.Black, "", Engine.GetUniFont(2));
            this.m_Ctrl          = new GSystemButton(x, 10, 0x20, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), Color.Black, "Ctrl", Engine.GetUniFont(2));
            this.m_Alt           = new GSystemButton(x + 0x1f, 10, 0x20, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), Color.Black, "Alt", Engine.GetUniFont(2));
            this.m_Shift         = new GSystemButton(x + 0x3e, 10, 0x20, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), Color.Black, "Shift", Engine.GetUniFont(2));
            this.m_All.OnClick   = new OnClick(this.All_OnClick);
            this.m_Ctrl.OnClick  = new OnClick(this.Ctrl_OnClick);
            this.m_Alt.OnClick   = new OnClick(this.Alt_OnClick);
            this.m_Shift.OnClick = new OnClick(this.Shift_OnClick);
            base.m_Children.Add(this.m_All);
            base.m_Children.Add(this.m_Ctrl);
            base.m_Children.Add(this.m_Alt);
            base.m_Children.Add(this.m_Shift);
            this.PlaceKey(Keys.Escape, "Esc");
            this.Skip();
            this.PlaceKey(Keys.F1);
            this.PlaceKey(Keys.F2);
            this.PlaceKey(Keys.F3);
            this.PlaceKey(Keys.F4);
            this.Skip(0.5f);
            this.PlaceKey(Keys.F5);
            this.PlaceKey(Keys.F6);
            this.PlaceKey(Keys.F7);
            this.PlaceKey(Keys.F8);
            this.Skip(0.5f);
            this.PlaceKey(Keys.F9);
            this.PlaceKey(Keys.F10);
            this.PlaceKey(Keys.F11);
            this.PlaceKey(Keys.F12);
            this.Skip(0.25f);
            this.m_Bold = false;
            this.PlaceKey(Keys.PrintScreen, "Prnt");
            this.PlaceKey(Keys.Scroll, "Scrl");
            this.PlaceKey(Keys.Pause, "Paus");
            this.m_Bold = true;
            this.m_fX   = 0f;
            this.m_fY  += 1.25f;
            this.PlaceKey(Keys.Oem3, "~");
            this.PlaceKey(Keys.D1, "1");
            this.PlaceKey(Keys.D2, "2");
            this.PlaceKey(Keys.D3, "3");
            this.PlaceKey(Keys.D4, "4");
            this.PlaceKey(Keys.D5, "5");
            this.PlaceKey(Keys.D6, "6");
            this.PlaceKey(Keys.D7, "7");
            this.PlaceKey(Keys.D8, "8");
            this.PlaceKey(Keys.D9, "9");
            this.PlaceKey(Keys.D0, "0");
            this.PlaceKey(Keys.OemMinus, "-");
            this.PlaceKey(Keys.Oemplus, "+");
            this.m_Bold = false;
            this.PlaceKey(Keys.Back, "Backspace", 2f);
            this.m_Bold = true;
            this.Skip(0.25f);
            this.m_Bold = false;
            this.PlaceKey(Keys.Insert, "Ins");
            this.PlaceKey(Keys.Home);
            this.m_Bold = true;
            this.PlaceKey(Keys.PageUp, "↑");
            this.Skip(0.25f);
            this.PlaceKey(Keys.NumLock, "Num");
            this.PlaceKey(Keys.Divide, "/");
            this.PlaceKey(Keys.Multiply, "*");
            this.PlaceKey(Keys.Subtract, "-");
            this.m_fX = 0f;
            this.m_fY++;
            this.PlaceKey(Keys.Tab, (float)1.5f);
            this.PlaceKey(Keys.Q);
            this.PlaceKey(Keys.W);
            this.PlaceKey(Keys.E);
            this.PlaceKey(Keys.R);
            this.PlaceKey(Keys.T);
            this.PlaceKey(Keys.Y);
            this.PlaceKey(Keys.U);
            this.PlaceKey(Keys.I);
            this.PlaceKey(Keys.O);
            this.PlaceKey(Keys.P);
            this.PlaceKey(Keys.Oem4, "[");
            this.PlaceKey(Keys.Oem6, "]");
            this.PlaceKey(Keys.Oem5, @"\", 1.5f);
            this.Skip(0.25f);
            this.m_Bold = false;
            this.PlaceKey(Keys.Delete, "Del");
            this.PlaceKey(Keys.End);
            this.m_Bold = true;
            this.PlaceKey(Keys.Next, "↓");
            this.Skip(0.25f);
            this.PlaceKey(Keys.NumPad7, "7");
            this.PlaceKey(Keys.NumPad8, "8");
            this.PlaceKey(Keys.NumPad9, "9");
            this.PlaceKey(Keys.Add, "+", 1f, 2f);
            this.m_fX = 0f;
            this.m_fY++;
            this.PlaceKey(Keys.Capital, "Caps", 1.75f);
            this.PlaceKey(Keys.A);
            this.PlaceKey(Keys.S);
            this.PlaceKey(Keys.D);
            this.PlaceKey(Keys.F);
            this.PlaceKey(Keys.G);
            this.PlaceKey(Keys.H);
            this.PlaceKey(Keys.J);
            this.PlaceKey(Keys.K);
            this.PlaceKey(Keys.L);
            this.PlaceKey(Keys.Oem1, ";");
            this.PlaceKey(Keys.Oem7, "'");
            this.PlaceKey(Keys.Enter, (float)2.25f);
            this.Skip(3.5f);
            this.PlaceKey(Keys.NumPad4, "4");
            this.PlaceKey(Keys.NumPad5, "5");
            this.PlaceKey(Keys.NumPad6, "6");
            this.m_fX = 0f;
            this.m_fY++;
            this.PlaceKey(Keys.ShiftKey, "Shift", 2.25f);
            this.PlaceKey(Keys.Z);
            this.PlaceKey(Keys.X);
            this.PlaceKey(Keys.C);
            this.PlaceKey(Keys.V);
            this.PlaceKey(Keys.B);
            this.PlaceKey(Keys.N);
            this.PlaceKey(Keys.M);
            this.PlaceKey(Keys.Oemcomma, ",");
            this.PlaceKey(Keys.OemPeriod, ".");
            this.PlaceKey(Keys.Oem2, "/");
            this.PlaceKey(Keys.ShiftKey, "Shift", 2.75f);
            this.Skip(1.25f);
            this.PlaceKey(Keys.Up, "↑");
            this.Skip(1.25f);
            this.PlaceKey(Keys.NumPad1, "1");
            this.PlaceKey(Keys.NumPad2, "2");
            this.PlaceKey(Keys.NumPad3, "3");
            this.m_Bold = false;
            this.PlaceKey(Keys.Enter, "Entr", 1f, 2f);
            this.m_Bold = true;
            this.m_fX   = 0f;
            this.m_fY++;
            this.PlaceKey(Keys.ControlKey, "Ctrl", 1.5f);
            this.PlaceKey(Keys.LWin, "Win", 1.25f);
            this.PlaceKey(Keys.Menu, "Alt", 1.25f);
            this.PlaceKey(Keys.Space, (float)5.75f);
            this.PlaceKey(Keys.Menu, "Alt", 1.25f);
            this.PlaceKey(Keys.RWin, "Win", 1.25f);
            this.PlaceKey(Keys.Apps, (float)1.25f);
            this.PlaceKey(Keys.ControlKey, "Ctrl", 1.5f);
            this.Skip(0.25f);
            this.PlaceKey(Keys.Left, "←");
            this.PlaceKey(Keys.Down, "↓");
            this.PlaceKey(Keys.Right, "→");
            this.Skip(0.25f);
            this.PlaceKey(Keys.NumPad0, "0", 2f);
            this.PlaceKey(Keys.Decimal, ".");
            this.Mods = MacroModifiers.All;
        }
Пример #7
0
 public override Gump CreateGump()
 {
     return(new GSystemButton(0, 0, 100, 0x18, SystemColors.Control, SystemColors.ControlText, base.Name, Engine.GetUniFont(1))
     {
         FillAlpha = 1f, InactiveColor = GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), ActiveColor = GumpPaint.Blend(Color.SteelBlue, SystemColors.Control, (float)0.5f), PressedColor = GumpPaint.Blend(Color.White, GumpPaint.Blend(Color.SteelBlue, SystemColors.Control, (float)0.5f), (float)0.5f), OnClick = new OnClick(this.OnClicked)
     });
 }
Пример #8
0
 public GMacroKeyButton(Keys key, string name, bool bold, int x, int y, int w, int h) : base(x, y, w, h, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float) 0.5f), SystemColors.ControlText, name, bold ? Engine.GetUniFont(1) : Engine.GetUniFont(2))
 {
     this.m_Key       = key;
     base.Tooltip     = new Tooltip(string.Format("{0}\nClick to create", GMacroEditorPanel.GetKeyName(this.m_Key)), true);
     base.FillAlpha   = 1f;
     base.m_QuickDrag = false;
     base.m_CanDrag   = true;
     base.OnClick     = new OnClick(this.Clicked);
 }