Esempio n. 1
0
        public void AddButton(string text, ModMenuItemClickedCallback callback)
        {
            if (_modMenuItems == null)
            {
                throw new InvalidOperationException("Looks like you are too late, menu already created...");
            }

            if (!(callback.Method.IsStatic && callback.Method.IsPublic))
                throw new ArgumentException("Click callback has to be public & static! " + callback.Method.Name + " is not.");
            if (UnmutableMethodModification.IsCompilerGenerated(callback.Method))
                throw new ArgumentException("Click callback cannot be compiler generated");
            UnmutableMethodModification.VerifyNestedPublicMethod(callback.Method);

            _modMenuItems.Add(text, callback);
        }
Esempio n. 2
0
        public void AddButton(string text, ModMenuItemClickedCallback callback)
        {
            if (_modMenuItems == null)
            {
                throw new InvalidOperationException("Looks like you are too late, menu already created...");
            }

            if (!(callback.Method.IsStatic && callback.Method.IsPublic))
            {
                throw new ArgumentException("Click callback has to be public & static! " + callback.Method.Name + " is not.");
            }
            if (UnmutableMethodModification.IsCompilerGenerated(callback.Method))
            {
                throw new ArgumentException("Click callback cannot be compiler generated");
            }
            UnmutableMethodModification.VerifyNestedPublicMethod(callback.Method);

            _modMenuItems.Add(text, callback);
        }
 public static void AddItem(string text, ModMenuItemClickedCallback callback)
 {
     Instance.AddButton(text, callback);
 }
Esempio n. 4
0
 public static void AddItem(string text, ModMenuItemClickedCallback callback)
 {
     Instance.AddButton(text, callback);
 }