mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-14 17:09:31 +07:00
tiled properties wip
This commit is contained in:
@@ -47,8 +47,11 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Assets\IsoTools\Scripts\Internal\Editor\IsoObjectEditor.cs" />
|
||||
<Compile Include="Assets\IsoTools\Tiled\Internal\Editor\TiledMapAssetEditor.cs" />
|
||||
<Compile Include="Assets\IsoTools\Tiled\Internal\Editor\TiledMapEditor.cs" />
|
||||
<Compile Include="Assets\IsoTools\Tiled\Internal\Editor\TiledMapLayerEditor.cs" />
|
||||
<Compile Include="Assets\IsoTools\Tiled\Internal\Editor\TiledMapPostprocessor.cs" />
|
||||
<Compile Include="Assets\IsoTools\Tiled\Internal\Editor\TiledMapPropertiesTests.cs" />
|
||||
<Compile Include="Assets\IsoTools\Tiled\Internal\Editor\TiledMapTileEditor.cs" />
|
||||
<Reference Include="UnityEditor.Advertisements">
|
||||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Advertisements/Editor/UnityEditor.Advertisements.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -33,6 +33,8 @@ MonoBehaviour:
|
||||
Visible: 0
|
||||
Tiles: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
Properties:
|
||||
- em
|
||||
-
|
||||
- layer prop
|
||||
- 765
|
||||
Tilesets:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 221bc03dca62748f284639c0b399875b
|
||||
timeCreated: 1454267285
|
||||
timeCreated: 1454394623
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,8 @@ namespace IsoTools.Tiled.Internal {
|
||||
iso_object.isShowBounds = true;
|
||||
|
||||
var tiled_map = map_go.AddComponent<TiledMap>();
|
||||
tiled_map.Asset = _asset;
|
||||
tiled_map.Asset = _asset;
|
||||
tiled_map.Properties = new TiledMapProperties(_asset.Data.Properties);
|
||||
foreach ( var layer in _asset.Data.Layers ) {
|
||||
CreateTiledMapLayer(tiled_map, layer);
|
||||
}
|
||||
@@ -39,7 +40,8 @@ namespace IsoTools.Tiled.Internal {
|
||||
layer_go.SetActive(layer_data.Visible);
|
||||
|
||||
var tiled_layer = layer_go.AddComponent<TiledMapLayer>();
|
||||
tiled_layer.Asset = _asset;
|
||||
tiled_layer.Asset = _asset;
|
||||
tiled_layer.Properties = new TiledMapProperties(layer_data.Properties);
|
||||
for ( var i = 0; i < _asset.Data.Height; ++i ) {
|
||||
for ( var j = 0; j < _asset.Data.Width; ++j ) {
|
||||
CreateTileMapTile(tiled_layer, layer_data, j, i);
|
||||
@@ -99,7 +101,8 @@ namespace IsoTools.Tiled.Internal {
|
||||
-(i + j) * iso_world.stepDepth);
|
||||
|
||||
var tiled_tile = tile_go.AddComponent<TiledMapTile>();
|
||||
tiled_tile.Asset = _asset;
|
||||
tiled_tile.Asset = _asset;
|
||||
tiled_tile.Properties = new TiledMapProperties(tileset.Properties);
|
||||
|
||||
var tile_spr = tile_go.AddComponent<SpriteRenderer>();
|
||||
tile_spr.sprite = tile_sprite;
|
||||
|
||||
35
Assets/IsoTools/Tiled/Internal/Editor/TiledMapEditor.cs
Normal file
35
Assets/IsoTools/Tiled/Internal/Editor/TiledMapEditor.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using IsoTools.Tiled;
|
||||
using IsoTools.Internal;
|
||||
|
||||
namespace IsoTools.Tiled.Internal {
|
||||
[CustomEditor(typeof(TiledMap))]
|
||||
public class TiledMapMapEditor : Editor {
|
||||
TiledMap _map = null;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// Functions
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// Messages
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
void OnEnable() {
|
||||
_map = target as TiledMap;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
DrawDefaultInspector();
|
||||
if ( _map && _map.Properties != null ) {
|
||||
GUILayout.Label(string.Format(
|
||||
"Property count: {0}", _map.Properties.Count));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace IsoTools.Tiled.Internal
|
||||
12
Assets/IsoTools/Tiled/Internal/Editor/TiledMapEditor.cs.meta
Normal file
12
Assets/IsoTools/Tiled/Internal/Editor/TiledMapEditor.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4fe69d04227f4d48adc05234d7a49f3
|
||||
timeCreated: 1454357848
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
35
Assets/IsoTools/Tiled/Internal/Editor/TiledMapLayerEditor.cs
Normal file
35
Assets/IsoTools/Tiled/Internal/Editor/TiledMapLayerEditor.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using IsoTools.Tiled;
|
||||
using IsoTools.Internal;
|
||||
|
||||
namespace IsoTools.Tiled.Internal {
|
||||
[CustomEditor(typeof(TiledMapLayer))]
|
||||
public class TiledMapLayerEditor : Editor {
|
||||
TiledMapLayer _layer = null;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// Functions
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// Messages
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
void OnEnable() {
|
||||
_layer = target as TiledMapLayer;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
DrawDefaultInspector();
|
||||
if ( _layer && _layer.Properties != null ) {
|
||||
GUILayout.Label(string.Format(
|
||||
"Property count: {0}", _layer.Properties.Count));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace IsoTools.Tiled.Internal
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae52a145971b34ce58548f7d0a1be41b
|
||||
timeCreated: 1454357699
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -199,9 +199,9 @@ namespace IsoTools.Tiled.Internal {
|
||||
var props_elem = owner_elem != null ? owner_elem.Element("properties") : null;
|
||||
if ( props_elem != null ) {
|
||||
foreach ( var prop_elem in props_elem.Elements("property") ) {
|
||||
var prop_name = SafeLoadStrFromElemAttr(prop_elem, "name" , string.Empty);
|
||||
var prop_value = SafeLoadStrFromElemAttr(prop_elem, "value", string.Empty);
|
||||
if ( !string.IsNullOrEmpty(prop_name) && prop_value != string.Empty ) {
|
||||
var prop_name = SafeLoadStrFromElemAttr(prop_elem, "name" , null);
|
||||
var prop_value = SafeLoadStrFromElemAttr(prop_elem, "value", null);
|
||||
if ( !string.IsNullOrEmpty(prop_name) && prop_value != null ) {
|
||||
props.Add(prop_name);
|
||||
props.Add(prop_value);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace IsoTools.Tiled.Internal {
|
||||
public void Test00() {
|
||||
var props = new TiledMapProperties(null);
|
||||
Assert.AreEqual(props.Count, 0);
|
||||
Assert.False(props.Has(""));
|
||||
Assert.False(props.Has(null));
|
||||
Assert.False(props.Has(string.Empty));
|
||||
Assert.False(props.Has("prop1"));
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace IsoTools.Tiled.Internal {
|
||||
Assert.True(props.Has("prop2"));
|
||||
Assert.True(props.Has("prop3"));
|
||||
|
||||
Assert.False(props.Has(""));
|
||||
Assert.False(props.Has(null));
|
||||
Assert.False(props.Has("val2"));
|
||||
Assert.False(props.Has("prop4"));
|
||||
Assert.False(props.Has(string.Empty));
|
||||
|
||||
35
Assets/IsoTools/Tiled/Internal/Editor/TiledMapTileEditor.cs
Normal file
35
Assets/IsoTools/Tiled/Internal/Editor/TiledMapTileEditor.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using IsoTools.Tiled;
|
||||
using IsoTools.Internal;
|
||||
|
||||
namespace IsoTools.Tiled.Internal {
|
||||
[CustomEditor(typeof(TiledMapTile))]
|
||||
public class TiledMapTileEditor : Editor {
|
||||
TiledMapTile _tile = null;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// Functions
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// Messages
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
void OnEnable() {
|
||||
_tile = target as TiledMapTile;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
DrawDefaultInspector();
|
||||
if ( _tile && _tile.Properties != null ) {
|
||||
GUILayout.Label(string.Format(
|
||||
"Property count: {0}", _tile.Properties.Count));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace IsoTools.Tiled.Internal
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b2831b8e398544239645b6e85f259eb
|
||||
timeCreated: 1454357710
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,7 +11,8 @@ namespace IsoTools.Tiled {
|
||||
[RequireComponent(typeof(IsoObject))]
|
||||
public class TiledMap : MonoBehaviour {
|
||||
|
||||
public TiledMapAsset Asset = null;
|
||||
public TiledMapAsset Asset = null;
|
||||
public TiledMapProperties Properties = null;
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace IsoTools.Tiled {
|
||||
[ExecuteInEditMode, DisallowMultipleComponent]
|
||||
public class TiledMapLayer : MonoBehaviour {
|
||||
|
||||
public TiledMapAsset Asset = null;
|
||||
public TiledMapAsset Asset = null;
|
||||
public TiledMapProperties Properties = null;
|
||||
}
|
||||
} // namespace IsoTools.Tiled
|
||||
@@ -10,6 +10,7 @@ namespace IsoTools.Tiled {
|
||||
[ExecuteInEditMode, DisallowMultipleComponent]
|
||||
public class TiledMapTile : MonoBehaviour {
|
||||
|
||||
public TiledMapAsset Asset = null;
|
||||
public TiledMapAsset Asset = null;
|
||||
public TiledMapProperties Properties = null;
|
||||
}
|
||||
} // namespace IsoTools.Tiled
|
||||
Reference in New Issue
Block a user