コード例 #1
0
ファイル: PlayerProfile.cs プロジェクト: yazici/FRONTIERS
        public static PlayerPreferences Default()
        {               //TODO this isn't really necessary any more, remove it
            PlayerPreferences prefs = new PlayerPreferences();

            /*prefs.InitializedAsDefault = true;
             *                      prefs.Video = VideoPrefs.Default();
             *                      prefs.Sound = SoundPrefs.Default();
             *                      prefs.Controls = ControlPrefs.Default();
             *                      prefs.Immersion = ImmersionPrefs.Default();
             *                      prefs.Accessibility = AccessibilityPrefs.Default();
             *                      prefs.Mods = ModPrefs.Default();*/
            return(prefs);
        }
コード例 #2
0
ファイル: Profile.cs プロジェクト: yazici/FRONTIERS
        public bool SetProfile(string profileName, out string errorMessage)
        {
            HasSelectedProfile = false;
            Debug.Log("Setting profile to " + profileName);
            PlayerProfile     profile = null;
            PlayerPreferences prefs   = null;

            if (GameData.IO.LoadProfile(ref profile, profileName, out errorMessage))
            {
                mCurrentProfile = profile;
                Debug.Log("Current profile is now " + profileName);
                HasSelectedProfile = true;

                if (GameData.IO.LoadPreferences(ref prefs, profileName, out errorMessage))
                {
                    //make sure these prefs are legitimate
                    //otherwise they might have wonky values

                    /*if (prefs.Version != GameManager.VersionString || !prefs.InitializedAsDefault) {
                     *      prefs = PlayerPreferences.Default();
                     *      //save the new preferences immediately
                     *      GameData.IO.SavePreferences(profileName, prefs);
                     * }*/
                    mCurrentPreferences = prefs;
                    //now's the time to detect if we have a controller plugged in
                    if (HasControllerPluggedIn && mCurrentPreferences.Controls.ShowCPromptsWhenControllerIsPresent)
                    {
                        Debug.Log("===Found controller plugged in - showing controller prompts");
                        mCurrentPreferences.Controls.ShowControllerPrompts = true;
                    }
                    else
                    {
                        Debug.Log("===Didn't find controller plugged in - defaulting to mouse & keyboard prompts");
                        mCurrentPreferences.Controls.ShowControllerPrompts = false;
                    }
                }
                else
                {
                    Debug.Log("Couldn't load preferences when setting profle");
                }
            }
            return(HasSelectedProfile);
        }
コード例 #3
0
ファイル: Profile.cs プロジェクト: yazici/FRONTIERS
 public bool CreateProfile(string profileName)
 {
     Debug.Log("Creating profile inside of profile manager");
     profileName = GameData.IO.CreateProfileDirectory(profileName);
     if (profileName != "Error")
     {
         PlayerProfile profile = new PlayerProfile();
         profile.Name        = profileName;
         mCurrentProfile     = profile;
         mCurrentPreferences = PlayerPreferences.Default();
         GameData.IO.SaveProfile(mCurrentProfile);
         GameData.IO.SavePreferences(mCurrentProfile.Name, mCurrentPreferences);
         HasSelectedProfile = true;
         return(true);
     }
     else
     {
         return(false);
     }
 }