protected override void DrawPort(GUIContent label) { if (IsVisible) { SirenixEditorGUI.BeginBox(); if (NodePortInfo.IsInput) { using (new EditorGUILayout.HorizontalScope()) { CallNextDrawer(label); if (GUILayout.Button("Remove")) { PortResolver.ForgetDynamicPort(Property); } } } else { using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("Remove")) { PortResolver.ForgetDynamicPort(Property); } CallNextDrawer(label); } } SirenixEditorGUI.EndBox(); } }
protected override void DrawPropertyLayout(GUIContent label) { // Draw a box around the property. SirenixEditorGUI.BeginBox(label); this.CallNextDrawer(null); SirenixEditorGUI.EndBox(); }
protected override void DrawPropertyLayout(GUIContent label) { SirenixEditorGUI.BeginBox(); bool collectionChanged = false; MakeHeader(ref collectionChanged); if (collectionChanged) { expanded.Value = true; } if (SirenixEditorGUI.BeginFadeGroup(this, expanded.Value)) { if (!DrawEntries(ref collectionChanged)) { DrawPrompt(); } } SirenixEditorGUI.EndFadeGroup(); if (collectionChanged) { AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } SirenixEditorGUI.EndBox(); }
private void OnStartList(int index) { SirenixEditorGUI.BeginBox(); SirenixEditorGUI.BeginBoxHeader(); EditorGUILayout.LabelField(((Stats)index).ToString()); SirenixEditorGUI.EndBoxHeader(); }
private void DrawCompactBoxButton() { SirenixEditorGUI.BeginBox(); var rect = SirenixEditorGUI.BeginToolbarBoxHeader().AlignRight(70).Padding(1); rect.height -= 1; GUIHelper.PushColor(this.btnColor); if (GUI.Button(rect, "Invoke")) { this.InvokeButton(); } GUIHelper.PopColor(); if (this.expanded) { EditorGUILayout.LabelField(this.label); } else { this.toggle.Value = SirenixEditorGUI.Foldout(this.toggle.Value, this.label); } SirenixEditorGUI.EndToolbarBoxHeader(); this.DrawParameters(false); SirenixEditorGUI.EndToolbarBox(); }
public void drawEntity(NodeMEntity entity) { string name = "Entity"; if (entity.entityName != "") { name = entity.entityName; } if (entity.orientation == PortOrientation.In) { //SirenixEditorGUI. SirenixEditorGUI.BeginIndentedHorizontal(); SirenixEditorGUI.BeginBox(); Rect rect = EditorGUILayout.GetControlRect(); // rect = EditorGUI.PrefixLabel(rect, new GUIContent(" ")); rect = EditorGUI.PrefixLabel(rect, new GUIContent(name)); if (GUI.Button(rect.AlignRight(15), EditorIcons.ArrowDown.Raw)) { entity.style.unfolded = !entity.style.unfolded; } ; SirenixEditorGUI.EndBox(); SirenixEditorGUI.EndIndentedHorizontal(); // NodeEditorGUILayout.AddPortField(entity.port); } else { SirenixEditorGUI.BeginBox(); Rect rect = EditorGUILayout.GetControlRect(); EditorGUI.LabelField(rect.AlignRight(80), name); if (GUI.Button(rect.AlignLeft(15), EditorIcons.ArrowDown.Raw)) { entity.style.unfolded = !entity.style.unfolded; } ; SirenixEditorGUI.EndBox(); // NodeEditorGUILayout.AddPortField(entity.port); } // entity.style.unfolded = SirenixEditorGUI.Foldout(entity.style.unfolded, ""); if (entity.style.unfolded) { SirenixEditorGUI.BeginBox(); for (int i = 0; i < entity.components.Count; i++) { drawComponent(entity.components[i]); } SirenixEditorGUI.EndBox(); } else { NodeEditorGUILayout.AddPortField(entity.port); } }
public void drawComponent(NodeIComponent component) { SirenixEditorGUI.BeginBoxHeader(); component.style.unfolded = SirenixEditorGUI.Foldout(component.style.unfolded, component.component.GetType().ToString()); Rect rect = GUILayoutUtility.GetLastRect(); SirenixEditorGUI.EndBoxHeader(); NodeEditorGUILayout.AddPortField(component.port); if (component.style.unfolded) { SirenixEditorGUI.BeginBox(); if (component.tree == null) { GUILayout.Label("the tree is null somehow"); } if (component.tree != null) { component.tree.Draw(false); } else { component.tree = PropertyTree.Create(component.component); component.tree.Draw(false); } //Debug.Log(component.tree.WeakTargets); SirenixEditorGUI.EndBox(); } }
private void DrawPageSlider(GUIContent label) { try { if (this.slider == null) { this.slider = new SlidePageNavigationHelper<InspectorProperty>(); this.slider.PushPage(this.Property, Guid.NewGuid().ToString()); this.page = this.slider.EnumeratePages.Last(); this.page.Name = this.GetLabelText(label); } currentSlider = this.slider; SirenixEditorGUI.BeginBox(); SirenixEditorGUI.BeginToolbarBoxHeader(); { var rect = GUILayoutUtility.GetRect(0, 20); rect.x -= 5; this.slider.DrawPageNavigation(rect); } SirenixEditorGUI.EndToolbarBoxHeader(); { this.slider.BeginGroup(); foreach (var p in this.slider.EnumeratePages) { if (p.BeginPage()) { if (p.Value == this.Property) { this.CallNextDrawer(null); } else { currentDrawingPageProperty = p.Value; if (p.Value.Tree != this.Property.Tree) { InspectorUtilities.BeginDrawPropertyTree(p.Value.Tree, true); } p.Value.Draw(null); if (p.Value.Tree != this.Property.Tree) { InspectorUtilities.EndDrawPropertyTree(p.Value.Tree); } currentDrawingPageProperty = null; } } p.EndPage(); } this.slider.EndGroup(); } SirenixEditorGUI.EndBox(); } finally { currentSlider = null; } }
protected override void DrawPropertyLayout(IPropertyValueEntry <int> entry, NotOneAttribute attribute, GUIContent label) { SirenixEditorGUI.BeginBox(); { if (entry.SmartValue == 1) { // Odin Scene Validator will listen for calls to SirenixEditorGUI.WarningMessageBox and SirenixEditorGUI.ErrorMessageBox, // so as long as you're just calling one of those two functions, the Scene Validator will catch it. SirenixEditorGUI.ErrorMessageBox("1 is not a valid value."); } else { SirenixEditorGUI.InfoMessageBox("Value is not 1 and therefore valid."); } // Continue the drawer chain. this.CallNextDrawer(entry, label); // Button for opening the Odin Scene Validator window. if (GUILayout.Button("Open Odin Scene Validator")) { OdinSceneValidatorWindow.OpenWindow(); } } SirenixEditorGUI.EndBox(); }
/// <summary> /// Draws the property. /// </summary> protected override void DrawPropertyLayout(GUIContent label) { var property = this.Property; var attribute = this.Attribute; if (this.TitleHelper.ErrorMessage != null) { SirenixEditorGUI.ErrorMessageBox(this.TitleHelper.ErrorMessage); } SirenixEditorGUI.BeginBox(); SirenixEditorGUI.BeginBoxHeader(); var content = GUIHelper.TempContent(this.TitleHelper.GetString(property)); this.IsVisible.Value = SirenixEditorGUI.Foldout(this.IsVisible.Value, content); SirenixEditorGUI.EndBoxHeader(); if (Event.current.type == EventType.Layout) { EditorTimeHelper.Time.Update(); this.t = Mathf.MoveTowards(this.t, this.IsVisible.Value ? 1 : 0, EditorTimeHelper.Time.DeltaTime * (1f / SirenixEditorGUI.DefaultFadeGroupDuration)); } if (SirenixEditorGUI.BeginFadeGroup(this.t)) { for (int i = 0; i < property.Children.Count; i++) { var child = property.Children[i]; child.Draw(child.Label); } } SirenixEditorGUI.EndFadeGroup(); SirenixEditorGUI.EndBox(); }
protected override void DrawPropertyLayout(IPropertyValueEntry <MyClass> entry, GUIContent label) { // Draw a box around the property. SirenixEditorGUI.BeginBox(label); this.CallNextDrawer(entry, null); SirenixEditorGUI.EndBox(); }
/// <summary> /// Draws the property. /// </summary> protected override void DrawPropertyLayout(InspectorProperty property, ShowDrawerChainAttribute attribute, GUIContent label) { OdinDrawer[] drawers = DrawerLocator.GetDrawersForProperty(property); SirenixEditorGUI.BeginBox("Drawers"); for (int i = 0; i < drawers.Length; i++) { bool highlight = drawers[i].GetType().Assembly != typeof(ShowDrawerChainAttributeDrawer).Assembly; if (highlight) { GUIHelper.PushColor(Color.green); } EditorGUILayout.LabelField(i + ": " + drawers[i].GetType().GetNiceName()); var rect = GUILayoutUtility.GetLastRect(); GUI.Label(rect, DrawerLocator.GetDrawerPriority(drawers[i].GetType()).ToString(), SirenixGUIStyles.RightAlignedGreyMiniLabel); if (highlight) { GUIHelper.PopColor(); } } SirenixEditorGUI.EndBox(); this.CallNextDrawer(property, label); }
protected override void DrawPropertyLayout(InspectorProperty property, ContextExampleAttribute attribute, GUIContent label) { // Get two context objects. One for a frame counter, and one for an on/off button. PropertyContext <int> frameCount = property.Context.Get(this, "counter", 0); PropertyContext <bool> toggle = property.Context.Get(this, "toggler", false); // Count the frames. if (Event.current.type == EventType.Layout && toggle.Value) { frameCount.Value++; GUIHelper.RequestRepaint(); } // Draw the current frame count, and a start stop button. SirenixEditorGUI.BeginBox(); { GUILayout.Label("Frame Count: " + frameCount.Value.ToString()); if (GUILayout.Button(toggle.Value ? "Stop" : "Start")) { toggle.Value = !toggle.Value; } } SirenixEditorGUI.EndBox(); // Continue the drawer chain. this.CallNextDrawer(property, label); }
private void BeginBox() { GUILayout.Space(30); SirenixEditorGUI.DrawThickHorizontalSeparator(); GUILayout.Space(10); SirenixEditorGUI.BeginBox("状态表现"); }
void ShowGenerateBookButton() { SirenixEditorGUI.BeginBox(); if (GUILayout.Button("Generate Whole Book")) { RunGeneration(true); } SirenixEditorGUI.EndBox(); }
protected override void DrawEditor(int index) { UniTweenSequence obj = (UniTweenSequence)CurrentDrawingTargets[index]; SirenixEditorGUI.BeginBox(obj.gameObject.name + ": " + obj.id); { base.DrawEditor(index); } SirenixEditorGUI.EndBox(); }
// ========================================================================== // #region Private private void BeginDrawListElement(int index) { if (p_listState[index] == null) { return; } #if ODIN_INSPECTOR && UNITY_EDITOR SirenixEditorGUI.BeginBox(this.p_listState[index].IDictionaryItem_GetKey().ToString()); #endif }
private void DrawWithDefaultLocator() { if (this.defaultPropertyTree == null) { this.defaultPropertyTree = PropertyTree.Create(new SomeClass()); } SirenixEditorGUI.BeginBox("Default Locator"); this.defaultPropertyTree.Draw(false); SirenixEditorGUI.EndBox(); }
private void DrawWithCustomLocator() { if (this.customPropertyTree == null) { this.customPropertyTree = PropertyTree.Create(new SomeClass()); this.customPropertyTree.AttributeProcessorLocator = new CustomMinionAttributeProcessorLocator(); } SirenixEditorGUI.BeginBox("Custom Locator"); this.customPropertyTree.Draw(false); SirenixEditorGUI.EndBox(); }
public void Draw() { SirenixEditorGUI.BeginBox(); SirenixEditorGUI.BeginBoxHeader(); { Rect rect = GUILayoutUtility.GetRect(100, 500, 20, 20).AddY(2); if (this.Icon != null) { EditorIcons.X.Draw(rect.AlignLeft(16).SetHeight(16).AddX(2), this.Icon); rect.xMin += 20; } GUI.Label(rect, this.Name); if (string.IsNullOrEmpty(this.registration.DocumentationUrl) == false) { GUILayout.FlexibleSpace(); if (GUILayout.Button("Documentation", SirenixGUIStyles.MiniButton)) { Help.BrowseURL(this.registration.DocumentationUrl); } } } SirenixEditorGUI.EndBoxHeader(); if (string.IsNullOrEmpty(this.registration.Description) == false) { GUILayout.Label(this.registration.Description); } SirenixEditorGUI.EndBox(); GUILayout.Space(15); if (this.examples.Length > 0) { this.tabGroup.BeginGroup(); foreach (var example in this.examples) { var tab = this.tabGroup.RegisterTab(example.ExampleInfo.Name); if (tab.BeginPage()) { example.Draw(this.DrawCodeExample); } tab.EndPage(); } this.tabGroup.EndGroup(); } else { GUILayout.Label("No examples available."); } }
// Remember to add the OdinDrawer to your custom drawer classes, or they will not be found by Odin. protected override void DrawPropertyLayout(GUIContent label) { GUILayout.Space(8f); // Changes the current GUI transform matrix, to make the inspector party. if (Event.current.rawType != EventType.Layout) { Vector3 offset = this.Property.LastDrawnValueRect.position + new Vector2(this.Property.LastDrawnValueRect.width, this.Property.LastDrawnValueRect.height) * 0.5f; Matrix4x4 matrix = Matrix4x4.TRS(offset, Quaternion.identity, Vector3.one) * Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(Mathf.Sin((float)EditorApplication.timeSinceStartup * this.Attribute.Speed) * this.Attribute.Range, Vector3.forward), Vector3.one * (1f + MathUtilities.BounceEaseInFastOut(Mathf.Sin((float)UnityEditor.EditorApplication.timeSinceStartup * 2f)) * 0.1f)) * Matrix4x4.TRS(-offset + new Vector3(Mathf.Sin((float)EditorApplication.timeSinceStartup * 2f), 0f, 0f) * 100f, Quaternion.identity, Vector3.one) * GUI.matrix; GUIHelper.PushMatrix(matrix); } // Changes the party color. if (Event.current.rawType == EventType.Repaint) { float t = MathUtilities.Bounce(Mathf.Sin((float)EditorApplication.timeSinceStartup * 2f)); if (t <= 0f) { this.start = this.target; this.target = UnityEngine.Random.ColorHSV(0f, 1f, 0.8f, 1f, 1f, 1f); } GUIHelper.PushColor(Color.Lerp(this.start, this.target, t)); } // Draws all the child properties of the group. SirenixEditorGUI.BeginBox(); for (int i = 0; i < this.Property.Children.Count; i++) { var child = this.Property.Children[i]; child.Draw(child.Label); } SirenixEditorGUI.EndBox(); // Revert changes to GUI color and matrix. if (Event.current.rawType == EventType.Repaint) { GUIHelper.PopColor(); } if (Event.current.rawType != EventType.Layout) { GUIHelper.PopMatrix(); } // Request a repaint for fluid motion. GUIHelper.RequestRepaint(); GUILayout.Space(8f); }
protected override void DrawEditor(int index) { UniTweenSequencePlayer obj = (UniTweenSequencePlayer)CurrentDrawingTargets[index]; if (obj != null) { SirenixEditorGUI.BeginBox($"{obj.gameObject.name} : {obj.DisplayName}"); { base.DrawEditor(index); } SirenixEditorGUI.EndBox(); } }
/// <summary> /// Draws the property. /// </summary> protected override void DrawPropertyLayout(IPropertyValueEntry <T> entry, GUIContent label) { if (entry.ValueState == PropertyValueState.Reference) { var isToggled = entry.Context.GetPersistent(this, "is_Toggled", false); var targetProp = entry.Property.Tree.GetPropertyAtPath(entry.TargetReferencePath); SirenixEditorGUI.BeginBox(); SirenixEditorGUI.BeginBoxHeader(); EditorGUILayout.BeginHorizontal(); isToggled.Value = label != null?SirenixEditorGUI.Foldout(isToggled.Value, label) : SirenixEditorGUI.Foldout(isToggled.Value, GUIHelper.TempContent("")); if (targetProp.Parent == null) { EditorGUILayout.LabelField("Reference to " + targetProp.Path, SirenixGUIStyles.RightAlignedGreyMiniLabel); } else { EditorGUILayout.LabelField("Reference to " + targetProp.Path, SirenixGUIStyles.RightAlignedGreyMiniLabel); } EditorGUILayout.EndHorizontal(); SirenixEditorGUI.EndBoxHeader(); if (SirenixEditorGUI.BeginFadeGroup(UniqueDrawerKey.Create(entry.Property, this), isToggled.Value)) { //EditorGUI.indentLevel++; //GUIHelper.PushGUIEnabled(true); var isInReference = targetProp.Context.GetGlobal("is_in_reference", false); bool previous = isInReference.Value; isInReference.Value = true; InspectorUtilities.DrawProperty(targetProp); isInReference.Value = previous; //GUIHelper.PopGUIEnabled(); //EditorGUI.indentLevel--; } SirenixEditorGUI.EndFadeGroup(); SirenixEditorGUI.EndBox(); } else { this.CallNextDrawer(entry.Property, label); } }
//[TabGroup("状态效果配置/TabGroup", "结束")] //[LabelText("效果列表")] //public SkillEffectToggleGroup[] EndEffectGroupList; private void BeginBox() { //if (GUILayout.Button("+")) //{ // var list = RunningEffectGroupList.ToList(); // list.Add(new SkillEffectToggleGroup()); // RunningEffectGroupList = list.ToArray(); //} GUILayout.Space(30); SirenixEditorGUI.DrawThickHorizontalSeparator(); //SirenixEditorGUI.DrawHorizontalLineSeperator(, 0, 10); GUILayout.Space(10); SirenixEditorGUI.BeginBox("状态表现"); }
void ShowGenerateButton() { SirenixEditorGUI.BeginBox(); if (GUILayout.Button("Generate")) { Debug.ClearDeveloperConsole(); for (int i = 0; i < TimesToGenerate; i++) { generatedText = RunGeneration(); } } SirenixEditorGUI.MessageBox(generatedText); SirenixEditorGUI.EndBox(); }
private void OnGUI() { GUILayout.BeginHorizontal(); { #if !ODIN_INSPECTOR GUILayout.Label("缺少Odin!"); #endif #if ODIN_INSPECTOR EXPORT_PATH = BApplication.DevOpsPublishAssetsPath; if (editorScript != null) { //GUILayout.BeginVertical(); SirenixEditorGUI.BeginBox("脚本", true, GUILayout.Width(220), GUILayout.Height(450)); editorScript.OnGUI(); SirenixEditorGUI.EndBox(); //GUILayout.EndVertical(); } // Layout_DrawLineV(Color.white); if (editorAsset != null) { SirenixEditorGUI.BeginBox("资源", true, GUILayout.Width(220), GUILayout.Height(450)); editorAsset.OnGUI(); SirenixEditorGUI.EndBox(); } // Layout_DrawLineV(Color.white); if (editorTable != null) { SirenixEditorGUI.BeginBox("表格", true, GUILayout.Width(200), GUILayout.Height(450)); editorTable.OnGUI(); SirenixEditorGUI.EndBox(); //Layout_DrawLineV(Color.white); } #endif } GUILayout.EndHorizontal(); EditorGUILayoutEx.Layout_DrawLineH(Color.white); //绘制一键导出和构建Editor WebServer GUILayout.BeginHorizontal(); OnGUI_OneKeyExprot(); EditorGUILayoutEx.Layout_DrawLineV(Color.white); OnGUI_PublishEditorService(); GUILayout.EndHorizontal(); }
public void drawFilter(NodeFilter filter) { if (filter != null) { if (filter.orientation == PortOrientation.In) { SirenixEditorGUI.BeginBox(); Rect rect = EditorGUILayout.GetControlRect(); rect = EditorGUI.PrefixLabel(rect, new GUIContent("In filter")); if (GUI.Button(rect.AlignRight(15), EditorIcons.ArrowDown.Raw)) { filter.style.unfolded = !filter.style.unfolded; } ; SirenixEditorGUI.EndBox(); // NodeEditorGUILayout.AddPortField(filter.port); } else { SirenixEditorGUI.BeginBox(); Rect rect = EditorGUILayout.GetControlRect(); EditorGUI.LabelField(rect.AlignRight(60), "Out filter"); if (GUI.Button(rect.AlignLeft(15), EditorIcons.ArrowDown.Raw)) { filter.style.unfolded = !filter.style.unfolded; } ; SirenixEditorGUI.EndBox(); } // NodeEditorGUILayout. if (filter.style.unfolded) { SirenixEditorGUI.BeginBox(); for (int i = 0; i < filter.filter.Count; i++) { drawEntity(filter.filter[i]); } SirenixEditorGUI.EndBox(); } else { NodeEditorGUILayout.AddPortField(filter.port); } } }
protected override void DrawPort(GUIContent label) { SirenixEditorGUI.BeginBox(); SirenixEditorGUI.BeginBoxHeader(); isUnfolded.Value = SirenixEditorGUI.Foldout(isUnfolded.Value, label == null ? GUIContent.none : label); NodePortDrawerHelper.DrawPortHandle(NodePortInfo); SirenixEditorGUI.EndBoxHeader(); if (SirenixEditorGUI.BeginFadeGroup(this, isUnfolded.Value)) { CallNextDrawer(null); } SirenixEditorGUI.EndFadeGroup(); SirenixEditorGUI.EndBox(); }
protected override void DrawPropertyLayout(GUIContent label) { SirenixEditorGUI.BeginBox(); { SirenixEditorGUI.BeginToolbarBoxHeader(); { var rect = GUILayoutUtility.GetRect(0, 19); var unityObjectFieldRect = rect.Padding(2).AlignLeft(rect.width / 2); var methodSelectorRect = rect.Padding(2).AlignRight(rect.width / 2 - 5); var dInfo = this.GetDelegateInfo(); var intlabel = new GUIContent("some type"); EditorGUI.BeginChangeCheck(); var someType = SirenixEditorFields.Dropdown(intlabel, tempType, SupportedReturnTypes); /*public static bool Dropdown<T>(Rect rect, IList<int> selected, IList<T> items, bool multiSelection)*/ var newTarget = SirenixEditorFields.UnityObjectField(unityObjectFieldRect, dInfo.Target, typeof(UnityEngine.Object), true); if (EditorGUI.EndChangeCheck()) { this.tmpTarget = newTarget; this.tempType = someType; } EditorGUI.BeginChangeCheck(); var selectorText = (dInfo.Method == null || this.tmpTarget) ? "Select a method" : dInfo.Method.Name; var newMethod = MethodSelector.DrawSelectorDropdown(methodSelectorRect, selectorText, this.CreateSelector); if (EditorGUI.EndChangeCheck()) { this.CreateAndAssignNewDelegate(newMethod.FirstOrDefault()); this.tmpTarget = null; } } SirenixEditorGUI.EndToolbarBoxHeader(); // Draws the rest of the ICustomEvent, and since we've drawn the label, we simply pass along null. for (int i = 0; i < this.Property.Children.Count; i++) { var child = this.Property.Children[i]; if (child.Name == "Result") { continue; } child.Draw(); } } SirenixEditorGUI.EndBox(); }
/// <summary> /// Draws the property. /// </summary> protected override void DrawPropertyGroupLayout(InspectorProperty property, BoxGroupAttribute attribute, GUIContent label) { var labelGetter = property.Context.Get <StringMemberHelper>(this, "LabelContext", (StringMemberHelper)null); if (labelGetter.Value == null) { labelGetter.Value = new StringMemberHelper(property.ParentType, attribute.GroupName); } SirenixEditorGUI.BeginBox(attribute.ShowLabel ? labelGetter.Value.GetString(property) : null, attribute.CenterLabel); for (int i = 0; i < property.Children.Count; i++) { InspectorUtilities.DrawProperty(property.Children[i]); } SirenixEditorGUI.EndBox(); }