Esempio n. 1
0
 private static void PassSectionToFunction(List <string> section, string section_name)
 {
     if (section_name.Equals(known_sections[0]))
     {
         Section_AutoSelect.Load(section);
     }
     if (section_name.Equals(known_sections[1]))
     {
         Section_JoystickCurve.Load(section);
     }
     //...
 }
Esempio n. 2
0
        public static void SaveActivePilot()
        {
            if (!PilotManager.Exists(PilotManager.ActivePilot))
            {
                return;
            }
            try
            {
                string filepath = Path.Combine(Application.persistentDataPath, PilotManager.ActivePilot + file_extension);

                using (StreamWriter w = File.CreateText(filepath))
                {
                    w.WriteLine("[SECTION: AUTOSELECT]");
                    Section_AutoSelect.Save(w);
                    w.WriteLine("[/END]");

                    w.WriteLine("[SECTION: JOYSTICKCURVE]");
                    Section_JoystickCurve.Save(w);
                    w.WriteLine("[/END]");

                    //...

                    if (unknown_sections != null)
                    {
                        foreach (string line in unknown_sections)
                        {
                            w.WriteLine(line);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Log("Error in ExtendedConfig.SaveActivePilot(): " + ex);
            }
        }
Esempio n. 3
0
 public static void ApplyConfigData()
 {
     Section_AutoSelect.ApplySettings();
 }
Esempio n. 4
0
 public static void SetDefaultConfig()
 {
     Section_AutoSelect.Set();
     Section_JoystickCurve.SetDefault();
 }
Esempio n. 5
0
            public static void LoadPilotExtendedConfig(string name)
            {
                if (Network.isServer)
                {
                    Debug.Log("ExtendedConfig_PilotManager_Select called on the server");
                    return;
                }

                SetDefaultConfig();

                var loaded = false;

                if (!string.IsNullOrEmpty(name))
                {
                    string filepath = Path.Combine(Application.persistentDataPath, name + file_extension);
                    if (File.Exists(filepath))
                    {
                        ReadConfigData(filepath);
                        loaded = true;
                    }
                }

                if (!loaded)
                {
                    // Attempt to use autoselect from pre 0.4.1.
                    if (File.Exists(textFile))
                    {
                        Debug.Log("Extended config does not exist for pilot, attempting to load pre-0.4.1 autoselect.");
                        using (StreamReader sr = File.OpenText(textFile))
                        {
                            MPAutoSelection.PrimaryPriorityArray[0]   = sr.ReadLine();
                            MPAutoSelection.PrimaryPriorityArray[1]   = sr.ReadLine();
                            MPAutoSelection.PrimaryPriorityArray[2]   = sr.ReadLine();
                            MPAutoSelection.PrimaryPriorityArray[3]   = sr.ReadLine();
                            MPAutoSelection.PrimaryPriorityArray[4]   = sr.ReadLine();
                            MPAutoSelection.PrimaryPriorityArray[5]   = sr.ReadLine();
                            MPAutoSelection.PrimaryPriorityArray[6]   = sr.ReadLine();
                            MPAutoSelection.PrimaryPriorityArray[7]   = sr.ReadLine();
                            MPAutoSelection.SecondaryPriorityArray[0] = sr.ReadLine();
                            MPAutoSelection.SecondaryPriorityArray[1] = sr.ReadLine();
                            MPAutoSelection.SecondaryPriorityArray[2] = sr.ReadLine();
                            MPAutoSelection.SecondaryPriorityArray[3] = sr.ReadLine();
                            MPAutoSelection.SecondaryPriorityArray[4] = sr.ReadLine();
                            MPAutoSelection.SecondaryPriorityArray[5] = sr.ReadLine();
                            MPAutoSelection.SecondaryPriorityArray[6] = sr.ReadLine();
                            MPAutoSelection.SecondaryPriorityArray[7] = sr.ReadLine();
                            MPAutoSelection.PrimaryNeverSelect[0]     = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.PrimaryNeverSelect[1]     = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.PrimaryNeverSelect[2]     = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.PrimaryNeverSelect[3]     = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.PrimaryNeverSelect[4]     = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.PrimaryNeverSelect[5]     = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.PrimaryNeverSelect[6]     = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.PrimaryNeverSelect[7]     = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.SecondaryNeverSelect[0]   = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.SecondaryNeverSelect[1]   = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.SecondaryNeverSelect[2]   = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.SecondaryNeverSelect[3]   = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.SecondaryNeverSelect[4]   = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.SecondaryNeverSelect[5]   = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.SecondaryNeverSelect[6]   = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.SecondaryNeverSelect[7]   = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.primarySwapFlag           = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.secondarySwapFlag         = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.swapWhileFiring           = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.dontAutoselectAfterFiring = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.zorc    = sr.ReadLine().ToLower() == "true";
                            MPAutoSelection.miasmic = sr.ReadLine().ToLower() == "true";
                        }

                        Section_AutoSelect.Set(true);
                    }
                }

                ApplyConfigData();
            }