/// <summary>Only loads the session settings.</summary>
        void Awake()
        {
            UnityEngine.Object.DontDestroyOnLoad(gameObject);

            // Read the configs for all the aggregators.
            ConfigAccessor.ReadFieldsInType(typeof(LogInterceptor), null /* instance */);
            ConfigAccessor.ReadFieldsInType(typeof(LogFilter), null /* instance */);
            ConfigAccessor.ReadFieldsInType(
                ConsoleUI.diskLogAggregator.GetType(), ConsoleUI.diskLogAggregator);
            ConfigAccessor.ReadFieldsInType(
                ConsoleUI.rawLogAggregator.GetType(), ConsoleUI.rawLogAggregator);
            ConfigAccessor.ReadFieldsInType(
                ConsoleUI.collapseLogAggregator.GetType(), ConsoleUI.collapseLogAggregator);
            ConfigAccessor.ReadFieldsInType(
                ConsoleUI.smartLogAggregator.GetType(), ConsoleUI.smartLogAggregator);

            // Start all aggregators.
            ConsoleUI.rawLogAggregator.StartCapture();
            ConsoleUI.collapseLogAggregator.StartCapture();
            ConsoleUI.smartLogAggregator.StartCapture();
            ConsoleUI.diskLogAggregator.StartCapture();
            LogInterceptor.StartIntercepting();

            // Load UI configs.
            ConfigAccessor.ReadFieldsInType(typeof(ConsoleUI), null /* instance */);
            ConfigAccessor.ReadFieldsInType(
                typeof(ConsoleUI), this, group: StdPersistentGroups.SessionGroup);
        }
Exemple #2
0
 /// <summary>Only loads session settings.</summary>
 void Awake()
 {
     ConfigAccessor.ReadFieldsInType(typeof(Controller), null /* instance */);
     ConfigAccessor.ReadFieldsInType(typeof(Controller), this, group: SessionGroup);
     toggleConsoleKeyEvent = Event.KeyboardEvent(toggleConsoleKey);
     windowRect            = new Rect(windowPos, windowSize);
 }
Exemple #3
0
 void Awake()
 {
     ConfigAccessor.ReadFieldsInType(GetType(), instance: this);
     if (!string.IsNullOrEmpty(openGUIKey))
     {
         openGUIEvent = Event.KeyboardEvent(openGUIKey);
     }
 }
Exemple #4
0
 void Awake()
 {
     ConfigAccessor.ReadFieldsInType(GetType(), this);
     if (twekerEnabled)
     {
         AsyncCall.CallOnEndOfFrame(this, WaitAndApplyTweaks);
     }
 }
Exemple #5
0
 void Awake()
 {
     ConfigAccessor.ReadFieldsInType(GetType(), instance: this);
     if (!string.IsNullOrEmpty(openGUIKey))
     {
         DebugEx.Info("EqippedItemAlignTool controller created");
         openGUIEvent = Event.KeyboardEvent(openGUIKey);
     }
 }
Exemple #6
0
 /// <summary>Only loads session settings.</summary>
 void Awake()
 {
     ConfigAccessor.ReadFieldsInType(typeof(Controller), null /* instance */);
     ConfigAccessor.ReadFieldsInType(typeof(Controller), this, group: SessionGroup);
     windowRect = new Rect(windowPos, windowSize);
     if (isUIVisible)
     {
         StartCoroutine(CheckForSettingsChange());
     }
 }
Exemple #7
0
 void Awake()
 {
     DebugEx.Info("Winch remote controller created");
     ConfigAccessor.ReadFieldsInType(GetType(), this);
     _openGuiEvent = Event.KeyboardEvent(openGuiKey);
     _instance     = this;
     LoadLocalizedContent();
     GameEvents.onLanguageSwitched.Add(LoadLocalizedContent);
     GameEvents.onVesselWasModified.Add(OnVesselUpdated);
     GameEvents.onVesselDestroy.Add(OnVesselUpdated);
     GameEvents.onVesselCreate.Add(OnVesselUpdated);
 }
        /// <summary>Overridden from MonoBehaviour.</summary>
        /// <remarks>Registers listeners, reads configuration and creates global UI objects.</remarks>
        void Awake()
        {
            GameEvents.onVesselSwitching.Add(OnVesselSwitch);
            GameEvents.onVesselChange.Add(OnVesselChange);
            GameEvents.onPartCouple.Add(OnPartCouple);
            ConfigAccessor.ReadFieldsInType(typeof(Controller), this);
            _mouseInfoOverlay = new HintOverlay(
                infoOverlayFontSize, infoOverlayHintPadding, infoOverlayTextColor, infoOverlayBackgroundColor);

            // Drop vessel selection when main modifier is released.
            vesselSwitchKey.OnRelease += delegate { SetHoveredVessel(null); };
            // Iterate thru stabilization modes.
            switchStabilizationModeKey.OnClick += SelectNextStabilizationMode;
        }
