Пример #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Menu" /> class.
        /// </summary>
        /// <param name="displayName">
        ///     The display name.
        /// </param>
        /// <param name="name">
        ///     The name.
        /// </param>
        /// <param name="isRootMenu">
        ///     Indicates whether the menu has root attribute.
        /// </param>
        public Menu(string displayName, string name, bool isRootMenu = false)
        {
            this.DisplayName = MenuGlobals.Function001(displayName);
            this.Name        = name;
            this.IsRootMenu  = isRootMenu;
            this.Style       = FontStyle.Regular;
            this.Color       = Color.White;

            if (isRootMenu)
            {
                CustomEvents.Game.OnGameEnd += delegate { this.SaveAll(); };
                Game.OnEnd += delegate { this.SaveAll(); };
                AppDomain.CurrentDomain.DomainUnload += delegate { this.SaveAll(); };
                AppDomain.CurrentDomain.ProcessExit  += delegate { this.SaveAll(); };

                var rootName = Assembly.GetCallingAssembly().GetName().Name + "." + name;

                if (RootMenus.ContainsKey(rootName))
                {
                    throw new ArgumentException(@"Root Menu [" + rootName + @"] with the same name exists", "name");
                }

                RootMenus.Add(rootName, this);
            }
        }
Пример #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Menu" /> class.
        /// </summary>
        /// <param name="name">
        ///     The name.
        /// </param>
        /// <param name="displayName">
        ///     The display name.
        /// </param>
        /// <param name="championUnique">
        ///     Indicates whether the menu item is champion unique.
        /// </param>
        public MenuItem(string name, string displayName, bool championUnique = false)
        {
            if (championUnique)
            {
                name = Player.Instance.ChampionName + name;
            }

            this.Name        = name;
            this.DisplayName = MenuGlobals.Function001(displayName);
            this.FontStyle   = FontStyle.Regular;
            this.FontColor   = Color.White;
            this.ShowItem    = true;
            this.Tag         = 0;
            //this.configName = name + Assembly.GetCallingAssembly().GetType().GUID;
            this.configName = Assembly.GetCallingAssembly().GetName().Name
                              + Assembly.GetCallingAssembly().GetType().GUID;
        }