public override void OnLevelLoaded(LoadMode mode)
        {
            if (mode == LoadMode.LoadGame || mode == LoadMode.NewGame)
            {
                UIView view = UIView.GetAView();
                UI = ToolsModifierControl.toolController.gameObject.AddComponent <MainPanel>();

                renderingManager         = RenderingManager.instance;
                renderingManager.enabled = true;
                if (renderingManager != null && !renderingManager.registered)
                {
                    RenderManager.RegisterRenderableManager(renderingManager);
                    renderingManager.registered = true;
                }
                renderingManager.initTimer();

                /*ModSettings.LoadSettings();
                *
                *
                *
                *
                *
                *  MarkARouteOptions.mInGame = true;
                *  MarkARouteOptions.update();*/
            }
        }
Пример #2
0
 /// <summary>
 /// Display the app launcher.
 /// </summary>
 public void onActivate()
 {
     Debug.Log("Kartographer App Launch Activate - Pos:" + _windowPos.x + " " + _windowPos.y);
     _windowPos.height = 0.0f;
     _active           = true;
     RenderingManager.AddToPostDrawQueue(0, OnDraw);
 }
        /*
         * Called after the scene is loaded.
         */
        void Awake()
        {
            //GUI id hashcodes
            mainGUIID         = Guid.NewGuid().GetHashCode();
            windGUIID         = Guid.NewGuid().GetHashCode();
            rainGUIID         = Guid.NewGuid().GetHashCode();
            cloudsGUIID       = Guid.NewGuid().GetHashCode();
            stormGUIID        = Guid.NewGuid().GetHashCode();
            snowGUIID         = Guid.NewGuid().GetHashCode();
            windSettingsGUIID = Guid.NewGuid().GetHashCode();
            windStormGUIID    = Guid.NewGuid().GetHashCode();
            weatherDataGUIID  = Guid.NewGuid().GetHashCode();
            cellDataTestGUIID = Guid.NewGuid().GetHashCode();

            Random.seed = (int)System.DateTime.Now.Ticks;   //helps with the random process
            RenderingManager.AddToPostDrawQueue(0, OnDraw); //Draw the stuffs
            //windDirectionNumb = Random.Range(1, 9); //Set wind direction
            windSpeed          = 1.0f;
            windDirectionLabel = Wind.WindDirectionLabel;
            windDirectionNumb  = Wind.windDirectionNumb;


            Debug.Log("WIND: setting wind function"); //Write to debug
            FARWind.SetWindFunction(windStuff);       //Set the WindFunction to the windStuff Function

            //Empty the strings so Unity won't throw a shit fit.
            windSpeedString         = string.Empty;
            WSMGSString             = string.Empty;
            WindGustTimeString      = string.Empty;
            WindGustDirectionString = string.Empty;
            CellIDLabel             = string.Empty;
        }
Пример #4
0
 protected override void Draw(GameTime gameTime)
 {
     base.Draw(gameTime);
     RenderingManager.startDraw();
     SceneManager.draw();
     RenderingManager.endDraw();
 }
Пример #5
0
 /// <summary>
 ///     Initialises the object's state on creation.
 /// </summary>
 private void Start()
 {
     this.windowId = this.GetHashCode();
     this.InitialiseStyles();
     RenderingManager.AddToPostDrawQueue(0, this.Draw);
     GuiDisplaySize.OnSizeChanged += this.OnSizeChanged;
 }
Пример #6
0
        public void OnGUI()
        {
            //var texture2D = FlightGlobals.Bodies[1].BiomeMap.Map;
            //GUI.DrawTexture(new Rect(0, 0, Screen.height, Screen.width), texture2D);


            //Do the GUI Stuff - basically get the workers draw stuff into the postrendering queue
            //If the two flags are different are we going in or out of the queue
            if (_shouldBeInPostDrawQueue != _isInPostDrawQueue)
            {
                if (_shouldBeInPostDrawQueue && !_isInPostDrawQueue)
                {
                    Utilities.DebugLogFormatted(LogLevel.Diagnostic, "Adding DrawGUI to PostRender Queue");

                    //reset any existing pane display
                    //WorkerObjectInstance.ResetPanes();

                    //Add to the queue
                    RenderingManager.AddToPostDrawQueue(5, DrawGUI);
                    _isInPostDrawQueue = true;

                    //if we are adding the renderer and we are in flight then do the daily version check if required
                    //if (HighLogic.LoadedScene == GameScenes.FLIGHT && Settings.DailyVersionCheck)
                    //    Settings.VersionCheck(false);
                }
                else
                {
                    Utilities.DebugLogFormatted(LogLevel.Diagnostic, "Removing DrawGUI from PostRender Queue");
                    RenderingManager.RemoveFromPostDrawQueue(5, DrawGUI);
                    _isInPostDrawQueue = false;
                }
            }
        }
