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) { var prop = property.GetArrayElementAtIndex(index); rect = BridgeEditorUtility.DrawBoxRect(rect, index.ToString()); EditorGUI.PropertyField(rect, prop); }
protected override void DrawElementCallBack(Rect rect, int index, bool isActive, bool isFocused) { var prop = property.GetArrayElementAtIndex(index); var graph = prop.objectReferenceValue; var graphName = graph == null ? "empty" : graph.name; rect = BridgeEditorUtility.DrawBoxRect(rect, index.ToString()); 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); } }
private void CloseAllCreated(UIInfoBase[] infoList) { TrySaveAllPrefabs(infoList); for (int i = 0; i < infoList.Length; i++) { var item = infoList[i]; var obj = EditorUtility.InstanceIDToObject(item.instanceID); if (obj != null) { BridgeEditorUtility.ApplyPrefab(obj as GameObject); DestroyImmediate(obj); } item.instanceID = 0; } }
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"); var obj = EditorUtility.InstanceIDToObject(instanceIDPorp.intValue); if (obj != null) { BridgeEditorUtility.ApplyPrefab(obj as GameObject); DestroyImmediate(obj); } instanceIDPorp.intValue = 0; } }
protected virtual void HideItemIfInstenced() { var obj = EditorUtility.InstanceIDToObject(instanceIDProp.intValue); if (obj != null) { var go = obj as GameObject; BridgeEditorUtility.ApplyPrefab(go); if (go.transform.parent.GetComponent <PanelGroup>() == null && go.transform.parent.childCount == 1) { Object.DestroyImmediate(go.transform.parent.gameObject); } else { Object.DestroyImmediate(obj); } } instanceIDProp.intValue = 0; }