/// <summary> /// Initialize the control scheme manager. Should be called on game start. /// </summary> public static void Initialize() { Schemes = deserializeControlSchemes(PathToControlSchemes); // if no schemes are present create and serialise the default scheme if (Schemes.Count <= 0) { Debug.Log("No control schemes found - creating new ones!"); Schemes.Add(new ControlScheme(ControlActions.CreateDefaultTank(), "Classic", false)); Schemes.Add(new ControlScheme(ControlActions.CreateDefaultFps(), "Revamped", true, 5F)); SerializeControlSchemes(Schemes); } }
public void EnsureDefaultSchemes() { if (!File.Exists(PathUtil.Combine(_controlSchemesPath, "Classic.dat"))) { Debug.Log("Unable to find 'Classic' control scheme - creating..."); Schemes.Add(new ControlScheme(ControlActions.CreateDefaultTank(), "Classic", false)); } if (!File.Exists(PathUtil.Combine(_controlSchemesPath, "Revamped.dat"))) { Debug.Log("Unable to find 'Revamped' control scheme - creating..."); Schemes.Add(new ControlScheme(ControlActions.CreateDefaultFps(), "Revamped", true, 15F)); } SaveSchemes(); // we now need to sort the list, as any schemes that might have already been there before the default ones // will now be before them in the list -- this is not preferable as loading them as normal will simply // load them in alphabetical order, so this is to emulate that Schemes.Sort((x, y) => String.Compare(x.Name, y.Name, StringComparison.Ordinal)); }