Пример #7
0
        public Game1(
            IGameSetup gameSetup,
            IDeltaTimeCalculator deltaTimeCalculator,
            IGameCollection <Entity> entityList,
            IGameCollection <Player> playerList,
            IGameCollection <Bullet> bulletList,
            IPlayerActionManager playerActionManager,
            IBulletMovementManger bulletMovementManger)
        {
            this.gameSetup           = gameSetup;
            graphics                 = new GraphicsDeviceManager(this);
            Content.RootDirectory    = "Content";
            this.deltaTimeCalculator = deltaTimeCalculator;

            // Assets
            assetLoader = new AssetLoader(Content);

            // Collections
            this.entityList = entityList;
            this.playerList = playerList;
            this.bulletList = bulletList;

            // Rendering
            renderingManager = new RenderingManager(assetLoader);

            // Game setup
            playerList.AddListRange(this.gameSetup.SetUpPlayers());
            this.playerActionManager  = playerActionManager;
            this.bulletMovementManger = bulletMovementManger;

            // Window size
            graphics.PreferredBackBufferWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
        }
        protected bool variabledt = true;             // Set this to true to allow the predictor to choose a dt based on how long each run is taking, and false to use a fixed dt.

        public override void OnStart(PartModule.StartState state)
        {
            if (state != PartModule.StartState.None && state != PartModule.StartState.Editor)
            {
                RenderingManager.AddToPostDrawQueue(1, DoMapView);
            }
        }
Пример #9
0
        public void Start()
        {
            instance = this;

            if (!init)
            {
                Initialise();
            }

            // register vessel
            if (FlightData.thisVessel == null)
            {
                FlightData.thisVessel = FlightGlobals.ActiveVessel;
            }

            PresetManager.loadCraftAsstPreset();

            Utils.GetAsst(PIDList.Aileron).InMax  = 180;
            Utils.GetAsst(PIDList.Aileron).InMin  = -180;
            Utils.GetAsst(PIDList.Altitude).InMin = 0;
            Utils.GetAsst(PIDList.Throttle).InMin = 0;

            FlightData.thisVessel.OnPostAutopilotUpdate += new FlightInputCallback(vesselController);
            GameEvents.onVesselChange.Add(vesselSwitch);

            RenderingManager.AddToPostDrawQueue(5, drawGUI);
        }
 private void OnEditorAttach()
 {
     if (this.part.IsPrimaryEditor(this.ClassID))
     {
         RenderingManager.AddToPostDrawQueue(0, onDraw);
     }
 }
Пример #11
0
    public void OnDestroy()
    {
        //MonoBehaviour.print("Destroy Science Settings");
        SaveSettings();

        RenderingManager.RemoveFromPostDrawQueue(3, OnDraw);
    }
Пример #12
0
 public void HailerGUIOpen()
 {
     RenderingManager.AddToPostDrawQueue(3, new Callback(drawGUI));
     Events["HailerGUIOpen"].active  = false;
     Events["HailerGUIClose"].active = true;
     guiopen = true;
 }
        public override void OnStart(PartModule.StartState state)
        {
            ExecuteOnStartOperations();
            InitStyles();
            isVisible = false;

            if (state == StartState.Editor)
            {
                isInEditor = true;
                this.part.OnEditorAttach  += OnEditorAttach;
                this.part.OnEditorDetach  += OnEditorDetach;
                this.part.OnEditorDestroy += OnEditorDestroy;
                OnEditorAttach();
            }
            else
            {
                isInEditor = false;
                RenderingManager.AddToPostDrawQueue(0, onDraw);
            }

            if (_appButton == null && (!isInEditor && this.part.IsPrimary(this.vessel.parts, this.ClassID)) || this.part.IsPrimaryEditor(this.ClassID))
            {
                _appButton = ApplicationLauncher.Instance.AddModApplication(this.ButtonOn, this.ButtonOff, null, null, null, null, ApplicationLauncher.AppScenes.ALWAYS, GameDatabase.Instance.GetTexture("RemoteTech2_Assist/Textures/Toolbar", false));
            }
        }
Пример #14
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     SceneManager.init();
     RenderingManager.init(graphics, spriteBatch, Content);
     StartupManager.startUp();
 }
        public void onTargetSelectionWindow(int windowId)
        {
            GUILayout.BeginVertical();

            for (int x = 0; x < PlanetList.Length; x++)
            {
                if (GUILayout.Button(PlanetList[x][0]))
                {
                    SelectedItem = PlanetList[x][0];
                    RenderingManager.RemoveFromPostDrawQueue(1, DrawTargetSelection);
                    isChosing = false;
                }

                for (int x1 = 1; x1 < PlanetList[x].Length; x1++)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(30);
                    if (GUILayout.Button(PlanetList[x][x1]))
                    {
                        SelectedItem = PlanetList[x][x1];
                        RenderingManager.RemoveFromPostDrawQueue(1, DrawTargetSelection);
                        isChosing = false;
                    }
                    GUILayout.EndHorizontal();
                }
            }

            GUILayout.EndVertical();
        }
 private void OnEditorDestroy()
 {
     if (this.part.IsPrimaryEditor(this.ClassID))
     {
         RenderingManager.RemoveFromPostDrawQueue(0, onDraw);
     }
 }
