Esempio n. 1
0
 public static void ModCompatibilityCheck()
 {
     if (disable_mod_compatibility_check)
     {
         Debug.LogWarning("RCSBuildAid's mod compatibility check disabled.");
         return;
     }
     foreach (var mod in AssemblyLoader.loadedAssemblies)
     {
         var assemblyName = mod.assembly.GetName();
         var modName      = assemblyName.Name;
         if (String.Equals(modName, "FerramAerospaceResearch", StringComparison.OrdinalIgnoreCase) ||
             String.Equals(modName, "RealChute", StringComparison.OrdinalIgnoreCase))
         {
             if (EnabledModes.Remove(PluginMode.Parachutes))
             {
                 Debug.LogWarning("RCSBuildAid's parachute mode disabled since incompatible mods were detected.");
                 if (Settings.plugin_mode == PluginMode.Parachutes)
                 {
                     Settings.plugin_mode = PluginMode.none;
                 }
             }
         }
     }
 }
Esempio n. 2
0
        public static void LoadConfig()
        {
            configPath = Path.Combine(KSPUtil.ApplicationRootPath, configFile);
            settings   = ConfigNode.Load(configPath) ?? new ConfigNode();

            plugin_mode      = (PluginMode)GetValue("plugin_mode", (int)PluginMode.RCS);
            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);
            resource_amount  = GetValue("resource_amount", false);
            use_dry_mass     = GetValue("use_dry_mass", 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);
            menu_minimized   = GetValue("menu_minimized", false);
            toolbar_plugin   = GetValue("toolbar_plugin", true);

            /* 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 ["MonoPropellant"] = GetValue(resourceKey("MonoPropellant"), true);
        }
Esempio n. 3
0
        // DataContext creates plugins
        internal Plugin(DataContext context, string fileName, PluginMode mode)
        {
            this.context  = context;
            this.fileName = fileName;

            if (mode == PluginMode.Create)
            {
                header            = context.CreateHeader();
                header.NextFormId = 0x800;
                header.Version    = context.GetLatestFormVersion();
            }
            else if (mode == PluginMode.Open)
            {
                // Read only the header mainly to fetch the list of masters
                Stream stream = context.DataFileProvider.GetDataFile(FileMode.Open, fileName).Open();
                using (var reader = context.CreateReader(stream))
                {
                    header = reader.ReadHeader();
                }
            }
            else
            {
                throw new ArgumentException("Illegal plugin mode specified");
            }
        }
Esempio n. 4
0
 //
 public PluginExtendedAttribute(PluginType T, PluginMode M)
 {
     if (T == PluginType.FPDriver && M == PluginMode.MultiLoader)
         throw new Exception("Type FPDriver can't be used in multiloader plugin");
     _Type = T;
     _Mode = M;
 }
Esempio n. 5
0
 public void onModeChange (PluginMode mode)
 {
     MainWindow.DrawModeContent -= DrawContent;
     if (mode == workingMode) {
         MainWindow.DrawModeContent += DrawContent;
     }
 }
Esempio n. 6
0
 public void onModeChange(PluginMode mode)
 {
     MainWindow.DrawModeContent -= DrawContent;
     if (mode == workingMode)
     {
         MainWindow.DrawModeContent += DrawContent;
     }
 }
Esempio n. 7
0
 public static void onModeChange(PluginMode mode)
 {
     MainWindow.onDrawModeContent -= DrawContent;
     if (mode == PluginMode.RCS)
     {
         MainWindow.onDrawModeContent += DrawContent;
     }
 }
Esempio n. 8
0
 string getModeButtonName(PluginMode mode)
 {
     if (!menuTitles.TryGetValue(mode, out var buttonName))
     {
         buttonName = mode.ToString();
     }
     return(buttonName);
 }
Esempio n. 9
0
 protected override bool activeInMode(PluginMode mode)
 {
     switch (mode) {
     case PluginMode.Engine:
         return true;
     }
     return false;
 }
Esempio n. 10
0
 //
 public PluginExtendedAttribute(PluginType T, PluginMode M)
 {
     if (T == PluginType.LegalPrinterDriver && M == PluginMode.MultiLoader)
     {
         throw new Exception("Type FPDriver can't be used in multiloader plugin");
     }
     _Type = T;
     _Mode = M;
 }
Esempio n. 11
0
 protected override bool activeInMode(PluginMode mode)
 {
     switch (mode)
     {
     case PluginMode.Engine:
         return(true);
     }
     return(false);
 }
Esempio n. 12
0
        public static void LoadConfig()
        {
            string configAbsolutePath = Path.Combine(KSPUtil.ApplicationRootPath, configDirectory, configFilename);

            settings = ConfigNode.Load(configAbsolutePath) ?? new ConfigNode();

            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);
            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);
            crew_screen      = GetValue("crew_screen", true);
            toolbar_plugin   = GetValue("toolbar_plugin", true);
            window_x         = GetValue("window_x", 1360);
            window_y         = GetValue("window_y", 55);
            show_dcom_offset = GetValue("show_dcom_offset", false);
            show_rcs_twr     = GetValue("show_rcs_twr", false);
            disable_mod_compatibility_check = GetValue("disable_mod_compatibility_check", false);
            show_massless_resources         = GetValue("show_massless_resources", 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.LeavingEditor += SaveConfig;
        }
Esempio n. 13
0
 protected override bool activeInMode(PluginMode mode)
 {
     switch (mode) {
     case PluginMode.RCS:
     case PluginMode.Attitude:
         return true;
     case PluginMode.Engine:
         return RCSBuildAid.IncludeRCS;
     }
     return false;
 }
Esempio n. 14
0
        protected override bool activeInMode(PluginMode mode)
        {
            switch (mode)
            {
            case PluginMode.RCS:
            case PluginMode.Attitude:
                return(true);

            case PluginMode.Engine:
                return(RCSBuildAid.IncludeRCS);
            }
            return(false);
        }
Esempio n. 15
0
        public void SetMode(PluginMode mode)
        {
            switch (this.mode)
            {
            case PluginMode.RCS:
            case PluginMode.Attitude:
                /* need to remember this so I can know if I was using attitude or translation mode */
                lastMode = this.mode;
                break;
            }

            this.mode = mode;
            OnModeChange();
        }
