コード例 #1
0
 bool CheckForRequirements()
 {
     if (!t)
     {
         EditorGUILayout.HelpBox("Please Create LevelBuilder in Scene", MessageType.Warning);
         if (GUILayout.Button("Create LevelBuilder"))
         {
             var go = new GameObject("Level Builder");
             _t = go.AddComponent <LevelBuilder>();
         }
         return(false);
     }
     if (!t.tileSet)
     {
         EditorGUILayout.HelpBox("Please Apply TileAtlas to LevelBuilder", MessageType.Warning);
         if (GUILayout.Button("Create New Tile Atlas"))
         {
             var tileAtlas = CreateInstance <TileAtlas>();
             var path      = EditorUtility.SaveFilePanelInProject("New TileAtlas", "My Tile Atlas", "asset", "Choose destination of new asset");
             AssetDatabase.CreateAsset(tileAtlas, path);
             AssetDatabase.Refresh();
             t.tileSet = (TileAtlas)AssetDatabase.LoadAssetAtPath(path, typeof(TileAtlas));
             EditorGUIUtility.PingObject(t.tileSet);
         }
         TileAtlas chosen = null;
         chosen = (TileAtlas)EditorGUILayout.ObjectField("Use Preexisting ", chosen, typeof(TileAtlas), false);
         if (chosen)
         {
             t.tileSet = chosen;
         }
         return(false);
     }
     if (t.tileSet.tiles == null || t.tileSet.tiles.Count == 0)
     {
         EditorGUILayout.HelpBox("Please add Tiles to TileAtlas", MessageType.Warning);
         if (GUILayout.Button("Ping Atlas"))
         {
             EditorGUIUtility.PingObject(t.tileSet);
         }
         return(false);
     }
     if (t.tileSet.TileFromGuid == null || t.tileSet.TileFromGuid.Keys.Count == 0)
     {
         EditorGUILayout.HelpBox("Please click 'Dictionary from List' in TileAtlas", MessageType.Warning);
         if (GUILayout.Button("Ping Atlas"))
         {
             EditorGUIUtility.PingObject(t.tileSet);
         }
         return(false);
     }
     return(true);
 }
コード例 #2
0
 public static void SetActiveLevelbuilder(LevelBuilder input)
 {
     _t = input;
 }