예제 #1
0
        public void add(string type, Chunk chunk)
        {
            ChunkTask task = new ChunkTask(type, chunk);

            if (type == "save")
            {
                savequeue.Add(task);
            }
            else
            {
                loadqueue.Add(task);
            }
            startthread();
        }
예제 #2
0
        void startsave()
        {
            if (savequeue.Count == 0)
            {
                return;
            }
            ChunkTask task = savequeue[0];

            thread       = new Thread(new ThreadStart(task.start));
            task.started = true;
            try {
                thread.Start();
            }
            catch (ThreadStateException e) {
                UnityEngine.Debug.Log("Thread Error" + e.ToString());
            }
        }
예제 #3
0
 public void update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         cio.save();
         foreach (Chunk chunk in Client.model.map.chunks)
         {
             if (chunk != null && chunk.loaded && !chunk.saved)
             {
                 ChunkTask task = new ChunkTask("save", chunk);
                 task.start();
             }
         }
         #if UNITY_EDITOR
         UnityEditor.EditorApplication.isPlaying = false;
         #else
         Application.Quit();
         #endif
     }
     playcon.update();
     invcon.update();
     chunkgen.run();
 }