Пример #17
0
        public TimeWarpDecorator()
        {
            mFlightButtonGreen  = GUITextureButtonFactory.CreateFromFilename("texFlightGreen.png", "texFlightGreenOver.png", "texFlightGreenDown.png", "texFlightGreenOver.png");
            mFlightButtonYellow = GUITextureButtonFactory.CreateFromFilename("texFlightYellow.png", "texFlightYellowOver.png", "texFlightYellowDown.png", "texFlightYellowOver.png");
            mFlightButtonRed    = GUITextureButtonFactory.CreateFromFilename("texFlightRed.png", "texFlightRed.png", "texFlightRed.png", "texFlightRed.png");

            mFlightButtonGreen.fixedHeight    = mFlightButtonGreen.fixedWidth = 0;
            mFlightButtonYellow.fixedHeight   = mFlightButtonYellow.fixedWidth = 0;
            mFlightButtonRed.fixedHeight      = mFlightButtonRed.fixedWidth = 0;
            mFlightButtonGreen.stretchHeight  = mFlightButtonGreen.stretchWidth = true;
            mFlightButtonYellow.stretchHeight = mFlightButtonYellow.stretchWidth = true;
            mFlightButtonRed.stretchHeight    = mFlightButtonRed.stretchWidth = true;

            // Crap timewarp object
            mTimewarpObject = TimeWarp.fetch;

            // objects on this scene?
            if (mTimewarpObject == null || mTimewarpObject.timeQuadrantTab == null)
            {
                // to skip the draw calls
                mTimewarpObject = null;
                return;
            }

            var text = mTimewarpObject.timeQuadrantTab.transform.FindChild("MET timer").GetComponent <ScreenSafeGUIText>();

            mTextStyle          = new GUIStyle(text.textStyle);
            mTextStyle.fontSize = (int)(text.textSize * ScreenSafeUI.PixelRatio);

            // Put the draw function to the DrawQueue
            RenderingManager.AddToPostDrawQueue(0, Draw);

            // create the Background
            RTUtil.LoadImage(out mTexBackground, "TimeQuadrantFcStatus.png");
        }
        void Awake()
        {
            RenderingManager.AddToPostDrawQueue(0, DrawCall);

            //register for the event
            ddlTest.SelectionChanged += ddlTestSelectionChanged;;
        }
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            if (state == StartState.Editor)
            {
                return;
            }

            RenderingManager.AddToPostDrawQueue(3, DrawGUI);

            lastObservedStage = vessel.currentStage;

            // add basic sensors to list
            sources.Add(new VesselInfoSource("Flight data", "Velocity (surface)", () => (float)vessel.srf_velocity.magnitude));
            sources.Add(new VesselInfoSource("Flight data", "Velocity (orbit)", () => (float)vessel.obt_velocity.magnitude));
            sources.Add(new VesselInfoSource("Flight data", "Altitude (surface)", () => vessel.heightFromTerrain));
            sources.Add(new VesselInfoSource("Flight data", "Altitude (above sea level)", () => (float)vessel.altitude));
            sources.Add(new VesselInfoSource("Flight data", "Dynamic pressure (q)",
                                             () => (float)(vessel.srf_velocity.magnitude * vessel.srf_velocity.magnitude * vessel.atmDensity * 0.5)));

            sources.Add(new VesselInfoSource("Flight data", "Total vehicle mass", () => (float)vessel.GetTotalMass()));
            sources.Add(new VesselInfoSource("Flight data", "Angle of attack", () => Vector3.Angle(vessel.transform.up, vessel.srf_velocity)));

            // find available sensors
            foreach (Part part in this.part.vessel.parts.Where(p => p.Modules.OfType <ModuleEnviroSensor> ().Any()))
            {
                sources.Add(new SensorSource(part));
            }

            // add resource data sources
            List <string> resourceNames = new List <string> ();

            foreach (Part p in vessel.parts)
            {
                foreach (PartResource pr in p.Resources)
                {
                    if (!resourceNames.Contains(pr.resourceName))
                    {
                        resourceNames.Add(pr.resourceName);
                    }
                }
            }
            resourceNames.Sort();
            foreach (string resource in resourceNames)
            {
                sources.Add(new ResourceSource(resource, vessel));
            }

            // optional plugin data integration

            /*Type mechjebCoreType = Type.GetType ("MuMechLib.MuMech.MechJebCore");
             * if (mechjebCoreType != null)
             *      MonoBehaviour.print("Graphotron: Mechjeb found!");
             * else
             *      MonoBehaviour.print("Graphotron: no Mechjeb found");*/

            this.part.force_activate();
        }
Пример #20
0
        public override void  OnStart(PartModule.StartState state)
        {
            base.OnStart(state);
            if (state.Equals(PartModule.StartState.Editor))
            {
                return;                                            //don't start stuff in the editor
            }
            windowID      = Util.random();
            mem           = new Int32[4626];
            pointer       = 530;
            charSetPtr    = 18;
            colorPointer  = 2;
            modePtr       = 1;
            scrollPointer = 0;
            colors        = new Color32[16];
            for (int i = 0; i < 16; ++i)
            {
                colors[i]   = new Color32();
                colors[i].a = 255;
            }

            imageBuffer      = new Color32[256 * 256];
            image            = new Texture2D(256, 256, TextureFormat.ARGB32, false);
            image.filterMode = FilterMode.Point;
            windowPos        = new Rect();
            if ((windowPos.x == 0) && (windowPos.y == 0))//windowPos is used to position the GUI window, lets set it in the center of the screen
            {
                windowPos = new Rect(Screen.width / 2, Screen.height / 2, 100, 100);
            }
            //Set all the pixels to black. If you don't do this the image contains random junk.
            for (int y = 0; y < image.height; y++)
            {
                for (int x = 0; x < image.width; x++)
                {
                    image.SetPixel(x, y, Color.black);
                }
            }
            image.Apply();

            //init monitor drawing
            RenderingManager.AddToPostDrawQueue(3, new Callback(draw));

            //initialise fonts and colors and things
            //init default values in memory
            int index = charSetPtr;

            foreach (UInt32 font in getDefaultFont())
            {
                mem[index] = (Int32)font;
                ++index;
            }
            index = colorPointer;
            foreach (Int32 col in getDefaultColors())
            {
                mem[index] = col;
                ++index;
            }
            updateColors();
        }
