public MacroControl(string name) { CanMove = true; _hotkeyBox = new HotkeyBox(); _hotkeyBox.HotkeyChanged += BoxOnHotkeyChanged; _hotkeyBox.HotkeyCancelled += BoxOnHotkeyCancelled; Add(_hotkeyBox); Add(new NiceButton(0, _hotkeyBox.Height + 3, 170, 25, ButtonAction.Activate, "+ Create macro button", 0, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT) { ButtonParameter = 2, IsSelectable = false }); Add(new NiceButton(0, _hotkeyBox.Height + 30, 50, 25, ButtonAction.Activate, "Add") { IsSelectable = false }); Add(new NiceButton(52, _hotkeyBox.Height + 30, 50, 25, ButtonAction.Activate, "Remove") { ButtonParameter = 1, IsSelectable = false }); Add(_collection = new MacroCollectionControl(name, 280, 280) { Y = _hotkeyBox.Height + 50 + 10 }); SetupKeyByDefault(); }
public MacroControl(string name) { CanMove = true; _hotkeyBox = new HotkeyBox(); _hotkeyBox.HotkeyChanged += BoxOnHotkeyChanged; _hotkeyBox.HotkeyCancelled += BoxOnHotkeyCancelled; Add(_hotkeyBox); Add ( new NiceButton ( 0, _hotkeyBox.Height + 3, 170, 25, ButtonAction.Activate, ResGumps.CreateMacroButton, 0, TEXT_ALIGN_TYPE.TS_LEFT ) { ButtonParameter = 2, IsSelectable = false } ); Add ( new NiceButton(0, _hotkeyBox.Height + 30, 50, 25, ButtonAction.Activate, ResGumps.Add) { IsSelectable = false } ); Add ( new NiceButton(52, _hotkeyBox.Height + 30, 50, 25, ButtonAction.Activate, ResGumps.Remove) { ButtonParameter = 1, IsSelectable = false } ); ScrollArea area = new ScrollArea(10, _hotkeyBox.Bounds.Bottom + 80, 280, 280, true); Add(area); _databox = new DataBox(0, 0, 280, 280); _databox.WantUpdateSize = true; area.Add(_databox); Macro = Client.Game.GetScene <GameScene>().Macros.FindMacro(name) ?? Macro.CreateEmptyMacro(name); SetupKeyByDefault(); SetupMacroUI(); }
public MacroControl(string name) { CanMove = true; HotkeyBox box = new HotkeyBox(); box.HotkeyChanged += BoxOnHotkeyChanged; box.HotkeyCancelled += BoxOnHotkeyCancelled; Add(box); Add(new NiceButton(0, box.Height + 3, 170, 25, ButtonAction.Activate, "+ Create macro button", 0, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT) { ButtonParameter = 2, IsSelectable = false }); Add(new NiceButton(0, box.Height + 30, 50, 25, ButtonAction.Activate, "Add") { IsSelectable = false }); Add(new NiceButton(52, box.Height + 30, 50, 25, ButtonAction.Activate, "Remove") { ButtonParameter = 1, IsSelectable = false }); Add(_collection = new MacroCollectionControl(name, 280, 280) { Y = box.Height + 50 + 10 }); if (_collection.Macro.Key != SDL.SDL_Keycode.SDLK_UNKNOWN) { SDL.SDL_Keymod mod = SDL.SDL_Keymod.KMOD_NONE; if (_collection.Macro.Alt) { mod |= SDL.SDL_Keymod.KMOD_ALT; } if (_collection.Macro.Shift) { mod |= SDL.SDL_Keymod.KMOD_SHIFT; } if (_collection.Macro.Ctrl) { mod |= SDL.SDL_Keymod.KMOD_CTRL; } box.SetKey(_collection.Macro.Key, mod); } }
public MacroControl(string name) { CanMove = true; HotkeyBox box = new HotkeyBox(); box.HotkeyChanged += BoxOnHotkeyChanged; box.HotkeyCancelled += BoxOnHotkeyCancelled; Add(box); Add(new NiceButton(0, box.Height + 3, 50, 25, ButtonAction.Activate, "Add") { IsSelectable = false }); Add(new NiceButton(52, box.Height + 3, 50, 25, ButtonAction.Activate, "Remove") { ToPage = 1, IsSelectable = false }); Add(_collection = new MacroCollectionControl(name, 280, 280) { Y = box.Height + 25 + 10 }); if (_collection.Macro.Key != SDL.SDL_Keycode.SDLK_UNKNOWN) { SDL.SDL_Keymod mod = SDL.SDL_Keymod.KMOD_NONE; if (_collection.Macro.Alt) { mod |= SDL.SDL_Keymod.KMOD_LALT; } if (_collection.Macro.Shift) { mod |= SDL.SDL_Keymod.KMOD_LSHIFT; } if (_collection.Macro.Ctrl) { mod |= SDL.SDL_Keymod.KMOD_LCTRL; } box.SetKey(_collection.Macro.Key, mod); } }
public void AddNew(HotkeyAction action) { HotkeyBox box = new HotkeyBox { X = 150 }; box.HotkeyChanged += (sender, e) => { GameScene gs = Client.Game.GetScene <GameScene>(); if (gs == null) { return; } if (gs.Hotkeys.Bind(_key, box.Key, box.Mod)) { } else // show a popup { UIManager.Add(new MessageBoxGump(400, 200, ResGumps.KeyCombinationAlreadyExists, null)); } }; box.HotkeyCancelled += (sender, e) => { GameScene gs = Client.Game.GetScene <GameScene>(); if (gs == null) { return; } gs.Hotkeys.UnBind(_key); }; if (_hotkesBoxes.Count != 0) { box.Y = _hotkesBoxes[_hotkesBoxes.Count - 1] .Bounds.Bottom; } _hotkesBoxes.Add(box); Add(box); }
public MacroControl(string name) { CanMove = true; _hotkeyBox = new HotkeyBox(); _hotkeyBox.HotkeyChanged += BoxOnHotkeyChanged; _hotkeyBox.HotkeyCancelled += BoxOnHotkeyCancelled; Add(_hotkeyBox); Add(new NiceButton(0, _hotkeyBox.Height + 3, 170, 25, ButtonAction.Activate, LanguageManager.Current.UI_AddMacroButton, 0, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT) { ButtonParameter = 2, IsSelectable = false }); Add(new NiceButton(0, _hotkeyBox.Height + 30, 50, 25, ButtonAction.Activate, LanguageManager.Current.UI_Add) { IsSelectable = false }); Add(new NiceButton(52, _hotkeyBox.Height + 30, 50, 25, ButtonAction.Activate, LanguageManager.Current.UI_Remove) { ButtonParameter = 1, IsSelectable = false }); Add(_collection = new MacroCollectionControl(name, 280, 280) { Y = _hotkeyBox.Height + 50 + 10 }); SetupKeyByDefault(); _checkbox = new Checkbox(0x00D2, 0x00D3, LanguageManager.Current.UI_Macro_Repeat, 0xFF, 999) { IsChecked = _collection.Macro.Repeat }; _checkbox.X = 0; _checkbox.Y = _hotkeyBox.Height + 60; _checkbox.ValueChanged += Ischecked; Add(_checkbox); _delaybar = new HSliderBar(50, _hotkeyBox.Height + 85, 150, 100, 5000, _collection.Macro.Delay, HSliderBarStyle.MetalWidgetRecessedBar, true, 0xff, 999); _delaybar.ValueChanged += Delaychanged; Add(_delaybar); }
public void AddNew(HotkeyAction action) { HotkeyBox box = new HotkeyBox() { X = 150, }; box.HotkeyChanged += (sender, e) => { GameScene gs = Engine.SceneManager.GetScene <GameScene>(); if (gs == null) { return; } if (gs.Hotkeys.Bind(_key, box.Key, box.Mod)) { } else // show a popup { Engine.UI.Add(new MessageBoxGump(400, 200, "Key combination already exists.", null)); } }; box.HotkeyCancelled += (sender, e) => { GameScene gs = Engine.SceneManager.GetScene <GameScene>(); if (gs == null) { return; } gs.Hotkeys.UnBind(_key); }; if (_hotkesBoxes.Count != 0) { box.Y = _hotkesBoxes[_hotkesBoxes.Count - 1].Bounds.Bottom; } _hotkesBoxes.Add(box); Add(box); }
private void BoxOnHotkeyChanged(object sender, EventArgs e) { HotkeyBox b = (HotkeyBox)sender; bool shift = (b.Mod & SDL.SDL_Keymod.KMOD_SHIFT) != SDL.SDL_Keymod.KMOD_NONE; bool alt = (b.Mod & SDL.SDL_Keymod.KMOD_ALT) != SDL.SDL_Keymod.KMOD_NONE; bool ctrl = (b.Mod & SDL.SDL_Keymod.KMOD_CTRL) != SDL.SDL_Keymod.KMOD_NONE; if (b.Key != SDL.SDL_Keycode.SDLK_UNKNOWN && CUOEnviroment.Client.GetScene <GameScene>().Macros.FindMacro(b.Key, alt, ctrl, shift) != null) { MessageBoxGump gump = new MessageBoxGump(250, 250, "This key combination\nalready exists.", s => { b.SetKey(SDL.SDL_Keycode.SDLK_UNKNOWN, SDL.SDL_Keymod.KMOD_NONE); }); UIManager.Add(gump); } else { Macro m = _collection.Macro; m.Key = b.Key; m.Shift = shift; m.Alt = alt; m.Ctrl = ctrl; } }
public MacroControl(string name, bool isFastAssign = false) { CanMove = true; _hotkeyBox = new HotkeyBox(); _hotkeyBox.HotkeyChanged += BoxOnHotkeyChanged; _hotkeyBox.HotkeyCancelled += BoxOnHotkeyCancelled; Add(_hotkeyBox); Add ( new NiceButton ( 0, _hotkeyBox.Height + 3, 170, 25, ButtonAction.Activate, ResGumps.CreateMacroButton, 0, TEXT_ALIGN_TYPE.TS_LEFT ) { ButtonParameter = (int)buttonsOption.CreateNewMacro, IsSelectable = false } ); if (!isFastAssign) { Add ( new NiceButton ( 0, _hotkeyBox.Height + 30, 50, 25, ButtonAction.Activate, ResGumps.Add ) { ButtonParameter = (int)buttonsOption.AddBtn, IsSelectable = false } ); Add ( new NiceButton ( 52, _hotkeyBox.Height + 30, 50, 25, ButtonAction.Activate, ResGumps.Remove, 0, TEXT_ALIGN_TYPE.TS_LEFT ) { ButtonParameter = (int)buttonsOption.RemoveBtn, IsSelectable = false } ); } else { Add ( new NiceButton ( 0, _hotkeyBox.Height + 30, 170, 25, ButtonAction.Activate, ResGumps.OpenMacroSettings ) { ButtonParameter = (int)buttonsOption.OpenMacroOptions, IsSelectable = false } ); } var scrollAreaH = isFastAssign ? 80 : 280; var scrollAreaW = isFastAssign ? 230 : 280; ScrollArea area = new ScrollArea ( 10, _hotkeyBox.Bounds.Bottom + 80, scrollAreaW, scrollAreaH, true ); Add(area); _databox = new DataBox(0, 0, 280, 280) { WantUpdateSize = true }; area.Add(_databox); Macro = Client.Game.GetScene <GameScene>().Macros.FindMacro(name) ?? Macro.CreateEmptyMacro(name); SetupKeyByDefault(); SetupMacroUI(); }