示例#1
0
        private void Clicked(Gump g)
        {
            GMacroEditorForm gmacroEditorForm = this.m_Parent.Parent as GMacroEditorForm;

            if (gmacroEditorForm == null)
            {
                return;
            }
            if (this.m_Macro == null)
            {
                Keys           keys           = Keys.None;
                MacroModifiers macroModifiers = MacroModifiers.All;
                if (gmacroEditorForm.Keyboard != null)
                {
                    macroModifiers = gmacroEditorForm.Keyboard.Mods;
                }
                if (macroModifiers == MacroModifiers.All)
                {
                    keys = Control.ModifierKeys;
                }
                else
                {
                    if ((macroModifiers & MacroModifiers.Alt) != MacroModifiers.None)
                    {
                        keys |= Keys.Alt;
                    }
                    if ((macroModifiers & MacroModifiers.Shift) != MacroModifiers.None)
                    {
                        keys |= Keys.Shift;
                    }
                    if ((macroModifiers & MacroModifiers.Ctrl) != MacroModifiers.None)
                    {
                        keys |= Keys.Control;
                    }
                }
                MacroSet     current = Macros.Current;
                PlayUO.Macro macro   = new PlayUO.Macro(new MacroData()
                {
                    Key = this.m_Key, Mods = keys
                });
                current.Macros.Add(macro);
                gmacroEditorForm.Current = macro;
                gmacroEditorForm.UpdateKeyboard();
            }
            else if (this.m_Macro is PlayUO.Macro)
            {
                gmacroEditorForm.Current = (PlayUO.Macro) this.m_Macro;
            }
            else
            {
                if (!(this.m_Macro is PlayUO.Macro[]))
                {
                    return;
                }
                PlayUO.Macro[] array = (PlayUO.Macro[]) this.m_Macro;
                int            num   = Array.IndexOf <PlayUO.Macro>(array, gmacroEditorForm.Current);
                gmacroEditorForm.Current = array[(num + 1) % array.Length];
            }
        }
 public bool MoveNext()
 {
     if (this._index < this._collection.Count - 1)
     {
         this._index          = this._index + 1;
         this._currentElement = this._collection[this._index];
         return(true);
     }
     this._index = this._collection.Count;
     return(false);
 }
示例#3
0
        private static MacroSet FindCurrent()
        {
            MacroConfig config  = Macros.Config;
            Mobile      player  = World.Player;
            MacroSet    current = Macros.FindCurrent(config, player);

            if (current == null && player != null)
            {
                current = Macros.FindCurrent(config, (Mobile)null);
            }
            return(current);
        }
示例#4
0
        private static MacroSet FindCurrent(MacroConfig config, Mobile mob)
        {
            int      index1   = mob == null ? 0 : mob.Serial;
            int      index2   = mob == null ? 0 : (Engine.m_ServerName == null ? 0 : Engine.m_ServerName.GetHashCode());
            MacroSet macroSet = config[index1, index2];

            if (macroSet == null && (mob == null || Macros.Exists(Macros.GetMobilePath(mob))))
            {
                macroSet        = Macros.LoadTextMacroSet(mob);
                macroSet.Serial = index1;
                macroSet.Server = index2;
                config.MacroSets.Add(macroSet);
                Macros.Save();
            }
            return(macroSet);
        }
 public void Reset()
 {
     this._index          = -1;
     this._currentElement = (MacroSet)null;
 }
 public void Insert(int index, MacroSet value)
 {
     this.List.Insert(index, (object)value);
 }
 public void Remove(MacroSet value)
 {
     this.List.Remove((object)value);
 }
 public int IndexOf(MacroSet value)
 {
     return(this.List.IndexOf((object)value));
 }
 public bool Contains(MacroSet value)
 {
     return(this.List.Contains((object)value));
 }
示例#10
0
 public int Add(MacroSet value)
 {
     return(this.List.Add((object)value));
 }
示例#11
0
 public static void Reset()
 {
     Macros.StopAll();
     Macros.m_Current = (MacroSet)null;
     Macros.m_Current = Macros.Current;
 }
示例#12
0
        public static MacroSet LoadTextMacroSet(string fileName)
        {
            MacroSet macroSet = new MacroSet();
            string   path     = Engine.FileManager.BasePath(string.Format("data/ultima/macros/{0}.txt", (object)fileName));

            if (File.Exists(path))
            {
                using (StreamReader ip = new StreamReader(path))
                {
                    string line1;
                    string line2;
                    while (true)
                    {
                        line1 = Macros.ReadLine(ip);
                        if (line1 != null)
                        {
                            if (line1.Length == 5)
                            {
                                string[] strArray = line1.Split(' ');
                                if (strArray.Length == 3)
                                {
                                    bool flag = true;
                                    for (int index = 0; flag && index < strArray.Length; ++index)
                                    {
                                        flag = strArray[index] == "0" || strArray[index] == "1";
                                    }
                                    if (flag)
                                    {
                                        Keys keys1 = Keys.None;
                                        if (strArray[0] != "0")
                                        {
                                            keys1 |= Keys.Control;
                                        }
                                        if (strArray[1] != "0")
                                        {
                                            keys1 |= Keys.Alt;
                                        }
                                        if (strArray[2] != "0")
                                        {
                                            keys1 |= Keys.Shift;
                                        }
                                        line2 = Macros.ReadLine(ip);
                                        if (line2 != null)
                                        {
                                            Keys keys2 = Keys.KeyCode | Keys.Modifiers;
                                            switch (line2)
                                            {
                                            case "WheelUp":
                                            case "Wheel Up":
                                                keys2 = (Keys)69632;
                                                break;

                                            case "WheelDown":
                                            case "Wheel Down":
                                                keys2 = (Keys)69633;
                                                break;

                                            case "WheelPress":
                                            case "Wheel Press":
                                                keys2 = (Keys)69634;
                                                break;

                                            default:
                                                try
                                                {
                                                    keys2 = (Keys)Enum.Parse(typeof(Keys), line2, true);
                                                    break;
                                                }
                                                catch
                                                {
                                                    break;
                                                }
                                            }
                                            if (keys2 != (Keys.KeyCode | Keys.Modifiers))
                                            {
                                                MacroData data = new MacroData();
                                                data.Key  = keys2;
                                                data.Mods = keys1;
                                                string command;
                                                while ((command = Macros.ReadLine(ip)) != null && !command.StartsWith("#"))
                                                {
                                                    int    length = command.IndexOf(' ');
                                                    Action action = length < 0 ? new Action(command, "") : new Action(command.Substring(0, length), command.Substring(length + 1));
                                                    if (action.Handler == null)
                                                    {
                                                        Debug.Trace("Bad macro action: {0}", (object)command);
                                                    }
                                                    data.Actions.Add(action);
                                                }
                                                macroSet.Macros.Add(new Macro(data));
                                            }
                                            else
                                            {
                                                goto label_26;
                                            }
                                        }
                                        else
                                        {
                                            goto label_36;
                                        }
                                    }
                                    else
                                    {
                                        goto label_11;
                                    }
                                }
                                else
                                {
                                    goto label_6;
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                        else
                        {
                            goto label_36;
                        }
                    }
                    Macros.Skip(line1, ip);
                    goto label_36;
label_6:
                    Macros.Skip(line1, ip);
                    goto label_36;
label_11:
                    Macros.Skip(line1, ip);
                    goto label_36;
label_26:
                    Macros.Skip(line2, ip);
                }
            }
label_36:
            return(macroSet);
        }