void Load(ref ClientMenuState state, ClientMenuState.Menu menu, FixedString128 name)
 {
     state.IsLoading           = true;
     state.LastLoadingMenu     = menu;
     state.LastLoadingMenuName = name;
     SceneManager.LoadScene(name.ToString(), LoadSceneMode.Additive);
 }
Beispiel #2
0
        protected override void OnUpdate()
        {
            if (m_rlsQuery.CalculateChunkCount() > 0)
            {
                FixedString128 targetScene = new FixedString128();
                bool           isInvalid   = false;

                Entities.ForEach((ref RequestLoadScene rls) =>
                {
                    if (rls.newScene.UTF8LengthInBytes == 0)
                    {
                        return;
                    }
                    if (targetScene.Length == 0)
                    {
                        targetScene = rls.newScene;
                    }
                    else if (rls.newScene != targetScene)
                    {
                        isInvalid = true;
                    }
                }).Run();

                if (targetScene.Length > 0)
                {
                    if (isInvalid)
                    {
                        UnityEngine.Debug.LogError("Multiple scenes were requested to load during the previous frame.");
                    }
                    else
                    {
                        var curr = worldGlobalEntity.GetComponentData <CurrentScene>();
                        curr.previousScene = curr.currentScene;
                        UnityEngine.Debug.Log("Loading scene: " + targetScene);
                        SceneManager.LoadScene(targetScene.ToString());
                        latiosWorld.pauseForSceneLoad = true;
                        curr.currentScene             = targetScene;
                        curr.isSceneFirstFrame        = true;
                        worldGlobalEntity.SetComponentData(curr);
                        return;
                    }
                }
            }

            //Handle case where initial scene loads or set firstFrame to false
            var currentScene = worldGlobalEntity.GetComponentData <CurrentScene>();

            if (currentScene.currentScene.UTF8LengthInBytes == 0)
            {
                currentScene.currentScene      = SceneManager.GetActiveScene().name;
                currentScene.isSceneFirstFrame = true;
            }
            else
            {
                currentScene.isSceneFirstFrame = false;
            }
            worldGlobalEntity.SetComponentData(currentScene);
        }
Beispiel #3
0
        public void WordStorageFixedString128Works(String value)
        {
            NumberedWords  w           = new NumberedWords();
            FixedString128 fixedString = default;

            w.SetString(value);
            w.ToFixedString(ref fixedString);
            Assert.AreEqual(value, fixedString.ToString());
        }
Beispiel #4
0
        public static unsafe bool PullCompletedReadBuffer(FixedString128 gameSaveFilePath, byte *buffer, int bufferLength)
        {
            string gameSaveFilePathString = gameSaveFilePath.ToString();

            return(js_gamesave_pullCompletedReadBuffer(gameSaveFilePathString, buffer, bufferLength));
        }
Beispiel #5
0
        public static unsafe bool GetLength(FixedString128 gameSaveFilePath, int *length)
        {
            string gameSaveFilePathString = gameSaveFilePath.ToString();

            return(js_gamesave_getLength(gameSaveFilePathString, length));
        }
Beispiel #6
0
        public static unsafe bool ReadFromDisk(FixedString128 gameSaveFilePath)
        {
            string gameSaveFilePathString = gameSaveFilePath.ToString();

            return(js_gamesave_asyncReadFromDisk(gameSaveFilePathString));
        }
Beispiel #7
0
        public static unsafe bool WriteToDisk(FixedString128 gameSaveFilePath, MemoryBinaryWriter writer)
        {
            string gameSaveFilePathString = gameSaveFilePath.ToString();

            return(js_gamesave_writeToDisk(gameSaveFilePathString, (byte *)writer.Data, (int)writer.Length));
        }
Beispiel #8
0
 public override string ToString()
 {
     return(Value.ToString());
 }