public override void OnInspectorGUI() { serializedObject.Update(); UIPainter panel = target as UIPainter; DrawPropertiesExcluding(serializedObject, propertyToExclude); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Package Name"); if (GUILayout.Button(packageName.stringValue, "ObjectField")) { EditorWindow.GetWindow <PackagesWindow>(true, "Select a UI Component").SetSelection(packageName.stringValue, componentName.stringValue); } if (GUILayout.Button("Clear", GUILayout.Width(50))) { #if UNITY_2018_3_OR_NEWER bool isPrefab = PrefabUtility.GetPrefabAssetType(panel) != PrefabAssetType.NotAPrefab; #else bool isPrefab = PrefabUtility.GetPrefabType(panel) == PrefabType.Prefab; #endif panel.SendMessage("OnUpdateSource", new object[] { null, null, null, !isPrefab }); #if UNITY_5_3_OR_NEWER EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); #elif UNITY_5 EditorApplication.MarkSceneDirty(); #else EditorUtility.SetDirty(panel); #endif } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Component Name"); if (GUILayout.Button(componentName.stringValue, "ObjectField")) { EditorWindow.GetWindow <PackagesWindow>(true, "Select a UI Component").SetSelection(packageName.stringValue, componentName.stringValue); } EditorGUILayout.EndHorizontal(); int oldSortingOrder = panel.sortingOrder; EditorGUILayout.PropertyField(sortingOrder); EditorGUILayout.PropertyField(renderCamera); EditorGUILayout.PropertyField(fairyBatching); EditorGUILayout.PropertyField(touchDisabled); if (serializedObject.ApplyModifiedProperties()) { #if UNITY_2018_3_OR_NEWER bool isPrefab = PrefabUtility.GetPrefabAssetType(panel) != PrefabAssetType.NotAPrefab; #else bool isPrefab = PrefabUtility.GetPrefabType(panel) == PrefabType.Prefab; #endif if (!isPrefab) { panel.ApplyModifiedProperties(sortingOrder.intValue != oldSortingOrder); } } }
private static void StartPickingProcess(Player player, Lock @lock) { var ui = new UIPainter(); var process = player.StartPicking(@lock); ui.Initialize(process); while (process.IsActive) { HandleKeystrokes(process); ui.Update(process); } }
static void Main(string[] args) { List <Dependency> dependencies = new List <Dependency>(); dependencies = GetDependencyProp(typeof(TestClass)); UIPainter painter = new UIPainter(); //设置绘制工具 painter.SetUiTool(null); painter.Draw(dependencies); foreach (var d in dependencies) { Console.WriteLine(d.ToString()); } Console.ReadKey(); }
public static void LoadPackages() { if (Application.isPlaying || _loaded) { return; } #if !UNITY_5 EditorApplication.update -= EditorApplication_Update; EditorApplication.update += EditorApplication_Update; #endif _loaded = true; UIPackage.RemoveAllPackages(); FontManager.Clear(); NTexture.DisposeEmpty(); string[] ids = AssetDatabase.FindAssets("@sprites t:textAsset"); int cnt = ids.Length; for (int i = 0; i < cnt; i++) { string assetPath = AssetDatabase.GUIDToAssetPath(ids[i]); int pos = assetPath.LastIndexOf("@"); if (pos == -1) { continue; } assetPath = assetPath.Substring(0, pos); if (AssetDatabase.AssetPathToGUID(assetPath) != null) { UIPackage.AddPackage(assetPath, (string name, string extension, System.Type type) => { return(AssetDatabase.LoadAssetAtPath(name + extension, type)); } ); } } List <UIPackage> pkgs = UIPackage.GetPackages(); pkgs.Sort(CompareUIPackage); cnt = pkgs.Count; packagesPopupContents = new GUIContent[cnt + 1]; for (int i = 0; i < cnt; i++) { packagesPopupContents[i] = new GUIContent(pkgs[i].name); } packagesPopupContents[cnt] = new GUIContent("Please Select"); UIConfig.ClearResourceRefs(); UIConfig[] configs = GameObject.FindObjectsOfType <UIConfig>(); foreach (UIConfig config in configs) { config.Load(); } UIPanel.packageListReady = true; UIPainter.packageListReady = true; UIPainter.ReloadAllPanels(); UIPanel.ReloadAllPanels(); }