Exemple #9
0
        public void Awake()
        {
            ConfigAccessor.ReadFieldsInType(GetType(), this);
            ConfigAccessor.ReadFieldsInType(typeof(ModuleKISInventory), instance: null);

            // Set inventory module for every eva kerbal
            Logger.logInfo("Set KIS config...");
            ConfigNode nodeSettings = GameDatabase.Instance.GetConfigNode("KIS/settings/KISConfig");

            if (nodeSettings == null)
            {
                Logger.logError("KIS settings.cfg not found or invalid !");
                return;
            }

            // Male Kerbal.
            UpdateEvaPrefab(PartLoader.getPartInfoByName(MaleKerbalEva), nodeSettings);
            // Female Kerbal.
            UpdateEvaPrefab(PartLoader.getPartInfoByName(FemaleKerbalEva), nodeSettings);

            // Set inventory module for every pod with crew capacity.
            Logger.logInfo("Loading pod inventories...");
            foreach (AvailablePart avPart in PartLoader.LoadedPartsList)
            {
                if (avPart.name == MaleKerbalEva || avPart.name == FemaleKerbalEva ||
                    avPart.name == RdKerbalEva ||
                    !avPart.partPrefab || avPart.partPrefab.CrewCapacity < 1)
                {
                    continue;
                }

                Logger.logInfo("Found part with CrewCapacity: {0}", avPart.name);
                for (int i = 0; i < avPart.partPrefab.CrewCapacity; i++)
                {
                    try {
                        var moduleInventory =
                            avPart.partPrefab.AddModule(typeof(ModuleKISInventory).Name) as ModuleKISInventory;
                        CallAwakeMethod(moduleInventory);
                        SetInventoryConfig(moduleInventory, nodeSettings);
                        moduleInventory.podSeat = i;
                        moduleInventory.invType = ModuleKISInventory.InventoryType.Pod;
                        Logger.logInfo("Pod inventory module(s) for seat {0} loaded successfully", i);
                    } catch {
                        Logger.logError("Pod inventory module(s) for seat {0} can't be loaded!", i);
                    }
                }
            }
        }
Exemple #10
0
        public void Awake()
        {
            ConfigAccessor.ReadFieldsInType(GetType(), this);
            ConfigAccessor.ReadFieldsInType(typeof(ModuleKISInventory), instance: null);

            // Set inventory module for every eva kerbal
            Debug.Log("Set KIS config...");
            ConfigNode nodeSettings = GameDatabase.Instance.GetConfigNode("KIS/settings/KISConfig");

            if (nodeSettings == null)
            {
                Debug.LogError("KIS settings.cfg not found or invalid !");
                return;
            }

            // Kerbal parts.
            UpdateEvaPrefab(MaleKerbalEva, nodeSettings);
            UpdateEvaPrefab(FemaleKerbalEva, nodeSettings);

            // Set inventory module for every pod with crew capacity.
            Debug.Log("Loading pod inventories...");
            foreach (AvailablePart avPart in PartLoader.LoadedPartsList)
            {
                if (avPart.name == MaleKerbalEva || avPart.name == FemaleKerbalEva ||
                    avPart.name == RdKerbalEva ||
                    !avPart.partPrefab || avPart.partPrefab.CrewCapacity < 1)
                {
                    continue;
                }

                Debug.LogFormat("Found part with CrewCapacity: {0}", avPart.name);
                for (int i = 0; i < avPart.partPrefab.CrewCapacity; i++)
                {
                    try {
                        var moduleInventory =
                            avPart.partPrefab.AddModule(typeof(ModuleKISInventory).Name) as ModuleKISInventory;
                        KIS_Shared.AwakePartModule(moduleInventory);
                        var baseFields = new BaseFieldList(moduleInventory);
                        baseFields.Load(nodeSettings.GetNode("EvaInventory"));
                        moduleInventory.podSeat = i;
                        moduleInventory.invType = ModuleKISInventory.InventoryType.Pod;
                        Debug.LogFormat("Pod inventory module(s) for seat {0} loaded successfully", i);
                    } catch {
                        Debug.LogErrorFormat("Pod inventory module(s) for seat {0} can't be loaded!", i);
                    }
                }
            }
        }