Пример #21
0
 public void Start()
 {
     RenderingManager.AddToPostDrawQueue(0, OnGUI);
     if (PluginHelper.using_toolbar)
     {
         render_window = false;
     }
 }
Пример #22
0
 public override void OnStart(StartState state)
 {
     if (state != StartState.Editor)
     {
         InitWindowPositionIfNecessary();
         RenderingManager.AddToPostDrawQueue(1, OnDraw);
     }
 }
Пример #23
0
 public override void onPartDelete()
 {
     if (buildSceneDrawer == this)
     {
         buildSceneDrawer = null;
     }
     RenderingManager.RemoveFromPostDrawQueue(0, drawBuildSceneGUI);
 }
Пример #24
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     if (state != StartState.Editor)
     {
         RenderingManager.AddToPostDrawQueue(0, OnGUI);
     }
 }
Пример #25
0
    public static void Hide()
    {
//         if (null == settings)
//             settings = new KSPScienceSettings();
        settings.shown = false;
        settings.SaveSettings();
        RenderingManager.RemoveFromPostDrawQueue(3, settings.OnDraw);
    }
Пример #26
0
 /// <summary>
 /// Hide the launcher.
 /// </summary>
 public void onDeactivate()
 {
     Debug.Log("KompLog App Launch Deactivate");
     _active       = false;
     _autoHideTime = 0.0f;
     RenderingManager.RemoveFromPostDrawQueue(0, OnDraw);
     ControlUnlock();
 }
Пример #27
0
 protected void OnDestroy()
 {
     RenderingManager.RemoveFromPostDrawQueue(3, new Callback(drawGEffects));
     GameEvents.onGamePause.Remove(onPause);
     GameEvents.onGameUnpause.Remove(onUnPause);
     GameEvents.onCrewKilled.Remove(onCrewKilled);
     GameEvents.onVesselChange.Remove(onVesselChange);
 }
Пример #28
0
 private void OnEditorDestroy()
 {
     if (IsPrimary)
     {
         RenderingManager.RemoveFromPostDrawQueue(0, DrawGUI);
         print("BuildEngineer: OnEditorDestroy");
     }
 }
Пример #29
0
 protected override void onPartDestroy()
 {
     if (ping != null)
     {
         RenderingManager.RemoveFromPostDrawQueue(3, new Callback(drawGUI));
     }
     base.onPartDestroy();
 }
Пример #30
0
 public override void OnStart(PartModule.StartState state)
 {
     base.OnStart(state);
     windowID    = Util.random();
     windowPos   = new Rect(Screen.width / 2, Screen.height / 2, 100, 100);
     buttonsDown = new LinkedList <int>();
     RenderingManager.AddToPostDrawQueue(3, new Callback(draw));
 }
Пример #31
0
        public void OnGUI()
        {
            if (HighLogic.LoadedScene != GameScenes.FLIGHT && HighLogic.LoadedScene != GameScenes.TRACKSTATION) { return; }

            if (renderingManager == null)
            {
                renderingManager = (RenderingManager)GameObject.FindObjectOfType(typeof(RenderingManager));
            }

            if (renderingManager != null)
            {
                var obj = renderingManager.uiElementsToDisable.FirstOrDefault();
                if (obj != null && !obj.activeSelf) { return; }
            }

            if (!MapView.MapIsEnabled || MapView.MapCamera == null) { return; }

            if (skin == null)
            {
                GUI.skin = null;
                skin = (GUISkin)GameObject.Instantiate(GUI.skin);

                var window = skin.window;
                window.padding = new RectOffset(6, 6, 20, 6);
                window.fontSize = 10;
                skin.window = window;

                var label = skin.label;
                label.margin = new RectOffset(1, 1, 1, 1);
                label.padding = new RectOffset(1, 1, 1, 1);
                label.fontSize = 10;
                skin.label = label;
            }

            GUI.skin = skin;

            if (hoverCell != null && ShowOverlay)
            {
                var mouse = Event.current.mousePosition;
                var position = new Rect(mouse.x + 16, mouse.y + 4, 160, 32);
                GUILayout.Window(12359, position, mouseWindow, "Resource Info");
            }

            if (defaultSkin == null)
            {
                GUI.skin = null;
                defaultSkin = (GUISkin)GameObject.Instantiate(GUI.skin);
            }

            if (centeredStyle == null)
            {
                centeredStyle = new GUIStyle(GUI.skin.GetStyle("Label"));
                centeredStyle.alignment = TextAnchor.MiddleCenter;
            }

            if (minMaxStyle == null)
            {
                minMaxStyle = new GUIStyle(GUI.skin.button);
                minMaxStyle.contentOffset = new Vector2(-1, 0);
            }

            if (toolbar != null && !toolbar.IsVisible) { return; }

            GUI.skin = defaultSkin;
            var oldBackground = GUI.backgroundColor;
            GUI.backgroundColor = XKCDColors.Green;

            controlWindowPos = GUILayout.Window(12358, controlWindowPos, controlWindow, expandWindow ? "Kethane Scan Map" : String.Empty);

            GUI.backgroundColor = oldBackground;
        }
