void SubCollider_List() { if (_rc.SubColliders != null && _rc.SubColliders.Length > 0) { Util.CustomEditorGUI.NewParagraph("[Sub Colliders(Can not change)]"); foreach (var subCollider in _rc.SubColliders) { if (subCollider != null) { using (new EditorGUILayout.HorizontalScope()) { using (new GUIBackgroundColorScope(Util.CustomEditorGUI.Color_LightYellow)) { if (GUILayout.Button("Del")) { Undo.RecordObject(_rc, "Destroy : SubCollider"); Undo.DestroyObjectImmediate(subCollider.gameObject); EditorUtility.SetDirty(_rc.gameObject); } } EditorGUILayout.ObjectField(subCollider, typeof(BoxCollider), allowSceneObjects: true); } } } } CustomEditorGUI.DrawSeperator(); }
void Inspector_Attached() { bool bUpdate = false; EditorGUI.indentLevel++; if (bShowCreateAttachmentBtn = EditorGUILayout.Foldout(bShowCreateAttachmentBtn, "Create Attachment! (each button has a tooltip)")) { CustomEditorGUI.DrawSeperator(); EditorGUILayout.LabelField("In Auto ISO, SortingOrder = Tile SO + Overlay Child Index"); bUpdate |= createAttachmentBTN(CustomEditorGUI.Color_Overlay, IsoMap.Prefab_Overlay, new GUIContent("Overlay", "This is for tile decoration, \nthere is no collider.")); CustomEditorGUI.DrawSeperator(); EditorGUILayout.LabelField("In Auto ISO, SortingOrder = Position-based calculation of RC"); using (new EditorGUILayout.HorizontalScope()) { bUpdate |= createAttachmentBTN(CustomEditorGUI.Color_Trigger, IsoMap.Prefab_TriggerPlane, new GUIContent("Trigger-IsoPlane", "This is throughtable object on the tile, \nhas trigger collider.")); bUpdate |= createAttachmentBTN(CustomEditorGUI.Color_Trigger, IsoMap.Prefab_TriggerCube, new GUIContent("Trigger-Cube", "This is throughtable object on the tile, \nhas trigger collider.")); bUpdate |= createAttachmentBTN(CustomEditorGUI.Color_Obstacle, IsoMap.Prefab_Obstacle, new GUIContent("Obstacle", "This is an obstacle on the tile, \nthere is a physical collider.")); } CustomEditorGUI.DrawSeperator(); if (bUpdate) { childInfoUpdate(); } } EditorGUI.indentLevel--; CustomEditorGUI.AttachmentHierarchyField(serializedObject, "_attachedList"); }
void iso2D_controller() { if (_childIso2D_0 == null) { return; } if (!(bHide_Iso2D = Util.CustomEditorGUI.NewParagraphWithHideToggle("[Iso2DObject Control Helper]", "Hide", bHide_Iso2D))) { EditorGUI.indentLevel = 0; float fWidth = EditorGUIUtility.currentViewWidth * 0.475f; float mfWidth = fWidth * 0.95f; fScaleSliderValue = Mathf.Max(1f, EditorGUILayout.FloatField("Cap of Sliders", fScaleSliderValue)); Vector3 v3Max = Vector3.one * fScaleSliderValue; using (new EditorGUILayout.HorizontalScope()) { using (new EditorGUILayout.VerticalScope()) { EditorGUI.BeginChangeCheck(); _spIso2DScaleMultiplier.vector3Value = Util.CustomEditorGUI.Vector3Slider( _spIso2DScaleMultiplier.vector3Value, Vector3.one, "Scale", Vector3.one * 0.1f, v3Max, mfWidth); if (EditorGUI.EndChangeCheck()) { foreach (var r in _rc.Iso2Ds) { r.Undo_LocalScale(_spIso2DScaleMultiplier.vector3Value); } } } using (new EditorGUILayout.VerticalScope()) { Vector3 _origin = _rc.Iso2Ds[0].GetPosition_WithoutFudge() - _rc.transform.position; EditorGUI.BeginChangeCheck(); Vector3 _new = Util.CustomEditorGUI.Vector3Slider( _origin, Vector3.zero, "Iso2D Position Handle", -v3Max, v3Max, mfWidth); if (EditorGUI.EndChangeCheck()) { Vector3 _diff = _new - _origin; for (int i = 0; i < _rc.Iso2Ds.Length; ++i) { _rc.Iso2Ds[i].Undo_PositionOffset(_rc.Iso2Ds[i].GetPosition_WithoutFudge() + _diff); } } } } } CustomEditorGUI.DrawSeperator(); EditorGUILayout.Separator(); }
void OnGUI() { showHelpMSG(); // Select Lookup Object CustomEditorGUI.DrawSeperator(); GUILayout.Label(new GUIContent("Lockup Object", "Root of Object"), EditorStyles.boldLabel); lookUpSource = EditorGUILayout.ObjectField("", lookUpSource, typeof(GameObject), allowSceneObjects: true) as GameObject; ShowAtlasList(); ShowSpriteList(); }
void ShowAtlasList() { CustomEditorGUI.DrawSeperator(); GUILayout.Label("SpriteAtlas List", EditorStyles.boldLabel); var keys = AtlasGridDic.Keys.GetEnumerator(); while (keys.MoveNext()) { var key = keys.Current; AtlasField(key, true); AtlasGridDic[key].ShowGrid(); } }
void OnGUI() { showHelpMSG(); CustomEditorGUI.DrawSeperator(); GUILayout.Label(new GUIContent("Target Object", "Root of Object"), EditorStyles.boldLabel); UpdateSelectedObject(); if (lookUpSource != null) { UtilBtns(); CustomEditorGUI.DrawSeperator(); CustomEditorGUI.AttachmentListDraw(this, isoHierarchy, ref vScrollPos); } }
void sortingOrder() { using (new EditorGUILayout.HorizontalScope()) { Util.CustomEditorGUI.NewParagraph(string.Format("[SortingOrder {0}]", _rc.CalcSortingOrder(true))); // EditorGUILayout.Toggle(new GUIContent("Force to OnGroundObject", ""), false); } var basis = _rc.GetISOBasis(); if (basis != null) { EditorGUILayout.ObjectField("Modified by", basis, typeof(ISOBasis), allowSceneObjects: true); } CustomEditorGUI.DrawSeperator(); }
void showHelpMSG() { if (EditorApplication.isPlayingOrWillChangePlaymode) { GUILayout.Label("Not available in Play mode!", EditorStyles.boldLabel); return; } CustomEditorGUI.DrawSeperator(); if (bFoldoutMSG = EditorGUILayout.Foldout(bFoldoutMSG, "[Help MSG]")) { GUILayout.Label(HelpMSG_00, EditorStyles.boldLabel); EditorGUILayout.HelpBox(HelpMSG_01, MessageType.Info); GUILayout.Label(HelpMSG_02, EditorStyles.boldLabel); EditorGUILayout.HelpBox(HelpMSG_03, MessageType.Info); } }
void ShowSpriteList() { if (!lookUpSource) { return; } CustomEditorGUI.DrawSeperator(); GUILayout.Label("Sprite List", EditorStyles.boldLabel); if (SpritesInSource.Count > 0) { CustomEditorGUI.SimpleGrid <Sprite> .Show( string.Format("{0} Sprites used in Source Object", SpritesInSource.Count), ShowClassifiedSprite, SpritesInSource.GetEnumerator(), "Clear Selection", () => { SelectedSprites.Clear(); }, ref fSpriteGridSize, ref bFoldoutSpriteList, ref vSpriteScroll); } }
public override void OnInspectorGUI() { if (bPrefab) { base.DrawDefaultInspector(); return; } if (undoredo()) { return; } serializedObject.Update(); if (!bCollapseOtherItems) { ShowSelector(); EditorGUILayout.LabelField("[Bulk Control]", EditorStyles.boldLabel); ShowResize(); ShowBulkControl(); EditorGUILayout.Separator(); EditorGUILayout.LabelField("[Tile Control]", EditorStyles.boldLabel); ShowTileControl(); EditorGUILayout.Separator(); } using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField("[Selection Filter]", EditorStyles.boldLabel); bCollapseOtherItems = EditorGUILayout.Toggle("Collapse other items", bCollapseOtherItems); } ShowTileFilter(); CustomEditorGUI.DrawSeperator(); ShowTileFilterControl(); EditorGUILayout.Separator(); serializedObject.ApplyModifiedProperties(); }
void OnGUI() { if (UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode) { GUILayout.Label("Not available in Play mode!", EditorStyles.boldLabel); return; } GUILayout.Label(HelpMSG_00, EditorStyles.boldLabel); GUILayout.Space(4); EditorGUILayout.HelpBox(HelpMSG_01, MessageType.Info); CustomEditorGUI.DrawSeperator(); origin = EditorGUILayout.ObjectField(new GUIContent("Source", "Root of Sources"), origin, typeof(GameObject), allowSceneObjects: true) as GameObject; CustomEditorGUI.DrawSeperator(); if (bFoldoutComponentList = EditorGUILayout.Foldout(bFoldoutComponentList, string.Format("The remaining components({0})", FilteredComponent.Count))) { var enumerator = FilterableComponent.GetEnumerator(); EditorGUI.indentLevel++; while (enumerator.MoveNext()) { var current = enumerator.Current; using (new EditorGUI.DisabledGroupScope(!current.Value)) { bool bFiltered = FilteredComponent.Contains(current.Key); EditorGUI.BeginChangeCheck(); bool bToggle = EditorGUILayout.ToggleLeft(current.Key.ToString(), bFiltered); if (EditorGUI.EndChangeCheck()) { if (bToggle && !bFiltered) { FilteredComponent.Add(current.Key); } else if (bFiltered) { FilteredComponent.Remove(current.Key); } } } } EditorGUI.indentLevel--; } if (isForNavMesh) { EditorGUI.indentLevel += 2; layerMask = CustomEditorGUI.LayerMaskField("LayerMask", layerMask); EditorGUI.indentLevel -= 2; } if (isRemovableState) { bRemoveAll = EditorGUILayout.ToggleLeft("Remove All(except for Nav Mesh)", bRemoveAll); } using (new EditorGUI.DisabledGroupScope(!origin)) { if (GUILayout.Button("Bake!", GUILayout.Height(30))) { Bake(); } } if (CustomEditorGUI.DestroyOBJBtn(baked, "Baked", GUILayout.Height(30))) { baked = null; } }
void SortingOrder(ref bool bLocalOnGroundToggle, ref bool bGlobalChanged, ref bool bChangedDepthTransform) { _spDoNotDestroyAutomatically.boolValue = EditorGUILayout.ToggleLeft( new GUIContent("[Tooltip] This Will not automatically destroyed.", "If you enable this option, this ISOBasis will not be automatically destroyed" + " even if the [Offset for GroundObject setting of IsoMap] is turned off."), _spDoNotDestroyAutomatically.boolValue); CustomEditorGUI.DrawSeperator(); if (IsoMap.IsNull || !IsoMap.instance.bUseIsometricSorting) { EditorGUILayout.HelpBox("SortingOrder Basis only works in Auto ISO mode.", MessageType.Info); } else { EditorGUI.BeginChangeCheck(); _spISOOffest.vector3Value = Util.CustomEditorGUI.Vector3Slider( _spISOOffest.vector3Value, Vector3.zero, "SortingOrder Basis", -0.5f * Vector3.one, 0.5f * Vector3.one, EditorGUIUtility.currentViewWidth); bLocalOnGroundToggle |= EditorGUI.EndChangeCheck(); } CustomEditorGUI.DrawSeperator(); using (new EditorGUILayout.HorizontalScope()) { EditorGUI.BeginChangeCheck(); _spOnGroundObject.boolValue = EditorGUILayout.ToggleLeft("IsOnGroundObject", _spOnGroundObject.boolValue); bLocalOnGroundToggle |= EditorGUI.EndChangeCheck(); if (_spOnGroundObject.boolValue) { bEditOnGroundOffset = EditorGUILayout.Toggle("Edit Global Offset", bEditOnGroundOffset); } } if (_spISOOffest == null) { return; } float fOnGroundOffset = IsoMap.instance.fOnGroundOffset; if (_ISOTarget == null) { Debug.LogWarning("ISOBasis must be located in the game object where the RC or ISO components reside."); return; } if (_spOnGroundObject.boolValue) { Util.CustomEditorGUI.NewParagraph("[Tooltip], What is OnGroundOffset? ", "Give them a global offset so that things on the ground are not covered by the edge of tile image of the ground.\n" + "This has the effect of changing the screen depth of the Sprite object. In particular, it affects the SO calculation in AutoIso mode."); if (IsoMap.instance.bUseIsometricSorting) { string desc = string.Format("New SortingOrder is {0}: Modified from {1}", _ISOTarget.CalcSortingOrder(true), _ISOTarget.CalcSortingOrder(false)); EditorGUILayout.LabelField(desc); } if (_targetIsoBasis.Parent != null) { EditorGUILayout.ObjectField("Parent ISOBasis", _targetIsoBasis.Parent, typeof(ISOBasis), allowSceneObjects: true); } else { if (bEditOnGroundOffset) { EditorGUI.BeginChangeCheck(); fOnGroundOffset = Util.CustomEditorGUI.FloatSlider("Global Offset", fOnGroundOffset, 0, 1, EditorGUIUtility.currentViewWidth); CustomEditorGUI.Button(true, CustomEditorGUI.Color_LightBlue, string.Format("Reset ({0})", IsoMap.fOnGroundOffset_Default), () => fOnGroundOffset = IsoMap.fOnGroundOffset_Default, GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth)); bGlobalChanged |= EditorGUI.EndChangeCheck(); if (bGlobalChanged) { Undo.RecordObject(IsoMap.instance, "ISOBasis: Edit Ground Offset"); IsoMap.instance.fOnGroundOffset = fOnGroundOffset; } } EditorGUILayout.Space(); bChangedDepthTransform = CustomTransform_ForFudge(); CustomEditorGUI.DrawSeperator(); } } return; }