示例#1
0
    public void LoadLevel()
    {
        PlayerData tmp = SaveLevel.LoadPlayer();

        level = tmp.level;
        score = tmp.score;
    }
示例#2
0
 private void OnSaveLevel(SaveLevel S)
 {
     if (S.Memory == gameObject)
     {
         ThisMemory = true;
     }
     else
     {
         ThisMemory = false;
     }
 }
示例#3
0
 public List <Detail> GetLoadLevel()
 {
     if (SaveLevel.LoadGame())
     {
         return(GetCurrentLevelDetails());
     }
     else
     {
         return(Reset());
     }
 }
示例#4
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#5
0
 void Awake()
 {
     
     if (instance == null)
         instance = this;
     else if (instance != this)
         Destroy(gameObject);
     DontDestroyOnLoad(gameObject);
     if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
         dataPath = System.IO.Path.Combine(Application.persistentDataPath, "Level.xml");
     else
         dataPath = System.IO.Path.Combine(Application.dataPath, "Resources/Level.xml");
 }
示例#6
0
    public static void RegisterPlayerBttn(string displayName, string password,
                                          string email, string fname, string lname, int age,
                                          string gender, string school, string major, string schoolYear, Text textError,
                                          Text emailError, GameObject panel, GameObject start,
                                          GameObject goBack, Text succefullReg)
    {
        GSRequestData sd = new GSRequestData().
                           AddString("displayName", displayName).
                           AddString("email", email).
                           AddString("userName", displayName);

        new GameSparks.Api.Requests.RegistrationRequest()
        .SetDisplayName(displayName)
        .SetUserName(displayName)
        .SetPassword(password)
        .SetScriptData(sd)
        .Send((response) => {
            if (!response.HasErrors)
            {
                Debug.Log("Player Registered \n User Name: " + response.DisplayName);

                SavePlayerData.SaveData(email, fname, lname, age, gender,
                                        school, major, schoolYear);

                stopMusic = true;

                /* after all is checked a ConfirmationRegistration form is displayed*/
                RegistrationConfirmation.Confirmation(panel, start, goBack, succefullReg);
                textError.text = " ";

                SaveLevel.saveLevel();
            }
            else
            {
                /**it handles when username is not unique**/

                if (response.Errors.JSON.Contains("Email"))
                {
                    emailError.text  = "Email has been taken";
                    emailError.color = Color.red;
                }
                else
                {
                    textError.text  = "Username has been taken";
                    textError.color = Color.red;
                }
            }
        });
    }
示例#7
0
 public void LoadNextScene()
 {
     if (SceneManager.GetActiveScene().buildIndex == 1)
     {
         _nextSceneIndex = 0;
         SaveLevel.SaveGame();
         _isSecondLaunch = true;
     }
     else
     {
         _nextSceneIndex = 1;
     }
     progressBar.value = 0;
     StartCoroutine(StartLoad());
 }
示例#8
0
    public void Restart()
    {
        SaveLevel.DeleteSaveFile();

        _allDetails = LevelContainer.currentLevelContainer.Reset();
        _connectionPoints.Clear();
        _connectionObjects.Clear();
        for (int i = 0; i < instantiateDetailObjects.Count; i++)
        {
            Destroy(instantiateDetailObjects[i]);
        }
        instantiateDetailObjects.Clear();
        StartDetailInstance();
        restartEvent.Invoke();
    }
示例#9
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
     if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
     {
         dataPath = System.IO.Path.Combine(Application.persistentDataPath, "Level.xml");
     }
     else
     {
         dataPath = System.IO.Path.Combine(Application.dataPath, "Resources/Level.xml");
     }
 }
 private void OnSaveLevel(SaveLevel S)
 {
     StartCoroutine(Show());
 }
示例#11
0
 private void OnDestroy()
 {
     SaveLevel.SaveGame();
 }
示例#12
0
 private void OnSaveLevel(SaveLevel S)
 {
     SaveLevel();
 }
示例#13
0
 public void Load()
 {
     SaveLevel.LoadGame();
 }
示例#14
0
 public void Save()
 {
     SaveLevel.SaveGame();
 }
示例#15
0
 public void NextLevel()
 {
     GlobalControl.Instance.level++;
     SaveLevel.SavePlayer();
     SceneManager.LoadScene(SceneManager.GetActiveScene().name);
 }
示例#16
0
 public void ResetLevel(int levelID)
 {
     _levels[levelID].Reset();
     SaveLevel.SaveGame();
 }