public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.Separator(); CustomEditorGUI.GridCoordinatesField(serializedObject); serializedObject.ApplyModifiedProperties(); }
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"); }
private void OnEnable() { if (IsPrefab = CustomEditorGUI.IsPrefab(targets)) { return; } }
bool CustomTransform_ForFudge() { GUIContent label = new GUIContent(string.Format("Transforms({0}) with Auto Depth", _spTransformsForFudge.arraySize), "Transforms registered here automatically apply Depth as much as Global Ground Offset. " + "Excluding it from the list restores the origin transform."); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(_spTransformsForFudge, label, true); if (_spTransformsForFudge.isExpanded) { using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("Auto Setup")) { serializedObject.ApplyModifiedProperties(); _targetIsoBasis.AutoSetup_DepthTransforms(); serializedObject.Update(); } CustomEditorGUI.Button(true, Color.gray, "Clear Depthed Transforms", () => { _spTransformsForFudge.ClearArray(); }); } } return(EditorGUI.EndChangeCheck()); }
public static Sprite SpriteField(Sprite sprite, params GUILayoutOption[] options) { EditorGUILayout.LabelField("", "", options); var rect = GUILayoutUtility.GetLastRect(); return(CustomEditorGUI.SpriteField(rect, sprite)); }
void removeComponents(GameObject target) { var comEnumerator = FilterableComponent.GetEnumerator(); if (isForNavMesh && CustomEditorGUI.IsMaskedLayer(layerMask, target)) { var col = target.GetComponent <Collider>(); if (col && col.enabled && !col.isTrigger) { var meshObj = MeshForNavmesh.Bake(col); meshObj.transform.parent = RootForNavMesh; meshObj.isStatic = true; IsoTile tile = target.GetComponentInParent <IsoTile>(); if (tile != null) { meshObj.name = tile.name; } } } while (comEnumerator.MoveNext()) { var type = comEnumerator.Current.Key; if ((type.IsSubclassOf(typeof(Component)) || type.IsSubclassOf(typeof(MonoBehaviour)) || type.IsInterface) && !FilteredComponent.Contains(type)) { var com = target.GetComponent(type); if (com) { DestroyImmediate(com); } } } }
void OnEnable() { if (target == null || Selection.activeGameObject == null) { return; } if (bPrefab = CustomEditorGUI.IsPrefab(targets)) { return; } update_InspectorTile(); if (screenInfoFontStyle == null) { screenInfoFontStyle = new GUIStyle(); screenInfoFontStyle.normal.textColor = Color.green; screenInfoFontStyle.fontStyle = FontStyle.Bold; screenInfoFontStyle.fontSize = 15; } if (SceneView.lastActiveSceneView != null && bFrameSelected) { SceneView.lastActiveSceneView.FrameSelected(false); } }
public override void OnInspectorGUI() { if (IsPrefab) { base.DrawDefaultInspector(); return; } if (undoredo()) { return; } serializedObject.Update(); if (Event.current.type == EventType.Layout) { update_childIso2D_0(); } sortingOrder(); iso2D_controller(); SubCollider_Create(); SubCollider_List(); CustomEditorGUI.ColliderControlHelperGUI(targets); serializedObject.ApplyModifiedProperties(); }
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 Union_Field(Rect _Rect, string _MSG, Iso2DObject _obj, Color _color) { _Rect.height = EditorGUIUtility.singleLineHeight; EditorGUI.LabelField(_Rect, _MSG); _Rect.y += _Rect.height; CustomEditorGUI.Undo_Iso2DSpriteField(_Rect, _obj.sprr.sprite, Iso2DObject.GetSideListOfTileSelection(Iso2DObject.Type.Side_Union), _color); }
public void SetTarget() { EditorGUILayout.Separator(); EditorGUILayout.LabelField("[Target Select Helper]", EditorStyles.boldLabel); lookupObject = EditorGUILayout.ObjectField(lookupObject, typeof(GameObject), allowSceneObjects: true) as GameObject; if (lookupObject != null && PrefabHelper.IsPrefab(lookupObject)) { lookupObject = null; Debug.Log("Prefab is not allowed. Please select only the GameObject in the scene."); } if (lookupObject) { using (new EditorGUILayout.HorizontalScope()) { bIncludeChild = EditorGUILayout.ToggleLeft("Include Child", bIncludeChild); if (GUILayout.Button("Add")) { light.AddTarget(lookupObject, bIncludeChild); } if (GUILayout.Button("Remove")) { light.RemoveTarget(lookupObject, bIncludeChild); } } } EditorGUILayout.Separator(); layerMask = CustomEditorGUI.LayerMaskField("Layer Mask for Add/Remove", layerMask); GUILayoutOption halfWidth = GUILayout.Width(EditorGUIUtility.currentViewWidth * 0.5f); using (new EditorGUILayout.HorizontalScope()) { using (new EditorGUI.DisabledGroupScope(layerMask == 0)) { if (GUILayout.Button("Add all Masked Iso2DBase", halfWidth)) { light.AddTarget_All(layerMask); } if (GUILayout.Button("Clear all Masked layer", halfWidth)) { light.RemoveTarget_All(layerMask); } } } EditorGUILayout.Separator(); using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("Add all Iso2DBase", halfWidth)) { light.AddTarget_All(layerMask); } if (GUILayout.Button("Clear TargetList", halfWidth)) { light.RemoveTarget_All(); } } }
public override void OnInspectorGUI() { if (IsPrefab) { base.DrawDefaultInspector(); return; } CustomEditorGUI.ColliderControlHelperGUI(targets); }
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 showClassifiedSprite(Sprite sprite, float fWidth, bool bImgOnly) { var evt = Event.current; GUILayoutOption wOption = GUILayout.Width(fWidth), hOption = GUILayout.Height(bImgOnly ? fWidth : (fWidth - 2 * EditorGUIUtility.singleLineHeight)); using (new EditorGUILayout.VerticalScope(wOption)) { Rect ImgRT = EditorGUILayout.GetControlRect(wOption, hOption); if (SelectedSprites.Contains(sprite)) { EditorGUI.DrawRect(ImgRT, Color.gray); } CustomEditorGUI.DrawSprite(ImgRT, sprite, Color.clear, true, true); if (!bImgOnly) { EditorGUILayout.ObjectField(sprite, typeof(Sprite), allowSceneObjects: false, options: wOption); if (SpriteAtlasDic.ContainsKey(sprite)) { AtlasField(SpriteAtlasDic[sprite], false); } } if (ImgRT.Contains(evt.mousePosition)) { if (evt.type == EventType.MouseUp || evt.type == EventType.MouseDrag) { if (!SelectedSprites.Contains(sprite)) { SelectedSprites.Add(sprite); } else if (evt.type == EventType.MouseUp) { SelectedSprites.Remove(sprite); } if (evt.type == EventType.MouseDrag) { DragAndDrop.PrepareStartDrag(); DragAndDrop.objectReferences = SelectedSprites.ToArray(); DragAndDrop.StartDrag("Dragging title"); } Event.current.Use(); } } } }
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 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); } }
static bool createAttachmentBTN(Color color, GameObject prefab, GUIContent content) { if (prefab != null) { using (new GUIBackgroundColorScope(color)) { GameObject newAttachment = CustomEditorGUI.Undo_TileDeco_Instantiate_DoAll(prefab, content, true); if (newAttachment != null) { var _tile = newAttachment.GetComponentInParent <IsoTile>(); _tile.SyncIsoLight(newAttachment); } return(true); } } return(false); }
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); } }
public override void OnInspectorGUI() { if (bPrefab) { base.DrawDefaultInspector(); return; } if (undoredo()) { return; } EditorGUILayout.Separator(); CustomEditorGUI.Iso2DObjectField(serializedObject); EditorGUILayout.Separator(); }
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); } }
void GridCoordinatesField() { GridCoordinates _gc = (GridCoordinates)(target); Vector3 _gridXYZ = _gc._xyz; float _fWidth = EditorGUIUtility.currentViewWidth * 0.475f; float _mfWidth = _fWidth * 0.95f; using (new EditorGUILayout.HorizontalScope()) { using (new EditorGUILayout.VerticalScope()) { CustomEditorGUI.NewParagraph("[Grid Coordinates]", GUILayout.MaxWidth(_mfWidth * 0.75f)); EditorGUI.showMixedValue = _snapFree.hasMultipleDifferentValues; EditorGUI.BeginChangeCheck(); EditorGUILayout.ToggleLeft(new GUIContent("Snap To Grid", "Snap to Grid Coordinates"), !_gc.bSnapFree, GUILayout.MaxWidth(_mfWidth * 0.75f)); if (EditorGUI.EndChangeCheck()) { foreach (var one in targets) { GCSnapToggle((GridCoordinates)one, !_gc.bSnapFree); } } EditorGUI.showMixedValue = false; if (!_gc.bSnapFree) { EditorGUILayout.LabelField(string.Format("F{1:0}_({0:0}, {2:0})", _gridXYZ.x, _gridXYZ.y, _gridXYZ.z), GUILayout.MaxWidth(_mfWidth * 0.75f)); EditorGUILayout.Separator(); } } using (new EditorGUILayout.VerticalScope(GUILayout.Width(_fWidth * 0.4f))) { Util.CustomEditorGUI.NewParagraph("[Transform Position]", GUILayout.MaxWidth(_mfWidth * 0.9f)); EditorGUILayout.LabelField("Global" + _gc.transform.position, GUILayout.MaxWidth(_mfWidth * 0.9f)); EditorGUILayout.LabelField("Local" + _gc.transform.localPosition, GUILayout.MaxWidth(_mfWidth * 0.9f)); } } }
public static bool PropertyField(SerializedProperty property, GUIContent label, bool includeChildren, params GUILayoutOption[] options) { if (includeChildren || property.propertyType == SerializedPropertyType.Generic) { property.isExpanded = EditorGUILayout.Foldout(property.isExpanded, property.displayName); if (includeChildren && property.isExpanded) { foreach (SerializedProperty childProperty in property) { PropertyField(childProperty, new GUIContent(property.displayName), false, options); } } return(false); } Rect position = EditorGUILayout.GetControlRect(label.text.Length > 0, EditorGUI.GetPropertyHeight(property), options); CustomEditorGUI.PropertyField(position, property, label, includeChildren); return(property.hasChildren && property.isExpanded && !includeChildren); }
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 Inspector_Attached() { using (new EditorGUILayout.HorizontalScope()) { bool bUpdate = false; using (new GUIBackgroundColorScope(Util.CustomEditorGUI.Color_Overlay)) { bUpdate = CustomEditorGUI.Undo_TileDeco_Instantiate_DoAll(IsoMap.instance.OverlayPrefab, "Create Overlay", true); } using (new GUIBackgroundColorScope(Util.CustomEditorGUI.Color_Obstacle)) { bUpdate = CustomEditorGUI.Undo_TileDeco_Instantiate_DoAll(IsoMap.instance.ObstaclePrefab, "Create Obstacle", true); } if (bUpdate) { childInfoUpdate(); } } CustomEditorGUI.AttachmentHierarchyField(serializedObject); }
Iso2DObject Side_Field(Rect _Rect, Iso2DObject.Type _sideType, Color _color, GameObject _prefab) { Iso2DObject _obj = _tile_Inspector.GetSideObject(_sideType); bool _bToggle = _obj != null; _Rect.height = EditorGUIUtility.singleLineHeight; EditorGUI.BeginChangeCheck(); _bToggle = EditorGUI.ToggleLeft(_Rect, _sideType.ToString(), _bToggle); if (EditorGUI.EndChangeCheck()) { for (int i = 0; i < Selection.gameObjects.Length; ++i) { if (Selection.gameObjects[i] == null) { continue; } IsoTile _t = Selection.gameObjects[i].GetComponent <IsoTile>(); if (_t != null && !_t.IsUnionCube()) { _t.Toggle_Side(_bToggle, _sideType); } } } List <Iso2DObject> _lookupList = Iso2DObject.GetSideListOfTileSelection(_sideType); if (_bToggle && _lookupList.Count > 0) { if (_obj == null) { _obj = _tile_Scene.GetSideObject(_sideType); } _Rect.y += _Rect.height; CustomEditorGUI.Undo_Iso2DSpriteField(_Rect, _obj.sprr.sprite, _lookupList, _color); } return(_obj); }
public static void Drawer(Rect rect, GameObject _target) { IsoTile _thisTile = _target.GetComponent <IsoTile>(); Iso2DObject _iso2D = _target.GetComponent <Iso2DObject>(); SpriteRenderer sprr = _target.GetComponent <SpriteRenderer>(); Color borderColor = Util.CustomEditorGUI.Color_Tile; if (_thisTile == null && _iso2D != null) { borderColor = CustomEditorGUI.Iso2DTypeColor(_iso2D._Type); } Rect rect_inside = new Rect(rect.xMin + border, rect.yMin + border, rect.width - border * 2, rect.height - border * 2); Rect rect_preview = new Rect(rect_inside.xMin, rect_inside.yMin, cellSize, rect_inside.height); Rect rect_info_name = new Rect(rect_preview.xMax, rect_inside.yMin, rect_inside.width - cellSize - fudgeWidth, rect_inside.height * 0.5f); Rect rect_Fudge = new Rect(rect_info_name.xMax, rect_inside.yMin, fudgeWidth, rect_inside.height * 0.5f - border); Rect rect_info_Sub = new Rect(rect_info_name.xMin, rect_info_name.yMin + cellSize * 0.5f, rect_info_name.width, rect_inside.height - rect_info_name.height); Rect[] rect_btns = new Rect[] { new Rect(rect_inside.xMax - cellSize * 1.1f, rect_info_Sub.yMin, cellSize, rect_info_Sub.height), new Rect(rect_inside.xMax - cellSize * 2.2f, rect_info_Sub.yMin, cellSize, rect_info_Sub.height), new Rect(rect_inside.xMax - cellSize * 3.3f, rect_info_Sub.yMin, cellSize, rect_info_Sub.height), new Rect(rect_inside.xMax - cellSize * 4.4f, rect_info_Sub.yMin, cellSize, rect_info_Sub.height) }; bool bControllerable = (_thisTile == null || _thisTile.gameObject != _target.gameObject) || (Selection.activeGameObject != null && Selection.activeGameObject.GetComponent <IsoTileBulk>()); CustomEditorGUI.DrawBordereddRect(rect, borderColor, rect_inside, Color.clear); CustomEditorGUI.DrawSideSprite(rect_preview, _iso2D, false, false); int iLv = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; EditorGUI.LabelField(rect_info_name, _target.name, EditorStyles.boldLabel); if (!IsoMap.instance.bUseIsometricSorting) { var IIsoBasis = _iso2D.GetComponentInParent <IISOBasis>(); var isOnGroundObject = false; if (IIsoBasis != null) { isOnGroundObject = IIsoBasis.IsOnGroundObject(); } else { isOnGroundObject = _iso2D.IsColliderAttachment; } float fOnGroundOffset = IsoMap.fCurrentOnGroundOffset; string msg = isOnGroundObject ? string.Format("Depth({0:0.00})", -fOnGroundOffset) : "Depth"; float _fTmp = CustomEditorGUI.FloatSlider(rect_Fudge, msg, _iso2D.FDepthFudge, -1f, 1f); if (_fTmp != _iso2D.FDepthFudge) { _iso2D.Undo_NewDepthFudge(_fTmp); } } // 서브 인포 출력 //using (new EditorGUILayout.HorizontalScope()) { float _fMinSize = Mathf.Min(rect_info_Sub.width, rect_info_Sub.height); SpriteRenderer[] _sprrList = _target.GetComponentsInChildren <SpriteRenderer>(); for (int i = 0; i < _sprrList.Length; ++i) { if (_sprrList[i].sprite != null && _sprrList[i] != sprr) { Rect _rt = EditorGUI.IndentedRect(rect_info_Sub); _rt.width = _rt.height = _fMinSize; rect_info_Sub.xMin += _fMinSize; // CustomEditorGUI.DrawSideSprite(_rt, _sprrList[i].sprite, ._Type); Util.CustomEditorGUI.DrawSprite(_rt, _sprrList[i].sprite, _sprrList[i].color, true, true); } } } if (bControllerable) { int buttonIndex = 0; CustomEditorGUI.Button(rect_btns[buttonIndex++], true, CustomEditorGUI.Color_LightYellow, "Ping!", () => { EditorGUIUtility.PingObject(_target.gameObject); }); CustomEditorGUI.Button(rect_btns[buttonIndex++], true, CustomEditorGUI.Color_LightGreen, "Iso2D", () => { Selection.activeGameObject = _target.gameObject; }); var ctlr = _target.transform.parent.GetComponentInParent <SubColliderHelper>(); if (Selection.activeGameObject != ctlr.gameObject) { CustomEditorGUI.Button(rect_btns[buttonIndex++], true, CustomEditorGUI.Color_LightGreen, "Ctlr!", () => { Selection.activeGameObject = ctlr.gameObject; }); } CustomEditorGUI.Button(rect_btns[buttonIndex++].ReSize(2f, 2f), true, CustomEditorGUI.Color_LightYellow, "Del!!", () => { _iso2D.DestoryGameObject(true, true); }); } EditorGUI.indentLevel = iLv; }
void Inspector_Side() { EditorGUILayout.Separator(); using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField("[Side Control]", EditorStyles.boldLabel, GUILayout.MaxWidth(120)); using (new GUIBackgroundColorScope(Util.CustomEditorGUI.Color_LightBlue)) { EditorGUI.BeginChangeCheck(); bool _bUnionMode = 1 == EditorGUILayout.Popup( _tile_Inspector.GetComponent <IsoTile>().IsUnionCube() ? 1 : 0, new string[] { "Side Mode", " Union Mode" }); if (EditorGUI.EndChangeCheck()) { foreach (GameObject _go in Selection.objects) { if (_go == null) { continue; } IsoTile _t = _go.GetComponent <IsoTile>(); if (_t != null && _t.IsUnionCube() != _bUnionMode) { _t.Reset_SideObject(_bUnionMode); } } } } } EditorGUILayout.Separator(); using (new EditorGUILayout.HorizontalScope()) { float fWidth = EditorGUIUtility.currentViewWidth / 3f; Rect _Rect = EditorGUILayout.GetControlRect( new GUILayoutOption[] { GUILayout.Height(fWidth), GUILayout.ExpandWidth(true) }); Rect[] _DescRectDivision; Rect[] _SubRects; if (_tile_Inspector.IsUnionCube()) { Iso2DObject _Union = _tile_Inspector.GetSideObject(Iso2DObject.Type.Side_Union); if (_Union != null) { SpriteRenderer sprr = _Union.sprr; _DescRectDivision = _Rect.Division( new float[] { 0.25f / 8f, 2.75f / 8f, 1 / 8f, 3f / 8f, 1f / 8f }, null); _SubRects = _DescRectDivision[1].Division(null, new float[] { 0.05f, 0.35f, 0.6f }); Union_Field(_SubRects[1], "Union Sprite", _Union, Handles.selectedColor); Util.CustomEditorGUI.DrawSprite(_SubRects[2].Division(new float[] { 0.25f, 0.5f }, null)[1], IsoMap.instance.IsoTile_Union_OutlineImage, Color.clear, true, false); CustomEditorGUI.DrawSideSprite(_DescRectDivision[3], _Union, false, false); } } else { _DescRectDivision = _Rect.Division( new float[] { 0.5f / 8f, 2.5f / 8f, 1f / 8f, 3 / 8f, 1f / 8f }, null); _SubRects = _DescRectDivision[1].Division(null, new float[] { 2 / 10f, 2 / 10f, 2 / 10f, 2 / 10f, 2 / 10f }); _Rect = _DescRectDivision[3].Division(new float[] { 0.1f, 0.8f }, new float[] { 0.2f, 0.8f })[3]; Util.CustomEditorGUI.DrawSprite(_Rect, IsoMap.instance.IsoTile_Side_OutlineImage, Color.clear, false, false); Iso2DObject _Iso2D_x = Side_Field(_SubRects[0], Iso2DObject.Type.Side_X, Handles.xAxisColor, IsoMap.instance.Side_X_Prefab); Iso2DObject _Iso2D_y = Side_Field(_SubRects[2], Iso2DObject.Type.Side_Y, Handles.yAxisColor, IsoMap.instance.Side_Y_Prefab); Iso2DObject _Iso2D_z = Side_Field(_SubRects[4], Iso2DObject.Type.Side_Z, Handles.zAxisColor, IsoMap.instance.Side_Z_Prefab); CustomEditorGUI.DrawSideSprite(_Rect, _Iso2D_y, false, false); CustomEditorGUI.DrawSideSprite(_Rect, _Iso2D_x, false, false); CustomEditorGUI.DrawSideSprite(_Rect, _Iso2D_z, false, false); } } EditorGUILayout.Space(); EditorGUILayout.Space(); }
public void InstanceList() { bLightListFoldout = CustomEditorGUI.ObjectListField(lightList, typeof(IsoLightReciver), "IsoListList", bLightListFoldout, true, ref scrollPosition2); targetList.isExpanded = CustomEditorGUI.ObjectListField(light.TargetList, typeof(IsoLightReciver), targetList.name, targetList.isExpanded, true, ref scrollPosition); }