mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交FairyGUI
This commit is contained in:
126
JNFrame2/Assets/Plugins/FairyGUI/Editor/DisplayObjectEditor.cs
Normal file
126
JNFrame2/Assets/Plugins/FairyGUI/Editor/DisplayObjectEditor.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using FairyGUI;
|
||||
|
||||
namespace FairyGUIEditor
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(DisplayObjectInfo))]
|
||||
public class DisplayObjectEditor : Editor
|
||||
{
|
||||
void OnEnable()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DisplayObject obj = (target as DisplayObjectInfo).displayObject;
|
||||
if (obj == null)
|
||||
return;
|
||||
|
||||
EditorGUILayout.LabelField(obj.GetType().Name + ": " + obj.id, (GUIStyle)"OL Title");
|
||||
EditorGUILayout.Separator();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
string name = EditorGUILayout.TextField("Name", obj.name);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
obj.name = name;
|
||||
if (obj is Container)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
bool fairyBatching = EditorGUILayout.Toggle("FairyBatching", ((Container)obj).fairyBatching);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
((Container)obj).fairyBatching = fairyBatching;
|
||||
}
|
||||
|
||||
GObject gObj = obj.gOwner;
|
||||
if (gObj != null)
|
||||
{
|
||||
EditorGUILayout.Separator();
|
||||
EditorGUILayout.LabelField(gObj.GetType().Name + ": " + gObj.id, (GUIStyle)"OL Title");
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
if (!string.IsNullOrEmpty(gObj.resourceURL))
|
||||
{
|
||||
PackageItem pi = UIPackage.GetItemByURL(gObj.resourceURL);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("Resource");
|
||||
EditorGUILayout.LabelField(pi.name + "@" + pi.owner.name);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
name = EditorGUILayout.TextField("Name", gObj.name);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
gObj.name = name;
|
||||
|
||||
if (gObj.parent != null)
|
||||
{
|
||||
string[] options = new string[gObj.parent.numChildren];
|
||||
int[] values = new int[options.Length];
|
||||
for (int i = 0; i < options.Length; i++)
|
||||
{
|
||||
options[i] = i.ToString();
|
||||
values[i] = i;
|
||||
}
|
||||
EditorGUI.BeginChangeCheck();
|
||||
int childIndex = EditorGUILayout.IntPopup("Child Index", gObj.parent.GetChildIndex(gObj), options, values);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
gObj.parent.SetChildIndex(gObj, childIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("Child Index");
|
||||
EditorGUILayout.LabelField("No Parent");
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
Vector3 position = EditorGUILayout.Vector3Field("Position", gObj.position);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
gObj.position = position;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
Vector3 rotation = EditorGUILayout.Vector3Field("Rotation", new Vector3(gObj.rotationX, gObj.rotationY, gObj.rotation));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
gObj.rotationX = rotation.x;
|
||||
gObj.rotationY = rotation.y;
|
||||
gObj.rotation = rotation.z;
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
Vector2 scale = EditorGUILayout.Vector2Field("Scale", gObj.scale);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
gObj.scale = scale;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
Vector2 skew = EditorGUILayout.Vector2Field("Skew", gObj.skew);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
gObj.skew = skew;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
Vector2 size = EditorGUILayout.Vector2Field("Size", gObj.size);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
gObj.size = size;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
Vector2 pivot = EditorGUILayout.Vector2Field("Pivot", gObj.pivot);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
gObj.pivot = pivot;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
string text = EditorGUILayout.TextField("Text", gObj.text);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
gObj.text = text;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
string icon = EditorGUILayout.TextField("Icon", gObj.icon);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
gObj.icon = icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a2f78faa29e5e1547837f976bf4b39f2
|
||||
timeCreated: 1541149029
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
135
JNFrame2/Assets/Plugins/FairyGUI/Editor/EditorToolSet.cs
Normal file
135
JNFrame2/Assets/Plugins/FairyGUI/Editor/EditorToolSet.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using FairyGUI;
|
||||
|
||||
namespace FairyGUIEditor
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class EditorToolSet
|
||||
{
|
||||
public static GUIContent[] packagesPopupContents;
|
||||
|
||||
static bool _loaded;
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
static void Startup()
|
||||
{
|
||||
EditorApplication.update += EditorApplication_Update;
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/FairyGUI/UI Panel", false, 0)]
|
||||
static void CreatePanel()
|
||||
{
|
||||
EditorApplication.update -= EditorApplication_Update;
|
||||
EditorApplication.update += EditorApplication_Update;
|
||||
|
||||
StageCamera.CheckMainCamera();
|
||||
|
||||
GameObject panelObject = new GameObject("UIPanel");
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
panelObject.transform.parent = Selection.activeGameObject.transform;
|
||||
panelObject.layer = Selection.activeGameObject.layer;
|
||||
}
|
||||
else
|
||||
{
|
||||
int layer = LayerMask.NameToLayer(StageCamera.LayerName);
|
||||
panelObject.layer = layer;
|
||||
}
|
||||
panelObject.AddComponent<FairyGUI.UIPanel>();
|
||||
Selection.objects = new Object[] { panelObject };
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/FairyGUI/UI Camera", false, 0)]
|
||||
static void CreateCamera()
|
||||
{
|
||||
StageCamera.CheckMainCamera();
|
||||
Selection.objects = new Object[] { StageCamera.main.gameObject };
|
||||
}
|
||||
|
||||
[MenuItem("Window/FairyGUI - Refresh Packages And Panels")]
|
||||
static void RefreshPanels()
|
||||
{
|
||||
ReloadPackages();
|
||||
}
|
||||
|
||||
static void EditorApplication_Update()
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
return;
|
||||
|
||||
if (_loaded || !EMRenderSupport.hasTarget)
|
||||
return;
|
||||
|
||||
LoadPackages();
|
||||
}
|
||||
|
||||
public static void ReloadPackages()
|
||||
{
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
_loaded = false;
|
||||
LoadPackages();
|
||||
Debug.Log("FairyGUI - Refresh Packages And Panels complete.");
|
||||
}
|
||||
else
|
||||
EditorUtility.DisplayDialog("FairyGUI", "Cannot run in play mode.", "OK");
|
||||
}
|
||||
|
||||
public static void LoadPackages()
|
||||
{
|
||||
if (Application.isPlaying || _loaded)
|
||||
return;
|
||||
|
||||
EditorApplication.update -= EditorApplication_Update;
|
||||
EditorApplication.update += EditorApplication_Update;
|
||||
|
||||
_loaded = true;
|
||||
|
||||
UIPackage.RemoveAllPackages();
|
||||
FontManager.Clear();
|
||||
NTexture.DisposeEmpty();
|
||||
UIObjectFactory.Clear();
|
||||
|
||||
string[] ids = AssetDatabase.FindAssets("_fui t:textAsset");
|
||||
int cnt = ids.Length;
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
string assetPath = AssetDatabase.GUIDToAssetPath(ids[i]);
|
||||
int pos = assetPath.LastIndexOf("_fui");
|
||||
if (pos == -1)
|
||||
continue;
|
||||
|
||||
assetPath = assetPath.Substring(0, pos);
|
||||
if (AssetDatabase.AssetPathToGUID(assetPath) != null)
|
||||
UIPackage.AddPackage(assetPath,
|
||||
(string name, string extension, System.Type type, out DestroyMethod destroyMethod) =>
|
||||
{
|
||||
destroyMethod = DestroyMethod.Unload;
|
||||
return AssetDatabase.LoadAssetAtPath(name + extension, type);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
List<UIPackage> pkgs = UIPackage.GetPackages();
|
||||
pkgs.Sort(CompareUIPackage);
|
||||
|
||||
cnt = pkgs.Count;
|
||||
packagesPopupContents = new GUIContent[cnt + 1];
|
||||
for (int i = 0; i < cnt; i++)
|
||||
packagesPopupContents[i] = new GUIContent(pkgs[i].name);
|
||||
packagesPopupContents[cnt] = new GUIContent("Please Select");
|
||||
|
||||
EMRenderSupport.Reload();
|
||||
}
|
||||
|
||||
static int CompareUIPackage(UIPackage u1, UIPackage u2)
|
||||
{
|
||||
return u1.name.CompareTo(u2.name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35dcb233f95ffd54c94f09d731db89ae
|
||||
timeCreated: 1535374214
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "FairyGUI.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:f4270d81837019d47b93f11421168dae"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19cba46ac204fdd48a96c9d9f1471d9c
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
201
JNFrame2/Assets/Plugins/FairyGUI/Editor/PackagesWindow.cs
Normal file
201
JNFrame2/Assets/Plugins/FairyGUI/Editor/PackagesWindow.cs
Normal file
@@ -0,0 +1,201 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
using UnityEditor.Experimental.SceneManagement;
|
||||
#endif
|
||||
using FairyGUI;
|
||||
|
||||
namespace FairyGUIEditor
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class PackagesWindow : EditorWindow
|
||||
{
|
||||
Vector2 scrollPos1;
|
||||
Vector2 scrollPos2;
|
||||
GUIStyle itemStyle;
|
||||
|
||||
int selectedPackage;
|
||||
string selectedPackageName;
|
||||
string selectedComponentName;
|
||||
|
||||
public PackagesWindow()
|
||||
{
|
||||
this.maxSize = new Vector2(550, 400);
|
||||
this.minSize = new Vector2(550, 400);
|
||||
}
|
||||
|
||||
public void SetSelection(string packageName, string componentName)
|
||||
{
|
||||
selectedPackageName = packageName;
|
||||
selectedComponentName = componentName;
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
if (itemStyle == null)
|
||||
itemStyle = new GUIStyle(GUI.skin.GetStyle("Tag MenuItem"));
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
//package list start------
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Space(5);
|
||||
|
||||
EditorGUILayout.BeginVertical();
|
||||
GUILayout.Space(10);
|
||||
|
||||
EditorGUILayout.LabelField("Packages", (GUIStyle)"OL Title", GUILayout.Width(300));
|
||||
GUILayout.Space(5);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Space(4);
|
||||
|
||||
scrollPos1 = EditorGUILayout.BeginScrollView(scrollPos1, (GUIStyle)"CN Box", GUILayout.Height(300), GUILayout.Width(300));
|
||||
EditorToolSet.LoadPackages();
|
||||
List<UIPackage> pkgs = UIPackage.GetPackages();
|
||||
int cnt = pkgs.Count;
|
||||
if (cnt == 0)
|
||||
{
|
||||
selectedPackage = -1;
|
||||
selectedPackageName = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Toggle(selectedPackageName == pkgs[i].name, pkgs[i].name, itemStyle, GUILayout.ExpandWidth(true)))
|
||||
{
|
||||
selectedPackage = i;
|
||||
selectedPackageName = pkgs[i].name;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndScrollView();
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
//package list end------
|
||||
|
||||
//component list start------
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Space(5);
|
||||
|
||||
EditorGUILayout.BeginVertical();
|
||||
GUILayout.Space(10);
|
||||
|
||||
EditorGUILayout.LabelField("Components", (GUIStyle)"OL Title", GUILayout.Width(220));
|
||||
GUILayout.Space(5);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Space(4);
|
||||
|
||||
scrollPos2 = EditorGUILayout.BeginScrollView(scrollPos2, (GUIStyle)"CN Box", GUILayout.Height(300), GUILayout.Width(220));
|
||||
if (selectedPackage >= 0)
|
||||
{
|
||||
List<PackageItem> items = pkgs[selectedPackage].GetItems();
|
||||
int i = 0;
|
||||
foreach (PackageItem pi in items)
|
||||
{
|
||||
if (pi.type == PackageItemType.Component && pi.exported)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Toggle(selectedComponentName == pi.name, pi.name, itemStyle, GUILayout.ExpandWidth(true)))
|
||||
selectedComponentName = pi.name;
|
||||
i++;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndScrollView();
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
//component list end------
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(20);
|
||||
|
||||
//buttons start---
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.Space(180);
|
||||
|
||||
if (GUILayout.Button("Refresh", GUILayout.Width(100)))
|
||||
EditorToolSet.ReloadPackages();
|
||||
|
||||
GUILayout.Space(20);
|
||||
if (GUILayout.Button("OK", GUILayout.Width(100)) && selectedPackage >= 0)
|
||||
{
|
||||
UIPackage selectedPkg = pkgs[selectedPackage];
|
||||
string tmp = selectedPkg.assetPath.ToLower();
|
||||
string packagePath;
|
||||
int pos = tmp.LastIndexOf("/resources/");
|
||||
if (pos != -1)
|
||||
packagePath = selectedPkg.assetPath.Substring(pos + 11);
|
||||
else
|
||||
{
|
||||
pos = tmp.IndexOf("resources/");
|
||||
if (pos == 0)
|
||||
packagePath = selectedPkg.assetPath.Substring(pos + 10);
|
||||
else
|
||||
packagePath = selectedPkg.assetPath;
|
||||
}
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
bool isPrefab = PrefabUtility.GetPrefabAssetType(Selection.activeGameObject) != PrefabAssetType.NotAPrefab;
|
||||
#else
|
||||
bool isPrefab = PrefabUtility.GetPrefabType(Selection.activeGameObject) == PrefabType.Prefab;
|
||||
#endif
|
||||
Selection.activeGameObject.SendMessage("OnUpdateSource",
|
||||
new object[] { selectedPkg.name, packagePath, selectedComponentName, !isPrefab },
|
||||
SendMessageOptions.DontRequireReceiver);
|
||||
}
|
||||
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
|
||||
if (prefabStage != null)
|
||||
EditorSceneManager.MarkSceneDirty(prefabStage.scene);
|
||||
else
|
||||
ApplyChange();
|
||||
#else
|
||||
ApplyChange();
|
||||
#endif
|
||||
this.Close();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
void ApplyChange()
|
||||
{
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
|
||||
#elif UNITY_5
|
||||
EditorApplication.MarkSceneDirty();
|
||||
#else
|
||||
EditorUtility.SetDirty(Selection.activeGameObject);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83ed477a96af9c94f9f2ccc24b5a24c0
|
||||
timeCreated: 1535374214
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
29
JNFrame2/Assets/Plugins/FairyGUI/Editor/StageCameraEditor.cs
Normal file
29
JNFrame2/Assets/Plugins/FairyGUI/Editor/StageCameraEditor.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using UnityEditor;
|
||||
using FairyGUI;
|
||||
|
||||
namespace FairyGUIEditor
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(StageCamera))]
|
||||
public class StageCameraEditor : Editor
|
||||
{
|
||||
string[] propertyToExclude;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
propertyToExclude = new string[] { "m_Script" };
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
DrawPropertiesExcluding(serializedObject, propertyToExclude);
|
||||
|
||||
if (serializedObject.ApplyModifiedProperties())
|
||||
(target as StageCamera).ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b99582678b83dc46986b02984c665a3
|
||||
timeCreated: 1460480287
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
226
JNFrame2/Assets/Plugins/FairyGUI/Editor/UIConfigEditor.cs
Normal file
226
JNFrame2/Assets/Plugins/FairyGUI/Editor/UIConfigEditor.cs
Normal file
@@ -0,0 +1,226 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using FairyGUI;
|
||||
|
||||
namespace FairyGUIEditor
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(UIConfig))]
|
||||
public class UIConfigEditor : Editor
|
||||
{
|
||||
string[] propertyToExclude;
|
||||
bool itemsFoldout;
|
||||
bool packagesFoldOut;
|
||||
int errorState;
|
||||
|
||||
private const float kButtonWidth = 18f;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
propertyToExclude = new string[] { "m_Script", "Items", "PreloadPackages" };
|
||||
|
||||
itemsFoldout = EditorPrefs.GetBool("itemsFoldOut");
|
||||
packagesFoldOut = EditorPrefs.GetBool("packagesFoldOut");
|
||||
errorState = 0;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
DrawPropertiesExcluding(serializedObject, propertyToExclude);
|
||||
|
||||
UIConfig config = (UIConfig)target;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
itemsFoldout = EditorGUILayout.Foldout(itemsFoldout, "Config Items");
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
EditorPrefs.SetBool("itemsFoldOut", itemsFoldout);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
bool modified = false;
|
||||
|
||||
if (itemsFoldout)
|
||||
{
|
||||
Undo.RecordObject(config, "Items");
|
||||
|
||||
int len = config.Items.Count;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("Add");
|
||||
UIConfig.ConfigKey selectedKey = (UIConfig.ConfigKey)EditorGUILayout.EnumPopup((System.Enum)UIConfig.ConfigKey.PleaseSelect);
|
||||
|
||||
if (selectedKey != UIConfig.ConfigKey.PleaseSelect)
|
||||
{
|
||||
int index = (int)selectedKey;
|
||||
|
||||
if (index > len - 1)
|
||||
{
|
||||
for (int i = len; i < index; i++)
|
||||
config.Items.Add(new UIConfig.ConfigValue());
|
||||
|
||||
UIConfig.ConfigValue value = new UIConfig.ConfigValue();
|
||||
value.valid = true;
|
||||
UIConfig.SetDefaultValue(selectedKey, value);
|
||||
config.Items.Add(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIConfig.ConfigValue value = config.Items[index];
|
||||
if (value == null)
|
||||
{
|
||||
value = new UIConfig.ConfigValue();
|
||||
value.valid = true;
|
||||
UIConfig.SetDefaultValue(selectedKey, value);
|
||||
config.Items[index] = value;
|
||||
}
|
||||
else if (!value.valid)
|
||||
{
|
||||
value.valid = true;
|
||||
UIConfig.SetDefaultValue(selectedKey, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
UIConfig.ConfigValue value = config.Items[i];
|
||||
if (value == null || !value.valid)
|
||||
continue;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel(((UIConfig.ConfigKey)i).ToString());
|
||||
switch ((UIConfig.ConfigKey)i)
|
||||
{
|
||||
case UIConfig.ConfigKey.ClickDragSensitivity:
|
||||
case UIConfig.ConfigKey.DefaultComboBoxVisibleItemCount:
|
||||
case UIConfig.ConfigKey.DefaultScrollStep:
|
||||
case UIConfig.ConfigKey.TouchDragSensitivity:
|
||||
case UIConfig.ConfigKey.TouchScrollSensitivity:
|
||||
case UIConfig.ConfigKey.InputCaretSize:
|
||||
value.i = EditorGUILayout.IntField(value.i);
|
||||
break;
|
||||
|
||||
case UIConfig.ConfigKey.ButtonSound:
|
||||
case UIConfig.ConfigKey.GlobalModalWaiting:
|
||||
case UIConfig.ConfigKey.HorizontalScrollBar:
|
||||
case UIConfig.ConfigKey.LoaderErrorSign:
|
||||
case UIConfig.ConfigKey.PopupMenu:
|
||||
case UIConfig.ConfigKey.PopupMenu_seperator:
|
||||
case UIConfig.ConfigKey.TooltipsWin:
|
||||
case UIConfig.ConfigKey.VerticalScrollBar:
|
||||
case UIConfig.ConfigKey.WindowModalWaiting:
|
||||
case UIConfig.ConfigKey.DefaultFont:
|
||||
value.s = EditorGUILayout.TextField(value.s);
|
||||
break;
|
||||
|
||||
case UIConfig.ConfigKey.DefaultScrollBounceEffect:
|
||||
case UIConfig.ConfigKey.DefaultScrollTouchEffect:
|
||||
case UIConfig.ConfigKey.RenderingTextBrighterOnDesktop:
|
||||
case UIConfig.ConfigKey.AllowSoftnessOnTopOrLeftSide:
|
||||
case UIConfig.ConfigKey.DepthSupportForPaintingMode:
|
||||
value.b = EditorGUILayout.Toggle(value.b);
|
||||
break;
|
||||
|
||||
case UIConfig.ConfigKey.ButtonSoundVolumeScale:
|
||||
value.f = EditorGUILayout.Slider(value.f, 0, 1);
|
||||
break;
|
||||
|
||||
case UIConfig.ConfigKey.ModalLayerColor:
|
||||
case UIConfig.ConfigKey.InputHighlightColor:
|
||||
value.c = EditorGUILayout.ColorField(value.c);
|
||||
break;
|
||||
|
||||
case UIConfig.ConfigKey.Branch:
|
||||
EditorGUI.BeginChangeCheck();
|
||||
value.s = EditorGUILayout.TextField(value.s);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (GUILayout.Button(new GUIContent("X", "Delete Item"), EditorStyles.miniButtonRight, GUILayout.Width(30)))
|
||||
{
|
||||
config.Items[i].Reset();
|
||||
UIConfig.SetDefaultValue((UIConfig.ConfigKey)i, config.Items[i]);
|
||||
modified = true;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
packagesFoldOut = EditorGUILayout.Foldout(packagesFoldOut, "Preload Packages");
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
EditorPrefs.SetBool("packagesFoldOut", packagesFoldOut);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (packagesFoldOut)
|
||||
{
|
||||
Undo.RecordObject(config, "PreloadPackages");
|
||||
|
||||
EditorToolSet.LoadPackages();
|
||||
|
||||
if (EditorToolSet.packagesPopupContents != null)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("Add");
|
||||
int selected = EditorGUILayout.Popup(EditorToolSet.packagesPopupContents.Length - 1, EditorToolSet.packagesPopupContents);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (selected != EditorToolSet.packagesPopupContents.Length - 1)
|
||||
{
|
||||
UIPackage pkg = UIPackage.GetPackages()[selected];
|
||||
string tmp = pkg.assetPath.ToLower();
|
||||
int pos = tmp.LastIndexOf("resources/");
|
||||
if (pos != -1)
|
||||
{
|
||||
string packagePath = pkg.assetPath.Substring(pos + 10);
|
||||
if (config.PreloadPackages.IndexOf(packagePath) == -1)
|
||||
config.PreloadPackages.Add(packagePath);
|
||||
|
||||
errorState = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorState = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (errorState > 0)
|
||||
{
|
||||
errorState--;
|
||||
EditorGUILayout.HelpBox("Package is not in resources folder.", MessageType.Warning);
|
||||
}
|
||||
|
||||
int cnt = config.PreloadPackages.Count;
|
||||
int pi = 0;
|
||||
while (pi < cnt)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("" + pi + ".");
|
||||
config.PreloadPackages[pi] = EditorGUILayout.TextField(config.PreloadPackages[pi]);
|
||||
if (GUILayout.Button(new GUIContent("X", "Delete Item"), EditorStyles.miniButtonRight, GUILayout.Width(30)))
|
||||
{
|
||||
config.PreloadPackages.RemoveAt(pi);
|
||||
cnt--;
|
||||
}
|
||||
else
|
||||
pi++;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
else
|
||||
errorState = 0;
|
||||
|
||||
if (serializedObject.ApplyModifiedProperties() || modified)
|
||||
(target as UIConfig).ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74df68b10ee56a54a8105d88312571ce
|
||||
timeCreated: 1460480288
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,64 @@
|
||||
using UnityEditor;
|
||||
using FairyGUI;
|
||||
|
||||
namespace FairyGUIEditor
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(UIContentScaler))]
|
||||
public class UIContentScalerEditor : Editor
|
||||
{
|
||||
SerializedProperty scaleMode;
|
||||
SerializedProperty screenMatchMode;
|
||||
SerializedProperty designResolutionX;
|
||||
SerializedProperty designResolutionY;
|
||||
SerializedProperty fallbackScreenDPI;
|
||||
SerializedProperty defaultSpriteDPI;
|
||||
SerializedProperty constantScaleFactor;
|
||||
SerializedProperty ignoreOrientation;
|
||||
|
||||
string[] propertyToExclude;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
scaleMode = serializedObject.FindProperty("scaleMode");
|
||||
screenMatchMode = serializedObject.FindProperty("screenMatchMode");
|
||||
designResolutionX = serializedObject.FindProperty("designResolutionX");
|
||||
designResolutionY = serializedObject.FindProperty("designResolutionY");
|
||||
fallbackScreenDPI = serializedObject.FindProperty("fallbackScreenDPI");
|
||||
defaultSpriteDPI = serializedObject.FindProperty("defaultSpriteDPI");
|
||||
constantScaleFactor = serializedObject.FindProperty("constantScaleFactor");
|
||||
ignoreOrientation = serializedObject.FindProperty("ignoreOrientation");
|
||||
|
||||
propertyToExclude = new string[] { "m_Script", "scaleMode", "screenMatchMode", "designResolutionX", "designResolutionY",
|
||||
"fallbackScreenDPI", "defaultSpriteDPI", "constantScaleFactor", "ignoreOrientation"};
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
DrawPropertiesExcluding(serializedObject, propertyToExclude);
|
||||
|
||||
EditorGUILayout.PropertyField(scaleMode);
|
||||
if ((UIContentScaler.ScaleMode)scaleMode.enumValueIndex == UIContentScaler.ScaleMode.ScaleWithScreenSize)
|
||||
{
|
||||
EditorGUILayout.PropertyField(designResolutionX);
|
||||
EditorGUILayout.PropertyField(designResolutionY);
|
||||
EditorGUILayout.PropertyField(screenMatchMode);
|
||||
EditorGUILayout.PropertyField(ignoreOrientation);
|
||||
}
|
||||
else if ((UIContentScaler.ScaleMode)scaleMode.enumValueIndex == UIContentScaler.ScaleMode.ConstantPhysicalSize)
|
||||
{
|
||||
EditorGUILayout.PropertyField(fallbackScreenDPI);
|
||||
EditorGUILayout.PropertyField(defaultSpriteDPI);
|
||||
}
|
||||
else
|
||||
EditorGUILayout.PropertyField(constantScaleFactor);
|
||||
|
||||
if (serializedObject.ApplyModifiedProperties())
|
||||
(target as UIContentScaler).ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69174d19fa9521b4283e0b8f0e85acc8
|
||||
timeCreated: 1460480288
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
96
JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPainterEditor.cs
Normal file
96
JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPainterEditor.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using UnityEngine;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
using UnityEditor;
|
||||
using FairyGUI;
|
||||
|
||||
namespace FairyGUIEditor
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(UIPainter))]
|
||||
public class UIPainterEditor : Editor
|
||||
{
|
||||
SerializedProperty packageName;
|
||||
SerializedProperty componentName;
|
||||
SerializedProperty renderCamera;
|
||||
SerializedProperty fairyBatching;
|
||||
SerializedProperty touchDisabled;
|
||||
SerializedProperty sortingOrder;
|
||||
|
||||
string[] propertyToExclude;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
packageName = serializedObject.FindProperty("packageName");
|
||||
componentName = serializedObject.FindProperty("componentName");
|
||||
renderCamera = serializedObject.FindProperty("renderCamera");
|
||||
fairyBatching = serializedObject.FindProperty("fairyBatching");
|
||||
touchDisabled = serializedObject.FindProperty("touchDisabled");
|
||||
sortingOrder = serializedObject.FindProperty("sortingOrder");
|
||||
|
||||
propertyToExclude = new string[] { "m_Script", "packageName", "componentName", "packagePath",
|
||||
"renderCamera", "fairyBatching", "touchDisabled","sortingOrder"
|
||||
};
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
UIPainter panel = target as UIPainter;
|
||||
|
||||
DrawPropertiesExcluding(serializedObject, propertyToExclude);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("Package Name");
|
||||
if (GUILayout.Button(packageName.stringValue, "ObjectField"))
|
||||
EditorWindow.GetWindow<PackagesWindow>(true, "Select a UI Component").SetSelection(packageName.stringValue, componentName.stringValue);
|
||||
|
||||
if (GUILayout.Button("Clear", GUILayout.Width(50)))
|
||||
{
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
bool isPrefab = PrefabUtility.GetPrefabAssetType(panel) != PrefabAssetType.NotAPrefab;
|
||||
#else
|
||||
bool isPrefab = PrefabUtility.GetPrefabType(panel) == PrefabType.Prefab;
|
||||
#endif
|
||||
panel.SendMessage("OnUpdateSource", new object[] { null, null, null, !isPrefab });
|
||||
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
|
||||
#elif UNITY_5
|
||||
EditorApplication.MarkSceneDirty();
|
||||
#else
|
||||
EditorUtility.SetDirty(panel);
|
||||
#endif
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("Component Name");
|
||||
if (GUILayout.Button(componentName.stringValue, "ObjectField"))
|
||||
EditorWindow.GetWindow<PackagesWindow>(true, "Select a UI Component").SetSelection(packageName.stringValue, componentName.stringValue);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
int oldSortingOrder = panel.sortingOrder;
|
||||
EditorGUILayout.PropertyField(sortingOrder);
|
||||
EditorGUILayout.PropertyField(renderCamera);
|
||||
EditorGUILayout.PropertyField(fairyBatching);
|
||||
EditorGUILayout.PropertyField(touchDisabled);
|
||||
|
||||
if (serializedObject.ApplyModifiedProperties())
|
||||
{
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
bool isPrefab = PrefabUtility.GetPrefabAssetType(panel) != PrefabAssetType.NotAPrefab;
|
||||
#else
|
||||
bool isPrefab = PrefabUtility.GetPrefabType(panel) == PrefabType.Prefab;
|
||||
#endif
|
||||
if (!isPrefab)
|
||||
{
|
||||
panel.ApplyModifiedProperties(sortingOrder.intValue != oldSortingOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5cb0f73c030157845aaa7b42a2b8d577
|
||||
timeCreated: 1461566835
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
163
JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPanelEditor.cs
Normal file
163
JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPanelEditor.cs
Normal file
@@ -0,0 +1,163 @@
|
||||
using UnityEngine;
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
using UnityEditor.SceneManagement;
|
||||
#endif
|
||||
using UnityEditor;
|
||||
|
||||
namespace FairyGUIEditor
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(FairyGUI.UIPanel))]
|
||||
public class UIPanelEditor : Editor
|
||||
{
|
||||
SerializedProperty packageName;
|
||||
SerializedProperty componentName;
|
||||
SerializedProperty packagePath;
|
||||
SerializedProperty renderMode;
|
||||
SerializedProperty renderCamera;
|
||||
SerializedProperty sortingOrder;
|
||||
SerializedProperty position;
|
||||
SerializedProperty scale;
|
||||
SerializedProperty rotation;
|
||||
SerializedProperty fairyBatching;
|
||||
SerializedProperty fitScreen;
|
||||
SerializedProperty touchDisabled;
|
||||
SerializedProperty hitTestMode;
|
||||
SerializedProperty setNativeChildrenOrder;
|
||||
|
||||
string[] propertyToExclude;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
packageName = serializedObject.FindProperty("packageName");
|
||||
componentName = serializedObject.FindProperty("componentName");
|
||||
packagePath = serializedObject.FindProperty("packagePath");
|
||||
renderMode = serializedObject.FindProperty("renderMode");
|
||||
renderCamera = serializedObject.FindProperty("renderCamera");
|
||||
sortingOrder = serializedObject.FindProperty("sortingOrder");
|
||||
position = serializedObject.FindProperty("position");
|
||||
scale = serializedObject.FindProperty("scale");
|
||||
rotation = serializedObject.FindProperty("rotation");
|
||||
fairyBatching = serializedObject.FindProperty("fairyBatching");
|
||||
fitScreen = serializedObject.FindProperty("fitScreen");
|
||||
touchDisabled = serializedObject.FindProperty("touchDisabled");
|
||||
hitTestMode = serializedObject.FindProperty("hitTestMode");
|
||||
setNativeChildrenOrder = serializedObject.FindProperty("setNativeChildrenOrder");
|
||||
|
||||
|
||||
propertyToExclude = new string[] { "m_Script", "packageName", "componentName", "packagePath", "renderMode",
|
||||
"renderCamera", "sortingOrder", "position", "scale", "rotation", "fairyBatching", "fitScreen","touchDisabled",
|
||||
"hitTestMode","cachedUISize","setNativeChildrenOrder"
|
||||
};
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
FairyGUI.UIPanel panel = target as FairyGUI.UIPanel;
|
||||
|
||||
DrawPropertiesExcluding(serializedObject, propertyToExclude);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("Package Name");
|
||||
if (GUILayout.Button(packageName.stringValue, "ObjectField"))
|
||||
EditorWindow.GetWindow<PackagesWindow>(true, "Select a UI Component").SetSelection(packageName.stringValue, componentName.stringValue);
|
||||
|
||||
if (GUILayout.Button("Clear", GUILayout.Width(50)))
|
||||
{
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
bool isPrefab = PrefabUtility.GetPrefabAssetType(panel) != PrefabAssetType.NotAPrefab;
|
||||
#else
|
||||
bool isPrefab = PrefabUtility.GetPrefabType(panel) == PrefabType.Prefab;
|
||||
#endif
|
||||
panel.SendMessage("OnUpdateSource", new object[] { null, null, null, !isPrefab });
|
||||
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
|
||||
#elif UNITY_5
|
||||
EditorApplication.MarkSceneDirty();
|
||||
#else
|
||||
EditorUtility.SetDirty(panel);
|
||||
#endif
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("Component Name");
|
||||
if (GUILayout.Button(componentName.stringValue, "ObjectField"))
|
||||
EditorWindow.GetWindow<PackagesWindow>(true, "Select a UI Component").SetSelection(packageName.stringValue, componentName.stringValue);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("Package Path");
|
||||
EditorGUILayout.LabelField(packagePath.stringValue, (GUIStyle)"helpbox");
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (Application.isPlaying)
|
||||
EditorGUILayout.EnumPopup("Render Mode", panel.container.renderMode);
|
||||
else
|
||||
EditorGUILayout.PropertyField(renderMode);
|
||||
if ((RenderMode)renderMode.enumValueIndex != RenderMode.ScreenSpaceOverlay)
|
||||
EditorGUILayout.PropertyField(renderCamera);
|
||||
|
||||
int oldSortingOrder = panel.sortingOrder;
|
||||
EditorGUILayout.PropertyField(sortingOrder);
|
||||
EditorGUILayout.PropertyField(fairyBatching);
|
||||
EditorGUILayout.PropertyField(hitTestMode);
|
||||
EditorGUILayout.PropertyField(touchDisabled);
|
||||
EditorGUILayout.PropertyField(setNativeChildrenOrder);
|
||||
EditorGUILayout.Separator();
|
||||
EditorGUILayout.LabelField("UI Transform", (GUIStyle)"OL Title");
|
||||
EditorGUILayout.Separator();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(position);
|
||||
EditorGUILayout.PropertyField(rotation);
|
||||
EditorGUILayout.PropertyField(scale);
|
||||
EditorGUILayout.Space();
|
||||
|
||||
FairyGUI.FitScreen oldFitScreen = (FairyGUI.FitScreen)fitScreen.enumValueIndex;
|
||||
EditorGUILayout.PropertyField(fitScreen);
|
||||
|
||||
if (serializedObject.ApplyModifiedProperties())
|
||||
{
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
bool isPrefab = PrefabUtility.GetPrefabAssetType(panel) != PrefabAssetType.NotAPrefab;
|
||||
#else
|
||||
bool isPrefab = PrefabUtility.GetPrefabType(panel) == PrefabType.Prefab;
|
||||
#endif
|
||||
if (!isPrefab)
|
||||
{
|
||||
panel.ApplyModifiedProperties(sortingOrder.intValue != oldSortingOrder, (FairyGUI.FitScreen)fitScreen.enumValueIndex != oldFitScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnSceneGUI()
|
||||
{
|
||||
FairyGUI.UIPanel panel = (target as FairyGUI.UIPanel);
|
||||
if (panel.container == null)
|
||||
return;
|
||||
|
||||
Vector3 pos = panel.GetUIWorldPosition();
|
||||
float sizeFactor = HandleUtility.GetHandleSize(pos);
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
var fmh_147_58_638646183197811786 = Quaternion.identity; Vector3 newPos = Handles.FreeMoveHandle(pos, sizeFactor, Vector3.one, Handles.ArrowHandleCap);
|
||||
#else
|
||||
Vector3 newPos = Handles.FreeMoveHandle(pos, Quaternion.identity, sizeFactor, Vector3.one, Handles.ArrowCap);
|
||||
#endif
|
||||
if (newPos != pos)
|
||||
{
|
||||
Vector2 v1 = HandleUtility.WorldToGUIPoint(pos);
|
||||
Vector2 v2 = HandleUtility.WorldToGUIPoint(newPos);
|
||||
Vector3 delta = v2 - v1;
|
||||
delta.x = (int)delta.x;
|
||||
delta.y = (int)delta.y;
|
||||
|
||||
panel.MoveUI(delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94949994c6eda08448145f618d0db72f
|
||||
timeCreated: 1535374215
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user