Esempio n. 16
0
        public static void LoadConfig ()
        {
            configAbsolutePath = Path.Combine (KSPUtil.ApplicationRootPath, configPath);
            settings = ConfigNode.Load (configAbsolutePath) ?? new ConfigNode ();

            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 );
            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"  , true );
            window_x         = GetValue ("window_x"        , 280  );
            window_y         = GetValue ("window_y"        , 114  );

            /* 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;
        }
Esempio n. 17
0
        private void SetupPluginModeLogic(PluginMode pluginMode)
        {
            switch (pluginMode)
            {
            case PluginMode.RelationshipBased:
                _logic = new RelationshipBased();
                break;

            case PluginMode.Advanced:
                _logic = new Advanced();
                break;

            default:
                _logic = new Disabled();
                break;
            }
        }
Esempio n. 18
0
        public static void SetMode(PluginMode new_mode)
        {
            switch (Mode)
            {
            case PluginMode.RCS:
            case PluginMode.Attitude:
            case PluginMode.Engine:
                /* for guesssing which mode to enable when using shortcuts (if needed) */
                previousMode = Mode;
                break;

            case PluginMode.Parachutes:
            case PluginMode.none:
                break;

            default:
                /* invalid mode loaded from settings.cfg */
                new_mode = PluginMode.none;
                break;
            }

            switch (new_mode)
            {
            case PluginMode.Engine:
                /* reset gimbals if we're switching to engines */
                SetDirection(Direction.none);
                break;

            case PluginMode.Attitude:
            case PluginMode.RCS:
                /* these modes should always have a direction */
                SetDirection(previousDirection);
                break;
            }

            Mode = new_mode;
            Events.OnModeChanged();
        }
Esempio n. 19
0
        public static void onModeChange(PluginMode mode)
        {
            switch (mode)
            {
            case PluginMode.Engine:
                RCSlist.Clear();
                WheelList.Clear();
                break;

            case PluginMode.Attitude:
                EngineList.Clear();
                break;

            case PluginMode.RCS:
                EngineList.Clear();
                WheelList.Clear();
                break;

            case PluginMode.none:
                clearAllLists();
                break;
            }
        }
Esempio n. 20
0
        // DataContext creates plugins
        internal Plugin(DataContext context, string fileName, PluginMode mode)
        {
            this.context = context;
            this.fileName = fileName;

            if (mode == PluginMode.Create)
            {
                header = context.CreateHeader();
                header.NextFormId = 0x800;
            }
            else if (mode == PluginMode.Open)
            {
                // Read only the header mainly to fetch the list of masters
                Stream stream = context.DataFileProvider.GetDataFile(FileMode.Open, fileName).Open();
                using (var reader = context.CreateReader(stream))
                {
                    header = reader.ReadHeader();
                }
            }
            else
            {
                throw new ArgumentException("Illegal plugin mode specified");
            }
        }