Пример #32
0
        public void Update()
        {
            try
            {
                if (!gameRunning)
                    return;

                if (pauseMenu != null)
                {
                    if (PauseMenu.isOpen && syncing)
                    {
                        if (KMPClientMain.tcpClient != null)
                        {
                            closePauseMenu = true;
                        }
                        else
                        {
                            disconnect("Connection terminated during sync");
                            forceQuit = true;
                        }
                    }
                    if (PauseMenu.isOpen && closePauseMenu)
                    {
                        closePauseMenu = false;
                        PauseMenu.Close();
                    }
                }

                if (FlightDriver.Pause) FlightDriver.SetPause(false);
                if (gameCheatsEnabled == false) {
                    CheatOptions.InfiniteFuel = false;
                    CheatOptions.InfiniteEVAFuel = false;
                    CheatOptions.InfiniteRCS = false;
                    CheatOptions.NoCrashDamage = false;
                    Destroy(FindObjectOfType(typeof(DebugToolbar)));
                }

                //Find an instance of the game's PauseMenu
                if (pauseMenu == null)
                    pauseMenu = (PauseMenu)FindObjectOfType(typeof(PauseMenu));

                //Find an instance of the game's RenderingManager
                if (renderManager == null)
                    renderManager = (RenderingManager)FindObjectOfType(typeof(RenderingManager));

                //Find an instance of the game's PlanetariumCamera
                if (planetariumCam == null)
                    planetariumCam = (PlanetariumCamera)FindObjectOfType(typeof(PlanetariumCamera));

                if (Input.GetKeyDown(KeyCode.F2))
                {
                    isGameHUDHidden = !isGameHUDHidden;
                }

                if (Input.GetKeyDown(KMPGlobalSettings.instance.guiToggleKey) && !isGameHUDHidden && KMPToggleButtonState)
                    KMPInfoDisplay.infoDisplayActive = !KMPInfoDisplay.infoDisplayActive;

                if (Input.GetKeyDown(KMPGlobalSettings.instance.screenshotKey))
                    StartCoroutine(shareScreenshot());

                if (Input.GetKeyDown(KMPGlobalSettings.instance.screenshotToggleKey) && !isGameHUDHidden && KMPToggleButtonState)
                    KMPScreenshotDisplay.windowEnabled = !KMPScreenshotDisplay.windowEnabled;

                if (Input.GetKeyDown(KMPGlobalSettings.instance.chatTalkKey))
                {
                    KMPChatDX.showInput = true;
                    //DISABLE SHIP CONTROL
                    InputLockManager.SetControlLock(ControlTypes.All,"KMP_ChatActive");
                }

                if (Input.GetKeyDown(KeyCode.Escape) && KMPChatDX.showInput)
                {
                    KMPChatDX.showInput = false;
                    //ENABLE SHIP CONTROL
                    InputLockManager.RemoveControlLock("KMP_ChatActive");
                    closePauseMenu = true;
                }

                if (Input.GetKeyDown(KMPGlobalSettings.instance.chatHideKey) && !isGameHUDHidden && KMPToggleButtonState)
                {
                    KMPGlobalSettings.instance.chatDXWindowEnabled = !KMPGlobalSettings.instance.chatDXWindowEnabled;
                    //if (KMPGlobalSettings.instance.chatDXWindowEnabled) KMPChatDX.enqueueChatLine("Press Chat key (" + (KMPGlobalSettings.instance.chatTalkKey == KeyCode.BackQuote ? "~" : KMPGlobalSettings.instance.chatTalkKey.ToString()) + ") to send a message");
                }

                if (Input.anyKeyDown)
                    lastKeyPressTime = UnityEngine.Time.realtimeSinceStartup;

                //Handle key-binding
                if (mappingGUIToggleKey)
                {
                    KeyCode key = KeyCode.F7;
                    if (getAnyKeyDown(ref key))
                    {
                        if (key != KeyCode.Mouse0)
                        {
                            KMPGlobalSettings.instance.guiToggleKey = key;
                            mappingGUIToggleKey = false;
                        }
                    }
                }

                if (mappingScreenshotKey)
                {
                    KeyCode key = KeyCode.F8;
                    if (getAnyKeyDown(ref key))
                    {
                        if (key != KeyCode.Mouse0)
                        {
                            KMPGlobalSettings.instance.screenshotKey = key;
                            mappingScreenshotKey = false;
                        }
                    }
                }

                if (mappingScreenshotToggleKey)
                {
                    KeyCode key = KeyCode.F10;
                    if (getAnyKeyDown(ref key))
                    {
                        if (key != KeyCode.Mouse0)
                        {
                            KMPGlobalSettings.instance.screenshotToggleKey = key;
                            mappingScreenshotToggleKey = false;
                        }
                    }
                }

                if (mappingChatKey)
                {
                    KeyCode key = KeyCode.Y;
                    if (getAnyKeyDown(ref key))
                    {
                        if (key != KeyCode.Mouse0)
                        {
                            KMPGlobalSettings.instance.chatTalkKey = key;
                            mappingChatKey = false;
                        }
                    }
                }

                if (mappingChatDXToggleKey)
                {
                    KeyCode key = KeyCode.F9;
                    if (getAnyKeyDown(ref key))
                    {
                        if (key != KeyCode.Mouse0)
                        {
                            KMPGlobalSettings.instance.chatHideKey = key;
                            mappingChatDXToggleKey = false;
                        }
                    }
                }
            } catch (Exception ex) { Log.Debug("Exception thrown in Update(), catch 2, Exception: {0}", ex.ToString()); Log.Debug ("u err: " + ex.Message + " " + ex.StackTrace); }
        }
