Пример #1
0
        //============================================================

        public void StartNewGame()
        {
            currentLevel = 1;

            SceneManager.LoadScene(1, LoadSceneMode.Single);
            SceneInitCommandQueue.Enqueue(new SceneInitCommandInfo(Default_Init, null));
        }
Пример #2
0
        public void LoadSave_by_Index(int index)
        {
            //GameDataManager.RequestData(Generate_Big_Data, Print_Big_Data);

            string path = Path.Combine(Application.persistentDataPath, "Save" + index.ToString() + ".vSave");

            if (File.Exists(path))
            {
                //With the use.... when code get out of the scope......automatically Close.
                using (BinaryReader reader = new BinaryReader(File.OpenRead(path)))
                {
                    //1.) Read the Scene Name
                    string sceneName = reader.ReadString();

                    //2. push a load data command to command Queue. After we Change Scene, We will Load the Data
                    SceneInitCommandQueue.Enqueue(new SceneInitCommandInfo(LoadSave, path));

                    //3.) Load the Scene
                    SceneManager.LoadScene(sceneName, LoadSceneMode.Single);
                }
            }
            else
            {
                Debug.Log("The Save is Invalidate");
            }
        }
Пример #3
0
 private void Start()
 {
     while (SceneInitCommandQueue.Count > 0)
     {
         SceneInitCommandInfo info = SceneInitCommandQueue.DequeueInit();
         info.callback(info.parameter);
     }
 }
Пример #4
0
 public void NextLevel()
 {
     currentLevel++;
     SceneInitCommandQueue.Enqueue(new SceneInitCommandInfo(Default_Init, true));
     SceneManager.LoadScene(currentLevel, LoadSceneMode.Single);
 }