save for editor properties

This commit is contained in:
2015-06-03 23:26:30 +06:00
parent e0ac3b82cd
commit f6b69c72b5
4 changed files with 62 additions and 42 deletions

View File

@@ -8,6 +8,9 @@ namespace IsoTools {
public static bool Alignment { get; private set; } public static bool Alignment { get; private set; }
public static bool ShowBounds { get; private set; } public static bool ShowBounds { get; private set; }
static string _alignmentPropName = "IsoTools.IsoEditorWindow.Alignment";
static string _showBoundsPropName = "IsoTools.IsoEditorWindow.ShowBounds";
void AlignmentSelection() { void AlignmentSelection() {
var iso_objects = Selection.gameObjects var iso_objects = Selection.gameObjects
.Where(p => p.GetComponent<IsoObject>()) .Where(p => p.GetComponent<IsoObject>())
@@ -33,5 +36,24 @@ namespace IsoTools {
AlignmentSelection(); AlignmentSelection();
} }
} }
void OnFocus() {
if ( EditorPrefs.HasKey(_alignmentPropName) ) {
Alignment = EditorPrefs.GetBool(_alignmentPropName);
}
if ( EditorPrefs.HasKey(_showBoundsPropName) ) {
ShowBounds = EditorPrefs.GetBool(_showBoundsPropName);
}
}
void OnLostFocus() {
EditorPrefs.SetBool(_alignmentPropName, Alignment);
EditorPrefs.SetBool(_showBoundsPropName, ShowBounds);
}
void OnDestroy() {
EditorPrefs.SetBool(_alignmentPropName, Alignment);
EditorPrefs.SetBool(_showBoundsPropName, ShowBounds);
}
} }
} }

View File

@@ -104,7 +104,7 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 44.4444427 value: 37.5
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
@@ -308,7 +308,7 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 88.8888931 value: 87.5
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
@@ -390,7 +390,7 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 77.7777786 value: 75
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
@@ -472,7 +472,7 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 66.6666641 value: 62.5
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
@@ -550,7 +550,7 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 55.5555534 value: 50
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
@@ -738,7 +738,7 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 33.3333321 value: 25
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
@@ -1020,7 +1020,7 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 11.1111107 value: 12.5
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x

View File

@@ -1,8 +1,7 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
namespace IsoTools { namespace IsoTools { namespace Examples {
namespace Examples {
public class IsoController : MonoBehaviour { public class IsoController : MonoBehaviour {
void MoveIsoObject(Vector3 dir) { void MoveIsoObject(Vector3 dir) {
var iso_object = GetComponent<IsoObject>(); var iso_object = GetComponent<IsoObject>();
@@ -35,5 +34,4 @@ namespace IsoTools {
} }
} }
} }
} }} // namespace IsoTools::Examples
}

View File

@@ -1,9 +1,9 @@
<Properties> <Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" PreferredExecutionTarget="MonoDevelop.Default" /> <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/IsoTools/Scripts/IsoRigidbody.cs"> <MonoDevelop.Ide.Workbench ActiveDocument="Assets/IsoTools/Scripts/IsoRigidbody.cs">
<Files> <Files>
<File FileName="Assets/IsoTools/Scripts/IsoRigidbody.cs" Line="22" Column="31" /> <File FileName="Assets/IsoTools/Scripts/IsoRigidbody.cs" Line="80" Column="52" />
<File FileName="Assets/IsoTools/Scripts/IsoObject.cs" Line="14" Column="12" /> <File FileName="Assets/IsoTools/Examples/Scripts/IsoController.cs" Line="14" Column="50" />
</Files> </Files>
</MonoDevelop.Ide.Workbench> </MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints> <MonoDevelop.Ide.DebuggingService.Breakpoints>