Пример #33
0
        private bool showGUI()
        {
            if (!isRelevantGameScene(HighLogic.LoadedScene)) {
                return false;
            }

            if (renderingManager == null) {
                renderingManager = (RenderingManager) GameObject.FindObjectOfType(typeof(RenderingManager));
            }

            if (renderingManager != null) {
                GameObject o = renderingManager.uiElementsToDisable.FirstOrDefault();
                return (o == null) || o.activeSelf;
            }

            return false;
        }
Пример #34
0
        public void Update()
        {
            if (HighLogic.LoadedScene == GameScenes.LOADING)
                return; //Don't do anything while the game is loading

            //Find an instance of the game's RenderingManager
            if (renderManager == null)
                renderManager = (RenderingManager) FindObjectOfType(typeof(RenderingManager));

            //Find an instance of the game's PlanetariumCamera
            if (planetariumCam == null)
                planetariumCam = (PlanetariumCamera)FindObjectOfType(typeof(PlanetariumCamera));

            if (Input.GetKeyDown(KLFGlobalSettings.instance.guiToggleKey))
                KLFInfoDisplay.infoDisplayActive = !KLFInfoDisplay.infoDisplayActive;

            if (Input.GetKeyDown(KLFGlobalSettings.instance.screenshotKey))
                shareScreenshot();

            if (Input.anyKeyDown)
                lastKeyPressTime = UnityEngine.Time.realtimeSinceStartup;

            //Handle key-binding
            if (mappingGUIToggleKey)
            {
                KeyCode key = KeyCode.F7;
                if (getAnyKeyDown(ref key))
                {
                    KLFGlobalSettings.instance.guiToggleKey = key;
                    mappingGUIToggleKey = false;
                }
            }

            if (mappingScreenshotKey)
            {
                KeyCode key = KeyCode.F8;
                if (getAnyKeyDown(ref key))
                {
                    KLFGlobalSettings.instance.screenshotKey = key;
                    mappingScreenshotKey = false;
                }
            }
        }