Exemple #11
0
        /// <summary>Overridden from MonoBehaviour.</summary>
        /// <remarks>Registers listeners, reads configuration and creates global UI objects.</remarks>
        void Awake()
        {
            GameEvents.onVesselSwitching.Add(OnVesselSwitch);
            GameEvents.onVesselChange.Add(OnVesselChange);
            GameEvents.onPartCouple.Add(OnPartCouple);
            ConfigAccessor.ReadFieldsInType(typeof(Controller), this);
            _mouseInfoOverlay = new HintOverlay(
                () => GUI.skin,
                () => new GUIStyle(GUI.skin.box)
            {
                padding   = GUI.skin.button.padding,
                margin    = GUI.skin.button.margin,
                alignment = TextAnchor.MiddleLeft,
                fontSize  = _infoOverlayFontSize,
            },
                adjustGuiScale: true);

            // Drop vessel selection when main modifier is released.
            _vesselSwitchKey.OnRelease += delegate { SetHoveredVessel(null); };
            // Iterate through stabilization modes.
            _switchStabilizationModeKey.OnClick += SelectNextStabilizationMode;
        }
Exemple #12
0
        void Awake()
        {
            // Read all configs.
            ConfigAccessor.ReadFieldsInType(typeof(ConsoleUI), null /* instance */);
            ConfigAccessor.ReadFieldsInType(typeof(LogInterceptor), null /* instance */);
            ConfigAccessor.ReadFieldsInType(typeof(LogFilter), null /* instance */);
            ConfigAccessor.ReadFieldsInType(
                ConsoleUI.diskLogAggregator.GetType(), ConsoleUI.diskLogAggregator);
            ConfigAccessor.ReadFieldsInType(
                ConsoleUI.rawLogAggregator.GetType(), ConsoleUI.rawLogAggregator);
            ConfigAccessor.ReadFieldsInType(
                ConsoleUI.collapseLogAggregator.GetType(), ConsoleUI.collapseLogAggregator);
            ConfigAccessor.ReadFieldsInType(
                ConsoleUI.smartLogAggregator.GetType(), ConsoleUI.smartLogAggregator);

            // Start all aggregators.
            ConsoleUI.rawLogAggregator.StartCapture();
            ConsoleUI.collapseLogAggregator.StartCapture();
            ConsoleUI.smartLogAggregator.StartCapture();
            ConsoleUI.diskLogAggregator.StartCapture();
            LogInterceptor.StartIntercepting();
        }
 /// <inheritdoc/>
 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     rotaingCylinder = Hierarchy.FindPartModelByPath(part, rotatingWinchCylinderModel);
     ConfigAccessor.ReadFieldsInType(GetType(), this);
 }
 public override void StartLoad()
 {
     ConfigAccessor.ReadFieldsInType(typeof(Config), instance: null);
 }
Exemple #15
0
 /// <summary>Only loads session settings.</summary>
 void Awake()
 {
     ConfigAccessor.ReadFieldsInType(typeof(ConsoleUI), this, group: SessionGroup);
 }
Exemple #16
0
 internal CommonConfigImpl()
 {
     ConfigAccessor.ReadFieldsInType(GetType(), this);
 }
Exemple #17
0
 public override void StartLoad()
 {
     DebugEx.Info("Loading KIS global settings...");
     ConfigAccessor.ReadFieldsInType(typeof(KISAddonConfig), instance: null);
     ConfigAccessor.ReadFieldsInType(typeof(ModuleKISInventory), instance: null);
 }