void PSystemReady()
        {
            // Log version info
            var ainfoV = Attribute.GetCustomAttribute(typeof(ContractConfigurator).Assembly,
                                                      typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute;

            LoggingUtil.LogInfo(this, "Contract Configurator {0} loading...", ainfoV.InformationalVersion);

            LoggingUtil.LoadDebuggingConfig();

            RegisterParameterFactories();
            RegisterBehaviourFactories();
            RegisterContractRequirements();

            LoadTypeInfo();

            IEnumerator <YieldInstruction> iterator = LoadGroupConfig();

            while (iterator.MoveNext())
            {
            }
            DebugWindow.LoadTextures();

            StartCoroutine(FinalizeContractTypeLoad());
        }
예제 #2
0
        void Update()
        {
            // Load all the contract configurator configuration
            if (HighLogic.LoadedScene == GameScenes.MAINMENU && !loaded)
            {
                LoggingUtil.LoadDebuggingConfig();
                RegisterParameterFactories();
                RegisterBehaviourFactories();
                RegisterContractRequirements();
                LoadContractConfig();
                loaded = true;
            }
            // Try to disable the contract types
            else if ((HighLogic.LoadedScene == GameScenes.SPACECENTER) && !contractTypesAdjusted)
            {
                if (AdjustContractTypes())
                {
                    contractTypesAdjusted = true;
                }
            }

            // Alt-F9 shows the contract configurator window
            if (GameSettings.MODIFIER_KEY.GetKey() && Input.GetKeyDown(KeyCode.F10))
            {
                showGUI = !showGUI;
            }

            // Check if the ContractsApp has just become visible, and fire off an update event
            if (!contractsAppVisible &&
                ContractsApp.Instance != null &&
                ContractsApp.Instance.appLauncherButton != null &&
                ContractsApp.Instance.cascadingList.cascadingList != null &&
                ContractsApp.Instance.cascadingList.cascadingList.gameObject.activeInHierarchy)
            {
                contractsAppVisible = true;

                // Fire off an event for each contract
                for (int i = 0; i < ContractSystem.Instance.Contracts.Count; i++)
                {
                    Contract contract = ContractSystem.Instance.Contracts[i];
                    if (contract.ContractState == Contract.State.Active && contract.GetType() == typeof(ConfiguredContract))
                    {
                        GameEvents.Contract.onParameterChange.Fire(contract, contract.GetParameter(0));
                    }
                }
            }
        }
        void PSystemReady()
        {
            // Log version info
            var ainfoV = Attribute.GetCustomAttribute(typeof(ContractConfigurator).Assembly,
                                                      typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute;

            LoggingUtil.LogInfo(this, "Contract Configurator " + ainfoV.InformationalVersion + " loading...");

            LoggingUtil.LoadDebuggingConfig();

            RegisterParameterFactories();
            RegisterBehaviourFactories();
            RegisterContractRequirements();
            IEnumerator <YieldInstruction> iterator = LoadContractConfig();

            while (iterator.MoveNext())
            {
            }
            DebugWindow.LoadTextures();

            LoggingUtil.LogInfo(this, "Contract Configurator " + ainfoV.InformationalVersion + " finished loading.");
        }
예제 #4
0
        void Update()
        {
            // Load all the contract configurator configuration
            if (HighLogic.LoadedScene == GameScenes.MAINMENU && !loading)
            {
                LoggingUtil.LoadDebuggingConfig();

                // Log version info
                var ainfoV = Attribute.GetCustomAttribute(typeof(ExceptionLogWindow).Assembly, typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute;
                LoggingUtil.LogInfo(this, "Contract Configurator " + ainfoV.InformationalVersion + " loading...");

                RegisterParameterFactories();
                RegisterBehaviourFactories();
                RegisterContractRequirements();
                loading = true;
                IEnumerator <YieldInstruction> iterator = LoadContractConfig();
                while (iterator.MoveNext())
                {
                }
                DebugWindow.LoadTextures();

                LoggingUtil.LogInfo(this, "Contract Configurator " + ainfoV.InformationalVersion + " finished loading.");
            }
            // Try to disable the contract types
            else if ((HighLogic.LoadedScene == GameScenes.SPACECENTER) && !contractTypesAdjusted)
            {
                if (AdjustContractTypes())
                {
                    contractTypesAdjusted = true;
                }
            }

            // Alt-F9 shows the contract configurator window
            if (GameSettings.MODIFIER_KEY.GetKey() && Input.GetKeyDown(KeyCode.F10))
            {
                DebugWindow.showGUI = !DebugWindow.showGUI;
            }

            // Check if the ContractsApp has just become visible
            if (!contractsAppVisible &&
                ContractsApp.Instance != null &&
                ContractsApp.Instance.appLauncherButton != null)
            // TODO - fix for 1.0
//                ContractsApp.Instance.cascadingList.cascadingList != null &&
//                ContractsApp.Instance.cascadingList.cascadingList.gameObject.activeInHierarchy)
            {
                contractsAppVisible = true;
            }

            // Display reloading message
            if (reloading)
            {
                if (lastMessage != null)
                {
                    ScreenMessages.RemoveMessage(lastMessage);
                    lastMessage = null;
                }

                switch (reloadStep)
                {
                case ReloadStep.GAME_DATABASE:
                    lastMessage = ScreenMessages.PostScreenMessage("Reloading game database...", Time.deltaTime,
                                                                   ScreenMessageStyle.UPPER_CENTER);
                    break;

                case ReloadStep.MODULE_MANAGER:
                    lastMessage = ScreenMessages.PostScreenMessage("Reloading module manager...", Time.deltaTime,
                                                                   ScreenMessageStyle.UPPER_CENTER);
                    break;

                case ReloadStep.CLEAR_CONFIG:
                    lastMessage = ScreenMessages.PostScreenMessage("Clearing previously loaded contract configuration...", Time.deltaTime,
                                                                   ScreenMessageStyle.UPPER_CENTER);
                    break;

                case ReloadStep.LOAD_CONFIG:
                    lastMessage = ScreenMessages.PostScreenMessage("Loading contract configuration (" + attemptedContracts + "/" + totalContracts + ")...", Time.deltaTime,
                                                                   ScreenMessageStyle.UPPER_CENTER);
                    break;

                case ReloadStep.ADJUST_TYPES:
                    lastMessage = ScreenMessages.PostScreenMessage("Adjusting contract types...", Time.deltaTime,
                                                                   ScreenMessageStyle.UPPER_CENTER);
                    break;
                }
            }

            // Fire update events
            if (contractsAppVisible)
            {
                foreach (Contract contract in contractsToUpdate)
                {
                    if (contract.ContractState == Contract.State.Active && contract.GetType() == typeof(ConfiguredContract))
                    {
                        GameEvents.Contract.onParameterChange.Fire(contract, contract.GetParameter(0));
                    }
                }
                contractsToUpdate.Clear();
            }
        }
        void Update()
        {
            // Load all the contract configurator configuration
            if (HighLogic.LoadedScene == GameScenes.MAINMENU && !loading)
            {
                // Log version info
                var ainfoV = Attribute.GetCustomAttribute(typeof(ContractConfigurator).Assembly,
                                                          typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute;
                LoggingUtil.LogInfo(this, "Contract Configurator " + ainfoV.InformationalVersion + " loading...");

                LoggingUtil.LoadDebuggingConfig();

                RegisterParameterFactories();
                RegisterBehaviourFactories();
                RegisterContractRequirements();
                loading = true;
                IEnumerator <YieldInstruction> iterator = LoadContractConfig();
                while (iterator.MoveNext())
                {
                }
                DebugWindow.LoadTextures();

                LoggingUtil.LogInfo(this, "Contract Configurator " + ainfoV.InformationalVersion + " finished loading.");
            }

            // Alt-F10 shows the contract configurator window
            if (GameSettings.MODIFIER_KEY.GetKey() && Input.GetKeyDown(KeyCode.F10))
            {
                DebugWindow.showGUI = !DebugWindow.showGUI;
            }

            // Display reloading message
            if (reloading)
            {
                if (lastMessage != null)
                {
                    ScreenMessages.RemoveMessage(lastMessage);
                    lastMessage = null;
                }

                switch (reloadStep)
                {
                case ReloadStep.GAME_DATABASE:
                    lastMessage = ScreenMessages.PostScreenMessage("Reloading game database...", Time.deltaTime,
                                                                   ScreenMessageStyle.UPPER_CENTER);
                    break;

                case ReloadStep.MODULE_MANAGER:
                    lastMessage = ScreenMessages.PostScreenMessage("Reloading module manager...", Time.deltaTime,
                                                                   ScreenMessageStyle.UPPER_CENTER);
                    break;

                case ReloadStep.CLEAR_CONFIG:
                    lastMessage = ScreenMessages.PostScreenMessage("Clearing previously loaded contract configuration...", Time.deltaTime,
                                                                   ScreenMessageStyle.UPPER_CENTER);
                    break;

                case ReloadStep.LOAD_CONFIG:
                    lastMessage = ScreenMessages.PostScreenMessage("Loading contract configuration (" + attemptedContracts + "/" + totalContracts + ")...", Time.deltaTime,
                                                                   ScreenMessageStyle.UPPER_CENTER);
                    break;
                }
            }
        }