Пример #35
0
        public void Update()
        {
            try
            {
                if (!gameRunning) return;

                try { if (PauseMenu.isOpen && syncing) PauseMenu.Close(); } catch { }

                if (FlightDriver.Pause) FlightDriver.SetPause(false);
                if (gameCheatsEnabled == false) {
                    if (CheatOptions.InfiniteFuel == true)
                        CheatOptions.InfiniteFuel = false;
                    if (CheatOptions.InfiniteEVAFuel == true)
                        CheatOptions.InfiniteEVAFuel = false;
                    if (CheatOptions.InfiniteRCS == true)
                        CheatOptions.InfiniteRCS = false;
                    if (CheatOptions.NoCrashDamage == true)
                        CheatOptions.NoCrashDamage = false;
                    Destroy(FindObjectOfType(typeof(DebugToolbar)));
                }

                //Find an instance of the game's RenderingManager
                if (renderManager == null)
                    renderManager = (RenderingManager)FindObjectOfType(typeof(RenderingManager));

                //Find an instance of the game's PlanetariumCamera
                if (planetariumCam == null)
                    planetariumCam = (PlanetariumCamera)FindObjectOfType(typeof(PlanetariumCamera));
                if (Input.GetKeyDown(KeyCode.F2))
                {
                    isGameHUDHidden = !isGameHUDHidden;
                }

                if (Input.GetKeyDown(KMPGlobalSettings.instance.guiToggleKey) && isGameHUDHidden == false)
                    KMPInfoDisplay.infoDisplayActive = !KMPInfoDisplay.infoDisplayActive;

                if (Input.GetKeyDown(KMPGlobalSettings.instance.screenshotKey))
                    StartCoroutine(shareScreenshot());

                if (Input.GetKeyDown(KMPGlobalSettings.instance.screenshotToggleKey) && isGameHUDHidden == false)
            KMPScreenshotDisplay.windowEnabled = !KMPScreenshotDisplay.windowEnabled;

                if (Input.GetKeyDown(KMPGlobalSettings.instance.chatTalkKey))
                    KMPChatDX.showInput = true;

                if (Input.GetKeyDown(KMPGlobalSettings.instance.chatHideKey) && isGameHUDHidden == false)
                {
            KMPGlobalSettings.instance.chatDXWindowEnabled = !KMPGlobalSettings.instance.chatDXWindowEnabled;
                    if (KMPGlobalSettings.instance.chatDXWindowEnabled) KMPChatDX.enqueueChatLine("Press Chat key (" + (KMPGlobalSettings.instance.chatTalkKey == KeyCode.BackQuote ? "~" : KMPGlobalSettings.instance.chatTalkKey.ToString()) + ") to send a message");
                }

                if (Input.anyKeyDown)
                    lastKeyPressTime = UnityEngine.Time.realtimeSinceStartup;

                //Handle key-binding
                if (mappingGUIToggleKey)
                {
                    KeyCode key = KeyCode.F7;
                    if (getAnyKeyDown(ref key))
                    {
                        if (key != KeyCode.Mouse0)
                        {
                            KMPGlobalSettings.instance.guiToggleKey = key;
                            mappingGUIToggleKey = false;
                        }
                    }
                }

                if (mappingScreenshotKey)
                {
                    KeyCode key = KeyCode.F8;
                    if (getAnyKeyDown(ref key))
                    {
                        if (key != KeyCode.Mouse0)
                        {
                            KMPGlobalSettings.instance.screenshotKey = key;
                            mappingScreenshotKey = false;
                        }
                    }
                }

                if (mappingScreenshotToggleKey)
                {
                    KeyCode key = KeyCode.F10;
                    if (getAnyKeyDown(ref key))
                    {
                        if (key != KeyCode.Mouse0)
                        {
                            KMPGlobalSettings.instance.screenshotToggleKey = key;
                            mappingScreenshotToggleKey = false;
                        }
                    }
                }

                if (mappingChatKey)
                {
                    KeyCode key = KeyCode.Y;
                    if (getAnyKeyDown(ref key))
                    {
                        if (key != KeyCode.Mouse0)
                        {
                            KMPGlobalSettings.instance.chatTalkKey = key;
                            mappingChatKey = false;
                        }
                    }
                }

                if (mappingChatDXToggleKey)
                {
                    KeyCode key = KeyCode.F9;
                    if (getAnyKeyDown(ref key))
                    {
                        if (key != KeyCode.Mouse0)
                        {
                            KMPGlobalSettings.instance.chatHideKey = key;
                            mappingChatDXToggleKey = false;
                        }
                    }
                }
            } catch (Exception ex) { Log.Debug("Exception thrown in Update(), catch 1, Exception: {0}", ex.ToString()); Log.Debug ("u err: " + ex.Message + " " + ex.StackTrace); }
        }
Пример #36
0
        public void Update()
        {
            try
            {
                if (gameRunning && FlightDriver.Pause) FlightDriver.SetPause(false);

                //Find an instance of the game's RenderingManager
                if (renderManager == null)
                    renderManager = (RenderingManager) FindObjectOfType(typeof(RenderingManager));

                //Find an instance of the game's PlanetariumCamera
                if (planetariumCam == null)
                    planetariumCam = (PlanetariumCamera)FindObjectOfType(typeof(PlanetariumCamera));

                if (Input.GetKeyDown(KMPGlobalSettings.instance.guiToggleKey))
                    KMPInfoDisplay.infoDisplayActive = !KMPInfoDisplay.infoDisplayActive;

                if (Input.GetKeyDown(KMPGlobalSettings.instance.screenshotKey))
                    StartCoroutine(shareScreenshot());

                if (Input.anyKeyDown)
                    lastKeyPressTime = UnityEngine.Time.realtimeSinceStartup;

                //Handle key-binding
                if (mappingGUIToggleKey)
                {
                    KeyCode key = KeyCode.F7;
                    if (getAnyKeyDown(ref key))
                    {
                        KMPGlobalSettings.instance.guiToggleKey = key;
                        mappingGUIToggleKey = false;
                    }
                }

                if (mappingScreenshotKey)
                {
                    KeyCode key = KeyCode.F8;
                    if (getAnyKeyDown(ref key))
                    {
                        KMPGlobalSettings.instance.screenshotKey = key;
                        mappingScreenshotKey = false;
                    }
                }
            } catch (Exception ex) { KMPClientMain.DebugLog ("u err: " + ex.Message + " " + ex.StackTrace); }
        }
