示例#1
0
 private void SetNewMap(MapDatam newMap)
 {
     if (map != newMap)
     {
         if (map != null)
         {
             Debug.Log("Closing Old Map: " + map.name);
             //systemsManager.voxelSystemGroup.worldSpawnSystem.Clear();
             space.GetOrCreateSystem <VoxelSystemGroup>().Clear();
         }
         map = newMap;
         if (map != null)
         {
             Debug.Log("New Map Set: " + newMap.name);
             //systemsManager.voxelSystemGroup.worldSpawnSystem.QueueWorld(float3.zero, map);
             space.GetOrCreateSystem <VoxelSystemGroup>().worldSpawnSystem.QueueMap(float3.zero, map, new Entity());
             this.titleContent = new GUIContent("MapMaker [" + map.name + "]");
             // clear buttons
             ClearButtons();
             SpawnMapSelectedUI();
         }
         else
         {
             this.titleContent = new GUIContent("MapMaker");
             //this.titleContent = new GUIContent("MapMaker [" + System.DateTime.Now.ToString("HH-dd-MMMyy").Replace('.', '-') + "]");
             // respawn buttons
             ClearButtons();
             SpawnMapButtons();
         }
     }
 }
示例#2
0
 void SpawnMapButtons()
 {
     for (int i = 0; i < maps.Length; i++)
     {
         MapDatam selectedMap = maps[i];
         Button   newButton   = new Button();
         newButton.clicked += (() =>
         {
             SetNewMap(selectedMap);
         });
         newButton.text = "[" + maps[i].name + "]";
         buttonsParent.Add(newButton);
     }
 }