Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ToolbarReference"/> class.
        /// </summary>
        /// <param name="list">A list of one <see cref="UiObject"/> controlled by the toolbar button.</param>
        public ToolbarReference(params object[] list)
        {
            if (list != null && list[0] != null)
            {
                if (list[0] != null)
                {
                    this.controlled = list[0] as UiObject;
                }
            }

            this.mainButton            = ToolbarManager.Instance.add("AGMReference", "AGMReferenceSwitch");
            this.mainButton.ToolTip    = Localizer.GetStringByTag("#autoLOC_AGM_003");
            this.mainButton.Visibility = new GameScenesVisibility(GameScenes.FLIGHT);
            this.mainButton.OnClick   +=
                (e) =>
            {
                if (e.MouseButton == 0)
                {
                    this.controlled.Visible     = !this.controlled.Visible;
                    this.mainButton.TexturePath = this.controlled.Visible ? this.mainPath + OnButton : this.mainPath + OffButton;
                }
            };

            this.SwitchTexture(this.controlled.Visible);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Toolbar"/> class.
        /// </summary>
        /// <param name="list">A list of one or two <see cref="UiObject"/> controlled by the toolbar button.</param>
        public Toolbar(params object[] list)
        {
            this.mainButton            = ToolbarManager.Instance.add("AGM", "AGMMainSwitch");
            this.mainButton.ToolTip    = Localizer.GetStringByTag("#autoLOC_AGM_004");
            this.mainButton.Visibility = new GameScenesVisibility(GameScenes.FLIGHT);
            this.mainButton.OnClick   +=
                (e) =>
            {
                if (e.MouseButton == 0)
                {
                    this.controlled.Visible     = !this.controlled.Visible;
                    this.mainButton.TexturePath = this.GetTexture();
                }
                else if (e.MouseButton == 1 && VisualUi.UiSettings.ToolBarListRightClick)
                {
                    this.secondaryControlled.Visible = !this.secondaryControlled.Visible;
                    this.mainButton.TexturePath      = this.GetTexture();
                }
            };

            if (list != null)
            {
                if (list[0] != null)
                {
                    this.controlled = list[0] as UiObject;
                }

                if (list[1] != null)
                {
                    this.secondaryControlled = list[1] as UiObject;
                }
            }

            this.mainButton.TexturePath = this.GetTexture();
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AppLauncher"/> class.
        /// </summary>
        /// <param name="list">A list of one or two <see cref="UiObject"/> controlled by the AppLauncher button.</param>
        public AppLauncher(params object[] list)
        {
            if (list != null)
            {
                if (list[0] != null)
                {
                    Program.AddDebugLog("Primary Launcher Button Left Click Assigned");
                    this.controlled = list[0] as UiObject;
                }

                if (list[1] != null)
                {
                    Program.AddDebugLog("Primary Launcher Button Right Click Assigned");
                    this.secondaryControlled = list[1] as UiObject;
                }
            }

            if (this.mainButton == null)
            {
                Program.AddDebugLog("Creating Primary Launcher Button");
                this.mainButton = ApplicationLauncher.Instance.AddModApplication(
                    this.OnClick,
                    this.OnClick,
                    null,
                    null,
                    null,
                    null,
                    ApplicationLauncher.AppScenes.FLIGHT,
                    GameDatabase.Instance.GetTexture(AppPath + "AppLauncherOff", false));

                this.mainButton.onRightClick += this.OnRightClick;
            }

            Program.AddDebugLog("Primary Launcher Button Created");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AppLauncherReference"/> class.
        /// </summary>
        /// <param name="list">A list of one <see cref="UiObject"/> controlled by the AppLauncherReference button.</param>
        public AppLauncherReference(params object[] list)
        {
            if (list != null && list[0] != null)
            {
                this.controlled = list[0] as UiObject;
            }

            if (this.mainButton == null)
            {
                this.mainButton = ApplicationLauncher.Instance.AddModApplication(
                    this.OnClick,
                    this.OnClick,
                    null,
                    null,
                    null,
                    null,
                    ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
                    GameDatabase.Instance.GetTexture(AppPath + (VisualUi.Manager.ShowReferenceWindow ? "AppLauncherListOn" : "AppLauncherListOff"), false));
            }

            this.SwitchTexture(this.controlled.Visible);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ToolbarControllerReference"/> class.
        /// </summary>
        /// <param name="list">A list of one <see cref="UiObject"/> controlled by the AppLauncherReference button.</param>
        public ToolbarControllerReference(params object[] list)
        {
            Program.AddDebugLog("ToolbarControllerReference ctor");
            if (list != null && list[0] != null)
            {
                this.controlled = list[0] as UiObject;
            }

            if (this.toolbarControl == null)
            {
                this.toolbarControl = VisualUi.Manager.gameObject.AddComponent <ToolbarControl>();
                this.toolbarControl.AddToAllToolbars(
                    this.OnClick,
                    this.OnClick,
                    ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
                    MODID,
                    "actionGroupManagerButton",
                    AppPath + (VisualUi.Manager.ShowReferenceWindow ? "AppLauncherListOn" : "AppLauncherListOff"),
                    AppPath + (VisualUi.Manager.ShowReferenceWindow ? OnButton : OffButton),
                    Localizer.GetStringByTag(MODNAME));
            }

            this.SwitchTexture(this.controlled.Visible);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ToolbarController"/> class.
        /// </summary>
        /// <param name="list">A list of one or two <see cref="UiObject"/> controlled by the AppLauncher button.</param>
        public ToolbarController(params object[] list)
        {
            if (list != null)
            {
                if (list[0] != null)
                {
                    Program.AddDebugLog("ToolbarController Button Left Click Assigned");
                    this.controlled = list[0] as UiObject;
                }

                if (list[1] != null)
                {
                    Program.AddDebugLog("ToolbarController Button Right Click Assigned");
                    this.secondaryControlled = list[1] as UiObject;
                }
            }

            if (this.toolbarControl == null)
            {
                Program.AddDebugLog("Creating Primary Launcher Button");

                this.toolbarControl = VisualUi.Manager.gameObject.AddComponent <ToolbarControl>();
                this.toolbarControl.AddToAllToolbars(
                    this.OnClick,
                    this.OnClick,
                    ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
                    ToolbarControllerReference.MODID,
                    "actionGroupManagerButton",
                    AppPath + "AppLauncherOff",
                    AppPath + OffButton,
                    Localizer.GetStringByTag(ToolbarControllerReference.MODNAME));
                this.toolbarControl.AddLeftRightClickCallbacks(null, this.OnRightClick);
            }

            Program.AddDebugLog("Primary Launcher Button Created");
        }