示例#1
0
        public Editor(Configuration configuration)
        {
            m_LauncherButton = new LauncherButton();
            m_ToolbarButton = new ToolbarButton();

            m_Position = new Rect(0.5f * Screen.width - 200.0f, 0.5f * Screen.height - 250.0f, 400.0f, 450.0f);

            m_NextButtonTexture = GameDatabase.Instance.GetTexture("KSEA/Historian/Historian_Button_Next", false);
            m_PreviousButtonTexture = GameDatabase.Instance.GetTexture("KSEA/Historian/Historian_Button_Previous", false);

            m_EnableLauncherButton = configuration.EnableLauncherButton;
            m_EnableToolberButton = configuration.EnableToolbarButton;

            if (m_EnableLauncherButton)
            {
                m_LauncherButton.OnTrue += Button_OnTrue;
                m_LauncherButton.OnFalse += Button_OnFalse;

                m_LauncherButton.Register();
            }

            if (m_EnableToolberButton)
            {
                m_ToolbarButton.OnTrue += Button_OnTrue;
                m_ToolbarButton.OnFalse += Button_OnFalse;
                m_ToolbarButton.OnAlternateClick += Button_OnAlternateClick;

                m_ToolbarButton.Register();
            }
        }
示例#2
0
        void ManageButtons()
        {
            if (enableLauncherButton && !appLauncherButton.IsRegistered)
            {
                appLauncherButton.Click += Button_Click;
                appLauncherButton.Register();
            }
            else if (!enableLauncherButton && appLauncherButton.IsRegistered)
            {
                appLauncherButton.Click -= Button_Click;
                appLauncherButton.Unregister();
            }

            if (enableToolberButton && ToolbarManager.ToolbarAvailable && !toolbarButton.IsRegistered)
            {
                toolbarButton.OnTrue  += Button_Click;
                toolbarButton.OnFalse += Button_Click;

                toolbarButton.SetState(isOpen);

                toolbarButton.Register();
            }
            else if (!enableToolberButton && ToolbarManager.ToolbarAvailable && toolbarButton.IsRegistered)
            {
                toolbarButton.OnTrue  -= Button_Click;
                toolbarButton.OnFalse -= Button_Click;

                toolbarButton.SetState(isOpen);

                toolbarButton.Unregister();
            }
        }
示例#3
0
        public Editor(Configuration configuration)
        {
            //m_LauncherButton = new LauncherButton();
            toolbarButton = new ToolbarButton();

            var windowHeight = 580f;
            var windowWidth  = 900f;

            //if (GameSettings.KERBIN_TIME)
            //    windowHeight += 100; // add extra height for Kerbin month/day name fields

            position = new Rect(0.5f * Screen.width - windowWidth / 2, 0.5f * Screen.height - windowHeight / 2, windowWidth, windowHeight);
            windowId = (new System.Random()).Next(876543210, 987654321); // 9 digit random number

            nextButtonTexture     = GameDatabase.Instance.GetTexture("Historian/Historian_Button_Next", false);
            previousButtonTexture = GameDatabase.Instance.GetTexture("Historian/Historian_Button_Previous", false);

            enableLauncherButton = configuration.EnableLauncherButton;
            enableToolberButton  = configuration.EnableToolbarButton;

            if (enableLauncherButton)
            {
                appLauncherButton.Click += Button_Click;

                if (!appLauncherButton.IsRegistered)
                {
                    appLauncherButton.Register();
                }
            }

            if (ToolbarManager.ToolbarAvailable && enableToolberButton)
            {
                toolbarButton.OnTrue           += Toggle;
                toolbarButton.OnFalse          += Toggle;
                toolbarButton.OnAlternateClick += Button_OnAlternateClick;

                toolbarButton.Register();
            }
        }