private void MarchList() { SerializedProperty property = null; SerializedProperty targetProperty = null; if (!string.IsNullOrEmpty(query)) { switch (EnumIndexToLoadType(defultTypeProp.enumValueIndex)) { case LoadType.Prefab: property = prefabsProp; targetProperty = prefabsPropWorp; break; case LoadType.Bundle: property = bundlesProp; targetProperty = bundlesPropWorp; break; default: break; } targetProperty.ClearArray(); for (int i = 0; i < property.arraySize; i++) { var assetNameProp = property.GetArrayElementAtIndex(i).FindPropertyRelative("panelName"); if (assetNameProp.stringValue.ToLower().Contains(query.ToLower())) { targetProperty.InsertArrayElementAtIndex(0); BridgeEditorUtility.CopyPropertyValue(targetProperty.GetArrayElementAtIndex(0), property.GetArrayElementAtIndex(i)); } } } }
protected override void DrawElementCallBack(Rect rect, int index, bool isActive, bool isFocused) { base.DrawElementCallBack(rect, index, isActive, isFocused); var prop = property.GetArrayElementAtIndex(index); var graph = prop.objectReferenceValue; var graphName = graph == null ? "empty" : graph.name; rect = BridgeEditorUtility.DrawBoxRect(rect, index.ToString("00")); var btnRect = new Rect(rect.x, rect.y, rect.width - 30, EditorGUIUtility.singleLineHeight); if (GUI.Button(btnRect, graphName, EditorStyles.toolbarButton)) { AssetDatabase.OpenAsset(graph); } btnRect = new Rect(rect.x + rect.width - 30, rect.y, 30, EditorGUIUtility.singleLineHeight); if (graph != null) { if (GUI.Button(btnRect, " ", EditorStyles.objectFieldMiniThumb)) { EditorGUIUtility.PingObject(graph); } DragGroupObj(btnRect, prop); } else { prop.objectReferenceValue = EditorGUI.ObjectField(btnRect, prop.objectReferenceValue, typeof(BridgeUI.Graph.UIGraph), false); } }
protected override void DrawElementCallBack(Rect rect, int index, bool isActive, bool isFocused) { base.DrawElementCallBack(rect, index, isActive, isFocused); var prop = property.GetArrayElementAtIndex(index); rect = BridgeEditorUtility.DrawBoxRect(rect, index.ToString("00")); EditorGUI.PropertyField(rect, prop); }
private void CloseAllCreated(UIInfoBase[] infoList) { TrySaveAllPrefabs(infoList); for (int i = 0; i < infoList.Length; i++) { var item = infoList[i]; BridgeEditorUtility.SavePrefab(ref item.instanceID); } }
private void CloseAllCreated(SerializedProperty arrayProp) { TrySaveAllPrefabs(arrayProp); for (int i = 0; i < arrayProp.arraySize; i++) { var item = arrayProp.GetArrayElementAtIndex(i); var instanceIDPorp = item.FindPropertyRelative("instanceID"); BridgeEditorUtility.SavePrefab(instanceIDPorp); } }
protected void DrawObjectDetail(UnityEngine.Object obj, Rect rect) { if (obj != null) { var serializedObj = BridgeEditorUtility.CreateCachedSerializedObject(obj); rect.y += EditorGUIUtility.singleLineHeight + 5; serializedObj.Update(); BridgeEditorUtility.DrawChildInContent(serializedObj.GetIterator(), rect, ignoreProps, null, 1); serializedObj.ApplyModifiedProperties(); } }
protected float ElementHeightCallback(int index) { var prop = prop_instences.GetArrayElementAtIndex(index); var height = EditorGUIUtility.singleLineHeight + BridgeEditorUtility.padding * 2; if (prop.objectReferenceValue != null && prop.isExpanded) { var se = BridgeUI.Drawer.BridgeEditorUtility.CreateCachedSerializedObject(prop.objectReferenceValue); height += BridgeEditorUtility.GetSerializedObjectHeight(se, ignoreProps) + BridgeEditorUtility.padding * 2; } return(height); }
protected virtual void HideItemIfInstenced() { var obj = EditorUtility.InstanceIDToObject(instanceIDProp.intValue); if (obj != null) { var go = obj as GameObject; var parent = go.transform.parent; BridgeEditorUtility.SavePrefab(go, true); } instanceIDProp.intValue = 0; }
protected override void DrawElementCallBack(Rect rect, int index, bool isActive, bool isFocused) { rect = BridgeEditorUtility.DrawBoxRect(rect, ""); base.DrawElementCallBack(rect, index, isActive, isFocused); var prop = property.GetArrayElementAtIndex(index); GUIContent content = GUIContent.none; if (prop.objectReferenceValue != null) { var obj = (prop.objectReferenceValue as PopDataObj); content = new GUIContent(obj.descrition); } EditorGUI.PropertyField(rect, prop, content); }
protected override void DrawElementCallBack(Rect rect, int index, bool isActive, bool isFocused) { base.DrawElementCallBack(rect, index, isActive, isFocused); var prop = property.GetArrayElementAtIndex(index); var graphGUID = prop.stringValue; BridgeUI.Graph.UIGraph graph = null; if (!string.IsNullOrEmpty(graphGUID)) { var path = AssetDatabase.GUIDToAssetPath(graphGUID); if (!string.IsNullOrEmpty(path)) { graph = AssetDatabase.LoadAssetAtPath <Graph.UIGraph>(path); } } var graphName = graph == null ? "empty" : graph.name; rect = BridgeEditorUtility.DrawBoxRect(rect, index.ToString("00")); var btnRect = new Rect(rect.x, rect.y, rect.width - 30, EditorGUIUtility.singleLineHeight); if (GUI.Button(btnRect, graphName, EditorStyles.toolbarButton)) { AssetDatabase.OpenAsset(graph); } btnRect = new Rect(rect.x + rect.width - 30, rect.y, 30, EditorGUIUtility.singleLineHeight); if (graph != null) { if (GUI.Button(btnRect, " ", EditorStyles.objectFieldMiniThumb)) { EditorGUIUtility.PingObject(graph); } DragGroupObj(btnRect, prop); } else { var graphNew = EditorGUI.ObjectField(btnRect, graph, typeof(BridgeUI.Graph.UIGraph), false) as Graph.UIGraph; if (graphNew != null && graphNew != graph) { SetProperyValue(prop, graphNew); } } }
protected virtual void HideItemIfInstenced() { var obj = EditorUtility.InstanceIDToObject(instanceIDProp.intValue); if (obj != null) { var go = obj as GameObject; var parent = go.transform.parent; BridgeEditorUtility.SavePrefab(go, true); if (parent != null && parent.GetComponent <PanelGroup>() == null && parent.childCount == 0) { Object.DestroyImmediate(parent.gameObject); } } instanceIDProp.intValue = 0; }