Пример #1
0
        void Awake()
        {
            if (toolbarControl == null)
            {
                Log.Info("RCSBuildaid creating toolbar");
                InitToolbar();
            }

            rcsList    = new List <PartModule>();
            engineList = new List <PartModule>();

            events = new Events();
            events.HookEvents();
            PluginKeys.Setup();

            gameObject.AddComponent <MarkerManager>();
            gameObject.AddComponent <MainWindow>();
            gameObject.AddComponent <DeltaV>();

            var obj = new GameObject("Vessel Forces Object");

            obj.layer    = 2;
            vesselForces = obj.AddComponent <MarkerForces>();

            Events.EditorScreenChanged += onEditorScreenChanged;
        }
Пример #2
0
        void Awake()
        {
            if (!appLauncherCreated)
            {
                appLauncherCreated = true;
                Log.Info("RCSBuildaid creating AppLauncher");
                //var appLauncher = new AppLauncher(this.gameObject);
            }

            rcsList    = new List <PartModule> ();
            engineList = new List <PartModule> ();

            events = new Events();
            events.HookEvents();
            PluginKeys.Setup();

            gameObject.AddComponent <MarkerManager> ();
            gameObject.AddComponent <MainWindow> ();
            gameObject.AddComponent <DeltaV> ();

            var obj = new GameObject("Vessel Forces Object");

            obj.layer    = 2;
            vesselForces = obj.AddComponent <MarkerForces> ();

            Events.EditorScreenChanged += onEditorScreenChanged;
        }
Пример #3
0
        void Awake()
        {
#if DEBUG
            Debug.Log("[RCSBA]: Awake");
#endif

            rcsList       = new List <PartModule> ();
            engineList    = new List <PartModule> ();
            chutesList    = new List <PartModule>();
            selectionList = new List <PartModule>();

            events = new Events();
            events.HookEvents();
            PluginKeys.Setup();

            gameObject.AddComponent <MarkerManager> ();
            gameObject.AddComponent <MainWindow> ();
            gameObject.AddComponent <DeltaV> ();

            var obj = new GameObject("Vessel Forces Object");
            obj.layer    = 2;
            vesselForces = obj.AddComponent <MarkerForces> ();

            /* We need these here and not in Start for catch some editor events */
            Events.EditorScreenChanged += onEditorScreenChanged;
            Events.VesselPartChanged   += onVesselPartChanged;
            Events.SelectionChanged    += onSelectionChange;
            Events.PartDrag            += onPartDrag;
            Events.LeavingEditor       += onLeavingEditor;
        }
Пример #4
0
        void Awake()
        {
            rcsList    = new List <PartModule> ();
            engineList = new List <PartModule> ();

            events = new Events();
            events.HookEvents();
            PluginKeys.Setup();

            gameObject.AddComponent <MainWindow> ();
            gameObject.AddComponent <DeltaV> ();
            // Analysis disable once AccessToStaticMemberViaDerivedType
            vesselOverlays = (EditorVesselOverlays)GameObject.FindObjectOfType(
                typeof(EditorVesselOverlays));

            Events.EditorScreenChanged += onEditorScreenChanged;
        }
Пример #5
0
        void Awake()
        {
            rcsList    = new List <PartModule> ();
            engineList = new List <PartModule> ();

            events = new Events();
            events.HookEvents();
            PluginKeys.Setup();

            gameObject.AddComponent <MarkerManager> ();
            gameObject.AddComponent <MainWindow> ();
            gameObject.AddComponent <DeltaV> ();

            var obj = new GameObject("Vessel Forces Object");

            obj.layer    = 2;
            vesselForces = obj.AddComponent <MarkerForces> ();

            Events.EditorScreenChanged += onEditorScreenChanged;
        }
Пример #6
0
        public static void LoadConfig()
        {
            oldPath = true;
            bool exists = true;

            configAbsolutePath = Path.Combine(KSPUtil.ApplicationRootPath, oldConfigPath);
            if (!File.Exists(configAbsolutePath))
            {
                oldPath            = false;
                configAbsolutePath = Path.Combine(KSPUtil.ApplicationRootPath, configPath);
            }
            exists   = File.Exists(configAbsolutePath);
            settings = ConfigNode.Load(configAbsolutePath) ?? new ConfigNode();
            if (oldPath)
            {
                try
                {
                    File.Delete(configAbsolutePath);
                    Directory.Delete(Path.Combine(KSPUtil.ApplicationRootPath, oldConfigDir));
                }
                catch { }
                configAbsolutePath = Path.Combine(KSPUtil.ApplicationRootPath, configPath);
            }

            com_reference = (MarkerType)GetValue("com_reference", (int)MarkerType.CoM);
            plugin_mode   = (PluginMode)GetValue("plugin_mode", (int)PluginMode.RCS);
            direction     = (Direction)GetValue("direction", (int)Direction.right);

            menu_vessel_mass  = GetValue("menu_vessel_mass", false);
            menu_res_mass     = GetValue("menu_res_mass", false);
            marker_scale      = GetValue("marker_scale", 1f);
            include_rcs       = GetValue("include_rcs", true);
            include_wheels    = GetValue("include_wheels", false);
            eng_include_rcs   = GetValue("eng_include_rcs", false);
            resource_amount   = GetValue("resource_amount", false);
            use_dry_mass      = GetValue("use_dry_mass", true);
            filled_chair      = GetValue("filled_chair", true);
            show_dcom_offsets = GetValue("show_dcom_offsets", true);
            show_marker_com   = GetValue("show_marker_com", true);
            show_marker_dcom  = GetValue("show_marker_dcom", true);
            show_marker_acom  = GetValue("show_marker_acom", false);
            marker_autoscale  = GetValue("marker_autoscale", true);
            menu_minimized    = GetValue("menu_minimized", false);
            //applauncher = GetValue("applauncher", true);
            action_screen = GetValue("action_screen", false);
//            toolbar_plugin = GetValue("toolbar_plugin", false);
            window_x = GetValue("window_x", 280);
            window_y = GetValue("window_y", 114);
            disable_mod_compatibility_check = GetValue("disable_mod_compatibility_check", false);

            /* for these resources, set some defaults */
            resource_cfg["LiquidFuel"]     = GetValue(resourceKey("LiquidFuel"), false);
            resource_cfg["Oxidizer"]       = GetValue(resourceKey("Oxidizer"), false);
            resource_cfg["SolidFuel"]      = GetValue(resourceKey("SolidFuel"), false);
            resource_cfg["XenonGas"]       = GetValue(resourceKey("XenonGas"), true);
            resource_cfg["IntakeAir"]      = GetValue(resourceKey("IntakeAir"), true);
            resource_cfg["Ablator"]        = GetValue(resourceKey("Ablator"), true);
            resource_cfg["Ore"]            = GetValue(resourceKey("Ore"), false);
            resource_cfg["MonoPropellant"] = GetValue(resourceKey("MonoPropellant"), true);

            string bodyname = GetValue("selected_body", "Kerbin");

            selected_body = PSystemManager.Instance.localBodies.Find(b => b.name == bodyname);
            if (selected_body == null)
            {
                /* can happen in a corrupted settings.cfg */
                selected_body = Planetarium.fetch.Home;
            }

            Events.ConfigSaving += SaveConfig;
            if (oldPath || !exists)
            {
                PluginKeys.Setup();
                SaveConfig();
                oldPath = false;
            }
        }