Пример #37
0
        public void Update()
        {
            try
            {
                if (!gameRunning) return;
                if (FlightDriver.Pause) FlightDriver.SetPause(false);

                //Find an instance of the game's RenderingManager
                if (renderManager == null)
                    renderManager = (RenderingManager)FindObjectOfType(typeof(RenderingManager));

                //Find an instance of the game's PlanetariumCamera
                if (planetariumCam == null)
                    planetariumCam = (PlanetariumCamera)FindObjectOfType(typeof(PlanetariumCamera));

                if (Input.GetKeyDown(KMPGlobalSettings.instance.guiToggleKey))
                    KMPInfoDisplay.infoDisplayActive = !KMPInfoDisplay.infoDisplayActive;

                if (Input.GetKeyDown(KMPGlobalSettings.instance.screenshotKey))
                    StartCoroutine(shareScreenshot());

                if (Input.GetKeyDown(KMPGlobalSettings.instance.chatTalkKey))
                    KMPChatDX.showInput = true;

                if (Input.GetKeyDown(KMPGlobalSettings.instance.chatHideKey))
                {
                    KMPGlobalSettings.instance.chatDXWindowEnabled = !KMPGlobalSettings.instance.chatDXWindowEnabled;
                    if (KMPGlobalSettings.instance.chatDXWindowEnabled) KMPChatDX.enqueueChatLine("Press Chat key (" + (KMPGlobalSettings.instance.chatTalkKey == KeyCode.BackQuote ? "~" : KMPGlobalSettings.instance.chatTalkKey.ToString()) + ") to send a message");
                }

                if (Input.anyKeyDown)
                    lastKeyPressTime = UnityEngine.Time.realtimeSinceStartup;

                //Handle key-binding
                if (mappingGUIToggleKey)
                {
                    KeyCode key = KeyCode.F7;
                    if (getAnyKeyDown(ref key))
                    {
                        if (key != KeyCode.Mouse0)
                        {
                            KMPGlobalSettings.instance.guiToggleKey = key;
                            mappingGUIToggleKey = false;
                        }
                    }
                }

                if (mappingScreenshotKey)
                {
                    KeyCode key = KeyCode.F8;
                    if (getAnyKeyDown(ref key))
                    {
                        if (key != KeyCode.Mouse0)
                        {
                            KMPGlobalSettings.instance.screenshotKey = key;
                            mappingScreenshotKey = false;
                        }
                    }
                }

                if (mappingChatKey)
                {
                    KeyCode key = KeyCode.Y;
                    if (getAnyKeyDown(ref key))
                    {
                        KMPGlobalSettings.instance.chatTalkKey = key;
                        mappingChatKey = false;
                    }
                }

                if (mappingChatDXToggleKey)
                {
                    KeyCode key = KeyCode.F9;
                    if (getAnyKeyDown(ref key))
                    {
                        KMPGlobalSettings.instance.chatHideKey = key;
                        mappingChatDXToggleKey = false;
                    }
                }
            } catch (Exception ex) { KMPClientMain.DebugLog ("u err: " + ex.Message + " " + ex.StackTrace); }
        }
Пример #38
0
        public void Update()
        {
            if (HighLogic.LoadedScene == GameScenes.LOADING)
                return; //Don't do anything while the game is loading
            if (RenderManager == null)
                RenderManager = (RenderingManager) FindObjectOfType(typeof(RenderingManager));
            if (PlanetariumCam == null)
                PlanetariumCam = (PlanetariumCamera)FindObjectOfType(typeof(PlanetariumCamera));
            //key events
            if (Input.GetKeyDown(KLFGlobalSettings.Instance.GuiToggleKey))
                KLFInfoDisplay.InfoDisplayActive = !KLFInfoDisplay.InfoDisplayActive;
            if (Input.GetKeyDown(KLFGlobalSettings.Instance.GuiToggleKey))
            {
                KLFInfoDisplay.InfoDisplayActive = !KLFInfoDisplay.InfoDisplayActive;
                if (KLFInfoDisplay.InfoDisplayActive)
                {
                    KLF_Button.SetTexture(KLF_button_on);
                    KLF_button_alert_anim = 0;
                }
                else
                {
                    KLF_Button.SetTexture(KLF_button_off);
                    CheckEditorLock();
                }
            }
            if (Input.GetKeyDown(KLFGlobalSettings.Instance.ScreenshotKey) || SharingScreenshot)
                ShareScreenshot();
            if (Input.GetKeyDown(KLFGlobalSettings.Instance.ChatKey))
            {
                KLFGlobalSettings.Instance.ChatWindowEnabled = !KLFGlobalSettings.Instance.ChatWindowEnabled;
                if (KLFGlobalSettings.Instance.ChatWindowEnabled && KLFInfoDisplay.InfoDisplayActive)
                {
                    KLF_Button.SetTexture(KLF_button_on);
                    KLF_button_alert_anim = 0;
                }
            }
            if (Input.GetKeyDown(KLFGlobalSettings.Instance.ViewKey))
                KLFScreenshotDisplay.WindowEnabled = !KLFScreenshotDisplay.WindowEnabled;

            //idle monitor
            if (Input.anyKeyDown)
                LastKeyPressTime = UnityEngine.Time.realtimeSinceStartup;

            //Handle custom key-bindings
            if (MappingGUIToggleKey)
            {
                KeyCode key = KeyCode.F7;
                if (GetAnyKeyDown(ref key))
                {
                    KLFGlobalSettings.Instance.GuiToggleKey = key;
                    MappingGUIToggleKey = false;
                }
            }
            if (MappingScreenshotKey)
            {
                KeyCode key = KeyCode.F8;
                if (GetAnyKeyDown(ref key))
                {
                    KLFGlobalSettings.Instance.ScreenshotKey = key;
                    MappingScreenshotKey = false;
                }
            }
            if (MappingChatKey)
            {
                KeyCode key = KeyCode.F9;
                if (GetAnyKeyDown(ref key))
                {
                    KLFGlobalSettings.Instance.ChatKey = key;
                    MappingChatKey = false;
                }
            }
            if (MappingViewKey)
            {
                KeyCode key = KeyCode.F10;
                if (GetAnyKeyDown(ref key))
                {
                    KLFGlobalSettings.Instance.ViewKey = key;
                    MappingViewKey = false;
                }
            }
        }