Skip to content

Commit

Permalink
add editor assembly definition, move all editor scripts to one locati…
Browse files Browse the repository at this point in the history
…on (#882)
  • Loading branch information
Em3rgencyLT authored Jan 4, 2022
1 parent 2159d92 commit a1c2ca3
Show file tree
Hide file tree
Showing 25 changed files with 77 additions and 55 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using SS3D.Engine.Tiles;
using System;
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEditor;
using UnityEngine;

namespace SS3D.Engine.Atmospherics
namespace SS3D.Editor.Atmospherics
{
// TODO, move to editors
public class AtmosDebug : EditorWindow
Expand Down
18 changes: 18 additions & 0 deletions Assets/Editor/EditorDefinitions.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "EditorDefinitions",
"references": [
"GUID:2b0396ce7dd650b49913445322785073",
"GUID:30817c1a0e6d646d99c048fc403f5979"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions Assets/Editor/EditorDefinitions.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Editor/TileMap.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using SS3D.Engine.Tile.TileRework.Connections;
using SS3D.Engine.Tile.TileRework;
using SS3D.Engine.Tile.TileRework.Connections;
using SS3D.Engine.Tile.TileRework.Connections.AdjacencyTypes;
using SS3D.Engine.Tiles;
using UnityEditor;
using UnityEngine;

namespace SS3D.Engine.Tile.TileRework.Editor
namespace SS3D.Editor.TileMap
{
/// <summary>
/// Custom editor used for setting blocked connections.
Expand Down Expand Up @@ -70,7 +71,7 @@ public override void OnInspectorGUI()
{
// Get the PlacedTileObject and map
var placedObject = connector.gameObject.GetComponent<PlacedTileObject>();
TileMap map = connector.gameObject.GetComponentInParent<TileMap>();
Engine.Tiles.TileMap map = connector.gameObject.GetComponentInParent<Engine.Tiles.TileMap>();

// Get all neighbours
var neighbourObjects = map.GetNeighbourObjects(placedObject.GetLayer(), 0, placedObject.transform.position);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
using System;
using System.Collections.Generic;
using SS3D.Engine.Tile.TileRework;
using SS3D.Engine.Tiles;
using UnityEditor;
using UnityEngine;

namespace SS3D.Engine.Tiles.Editor.TileMapEditor
namespace SS3D.Editor.TileMap
{
/**
* Handles creating a dragging rect and converting that into real tiles in the scene.
*/
public class TileDragHandler
{
public TileDragHandler(TileManager tileManager, TileMapEditor mapEditor, TileMap map, int subLayerIndex, TileObjectSo tileObjectSO, Direction selectedDir, Vector3Int snappedPosition)
public TileDragHandler(TileManager tileManager, TileMapEditor mapEditor, Engine.Tiles.TileMap map, int subLayerIndex, TileObjectSo tileObjectSO, Direction selectedDir, Vector3Int snappedPosition)
{
this.tileManager = tileManager;
this.mapEditor = mapEditor;
Expand All @@ -29,7 +30,7 @@ public TileDragHandler(TileManager tileManager, TileMapEditor mapEditor, TileMap

private GameObject CreateGhost()
{
GameObject ghostObject = EditorAndRuntime.InstantiatePrefab(tileObjectSO.prefab);
GameObject ghostObject = (GameObject)PrefabUtility.InstantiatePrefab(tileObjectSO.prefab);
ghostObject.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
ghostObject.name = "Ghost object";
ghostObject.tag = "EditorOnly";
Expand Down Expand Up @@ -226,7 +227,7 @@ private void ShowTiles()

private readonly TileManager tileManager;
private readonly TileMapEditor mapEditor;
private readonly TileMap map;
private readonly Engine.Tiles.TileMap map;
private readonly int subLayerIndex;
private readonly TileObjectSo tileObjectSO;
private readonly Direction selectedDir;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
using SS3D.Engine.Tiles;
using SS3D.Engine.Tiles.Connections;
using System;
using System;
using System.Collections.Generic;
using System.Threading;
using SS3D.Engine.Tile.TileRework;
using SS3D.Engine.Tiles;
using SS3D.Engine.Tiles.Connections;
using UnityEditor;
using UnityEngine;

/// <summary>
/// This is the main editor for changing the tilemap.
/// </summary>
namespace SS3D.Engine.Tiles.Editor.TileMapEditor
namespace SS3D.Editor.TileMap
{
public class TileMapEditor : EditorWindow
{
Expand Down Expand Up @@ -263,7 +262,7 @@ public void OnGUI()
/// </summary>
private void ApplySettings()
{
TileMap map = tileManager.GetTileMaps()[selectedTileMapIndex];
Engine.Tiles.TileMap map = tileManager.GetTileMaps()[selectedTileMapIndex];
map.SetName(selectedName);
map.IsMain = isMainMap;

Expand Down Expand Up @@ -449,12 +448,12 @@ private void RefreshMapList()
}
}

private TileMap GetCurrentMap()
private Engine.Tiles.TileMap GetCurrentMap()
{
return tileManager.GetTileMaps()[selectedTileMapIndex];
}

private void FillGridOptions(TileMap map)
private void FillGridOptions(Engine.Tiles.TileMap map)
{
selectedName = map.GetName();
isMainMap = map.IsMain;
Expand Down Expand Up @@ -497,18 +496,18 @@ private void DisplayVisualHelp(Vector3 cell)
/// Draws the edges of chunks.
/// </summary>
/// <param name="map">Map to get chunks from</param>
private void DisplayGrid(TileMap map)
private void DisplayGrid(Engine.Tiles.TileMap map)
{
Handles.color = Color.cyan;
Vector3 offset = new Vector3(0.5f, 0, 0.5f);

TileChunk[] chunks = map.GetChunks();
foreach (var chunk in chunks)
{
Handles.DrawLine(chunk.GetOrigin() - offset, chunk.GetOrigin() + new Vector3(TileMap.CHUNK_SIZE, 0, 0) - offset);
Handles.DrawLine(chunk.GetOrigin() - offset, chunk.GetOrigin() + new Vector3(0, 0, TileMap.CHUNK_SIZE) - offset);
Handles.DrawLine(chunk.GetOrigin() - offset + new Vector3(TileMap.CHUNK_SIZE, 0, 0), chunk.GetOrigin() + new Vector3(TileMap.CHUNK_SIZE, 0, TileMap.CHUNK_SIZE) - offset);
Handles.DrawLine(chunk.GetOrigin() - offset + new Vector3(0, 0, TileMap.CHUNK_SIZE), chunk.GetOrigin() + new Vector3(TileMap.CHUNK_SIZE, 0, TileMap.CHUNK_SIZE) - offset);
Handles.DrawLine(chunk.GetOrigin() - offset, chunk.GetOrigin() + new Vector3(Engine.Tiles.TileMap.CHUNK_SIZE, 0, 0) - offset);
Handles.DrawLine(chunk.GetOrigin() - offset, chunk.GetOrigin() + new Vector3(0, 0, Engine.Tiles.TileMap.CHUNK_SIZE) - offset);
Handles.DrawLine(chunk.GetOrigin() - offset + new Vector3(Engine.Tiles.TileMap.CHUNK_SIZE, 0, 0), chunk.GetOrigin() + new Vector3(Engine.Tiles.TileMap.CHUNK_SIZE, 0, Engine.Tiles.TileMap.CHUNK_SIZE) - offset);
Handles.DrawLine(chunk.GetOrigin() - offset + new Vector3(0, 0, Engine.Tiles.TileMap.CHUNK_SIZE), chunk.GetOrigin() + new Vector3(Engine.Tiles.TileMap.CHUNK_SIZE, 0, Engine.Tiles.TileMap.CHUNK_SIZE) - offset);
}
}

Expand Down Expand Up @@ -584,7 +583,7 @@ private void DestroyGhost()
/// </summary>
private void UpdateTileVisibility()
{
TileMap map = GetCurrentMap();
Engine.Tiles.TileMap map = GetCurrentMap();
foreach (TileLayer layer in TileHelper.GetTileLayers())
{
bool visible = layerVisibilitySelection[(int)layer];
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using SS3D.Engine.Tile.TileRework;
using SS3D.Engine.Tile.TileRework;
using UnityEditor;
using UnityEngine;

namespace SS3D.Engine.Tiles.Editor.TileMapEditor
namespace SS3D.Editor.TileMap
{
public class TileObjectMigrator : MonoBehaviour
{
Expand Down
12 changes: 0 additions & 12 deletions Assets/Engine/Atmospherics/Editor.meta

This file was deleted.

11 changes: 3 additions & 8 deletions Assets/Engine/Debug/EasyButtons/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/Engine/Debug/EasyButtons/Editor/EasyButtons.asmref
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"reference": "GUID:adfd753e6e0bb234fb7143be344f1fa4"
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Assets/Engine/Tile/TileRework/TileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ private void Init()
}
tileObjectSOs = listTileObjectSO.ToArray();
#else
Resources.LoadAll<TileObjectSO>("");
tileObjectSOs = Resources.FindObjectsOfTypeAll<TileObjectSO>();
Resources.LoadAll<TileObjectSo>("");
tileObjectSOs = Resources.FindObjectsOfTypeAll<TileObjectSo>();
#endif

LoadAll(true);
Expand Down

0 comments on commit a1c2ca3

Please sign in to comment.