Esempio n. 21
0
        void drawModeSelectList()
        {
            GUILayout.BeginVertical(GUI.skin.box);
            {
                int r = Mathf.CeilToInt(plugin_mode_count / 2f);
                int i = 0;

                GUILayout.BeginHorizontal();
                {
                    while (i < plugin_mode_count)
                    {
                        GUILayout.BeginVertical();
                        {
                            for (int j = 0; (j < r) && (i < plugin_mode_count); j++)
                            {
                                PluginMode mode = getEnabledPluginMode(i);
                                if (GUILayout.Button(getModeButtonName(mode), style.clickLabel))
                                {
                                    modeSelect = false;
                                    RCSBuildAid.SetMode(mode);
                                }
                                i++;
                            }
                        }
                        GUILayout.EndVertical();
                    }
                }
                GUILayout.EndHorizontal();
                if (GUILayout.Button("None", style.clickLabelCenter))
                {
                    modeSelect = false;
                    RCSBuildAid.SetMode(PluginMode.none);
                }
            }
            GUILayout.EndVertical();
        }
 protected override bool activeInMode(PluginMode mode)
 {
     return mode == PluginMode.Parachutes;
 }
 void onModeChanged(PluginMode mode)
 {
     stateChanged ();
 }
 protected abstract bool activeInMode(PluginMode mode);
Esempio n. 25
0
 protected override bool activeInMode(PluginMode mode)
 {
     switch (mode) {
     case PluginMode.RCS:
     case PluginMode.Attitude:
         return true;
     case PluginMode.Engine:
         return Settings.eng_include_rcs;
     }
     return false;
 }
Esempio n. 26
0
    public static bool ExtendedStartmode(PluginMode pluginMode, string disabledfeature)
    {
      switch (pluginMode)
      {
        case (PluginMode.Test): // for public user testing
          if (Configuration.PluginMode == "extended") return true; 
          if (Configuration.PluginMode == "test") return true;
          else LogMyFilms.Debug("PluginMode: '{0}', disabled feature: '{1}", Configuration.PluginMode, disabledfeature);
          return false;

        case (PluginMode.Extended): // for developer features only - set manually in config
          if (Configuration.PluginMode == "extended") return true;
          else LogMyFilms.Debug("PluginMode: '{0}', disabled feature: '{1}", Configuration.PluginMode, disabledfeature);
          return false;

        case (PluginMode.Normal):
        default:
          return true;
      }
    }
Esempio n. 27
0
 /* test if this part should be active during this mode */
 protected abstract bool activeInMode(PluginMode mode);
Esempio n. 28
0
 void onModeChange(PluginMode mode)
 {
     holdUpdate = true;
 }
Esempio n. 29
0
 void modeChanged(PluginMode mode)
 {
     updateRotation();
 }
Esempio n. 30
0
 /// <summary>
 /// Gets the specified PLug-in Mode value.
 /// </summary>
 /// <param name="pluginMode">PluginMode enum.</param>
 /// <returns>System.Int32.</returns>
 public static int Get(PluginMode pluginMode)
 {
     return((int)pluginMode);
 }
Esempio n. 31
0
 protected override bool activeInMode(PluginMode mode)
 {
     return(mode == PluginMode.Parachutes);
 }
Esempio n. 32
0
 private void HandlePatternChanges(IList<PatternStart> current, IList<PatternStart> update)
 {
     foreach (PatternStart start in update)
     {
         current.Remove(start);
     }
     if (current.Count > 0)
     {
         var effect = current.First().SampleEffect as Sweep;
         if (effect != null && effect.StartEffect != effect.EndEffect)
         {
             _kinectState = (_kinectState == PluginMode.NoBack) ?
                 PluginMode.NoFore : PluginMode.NoBack;
         }
     }
 }
Esempio n. 33
0
 void onModeChange(PluginMode mode)
 {
     holdUpdate = true;
 }
Esempio n. 34
0
 void onModeChanged(PluginMode mode)
 {
     stateChanged();
 }
Esempio n. 35
0
 string getModeButtonName (PluginMode mode)
 {
     string buttonName;
     if (!menuTitles.TryGetValue(mode, out buttonName)) {
         buttonName = mode.ToString ();
     }
     return buttonName;
 }
Esempio n. 36
0
 void onModeChange(PluginMode mode)
 {
     CoD.SetActive(mode == PluginMode.Parachutes);
 }
Esempio n. 37
0
 public static void ModCompatibilityCheck()
 {
     if (disable_mod_compatibility_check) {
         Debug.LogWarning ("RCSBuildAid's mod compatibility check disabled.");
         return;
     }
     foreach (var mod in AssemblyLoader.loadedAssemblies) {
         var assemblyName = mod.assembly.GetName();
         var modName = assemblyName.Name;
         if (String.Equals (modName, "FerramAerospaceResearch", StringComparison.OrdinalIgnoreCase) ||
             String.Equals (modName, "RealChute", StringComparison.OrdinalIgnoreCase)) {
             if (EnabledModes.Remove (PluginMode.Parachutes)) {
                 Debug.LogWarning ("RCSBuildAid's parachute mode disabled since incompatible mods were detected.");
                 if (Settings.plugin_mode == PluginMode.Parachutes) {
                     Settings.plugin_mode = PluginMode.none;
                 }
             }
         }
     }
 }