diff --git a/JNFrame2/Assembly-CSharp-firstpass.csproj b/JNFrame2/Assembly-CSharp-firstpass.csproj
index 4001ee3d..3e7b9a81 100644
--- a/JNFrame2/Assembly-CSharp-firstpass.csproj
+++ b/JNFrame2/Assembly-CSharp-firstpass.csproj
@@ -83,6 +83,7 @@
+
D:\Unity\2022.3.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.dll
@@ -899,6 +900,10 @@
{168b694c-7d58-d228-f9a3-02235c192fc5}
UniTask.Linq
+
+ {65d6cac9-6d7d-4b93-ff92-1a5fc94f680c}
+ FairyGUI.Runtime
+
{17b58f54-5d7b-7430-a784-74a4540f4c68}
JNGame.Editor
@@ -943,6 +948,10 @@
{56fe4698-9e38-f97f-0948-b4a412ec01fc}
SHFrame
+
+ {44b47b38-a33f-7d44-f2e0-a6c5f272d235}
+ FairyGUI.Editor
+
{694241c5-b793-03a0-1887-6d1b1abd5716}
UniTask.DOTween
diff --git a/JNFrame2/Assembly-CSharp.csproj b/JNFrame2/Assembly-CSharp.csproj
index aa6cb655..7d61dd77 100644
--- a/JNFrame2/Assembly-CSharp.csproj
+++ b/JNFrame2/Assembly-CSharp.csproj
@@ -1015,6 +1015,10 @@
{168b694c-7d58-d228-f9a3-02235c192fc5}
UniTask.Linq
+
+ {65d6cac9-6d7d-4b93-ff92-1a5fc94f680c}
+ FairyGUI.Runtime
+
{17b58f54-5d7b-7430-a784-74a4540f4c68}
JNGame.Editor
@@ -1059,6 +1063,10 @@
{56fe4698-9e38-f97f-0948-b4a412ec01fc}
SHFrame
+
+ {44b47b38-a33f-7d44-f2e0-a6c5f272d235}
+ FairyGUI.Editor
+
{694241c5-b793-03a0-1887-6d1b1abd5716}
UniTask.DOTween
diff --git a/JNFrame2/Assets/HotMain/HotMain.unity b/JNFrame2/Assets/HotMain/HotMain.unity
index 5bc67f29..58d28f0e 100644
--- a/JNFrame2/Assets/HotMain/HotMain.unity
+++ b/JNFrame2/Assets/HotMain/HotMain.unity
@@ -406,3 +406,55 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &1994723394
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1994723396}
+ - component: {fileID: 1994723395}
+ m_Layer: 0
+ m_Name: UIContentScaler
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &1994723395
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1994723394}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: a723f7fd716aac049aa24e9186f18685, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ scaleMode: 1
+ screenMatchMode: 0
+ designResolutionX: 1600
+ designResolutionY: 720
+ fallbackScreenDPI: 96
+ defaultSpriteDPI: 96
+ constantScaleFactor: 1
+ ignoreOrientation: 0
+--- !u!4 &1994723396
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1994723394}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI.meta b/JNFrame2/Assets/Plugins/FairyGUI.meta
new file mode 100644
index 00000000..dd4094a4
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 53bdd28b74e5cb144ac7165c06a5f286
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor.meta b/JNFrame2/Assets/Plugins/FairyGUI/Editor.meta
new file mode 100644
index 00000000..54b45634
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3fca1864980d947bfb1fd073c07362e7
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/DisplayObjectEditor.cs b/JNFrame2/Assets/Plugins/FairyGUI/Editor/DisplayObjectEditor.cs
new file mode 100644
index 00000000..a307e67d
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/DisplayObjectEditor.cs
@@ -0,0 +1,126 @@
+using UnityEngine;
+using UnityEditor;
+using FairyGUI;
+
+namespace FairyGUIEditor
+{
+ ///
+ ///
+ ///
+ [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;
+ }
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/DisplayObjectEditor.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Editor/DisplayObjectEditor.cs.meta
new file mode 100644
index 00000000..5ed8600d
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/DisplayObjectEditor.cs.meta
@@ -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:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/EditorToolSet.cs b/JNFrame2/Assets/Plugins/FairyGUI/Editor/EditorToolSet.cs
new file mode 100644
index 00000000..b736ef6e
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/EditorToolSet.cs
@@ -0,0 +1,135 @@
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEditor;
+using FairyGUI;
+
+namespace FairyGUIEditor
+{
+ ///
+ ///
+ ///
+ 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();
+ 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 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);
+ }
+ }
+
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/EditorToolSet.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Editor/EditorToolSet.cs.meta
new file mode 100644
index 00000000..65541278
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/EditorToolSet.cs.meta
@@ -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:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/FairyGUI.Editor.asmdef b/JNFrame2/Assets/Plugins/FairyGUI/Editor/FairyGUI.Editor.asmdef
new file mode 100644
index 00000000..51abd615
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/FairyGUI.Editor.asmdef
@@ -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
+}
\ No newline at end of file
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/FairyGUI.Editor.asmdef.meta b/JNFrame2/Assets/Plugins/FairyGUI/Editor/FairyGUI.Editor.asmdef.meta
new file mode 100644
index 00000000..0847954a
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/FairyGUI.Editor.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 19cba46ac204fdd48a96c9d9f1471d9c
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/PackagesWindow.cs b/JNFrame2/Assets/Plugins/FairyGUI/Editor/PackagesWindow.cs
new file mode 100644
index 00000000..0fb36663
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/PackagesWindow.cs
@@ -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
+{
+ ///
+ ///
+ ///
+ 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 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 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
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/PackagesWindow.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Editor/PackagesWindow.cs.meta
new file mode 100644
index 00000000..471d1b3d
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/PackagesWindow.cs.meta
@@ -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:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/StageCameraEditor.cs b/JNFrame2/Assets/Plugins/FairyGUI/Editor/StageCameraEditor.cs
new file mode 100644
index 00000000..0e7bba90
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/StageCameraEditor.cs
@@ -0,0 +1,29 @@
+using UnityEditor;
+using FairyGUI;
+
+namespace FairyGUIEditor
+{
+ ///
+ ///
+ ///
+ [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();
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/StageCameraEditor.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Editor/StageCameraEditor.cs.meta
new file mode 100644
index 00000000..517cdbaf
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/StageCameraEditor.cs.meta
@@ -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:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIConfigEditor.cs b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIConfigEditor.cs
new file mode 100644
index 00000000..dc6a828e
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIConfigEditor.cs
@@ -0,0 +1,226 @@
+using UnityEngine;
+using UnityEditor;
+using FairyGUI;
+
+namespace FairyGUIEditor
+{
+ ///
+ ///
+ ///
+ [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();
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIConfigEditor.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIConfigEditor.cs.meta
new file mode 100644
index 00000000..e40b052d
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIConfigEditor.cs.meta
@@ -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:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIContentScalerEditor.cs b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIContentScalerEditor.cs
new file mode 100644
index 00000000..f874c985
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIContentScalerEditor.cs
@@ -0,0 +1,64 @@
+using UnityEditor;
+using FairyGUI;
+
+namespace FairyGUIEditor
+{
+ ///
+ ///
+ ///
+ [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();
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIContentScalerEditor.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIContentScalerEditor.cs.meta
new file mode 100644
index 00000000..edefd7c3
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIContentScalerEditor.cs.meta
@@ -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:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPainterEditor.cs b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPainterEditor.cs
new file mode 100644
index 00000000..1f71214e
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPainterEditor.cs
@@ -0,0 +1,96 @@
+using UnityEngine;
+#if UNITY_5_3_OR_NEWER
+using UnityEditor.SceneManagement;
+#endif
+using UnityEditor;
+using FairyGUI;
+
+namespace FairyGUIEditor
+{
+ ///
+ ///
+ ///
+ [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(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(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);
+ }
+ }
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPainterEditor.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPainterEditor.cs.meta
new file mode 100644
index 00000000..01757308
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPainterEditor.cs.meta
@@ -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:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPanelEditor.cs b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPanelEditor.cs
new file mode 100644
index 00000000..b77eda99
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPanelEditor.cs
@@ -0,0 +1,163 @@
+using UnityEngine;
+#if UNITY_5_3_OR_NEWER
+using UnityEditor.SceneManagement;
+#endif
+using UnityEditor;
+
+namespace FairyGUIEditor
+{
+ ///
+ ///
+ ///
+ [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(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(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);
+ }
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPanelEditor.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPanelEditor.cs.meta
new file mode 100644
index 00000000..fdbfeaff
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Editor/UIPanelEditor.cs.meta
@@ -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:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/ReadMe - 4.3.0.txt b/JNFrame2/Assets/Plugins/FairyGUI/ReadMe - 4.3.0.txt
new file mode 100644
index 00000000..14655680
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/ReadMe - 4.3.0.txt
@@ -0,0 +1,150 @@
+--------------------
+ FairyGUI
+Copyright © 2014-2022 FairyGUI.com
+Version 4.3.0
+support@fairygui.com
+--------------------
+FairyGUI is a flexible UI framework for Unity, working with the professional FREE Game UI Editor: FairyGUI Editor.
+Download the editor from here: https://www.fairygui.com/
+
+--------------------
+Get Started
+--------------------
+Run demos in Assets/FairyGUI/Examples/Scenes.
+The UI project is in Examples-UIProject.zip, unzip it anywhere. Use FairyGUI Editor to open it.
+
+Using FairyGUI in Unity:
+* Place a UIPanel in scene by using editor menu GameObject/FairyGUI/UIPanel.
+* Or using UIPackage.CreateObject to create UI component dynamically, and then use GRoot.inst.AddChild to show it on screen.
+
+-----------------
+ Version History
+-----------------
+4.3.0
+1. Support truncating text with ellipsis.
+2. Add UIConfig.defaultScrollSnappingThreshold/defaultScrollPagingThreshold.
+3. Add support for changing skeleton animation in controller and transition.
+4. Increase compatibility of package path detection.
+5. Provide a better way for cloning spine materials.
+6. Ensure GList.defaultItem to be in normalized format for performance issue.
+7. Fixed a shape hit test bug.
+8. Fixed a scrolling bug if custom input is enabled.
+
+4.2.0
+1. Improve GoWrapper clipping.
+2. Fix a bitmap font bug.
+3. Add enter/exit sound for GComponent.
+4. Add click sound for GCombobox/GLabel/GProgressbar.
+5. Fix emoji align issue.
+6. Adapt to new TextMeshPro version.
+7. Fix a text shrinking behavior bug.
+
+4.1.0
+1. Add Stage.GetTouchTarget.
+2. Add CustomEase.
+3. Add Atlas reference manage mechanism.
+4. Fixed: the line settings of polygon is missing.
+5. Fixed: nested transitions may not be played.
+6. Fixed: wrong parameter for loading Spine/Dragonbones by bundle.
+7. Fixed: exceptions when a UIPanel in prefab is being destroyed in editor, since 2018.3.
+8. Upgrade example project to Unity 2018.
+
+4.0.1
+- FIXED: Selection bug in InputTextField.
+- FIXED: Wrong TextMeshPro text color in linear color space.
+- FIXED: Set initial color to white of GLoader3D.
+- FIXED: Recover text after cancelling typing effect.
+- FIXED: Invalid command key status in windows.
+
+4.0.0
+- New: New GLoader3D object for loading Spine and DragonBones.
+- New: Support TextMeshPro.
+- New: Mouse cursor manager.
+- New: Key navigation support.
+- New: Async loading mechanism of UIPackage (Convenient for Addressable).
+- IMPROVED: User's experience of mouse wheel.
+
+3.5.1
+- IMPROVED: Outline support for polygon shape.
+- FIXED: Branch mechanism not works for GComponent.
+- FIXED: Rotated sprite in atlas display incorrectly.
+
+3.5.0
+- NEW: Editor 5.0 functions.
+- FIXED: Nested stencil masks work incorrectly.
+- FIXED: TouchScreenKeyboard bug.
+- FIXED: Some issues in RTLSupport.
+
+3.4.1
+- FIXED: Text order issue in fairybatching.
+- FIXED: A virtual list bug.
+- FIXED: A bug in color control of circle shape.
+- FIXED: Fixed a bug in fill mesh.
+
+3.4.0
+- NEW: Add multi-display support.
+- NEW: Add API DynamicFont(name, font).
+- IMPROVED: Compatibility with 2018.3.
+- FIXED: Incorrect letter spacing on mobile platform.
+- FIXED: Same transition hook may be called twice.
+- FIXED: Exception raised when texture was disposed before object was disposed.
+
+3.3.0
+- NEW: Add textfield maxwidth feature.
+- NEW: Add API to query package dependencies.
+- IMPROVED: Graphics module refactor. Now it is more convenient to create various shapes(pie, lines, polygon etc) and do mesh deform. Memory usage on building mesh is also dropped. Also supports automatically setup uv for arbitrary quad to avoid seam between 2 triangles. All shaders are updated, don't forget to replace shaders in your project.
+- IMPROVED: Text-Brighter mechanism is removed, so FairyGUI-Text-Brighter.shader is removed.
+- IMPROVED: Add support for shrinking multi-line text.
+- IMPROVED: Improve Lua support.
+
+3.2.0
+- NEW: Add DisplayObjectInfo component. Define script symbol FAIRYGUI_TEST to enable it.
+- FIXED: A virtual list scrolling bug.
+- FIXED: A BlendMode bug.
+
+3.1.0
+- NEW: Draw extra 8 directions instead of 4 directions to archive text outline effect. Toggle option is UIConfig.enhancedTextOutlineEffect.
+- IMPROVED: Eexecution efficiency optimizations.
+- IMPROVED: GoWrapper now supports multiple materials.
+- FIXED: Correct cleanup action for RemovePackage.
+
+3.0.0
+From this version, we change package data format to binary. Editor version 3.9.0 with 'binary format' option checked in publish dialog is required to generating this kind of format. Old XML format is not supported anymore.
+
+- NEW: Add UIPackage.UnloadAssets and UIPackage.ReloadAssets to allow unload package resources without removing the package.
+- NEW: Add TransitionActionType.Text and TransitionActionType.Icon.
+
+2.4.0
+- NEW: GTween is introduced, DOTween is no longer used inside FairyGUI.
+- NEW: Transitions now support playing partially and pausing.
+- IMPROVED: Change the way of registering bitmap font.
+- FIXED: A GButton pivot issue.
+- FIXED: Correct text align behavior.
+
+2.3.0
+- NEW: Allow loader to load component.
+- NEW: Add text template feature.
+- FIXED: Exclude invisible object in FairyBatching.
+
+2.2.0
+- NEW: Modify shaders to fit linear color space.
+- IMPROVED: Improve relation system to handle conditions that anchor is set.
+- IMPROVED: Eliminate GC in transition.
+- FIXED: Fixed a bug of unloading bundle in UIPackage.
+- FIXED: Fixed issue that some blend mode(multiply, screen) works improperly.
+
+2.1.0
+- NEW: Add GGraph.DrawRoundRect.
+- NEW: Add FillType.ScaleNoBorder.
+- FIXED: Repair potential problems of virtual list.
+- FIXED: Fixed a bug in handling shared materials.
+
+2.0.0
+- NEW: RTL Text rendering support. Define scripting symbols RTL_TEXT_SUPPORT to enabled it.
+- NEW: Support for setting GObject.data in editor.
+- NEW: Support for setting selectedIcon of list item in editor.
+- IMPROVED: Add UIConfig.depthSupportForPaitingMode.
+- IMPROVED: Set sorting order of popup automatically.
+- FIXED: Fixed a text layout bug when line spacing is negative.
+- FIXED: Reset ScrollPane.draggingPane when an active scrollPane is being disposed.
+- FIXED: Fixed a bug of skew rendering.
\ No newline at end of file
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/ReadMe - 4.3.0.txt.meta b/JNFrame2/Assets/Plugins/FairyGUI/ReadMe - 4.3.0.txt.meta
new file mode 100644
index 00000000..1e5dce54
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/ReadMe - 4.3.0.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 2b25fe107b6204fd680450b22ba79672
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime.meta
new file mode 100644
index 00000000..b0a03d96
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 301fdc52d1f18da46a6b39888abab570
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions.meta
new file mode 100644
index 00000000..590cfebf
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ee08275ceb5764e62bce73db80126854
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/DragonBones.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/DragonBones.meta
new file mode 100644
index 00000000..1a5a8960
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/DragonBones.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 2d9a58836214e4e58b41c998e14a4239
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/DragonBones/DragonBonesLoader.cs b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/DragonBones/DragonBonesLoader.cs
new file mode 100644
index 00000000..1e9948ac
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/DragonBones/DragonBonesLoader.cs
@@ -0,0 +1,109 @@
+#if FAIRYGUI_DRAGONBONES
+
+using UnityEngine;
+using DragonBones;
+
+namespace FairyGUI
+{
+ ///
+ ///
+ ///
+ public partial class GLoader3D : GObject
+ {
+ UnityArmatureComponent _armatureComponent;
+
+ ///
+ ///
+ ///
+ ///
+ public UnityArmatureComponent armatureComponent
+ {
+ get { return _armatureComponent; }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetDragonBones(DragonBonesData asset, int width, int height, Vector2 anchor)
+ {
+ if (_armatureComponent != null)
+ FreeDragonBones();
+
+ _armatureComponent = UnityFactory.factory.BuildArmatureComponent(asset.armatureNames[0], asset.name, null, asset.name);
+ _armatureComponent.gameObject.transform.localScale = new Vector3(100, 100, 1);
+ _armatureComponent.gameObject.transform.localPosition = new Vector3(anchor.x, -anchor.y, 0);
+ SetWrapTarget(_armatureComponent.gameObject, true, width, height);
+
+ var ct = _armatureComponent.color;
+ ct.redMultiplier = _color.r;
+ ct.greenMultiplier = _color.g;
+ ct.blueMultiplier = _color.b;
+ _armatureComponent.color = ct;
+
+ OnChangeDragonBones(null);
+ }
+
+ protected void LoadDragonBones()
+ {
+ DragonBonesData asset = (DragonBonesData)_contentItem.skeletonAsset;
+ if (asset == null)
+ return;
+
+ SetDragonBones(asset, _contentItem.width, _contentItem.height, _contentItem.skeletonAnchor);
+ }
+
+ protected void OnChangeDragonBones(string propertyName)
+ {
+ if (_armatureComponent == null)
+ return;
+
+ if (propertyName == "color")
+ {
+ var ct = _armatureComponent.color;
+ ct.redMultiplier = _color.r;
+ ct.greenMultiplier = _color.g;
+ ct.blueMultiplier = _color.b;
+ _armatureComponent.color = ct;
+ return;
+ }
+
+ if (!string.IsNullOrEmpty(_animationName))
+ {
+ if (_playing)
+ _armatureComponent.animation.Play(_animationName, _loop ? 0 : 1);
+ else
+ _armatureComponent.animation.GotoAndStopByFrame(_animationName, (uint)_frame);
+ }
+ else
+ _armatureComponent.animation.Reset();
+ }
+
+ protected void FreeDragonBones()
+ {
+ if (_armatureComponent != null)
+ {
+ _armatureComponent.Dispose();
+ if (Application.isPlaying)
+ GameObject.Destroy(_armatureComponent.gameObject);
+ else
+ GameObject.DestroyImmediate(_armatureComponent.gameObject);
+ }
+ }
+
+ protected void OnUpdateDragonBones(UpdateContext context)
+ {
+ if (_armatureComponent != null)
+ {
+ var ct = _armatureComponent.color;
+ ct.alphaMultiplier = context.alpha * _content.alpha;
+ _armatureComponent.color = ct;
+ }
+ }
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/DragonBones/DragonBonesLoader.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/DragonBones/DragonBonesLoader.cs.meta
new file mode 100644
index 00000000..d3733a21
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/DragonBones/DragonBonesLoader.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9d48ba38d2e2e420085e6c98407dc1fb
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/Spine.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/Spine.meta
new file mode 100644
index 00000000..56dde9b5
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/Spine.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d55093b745d3d452699bdfe7bd8ac88e
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/Spine/SpineLoader.cs b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/Spine/SpineLoader.cs
new file mode 100644
index 00000000..d1d272a7
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/Spine/SpineLoader.cs
@@ -0,0 +1,160 @@
+#if FAIRYGUI_SPINE
+using System.Collections.Generic;
+using UnityEngine;
+using Spine.Unity;
+
+namespace FairyGUI
+{
+ ///
+ ///
+ ///
+ public partial class GLoader3D : GObject
+ {
+ SkeletonAnimation _spineAnimation;
+
+ ///
+ ///
+ ///
+ ///
+ public SkeletonAnimation spineAnimation
+ {
+ get { return _spineAnimation; }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetSpine(SkeletonDataAsset asset, int width, int height, Vector2 anchor)
+ {
+ SetSpine(asset, width, height, anchor, true);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetSpine(SkeletonDataAsset asset, int width, int height, Vector2 anchor, bool cloneMaterial)
+ {
+ if (_spineAnimation != null)
+ FreeSpine();
+
+ _content.customCloneMaterials = MaterialOverride;
+ _content.customRecoverMaterials = CleanMaterialOverride;
+
+ _spineAnimation = SkeletonRenderer.NewSpineGameObject(asset);
+ _spineAnimation.gameObject.name = asset.name;
+ Spine.SkeletonData dat = asset.GetSkeletonData(false);
+ _spineAnimation.gameObject.transform.localScale = new Vector3(1 / asset.scale, 1 / asset.scale, 1);
+ _spineAnimation.gameObject.transform.localPosition = new Vector3(anchor.x, -anchor.y, 0);
+ SetWrapTarget(_spineAnimation.gameObject, cloneMaterial, width, height);
+
+ _spineAnimation.skeleton.R = _color.r;
+ _spineAnimation.skeleton.G = _color.g;
+ _spineAnimation.skeleton.B = _color.b;
+
+ OnChangeSpine(null);
+ }
+
+ protected void LoadSpine()
+ {
+ SkeletonDataAsset asset = (SkeletonDataAsset)_contentItem.skeletonAsset;
+ if (asset == null)
+ return;
+
+ SetSpine(asset, _contentItem.width, _contentItem.height, _contentItem.skeletonAnchor);
+ }
+
+ protected void OnChangeSpine(string propertyName)
+ {
+ if (_spineAnimation == null)
+ return;
+
+ if (propertyName == "color")
+ {
+ _spineAnimation.skeleton.R = _color.r;
+ _spineAnimation.skeleton.G = _color.g;
+ _spineAnimation.skeleton.B = _color.b;
+ return;
+ }
+
+ var skeletonData = _spineAnimation.skeleton.Data;
+
+ var state = _spineAnimation.AnimationState;
+ Spine.Animation animationToUse = !string.IsNullOrEmpty(_animationName) ? skeletonData.FindAnimation(_animationName) : null;
+ if (animationToUse != null)
+ {
+ var trackEntry = state.GetCurrent(0);
+ if (trackEntry == null || trackEntry.Animation.Name != _animationName || trackEntry.IsComplete && !trackEntry.Loop)
+ trackEntry = state.SetAnimation(0, animationToUse, _loop);
+ else
+ trackEntry.Loop = _loop;
+
+ if (_playing)
+ trackEntry.TimeScale = 1;
+ else
+ {
+ trackEntry.TimeScale = 0;
+ trackEntry.TrackTime = Mathf.Lerp(0, trackEntry.AnimationEnd - trackEntry.AnimationStart, _frame / 100f);
+ }
+ }
+ else
+ state.ClearTrack(0);
+
+ var skin = !string.IsNullOrEmpty(skinName) ? skeletonData.FindSkin(skinName) : skeletonData.DefaultSkin;
+ if (skin == null && skeletonData.Skins.Count > 0)
+ skin = skeletonData.Skins.Items[0];
+ if (_spineAnimation.skeleton.Skin != skin)
+ {
+ _spineAnimation.skeleton.SetSkin(skin);
+ _spineAnimation.skeleton.SetSlotsToSetupPose();
+ }
+ }
+
+ protected void FreeSpine()
+ {
+ if (_spineAnimation != null)
+ {
+ if (Application.isPlaying)
+ GameObject.Destroy(_spineAnimation.gameObject);
+ else
+ GameObject.DestroyImmediate(_spineAnimation.gameObject);
+
+ _content.customCloneMaterials = null;
+ _content.customRecoverMaterials = null;
+ }
+ }
+
+ protected void OnUpdateSpine(UpdateContext context)
+ {
+ if (_spineAnimation != null)
+ _spineAnimation.skeleton.A = context.alpha * _content.alpha;
+ }
+
+ private void MaterialOverride(Dictionary materials)
+ {
+ if (_spineAnimation != null)
+ {
+ foreach (var kv in materials)
+ {
+ _spineAnimation.CustomMaterialOverride[kv.Key] = kv.Value;
+ }
+ }
+ }
+
+ private void CleanMaterialOverride()
+ {
+ if (_spineAnimation != null)
+ _spineAnimation.CustomMaterialOverride.Clear();
+ }
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/Spine/SpineLoader.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/Spine/SpineLoader.cs.meta
new file mode 100644
index 00000000..006fbf12
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/Spine/SpineLoader.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: e3757a6f06ad143439bb00cd7190c6d1
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro.meta
new file mode 100644
index 00000000..79426095
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 1de100836593c444995397fa368017d5
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/Shaders.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/Shaders.meta
new file mode 100644
index 00000000..bad37530
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/Shaders.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: e302db5f01fdb46b5b45f44c25164846
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/Shaders/FairyGUI-TMP.shader b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/Shaders/FairyGUI-TMP.shader
new file mode 100644
index 00000000..aa060b36
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/Shaders/FairyGUI-TMP.shader
@@ -0,0 +1,338 @@
+Shader "FairyGUI/TextMeshPro/Distance Field" {
+
+Properties {
+ _FaceTex ("Face Texture", 2D) = "white" {}
+ _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0
+ _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0
+ _FaceColor ("Face Color", Color) = (1,1,1,1)
+ _FaceDilate ("Face Dilate", Range(-1,1)) = 0
+
+ _OutlineColor ("Outline Color", Color) = (0,0,0,1)
+ _OutlineTex ("Outline Texture", 2D) = "white" {}
+ _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0
+ _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0
+ _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0
+ _OutlineSoftness ("Outline Softness", Range(0,1)) = 0
+
+ _Bevel ("Bevel", Range(0,1)) = 0.5
+ _BevelOffset ("Bevel Offset", Range(-0.5,0.5)) = 0
+ _BevelWidth ("Bevel Width", Range(-.5,0.5)) = 0
+ _BevelClamp ("Bevel Clamp", Range(0,1)) = 0
+ _BevelRoundness ("Bevel Roundness", Range(0,1)) = 0
+
+ _LightAngle ("Light Angle", Range(0.0, 6.2831853)) = 3.1416
+ _SpecularColor ("Specular", Color) = (1,1,1,1)
+ _SpecularPower ("Specular", Range(0,4)) = 2.0
+ _Reflectivity ("Reflectivity", Range(5.0,15.0)) = 10
+ _Diffuse ("Diffuse", Range(0,1)) = 0.5
+ _Ambient ("Ambient", Range(1,0)) = 0.5
+
+ _BumpMap ("Normal map", 2D) = "bump" {}
+ _BumpOutline ("Bump Outline", Range(0,1)) = 0
+ _BumpFace ("Bump Face", Range(0,1)) = 0
+
+ _ReflectFaceColor ("Reflection Color", Color) = (0,0,0,1)
+ _ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1)
+ _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ }
+ _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0)
+
+
+ _UnderlayColor ("Border Color", Color) = (0,0,0, 0.5)
+ _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0
+ _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0
+ _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0
+ _UnderlaySoftness ("Border Softness", Range(0,1)) = 0
+
+ _GlowColor ("Color", Color) = (0, 1, 0, 0.5)
+ _GlowOffset ("Offset", Range(-1,1)) = 0
+ _GlowInner ("Inner", Range(0,1)) = 0.05
+ _GlowOuter ("Outer", Range(0,1)) = 0.05
+ _GlowPower ("Falloff", Range(1, 0)) = 0.75
+
+ _WeightNormal ("Weight Normal", float) = 0
+ _WeightBold ("Weight Bold", float) = 0.5
+
+ _ShaderFlags ("Flags", float) = 0
+ _ScaleRatioA ("Scale RatioA", float) = 1
+ _ScaleRatioB ("Scale RatioB", float) = 1
+ _ScaleRatioC ("Scale RatioC", float) = 1
+
+ _MainTex ("Font Atlas", 2D) = "white" {}
+ _TextureWidth ("Texture Width", float) = 512
+ _TextureHeight ("Texture Height", float) = 512
+ _GradientScale ("Gradient Scale", float) = 5.0
+ _ScaleX ("Scale X", float) = 1.0
+ _ScaleY ("Scale Y", float) = 1.0
+ _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875
+ _Sharpness ("Sharpness", Range(-1,1)) = 0
+
+ _VertexOffsetX ("Vertex OffsetX", float) = 0
+ _VertexOffsetY ("Vertex OffsetY", float) = 0
+
+ _MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767)
+ _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
+ _MaskSoftnessX ("Mask SoftnessX", float) = 0
+ _MaskSoftnessY ("Mask SoftnessY", float) = 0
+
+ _StencilComp ("Stencil Comparison", Float) = 8
+ _Stencil ("Stencil ID", Float) = 0
+ _StencilOp ("Stencil Operation", Float) = 0
+ _StencilWriteMask ("Stencil Write Mask", Float) = 255
+ _StencilReadMask ("Stencil Read Mask", Float) = 255
+
+ _ColorMask ("Color Mask", Float) = 15
+}
+
+SubShader {
+
+ Tags
+ {
+ "Queue"="Transparent"
+ "IgnoreProjector"="True"
+ "RenderType"="Transparent"
+ }
+
+ Stencil
+ {
+ Ref [_Stencil]
+ Comp [_StencilComp]
+ Pass [_StencilOp]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ }
+
+ Cull [_CullMode]
+ ZWrite Off
+ Lighting Off
+ Fog { Mode Off }
+ ZTest [unity_GUIZTestMode]
+ Blend One OneMinusSrcAlpha
+ ColorMask [_ColorMask]
+
+ Pass {
+ CGPROGRAM
+ #pragma target 3.0
+ #pragma vertex VertShader
+ #pragma fragment PixShader
+ #pragma shader_feature __ BEVEL_ON
+ #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER
+ #pragma shader_feature __ GLOW_ON
+
+ //#pragma multi_compile __ UNITY_UI_CLIP_RECT
+ //#pragma multi_compile __ UNITY_UI_ALPHACLIP
+ #pragma multi_compile NOT_CLIPPED CLIPPED
+
+ #include "UnityCG.cginc"
+ #include "UnityUI.cginc"
+ //#include "Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc"
+ //#include "Assets/TextMesh Pro/Resources/Shaders/TMPro.cginc"
+ #include "Assets/TextMesh Pro/Shaders/TMPro_Properties.cginc"
+ #include "Assets/TextMesh Pro/Shaders/TMPro.cginc"
+
+ struct vertex_t {
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ float4 position : POSITION;
+ float3 normal : NORMAL;
+ fixed4 color : COLOR;
+ float2 texcoord0 : TEXCOORD0;
+ float2 texcoord1 : TEXCOORD1;
+ };
+
+
+ struct pixel_t {
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ float4 position : SV_POSITION;
+ fixed4 color : COLOR;
+ float2 atlas : TEXCOORD0; // Atlas
+ float4 param : TEXCOORD1; // alphaClip, scale, bias, weight
+ float2 mask : TEXCOORD2; // Position in object space(xy), pixel Size(zw)
+ float3 viewDir : TEXCOORD3;
+
+ #if (UNDERLAY_ON || UNDERLAY_INNER)
+ float4 texcoord2 : TEXCOORD4; // u,v, scale, bias
+ fixed4 underlayColor : COLOR1;
+ #endif
+ float4 textures : TEXCOORD5;
+ };
+
+ // Used by Unity internally to handle Texture Tiling and Offset.
+ float4 _FaceTex_ST;
+ float4 _OutlineTex_ST;
+
+ CBUFFER_START(UnityPerMaterial)
+ #ifdef CLIPPED
+ float4 _ClipBox = float4(-2, -2, 0, 0);
+ #endif
+ CBUFFER_END
+
+ pixel_t VertShader(vertex_t input)
+ {
+ pixel_t output;
+
+ UNITY_INITIALIZE_OUTPUT(pixel_t, output);
+ UNITY_SETUP_INSTANCE_ID(input);
+ UNITY_TRANSFER_INSTANCE_ID(input,output);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
+
+ float bold = step(input.texcoord1.y, 0);
+
+ float4 vert = input.position;
+ vert.x += _VertexOffsetX;
+ vert.y += _VertexOffsetY;
+
+ float4 vPosition = UnityObjectToClipPos(vert);
+
+ float2 pixelSize = vPosition.w;
+ pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
+ float scale = rsqrt(dot(pixelSize, pixelSize));
+ scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1);
+ if (UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert)))));
+
+ float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0;
+ weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5;
+
+ float bias =(.5 - weight) + (.5 / scale);
+
+ float alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _OutlineSoftness * _ScaleRatioA);
+
+ #if GLOW_ON
+ alphaClip = min(alphaClip, 1.0 - _GlowOffset * _ScaleRatioB - _GlowOuter * _ScaleRatioB);
+ #endif
+
+ alphaClip = alphaClip / 2.0 - ( .5 / scale) - weight;
+
+ #if (UNDERLAY_ON || UNDERLAY_INNER)
+ float4 underlayColor = _UnderlayColor;
+ underlayColor.rgb *= underlayColor.a;
+
+ float bScale = scale;
+ bScale /= 1 + ((_UnderlaySoftness*_ScaleRatioC) * bScale);
+ float bBias = (0.5 - weight) * bScale - 0.5 - ((_UnderlayDilate * _ScaleRatioC) * 0.5 * bScale);
+
+ float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth;
+ float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight;
+ float2 bOffset = float2(x, y);
+ #endif
+
+ // Generate UV for the Masking Texture
+ // float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
+ // float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy);
+
+ // Support for texture tiling and offset
+ float2 textureUV = UnpackUV(input.texcoord1.x);
+ float2 faceUV = TRANSFORM_TEX(textureUV, _FaceTex);
+ float2 outlineUV = TRANSFORM_TEX(textureUV, _OutlineTex);
+
+ output.position = vPosition;
+ #if !defined(UNITY_COLORSPACE_GAMMA) && (UNITY_VERSION >= 550)
+ output.color.rgb = GammaToLinearSpace(input.color.rgb);
+ output.color.a = input.color.a;
+ #else
+ output.color = input.color;
+ #endif
+ output.atlas = input.texcoord0;
+ output.param = float4(alphaClip, scale, bias, weight);
+ //output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy));
+ output.viewDir = mul((float3x3)_EnvMatrix, _WorldSpaceCameraPos.xyz - mul(unity_ObjectToWorld, vert).xyz);
+ #if (UNDERLAY_ON || UNDERLAY_INNER)
+ output.texcoord2 = float4(input.texcoord0 + bOffset, bScale, bBias);
+ output.underlayColor = underlayColor;
+ #endif
+ output.textures = float4(faceUV, outlineUV);
+
+ #ifdef CLIPPED
+ output.mask = mul(unity_ObjectToWorld, input.position).xy * _ClipBox.zw + _ClipBox.xy;
+ #endif
+
+ return output;
+ }
+
+
+ fixed4 PixShader(pixel_t input) : SV_Target
+ {
+ UNITY_SETUP_INSTANCE_ID(input);
+
+ float c = tex2D(_MainTex, input.atlas).a;
+
+ #ifndef UNDERLAY_ON
+ clip(c - input.param.x);
+ #endif
+
+ float scale = input.param.y;
+ float bias = input.param.z;
+ float weight = input.param.w;
+ float sd = (bias - c) * scale;
+
+ float outline = (_OutlineWidth * _ScaleRatioA) * scale;
+ float softness = (_OutlineSoftness * _ScaleRatioA) * scale;
+
+ half4 faceColor = _FaceColor;
+ half4 outlineColor = _OutlineColor;
+
+ faceColor.rgb *= input.color.rgb;
+
+ faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y);
+ outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y);
+
+ faceColor = GetColor(sd, faceColor, outlineColor, outline, softness);
+
+ #if BEVEL_ON
+ float3 dxy = float3(0.5 / _TextureWidth, 0.5 / _TextureHeight, 0);
+ float3 n = GetSurfaceNormal(input.atlas, weight, dxy);
+
+ float3 bump = UnpackNormal(tex2D(_BumpMap, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y)).xyz;
+ bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5));
+ n = normalize(n- bump);
+
+ float3 light = normalize(float3(sin(_LightAngle), cos(_LightAngle), -1.0));
+
+ float3 col = GetSpecular(n, light);
+ faceColor.rgb += col*faceColor.a;
+ faceColor.rgb *= 1-(dot(n, light)*_Diffuse);
+ faceColor.rgb *= lerp(_Ambient, 1, n.z*n.z);
+
+ fixed4 reflcol = texCUBE(_Cube, reflect(input.viewDir, -n));
+ faceColor.rgb += reflcol.rgb * lerp(_ReflectFaceColor.rgb, _ReflectOutlineColor.rgb, saturate(sd + outline * 0.5)) * faceColor.a;
+ #endif
+
+ #if UNDERLAY_ON
+ float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z;
+ faceColor += input.underlayColor * saturate(d - input.texcoord2.w) * (1 - faceColor.a);
+ #endif
+
+ #if UNDERLAY_INNER
+ float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z;
+ faceColor += input.underlayColor * (1 - saturate(d - input.texcoord2.w)) * saturate(1 - sd) * (1 - faceColor.a);
+ #endif
+
+ #if GLOW_ON
+ float4 glowColor = GetGlowColor(sd, scale);
+ faceColor.rgb += glowColor.rgb * glowColor.a;
+ #endif
+
+ // Alternative implementation to UnityGet2DClipping with support for softness.
+ // #if UNITY_UI_CLIP_RECT
+ // half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw);
+ // faceColor *= m.x * m.y;
+ // #endif
+
+ // #if UNITY_UI_ALPHACLIP
+ // clip(faceColor.a - 0.001);
+ // #endif
+
+ #ifdef CLIPPED
+ float2 factor = abs(input.mask);
+ clip(1-max(factor.x, factor.y));
+ #endif
+
+ return faceColor * input.color.a;
+ }
+
+ ENDCG
+ }
+}
+
+Fallback "TextMeshPro/Mobile/Distance Field"
+CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI"
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/Shaders/FairyGUI-TMP.shader.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/Shaders/FairyGUI-TMP.shader.meta
new file mode 100644
index 00000000..3eee1cd5
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/Shaders/FairyGUI-TMP.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: de10f84640569464799f0e0bfa1ab7b0
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/TMPFont.cs b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/TMPFont.cs
new file mode 100644
index 00000000..92fe3ca4
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/TMPFont.cs
@@ -0,0 +1,542 @@
+#if FAIRYGUI_TMPRO
+
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.TextCore;
+using TMPro;
+
+namespace FairyGUI
+{
+ ///
+ /// TextMeshPro text adapter for FairyGUI. Most of codes were taken from TextMeshPro!
+ /// Note that not all of TextMeshPro features are supported.
+ ///
+ public class TMPFont : BaseFont
+ {
+ protected TMP_FontAsset _fontAsset;
+
+ FontStyles _style;
+ float _scale;
+ float _padding;
+ float _stylePadding;
+ float _ascent;
+ float _lineHeight;
+ float _boldMultiplier;
+ FontWeight _defaultFontWeight;
+ FontWeight _fontWeight;
+ TextFormat _format;
+ TMP_Character _char;
+ TMP_Character _lineChar;
+ Material _material;
+ MaterialManager _manager;
+
+ public TMPFont()
+ {
+ this.canTint = true;
+ this.shader = "FairyGUI/TextMeshPro/Distance Field";
+ this.keepCrisp = true;
+
+ _defaultFontWeight = FontWeight.Medium;
+ }
+
+ override public void Dispose()
+ {
+ Release();
+ }
+
+ public TMP_FontAsset fontAsset
+ {
+ get { return _fontAsset; }
+ set
+ {
+ _fontAsset = value;
+ Init();
+ }
+ }
+
+ public FontWeight fontWeight
+ {
+ get { return _defaultFontWeight; }
+ set { _defaultFontWeight = value; }
+ }
+
+ void Release()
+ {
+ if (_manager != null)
+ {
+ _manager.onCreateNewMaterial -= OnCreateNewMaterial;
+ _manager = null;
+ }
+
+ if (mainTexture != null)
+ {
+ mainTexture.Dispose();
+ mainTexture = null;
+ }
+
+ if (_material != null)
+ {
+ Material.DestroyImmediate(_material);
+ _material = null;
+ }
+ }
+
+ void Init()
+ {
+ Release();
+
+ mainTexture = new NTexture(_fontAsset.atlasTexture);
+ mainTexture.destroyMethod = DestroyMethod.None;
+
+ _manager = mainTexture.GetMaterialManager(this.shader);
+ _manager.onCreateNewMaterial += OnCreateNewMaterial;
+
+ _material = new Material(_fontAsset.material); //copy
+ _material.SetFloat(ShaderUtilities.ID_TextureWidth, mainTexture.width);
+ _material.SetFloat(ShaderUtilities.ID_TextureHeight, mainTexture.height);
+ _material.SetFloat(ShaderUtilities.ID_GradientScale, fontAsset.atlasPadding + 1);
+ _material.SetFloat(ShaderUtilities.ID_WeightNormal, fontAsset.normalStyle);
+ _material.SetFloat(ShaderUtilities.ID_WeightBold, fontAsset.boldStyle);
+
+ // _ascent = _fontAsset.faceInfo.ascentLine;
+ // _lineHeight = _fontAsset.faceInfo.lineHeight;
+ _ascent = _fontAsset.faceInfo.pointSize;
+ _lineHeight = _fontAsset.faceInfo.pointSize * 1.25f;
+
+ _lineChar = GetCharacterFromFontAsset('_', FontStyles.Normal);
+ }
+
+ void OnCreateNewMaterial(Material mat)
+ {
+ mat.SetFloat(ShaderUtilities.ID_TextureWidth, mainTexture.width);
+ mat.SetFloat(ShaderUtilities.ID_TextureHeight, mainTexture.height);
+ mat.SetFloat(ShaderUtilities.ID_GradientScale, fontAsset.atlasPadding + 1);
+ mat.SetFloat(ShaderUtilities.ID_WeightNormal, fontAsset.normalStyle);
+ mat.SetFloat(ShaderUtilities.ID_WeightBold, fontAsset.boldStyle);
+ }
+
+ override public void UpdateGraphics(NGraphics graphics)
+ {
+ MaterialPropertyBlock block = graphics.materialPropertyBlock;
+ if (_format.outline > 0)
+ {
+ graphics.ToggleKeyword("OUTLINE_ON", true);
+
+ block.SetFloat(ShaderUtilities.ID_OutlineWidth, _format.outline);
+ block.SetColor(ShaderUtilities.ID_OutlineColor, _format.outlineColor);
+ }
+ else
+ {
+ graphics.ToggleKeyword("OUTLINE_ON", false);
+
+ block.SetFloat(ShaderUtilities.ID_OutlineWidth, 0);
+ }
+
+ if (_format.shadowOffset.x != 0 || _format.shadowOffset.y != 0)
+ {
+ graphics.ToggleKeyword("UNDERLAY_ON", true);
+
+ block.SetColor(ShaderUtilities.ID_UnderlayColor, _format.shadowColor);
+ block.SetFloat(ShaderUtilities.ID_UnderlayOffsetX, _format.shadowOffset.x);
+ block.SetFloat(ShaderUtilities.ID_UnderlayOffsetY, -_format.shadowOffset.y);
+ block.SetFloat(ShaderUtilities.ID_UnderlaySoftness, _format.underlaySoftness);
+ }
+ else
+ {
+ graphics.ToggleKeyword("UNDERLAY_ON", false);
+
+ block.SetFloat(ShaderUtilities.ID_UnderlayOffsetX, 0);
+ block.SetFloat(ShaderUtilities.ID_UnderlayOffsetY, 0);
+ block.SetFloat(ShaderUtilities.ID_UnderlaySoftness, 0);
+ }
+
+ block.SetFloat(ShaderUtilities.ID_FaceDilate, _format.faceDilate);
+ block.SetFloat(ShaderUtilities.ID_OutlineSoftness, _format.outlineSoftness);
+
+ if (_material.HasProperty(ShaderUtilities.ID_ScaleRatio_A))
+ {
+ //ShaderUtilities.GetPadding does not support handle materialproperyblock, we have to use a temp material
+ _material.SetFloat(ShaderUtilities.ID_OutlineWidth, block.GetFloat(ShaderUtilities.ID_OutlineWidth));
+ _material.SetFloat(ShaderUtilities.ID_UnderlayOffsetX, block.GetFloat(ShaderUtilities.ID_UnderlayOffsetX));
+ _material.SetFloat(ShaderUtilities.ID_UnderlayOffsetY, block.GetFloat(ShaderUtilities.ID_UnderlayOffsetY));
+ _material.SetFloat(ShaderUtilities.ID_UnderlaySoftness, block.GetFloat(ShaderUtilities.ID_UnderlaySoftness));
+ _material.SetFloat(ShaderUtilities.ID_FaceDilate, block.GetFloat(ShaderUtilities.ID_FaceDilate));
+ _material.SetFloat(ShaderUtilities.ID_OutlineSoftness, block.GetFloat(ShaderUtilities.ID_OutlineSoftness));
+
+ _padding = ShaderUtilities.GetPadding(_material, false, false);
+
+ //and then set back the properteis
+ block.SetFloat(ShaderUtilities.ID_ScaleRatio_A, _material.GetFloat(ShaderUtilities.ID_ScaleRatio_A));
+ block.SetFloat(ShaderUtilities.ID_ScaleRatio_B, _material.GetFloat(ShaderUtilities.ID_ScaleRatio_B));
+ block.SetFloat(ShaderUtilities.ID_ScaleRatio_C, _material.GetFloat(ShaderUtilities.ID_ScaleRatio_C));
+ }
+
+ // Set Padding based on selected font style
+ #region Handle Style Padding
+ if (((_style & FontStyles.Bold) == FontStyles.Bold)) // Checks for any combination of Bold Style.
+ {
+ if (_material.HasProperty(ShaderUtilities.ID_GradientScale))
+ {
+ float gradientScale = _material.GetFloat(ShaderUtilities.ID_GradientScale);
+ _stylePadding = _fontAsset.boldStyle / 4.0f * gradientScale * _material.GetFloat(ShaderUtilities.ID_ScaleRatio_A);
+
+ // Clamp overall padding to Gradient Scale size.
+ if (_stylePadding + _padding > gradientScale)
+ _padding = gradientScale - _stylePadding;
+ }
+ else
+ _stylePadding = 0;
+ }
+ else
+ {
+ if (_material.HasProperty(ShaderUtilities.ID_GradientScale))
+ {
+ float gradientScale = _material.GetFloat(ShaderUtilities.ID_GradientScale);
+ _stylePadding = _fontAsset.normalStyle / 4.0f * gradientScale * _material.GetFloat(ShaderUtilities.ID_ScaleRatio_A);
+
+ // Clamp overall padding to Gradient Scale size.
+ if (_stylePadding + _padding > gradientScale)
+ _padding = gradientScale - _stylePadding;
+ }
+ else
+ _stylePadding = 0;
+ }
+ #endregion Handle Style Padding
+ }
+
+ override public void SetFormat(TextFormat format, float fontSizeScale)
+ {
+ _format = format;
+
+ float size = format.size * fontSizeScale;
+ if (_format.specialStyle == TextFormat.SpecialStyle.Subscript || _format.specialStyle == TextFormat.SpecialStyle.Superscript)
+ size *= SupScale;
+
+ _scale = size / _fontAsset.faceInfo.pointSize * _fontAsset.faceInfo.scale;
+ _style = FontStyles.Normal;
+ if (format.bold)
+ {
+ _style |= FontStyles.Bold;
+ _fontWeight = FontWeight.Bold;
+ _boldMultiplier = 1 + _fontAsset.boldSpacing * 0.01f;
+ }
+ else
+ {
+ _fontWeight = _defaultFontWeight;
+ _boldMultiplier = 1.0f;
+ }
+ if (format.italic)
+ _style |= FontStyles.Italic;
+
+ format.FillVertexColors(vertexColors);
+ }
+
+ override public bool GetGlyph(char ch, out float width, out float height, out float baseline)
+ {
+ _char = GetCharacterFromFontAsset(ch, _style);
+ if (_char != null)
+ {
+ width = _char.glyph.metrics.horizontalAdvance * _boldMultiplier * _scale;
+ height = _lineHeight * _scale;
+ baseline = _ascent * _scale;
+
+ if (_format.specialStyle == TextFormat.SpecialStyle.Subscript)
+ {
+ height /= SupScale;
+ baseline /= SupScale;
+ }
+ else if (_format.specialStyle == TextFormat.SpecialStyle.Superscript)
+ {
+ height = height / SupScale + baseline * SupOffset;
+ baseline *= (SupOffset + 1 / SupScale);
+ }
+
+ height = Mathf.RoundToInt(height);
+ baseline = Mathf.RoundToInt(baseline);
+
+ return true;
+ }
+ else
+ {
+ width = 0;
+ height = 0;
+ baseline = 0;
+ return false;
+ }
+ }
+
+ TMP_Character GetCharacterFromFontAsset(uint unicode, FontStyles fontStyle)
+ {
+ bool isAlternativeTypeface;
+#pragma warning disable
+ TMP_FontAsset actualAsset;
+#pragma warning restore
+ return TMP_FontAssetUtilities.GetCharacterFromFontAsset(unicode, _fontAsset, true, fontStyle, _fontWeight,
+ out isAlternativeTypeface
+ //,out actualAsset //old TMP version need this line
+ );
+ }
+
+ static Vector3 bottomLeft;
+ static Vector3 topLeft;
+ static Vector3 topRight;
+ static Vector3 bottomRight;
+
+ static Vector4 uvBottomLeft;
+ static Vector4 uvTopLeft;
+ static Vector4 uvTopRight;
+ static Vector4 uvBottomRight;
+
+ static Vector4 uv2BottomLeft;
+ static Vector4 uv2TopLeft;
+ static Vector4 uv2TopRight;
+ static Vector4 uv2BottomRight;
+
+ static Color32[] vertexColors = new Color32[4];
+
+ override public int DrawGlyph(float x, float y,
+ List vertList, List uvList, List uv2List, List colList)
+ {
+ GlyphMetrics metrics = _char.glyph.metrics;
+ GlyphRect rect = _char.glyph.glyphRect;
+
+ if (_format.specialStyle == TextFormat.SpecialStyle.Subscript)
+ y = y - Mathf.RoundToInt(_ascent * _scale * SupOffset);
+ else if (_format.specialStyle == TextFormat.SpecialStyle.Superscript)
+ y = y + Mathf.RoundToInt(_ascent * _scale * (1 / SupScale - 1 + SupOffset));
+
+ topLeft.x = x + (metrics.horizontalBearingX - _padding - _stylePadding) * _scale;
+ topLeft.y = y + (metrics.horizontalBearingY + _padding) * _scale;
+ bottomRight.x = topLeft.x + (metrics.width + _padding * 2 + _stylePadding * 2) * _scale;
+ bottomRight.y = topLeft.y - (metrics.height + _padding * 2) * _scale;
+
+ topRight.x = bottomRight.x;
+ topRight.y = topLeft.y;
+ bottomLeft.x = topLeft.x;
+ bottomLeft.y = bottomRight.y;
+
+ #region Handle Italic & Shearing
+ if (((_style & FontStyles.Italic) == FontStyles.Italic))
+ {
+ // Shift Top vertices forward by half (Shear Value * height of character) and Bottom vertices back by same amount.
+ float shear_value = _fontAsset.italicStyle * 0.01f;
+ Vector3 topShear = new Vector3(shear_value * ((metrics.horizontalBearingY + _padding + _stylePadding) * _scale), 0, 0);
+ Vector3 bottomShear = new Vector3(shear_value * (((metrics.horizontalBearingY - metrics.height - _padding - _stylePadding)) * _scale), 0, 0);
+
+ topLeft += topShear;
+ bottomLeft += bottomShear;
+ topRight += topShear;
+ bottomRight += bottomShear;
+ }
+ #endregion Handle Italics & Shearing
+
+ vertList.Add(bottomLeft);
+ vertList.Add(topLeft);
+ vertList.Add(topRight);
+ vertList.Add(bottomRight);
+
+ float u = (rect.x - _padding - _stylePadding) / _fontAsset.atlasWidth;
+ float v = (rect.y - _padding - _stylePadding) / _fontAsset.atlasHeight;
+ float uw = (rect.width + _padding * 2 + _stylePadding * 2) / _fontAsset.atlasWidth;
+ float vw = (rect.height + _padding * 2 + _stylePadding * 2) / _fontAsset.atlasHeight;
+
+ uvBottomLeft = new Vector2(u, v);
+ uvTopLeft = new Vector2(u, v + vw);
+ uvTopRight = new Vector2(u + uw, v + vw);
+ uvBottomRight = new Vector2(u + uw, v);
+
+ float xScale = _scale * 0.01f;
+ if (_format.bold)
+ xScale *= -1;
+ uv2BottomLeft = new Vector2(0, xScale);
+ uv2TopLeft = new Vector2(511, xScale);
+ uv2TopRight = new Vector2(2093567, xScale);
+ uv2BottomRight = new Vector2(2093056, xScale);
+
+ uvList.Add(uvBottomLeft);
+ uvList.Add(uvTopLeft);
+ uvList.Add(uvTopRight);
+ uvList.Add(uvBottomRight);
+
+ uv2List.Add(uv2BottomLeft);
+ uv2List.Add(uv2TopLeft);
+ uv2List.Add(uv2TopRight);
+ uv2List.Add(uv2BottomRight);
+
+ colList.Add(vertexColors[0]);
+ colList.Add(vertexColors[1]);
+ colList.Add(vertexColors[2]);
+ colList.Add(vertexColors[3]);
+
+ return 4;
+ }
+
+ override public int DrawLine(float x, float y, float width, int fontSize, int type,
+ List vertList, List uvList, List uv2List, List colList)
+ {
+ if (_lineChar == null)
+ return 0;
+
+ float thickness;
+ float offset;
+
+ if (type == 0)
+ {
+ thickness = _fontAsset.faceInfo.underlineThickness;
+ offset = _fontAsset.faceInfo.underlineOffset;
+ }
+ else
+ {
+ thickness = _fontAsset.faceInfo.strikethroughThickness;
+ offset = _fontAsset.faceInfo.strikethroughOffset;
+ }
+
+ float scale = (float)fontSize / _fontAsset.faceInfo.pointSize * _fontAsset.faceInfo.scale;
+ float segmentWidth = _lineChar.glyph.metrics.width / 2 * scale;
+ if (width < _lineChar.glyph.metrics.width * scale)
+ segmentWidth = width / 2f;
+
+ // UNDERLINE VERTICES FOR (3) LINE SEGMENTS
+ #region UNDERLINE VERTICES
+
+ thickness = thickness * scale;
+ if (thickness < 1)
+ thickness = 1;
+ offset = Mathf.RoundToInt(offset * scale);
+
+ // Front Part of the Underline
+ y += offset;
+ topLeft.x = x;
+ topLeft.y = y + _padding * scale;
+ bottomRight.x = x + segmentWidth;
+ bottomRight.y = y - thickness - _padding * scale;
+
+ topRight.x = bottomRight.x;
+ topRight.y = topLeft.y;
+ bottomLeft.x = topLeft.x;
+ bottomLeft.y = bottomRight.y;
+
+ vertList.Add(bottomLeft);
+ vertList.Add(topLeft);
+ vertList.Add(topRight);
+ vertList.Add(bottomRight);
+
+ // Middle Part of the Underline
+ topLeft = topRight;
+ bottomLeft = bottomRight;
+
+ topRight.x = x + width - segmentWidth;
+ bottomRight.x = topRight.x;
+
+ vertList.Add(bottomLeft);
+ vertList.Add(topLeft);
+ vertList.Add(topRight);
+ vertList.Add(bottomRight);
+
+ // End Part of the Underline
+ topLeft = topRight;
+ bottomLeft = bottomRight;
+
+ topRight.x = x + width;
+ bottomRight.x = topRight.x;
+
+ vertList.Add(bottomLeft);
+ vertList.Add(topLeft);
+ vertList.Add(topRight);
+ vertList.Add(bottomRight);
+
+ #endregion
+
+ // UNDERLINE UV0
+ #region HANDLE UV0
+
+ // Calculate UV required to setup the 3 Quads for the Underline.
+ Vector2 uv0 = new Vector2((_lineChar.glyph.glyphRect.x - _padding) / _fontAsset.atlasWidth, (_lineChar.glyph.glyphRect.y - _padding) / _fontAsset.atlasHeight); // bottom left
+ Vector2 uv1 = new Vector2(uv0.x, (_lineChar.glyph.glyphRect.y + _lineChar.glyph.glyphRect.height + _padding) / _fontAsset.atlasHeight); // top left
+ Vector2 uv2 = new Vector2((_lineChar.glyph.glyphRect.x - _padding + (float)_lineChar.glyph.glyphRect.width / 2) / _fontAsset.atlasWidth, uv1.y); // Mid Top Left
+ Vector2 uv3 = new Vector2(uv2.x, uv0.y); // Mid Bottom Left
+ Vector2 uv4 = new Vector2((_lineChar.glyph.glyphRect.x + _padding + (float)_lineChar.glyph.glyphRect.width / 2) / _fontAsset.atlasWidth, uv1.y); // Mid Top Right
+ Vector2 uv5 = new Vector2(uv4.x, uv0.y); // Mid Bottom right
+ Vector2 uv6 = new Vector2((_lineChar.glyph.glyphRect.x + _padding + _lineChar.glyph.glyphRect.width) / _fontAsset.atlasWidth, uv1.y); // End Part - Bottom Right
+ Vector2 uv7 = new Vector2(uv6.x, uv0.y); // End Part - Top Right
+
+ uvList.Add(uv0);
+ uvList.Add(uv1);
+ uvList.Add(uv2);
+ uvList.Add(uv3);
+
+ // Middle Part of the Underline
+ uvList.Add(new Vector2(uv2.x - uv2.x * 0.001f, uv0.y));
+ uvList.Add(new Vector2(uv2.x - uv2.x * 0.001f, uv1.y));
+ uvList.Add(new Vector2(uv2.x + uv2.x * 0.001f, uv1.y));
+ uvList.Add(new Vector2(uv2.x + uv2.x * 0.001f, uv0.y));
+
+ // Right Part of the Underline
+
+ uvList.Add(uv5);
+ uvList.Add(uv4);
+ uvList.Add(uv6);
+ uvList.Add(uv7);
+
+ #endregion
+
+ // UNDERLINE UV2
+ #region HANDLE UV2 - SDF SCALE
+ // UV1 contains Face / Border UV layout.
+ float segUv1 = segmentWidth / width;
+ float segUv2 = 1 - segUv1;
+
+ //Calculate the xScale or how much the UV's are getting stretched on the X axis for the middle section of the underline.
+ float xScale = scale * 0.01f;
+
+ uv2List.Add(PackUV(0, 0, xScale));
+ uv2List.Add(PackUV(0, 1, xScale));
+ uv2List.Add(PackUV(segUv1, 1, xScale));
+ uv2List.Add(PackUV(segUv1, 0, xScale));
+
+ uv2List.Add(PackUV(segUv1, 0, xScale));
+ uv2List.Add(PackUV(segUv1, 1, xScale));
+ uv2List.Add(PackUV(segUv2, 1, xScale));
+ uv2List.Add(PackUV(segUv2, 0, xScale));
+
+ uv2List.Add(PackUV(segUv2, 0, xScale));
+ uv2List.Add(PackUV(segUv2, 1, xScale));
+ uv2List.Add(PackUV(1, 1, xScale));
+ uv2List.Add(PackUV(1, 0, xScale));
+
+ #endregion
+
+ // UNDERLINE VERTEX COLORS
+ #region
+ // Alpha is the lower of the vertex color or tag color alpha used.
+
+ for (int i = 0; i < 12; i++)
+ colList.Add(vertexColors[0]);
+
+ #endregion
+
+ return 12;
+ }
+
+ Vector2 PackUV(float x, float y, float xScale)
+ {
+ double x0 = (int)(x * 511);
+ double y0 = (int)(y * 511);
+
+ return new Vector2((float)((x0 * 4096) + y0), xScale);
+ }
+
+ override public bool HasCharacter(char ch)
+ {
+ return _fontAsset.HasCharacter(ch);
+ }
+
+ override public int GetLineHeight(int size)
+ {
+ return Mathf.RoundToInt(_lineHeight * ((float)size / _fontAsset.faceInfo.pointSize * _fontAsset.faceInfo.scale));
+ }
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/TMPFont.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/TMPFont.cs.meta
new file mode 100644
index 00000000..f8164579
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/TMPFont.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d7b7ade279883464288671135d22476f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/TMPTextFormat.cs b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/TMPTextFormat.cs
new file mode 100644
index 00000000..89758dc0
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/TMPTextFormat.cs
@@ -0,0 +1,16 @@
+#if FAIRYGUI_TMPRO
+
+namespace FairyGUI
+{
+ ///
+ ///
+ ///
+ public partial class TextFormat
+ {
+ public float faceDilate;
+ public float outlineSoftness;
+ public float underlaySoftness;
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/TMPTextFormat.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/TMPTextFormat.cs.meta
new file mode 100644
index 00000000..5a9b3780
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Extensions/TextMeshPro/TMPTextFormat.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 6dd33b417fbb245f887d32166c8acc1d
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/FairyGUI.Runtime.asmdef b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/FairyGUI.Runtime.asmdef
new file mode 100644
index 00000000..05ffb2f8
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/FairyGUI.Runtime.asmdef
@@ -0,0 +1,14 @@
+{
+ "name": "FairyGUI.Runtime",
+ "rootNamespace": "",
+ "references": [],
+ "includePlatforms": [],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false,
+ "overrideReferences": false,
+ "precompiledReferences": [],
+ "autoReferenced": true,
+ "defineConstraints": [],
+ "versionDefines": [],
+ "noEngineReferences": false
+}
\ No newline at end of file
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/FairyGUI.Runtime.asmdef.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/FairyGUI.Runtime.asmdef.meta
new file mode 100644
index 00000000..a81992d3
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/FairyGUI.Runtime.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: f4270d81837019d47b93f11421168dae
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources.meta
new file mode 100644
index 00000000..ee4194fd
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: fd78597466f9944429e3daf64a4e2063
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders.meta
new file mode 100644
index 00000000..6c41660c
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: cc39210f7f4d03f4aa637689b9d90d75
+folderAsset: yes
+timeCreated: 1446459912
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/AddOn.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/AddOn.meta
new file mode 100644
index 00000000..dddf6b3c
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/AddOn.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b5137d7a41873f9499f95f860a6cef17
+folderAsset: yes
+timeCreated: 1465913233
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/AddOn/FairyGUI-BlurFilter.shader b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/AddOn/FairyGUI-BlurFilter.shader
new file mode 100644
index 00000000..06a45a0b
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/AddOn/FairyGUI-BlurFilter.shader
@@ -0,0 +1,58 @@
+// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
+
+Shader "FairyGUI/BlurFilter" {
+ Properties {
+ _MainTex ("Base (RGB)", 2D) = "white" {}
+}
+
+SubShader {
+ Pass {
+ ZTest Always
+ ZWrite Off
+
+ CGPROGRAM
+ #pragma vertex vert
+ #pragma fragment frag
+
+ #include "UnityCG.cginc"
+
+ struct appdata_t {
+ float4 vertex : POSITION;
+ float2 texcoord : TEXCOORD0;
+ };
+
+ struct v2f {
+ float4 vertex : SV_POSITION;
+ half2 texcoord : TEXCOORD0;
+ half2 taps[4] : TEXCOORD1;
+ };
+
+ sampler2D _MainTex;
+ half4 _MainTex_TexelSize;
+ half4 _BlurOffsets;
+
+ v2f vert (appdata_t v)
+ {
+ v2f o;
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.texcoord = v.texcoord - _BlurOffsets.xy * _MainTex_TexelSize.xy;
+ o.taps[0] = o.texcoord + _MainTex_TexelSize * _BlurOffsets.xy;
+ o.taps[1] = o.texcoord - _MainTex_TexelSize * _BlurOffsets.xy;
+ o.taps[2] = o.texcoord + _MainTex_TexelSize * _BlurOffsets.xy * half2(1,-1);
+ o.taps[3] = o.texcoord - _MainTex_TexelSize * _BlurOffsets.xy * half2(1,-1);
+ return o;
+ }
+
+ fixed4 frag (v2f i) : SV_Target
+ {
+ half4 color = tex2D(_MainTex, i.taps[0]);
+ color += tex2D(_MainTex, i.taps[1]);
+ color += tex2D(_MainTex, i.taps[2]);
+ color += tex2D(_MainTex, i.taps[3]);
+ return color * 0.25;
+ }
+ ENDCG
+ }
+}
+Fallback off
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/AddOn/FairyGUI-BlurFilter.shader.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/AddOn/FairyGUI-BlurFilter.shader.meta
new file mode 100644
index 00000000..81312dc5
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/AddOn/FairyGUI-BlurFilter.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f83d3bb1d90aaf54d8aed0783317662f
+timeCreated: 1465913243
+licenseType: Pro
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-BMFont.shader b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-BMFont.shader
new file mode 100644
index 00000000..1c77d8f3
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-BMFont.shader
@@ -0,0 +1,154 @@
+// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
+// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
+
+Shader "FairyGUI/BMFont"
+{
+ Properties
+ {
+ _MainTex ("Base (RGB), Alpha (A)", 2D) = "black" {}
+
+ _StencilComp ("Stencil Comparison", Float) = 8
+ _Stencil ("Stencil ID", Float) = 0
+ _StencilOp ("Stencil Operation", Float) = 0
+ _StencilWriteMask ("Stencil Write Mask", Float) = 255
+ _StencilReadMask ("Stencil Read Mask", Float) = 255
+
+ _ColorMask ("Color Mask", Float) = 15
+
+ _BlendSrcFactor ("Blend SrcFactor", Float) = 5
+ _BlendDstFactor ("Blend DstFactor", Float) = 10
+ }
+
+ SubShader
+ {
+ LOD 100
+
+ Tags
+ {
+ "Queue" = "Transparent"
+ "IgnoreProjector" = "True"
+ "RenderType" = "Transparent"
+ }
+
+ Stencil
+ {
+ Ref [_Stencil]
+ Comp [_StencilComp]
+ Pass [_StencilOp]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ }
+
+ Cull Off
+ Lighting Off
+ ZWrite Off
+ Fog { Mode Off }
+ Blend [_BlendSrcFactor] [_BlendDstFactor]
+ ColorMask [_ColorMask]
+
+ Pass
+ {
+ CGPROGRAM
+ #pragma multi_compile NOT_GRAYED GRAYED
+ #pragma multi_compile NOT_CLIPPED CLIPPED SOFT_CLIPPED
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma exclude_renderers d3d9 opengl flash
+
+ #include "UnityCG.cginc"
+
+ struct appdata_t
+ {
+ float4 vertex : POSITION;
+ fixed4 color : COLOR;
+ float4 texcoord : TEXCOORD0;
+ };
+
+ struct v2f
+ {
+ float4 vertex : SV_POSITION;
+ fixed4 color : COLOR;
+ float4 texcoord : TEXCOORD0;
+
+ #ifdef CLIPPED
+ float2 clipPos : TEXCOORD1;
+ #endif
+
+ #ifdef SOFT_CLIPPED
+ float2 clipPos : TEXCOORD1;
+ #endif
+ };
+
+ sampler2D _MainTex;
+
+ CBUFFER_START(UnityPerMaterial)
+ #ifdef CLIPPED
+ float4 _ClipBox = float4(-2, -2, 0, 0);
+ #endif
+
+ #ifdef SOFT_CLIPPED
+ float4 _ClipBox = float4(-2, -2, 0, 0);
+ float4 _ClipSoftness = float4(0, 0, 0, 0);
+ #endif
+ CBUFFER_END
+
+ v2f vert (appdata_t v)
+ {
+ v2f o;
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.texcoord = v.texcoord;
+ #if !defined(UNITY_COLORSPACE_GAMMA) && (UNITY_VERSION >= 550)
+ o.color.rgb = GammaToLinearSpace(v.color.rgb);
+ o.color.a = v.color.a;
+ #else
+ o.color = v.color;
+ #endif
+
+ #ifdef CLIPPED
+ o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
+ #endif
+
+ #ifdef SOFT_CLIPPED
+ o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
+ #endif
+
+ return o;
+ }
+
+ fixed4 frag (v2f i) : SV_Target
+ {
+ fixed4 col = i.color;
+ fixed4 tcol = tex2D(_MainTex, i.texcoord);
+ col.a *= tcol[i.texcoord.z];//z stores channel
+
+ #ifdef GRAYED
+ fixed grey = dot(col.rgb, fixed3(0.299, 0.587, 0.114));
+ col.rgb = fixed3(grey, grey, grey);
+ #endif
+
+ #ifdef SOFT_CLIPPED
+ float2 factor = float2(0,0);
+ if(i.clipPos.x<0)
+ factor.x = (1.0-abs(i.clipPos.x)) * _ClipSoftness.x;
+ else
+ factor.x = (1.0-i.clipPos.x) * _ClipSoftness.z;
+ if(i.clipPos.y<0)
+ factor.y = (1.0-abs(i.clipPos.y)) * _ClipSoftness.w;
+ else
+ factor.y = (1.0-i.clipPos.y) * _ClipSoftness.y;
+ col.a *= clamp(min(factor.x, factor.y), 0.0, 1.0);
+ #endif
+
+ #ifdef CLIPPED
+ float2 factor = abs(i.clipPos);
+ col.a *= step(max(factor.x, factor.y), 1);
+ #endif
+
+ return col;
+ }
+ ENDCG
+ }
+ }
+
+ Fallback "FairyGUI/Text"
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-BMFont.shader.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-BMFont.shader.meta
new file mode 100644
index 00000000..70394890
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-BMFont.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: cd79153f88fa7334ea6c5564c053bdca
+timeCreated: 1459224288
+licenseType: Pro
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-Image.shader b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-Image.shader
new file mode 100644
index 00000000..666cad36
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-Image.shader
@@ -0,0 +1,182 @@
+// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
+// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
+
+Shader "FairyGUI/Image"
+{
+ Properties
+ {
+ _MainTex ("Base (RGB), Alpha (A)", 2D) = "black" {}
+
+ _StencilComp ("Stencil Comparison", Float) = 8
+ _Stencil ("Stencil ID", Float) = 0
+ _StencilOp ("Stencil Operation", Float) = 0
+ _StencilWriteMask ("Stencil Write Mask", Float) = 255
+ _StencilReadMask ("Stencil Read Mask", Float) = 255
+
+ _ColorMask ("Color Mask", Float) = 15
+
+ _BlendSrcFactor ("Blend SrcFactor", Float) = 5
+ _BlendDstFactor ("Blend DstFactor", Float) = 10
+ }
+
+ SubShader
+ {
+ LOD 100
+
+ Tags
+ {
+ "Queue" = "Transparent"
+ "IgnoreProjector" = "True"
+ "RenderType" = "Transparent"
+ }
+
+ Stencil
+ {
+ Ref [_Stencil]
+ Comp [_StencilComp]
+ Pass [_StencilOp]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ }
+
+ Cull Off
+ Lighting Off
+ ZWrite Off
+ Fog { Mode Off }
+ Blend [_BlendSrcFactor] [_BlendDstFactor], One One
+ ColorMask [_ColorMask]
+
+ Pass
+ {
+ CGPROGRAM
+ #pragma multi_compile NOT_COMBINED COMBINED
+ #pragma multi_compile NOT_GRAYED GRAYED COLOR_FILTER
+ #pragma multi_compile NOT_CLIPPED CLIPPED SOFT_CLIPPED ALPHA_MASK
+ #pragma vertex vert
+ #pragma fragment frag
+
+ #include "UnityCG.cginc"
+
+ struct appdata_t
+ {
+ float4 vertex : POSITION;
+ fixed4 color : COLOR;
+ float4 texcoord : TEXCOORD0;
+ };
+
+ struct v2f
+ {
+ float4 vertex : SV_POSITION;
+ fixed4 color : COLOR;
+ float4 texcoord : TEXCOORD0;
+
+ #ifdef CLIPPED
+ float2 clipPos : TEXCOORD1;
+ #endif
+
+ #ifdef SOFT_CLIPPED
+ float2 clipPos : TEXCOORD1;
+ #endif
+ };
+
+ sampler2D _MainTex;
+
+ #ifdef COMBINED
+ sampler2D _AlphaTex;
+ #endif
+
+ CBUFFER_START(UnityPerMaterial)
+ #ifdef CLIPPED
+ float4 _ClipBox = float4(-2, -2, 0, 0);
+ #endif
+
+ #ifdef SOFT_CLIPPED
+ float4 _ClipBox = float4(-2, -2, 0, 0);
+ float4 _ClipSoftness = float4(0, 0, 0, 0);
+ #endif
+ CBUFFER_END
+
+ #ifdef COLOR_FILTER
+ float4x4 _ColorMatrix;
+ float4 _ColorOffset;
+ float _ColorOption = 0;
+ #endif
+
+ v2f vert (appdata_t v)
+ {
+ v2f o;
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.texcoord = v.texcoord;
+ #if !defined(UNITY_COLORSPACE_GAMMA) && (UNITY_VERSION >= 550)
+ o.color.rgb = GammaToLinearSpace(v.color.rgb);
+ o.color.a = v.color.a;
+ #else
+ o.color = v.color;
+ #endif
+
+ #ifdef CLIPPED
+ o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
+ #endif
+
+ #ifdef SOFT_CLIPPED
+ o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
+ #endif
+
+ return o;
+ }
+
+ fixed4 frag (v2f i) : SV_Target
+ {
+ fixed4 col = tex2D(_MainTex, i.texcoord.xy / i.texcoord.w) * i.color;
+
+ #ifdef COMBINED
+ col.a *= tex2D(_AlphaTex, i.texcoord.xy / i.texcoord.w).g;
+ #endif
+
+ #ifdef GRAYED
+ fixed grey = dot(col.rgb, fixed3(0.299, 0.587, 0.114));
+ col.rgb = fixed3(grey, grey, grey);
+ #endif
+
+ #ifdef SOFT_CLIPPED
+ float2 factor = float2(0,0);
+ if(i.clipPos.x<0)
+ factor.x = (1.0-abs(i.clipPos.x)) * _ClipSoftness.x;
+ else
+ factor.x = (1.0-i.clipPos.x) * _ClipSoftness.z;
+ if(i.clipPos.y<0)
+ factor.y = (1.0-abs(i.clipPos.y)) * _ClipSoftness.w;
+ else
+ factor.y = (1.0-i.clipPos.y) * _ClipSoftness.y;
+ col.a *= clamp(min(factor.x, factor.y), 0.0, 1.0);
+ #endif
+
+ #ifdef CLIPPED
+ float2 factor = abs(i.clipPos);
+ col.a *= step(max(factor.x, factor.y), 1);
+ #endif
+
+ #ifdef COLOR_FILTER
+ if (_ColorOption == 0)
+ {
+ fixed4 col2 = col;
+ col2.r = dot(col, _ColorMatrix[0]) + _ColorOffset.x;
+ col2.g = dot(col, _ColorMatrix[1]) + _ColorOffset.y;
+ col2.b = dot(col, _ColorMatrix[2]) + _ColorOffset.z;
+ col2.a = dot(col, _ColorMatrix[3]) + _ColorOffset.w;
+ col = col2;
+ }
+ else //premultiply alpha
+ col.rgb *= col.a;
+ #endif
+
+ #ifdef ALPHA_MASK
+ clip(col.a - 0.001);
+ #endif
+
+ return col;
+ }
+ ENDCG
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-Image.shader.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-Image.shader.meta
new file mode 100644
index 00000000..36cfc082
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-Image.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 263c97191482b3649ac7bf0810cc4f77
+timeCreated: 1459224288
+licenseType: Pro
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-Text.shader b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-Text.shader
new file mode 100644
index 00000000..00899999
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-Text.shader
@@ -0,0 +1,150 @@
+// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
+// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
+
+Shader "FairyGUI/Text"
+{
+ Properties
+ {
+ _MainTex ("Alpha (A)", 2D) = "white" {}
+
+ _StencilComp ("Stencil Comparison", Float) = 8
+ _Stencil ("Stencil ID", Float) = 0
+ _StencilOp ("Stencil Operation", Float) = 0
+ _StencilWriteMask ("Stencil Write Mask", Float) = 255
+ _StencilReadMask ("Stencil Read Mask", Float) = 255
+
+ _ColorMask ("Color Mask", Float) = 15
+
+ _BlendSrcFactor ("Blend SrcFactor", Float) = 5
+ _BlendDstFactor ("Blend DstFactor", Float) = 10
+ }
+
+ SubShader
+ {
+ LOD 100
+
+ Tags
+ {
+ "Queue" = "Transparent"
+ "IgnoreProjector" = "True"
+ "RenderType" = "Transparent"
+ }
+
+ Stencil
+ {
+ Ref [_Stencil]
+ Comp [_StencilComp]
+ Pass [_StencilOp]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ }
+
+ Cull Off
+ Lighting Off
+ ZWrite Off
+ Fog { Mode Off }
+ Blend [_BlendSrcFactor] [_BlendDstFactor]
+ ColorMask [_ColorMask]
+
+ Pass
+ {
+ CGPROGRAM
+ #pragma multi_compile NOT_GRAYED GRAYED
+ #pragma multi_compile NOT_CLIPPED CLIPPED SOFT_CLIPPED
+ #pragma vertex vert
+ #pragma fragment frag
+
+ #include "UnityCG.cginc"
+
+ struct appdata_t
+ {
+ float4 vertex : POSITION;
+ fixed4 color : COLOR;
+ float4 texcoord : TEXCOORD0;
+ };
+
+ struct v2f
+ {
+ float4 vertex : SV_POSITION;
+ fixed4 color : COLOR;
+ float4 texcoord : TEXCOORD0;
+
+ #ifdef CLIPPED
+ float2 clipPos : TEXCOORD1;
+ #endif
+
+ #ifdef SOFT_CLIPPED
+ float2 clipPos : TEXCOORD1;
+ #endif
+ };
+
+ sampler2D _MainTex;
+
+ CBUFFER_START(UnityPerMaterial)
+ #ifdef CLIPPED
+ float4 _ClipBox = float4(-2, -2, 0, 0);
+ #endif
+
+ #ifdef SOFT_CLIPPED
+ float4 _ClipBox = float4(-2, -2, 0, 0);
+ float4 _ClipSoftness = float4(0, 0, 0, 0);
+ #endif
+ CBUFFER_END
+
+ v2f vert (appdata_t v)
+ {
+ v2f o;
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.texcoord = v.texcoord;
+ #if !defined(UNITY_COLORSPACE_GAMMA) && (UNITY_VERSION >= 550)
+ o.color.rgb = GammaToLinearSpace(v.color.rgb);
+ o.color.a = v.color.a;
+ #else
+ o.color = v.color;
+ #endif
+
+ #ifdef CLIPPED
+ o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
+ #endif
+
+ #ifdef SOFT_CLIPPED
+ o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
+ #endif
+
+ return o;
+ }
+
+ fixed4 frag (v2f i) : SV_Target
+ {
+ fixed4 col = i.color;
+ col.a *= tex2D(_MainTex, i.texcoord).a;
+
+ #ifdef GRAYED
+ fixed grey = dot(col.rgb, fixed3(0.299, 0.587, 0.114));
+ col.rgb = fixed3(grey, grey, grey);
+ #endif
+
+ #ifdef SOFT_CLIPPED
+ float2 factor = float2(0,0);
+ if(i.clipPos.x<0)
+ factor.x = (1.0-abs(i.clipPos.x)) * _ClipSoftness.x;
+ else
+ factor.x = (1.0-i.clipPos.x) * _ClipSoftness.z;
+ if(i.clipPos.y<0)
+ factor.y = (1.0-abs(i.clipPos.y)) * _ClipSoftness.w;
+ else
+ factor.y = (1.0-i.clipPos.y) * _ClipSoftness.y;
+ col.a *= clamp(min(factor.x, factor.y), 0.0, 1.0);
+ #endif
+
+ #ifdef CLIPPED
+ float2 factor = abs(i.clipPos);
+ col.a *= step(max(factor.x, factor.y), 1);
+ #endif
+
+ return col;
+ }
+ ENDCG
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-Text.shader.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-Text.shader.meta
new file mode 100644
index 00000000..ec6565d6
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Resources/Shaders/FairyGUI-Text.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8526777372c6fef4f8162b3a7901dcb0
+timeCreated: 1459224288
+licenseType: Pro
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts.meta
new file mode 100644
index 00000000..71aaef2c
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 6c12af28724b4455ba52362d4621053f
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core.meta
new file mode 100644
index 00000000..15c8551e
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: eed3a919a48726c46a61e180a615ef7d
+folderAsset: yes
+timeCreated: 1460480287
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/BlendMode.cs b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/BlendMode.cs
new file mode 100644
index 00000000..dd725ea5
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/BlendMode.cs
@@ -0,0 +1,110 @@
+using UnityEngine;
+using NativeBlendMode = UnityEngine.Rendering.BlendMode;
+
+namespace FairyGUI
+{
+ /*关于BlendMode.Off, 这种模式相当于Blend Off指令的效果。当然,在着色器里使用Blend Off指令可以获得更高的效率,
+ 但因为Image着色器本身就有多个关键字,复制一个这样的着色器代价太大,所有为了节省Shader数量便增加了这样一种模式,也是可以接受的。
+ */
+
+ ///
+ ///
+ ///
+ public enum BlendMode
+ {
+ Normal,
+ None,
+ Add,
+ Multiply,
+ Screen,
+ Erase,
+ Mask,
+ Below,
+ Off,
+ One_OneMinusSrcAlpha,
+ Custom1,
+ Custom2,
+ Custom3
+ }
+
+ ///
+ ///
+ ///
+ public class BlendModeUtils
+ {
+ public class BlendFactor
+ {
+ public NativeBlendMode srcFactor;
+ public NativeBlendMode dstFactor;
+ public bool pma;
+
+ public BlendFactor(NativeBlendMode srcFactor, NativeBlendMode dstFactor, bool pma = false)
+ {
+ this.srcFactor = srcFactor;
+ this.dstFactor = dstFactor;
+ this.pma = pma;
+ }
+ }
+
+ //Source指的是被计算的颜色,Destination是已经在屏幕上的颜色。
+ //混合结果=Source * factor1 + Destination * factor2
+ public static BlendFactor[] Factors = new BlendFactor[] {
+ //Normal
+ new BlendFactor(NativeBlendMode.SrcAlpha, NativeBlendMode.OneMinusSrcAlpha),
+ //None
+ new BlendFactor(NativeBlendMode.One, NativeBlendMode.One),
+ //Add
+ new BlendFactor(NativeBlendMode.SrcAlpha, NativeBlendMode.One),
+ //Multiply
+ new BlendFactor(NativeBlendMode.DstColor, NativeBlendMode.OneMinusSrcAlpha, true),
+ //Screen
+ new BlendFactor(NativeBlendMode.One, NativeBlendMode.OneMinusSrcColor, true),
+ //Erase
+ new BlendFactor(NativeBlendMode.Zero, NativeBlendMode.OneMinusSrcAlpha),
+ //Mask
+ new BlendFactor(NativeBlendMode.Zero, NativeBlendMode.SrcAlpha),
+ //Below
+ new BlendFactor(NativeBlendMode.OneMinusDstAlpha, NativeBlendMode.DstAlpha),
+ //Off
+ new BlendFactor(NativeBlendMode.One, NativeBlendMode.Zero),
+ //One_OneMinusSrcAlpha
+ new BlendFactor(NativeBlendMode.One, NativeBlendMode.OneMinusSrcAlpha),
+ //Custom1
+ new BlendFactor(NativeBlendMode.SrcAlpha, NativeBlendMode.OneMinusSrcAlpha),
+ //Custom2
+ new BlendFactor(NativeBlendMode.SrcAlpha, NativeBlendMode.OneMinusSrcAlpha),
+ //Custom3
+ new BlendFactor(NativeBlendMode.SrcAlpha, NativeBlendMode.OneMinusSrcAlpha)
+ };
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void Apply(Material mat, BlendMode blendMode)
+ {
+ BlendFactor bf = Factors[(int)blendMode];
+ mat.SetFloat(ShaderConfig.ID_BlendSrcFactor, (float)bf.srcFactor);
+ mat.SetFloat(ShaderConfig.ID_BlendDstFactor, (float)bf.dstFactor);
+
+ if (bf.pma)
+ mat.SetFloat(ShaderConfig.ID_ColorOption, 1);
+ else
+ mat.SetFloat(ShaderConfig.ID_ColorOption, 0);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void Override(BlendMode blendMode, NativeBlendMode srcFactor, NativeBlendMode dstFactor)
+ {
+ BlendFactor bf = Factors[(int)blendMode];
+ bf.srcFactor = srcFactor;
+ bf.dstFactor = dstFactor;
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/BlendMode.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/BlendMode.cs.meta
new file mode 100644
index 00000000..85b25a0b
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/BlendMode.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: ce4df113fe8d9994c83e22680544ccdb
+timeCreated: 1464679834
+licenseType: Store
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/CaptureCamera.cs b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/CaptureCamera.cs
new file mode 100644
index 00000000..cd550477
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/CaptureCamera.cs
@@ -0,0 +1,202 @@
+using UnityEngine;
+
+namespace FairyGUI
+{
+ ///
+ ///
+ ///
+ public class CaptureCamera : MonoBehaviour
+ {
+ ///
+ ///
+ ///
+ [System.NonSerialized]
+ public Transform cachedTransform;
+ ///
+ ///
+ ///
+ [System.NonSerialized]
+ public Camera cachedCamera;
+
+ [System.NonSerialized]
+ static CaptureCamera _main;
+
+ [System.NonSerialized]
+ static int _layer = -1;
+ static int _hiddenLayer = -1;
+
+ public const string Name = "Capture Camera";
+ public const string LayerName = "VUI";
+ public const string HiddenLayerName = "Hidden VUI";
+
+ void OnEnable()
+ {
+ cachedCamera = this.GetComponent();
+ cachedTransform = this.gameObject.transform;
+
+ if (this.gameObject.name == Name)
+ _main = this;
+ }
+
+ ///
+ ///
+ ///
+ public static void CheckMain()
+ {
+ if (_main != null && _main.cachedCamera != null)
+ return;
+
+ GameObject go = GameObject.Find(Name);
+ if (go != null)
+ {
+ _main = go.GetComponent();
+ return;
+ }
+
+ GameObject cameraObject = new GameObject(Name);
+ Camera camera = cameraObject.AddComponent();
+ camera.depth = 0;
+ camera.cullingMask = 1 << layer;
+ camera.clearFlags = CameraClearFlags.SolidColor;
+ camera.backgroundColor = Color.clear;
+ camera.orthographic = true;
+ camera.orthographicSize = 5;
+ camera.nearClipPlane = -30;
+ camera.farClipPlane = 30;
+ camera.enabled = false;
+#if UNITY_5_4_OR_NEWER
+ camera.stereoTargetEye = StereoTargetEyeMask.None;
+#endif
+
+#if UNITY_5_6_OR_NEWER
+ camera.allowHDR = false;
+ camera.allowMSAA = false;
+#endif
+ cameraObject.AddComponent();
+ }
+
+ ///
+ ///
+ ///
+ public static int layer
+ {
+ get
+ {
+ if (_layer == -1)
+ {
+ _layer = LayerMask.NameToLayer(LayerName);
+ if (_layer == -1)
+ {
+ _layer = 30;
+ Debug.LogWarning("Please define two layers named '" + CaptureCamera.LayerName + "' and '" + CaptureCamera.HiddenLayerName + "'");
+ }
+ }
+
+ return _layer;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public static int hiddenLayer
+ {
+ get
+ {
+ if (_hiddenLayer == -1)
+ {
+ _hiddenLayer = LayerMask.NameToLayer(HiddenLayerName);
+ if (_hiddenLayer == -1)
+ {
+ Debug.LogWarning("Please define two layers named '" + CaptureCamera.LayerName + "' and '" + CaptureCamera.HiddenLayerName + "'");
+ _hiddenLayer = 31;
+ }
+ }
+
+ return _hiddenLayer;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static RenderTexture CreateRenderTexture(int width, int height, bool stencilSupport)
+ {
+ RenderTexture texture = new RenderTexture(width, height, stencilSupport ? 24 : 0, RenderTextureFormat.ARGB32);
+ texture.antiAliasing = 1;
+ texture.filterMode = FilterMode.Bilinear;
+ texture.anisoLevel = 0;
+ texture.useMipMap = false;
+ texture.wrapMode = TextureWrapMode.Clamp;
+ texture.hideFlags = DisplayObject.hideFlags;
+ return texture;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void Capture(DisplayObject target, RenderTexture texture, float contentHeight, Vector2 offset)
+ {
+ CheckMain();
+
+ Matrix4x4 matrix = target.cachedTransform.localToWorldMatrix;
+ float scaleX = new Vector4(matrix.m00, matrix.m10, matrix.m20, matrix.m30).magnitude;
+ float scaleY = new Vector4(matrix.m01, matrix.m11, matrix.m21, matrix.m31).magnitude;
+
+ Vector3 forward;
+ forward.x = matrix.m02;
+ forward.y = matrix.m12;
+ forward.z = matrix.m22;
+
+ Vector3 upwards;
+ upwards.x = matrix.m01;
+ upwards.y = matrix.m11;
+ upwards.z = matrix.m21;
+
+ float halfHeight = contentHeight * 0.5f;
+
+ Camera camera = _main.cachedCamera;
+ camera.targetTexture = texture;
+ float aspect = (float)texture.width / texture.height;
+ camera.aspect = aspect * scaleX / scaleY;
+ camera.orthographicSize = halfHeight * scaleY;
+ _main.cachedTransform.localPosition = target.cachedTransform.TransformPoint(halfHeight * aspect - offset.x, -halfHeight + offset.y, 0);
+ if (forward != Vector3.zero)
+ _main.cachedTransform.localRotation = Quaternion.LookRotation(forward, upwards);
+
+ int oldLayer = 0;
+
+ if (target.graphics != null)
+ {
+ oldLayer = target.graphics.gameObject.layer;
+ target.graphics.gameObject.layer = CaptureCamera.layer;
+ }
+
+ if (target is Container)
+ {
+ oldLayer = ((Container)target).numChildren > 0 ? ((Container)target).GetChildAt(0).layer : CaptureCamera.hiddenLayer;
+ ((Container)target).SetChildrenLayer(CaptureCamera.layer);
+ }
+
+ RenderTexture old = RenderTexture.active;
+ RenderTexture.active = texture;
+ GL.Clear(true, true, Color.clear);
+ camera.Render();
+ RenderTexture.active = old;
+
+ if (target.graphics != null)
+ target.graphics.gameObject.layer = oldLayer;
+
+ if (target is Container)
+ ((Container)target).SetChildrenLayer(oldLayer);
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/CaptureCamera.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/CaptureCamera.cs.meta
new file mode 100644
index 00000000..f6278fcd
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/CaptureCamera.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: d207151359c99fb448f4b3380bf41b0f
+timeCreated: 1535374215
+licenseType: Store
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/Container.cs b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/Container.cs
new file mode 100644
index 00000000..61d6f4c1
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/Container.cs
@@ -0,0 +1,1124 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace FairyGUI
+{
+ ///
+ ///
+ ///
+ public class Container : DisplayObject
+ {
+ ///
+ ///
+ ///
+ public RenderMode renderMode;
+
+ ///
+ ///
+ ///
+ public Camera renderCamera;
+
+ ///
+ ///
+ ///
+ public bool opaque;
+
+ ///
+ ///
+ ///
+ public Vector4? clipSoftness;
+
+ ///
+ ///
+ ///
+ public IHitTest hitArea;
+
+ ///
+ ///
+ ///
+ public bool touchChildren;
+
+ ///
+ ///
+ ///
+ public event Action onUpdate;
+
+ ///
+ ///
+ ///
+ public bool reversedMask;
+
+ List _children;
+ DisplayObject _mask;
+ Rect? _clipRect;
+ List _descendants;
+
+ internal int _panelOrder;
+ internal DisplayObject _lastFocus;
+
+ ///
+ ///
+ ///
+ public Container()
+ : base()
+ {
+ CreateGameObject("Container");
+ Init();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public Container(string gameObjectName)
+ : base()
+ {
+ CreateGameObject(gameObjectName);
+ Init();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public Container(GameObject attachTarget)
+ : base()
+ {
+ SetGameObject(attachTarget);
+ Init();
+ }
+
+ void Init()
+ {
+ _children = new List();
+ touchChildren = true;
+ }
+
+ ///
+ ///
+ ///
+ public int numChildren
+ {
+ get { return _children.Count; }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DisplayObject AddChild(DisplayObject child)
+ {
+ AddChildAt(child, _children.Count);
+ return child;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DisplayObject AddChildAt(DisplayObject child, int index)
+ {
+ int count = _children.Count;
+ if (index >= 0 && index <= count)
+ {
+ if (child.parent == this)
+ {
+ SetChildIndex(child, index);
+ }
+ else
+ {
+ child.RemoveFromParent();
+ if (index == count)
+ _children.Add(child);
+ else
+ _children.Insert(index, child);
+ child.InternalSetParent(this);
+
+ if (stage != null)
+ {
+ if (child is Container)
+ child.BroadcastEvent("onAddedToStage", null);
+ else
+ child.DispatchEvent("onAddedToStage", null);
+ }
+
+ InvalidateBatchingState(true);
+ }
+ return child;
+ }
+ else
+ {
+ throw new Exception("Invalid child index");
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool Contains(DisplayObject child)
+ {
+ return _children.Contains(child);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DisplayObject GetChildAt(int index)
+ {
+ return _children[index];
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DisplayObject GetChild(string name)
+ {
+ int cnt = _children.Count;
+ for (int i = 0; i < cnt; ++i)
+ {
+ if (_children[i].name == name)
+ return _children[i];
+ }
+
+ return null;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public DisplayObject[] GetChildren()
+ {
+ return _children.ToArray();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int GetChildIndex(DisplayObject child)
+ {
+ return _children.IndexOf(child);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DisplayObject RemoveChild(DisplayObject child)
+ {
+ return RemoveChild(child, false);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DisplayObject RemoveChild(DisplayObject child, bool dispose)
+ {
+ if (child.parent != this)
+ throw new Exception("obj is not a child");
+
+ int i = _children.IndexOf(child);
+ if (i >= 0)
+ return RemoveChildAt(i, dispose);
+ else
+ return null;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DisplayObject RemoveChildAt(int index)
+ {
+ return RemoveChildAt(index, false);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DisplayObject RemoveChildAt(int index, bool dispose)
+ {
+ if (index >= 0 && index < _children.Count)
+ {
+ DisplayObject child = _children[index];
+
+ if (stage != null && (child._flags & Flags.Disposed) == 0)
+ {
+ if (child is Container)
+ {
+ child.BroadcastEvent("onRemovedFromStage", null);
+ if (child == Stage.inst.focus || ((Container)child).IsAncestorOf(Stage.inst.focus))
+ Stage.inst._OnFocusRemoving(this);
+ }
+ else
+ {
+ child.DispatchEvent("onRemovedFromStage", null);
+ if (child == Stage.inst.focus)
+ Stage.inst._OnFocusRemoving(this);
+ }
+ }
+ _children.Remove(child);
+ InvalidateBatchingState(true);
+ if (!dispose)
+ child.InternalSetParent(null);
+ else
+ child.Dispose();
+
+ return child;
+ }
+ else
+ throw new Exception("Invalid child index");
+ }
+
+ ///
+ ///
+ ///
+ public void RemoveChildren()
+ {
+ RemoveChildren(0, int.MaxValue, false);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void RemoveChildren(int beginIndex, int endIndex, bool dispose)
+ {
+ if (endIndex < 0 || endIndex >= numChildren)
+ endIndex = numChildren - 1;
+
+ for (int i = beginIndex; i <= endIndex; ++i)
+ RemoveChildAt(beginIndex, dispose);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetChildIndex(DisplayObject child, int index)
+ {
+ int oldIndex = _children.IndexOf(child);
+ if (oldIndex == index) return;
+ if (oldIndex == -1) throw new ArgumentException("Not a child of this container");
+ _children.RemoveAt(oldIndex);
+ if (index >= _children.Count)
+ _children.Add(child);
+ else
+ _children.Insert(index, child);
+ InvalidateBatchingState(true);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SwapChildren(DisplayObject child1, DisplayObject child2)
+ {
+ int index1 = _children.IndexOf(child1);
+ int index2 = _children.IndexOf(child2);
+ if (index1 == -1 || index2 == -1)
+ throw new Exception("Not a child of this container");
+ SwapChildrenAt(index1, index2);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SwapChildrenAt(int index1, int index2)
+ {
+ DisplayObject obj1 = _children[index1];
+ DisplayObject obj2 = _children[index2];
+ _children[index1] = obj2;
+ _children[index2] = obj1;
+ InvalidateBatchingState(true);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void ChangeChildrenOrder(IList indice, IList objs)
+ {
+ int cnt = objs.Count;
+ for (int i = 0; i < cnt; i++)
+ {
+ DisplayObject obj = objs[i];
+ if (obj.parent != this)
+ throw new Exception("Not a child of this container");
+
+ _children[indice[i]] = obj;
+ }
+ InvalidateBatchingState(true);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public IEnumerator GetDescendants(bool backward)
+ {
+ return new DescendantsEnumerator(this, backward);
+ }
+
+ ///
+ ///
+ ///
+ public Rect? clipRect
+ {
+ get { return _clipRect; }
+ set
+ {
+ if (_clipRect != value)
+ {
+ _clipRect = value;
+ UpdateBatchingFlags();
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ public DisplayObject mask
+ {
+ get { return _mask; }
+ set
+ {
+ if (_mask != value)
+ {
+ _mask = value;
+ UpdateBatchingFlags();
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ public void CreateGraphics()
+ {
+ if (graphics == null)
+ {
+ graphics = new NGraphics(this.gameObject);
+ graphics.texture = NTexture.Empty;
+ }
+ }
+
+ public override Rect GetBounds(DisplayObject targetSpace)
+ {
+ if (_clipRect != null)
+ return TransformRect((Rect)_clipRect, targetSpace);
+
+ int count = _children.Count;
+
+ Rect rect;
+ if (count == 0)
+ {
+ Vector2 v = TransformPoint(Vector2.zero, targetSpace);
+ rect = Rect.MinMaxRect(v.x, v.y, 0, 0);
+ }
+ else if (count == 1)
+ {
+ rect = _children[0].GetBounds(targetSpace);
+ }
+ else
+ {
+ float minX = float.MaxValue, maxX = float.MinValue;
+ float minY = float.MaxValue, maxY = float.MinValue;
+
+ for (int i = 0; i < count; ++i)
+ {
+ rect = _children[i].GetBounds(targetSpace);
+ minX = minX < rect.xMin ? minX : rect.xMin;
+ maxX = maxX > rect.xMax ? maxX : rect.xMax;
+ minY = minY < rect.yMin ? minY : rect.yMin;
+ maxY = maxY > rect.yMax ? maxY : rect.yMax;
+ }
+
+ rect = Rect.MinMaxRect(minX, minY, maxX, maxY);
+ }
+
+ return rect;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public Camera GetRenderCamera()
+ {
+ if (renderMode == RenderMode.ScreenSpaceOverlay)
+ return StageCamera.main;
+ else
+ {
+ Camera cam = this.renderCamera;
+ if (cam == null)
+ {
+ if (HitTestContext.cachedMainCamera != null)
+ cam = HitTestContext.cachedMainCamera;
+ else
+ {
+ cam = Camera.main;
+ if (cam == null)
+ cam = StageCamera.main;
+ }
+ }
+ return cam;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DisplayObject HitTest(Vector2 stagePoint, bool forTouch)
+ {
+ if (StageCamera.main == null)
+ {
+ if (this is Stage)
+ return this;
+ else
+ return null;
+ }
+
+ HitTestContext.screenPoint = new Vector3(stagePoint.x, Screen.height - stagePoint.y, 0);
+ if (Display.displays.Length > 1)
+ {
+ Vector3 p = Display.RelativeMouseAt(HitTestContext.screenPoint);
+ if (p != Vector3.zero)
+ HitTestContext.screenPoint = p;
+ }
+ HitTestContext.worldPoint = StageCamera.main.ScreenToWorldPoint(HitTestContext.screenPoint);
+ HitTestContext.direction = Vector3.back;
+ HitTestContext.forTouch = forTouch;
+ HitTestContext.camera = StageCamera.main;
+
+ DisplayObject ret = HitTest();
+ if (ret != null)
+ return ret;
+ else if (this is Stage)
+ return this;
+ else
+ return null;
+ }
+
+ override protected DisplayObject HitTest()
+ {
+ if ((_flags & Flags.UserGameObject) != 0 && !gameObject.activeInHierarchy)
+ return null;
+
+ if (this.cachedTransform.localScale.x == 0 || this.cachedTransform.localScale.y == 0)
+ return null;
+
+ Camera savedCamera = HitTestContext.camera;
+ Vector3 savedWorldPoint = HitTestContext.worldPoint;
+ Vector3 savedDirection = HitTestContext.direction;
+ DisplayObject target;
+
+ if (renderMode != RenderMode.ScreenSpaceOverlay || (_flags & Flags.UserGameObject) != 0)
+ {
+ Camera cam = GetRenderCamera();
+ if (cam.targetDisplay != HitTestContext.screenPoint.z)
+ return null;
+
+ HitTestContext.camera = cam;
+ if (renderMode == RenderMode.WorldSpace)
+ {
+ Vector3 screenPoint = HitTestContext.camera.WorldToScreenPoint(this.cachedTransform.position); //only for query z value
+ screenPoint.x = HitTestContext.screenPoint.x;
+ screenPoint.y = HitTestContext.screenPoint.y;
+
+ //获得本地z轴在世界坐标的方向
+ HitTestContext.worldPoint = HitTestContext.camera.ScreenToWorldPoint(screenPoint);
+ Ray ray = HitTestContext.camera.ScreenPointToRay(screenPoint);
+ HitTestContext.direction = Vector3.zero - ray.direction;
+ }
+ else if (renderMode == RenderMode.ScreenSpaceCamera)
+ {
+ HitTestContext.worldPoint = HitTestContext.camera.ScreenToWorldPoint(HitTestContext.screenPoint);
+ }
+ }
+ else
+ {
+ if (HitTestContext.camera.targetDisplay != HitTestContext.screenPoint.z && !(this is Stage))
+ return null;
+ }
+
+ target = HitTest_Container();
+
+ HitTestContext.camera = savedCamera;
+ HitTestContext.worldPoint = savedWorldPoint;
+ HitTestContext.direction = savedDirection;
+
+ return target;
+ }
+
+ DisplayObject HitTest_Container()
+ {
+ Vector2 localPoint = WorldToLocal(HitTestContext.worldPoint, HitTestContext.direction);
+ if (_vertexMatrix != null)
+ HitTestContext.worldPoint = this.cachedTransform.TransformPoint(new Vector2(localPoint.x, -localPoint.y));
+
+ if (hitArea != null)
+ {
+ if (!hitArea.HitTest(_contentRect, localPoint))
+ return null;
+
+ if (hitArea is MeshColliderHitTest)
+ localPoint = ((MeshColliderHitTest)hitArea).lastHit;
+ }
+ else
+ {
+ if (_clipRect != null && !((Rect)_clipRect).Contains(localPoint))
+ return null;
+ }
+
+ if (_mask != null)
+ {
+ DisplayObject tmp = _mask.InternalHitTestMask();
+ if (!reversedMask && tmp == null || reversedMask && tmp != null)
+ return null;
+ }
+
+ DisplayObject target = null;
+ if (touchChildren)
+ {
+ int count = _children.Count;
+ for (int i = count - 1; i >= 0; --i) // front to back!
+ {
+ DisplayObject child = _children[i];
+ if ((child._flags & Flags.GameObjectDisposed) != 0)
+ {
+ child.DisplayDisposedWarning();
+ continue;
+ }
+
+ if (child == _mask || (child._flags & Flags.TouchDisabled) != 0)
+ continue;
+
+ target = child.InternalHitTest();
+ if (target != null)
+ break;
+ }
+ }
+
+ if (target == null && opaque && (hitArea != null || _contentRect.Contains(localPoint)))
+ target = this;
+
+ return target;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool IsAncestorOf(DisplayObject obj)
+ {
+ if (obj == null)
+ return false;
+
+ Container p = obj.parent;
+ while (p != null)
+ {
+ if (p == this)
+ return true;
+
+ p = p.parent;
+ }
+ return false;
+ }
+
+ ///
+ ///
+ ///
+ public bool fairyBatching
+ {
+ get { return (_flags & Flags.FairyBatching) != 0; }
+ set
+ {
+ bool oldValue = (_flags & Flags.FairyBatching) != 0;
+ if (oldValue != value)
+ {
+ if (value)
+ _flags |= Flags.FairyBatching;
+ else
+ _flags &= ~Flags.FairyBatching;
+ UpdateBatchingFlags();
+ }
+ }
+ }
+
+ internal void UpdateBatchingFlags()
+ {
+ bool oldValue = (_flags & Flags.BatchingRoot) != 0;
+ bool newValue = (_flags & Flags.FairyBatching) != 0 || _clipRect != null || _mask != null || _paintingMode > 0;
+ if (newValue)
+ _flags |= Flags.BatchingRoot;
+ else
+ _flags &= ~Flags.BatchingRoot;
+ if (oldValue != newValue)
+ {
+ if (newValue)
+ _flags |= Flags.BatchingRequested;
+ else if (_descendants != null)
+ _descendants.Clear();
+
+ InvalidateBatchingState();
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void InvalidateBatchingState(bool childrenChanged)
+ {
+ if (childrenChanged && (_flags & Flags.BatchingRoot) != 0)
+ _flags |= Flags.BatchingRequested;
+ else
+ {
+ Container p = this.parent;
+ while (p != null)
+ {
+ if ((p._flags & Flags.BatchingRoot) != 0)
+ {
+ p._flags |= Flags.BatchingRequested;
+ break;
+ }
+
+ p = p.parent;
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void SetChildrenLayer(int value)
+ {
+ int cnt = _children.Count;
+ for (int i = 0; i < cnt; i++)
+ {
+ DisplayObject child = _children[i];
+ child._SetLayerDirect(value);
+ if ((child is Container) && child._paintingMode == 0)
+ ((Container)child).SetChildrenLayer(value);
+ }
+ }
+
+ override public void Update(UpdateContext context)
+ {
+ if ((_flags & Flags.UserGameObject) != 0 && !gameObject.activeInHierarchy)
+ return;
+
+ base.Update(context);
+
+ if (_paintingMode != 0)
+ {
+ if ((_flags & Flags.CacheAsBitmap) != 0 && _paintingInfo.flag == 2)
+ {
+ if (onUpdate != null)
+ onUpdate();
+ return;
+ }
+
+ context.EnterPaintingMode();
+ }
+
+ if (_mask != null)
+ {
+ context.EnterClipping(this.id, reversedMask);
+ if (_mask.graphics != null)
+ _mask.graphics._PreUpdateMask(context, _mask.id);
+ }
+ else if (_clipRect != null)
+ context.EnterClipping(this.id, this.TransformRect((Rect)_clipRect, null), clipSoftness);
+
+ float savedAlpha = context.alpha;
+ context.alpha *= this.alpha;
+ bool savedGrayed = context.grayed;
+ context.grayed = context.grayed || this.grayed;
+
+ if ((_flags & Flags.FairyBatching) != 0)
+ context.batchingDepth++;
+
+ if (context.batchingDepth > 0)
+ {
+ int cnt = _children.Count;
+ for (int i = 0; i < cnt; i++)
+ {
+ DisplayObject child = _children[i];
+ if ((child._flags & Flags.GameObjectDisposed) != 0)
+ {
+ child.DisplayDisposedWarning();
+ continue;
+ }
+
+ if (child.visible)
+ child.Update(context);
+ }
+ }
+ else
+ {
+ if (_mask != null)
+ _mask.renderingOrder = context.renderingOrder++;
+
+ int cnt = _children.Count;
+ for (int i = 0; i < cnt; i++)
+ {
+ DisplayObject child = _children[i];
+ if ((child._flags & Flags.GameObjectDisposed) != 0)
+ {
+ child.DisplayDisposedWarning();
+ continue;
+ }
+
+ if (child.visible)
+ {
+ if (!(child.graphics != null && child.graphics._maskFlag == 1)) //if not a mask
+ child.renderingOrder = context.renderingOrder++;
+
+ child.Update(context);
+ }
+ }
+
+ if (_mask != null)
+ {
+ if (_mask.graphics != null)
+ _mask.graphics._SetStencilEraserOrder(context.renderingOrder++);
+ }
+ }
+
+ if ((_flags & Flags.FairyBatching) != 0)
+ {
+ if (context.batchingDepth == 1)
+ SetRenderingOrder(context);
+ context.batchingDepth--;
+ }
+
+ context.alpha = savedAlpha;
+ context.grayed = savedGrayed;
+
+ if (_clipRect != null || _mask != null)
+ context.LeaveClipping();
+
+ if (_paintingMode != 0)
+ {
+ context.LeavePaintingMode();
+ UpdateContext.OnEnd += _paintingInfo.captureDelegate;
+ }
+
+ if (onUpdate != null)
+ onUpdate();
+ }
+
+ private void SetRenderingOrder(UpdateContext context)
+ {
+ if ((_flags & Flags.BatchingRequested) != 0)
+ DoFairyBatching();
+
+ if (_mask != null)
+ _mask.renderingOrder = context.renderingOrder++;
+
+ int cnt = _descendants.Count;
+ for (int i = 0; i < cnt; i++)
+ {
+ DisplayObject child = _descendants[i];
+ if (!(child.graphics != null && child.graphics._maskFlag == 1))
+ child.renderingOrder = context.renderingOrder++;
+
+ if ((child._flags & Flags.BatchingRoot) != 0)
+ ((Container)child).SetRenderingOrder(context);
+ }
+
+ if (_mask != null)
+ {
+ if (_mask.graphics != null)
+ _mask.graphics._SetStencilEraserOrder(context.renderingOrder++);
+ }
+ }
+
+ private void DoFairyBatching()
+ {
+ _flags &= ~Flags.BatchingRequested;
+
+ if (_descendants == null)
+ _descendants = new List();
+ else
+ _descendants.Clear();
+ CollectChildren(this, false);
+
+ int cnt = _descendants.Count;
+
+ int i, j, k, m;
+ object curMat, testMat, lastMat;
+ DisplayObject current, test;
+ float[] bound;
+ for (i = 0; i < cnt; i++)
+ {
+ current = _descendants[i];
+ bound = current._batchingBounds;
+ curMat = current.material;
+ if (curMat == null || (current._flags & Flags.SkipBatching) != 0)
+ continue;
+
+ k = -1;
+ lastMat = null;
+ m = i;
+ for (j = i - 1; j >= 0; j--)
+ {
+ test = _descendants[j];
+ if ((test._flags & Flags.SkipBatching) != 0)
+ break;
+
+ testMat = test.material;
+ if (testMat != null)
+ {
+ if (lastMat != testMat)
+ {
+ lastMat = testMat;
+ m = j + 1;
+ }
+
+ if (curMat == testMat)
+ k = m;
+ }
+
+ if ((bound[0] > test._batchingBounds[0] ? bound[0] : test._batchingBounds[0])
+ <= (bound[2] < test._batchingBounds[2] ? bound[2] : test._batchingBounds[2])
+ && (bound[1] > test._batchingBounds[1] ? bound[1] : test._batchingBounds[1])
+ <= (bound[3] < test._batchingBounds[3] ? bound[3] : test._batchingBounds[3]))
+ {
+ if (k == -1)
+ k = m;
+ break;
+ }
+ }
+ if (k != -1 && i != k)
+ {
+ _descendants.RemoveAt(i);
+ _descendants.Insert(k, current);
+ }
+ }
+
+ //Debug.Log("DoFairyBatching " + cnt + "," + this.cachedTransform.GetInstanceID());
+ }
+
+ private void CollectChildren(Container initiator, bool outlineChanged)
+ {
+ int count = _children.Count;
+ for (int i = 0; i < count; i++)
+ {
+ DisplayObject child = _children[i];
+ if (!child.visible)
+ continue;
+
+ if (child._batchingBounds == null)
+ child._batchingBounds = new float[4];
+
+ if (child is Container)
+ {
+ Container container = (Container)child;
+ if ((container._flags & Flags.BatchingRoot) != 0)
+ {
+ initiator._descendants.Add(container);
+ if (outlineChanged || (container._flags & Flags.OutlineChanged) != 0)
+ {
+ Rect rect = container.GetBounds(initiator);
+ container._batchingBounds[0] = rect.xMin;
+ container._batchingBounds[1] = rect.yMin;
+ container._batchingBounds[2] = rect.xMax;
+ container._batchingBounds[3] = rect.yMax;
+ }
+ if ((container._flags & Flags.BatchingRequested) != 0)
+ container.DoFairyBatching();
+ }
+ else
+ container.CollectChildren(initiator, outlineChanged || (container._flags & Flags.OutlineChanged) != 0);
+ }
+ else if (child != initiator._mask)
+ {
+ if (outlineChanged || (child._flags & Flags.OutlineChanged) != 0)
+ {
+ Rect rect = child.GetBounds(initiator);
+ child._batchingBounds[0] = rect.xMin;
+ child._batchingBounds[1] = rect.yMin;
+ child._batchingBounds[2] = rect.xMax;
+ child._batchingBounds[3] = rect.yMax;
+ }
+ initiator._descendants.Add(child);
+ }
+
+ child._flags &= ~Flags.OutlineChanged;
+ }
+ }
+
+ public override void Dispose()
+ {
+ if ((_flags & Flags.Disposed) != 0)
+ return;
+
+ base.Dispose(); //Destroy GameObject tree first, avoid destroying each seperately;
+
+ int numChildren = _children.Count;
+ for (int i = numChildren - 1; i >= 0; --i)
+ {
+ DisplayObject obj = _children[i];
+ obj.InternalSetParent(null); //Avoid RemoveParent call
+ obj.Dispose();
+ }
+ }
+
+ ///
+ /// If true, when the container is focused, tab navigation is lock inside it.
+ ///
+ public bool tabStopChildren
+ {
+ get { return (_flags & Flags.TabStopChildren) != 0; }
+ set
+ {
+ if (value)
+ _flags |= Flags.TabStopChildren;
+ else
+ _flags &= ~Flags.TabStopChildren;
+ }
+ }
+
+ struct DescendantsEnumerator : IEnumerator
+ {
+ Container _root;
+ Container _com;
+ DisplayObject _current;
+ int _index;
+ bool _forward;
+
+ public DescendantsEnumerator(Container root, bool backward)
+ {
+ _root = root;
+ _com = _root;
+ _current = null;
+ _forward = !backward;
+ if (_forward)
+ _index = 0;
+ else
+ _index = _com._children.Count - 1;
+ }
+
+ public DisplayObject Current
+ {
+ get { return _current; }
+ }
+
+ object IEnumerator.Current
+ {
+ get { return _current; }
+ }
+
+ public bool MoveNext()
+ {
+ if (_forward)
+ {
+ if (_index >= _com._children.Count)
+ {
+ if (_com == _root)
+ {
+ _current = null;
+ return false;
+ }
+
+ _current = _com;
+ _com = _com.parent;
+ _index = _com.GetChildIndex(_current) + 1;
+ return true;
+ }
+ else
+ {
+ DisplayObject obj = _com._children[_index];
+ if (obj is Container)
+ {
+ _com = (Container)obj;
+ _index = 0;
+ return MoveNext();
+ }
+ _index++;
+ _current = obj;
+ return true;
+ }
+ }
+ else
+ {
+ if (_index < 0)
+ {
+ if (_com == _root)
+ {
+ _current = null;
+ return false;
+ }
+
+ _current = _com;
+ _com = _com.parent;
+ _index = _com.GetChildIndex(_current) - 1;
+ return true;
+ }
+ else
+ {
+ DisplayObject obj = _com._children[_index];
+ if (obj is Container)
+ {
+ _com = (Container)obj;
+ _index = _com._children.Count - 1;
+ return MoveNext();
+ }
+ _index--;
+ _current = obj;
+ return true;
+ }
+ }
+ }
+
+ public void Reset()
+ {
+ _com = _root;
+ _current = null;
+ _index = 0;
+ }
+
+ public void Dispose()
+ {
+ }
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/Container.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/Container.cs.meta
new file mode 100644
index 00000000..78c838b1
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/Container.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 531f2c788ec31e7459700f6811410a6f
+timeCreated: 1535374214
+licenseType: Store
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/DisplayObject.cs b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/DisplayObject.cs
new file mode 100644
index 00000000..5909a65b
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/DisplayObject.cs
@@ -0,0 +1,1878 @@
+using System;
+using System.Text;
+using UnityEngine;
+using FairyGUI.Utils;
+
+namespace FairyGUI
+{
+ ///
+ ///
+ ///
+ public class DisplayObject : EventDispatcher
+ {
+ ///
+ ///
+ ///
+ public string name;
+
+ ///
+ ///
+ ///
+ public Container parent { get; private set; }
+
+ ///
+ ///
+ ///
+ public GameObject gameObject { get; protected set; }
+
+ ///
+ ///
+ ///
+ public Transform cachedTransform { get; protected set; }
+
+ ///
+ ///
+ ///
+ public NGraphics graphics { get; protected set; }
+
+ ///
+ ///
+ ///
+ public NGraphics paintingGraphics { get; protected set; }
+
+ ///
+ ///
+ ///
+ public event Action onPaint;
+
+ ///
+ ///
+ ///
+ public GObject gOwner;
+
+ ///
+ ///
+ ///
+ public uint id;
+
+ bool _visible;
+ bool _touchable;
+ Vector2 _pivot;
+ Vector3 _pivotOffset;
+ Vector3 _rotation; //由于万向锁,单独旋转一个轴是会影响到其他轴的,所以这里需要单独保存
+ Vector2 _skew;
+ int _renderingOrder;
+ float _alpha;
+ bool _grayed;
+ BlendMode _blendMode;
+ IFilter _filter;
+ Transform _home;
+ string _cursor;
+ bool _perspective;
+ int _focalLength;
+ Vector3 _pixelPerfectAdjustment;
+ int _checkPixelPerfect;
+
+ EventListener _onClick;
+ EventListener _onRightClick;
+ EventListener _onTouchBegin;
+ EventListener _onTouchMove;
+ EventListener _onTouchEnd;
+ EventListener _onRollOver;
+ EventListener _onRollOut;
+ EventListener _onMouseWheel;
+ EventListener _onAddedToStage;
+ EventListener _onRemovedFromStage;
+ EventListener _onKeyDown;
+ EventListener _onClickLink;
+ EventListener _onFocusIn;
+ EventListener _onFocusOut;
+
+ protected internal int _paintingMode; //1-滤镜,2-blendMode,4-transformMatrix, 8-cacheAsBitmap
+ protected internal PaintingInfo _paintingInfo;
+ protected Rect _contentRect;
+ protected NGraphics.VertexMatrix _vertexMatrix;
+ protected internal Flags _flags;
+ protected internal float[] _batchingBounds;
+
+ internal static uint _gInstanceCounter;
+
+ internal static HideFlags hideFlags = HideFlags.None;
+
+ public DisplayObject()
+ {
+ id = _gInstanceCounter++;
+
+ _alpha = 1;
+ _visible = true;
+ _touchable = true;
+ _blendMode = BlendMode.Normal;
+ _focalLength = 2000;
+ _flags |= Flags.OutlineChanged;
+ if (UIConfig.makePixelPerfect)
+ _flags |= Flags.PixelPerfect;
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onClick
+ {
+ get { return _onClick ?? (_onClick = new EventListener(this, "onClick")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onRightClick
+ {
+ get { return _onRightClick ?? (_onRightClick = new EventListener(this, "onRightClick")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onTouchBegin
+ {
+ get { return _onTouchBegin ?? (_onTouchBegin = new EventListener(this, "onTouchBegin")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onTouchMove
+ {
+ get { return _onTouchMove ?? (_onTouchMove = new EventListener(this, "onTouchMove")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onTouchEnd
+ {
+ get { return _onTouchEnd ?? (_onTouchEnd = new EventListener(this, "onTouchEnd")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onRollOver
+ {
+ get { return _onRollOver ?? (_onRollOver = new EventListener(this, "onRollOver")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onRollOut
+ {
+ get { return _onRollOut ?? (_onRollOut = new EventListener(this, "onRollOut")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onMouseWheel
+ {
+ get { return _onMouseWheel ?? (_onMouseWheel = new EventListener(this, "onMouseWheel")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onAddedToStage
+ {
+ get { return _onAddedToStage ?? (_onAddedToStage = new EventListener(this, "onAddedToStage")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onRemovedFromStage
+ {
+ get { return _onRemovedFromStage ?? (_onRemovedFromStage = new EventListener(this, "onRemovedFromStage")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onKeyDown
+ {
+ get { return _onKeyDown ?? (_onKeyDown = new EventListener(this, "onKeyDown")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onClickLink
+ {
+ get { return _onClickLink ?? (_onClickLink = new EventListener(this, "onClickLink")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onFocusIn
+ {
+ get { return _onFocusIn ?? (_onFocusIn = new EventListener(this, "onFocusIn")); }
+ }
+
+ ///
+ ///
+ ///
+ public EventListener onFocusOut
+ {
+ get { return _onFocusOut ?? (_onFocusOut = new EventListener(this, "onFocusOut")); }
+
+ }
+
+ protected void CreateGameObject(string gameObjectName)
+ {
+ gameObject = new GameObject(gameObjectName);
+ cachedTransform = gameObject.transform;
+ if (Application.isPlaying)
+ {
+ UnityEngine.Object.DontDestroyOnLoad(gameObject);
+
+ DisplayObjectInfo info = gameObject.AddComponent();
+ info.displayObject = this;
+ }
+ gameObject.hideFlags = DisplayObject.hideFlags;
+ gameObject.SetActive(false);
+ }
+
+ protected void SetGameObject(GameObject gameObject)
+ {
+ this.gameObject = gameObject;
+ this.cachedTransform = gameObject.transform;
+ _rotation = cachedTransform.localEulerAngles;
+
+ _flags |= Flags.UserGameObject;
+ }
+
+ protected void DestroyGameObject()
+ {
+ if ((_flags & Flags.UserGameObject) == 0 && gameObject != null)
+ {
+ if (Application.isPlaying)
+ GameObject.Destroy(gameObject);
+ else
+ GameObject.DestroyImmediate(gameObject);
+ gameObject = null;
+ cachedTransform = null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public float alpha
+ {
+ get { return _alpha; }
+ set { _alpha = value; }
+ }
+
+ ///
+ ///
+ ///
+ public bool grayed
+ {
+ get { return _grayed; }
+ set { _grayed = value; }
+ }
+
+ ///
+ ///
+ ///
+ public bool visible
+ {
+ get { return _visible; }
+ set
+ {
+ if (_visible != value)
+ {
+ _visible = value;
+ _flags |= Flags.OutlineChanged;
+ if (parent != null && _visible)
+ {
+ gameObject.SetActive(true);
+ InvalidateBatchingState();
+ if (this is Container)
+ ((Container)this).InvalidateBatchingState(true);
+ }
+ else
+ gameObject.SetActive(false);
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ public float x
+ {
+ get { return cachedTransform.localPosition.x; }
+ set
+ {
+ SetPosition(value, -cachedTransform.localPosition.y, cachedTransform.localPosition.z);
+ }
+ }
+
+ ///
+ ///
+ ///
+ public float y
+ {
+ get { return -cachedTransform.localPosition.y; }
+ set
+ {
+ SetPosition(cachedTransform.localPosition.x, value, cachedTransform.localPosition.z);
+ }
+ }
+
+ ///
+ ///
+ ///
+ public float z
+ {
+ get { return cachedTransform.localPosition.z; }
+ set
+ {
+ SetPosition(cachedTransform.localPosition.x, -cachedTransform.localPosition.y, value);
+ }
+ }
+
+ ///
+ ///
+ ///
+ public Vector2 xy
+ {
+ get { return new Vector2(this.x, this.y); }
+ set { SetPosition(value.x, value.y, cachedTransform.localPosition.z); }
+ }
+
+ ///
+ ///
+ ///
+ public Vector3 position
+ {
+ get { return new Vector3(this.x, this.y, this.z); }
+ set { SetPosition(value.x, value.y, value.z); }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetXY(float xv, float yv)
+ {
+ SetPosition(xv, yv, cachedTransform.localPosition.z);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetPosition(float xv, float yv, float zv)
+ {
+ Vector3 v = new Vector3();
+ v.x = xv;
+ v.y = -yv;
+ v.z = zv;
+ if (v != cachedTransform.localPosition)
+ {
+ cachedTransform.localPosition = v;
+ _flags |= Flags.OutlineChanged;
+ if ((_flags & Flags.PixelPerfect) != 0)
+ {
+ //总在下一帧再完成PixelPerfect,这样当物体在连续运动时,不会因为PixelPerfect而发生抖动。
+ _checkPixelPerfect = Time.frameCount;
+ _pixelPerfectAdjustment = Vector3.zero;
+ }
+ }
+ }
+
+ ///
+ /// If the object position is align by pixel
+ ///
+ public bool pixelPerfect
+ {
+ get { return (_flags & Flags.PixelPerfect) != 0; }
+ set
+ {
+ if (value)
+ _flags |= Flags.PixelPerfect;
+ else
+ _flags &= ~Flags.PixelPerfect;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public float width
+ {
+ get
+ {
+ EnsureSizeCorrect();
+ return _contentRect.width;
+ }
+ set
+ {
+ if (!Mathf.Approximately(value, _contentRect.width))
+ {
+ _contentRect.width = value;
+ _flags |= Flags.WidthChanged;
+ _flags &= ~Flags.HeightChanged;
+ OnSizeChanged();
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ public float height
+ {
+ get
+ {
+ EnsureSizeCorrect();
+ return _contentRect.height;
+ }
+ set
+ {
+ if (!Mathf.Approximately(value, _contentRect.height))
+ {
+ _contentRect.height = value;
+ _flags &= ~Flags.WidthChanged;
+ _flags |= Flags.HeightChanged;
+ OnSizeChanged();
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ public Vector2 size
+ {
+ get
+ {
+ EnsureSizeCorrect();
+ return _contentRect.size;
+ }
+ set
+ {
+ SetSize(value.x, value.y);
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetSize(float wv, float hv)
+ {
+ if (!Mathf.Approximately(wv, _contentRect.width))
+ _flags |= Flags.WidthChanged;
+ else
+ _flags &= ~Flags.WidthChanged;
+ if (!Mathf.Approximately(hv, _contentRect.height))
+ _flags |= Flags.HeightChanged;
+ else
+ _flags &= ~Flags.HeightChanged;
+
+ if ((_flags & Flags.WidthChanged) != 0 || (_flags & Flags.HeightChanged) != 0)
+ {
+ _contentRect.width = wv;
+ _contentRect.height = hv;
+ OnSizeChanged();
+ }
+ }
+
+ virtual public void EnsureSizeCorrect()
+ {
+ }
+
+ virtual protected void OnSizeChanged()
+ {
+ ApplyPivot();
+
+ if (_paintingInfo != null)
+ _paintingInfo.flag = 1;
+ if (graphics != null)
+ graphics.contentRect = _contentRect;
+ _flags |= Flags.OutlineChanged;
+ }
+
+ ///
+ ///
+ ///
+ public float scaleX
+ {
+ get { return cachedTransform.localScale.x; }
+ set
+ {
+ Vector3 v = cachedTransform.localScale;
+ v.x = v.z = ValidateScale(value);
+ cachedTransform.localScale = v;
+ _flags |= Flags.OutlineChanged;
+ ApplyPivot();
+ }
+ }
+
+ ///
+ ///
+ ///
+ public float scaleY
+ {
+ get { return cachedTransform.localScale.y; }
+ set
+ {
+ Vector3 v = cachedTransform.localScale;
+ v.y = ValidateScale(value);
+ cachedTransform.localScale = v;
+ _flags |= Flags.OutlineChanged;
+ ApplyPivot();
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetScale(float xv, float yv)
+ {
+ Vector3 v = new Vector3();
+ v.x = v.z = ValidateScale(xv);
+ v.y = ValidateScale(yv);
+ cachedTransform.localScale = v;
+ _flags |= Flags.OutlineChanged;
+ ApplyPivot();
+ }
+
+ ///
+ /// 在scale过小情况(极端情况=0),当使用Transform的坐标变换时,变换到世界,再从世界变换到本地,会由于精度问题造成结果错误。
+ /// 这种错误会导致Batching错误,因为Batching会使用缓存的outline。
+ /// 这里限制一下scale的最小值作为当前解决方案。
+ /// 这个方案并不完美,因为限制了本地scale值并不能保证对世界scale不会过小。
+ ///
+ ///
+ ///
+ private float ValidateScale(float value)
+ {
+ if (value >= 0 && value < 0.001f)
+ value = 0.001f;
+ else if (value < 0 && value > -0.001f)
+ value = -0.001f;
+ return value;
+ }
+
+ ///
+ ///
+ ///
+ public Vector2 scale
+ {
+ get { return cachedTransform.localScale; }
+ set
+ {
+ SetScale(value.x, value.y);
+ }
+ }
+
+ ///
+ ///
+ ///
+ public float rotation
+ {
+ get
+ {
+ //和Unity默认的旋转方向相反
+ return -_rotation.z;
+ }
+ set
+ {
+ _rotation.z = -value;
+ _flags |= Flags.OutlineChanged;
+ if (_perspective)
+ UpdateTransformMatrix();
+ else
+ {
+ cachedTransform.localEulerAngles = _rotation;
+ ApplyPivot();
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ public float rotationX
+ {
+ get
+ {
+ return _rotation.x;
+ }
+ set
+ {
+ _rotation.x = value;
+ _flags |= Flags.OutlineChanged;
+ if (_perspective)
+ UpdateTransformMatrix();
+ else
+ {
+ cachedTransform.localEulerAngles = _rotation;
+ ApplyPivot();
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ public float rotationY
+ {
+ get
+ {
+ return _rotation.y;
+ }
+ set
+ {
+ _rotation.y = value;
+ _flags |= Flags.OutlineChanged;
+ if (_perspective)
+ UpdateTransformMatrix();
+ else
+ {
+ cachedTransform.localEulerAngles = _rotation;
+ ApplyPivot();
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ public Vector2 skew
+ {
+ get { return _skew; }
+ set
+ {
+ _skew = value;
+ _flags |= Flags.OutlineChanged;
+
+ if (!Application.isPlaying) //编辑期间不支持!!
+ return;
+
+ UpdateTransformMatrix();
+ }
+ }
+
+ ///
+ /// 当对象处于ScreenSpace,也就是使用正交相机渲染时,对象虽然可以绕X轴或者Y轴旋转,但没有透视效果。设置perspective,可以模拟出透视效果。
+ ///
+ public bool perspective
+ {
+ get
+ {
+ return _perspective;
+ }
+ set
+ {
+ if (_perspective != value)
+ {
+ _perspective = value;
+ if (_perspective)//屏蔽Unity自身的旋转变换
+ cachedTransform.localEulerAngles = Vector3.zero;
+ else
+ cachedTransform.localEulerAngles = _rotation;
+
+ ApplyPivot();
+ UpdateTransformMatrix();
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ public int focalLength
+ {
+ get { return _focalLength; }
+ set
+ {
+ if (value <= 0)
+ value = 1;
+
+ _focalLength = value;
+ if (_vertexMatrix != null)
+ UpdateTransformMatrix();
+ }
+ }
+
+ void UpdateTransformMatrix()
+ {
+ Matrix4x4 matrix = Matrix4x4.identity;
+ if (_skew.x != 0 || _skew.y != 0)
+ ToolSet.SkewMatrix(ref matrix, _skew.x, _skew.y);
+ if (_perspective)
+ matrix *= Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(_rotation), Vector3.one);
+ if (matrix.isIdentity)
+ _vertexMatrix = null;
+ else if (_vertexMatrix == null)
+ _vertexMatrix = new NGraphics.VertexMatrix();
+
+ //组件的transformMatrix是通过paintingMode实现的,因为全部通过矩阵变换的话,和unity自身的变换混杂在一起,无力理清。
+ if (_vertexMatrix != null)
+ {
+ _vertexMatrix.matrix = matrix;
+ _vertexMatrix.cameraPos = new Vector3(_pivot.x * _contentRect.width, -_pivot.y * _contentRect.height, _focalLength);
+
+ if (graphics == null)
+ EnterPaintingMode(4, null);
+ }
+ else
+ {
+ if (graphics == null)
+ LeavePaintingMode(4);
+ }
+
+ if (_paintingMode > 0)
+ {
+ paintingGraphics.vertexMatrix = _vertexMatrix;
+ _paintingInfo.flag = 1;
+ }
+ else if (graphics != null)
+ graphics.vertexMatrix = _vertexMatrix;
+
+ _flags |= Flags.OutlineChanged;
+ }
+
+ ///
+ ///
+ ///
+ public Vector2 pivot
+ {
+ get { return _pivot; }
+ set
+ {
+ Vector3 deltaPivot = new Vector2((value.x - _pivot.x) * _contentRect.width, (_pivot.y - value.y) * _contentRect.height);
+ Vector3 oldOffset = _pivotOffset;
+
+ _pivot = value;
+ UpdatePivotOffset();
+ Vector3 v = cachedTransform.localPosition;
+ v += oldOffset - _pivotOffset + deltaPivot;
+ cachedTransform.localPosition = v;
+ _flags |= Flags.OutlineChanged;
+ }
+ }
+
+ void UpdatePivotOffset()
+ {
+ float px = _pivot.x * _contentRect.width;
+ float py = _pivot.y * _contentRect.height;
+
+ //注意这里不用处理skew,因为在顶点变换里有对pivot的处理
+ Matrix4x4 matrix = Matrix4x4.TRS(Vector3.zero, cachedTransform.localRotation, cachedTransform.localScale);
+ _pivotOffset = matrix.MultiplyPoint(new Vector3(px, -py, 0));
+
+ if (_vertexMatrix != null)
+ _vertexMatrix.cameraPos = new Vector3(_pivot.x * _contentRect.width, -_pivot.y * _contentRect.height, _focalLength);
+ }
+
+ void ApplyPivot()
+ {
+ if (_pivot.x != 0 || _pivot.y != 0)
+ {
+ Vector3 oldOffset = _pivotOffset;
+
+ UpdatePivotOffset();
+ Vector3 v = cachedTransform.localPosition;
+
+ if ((_flags & Flags.PixelPerfect) != 0)
+ {
+ v -= _pixelPerfectAdjustment;
+ _checkPixelPerfect = Time.frameCount;
+ _pixelPerfectAdjustment = Vector3.zero;
+ }
+
+ v += oldOffset - _pivotOffset;
+ cachedTransform.localPosition = v;
+ _flags |= Flags.OutlineChanged;
+ }
+ }
+
+ ///
+ /// This is the pivot position
+ ///
+ public Vector3 location
+ {
+ get
+ {
+ Vector3 pos = this.position;
+ pos.x += _pivotOffset.x;
+ pos.y -= _pivotOffset.y;
+ pos.z += _pivotOffset.z;
+ return pos;
+ }
+
+ set
+ {
+ this.SetPosition(value.x - _pivotOffset.x, value.y + _pivotOffset.y, value.z - _pivotOffset.z);
+ }
+ }
+
+ ///
+ ///
+ ///
+ virtual public Material material
+ {
+ get
+ {
+ if (graphics != null)
+ return graphics.material;
+ else
+ return null;
+ }
+ set
+ {
+ if (graphics != null)
+ graphics.material = value;
+ }
+ }
+
+ ///
+ ///
+ ///
+ virtual public string shader
+ {
+ get
+ {
+ if (graphics != null)
+ return graphics.shader;
+ else
+ return null;
+ }
+ set
+ {
+ if (graphics != null)
+ graphics.shader = value;
+ }
+ }
+
+ ///
+ ///
+ ///
+ virtual public int renderingOrder
+ {
+ get
+ {
+ return _renderingOrder;
+ }
+ set
+ {
+ if ((_flags & Flags.GameObjectDisposed) != 0)
+ {
+ DisplayDisposedWarning();
+ return;
+ }
+
+ _renderingOrder = value;
+ if (graphics != null)
+ graphics.sortingOrder = value;
+ if (_paintingMode > 0)
+ paintingGraphics.sortingOrder = value;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public int layer
+ {
+ get
+ {
+ if (_paintingMode > 0)
+ return paintingGraphics.gameObject.layer;
+ else
+ return gameObject.layer;
+ }
+ set
+ {
+ SetLayer(value, false);
+ }
+ }
+
+ ///
+ /// If the object can be focused?
+ ///
+ public bool focusable
+ {
+ get { return (_flags & Flags.NotFocusable) == 0; }
+ set
+ {
+ if (value)
+ _flags &= ~Flags.NotFocusable;
+ else
+ _flags |= Flags.NotFocusable;
+ }
+ }
+
+ ///
+ /// If the object can be navigated by TAB?
+ ///
+ public bool tabStop
+ {
+ get { return (_flags & Flags.TabStop) != 0; }
+ set
+ {
+ if (value)
+ _flags |= Flags.TabStop;
+ else
+ _flags &= ~Flags.TabStop;
+ }
+ }
+
+ ///
+ /// If the object focused?
+ ///
+ public bool focused
+ {
+ get
+ {
+ return Stage.inst.focus == this || (this is Container) && ((Container)this).IsAncestorOf(Stage.inst.focus);
+ }
+ }
+
+ internal bool _AcceptTab()
+ {
+ if (_touchable && _visible
+ && ((_flags & Flags.TabStop) != 0 || (_flags & Flags.TabStopChildren) != 0)
+ && (_flags & Flags.NotFocusable) == 0)
+ {
+ Stage.inst.SetFocus(this, true);
+ return true;
+ }
+ else
+ return false;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public string cursor
+ {
+ get { return _cursor; }
+ set
+ {
+ _cursor = value;
+ if (Application.isPlaying
+ && (this == Stage.inst.touchTarget || (this is Container) && ((Container)this).IsAncestorOf(Stage.inst.touchTarget)))
+ {
+ Stage.inst._ChangeCursor(_cursor);
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ public bool isDisposed
+ {
+ get { return (_flags & Flags.Disposed) != 0 || gameObject == null; }
+ }
+
+ internal void InternalSetParent(Container value)
+ {
+ if (parent != value)
+ {
+ if (value == null && (parent._flags & Flags.Disposed) != 0)
+ parent = value;
+ else
+ {
+ parent = value;
+ UpdateHierarchy();
+ }
+ _flags |= Flags.OutlineChanged;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public Container topmost
+ {
+ get
+ {
+ DisplayObject currentObject = this;
+ while (currentObject.parent != null)
+ currentObject = currentObject.parent;
+ return currentObject as Container;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public Stage stage
+ {
+ get
+ {
+ return topmost as Stage;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public Container worldSpaceContainer
+ {
+ get
+ {
+ Container wsc = null;
+ DisplayObject currentObject = this;
+ while (currentObject.parent != null)
+ {
+ if ((currentObject is Container) && ((Container)currentObject).renderMode == RenderMode.WorldSpace)
+ {
+ wsc = (Container)currentObject;
+ break;
+ }
+ currentObject = currentObject.parent;
+ }
+
+ return wsc;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public bool touchable
+ {
+ get { return _touchable; }
+ set
+ {
+ if (_touchable != value)
+ {
+ _touchable = value;
+ if (this is Container)
+ {
+ ColliderHitTest hitArea = ((Container)this).hitArea as ColliderHitTest;
+ if (hitArea != null)
+ hitArea.collider.enabled = value;
+ }
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public bool touchDisabled
+ {
+ get { return (_flags & Flags.TouchDisabled) != 0; }
+ }
+
+ ///
+ /// 进入绘画模式,整个对象将画到一张RenderTexture上,然后这种贴图将代替原有的显示内容。
+ /// 可以在onPaint回调里对这张纹理进行进一步操作,实现特殊效果。
+ ///
+ public void EnterPaintingMode()
+ {
+ EnterPaintingMode(16384, null, 1);
+ }
+
+ ///
+ /// 进入绘画模式,整个对象将画到一张RenderTexture上,然后这种贴图将代替原有的显示内容。
+ /// 可以在onPaint回调里对这张纹理进行进一步操作,实现特殊效果。
+ /// 可能有多个地方要求进入绘画模式,这里用requestorId加以区别,取值是1、2、4、8、16以此类推。1024内内部保留。用户自定义的id从1024开始。
+ ///
+ /// 请求者id
+ /// 纹理四周的留空。如果特殊处理后的内容大于原内容,那么这里的设置可以使纹理扩大。
+ public void EnterPaintingMode(int requestorId, Margin? extend)
+ {
+ EnterPaintingMode(requestorId, extend, 1);
+ }
+
+ ///
+ /// 进入绘画模式,整个对象将画到一张RenderTexture上,然后这种贴图将代替原有的显示内容。
+ /// 可以在onPaint回调里对这张纹理进行进一步操作,实现特殊效果。
+ /// 可能有多个地方要求进入绘画模式,这里用requestorId加以区别,取值是1、2、4、8、16以此类推。1024内内部保留。用户自定义的id从1024开始。
+ ///
+ /// 请求者id
+ /// 扩展纹理。如果特殊处理后的内容大于原内容,那么这里的设置可以使纹理扩大。
+ /// 附加一个缩放系数
+ public void EnterPaintingMode(int requestorId, Margin? extend, float scale)
+ {
+ bool first = _paintingMode == 0;
+ _paintingMode |= requestorId;
+ if (first)
+ {
+ if (_paintingInfo == null)
+ {
+ _paintingInfo = new PaintingInfo()
+ {
+ captureDelegate = Capture,
+ scale = 1
+ };
+ }
+
+ if (paintingGraphics == null)
+ {
+ if (graphics == null)
+ paintingGraphics = new NGraphics(this.gameObject);
+ else
+ {
+ GameObject go = new GameObject(this.gameObject.name + " (Painter)");
+ go.layer = this.gameObject.layer;
+ go.transform.SetParent(cachedTransform, false);
+ go.hideFlags = DisplayObject.hideFlags;
+ paintingGraphics = new NGraphics(go);
+ }
+ }
+ else
+ paintingGraphics.enabled = true;
+ paintingGraphics.vertexMatrix = null;
+
+ if (this is Container)
+ {
+ ((Container)this).SetChildrenLayer(CaptureCamera.hiddenLayer);
+ ((Container)this).UpdateBatchingFlags();
+ }
+ else
+ this.InvalidateBatchingState();
+
+ if (graphics != null)
+ this.gameObject.layer = CaptureCamera.hiddenLayer;
+ }
+ if (extend != null)
+ _paintingInfo.extend = (Margin)extend;
+ _paintingInfo.scale = scale;
+ _paintingInfo.flag = 1;
+ }
+
+ ///
+ /// 离开绘画模式
+ ///
+ ///
+ public void LeavePaintingMode(int requestorId)
+ {
+ if (_paintingMode == 0 || (_flags & Flags.Disposed) != 0)
+ return;
+
+ _paintingMode ^= requestorId;
+ if (_paintingMode == 0)
+ {
+ paintingGraphics.enabled = false;
+
+ if (this is Container)
+ {
+ ((Container)this).SetChildrenLayer(this.layer);
+ ((Container)this).UpdateBatchingFlags();
+ }
+ else
+ this.InvalidateBatchingState();
+
+ if (graphics != null)
+ this.gameObject.layer = paintingGraphics.gameObject.layer;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public bool paintingMode
+ {
+ get { return _paintingMode > 0; }
+ }
+
+ ///
+ /// 将整个显示对象(如果是容器,则容器包含的整个显示列表)静态化,所有内容被缓冲到一张纹理上。
+ /// DC将保持为1。CPU消耗将降到最低。但对象的任何变化不会更新。
+ /// 当cacheAsBitmap已经为true时,再次调用cacheAsBitmap=true将会刷新对象一次。
+ ///
+ public bool cacheAsBitmap
+ {
+ get { return (_flags & Flags.CacheAsBitmap) != 0; }
+ set
+ {
+ if (value)
+ {
+ _flags |= Flags.CacheAsBitmap;
+ EnterPaintingMode(8, null, UIContentScaler.scaleFactor);
+ }
+ else
+ {
+ _flags &= ~Flags.CacheAsBitmap;
+ LeavePaintingMode(8);
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Texture2D GetScreenShot(Margin? extend, float scale)
+ {
+ EnterPaintingMode(8, null, scale);
+ UpdatePainting();
+ Capture();
+
+ Texture2D output;
+ if (paintingGraphics.texture == null)
+ output = new Texture2D(1, 1, TextureFormat.RGBA32, false, true);
+ else
+ {
+ RenderTexture rt = (RenderTexture)paintingGraphics.texture.nativeTexture;
+ output = new Texture2D(rt.width, rt.height, TextureFormat.RGBA32, false, true);
+ RenderTexture old = RenderTexture.active;
+ RenderTexture.active = rt;
+ output.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0);
+ output.Apply();
+ RenderTexture.active = old;
+ }
+
+ LeavePaintingMode(8);
+
+ return output;
+ }
+
+ ///
+ ///
+ ///
+ public IFilter filter
+ {
+ get
+ {
+ return _filter;
+ }
+
+ set
+ {
+ if (!Application.isPlaying) //编辑期间不支持!!
+ return;
+
+ if (value == _filter)
+ return;
+
+ if (_filter != null)
+ _filter.Dispose();
+
+ if (value != null && value.target != null)
+ value.target.filter = null;
+
+ _filter = value;
+ if (_filter != null)
+ _filter.target = this;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public BlendMode blendMode
+ {
+ get { return _blendMode; }
+ set
+ {
+ _blendMode = value;
+ InvalidateBatchingState();
+
+ if (graphics == null)
+ {
+ if (_blendMode != BlendMode.Normal)
+ {
+ if (!Application.isPlaying) //Not supported in edit mode!
+ return;
+
+ EnterPaintingMode(2, null);
+ paintingGraphics.blendMode = _blendMode;
+ }
+ else
+ LeavePaintingMode(2);
+ }
+ else
+ graphics.blendMode = _blendMode;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ virtual public Rect GetBounds(DisplayObject targetSpace)
+ {
+ EnsureSizeCorrect();
+
+ if (targetSpace == this) // optimization
+ {
+ return _contentRect;
+ }
+ else if (targetSpace == parent && _rotation.z == 0)
+ {
+ return new Rect(cachedTransform.localPosition.x, -cachedTransform.localPosition.y,
+ _contentRect.width * cachedTransform.localScale.x, _contentRect.height * cachedTransform.localScale.y);
+ }
+ else
+ return TransformRect(_contentRect, targetSpace);
+ }
+
+ internal DisplayObject InternalHitTest()
+ {
+ if (_visible && (!HitTestContext.forTouch || _touchable))
+ return HitTest();
+ else
+ return null;
+ }
+
+ internal DisplayObject InternalHitTestMask()
+ {
+ if (_visible)
+ return HitTest();
+ else
+ return null;
+ }
+
+ virtual protected DisplayObject HitTest()
+ {
+ Rect rect = GetBounds(this);
+ if (rect.width == 0 || rect.height == 0)
+ return null;
+
+ Vector2 localPoint = WorldToLocal(HitTestContext.worldPoint, HitTestContext.direction);
+ if (rect.Contains(localPoint))
+ return this;
+ else
+ return null;
+ }
+
+ ///
+ /// 将舞台坐标转换为本地坐标
+ ///
+ ///
+ ///
+ public Vector2 GlobalToLocal(Vector2 point)
+ {
+ Container wsc = this.worldSpaceContainer;
+
+ if (wsc != null)//I am in a world space
+ {
+ Camera cam = wsc.GetRenderCamera();
+ Vector3 worldPoint;
+ Vector3 direction;
+ Vector3 screenPoint = new Vector3();
+ screenPoint.x = point.x;
+ screenPoint.y = Screen.height - point.y;
+
+ if (wsc.hitArea is MeshColliderHitTest)
+ {
+ Ray ray = cam.ScreenPointToRay(screenPoint);
+ RaycastHit hit;
+ if (((MeshColliderHitTest)wsc.hitArea).collider.Raycast(ray, out hit, 100))
+ {
+ point = new Vector2(hit.textureCoord.x * _contentRect.width, (1 - hit.textureCoord.y) * _contentRect.height);
+ worldPoint = Stage.inst.cachedTransform.TransformPoint(point.x, -point.y, 0);
+ direction = Vector3.back;
+ }
+ else //当射线没有击中模型时,无法确定本地坐标
+ return new Vector2(float.NaN, float.NaN);
+ }
+ else
+ {
+ screenPoint.z = cam.WorldToScreenPoint(this.cachedTransform.position).z;
+ worldPoint = cam.ScreenToWorldPoint(screenPoint);
+ Ray ray = cam.ScreenPointToRay(screenPoint);
+ direction = Vector3.zero - ray.direction;
+ }
+
+ return this.WorldToLocal(worldPoint, direction);
+ }
+ else //I am in stage space
+ {
+ Vector3 worldPoint = Stage.inst.cachedTransform.TransformPoint(point.x, -point.y, 0);
+ return this.WorldToLocal(worldPoint, Vector3.back);
+ }
+ }
+
+ ///
+ /// 将本地坐标转换为舞台坐标
+ ///
+ ///
+ ///
+ public Vector2 LocalToGlobal(Vector2 point)
+ {
+ Container wsc = this.worldSpaceContainer;
+
+ Vector3 worldPoint = this.cachedTransform.TransformPoint(point.x, -point.y, 0);
+ if (wsc != null)
+ {
+ if (wsc.hitArea is MeshColliderHitTest) //Not supported for UIPainter, use TransfromPoint instead.
+ return new Vector2(float.NaN, float.NaN);
+
+ Vector3 screePoint = wsc.GetRenderCamera().WorldToScreenPoint(worldPoint);
+ return new Vector2(screePoint.x, Stage.inst.size.y - screePoint.y);
+ }
+ else
+ {
+ point = Stage.inst.cachedTransform.InverseTransformPoint(worldPoint);
+ point.y = -point.y;
+ return point;
+ }
+ }
+
+ ///
+ /// 转换世界坐标点到等效的本地xy平面的点。等效的意思是他们在屏幕方向看到的位置一样。
+ /// 返回的点是在对象的本地坐标空间,且z=0
+ ///
+ ///
+ ///
+ ///
+ public Vector3 WorldToLocal(Vector3 worldPoint, Vector3 direction)
+ {
+ Vector3 localPoint = this.cachedTransform.InverseTransformPoint(worldPoint);
+ if (localPoint.z != 0) //如果对象绕x轴或y轴旋转过,或者对象是在透视相机,那么z值可能不为0,
+ {
+ //将世界坐标的摄影机方向在本地空间上投射,求出与xy平面的交点
+ direction = this.cachedTransform.InverseTransformDirection(direction);
+ float distOnLine = Vector3.Dot(Vector3.zero - localPoint, Vector3.forward) / Vector3.Dot(direction, Vector3.forward);
+ if (float.IsInfinity(distOnLine))
+ return Vector2.zero;
+
+ localPoint = localPoint + direction * distOnLine;
+ }
+ else if (_vertexMatrix != null)
+ {
+ Vector3 center = _vertexMatrix.cameraPos;
+ center.z = 0;
+ center -= _vertexMatrix.matrix.MultiplyPoint(center);
+
+ Matrix4x4 mm = _vertexMatrix.matrix.inverse;
+
+ localPoint -= center;
+ localPoint = mm.MultiplyPoint(localPoint);
+
+ Vector3 camPos = mm.MultiplyPoint(_vertexMatrix.cameraPos);
+ Vector3 vec = localPoint - camPos;
+ float lambda = -camPos.z / vec.z;
+ localPoint = camPos + lambda * vec;
+ localPoint.z = 0;
+ }
+ localPoint.y = -localPoint.y;
+
+ return localPoint;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Vector3 LocalToWorld(Vector3 localPoint)
+ {
+ localPoint.y = -localPoint.y;
+ if (_vertexMatrix != null)
+ {
+ Vector3 center = _vertexMatrix.cameraPos;
+ center.z = 0;
+ center -= _vertexMatrix.matrix.MultiplyPoint(center);
+
+ localPoint = _vertexMatrix.matrix.MultiplyPoint(localPoint);
+ localPoint += center;
+
+ Vector3 camPos = _vertexMatrix.cameraPos;
+ Vector3 vec = localPoint - camPos;
+ float lambda = -camPos.z / vec.z;
+ localPoint = camPos + lambda * vec;
+ localPoint.z = 0;
+ }
+
+ return this.cachedTransform.TransformPoint(localPoint);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ /// null if to world space
+ ///
+ public Vector2 TransformPoint(Vector2 point, DisplayObject targetSpace)
+ {
+ if (targetSpace == this)
+ return point;
+
+ point = LocalToWorld(point);
+ if (targetSpace != null)
+ point = targetSpace.WorldToLocal(point, Vector3.back);
+
+ return point;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ /// null if to world space
+ ///
+ public Rect TransformRect(Rect rect, DisplayObject targetSpace)
+ {
+ if (targetSpace == this)
+ return rect;
+
+ if (targetSpace == parent && _rotation.z == 0) // optimization
+ {
+ Vector3 vec = cachedTransform.localScale;
+ return new Rect((this.x + rect.x) * vec.x, (this.y + rect.y) * vec.y,
+ rect.width * vec.x, rect.height * vec.y);
+ }
+ else
+ {
+ Vector4 vec4 = new Vector4(float.MaxValue, float.MaxValue, float.MinValue, float.MinValue);
+
+ TransformRectPoint(rect.xMin, rect.yMin, targetSpace, ref vec4);
+ TransformRectPoint(rect.xMax, rect.yMin, targetSpace, ref vec4);
+ TransformRectPoint(rect.xMin, rect.yMax, targetSpace, ref vec4);
+ TransformRectPoint(rect.xMax, rect.yMax, targetSpace, ref vec4);
+
+ return Rect.MinMaxRect(vec4.x, vec4.y, vec4.z, vec4.w);
+ }
+ }
+
+ protected void TransformRectPoint(float px, float py, DisplayObject targetSpace, ref Vector4 vec4)
+ {
+ Vector2 v = TransformPoint(new Vector2(px, py), targetSpace);
+
+ if (vec4.x > v.x) vec4.x = v.x;
+ if (vec4.z < v.x) vec4.z = v.x;
+ if (vec4.y > v.y) vec4.y = v.y;
+ if (vec4.w < v.y) vec4.w = v.y;
+ }
+
+ ///
+ ///
+ ///
+ public void RemoveFromParent()
+ {
+ if (parent != null)
+ parent.RemoveChild(this);
+ }
+
+ ///
+ ///
+ ///
+ public void InvalidateBatchingState()
+ {
+ if (parent != null)
+ parent.InvalidateBatchingState(true);
+ }
+
+ virtual public void Update(UpdateContext context)
+ {
+ if (_checkPixelPerfect != 0)
+ {
+ if (_rotation == Vector3.zero)
+ {
+ Vector3 v = cachedTransform.localPosition;
+ v.x = Mathf.Round(v.x);
+ v.y = Mathf.Round(v.y);
+ _pixelPerfectAdjustment = v - cachedTransform.localPosition;
+ if (_pixelPerfectAdjustment != Vector3.zero)
+ cachedTransform.localPosition = v;
+ }
+ _checkPixelPerfect = 0;
+ }
+
+ if (graphics != null)
+ graphics.Update(context, context.alpha * _alpha, context.grayed | _grayed);
+
+ if (_paintingMode != 0)
+ {
+ UpdatePainting();
+
+ //如果是容器,Capture要等到Container.Update的最后执行,因为容器中可能也有需要Capture的内容,要等他们完成后再进行容器的Capture。
+ if (!(this is Container))
+ {
+ if ((_flags & Flags.CacheAsBitmap) == 0 || _paintingInfo.flag != 2)
+ UpdateContext.OnEnd += _paintingInfo.captureDelegate;
+ }
+
+ paintingGraphics.Update(context, 1, false);
+ }
+
+ if (_filter != null)
+ _filter.Update();
+
+ Stats.ObjectCount++;
+ }
+
+ void UpdatePainting()
+ {
+ NTexture paintingTexture = paintingGraphics.texture;
+ if (paintingTexture != null && paintingTexture.disposed) //Texture可能已被Stage.MonitorTexture销毁
+ {
+ paintingTexture = null;
+ _paintingInfo.flag = 1;
+ }
+
+ if (_paintingInfo.flag == 1)
+ {
+ _paintingInfo.flag = 0;
+
+ //从优化考虑,决定使用绘画模式的容器都需要明确指定大小,而不是自动计算包围。这在UI使用上并没有问题,因为组件总是有固定大小的
+ Margin extend = _paintingInfo.extend;
+ paintingGraphics.contentRect = new Rect(-extend.left, -extend.top, _contentRect.width + extend.left + extend.right, _contentRect.height + extend.top + extend.bottom);
+ int textureWidth = Mathf.RoundToInt(paintingGraphics.contentRect.width * _paintingInfo.scale);
+ int textureHeight = Mathf.RoundToInt(paintingGraphics.contentRect.height * _paintingInfo.scale);
+ if (paintingTexture == null || paintingTexture.width != textureWidth || paintingTexture.height != textureHeight)
+ {
+ if (paintingTexture != null)
+ paintingTexture.Dispose();
+ if (textureWidth > 0 && textureHeight > 0)
+ {
+ paintingTexture = new NTexture(CaptureCamera.CreateRenderTexture(textureWidth, textureHeight, UIConfig.depthSupportForPaintingMode));
+ Stage.inst.MonitorTexture(paintingTexture);
+ }
+ else
+ paintingTexture = null;
+ paintingGraphics.texture = paintingTexture;
+ }
+ }
+
+ if (paintingTexture != null)
+ paintingTexture.lastActive = Time.time;
+ }
+
+ void Capture()
+ {
+ if (paintingGraphics.texture == null)
+ return;
+
+ Vector2 offset = new Vector2(_paintingInfo.extend.left, _paintingInfo.extend.top);
+ CaptureCamera.Capture(this, (RenderTexture)paintingGraphics.texture.nativeTexture, paintingGraphics.contentRect.height, offset);
+
+ _paintingInfo.flag = 2; //2表示已完成一次Capture
+ if (onPaint != null)
+ onPaint();
+ }
+
+ ///
+ /// 为对象设置一个默认的父Transform。当对象不在显示列表里时,它的GameObject挂到哪里。
+ ///
+ public Transform home
+ {
+ get { return _home; }
+ set
+ {
+ _home = value;
+ if (value != null && cachedTransform.parent == null)
+ cachedTransform.SetParent(value, false);
+ }
+ }
+
+ void UpdateHierarchy()
+ {
+ if ((_flags & Flags.GameObjectDisposed) != 0)
+ return;
+
+ if ((_flags & Flags.UserGameObject) != 0)
+ {
+ //we dont change transform parent of this object
+ if (gameObject != null)
+ {
+ if (parent != null && visible)
+ gameObject.SetActive(true);
+ else
+ gameObject.SetActive(false);
+ }
+ }
+ else if (parent != null)
+ {
+ cachedTransform.SetParent(parent.cachedTransform, false);
+
+ if (_visible)
+ gameObject.SetActive(true);
+
+ int layerValue = parent.gameObject.layer;
+ if (parent._paintingMode != 0)
+ layerValue = CaptureCamera.hiddenLayer;
+ SetLayer(layerValue, true);
+ }
+ else if ((_flags & Flags.Disposed) == 0 && this.gameObject != null && !StageEngine.beingQuit)
+ {
+ if (Application.isPlaying)
+ {
+ if (gOwner == null || gOwner.parent == null)//如果gOwner还有parent的话,说明只是暂时的隐藏
+ {
+ cachedTransform.SetParent(_home, false);
+ if (_home == null)
+ UnityEngine.Object.DontDestroyOnLoad(this.gameObject);
+ }
+ }
+
+ gameObject.SetActive(false);
+ }
+ }
+
+ virtual protected bool SetLayer(int value, bool fromParent)
+ {
+ if ((_flags & Flags.LayerSet) != 0) //setted
+ {
+ if (fromParent)
+ return false;
+ }
+ else if ((_flags & Flags.LayerFromParent) != 0) //inherit from parent
+ {
+ if (!fromParent)
+ _flags |= Flags.LayerSet;
+ }
+ else
+ {
+ if (fromParent)
+ _flags |= Flags.LayerFromParent;
+ else
+ _flags |= Flags.LayerSet;
+ }
+
+ if (_paintingMode > 0)
+ paintingGraphics.gameObject.layer = value;
+ else if (gameObject.layer != value)
+ {
+ gameObject.layer = value;
+ if ((this is Container))
+ {
+ int cnt = ((Container)this).numChildren;
+ for (int i = 0; i < cnt; i++)
+ {
+ DisplayObject child = ((Container)this).GetChildAt(i);
+ child.SetLayer(value, true);
+ }
+ }
+ }
+
+ return true;
+ }
+
+ internal void _SetLayerDirect(int value)
+ {
+ if (_paintingMode > 0)
+ paintingGraphics.gameObject.layer = value;
+ else
+ gameObject.layer = value;
+ }
+
+ virtual public void Dispose()
+ {
+ if ((_flags & Flags.Disposed) != 0)
+ return;
+
+ _flags |= Flags.Disposed;
+ RemoveFromParent();
+ RemoveEventListeners();
+ if (graphics != null)
+ graphics.Dispose();
+ if (_filter != null)
+ _filter.Dispose();
+ if (paintingGraphics != null)
+ {
+ if (paintingGraphics.texture != null)
+ paintingGraphics.texture.Dispose();
+
+ paintingGraphics.Dispose();
+ if (paintingGraphics.gameObject != this.gameObject)
+ {
+ if (Application.isPlaying)
+ UnityEngine.Object.Destroy(paintingGraphics.gameObject);
+ else
+ UnityEngine.Object.DestroyImmediate(paintingGraphics.gameObject);
+ }
+ }
+ DestroyGameObject();
+ }
+
+ internal void DisplayDisposedWarning()
+ {
+ if ((_flags & Flags.DisposedWarning) == 0)
+ {
+ _flags |= Flags.DisposedWarning;
+
+ StringBuilder sb = new StringBuilder();
+ sb.Append("DisplayObject is still in use but GameObject was disposed. (");
+ if (gOwner != null)
+ {
+ sb.Append("type=").Append(gOwner.GetType().Name).Append(", x=").Append(gOwner.x).Append(", y=").Append(gOwner.y).Append(", name=").Append(gOwner.name);
+ if (gOwner.packageItem != null)
+ sb.Append(", res=" + gOwner.packageItem.name);
+ }
+ else
+ {
+ sb.Append("id=").Append(id).Append(", type=").Append(this.GetType().Name).Append(", name=").Append(name);
+ }
+ sb.Append(")");
+ Debug.LogError(sb.ToString());
+ }
+ }
+
+ protected internal class PaintingInfo
+ {
+ public Action captureDelegate; //缓存这个delegate,可以防止Capture状态下每帧104B的GC
+ public Margin extend;
+ public float scale;
+ public int flag;
+ }
+
+ [Flags]
+ protected internal enum Flags
+ {
+ Disposed = 1,
+ UserGameObject = 2,
+ TouchDisabled = 4,
+ OutlineChanged = 8,
+ UpdatingSize = 0x10,
+ WidthChanged = 0x20,
+ HeightChanged = 0x40,
+ PixelPerfect = 0x80,
+ LayerSet = 0x100,
+ LayerFromParent = 0x200,
+ NotFocusable = 0x400,
+ TabStop = 0x800,
+ TabStopChildren = 0x1000,
+ FairyBatching = 0x2000,
+ BatchingRequested = 0x4000,
+ BatchingRoot = 0x8000,
+ SkipBatching = 0x10000,
+ CacheAsBitmap = 0x20000,
+ GameObjectDisposed = 0x40000,
+ DisposedWarning = 0x80000
+ }
+ }
+
+ ///
+ ///
+ ///
+ public class DisplayObjectInfo : MonoBehaviour
+ {
+ ///
+ ///
+ /// ///
+ [System.NonSerialized]
+ public DisplayObject displayObject;
+
+ private void OnDestroy()
+ {
+ if (displayObject != null)
+ displayObject._flags |= DisplayObject.Flags.GameObjectDisposed;
+ }
+ }
+}
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/DisplayObject.cs.meta b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/DisplayObject.cs.meta
new file mode 100644
index 00000000..6fcef79e
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/DisplayObject.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 24d09ba8cf3faa74f8dcd1c86ad38588
+timeCreated: 1535374214
+licenseType: Store
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/GoWrapper.cs b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/GoWrapper.cs
new file mode 100644
index 00000000..e3dbdd0e
--- /dev/null
+++ b/JNFrame2/Assets/Plugins/FairyGUI/Runtime/Scripts/Core/GoWrapper.cs
@@ -0,0 +1,393 @@
+using UnityEngine;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine.Pool;
+
+namespace FairyGUI
+{
+ ///
+ /// GoWrapper is class for wrapping common gameobject into UI display list.
+ ///
+ public class GoWrapper : DisplayObject
+ {
+ [Obsolete("No need to manually set this flag anymore, coz it will be handled automatically.")]
+ public bool supportStencil;
+
+ public event Action onUpdate;
+ public Action> customCloneMaterials;
+ public Action customRecoverMaterials;
+
+ protected GameObject _wrapTarget;
+ protected List _renderers;
+ protected Dictionary _materialsBackup;
+ protected Canvas _canvas;
+ protected bool _cloneMaterial;
+ protected bool _shouldCloneMaterial;
+
+ protected struct RendererInfo
+ {
+ public Renderer renderer;
+ public Material[] materials;
+ public int sortingOrder;
+ }
+
+ // protected static List helperTransformList = new List();
+
+ ///
+ ///
+ ///
+ public GoWrapper()
+ {
+ // _flags |= Flags.SkipBatching;
+
+ _renderers = new List();
+ _materialsBackup = new Dictionary();
+
+ CreateGameObject("GoWrapper");
+ }
+
+ ///
+ ///
+ ///
+ /// 包装对象。
+ public GoWrapper(GameObject go) : this()
+ {
+ SetWrapTarget(go, false);
+ }
+
+ ///
+ /// 设置包装对象。注意如果原来有包装对象,设置新的包装对象后,原来的包装对象只会被删除引用,但不会被销毁。
+ /// 对象包含的所有材质不会被复制,如果材质已经是公用的,这可能影响到其他对象。如果希望自动复制,改为使用SetWrapTarget(target, true)设置。
+ ///
+ public GameObject wrapTarget
+ {
+ get { return _wrapTarget; }
+ set { SetWrapTarget(value, false); }
+ }
+
+ [Obsolete("setWrapTarget is deprecated. Use SetWrapTarget instead.")]
+ public void setWrapTarget(GameObject target, bool cloneMaterial)
+ {
+ SetWrapTarget(target, cloneMaterial);
+ }
+
+ ///
+ /// 设置包装对象。注意如果原来有包装对象,设置新的包装对象后,原来的包装对象只会被删除引用,但不会被销毁。
+ ///
+ ///
+ /// 如果true,则复制材质,否则直接使用sharedMaterial。
+ public void SetWrapTarget(GameObject target, bool cloneMaterial)
+ {
+ // set Flags.SkipBatching only target not null
+ if (target == null) _flags &= ~Flags.SkipBatching;
+ else _flags |= Flags.SkipBatching;
+ InvalidateBatchingState();
+
+ RecoverMaterials();
+
+ _cloneMaterial = cloneMaterial;
+ if (_wrapTarget != null)
+ _wrapTarget.transform.SetParent(null, false);
+
+ _canvas = null;
+ _wrapTarget = target;
+ _shouldCloneMaterial = false;
+ _renderers.Clear();
+
+ if (_wrapTarget != null)
+ {
+ _wrapTarget.transform.SetParent(this.cachedTransform, false);
+ _canvas = _wrapTarget.GetComponent