/// <summary> /// Draws the property. /// </summary> protected override void DrawPropertyLayout(GUIContent label) { var entry = this.ValueEntry; var property = entry.Property; int minCount = int.MaxValue; int maxCount = 0; PropertyContext <bool> isVisible; if (entry.Context.Get(this, "is_visible", out isVisible)) { isVisible.Value = GeneralDrawerConfig.Instance.OpenListsByDefault; } for (int i = 0; i < entry.ValueCount; i++) { if (entry.Values[i].Count > maxCount) { maxCount = entry.Values[i].Count; } if (entry.Values[i].Count < minCount) { minCount = entry.Values[i].Count; } } SirenixEditorGUI.BeginHorizontalToolbar(); isVisible.Value = SirenixEditorGUI.Foldout(isVisible.Value, GUIHelper.TempContent("SyncList " + label.text + " [" + typeof(TList).Name + "]")); EditorGUILayout.LabelField(GUIHelper.TempContent(minCount == maxCount ? (minCount == 0 ? "Empty" : minCount + " items") : minCount + " (" + maxCount + ") items"), SirenixGUIStyles.RightAlignedGreyMiniLabel); SirenixEditorGUI.EndHorizontalToolbar(); if (SirenixEditorGUI.BeginFadeGroup(isVisible, isVisible.Value)) { GUIHelper.PushGUIEnabled(false); SirenixEditorGUI.BeginVerticalList(); { var elementLabel = new GUIContent(); for (int i = 0; i < maxCount; i++) { SirenixEditorGUI.BeginListItem(); elementLabel.text = "Item " + i; if (i < minCount) { property.Children[i].Draw(elementLabel); } else { EditorGUILayout.LabelField(elementLabel, SirenixEditorGUI.MixedValueDashChar); } SirenixEditorGUI.EndListItem(); } } SirenixEditorGUI.EndVerticalList(); GUIHelper.PopGUIEnabled(); } SirenixEditorGUI.EndFadeGroup(); }
protected override void OnBeginDrawEditors() { OdinMenuTreeSelection selected = this.MenuTree.Selection; if (selected.SelectedValue != null) { SirenixEditorGUI.BeginHorizontalToolbar(); GUILayout.Label(this.MenuTree.Selection.FirstOrDefault().Name); if (selected.SelectedValue.GetType() == typeof(SceneEssentialObjects)) { { GUILayout.FlexibleSpace(); if (SirenixEditorGUI.ToolbarButton("Delete Current")) { SceneEssentialObjects asset = selected.SelectedValue as SceneEssentialObjects; string path = AssetDatabase.GetAssetPath(asset); AssetDatabase.DeleteAsset(path); AssetDatabase.SaveAssets(); } } } SirenixEditorGUI.EndHorizontalToolbar(); } }
/// <summary> /// 头顶的选项按钮 /// </summary> protected override void OnBeginDrawEditors() { var selected = this.MenuTree.Selection.FirstOrDefault(); var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; // Draws a toolbar with the name of the currently selected menu item. SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { if (selected != null) { GUILayout.Label(selected.Name); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("Create Item"))) { ScriptableObjectCreator.ShowDialog <Item>("Assets/Plugins/Sirenix/Demos/Sample - RPG Editor/Items", obj => { obj.Name = obj.name; base.TrySelectMenuItemWithObject(obj); // Selects the newly created item in the editor }); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("Create Character"))) { ScriptableObjectCreator.ShowDialog <Character>("Assets/Plugins/Sirenix/Demos/Sample - RPG Editor/Character", obj => { obj.Name = obj.name; base.TrySelectMenuItemWithObject(obj); // Selects the newly created item in the editor }); } } SirenixEditorGUI.EndHorizontalToolbar(); }
void DrawListKeyValuePair <K, V>(List <KeyValuePair <K, V> > pairs, ref bool state, string label, Action <K> DrawItem) { #if UNITY_EDITOR SirenixEditorGUI.BeginIndentedVertical(SirenixGUIStyles.PropertyPadding); { SirenixEditorGUI.BeginHorizontalToolbar(); { state = SirenixEditorGUI.Foldout(state, label); GUILayout.FlexibleSpace(); } SirenixEditorGUI.EndHorizontalToolbar(); if (state) { SirenixEditorGUI.BeginVerticalList(false); foreach (var item in pairs) { SirenixEditorGUI.BeginListItem(false); EditorGUILayout.BeginHorizontal(); DrawItem(item.Key); EditorGUILayout.EndHorizontal(); SirenixEditorGUI.EndListItem(); } SirenixEditorGUI.EndVerticalList(); } } SirenixEditorGUI.EndIndentedVertical(); #endif }
/// <summary> /// /// </summary> protected override void OnBeginDrawEditors() { base.OnBeginDrawEditors(); OdinMenuItem selected = this.MenuTree.Selection.FirstOrDefault(); int toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { if (selected != null) { GUILayout.Label(selected.Name); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("Switch Platform"))) { BuildManager.Instance.SwitchPlatform(selected.Name); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("Upgrade Version"))) { VersionManager.Instance.UpdateVersion(); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("Make a build", "Button used to make a build for current selected platform"))) { Close(); BuildManager.Instance.Build(); } } SirenixEditorGUI.EndHorizontalToolbar(); }
protected override void OnBeginDrawEditors() { if (MenuTree == null) { return; } var selected = this.MenuTree.Selection.FirstOrDefault(); var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { if (selected != null) { var old = GUI.color; GUI.color = Color.cyan; GUILayout.Label(selected.Name, SirenixGUIStyles.BoldLabel); GUI.color = old; } if (SirenixEditorGUI.ToolbarButton("检查")) { HomeConfig.Instance.CheckAll(); } } SirenixEditorGUI.EndHorizontalToolbar(); }
private void OnHeaderGUI() { SirenixEditorGUI.BeginHorizontalToolbar(SirenixGUIStyles.BoxHeaderStyle); GUILayout.Label(" ", GUILayout.Width(17f)); GUILayout.Label("继承", SirenixGUIStyles.LabelCentered, GUILayout.Width(ActionEditor.INHERIT_WIDTH)); GUILayout.Label("动作名称", SirenixGUIStyles.LabelCentered, GUILayout.Width(ActionEditor.ACT_NAME_WIDTH)); GUILayout.Label("动画来源", SirenixGUIStyles.LabelCentered, GUILayout.Width(ActionEditor.ACT_SRC_WIDTH)); GUILayout.Label("动画文件", SirenixGUIStyles.LabelCentered, GUILayout.Width(ActionEditor.ACT_CLIP_WIDTH)); GUILayout.Label("操作", SirenixGUIStyles.LabelCentered, GUILayout.ExpandWidth(true)); SirenixEditorGUI.EndHorizontalToolbar(); }
protected override void OnEndDrawEditors() { Debug.Log(_missingGameObjects); OdinMenuTreeSelection selected = this.MenuTree.Selection; if (selected.SelectedValue != null) { if (selected.SelectedValue.GetType() == typeof(SceneEssentialObjects)) { SceneEssentialObjects asset = selected.SelectedValue as SceneEssentialObjects; if (_missingGameObjects != null) { foreach (GameObject obj in _missingGameObjects) { SirenixEditorGUI.WarningMessageBox("Missing -" + obj.name + "- Prefab."); } } else { if (asset.HasBeenChecked) { SirenixEditorGUI.InfoMessageBox("No missing Objects."); } else { SirenixEditorGUI.InfoMessageBox("Not Checked Yet."); } } GUILayout.FlexibleSpace(); SirenixEditorGUI.BeginHorizontalToolbar(); { GUILayout.FlexibleSpace(); if (_missingGameObjects != null) { if (SirenixEditorGUI.ToolbarButton("Add Missing Objects")) { AddMissing(); } } if (SirenixEditorGUI.ToolbarButton("Check Scene")) { CheckScene(asset); asset.HasBeenChecked = true; } } SirenixEditorGUI.EndHorizontalToolbar(); } } }
private void DrawTopBar() { Rect rect = SirenixEditorGUI.BeginHorizontalToolbar(); { var iconRect = rect.AlignLeft(SerializationInfoMenuItem.IconSize).AlignMiddle(SerializationInfoMenuItem.IconSize); iconRect.x += SerializationInfoMenuItem.IconSpacing * 2; GUI.color = (this.backendFlags & SerializationBackendFlags.Odin) != 0 ? Color.white : new Color(1f, 1f, 1f, 0.2f); GUI.DrawTexture(iconRect.Padding(2), EditorIcons.OdinInspectorLogo, ScaleMode.ScaleToFit); iconRect.x += SerializationInfoMenuItem.IconSize + SerializationInfoMenuItem.IconSpacing * 2; GUI.color = (this.backendFlags & SerializationBackendFlags.Unity) != 0 ? Color.white : new Color(1f, 1f, 1f, 0.2f); GUI.DrawTexture(iconRect.Padding(2), EditorIcons.UnityLogo, ScaleMode.ScaleToFit); GUI.color = Color.white; var typeName = " " + (this.targetType == null ? "Select Type" : this.targetType.GetNiceName().SplitPascalCase()) + " "; GUILayout.Space(iconRect.xMax + 3); bool selectB = SirenixEditorGUI.ToolbarButton(new GUIContent(typeName)); GUILayout.FlexibleSpace(); bool selectA = SirenixEditorGUI.ToolbarButton(EditorIcons.TriangleDown); if (selectA || selectB) { var btnRect = GUIHelper.GetCurrentLayoutRect().HorizontalPadding(20).AlignTop(20); btnRect = btnRect.AlignRight(400); var source = AssemblyUtilities.GetTypes(AssemblyTypeFlags.CustomTypes) .Where(x => !x.IsAbstract && x.IsClass && x.InheritsFrom <UnityEngine.Object>()) .Where(x => !x.Assembly.FullName.StartsWith("Sirenix")) .OrderBy(x => x.Assembly.GetAssemblyTypeFlag()) .OrderBy(x => x.Assembly.GetAssemblyTypeFlag()) .ThenBy(x => x.Namespace) .ThenByDescending(x => x.Name); var p = new TypeSelector(source, false); p.SelectionChanged += (types) => { var t = types.FirstOrDefault(); if (t != null) { this.targetType = t; this.odinContext = this.targetType.IsDefined <ShowOdinSerializedPropertiesInInspectorAttribute>(true); this.CreateMenuTree(true); } }; p.SetSelection(this.targetType); p.ShowInPopup(300); } } SirenixEditorGUI.EndHorizontalToolbar(); }
private void OnGUI() { this.Focus(); this.wantsMouseMove = true; if (InstanceCreator.Type == null) { this.Close(); return; } else { this.RootNode = this.RootNode ?? this.GetTypeTree(InstanceCreator.Type); SirenixEditorGUI.BeginHorizontalToolbar(ToolbarBackgroundChainedTop); { this.searchChanged = this.searchTerm != (this.searchTerm = SirenixEditorGUI.ToolbarSearchField(this.searchTerm, true)) || this.searchChanged; } SirenixEditorGUI.EndHorizontalToolbar(); SirenixEditorGUI.BeginVerticalMenuList(this); { this.RootNode.DrawItem(); } SirenixEditorGUI.EndVerticalMenuList(); SirenixEditorGUI.DrawBorders(new Rect(0, 0, this.position.width, this.position.height), 1, 1, 1, 1, SirenixGUIStyles.BorderColor); if (Event.current.type == EventType.Repaint) { this.hasSearchTerm = this.searchTerm != null && (this.searchTerm.Length >= 2 || (this.searchTerm.Length == 1 && !char.IsLetter(this.searchTerm[0]))); if (this.searchChanged) { this.RootNode.UpdateSearchTerm(); this.searchChanged = false; } } if (this.chosenType != null) { this.SetSelectedType(); this.chosenType = null; this.Close(); return; } this.RepaintIfRequested(); } }
public void DrawToolbar() { SirenixEditorGUI.BeginHorizontalToolbar(22f, 4); if (SirenixEditorGUI.ToolbarButton(this.m_provinceContent, false)) { } if (SirenixEditorGUI.ToolbarButton(this.m_cityContent, false)) { } if (SirenixEditorGUI.ToolbarButton("刷新", false)) { } SirenixEditorGUI.EndHorizontalToolbar(); }
protected override void OnBeginDrawEditors() { OdinMenuItem selected = null; try { if (this.MenuTree.Selection.Count > 0) { selected = this.MenuTree.Selection.FirstOrDefault(); } } catch (NullReferenceException) { } int toolbarHeight = 0; if (this.MenuTree.Config.SearchToolbarHeight != null) { toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; } // Draws a toolbar with the name of the currently selected menu item. SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { if (selected != null) { GUILayout.Label(selected.Name); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("Create Loadout"))) { ScriptableObjectPicker.ShowDialog <Loadout>("Assets/Resources/Equipment/Loadouts", obj => { obj.Name = obj.name; base.TrySelectMenuItemWithObject(obj); // Selects the newly created item in the editor }); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("Create Equipment"))) { ScriptableObjectPicker.ShowDialog <Equipment>("Assets/Resources/Equipment", obj => { obj.Name = obj.name; base.TrySelectMenuItemWithObject(obj); // Selects the newly created item in the editor }); } } SirenixEditorGUI.EndHorizontalToolbar(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); var _uiButton = (UIButton)target; SirenixEditorGUI.BeginHorizontalToolbar(28, 4); { bool isSingle = _uiButton.buttonClickEnum.HasFlag(UIButton.ButtonClickEnum.Single); if (SirenixEditorGUI.ToolbarButton("单击", isSingle)) { _uiButton.buttonClickEnum = isSingle ? _uiButton.buttonClickEnum &= (~UIButton.ButtonClickEnum.Single) : _uiButton.buttonClickEnum |= UIButton.ButtonClickEnum.Single; } bool isDouble = _uiButton.buttonClickEnum.HasFlag(UIButton.ButtonClickEnum.Double); if (SirenixEditorGUI.ToolbarButton("双击", isDouble)) { _uiButton.buttonClickEnum = isDouble ? _uiButton.buttonClickEnum &= (~UIButton.ButtonClickEnum.Double) : _uiButton.buttonClickEnum |= UIButton.ButtonClickEnum.Double; } bool isLongPress = _uiButton.buttonClickEnum.HasFlag(UIButton.ButtonClickEnum.LongPress); if (SirenixEditorGUI.ToolbarButton("长按", isLongPress)) { _uiButton.buttonClickEnum = isLongPress ? _uiButton.buttonClickEnum &= (~UIButton.ButtonClickEnum.LongPress) : _uiButton.buttonClickEnum |= UIButton.ButtonClickEnum.LongPress; } bool isAll = _uiButton.buttonClickEnum.HasFlag(UIButton.ButtonClickEnum.All); if (SirenixEditorGUI.ToolbarButton("所有", isAll)) { _uiButton.buttonClickEnum = isAll ? _uiButton.buttonClickEnum = UIButton.ButtonClickEnum.None : _uiButton.buttonClickEnum = UIButton.ButtonClickEnum.All; } } SirenixEditorGUI.EndHorizontalToolbar(); EditorGUILayout.PropertyField(_itemId); EditorGUILayout.PropertyField(_clickThreshold); EditorGUILayout.PropertyField(_doubleClickThreshold); EditorGUILayout.PropertyField(_pressThreshold); serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(target); }
protected override void OnBeginDrawEditors() { OdinMenuTreeSelection selected = this.MenuTree.Selection; SirenixEditorGUI.BeginHorizontalToolbar(); { GUILayout.FlexibleSpace(); if (SirenixEditorGUI.ToolbarButton("Delete Current")) { SOFabricatorItem asset = selected.SelectedValue as SOFabricatorItem; string path = AssetDatabase.GetAssetPath(asset); AssetDatabase.DeleteAsset(path); AssetDatabase.SaveAssets(); } } SirenixEditorGUI.EndHorizontalToolbar(); }
void DrawToolbar() { this.includeWarnings = EditorPrefs.GetBool("OdinValidation.includeWarnings", this.includeWarnings); this.includeErrors = EditorPrefs.GetBool("OdinValidation.includeErrors", this.includeErrors); this.includeValid = EditorPrefs.GetBool("OdinValidation.includeValid", this.includeValid); SirenixEditorGUI.BeginHorizontalToolbar(); { //GL.sRGBWrite = QualitySettings.activeColorSpace == ColorSpace.Linear; //this.includeValid = SirenixEditorGUI.ToolbarButton(new GUIContent(" " + this.validCount + " "), this.includeValid) ? !this.includeValid : this.includeValid; this.includeValid = SirenixEditorGUI.ToolbarToggle(this.includeValid, new GUIContent(" " + this.validCount + " ")); GUIHelper.PushColor(Color.green); GUI.DrawTexture(new Rect(GUILayoutUtility.GetLastRect().position + new Vector2(6, 4), new Vector2(16, 16)), EditorIcons.Checkmark.Highlighted, ScaleMode.ScaleToFit); GUIHelper.PopColor(); //this.includeWarnings = SirenixEditorGUI.ToolbarButton(new GUIContent(" " + this.WarningCount + " "), this.includeWarnings) ? !this.includeWarnings : this.includeWarnings; this.includeWarnings = SirenixEditorGUI.ToolbarToggle(this.includeWarnings, new GUIContent(" " + this.warningCount + " ")); GUI.DrawTexture(new Rect(GUILayoutUtility.GetLastRect().position + Vector2.one * 2, new Vector2(20, 20)), EditorIcons.UnityWarningIcon, ScaleMode.ScaleToFit); //this.includeErrors = SirenixEditorGUI.ToolbarButton(new GUIContent(" " + this.ErrorCount + " "), this.includeErrors) ? !this.includeErrors : this.includeErrors; this.includeErrors = SirenixEditorGUI.ToolbarToggle(this.includeErrors, new GUIContent(" " + this.errorCount + " ")); GUI.DrawTexture(new Rect(GUILayoutUtility.GetLastRect().position + Vector2.one * 2, new Vector2(22, 22)), EditorIcons.UnityErrorIcon, ScaleMode.ScaleToFit); //GL.sRGBWrite = false; GUILayout.FlexibleSpace(); if (SirenixEditorGUI.ToolbarButton(GUIHelper.TempContent(" Scan Scene "))) { this.FullScan(ScanType.Scene); } if (SirenixEditorGUI.ToolbarButton(GUIHelper.TempContent(" Scan ScriptObjs "))) { this.FullScan(ScanType.ScriptableObject); } if (SirenixEditorGUI.ToolbarButton(GUIHelper.TempContent(" Scan Prefabs "))) { this.FullScan(ScanType.Prefab); } } SirenixEditorGUI.EndHorizontalToolbar(); EditorPrefs.SetBool("OdinValidation.includeWarnings", this.includeWarnings); EditorPrefs.SetBool("OdinValidation.includeErrors", this.includeErrors); EditorPrefs.SetBool("OdinValidation.includeValid", this.includeValid); }
protected override void OnBeginDrawEditors() { //Gets the reference to the currently selected item OdinMenuTreeSelection selection = this.MenuTree.Selection; SirenixEditorGUI.BeginHorizontalToolbar(); { GUILayout.FlexibleSpace(); if (SirenixEditorGUI.ToolbarButton("Delete Current")) { WaveManagerScriptableObject asset = selection.SelectedValue as WaveManagerScriptableObject; string path = AssetDatabase.GetAssetPath(asset); AssetDatabase.DeleteAsset(path); AssetDatabase.SaveAssets(); } } SirenixEditorGUI.EndHorizontalToolbar(); }
protected override void OnBeginDrawEditors() { var selected = this.MenuTree.Selection.FirstOrDefault(); var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { if (selected != null) { GUILayout.Label(selected.Name); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("Create UGUIWindowConfig"))) { ScriptableObjectCreator.ShowDialog <UGUIWindowConfig>("Assets/UGUIFramework/GameData"); } } SirenixEditorGUI.EndHorizontalToolbar(); }
protected override void OnBeginDrawEditors() { var selected = this.MenuTree.Selection.FirstOrDefault(); var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; // Draws a toolbar with the name of the currently selected menu item. SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { if (selected != null && cur != null) { GUILayout.MaxWidth(30); EditorGUILayout.LabelField("Name: ", GUILayout.MaxWidth(40)); selected.Name = EditorGUILayout.TextField(selected.Name, GUILayout.MaxWidth(100)); EditorGUILayout.LabelField("ID: ", GUILayout.MaxWidth(30)); cur.ID = EditorGUILayout.IntField(cur.ID, GUILayout.MaxWidth(30)); } } SirenixEditorGUI.EndHorizontalToolbar(); }
protected override void OnBeginDrawEditors() { OdinMenuItem selected = null; if (MenuTree != null) { if (MenuTree.MenuItems.Count > 0) { selected = this.MenuTree.Selection.FirstOrDefault(); } var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; // Draws a toolbar with the name of the currently selected menu item. SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { if (selected != null) { //GUILayout.Label(((GameEventListener)selected.ObjectInstance).name + " > " + selected.Name); //GUILayout.Label(selected.Name); if (SirenixEditorGUI.ToolbarButton(new GUIContent("Select GameObject"))) { Selection.activeGameObject = (((UniTweenSequence)selected.ObjectInstance).gameObject); } } if (SirenixEditorGUI.ToolbarButton(new GUIContent("Reload Tree"))) { ForceMenuTreeRebuild(); } } SirenixEditorGUI.EndHorizontalToolbar(); } else { if (SirenixEditorGUI.ToolbarButton(new GUIContent("Reload Tree"))) { ForceMenuTreeRebuild(); } } }
protected override void OnBeginDrawEditors() { OdinMenuTreeSelection selected = this.MenuTree.Selection; var asset = selected.SelectedValue as NovelsSectionData; if (asset != null) { SirenixEditorGUI.BeginHorizontalToolbar(); { GUILayout.FlexibleSpace(); if (SirenixEditorGUI.ToolbarButton("删除")) { string path = AssetDatabase.GetAssetPath(asset); AssetDatabase.DeleteAsset(path); AssetDatabase.SaveAssets(); } } SirenixEditorGUI.EndHorizontalToolbar(); } }
// Update is called once per frame protected override void OnBeginDrawEditors() { var selected = this.MenuTree.Selection.FirstOrDefault(); var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { SirenixEditorGUI.ToolbarTab(false, new GUIContent("")); if (SirenixEditorGUI.ToolbarButton(new GUIContent(" + ")) && !isCreate) { isCreate = true; SuitConfig w = new SuitConfig(); w.ID = _tree.MenuItems.Count + 1; _tree.Add("New Suit", w); _tree.MenuItems[_tree.MenuItems.Count - 1].Select(); } } SirenixEditorGUI.EndHorizontalToolbar(); }
protected override void OnBeginDrawEditors() { var selected = this.MenuTree.Selection.FirstOrDefault(); var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { if (selected != null) { GUILayout.Label(selected.Name); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("创建模组"))) { ScriptableObjectCreator.ShowDialog <ModuleSet>("Assets/Resources/ScriptObject/ModuleSet", obj => { obj.moduleName = obj.name; base.TrySelectMenuItemWithObject(obj); // Selects the newly created item in the editor }); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("创建怪物"))) { ScriptableObjectCreator.ShowDialog <MonsterSet>("Assets/Resources/ScriptObject/MonsterSet", obj => { obj.monsterSpecificName = obj.name; base.TrySelectMenuItemWithObject(obj); // Selects the newly created item in the editor }); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("创建技能"))) { ScriptableObjectCreator.ShowDialog <SkillSet>("Assets/Resources/ScriptObject/SkillSet", obj => { obj.skillName = obj.name; base.TrySelectMenuItemWithObject(obj); // Selects the newly created item in the editor }); } } SirenixEditorGUI.EndHorizontalToolbar(); }
public void DrawEditors() { #if ODIN_INSPECTOR SirenixEditorGUI.BeginHorizontalToolbar(); { GUILayout.FlexibleSpace(); if (SirenixEditorGUI.ToolbarButton(nameof(Reconnect))) { Reconnect(); } if (SirenixEditorGUI.ToolbarButton(ImportLabel)) { Import(); } if (SirenixEditorGUI.ToolbarButton(ExportLabel)) { Export(); } } SirenixEditorGUI.EndHorizontalToolbar(); #endif }
private void DrawOpeartorPlayerPrefsData() { if (this.m_bRefresh == false) { //如果没有数据直接返回 return; } SirenixEditorGUI.BeginHorizontalToolbar(22f, 4); if (SirenixEditorGUI.ToolbarButton(this.m_selectAll, false)) { } if (SirenixEditorGUI.ToolbarButton(this.m_cancelSelectAll, false)) { } if (SirenixEditorGUI.ToolbarButton(this.m_sort, false)) { } if (SirenixEditorGUI.ToolbarButton(CaomaoEditorIcon.SaveGUIContentSmall)) { } SirenixEditorGUI.EndHorizontalToolbar(); }
protected override void OnBeginDrawEditors() { OdinMenuItem selected = null; if (MenuTree != null) { if (MenuTree.MenuItems.Count > 0) { selected = this.MenuTree.Selection.FirstOrDefault(); } var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { if (selected != null) { if (SirenixEditorGUI.ToolbarButton(new GUIContent("Select GameObject"))) { Selection.activeGameObject = (((UniTweenSequencePlayer)selected.Value).gameObject); EditorGUIUtility.PingObject(Selection.activeGameObject); } } if (SirenixEditorGUI.ToolbarButton(new GUIContent("Reload Tree"))) { ForceMenuTreeRebuild(); } } SirenixEditorGUI.EndHorizontalToolbar(); } else { if (SirenixEditorGUI.ToolbarButton(new GUIContent("Reload Tree"))) { ForceMenuTreeRebuild(); } } }
protected override void OnBeginDrawEditors() { var selected = this.MenuTree.Selection.FirstOrDefault(); var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; if (selected == null) { return; } // Draws a toolbar with the name of the currently selected menu item. SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { if (selected != null) { GUILayout.Label(selected.Name); } if (!settings.Contains(selected.SmartName)) { if (SirenixEditorGUI.ToolbarButton(_import)) { (selected.ObjectInstance as DirectorySetting <TextureSetting>).DoHandle(); EditorUtility.ClearProgressBar(); Debug.LogFormat("[重新导入配置]文件夹{0}纹理配置导入 OK~", selected.SmartName); } } if (selected.SmartName.Equals(TAB_TEXTURE)) { if (SirenixEditorGUI.ToolbarButton(_import)) { TextureImpoterCfg.Instance.ReimportAll(); Debug.Log("[重新导入配置]各种纹理配置导入 OK~"); } } } SirenixEditorGUI.EndHorizontalToolbar(); }
protected override void OnBeginDrawEditors() { var selected = this.MenuTree.Selection.FirstOrDefault(); var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { if (selected != null) { GUILayout.Label(selected.Name); } if (SirenixEditorGUI.ToolbarButton(_createConfig)) { HomeConfigPreview.Instance.Create((model) => { HomeConfigPreview.Instance.AddModel(model); MenuTree.AddObjectAtPath(model.MenuItemName, model); }); } } SirenixEditorGUI.EndHorizontalToolbar(); }
protected override void OnBeginDrawEditors() { OdinMenuItem selected = this.MenuTree.Selection.FirstOrDefault(); int toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; // Draws a toolbar with the name of the currently selected menu item. SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { if (selected != null) { GUILayout.Label(selected.Name); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("Add Zone"))) { PathSettings.AddZone(ProceduralZone.Default); //base.TrySelectMenuItemWithObject(zone); } if (SirenixEditorGUI.ToolbarButton(new GUIContent("Delete Zone")) && PathSettings.Zones.Count > 0) { //ProceduralZone zone = selected.Value as ProceduralZone; //PathSettings.RemoveZone(zone); //AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(zone)); //base.TrySelectMenuItemWithObject(PathSettings); //if (PathSettings.Zones.Count > 0) // base.TrySelectMenuItemWithObject(PathSettings.Zones.Last()); //base.MenuTree.MarkDirty(); } } SirenixEditorGUI.EndHorizontalToolbar(); }
private void DrawToolbar() { if (Event.current.type == EventType.Layout) { this.toolbarRect = this.OuterRect; this.toolbarRect.height = this.toolbarHeight; this.toolbarRect.x += 1; this.toolbarRect.width -= 1; } //if (Event.current.OnRepaint()) //{ // SirenixEditorGUI.DrawBorders(new Rect(GUILayoutUtility.GetLastRect()) { height = this.toolbarHeight }, 1); //} SirenixEditorGUI.BeginHorizontalToolbar(this.toolbarHeight); foreach (var page in this.OrderedPages) { if (page.IsActive) { if (SirenixEditorGUI.ToolbarTab(page == (this.nextPage ?? this.CurrentPage), page.Title)) { this.nextPage = page; } } } SirenixEditorGUI.EndHorizontalToolbar(); if (Event.current.OnRepaint()) { SirenixEditorGUI.DrawBorders(new Rect(GUILayoutUtility.GetLastRect()) { height = this.toolbarHeight }, 1, 1, 0, 0); } }
/// <summary> /// Not yet documented. /// </summary> protected override void DrawPropertyLayout(GUIContent label) { var entry = this.ValueEntry; var attribute = this.Attribute; var config = entry.Property.Context.Get(this, "Test", (CurrentContext)null); if (config.Value == null) { config.Value = new CurrentContext(); config.Value.Attribute = attribute; config.Value.Tags = attribute.Tags != null?attribute.Tags.Trim().Split(',').Select(i => i.Trim()).ToArray() : null; config.Value.LayerNames = attribute.LayerNames != null?attribute.LayerNames.Trim().Split(',').Select(i => i.Trim()).ToArray() : null; config.Value.Property = entry.Property; if (attribute.Path != null) { var path = attribute.Path.Trim('/', ' '); path = "Assets/" + path + "/"; path = Application.dataPath + "/" + path; config.Value.AssetsFolderLocation = new DirectoryInfo(path); path = attribute.Path.TrimStart('/').TrimEnd('/'); config.Value.PrettyPath = "/" + path.TrimStart('/'); } if (attribute.CustomFilterMethod != null) { MethodInfo methodInfo; string error; if (MemberFinder.Start(entry.ParentType) .IsMethod() .IsNamed(attribute.CustomFilterMethod) .HasReturnType <bool>() .HasParameters <TElement>() .TryGetMember <MethodInfo>(out methodInfo, out error)) { if (methodInfo.IsStatic) { config.Value.StaticCustomIncludeMethod = (Func <TElement, bool>)Delegate.CreateDelegate(typeof(Func <TElement, bool>), methodInfo, true); } else { config.Value.InstanceCustomIncludeMethod = EmitUtilities.CreateWeakInstanceMethodCaller <bool, TElement>(methodInfo); } } config.Value.ErrorMessage = error; } if (config.Value.ErrorMessage != null) { // We can get away with lag on load. config.Value.MaxSearchDurationPrFrameInMS = 20; config.Value.EnsureListPopulation(); config.Value.MaxSearchDurationPrFrameInMS = 1; } } var currentValue = (UnityEngine.Object)entry.WeakSmartValue; if (config.Value.ErrorMessage != null) { SirenixEditorGUI.ErrorMessageBox(config.Value.ErrorMessage); } else { config.Value.EnsureListPopulation(); } SirenixEditorGUI.BeginIndentedVertical(SirenixGUIStyles.PropertyPadding); { SirenixEditorGUI.BeginHorizontalToolbar(); if (label != null) { GUILayout.Label(label); } GUILayout.FlexibleSpace(); if (config.Value.PrettyPath != null) { GUILayout.Label(config.Value.PrettyPath, SirenixGUIStyles.RightAlignedGreyMiniLabel); SirenixEditorGUI.VerticalLineSeparator(); } if (config.Value.IsPopulated) { GUILayout.Label(config.Value.AvailableAsset.Count + " items", SirenixGUIStyles.RightAlignedGreyMiniLabel); GUIHelper.PushGUIEnabled(GUI.enabled && (config.Value.AvailableAsset.Count > 0 && config.Value.ErrorMessage == null)); } else { GUILayout.Label("Scanning " + config.Value.CurrentSearchingIndex + " / " + config.Value.NumberOfResultsToSearch, SirenixGUIStyles.RightAlignedGreyMiniLabel); GUIHelper.PushGUIEnabled(false); } SirenixEditorGUI.VerticalLineSeparator(); bool drawConflict = entry.Property.ParentValues.Count > 1; if (drawConflict == false) { var index = config.Value.AvailableAsset.IndexOf(currentValue) + 1; if (index > 0) { GUILayout.Label(index.ToString(), SirenixGUIStyles.RightAlignedGreyMiniLabel); } else { drawConflict = true; } } if (drawConflict) { GUILayout.Label("-", SirenixGUIStyles.RightAlignedGreyMiniLabel); } if (SirenixEditorGUI.ToolbarButton(EditorIcons.TriangleLeft) && config.Value.IsPopulated) { var index = config.Value.AvailableAsset.IndexOf(currentValue) - 1; index = index < 0 ? config.Value.AvailableAsset.Count - 1 : index; entry.WeakSmartValue = config.Value.AvailableAsset[index]; } if (SirenixEditorGUI.ToolbarButton(EditorIcons.TriangleDown) && config.Value.IsPopulated) { GenericMenu m = new GenericMenu(); var selected = currentValue; int itemsPrPage = 40; bool showPages = config.Value.AvailableAsset.Count > 50; string page = ""; int selectedPage = (config.Value.AvailableAsset.IndexOf(entry.WeakSmartValue as UnityEngine.Object) / itemsPrPage); for (int i = 0; i < config.Value.AvailableAsset.Count; i++) { var obj = config.Value.AvailableAsset[i]; if (obj != null) { var path = AssetDatabase.GetAssetPath(obj); var name = string.IsNullOrEmpty(path) ? obj.name : path.Substring(7).Replace("/", "\\"); var localEntry = entry; if (showPages) { var p = (i / itemsPrPage); page = (p * itemsPrPage) + " - " + Mathf.Min(((p + 1) * itemsPrPage), config.Value.AvailableAsset.Count - 1); if (selectedPage == p) { page += " (contains selected)"; } page += "/"; } m.AddItem(new GUIContent(page + name), obj == selected, () => { localEntry.Property.Tree.DelayActionUntilRepaint(() => localEntry.WeakSmartValue = obj); }); } } m.ShowAsContext(); } if (SirenixEditorGUI.ToolbarButton(EditorIcons.TriangleRight) && config.Value.IsPopulated) { var index = config.Value.AvailableAsset.IndexOf(currentValue) + 1; entry.WeakSmartValue = config.Value.AvailableAsset[index % config.Value.AvailableAsset.Count]; } GUIHelper.PopGUIEnabled(); SirenixEditorGUI.EndHorizontalToolbar(); SirenixEditorGUI.BeginVerticalList(); SirenixEditorGUI.BeginListItem(false, padding); this.CallNextDrawer(null); SirenixEditorGUI.EndListItem(); SirenixEditorGUI.EndVerticalList(); } SirenixEditorGUI.EndIndentedVertical(); }