private void SerializeObj(FieldInfo value, object Comp, object obj) { Type objtype = value.FieldType; object[] attributes = value.GetCustomAttributes(typeof(MFWModel_SerializeAttribute), true); if (attributes == null || attributes.Length == 0) { return; } object SerializeAttribute = attributes[0]; bool IsWirte = (bool)SerializeAttribute.GetType().GetField("IsWrite").GetValue(SerializeAttribute); string Name = SerializeAttribute is MFWModel_SerializeNameAttribute ? (string)SerializeAttribute.GetType().GetField("Name").GetValue(SerializeAttribute) : value.Name; if (objtype == typeof(string)) { if (IsWirte) { value.SetValue(Comp, EditorGUILayout.TextField(Name, (string)obj)); } else { EditorGUILayout.LabelField(Name, (string)obj); } } else if (objtype == typeof(bool)) { if (IsWirte) { value.SetValue(Comp, EditorGUILayout.Toggle(Name, (bool)obj)); } else { EditorGUILayout.Toggle(Name, (bool)obj); } } else if (objtype.IsEnum) { if (IsWirte) { value.SetValue(Comp, EditorGUILayout.EnumPopup(Name, (Enum)obj)); } else { EditorGUILayout.EnumPopup(Name, (Enum)obj); } } else if (objtype == typeof(byte) || objtype == typeof(int)) { if (IsWirte) { value.SetValue(Comp, EditorGUILayout.IntField(Name, (int)obj)); } else { EditorGUILayout.IntField(Name, (int)obj); } } else if (objtype == typeof(long)) { if (IsWirte) { value.SetValue(Comp, EditorGUILayout.LongField(Name, (long)obj)); } else { EditorGUILayout.LongField(Name, (long)obj); } } else if (objtype == typeof(float) || objtype == typeof(double)) { if (IsWirte) { value.SetValue(Comp, EditorGUILayout.FloatField(Name, (float)obj)); } else { EditorGUILayout.FloatField(Name, (float)obj); } } else if (objtype == typeof(Vector2)) { if (IsWirte) { value.SetValue(Comp, EditorGUILayout.Vector2Field(Name, (Vector2)obj)); } else { EditorGUILayout.Vector2Field(Name, (Vector2)obj); } } else if (objtype == typeof(Vector3)) { if (IsWirte) { value.SetValue(Comp, EditorGUILayout.Vector2Field(Name, (Vector3)obj)); } else { EditorGUILayout.Vector2Field(Name, (Vector3)obj); } } else if (objtype == typeof(Color32)) { if (IsWirte) { value.SetValue(Comp, EditorGUILayout.ColorField(Name, (Color32)obj)); } else { EditorGUILayout.ColorField(Name, (Color32)obj); } } else if (objtype.IsGenericType && objtype.GetGenericTypeDefinition() == typeof(Dictionary <,>)) { EditorGUILayout.LabelField(Name + ": 字典列表"); } else if (objtype.IsGenericType && objtype.GetGenericTypeDefinition() == typeof(List <>)) { EditorGUILayout.LabelField(Name + ": 对象列表"); } else { GUILayout.Label(Name + ": 对象没有序列化"); } }
public static Color DrawField(string label, Color value) { return(EditorGUILayout.ColorField(label, value)); }
protected void DrawSpriteEditorGUI(tk2dBaseSprite sprite) { // maybe cache this if its too slow later if (generatorCache.all == null || generatorCache.current != sprite.collection) { generatorCache.all = tk2dEditorUtility.GetOrCreateIndex().GetSpriteCollectionIndex(); if (generatorCache.all != null) { string guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(sprite.collection)); for (int i = 0; i < generatorCache.all.Length; ++i) { if (generatorCache.all[i].spriteCollectionDataGUID == guid) { generatorCache.current = sprite.collection; generatorCache.currentGUID = guid; break; } } } } if (generatorCache.all == null) { EditorGUILayout.LabelField("Collection", "Error"); } else { string[] collNames = new string[generatorCache.all.Length]; int selIndex = -1; for (int i = 0; i < generatorCache.all.Length; ++i) { collNames[i] = generatorCache.all[i].name; if (generatorCache.all[i].spriteCollectionDataGUID == generatorCache.currentGUID) { selIndex = i; } } EditorGUILayout.BeginHorizontal(); int newIndex = EditorGUILayout.Popup("Collection", (selIndex != -1) ? selIndex : 0, collNames); if (newIndex != selIndex) { generatorCache.currentGUID = generatorCache.all[newIndex].spriteCollectionDataGUID; GameObject go = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(generatorCache.currentGUID), typeof(GameObject)) as GameObject; tk2dSpriteCollectionData data = go.GetComponent <tk2dSpriteCollectionData>(); if (data != null) { generatorCache.current = data; int newId = (sprite.spriteId >= generatorCache.current.Count)?0:sprite.spriteId; sprite.SwitchCollectionAndSprite(generatorCache.current, newId); sprite.EditMode__CreateCollider(); } } if (GUILayout.Button("Edit...", GUILayout.MaxWidth(40f), GUILayout.MaxHeight(14f))) { tk2dSpriteCollection gen = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(generatorCache.current.spriteCollectionGUID), typeof(tk2dSpriteCollection)) as tk2dSpriteCollection; if (gen != null) { tk2dSpriteCollectionEditorPopup v = EditorWindow.GetWindow(typeof(tk2dSpriteCollectionEditorPopup), false, "Sprite Collection Editor") as tk2dSpriteCollectionEditorPopup; v.SetGeneratorAndSelectedSprite(gen, sprite.spriteId); } } EditorGUILayout.EndHorizontal(); } if (sprite.collection) { // sanity check sprite id if (sprite.spriteId < 0 || sprite.spriteId >= sprite.collection.Count) { sprite.spriteId = 0; sprite.EditMode__CreateCollider(); } int newSpriteId = sprite.spriteId; if (generatorCache.current) { newSpriteId = tk2dEditorUtility.SpriteSelectorPopup("Sprite", sprite.spriteId, generatorCache.current); if (tk2dPreferences.inst.displayTextureThumbs) { if (generatorCache.current.version < 1) { GUILayout.Label("No thumbnail data.\nPlease rebuild Sprite Collection."); } else { var tex = tk2dSpriteThumbnailCache.GetThumbnailTexture(generatorCache.current, sprite.spriteId); if (tex) { float w = tex.width; float h = tex.height; float maxSize = 128.0f; if (w > maxSize) { h = h / w * maxSize; w = maxSize; } Rect r = GUILayoutUtility.GetRect(w, h); GUI.DrawTexture(r, tex, ScaleMode.ScaleToFit); //GUILayout.Box(tex, GUILayout.Width(w), GUILayout.Height(h)); } } } } else { newSpriteId = EditorGUILayout.IntSlider(sprite.spriteId, 0, sprite.collection.Count - 1); } if (newSpriteId != sprite.spriteId) { sprite.spriteId = newSpriteId; sprite.EditMode__CreateCollider(); GUI.changed = true; } sprite.color = EditorGUILayout.ColorField("Color", sprite.color); Vector3 newScale = EditorGUILayout.Vector3Field("Scale", sprite.scale); if (newScale != sprite.scale) { sprite.scale = newScale; sprite.EditMode__CreateCollider(); } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("HFlip")) { Vector3 s = sprite.scale; s.x *= -1.0f; sprite.scale = s; GUI.changed = true; } if (GUILayout.Button("VFlip")) { Vector3 s = sprite.scale; s.y *= -1.0f; sprite.scale = s; GUI.changed = true; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(new GUIContent("Reset Scale", "Set scale to 1"))) { Vector3 s = sprite.scale; s.x = Mathf.Sign(s.x); s.y = Mathf.Sign(s.y); s.z = Mathf.Sign(s.z); sprite.scale = s; GUI.changed = true; } if (GUILayout.Button(new GUIContent("Bake Scale", "Transfer scale from transform.scale -> sprite"))) { tk2dScaleUtility.Bake(sprite.transform); GUI.changed = true; } GUIContent pixelPerfectButton = new GUIContent("1:1", "Make Pixel Perfect"); if (GUILayout.Button(pixelPerfectButton)) { if (tk2dPixelPerfectHelper.inst) { tk2dPixelPerfectHelper.inst.Setup(); } sprite.MakePixelPerfect(); GUI.changed = true; } sprite.pixelPerfect = GUILayout.Toggle(sprite.pixelPerfect, new GUIContent("Always", "Always keep pixel perfect"), GUILayout.Width(60.0f)); EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.IntSlider("Need a collection bound", 0, 0, 1); } if (GUI.changed) { EditorUtility.SetDirty(sprite); } }
public override void OnInspectorGUI() { GUILayout.Label(gs.editorImg, GUILayout.MaxWidth(460)); EditorGUILayout.LabelField("Quiz game by Android | Helper (RU)"); EditorGUILayout.HelpBox("При включении режима разработчика, вы сможете редактировать публичные данные основного скрипта.", MessageType.Info); var devbttn = GUILayout.Button("Включить режим разработчика"); if (devbttn && !developerMode) { developerMode = true; } else if (devbttn && developerMode) { developerMode = false; } if (developerMode) { DrawDefaultInspector(); } EditorGUILayout.Space(); EditorGUILayout.HelpBox("При нажатии на эту кнопку вы сможете редактировать и удалять вопросы (ответы)", MessageType.Info); if (GUILayout.Button("Редактировать содержимое", GUILayout.Height(50))) { QuestionWindow.ShowWindow(); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal("box"); QAddCount = EditorGUILayout.IntField("Сколько добавить вопросов?", QAddCount); if (QAddCount > 0) { if (GUILayout.Button("Добавить вопрос: " + (gs.Questions.Length + 1) + "-" + (gs.Questions.Length + QAddCount))) { List <object> QList = new List <object>(gs.Questions); gs.Questions = new QuestionsList[QList.Count + QAddCount]; for (int i = 0; i < QList.Count; i++) { gs.Questions[i] = QList[i] as QuestionsList; } if (QAddCount <= 1) { Debug.Log(gs.Questions.Length + " - вопрос, был успешно добавлен!"); } else { Debug.Log(QAddCount + " - вопросов, было успешно добавлено!"); } } } else if (QAddCount <= 0) { EditorGUILayout.HelpBox("Минимальное кол-во для добавления: 1.", MessageType.Error); } EditorGUILayout.EndHorizontal(); if (SceneManager.GetActiveScene().isDirty) { EditorGUILayout.HelpBox("Не забудьте сохранить проект!", MessageType.Warning); } EditorGUILayout.Space(); EditorGUILayout.HelpBox("Ниже находятся настройки геймплея и интерфейса.", MessageType.Info); EditorGUILayout.BeginHorizontal("box"); EditorGUILayout.BeginVertical(); gs.publicTimeCount = EditorGUILayout.IntField("Время для ответа: ", gs.publicTimeCount); gs.multiplierScore = EditorGUILayout.IntField("Множитель для счёта: ", gs.multiplierScore); EditorGUILayout.Space(); gs.trueCC = EditorGUILayout.ColorField("Цвет при правильном ответе", gs.trueCC); gs.falseCC = EditorGUILayout.ColorField("Цвет при неправильном ответе", gs.falseCC); gs.defaultCC = EditorGUILayout.ColorField("Стандартный цвет шапки", gs.defaultCC); if (!Application.isPlaying) { gs.headPanel.color = new Color(gs.defaultCC.r, gs.defaultCC.g, gs.defaultCC.b); } gs.bg.color = EditorGUILayout.ColorField("Цвет заднего фона", gs.bg.color); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.HelpBox("В группе ВК вы можете получить помощь, если у вас что-то не получается.", MessageType.Info); EditorGUILayout.BeginHorizontal("box"); //if (GUILayout.Button("Перейти на Youtube канал")) Application.OpenURL("https://www.youtube.com/channel/UCfkGzBtY86U5Y8kmbEuiNIA"); // if (GUILayout.Button("Перейти в группу ВКонтакте")) Application.OpenURL("https://vk.com/youtube_androidhelper"); EditorGUILayout.EndHorizontal(); if (GUI.changed) { EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); } Repaint(); SceneView.RepaintAll(); }
public override void OnInspectorGUI() { if (m_target == null && target == null) { base.OnInspectorGUI(); return; } LoadGuiStyles(); float defaultLabelWidth = EditorGUIUtility.labelWidth; float defaultFieldWidth = EditorGUIUtility.fieldWidth; GUIStyle foldoutStyle = new GUIStyle(EditorStyles.foldout) { font = m_headerStyle2.font, fontStyle = m_headerStyle2.fontStyle, contentOffset = Vector2.down * 3f //TODO: Maybe replace this with "new Vector2(0f, -3f);" }; SetGuiStyleFontColor ( guiStyle: foldoutStyle, color: EditorGUIUtility.isProSkin ? Color.white : Color.black ); //===== CONTENT REGION ======================================================================== GUILayout.Space(20); #region Section -> Logo if (m_logoTexture != null) { GUILayout.Label ( image: m_logoTexture, style: new GUIStyle(GUI.skin.GetStyle("Label")) { alignment = TextAnchor.UpperCenter } ); GUILayout.Space(10); } else { EditorGUILayout.LabelField ( label: "[ GRAPHY - MANAGER ]", style: m_headerStyle1 ); } #endregion GUILayout.Space(5); //Extra pixels added when the logo is used. #region Section -> Settings EditorGUIUtility.labelWidth = 130; EditorGUIUtility.fieldWidth = 35; EditorGUILayout.PropertyField ( m_graphyMode, new GUIContent ( text: "Graphy Mode", tooltip: "LIGHT mode increases compatibility with mobile and older, less powerful GPUs, but reduces the maximum graph resolutions to 128." ) ); GUILayout.Space(10); m_enableOnStartup.boolValue = EditorGUILayout.Toggle ( new GUIContent ( text: "Enable On Startup", tooltip: "If ticked, Graphy will be displayed by default on startup, otherwise it will initiate and hide." ), value: m_enableOnStartup.boolValue ); m_keepAlive.boolValue = EditorGUILayout.Toggle ( new GUIContent ( text: "Keep Alive", tooltip: "If ticked, it will survive scene changes.\n\nCAREFUL, if you set Graphy as a child of another GameObject, the root GameObject will also survive scene changes. If you want to avoid that put Graphy in the root of the Scene as its own entity." ), value: m_keepAlive.boolValue ); GUILayout.Space(10); EditorGUILayout.BeginHorizontal(); m_background.boolValue = EditorGUILayout.Toggle ( new GUIContent ( text: "Background", tooltip: "If ticked, it will show a background overlay to improve readability in cluttered scenes." ), value: m_background.boolValue ); m_backgroundColor.colorValue = EditorGUILayout.ColorField(m_backgroundColor.colorValue); EditorGUILayout.EndHorizontal(); GUILayout.Space(10); m_enableHotkeys.boolValue = EditorGUILayout.Toggle ( new GUIContent ( text: "Enable Hotkeys", tooltip: "If ticked, it will enable the hotkeys to be able to modify Graphy in runtime with custom keyboard shortcuts." ), value: m_enableHotkeys.boolValue ); if (m_enableHotkeys.boolValue) { EditorGUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 130; EditorGUIUtility.fieldWidth = 35; EditorGUILayout.PropertyField ( m_toggleModeKeyCode, new GUIContent ( text: "Toggle Mode Key", tooltip: "If ticked, it will require clicking this key and the other ones you have set up." ) ); EditorGUIUtility.labelWidth = 30; EditorGUIUtility.fieldWidth = 35; m_toggleModeCtrl.boolValue = EditorGUILayout.Toggle ( new GUIContent ( text: "Ctrl", tooltip: "If ticked, it will require clicking Ctrl and the other keys you have set up." ), value: m_toggleModeCtrl.boolValue ); m_toggleModeAlt.boolValue = EditorGUILayout.Toggle ( new GUIContent ( text: "Alt", tooltip: "If ticked, it will require clicking Alt and the other keys you have set up." ), value: m_toggleModeAlt.boolValue ); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 130; EditorGUIUtility.fieldWidth = 35; EditorGUILayout.PropertyField ( m_toggleActiveKeyCode, new GUIContent ( text: "Toggle Active Key", tooltip: "If ticked, it will require clicking this key and the other ones you have set up." ) ); EditorGUIUtility.labelWidth = 30; EditorGUIUtility.fieldWidth = 35; m_toggleActiveCtrl.boolValue = EditorGUILayout.Toggle ( new GUIContent ( text: "Ctrl", tooltip: "If ticked, it will require clicking Ctrl and the other kesy you have set up." ), value: m_toggleActiveCtrl.boolValue ); m_toggleActiveAlt.boolValue = EditorGUILayout.Toggle ( new GUIContent ( text: "Alt", tooltip: "If ticked, it will require clicking Alt and the other keys you have set up." ), value: m_toggleActiveAlt.boolValue ); EditorGUILayout.EndHorizontal(); } GUILayout.Space(15); EditorGUIUtility.labelWidth = 155; EditorGUIUtility.fieldWidth = 35; EditorGUILayout.PropertyField ( m_graphModulePosition, new GUIContent ( text: "Graph modules position", tooltip: "Defines in which corner the modules will be located." ) ); #endregion GUILayout.Space(20); #region Section -> FPS m_fpsModuleInspectorToggle = EditorGUILayout.Foldout ( m_fpsModuleInspectorToggle, content: " [ FPS ]", style: foldoutStyle ); GUILayout.Space(5); if (m_fpsModuleInspectorToggle) { EditorGUILayout.PropertyField ( m_fpsModuleState, new GUIContent ( text: "Module state", tooltip: "FULL -> Text + Graph \nTEXT -> Just text \nOFF -> Turned off" ) ); GUILayout.Space(5); EditorGUILayout.LabelField("Fps thresholds and colors:"); EditorGUI.indentLevel++; EditorGUILayout.BeginHorizontal(); m_goodFpsThreshold.intValue = EditorGUILayout.IntField ( new GUIContent ( text: "- Good", tooltip: "When FPS rise above this value, this color will be used." ), value: m_goodFpsThreshold.intValue ); m_goodFpsColor.colorValue = EditorGUILayout.ColorField(m_goodFpsColor.colorValue); EditorGUILayout.EndHorizontal(); if (m_goodFpsThreshold.intValue <= m_cautionFpsThreshold.intValue && m_goodFpsThreshold.intValue > 1) { m_cautionFpsThreshold.intValue = m_goodFpsThreshold.intValue - 1; } else if (m_goodFpsThreshold.intValue <= 1) { m_goodFpsThreshold.intValue = 2; } EditorGUILayout.BeginHorizontal(); m_cautionFpsThreshold.intValue = EditorGUILayout.IntField ( new GUIContent ( text: "- Caution", tooltip: "When FPS falls between this and the Good value, this color will be used." ), value: m_cautionFpsThreshold.intValue ); m_cautionFpsColor.colorValue = EditorGUILayout.ColorField(m_cautionFpsColor.colorValue); EditorGUILayout.EndHorizontal(); if (m_cautionFpsThreshold.intValue >= m_goodFpsThreshold.intValue) { m_cautionFpsThreshold.intValue = m_goodFpsThreshold.intValue - 1; } else if (m_cautionFpsThreshold.intValue <= 0) { m_cautionFpsThreshold.intValue = 1; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.IntField ( new GUIContent ( text: "- Critical", tooltip: "When FPS falls below the Caution value, this color will be used. (You can't have negative FPS, so this value is just for reference, it can't be changed)." ), value: 0 ); m_criticalFpsColor.colorValue = EditorGUILayout.ColorField(m_criticalFpsColor.colorValue); EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel--; if (m_fpsModuleState.intValue == 0) { m_fpsGraphResolution.intValue = EditorGUILayout.IntSlider ( new GUIContent ( text: "Graph resolution", tooltip: "Defines the amount of points in the graph" ), m_fpsGraphResolution.intValue, leftValue: 20, rightValue: m_graphyMode.intValue == 0 ? 300 : 128 ); } EditorGUIUtility.labelWidth = 180; EditorGUIUtility.fieldWidth = 35; m_timeToResetMinMaxFps.intValue = EditorGUILayout.IntSlider ( new GUIContent ( text: "Time to reset min/max values", tooltip: "If the min/max value doesn't change in the specified time, they will be reset. This allows tracking the min/max fps in a shorter interval. \n\nSet it to 0 if you don't want it to reset." ), m_timeToResetMinMaxFps.intValue, leftValue: 0, rightValue: 120 ); EditorGUIUtility.labelWidth = 155; EditorGUIUtility.fieldWidth = 35; m_fpsTextUpdateRate.intValue = EditorGUILayout.IntSlider ( new GUIContent ( text: "Text update rate", tooltip: "Defines the amount times the text is updated in 1 second." ), m_fpsTextUpdateRate.intValue, leftValue: 1, rightValue: 60 ); } #endregion GUILayout.Space(20); #region Section -> RAM m_ramModuleInspectorToggle = EditorGUILayout.Foldout ( m_ramModuleInspectorToggle, content: " [ RAM ]", style: foldoutStyle ); GUILayout.Space(5); if (m_ramModuleInspectorToggle) { EditorGUILayout.PropertyField ( m_ramModuleState, new GUIContent ( text: "Module state", tooltip: "FULL -> Text + Graph \nTEXT -> Just text \nOFF -> Turned off" ) ); GUILayout.Space(5); EditorGUILayout.LabelField("Graph colors:"); EditorGUI.indentLevel++; m_allocatedRamColor.colorValue = EditorGUILayout.ColorField ( label: "- Allocated", value: m_allocatedRamColor.colorValue ); m_reservedRamColor.colorValue = EditorGUILayout.ColorField ( label: "- Reserved", value: m_reservedRamColor.colorValue ); m_monoRamColor.colorValue = EditorGUILayout.ColorField ( label: "- Mono", value: m_monoRamColor.colorValue ); EditorGUI.indentLevel--; if (m_ramModuleState.intValue == 0) { m_ramGraphResolution.intValue = EditorGUILayout.IntSlider( new GUIContent ( text: "Graph resolution", tooltip: "Defines the amount of points are in the graph" ), m_ramGraphResolution.intValue, leftValue: 20, rightValue: m_graphyMode.intValue == 0 ? 300 : 128 ); } m_ramTextUpdateRate.intValue = EditorGUILayout.IntSlider ( new GUIContent ( text: "Text update rate", tooltip: "Defines the amount times the text is updated in 1 second." ), m_ramTextUpdateRate.intValue, leftValue: 1, rightValue: 60 ); } #endregion GUILayout.Space(20); #region Section -> Audio m_audioModuleInspectorToggle = EditorGUILayout.Foldout ( m_audioModuleInspectorToggle, content: " [ AUDIO ]", style: foldoutStyle ); GUILayout.Space(5); if (m_audioModuleInspectorToggle) { EditorGUILayout.PropertyField ( m_audioModuleState, new GUIContent ( text: "Module state", tooltip: "FULL -> Text + Graph \nTEXT -> Just text \nOFF -> Turned off" ) ); GUILayout.Space(5); EditorGUILayout.PropertyField ( m_findAudioListenerInCameraIfNull, new GUIContent ( text: "Find audio listener", tooltip: "Tries to find the AudioListener in the Main camera in the scene. (if AudioListener is null)" ) ); EditorGUILayout.PropertyField ( m_audioListener, new GUIContent ( text: "Audio Listener", tooltip: "Graphy will take the data from this Listener. If none are specified, it will try to get it from the Main Camera in the scene." ) ); if (m_audioModuleState.intValue == 0) { m_audioGraphColor.colorValue = EditorGUILayout.ColorField ( label: "Graph color", value: m_audioGraphColor.colorValue ); m_audioGraphResolution.intValue = EditorGUILayout.IntSlider ( new GUIContent ( text: "Graph resolution", tooltip: "Defines the amount of points that are in the graph." ), m_audioGraphResolution.intValue, leftValue: 20, rightValue: m_graphyMode.intValue == 0 ? 300 : 128 ); // Forces the value to be a multiple of 3, this way the audio graph is painted correctly if (m_audioGraphResolution.intValue % 3 != 0 && m_audioGraphResolution.intValue < 300) { m_audioGraphResolution.intValue += 3 - m_audioGraphResolution.intValue % 3; } //TODO: Figure out why a static version of the ForceMultipleOf3 isnt used. } EditorGUILayout.PropertyField ( m_FFTWindow, new GUIContent ( text: "FFT Window", tooltip: "Used to reduce leakage between frequency bins/bands. Note, the more complex window type, the better the quality, but reduced speed. \n\nSimplest is rectangular. Most complex is BlackmanHarris" ) ); m_spectrumSize.intValue = EditorGUILayout.IntSlider ( new GUIContent ( text: "Spectrum size", tooltip: "Has to be a power of 2 between 128-8192. The higher sample rate, the less precision but also more impact on performance. Careful with mobile devices" ), m_spectrumSize.intValue, leftValue: 128, rightValue: 8192 ); int closestSpectrumIndex = 0; int minDistanceToSpectrumValue = 100000; for (int i = 0; i < m_spectrumSizeValues.Length; i++) { int newDistance = Mathf.Abs ( value: m_spectrumSize.intValue - m_spectrumSizeValues[i] ); if (newDistance < minDistanceToSpectrumValue) { minDistanceToSpectrumValue = newDistance; closestSpectrumIndex = i; } } m_spectrumSize.intValue = m_spectrumSizeValues[closestSpectrumIndex]; m_audioTextUpdateRate.intValue = EditorGUILayout.IntSlider ( new GUIContent ( text: "Text update rate", tooltip: "Defines the amount times the text is updated in 1 second" ), m_audioTextUpdateRate.intValue, leftValue: 1, rightValue: 60 ); } #endregion GUILayout.Space(20); #region Section -> Advanced Settings m_advancedModuleInspectorToggle = EditorGUILayout.Foldout ( m_advancedModuleInspectorToggle, content: " [ ADVANCED DATA ]", style: foldoutStyle ); GUILayout.Space(5); if (m_advancedModuleInspectorToggle) { EditorGUILayout.PropertyField(m_advancedModulePosition); EditorGUILayout.PropertyField ( m_advancedModuleState, new GUIContent ( text: "Module state", tooltip: "FULL -> Text \nOFF -> Turned off" ) ); } #endregion ; EditorGUIUtility.labelWidth = defaultLabelWidth; EditorGUIUtility.fieldWidth = defaultFieldWidth; serializedObject.ApplyModifiedProperties(); }
void OnGUI() { Repaint(); if (mySceneControl == null) { mySceneControl = GameObject.Find("SCENE CONTROL").GetComponent <SceneControl> (); ExecuteKey = mySceneControl.ExecuteKey; } /* if (myDanceControl == null) { * myDanceControl = GameObject.Find ("DANCE CONTROL").GetComponent<DanceControl> (); * ExecuteKey = myDanceControl.ExecuteKey; * }*/ //GUILayout.Label EditorGUILayout.TextField("PLAYBACK", EditorStyles.boldLabel); GUILayout.BeginHorizontal("box"); if (GUILayout.Button(powerBtn)) { mySceneControl.jumpCueNumber = editCue; mySceneControl.inPlayMode = true; EditorApplication.isPlaying = true; EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); Debug.Log("marking dirty"); //Playable = GameObject.FindWithTag("timeline"); mySceneControl.timeline.initialTime = mySceneControl.cueTimes[mySceneControl.jumpCueNumber]; } if (GUILayout.Button(playBtn)) { if (mySceneControl.inPlayMode) { // timeline = GameObject.FindWithTag("timeline").GetComponent<PlayableDirector>(); // Playable.SetActive(true); // timeline.enabled = true; // timeline.time = mySceneControl.cueTimes[mySceneControl.jumpCueNumber]; //timeline.initialTime = mySceneControl.cueTimes[mySceneControl.jumpCueNumber]; // timeline.Play(); mySceneControl.cueToRun = editCue; // myDanceControl.cueToRun = editCue; mySceneControl.GetComponent <AudioSource>().time = mySceneControl.cueTimes[editCue]; // mySceneControl.timeline.time = mySceneControl.cueTimes[mySceneControl.jumpCueNumber]; mySceneControl.StartPlayback(); mySceneControl.timeline.initialTime = mySceneControl.cueTimes[mySceneControl.jumpCueNumber]; mySceneControl.lastCueNumber = builtCues; } } if (GUILayout.Button(stopBtn)) { EditorApplication.isPlaying = false; mySceneControl.inPlayMode = false; // timeline.enabled = true; timeline.Stop(); Debug.Log("Stopped Play Mode"); // timeline = GameObject.FindWithTag("timeline").GetComponent<PlayableDirector>(); // timeline.enabled = true; } GUILayout.EndHorizontal(); EditorGUILayout.Space(); // ExecuteKey = (KeyCode)EditorGUILayout.EnumPopup("Execute Key:", ExecuteKey, EditorStyles.boldLabel); EditorGUILayout.TextField("CUES", EditorStyles.boldLabel); GUILayout.BeginHorizontal("box"); EditorGUILayout.BeginVertical("Button"); GUILayout.BeginHorizontal("box"); EditorGUILayout.TextField("Cue Number: " + editCue + " of " + builtCues, EditorStyles.boldLabel); GUILayout.TextField("Current Playback Time: " + Mathf.Round(mySceneControl.GetComponent <AudioSource>().time), EditorStyles.boldLabel); GUILayout.EndHorizontal(); cueTime = EditorGUILayout.FloatField("Run Cue at Time: ", cueTime); EditorGUILayout.Space(); EditorGUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if (GUILayout.Button("Prev Cue")) { if (editCue > 1) { editCue--; LoadCueData(); } } if (builtCues > editCue) { if (GUILayout.Button("Next Cue")) { editCue++; LoadCueData(); } } else { if (GUILayout.Button("At Last Cue")) { //editCue++; //builtCues++; //LoadCueData(); } } // GUILayout.EndHorizontal(); // EditorGUILayout.Space(); // GUILayout.BeginHorizontal("box"); // if (GUILayout.Button("Load Cue Data")) { // LoadCueData(); // } if (GUILayout.Button("Save Cue")) { // myDanceControl.Theme = theme; // myDanceControl.bodyMaterials[editCue] = bodyTex; // myDanceControl.MotionClips[editCue] = clip; // myDanceControl.ClipSpeeds[editCue] = clipSpeed; // myDanceControl.ClipOffsets[editCue] = clipOffset; mySceneControl.ExecuteKey = ExecuteKey; mySceneControl.cueTimes[editCue] = cueTime; // myDanceControl.cueTimes[editCue] = cueTime; mySceneControl.cameraLoc[editCue] = mySceneControl.theCamera.transform.position; mySceneControl.cameraEffect [editCue] = camEffects; mySceneControl.cameraMoveTime[editCue] = camMoveTime; mySceneControl.camerafollowing[editCue] = cameraFollowing; mySceneControl.lightFadeTime[editCue] = lightFadeTime; mySceneControl.lightVerticalMoveAmount[editCue] = lightVerticalMoveAmount; mySceneControl.light1Loc[editCue] = mySceneControl.lights[0].transform.position; mySceneControl.light2Loc[editCue] = mySceneControl.lights[1].transform.position; mySceneControl.light3Loc[editCue] = mySceneControl.lights[2].transform.position; mySceneControl.light1Color[editCue] = light1Color; mySceneControl.light2Color[editCue] = light2Color; mySceneControl.light3Color[editCue] = light3Color; mySceneControl.lightLights[0].color = light1Color; mySceneControl.lightLights[1].color = light2Color; mySceneControl.lightLights[2].color = light3Color; mySceneControl.floorTexture[editCue] = floorTex; mySceneControl.musicVolume = volume; mySceneControl.audioFadeOutTime = audioFadeTime; mySceneControl.lastCueNumber = builtCues; } if (editCue < 50) { if (GUILayout.Button("Insert Cue")) { List <Color> light1ColorArray = new List <Color>(); List <Color> light2ColorArray = new List <Color>(); List <Color> light3ColorArray = new List <Color>(); List <Vector3> light1LocArray = new List <Vector3>(); List <Vector3> light2LocArray = new List <Vector3>(); List <Vector3> light3LocArray = new List <Vector3>(); List <float> lightFadeTimeArray = new List <float>(); List <float> clipSpeedArray = new List <float>(); List <float> clipOffsetArray = new List <float>(); List <bool> camFollowingArray = new List <bool>(); List <SceneControl.CameraEffects> camEffectsArray = new List <SceneControl.CameraEffects>(); List <SceneControl.FloorTex> floorTexArray = new List <SceneControl.FloorTex>(); List <DanceControl.BodyMats> BodyTexArray = new List <DanceControl.BodyMats>(); List <DanceControl.MotionClip> clipArray = new List <DanceControl.MotionClip>(); List <float> camMoveTimeArray = new List <float>(); List <float> camMoveAmountArray = new List <float>(); List <float> cueTimeArray = new List <float>(); for (int x = 0; x < 50 - editCue; x++) { light1ColorArray.Add(mySceneControl.light1Color[editCue + x]); light2ColorArray.Add(mySceneControl.light2Color[editCue + x]); light3ColorArray.Add(mySceneControl.light3Color[editCue + x]); light1LocArray.Add(mySceneControl.light1Loc[editCue + x]); light2LocArray.Add(mySceneControl.light2Loc[editCue + x]); light3LocArray.Add(mySceneControl.light3Loc[editCue + x]); lightFadeTimeArray.Add(mySceneControl.lightFadeTime[editCue + x]); camFollowingArray.Add(mySceneControl.camerafollowing[editCue + x]); camEffectsArray.Add(mySceneControl.cameraEffect[editCue + x]); floorTexArray.Add(mySceneControl.floorTexture[editCue + x]); /*BodyTexArray.Add(myDanceControl.bodyMaterials[editCue + x]); * clipArray.Add(myDanceControl.MotionClips[editCue + x]); * clipSpeedArray.Add(myDanceControl.ClipSpeeds[editCue + x]); * clipOffsetArray.Add(myDanceControl.ClipOffsets[editCue + x]);*/ camMoveTimeArray.Add(mySceneControl.cameraMoveTime[editCue + x]); camMoveAmountArray.Add(mySceneControl.cameraMoveAmount[editCue + x]); cueTimeArray.Add(mySceneControl.cueTimes[editCue + x]); } for (int y = 0; y < 50 - (editCue + 1); y++) { mySceneControl.light1Color[editCue + y + 1] = light1ColorArray[y]; mySceneControl.light2Color[editCue + y + 1] = light2ColorArray[y]; mySceneControl.light3Color[editCue + y + 1] = light3ColorArray[y]; mySceneControl.light1Loc[editCue + y + 1] = light1LocArray[y]; mySceneControl.light2Loc[editCue + y + 1] = light2LocArray[y]; mySceneControl.light3Loc[editCue + y + 1] = light3LocArray[y]; mySceneControl.lightFadeTime[editCue + y + 1] = lightFadeTimeArray[y]; mySceneControl.camerafollowing[editCue + y + 1] = camFollowingArray[y]; mySceneControl.cameraEffect[editCue + y + 1] = camEffectsArray[y]; mySceneControl.floorTexture[editCue + y + 1] = floorTexArray[y]; /* myDanceControl.bodyMaterials[editCue + y + 1] = BodyTexArray[y]; * myDanceControl.MotionClips[editCue + y + 1] = clipArray[y]; * myDanceControl.ClipSpeeds[editCue + y + 1] = clipSpeedArray[y]; * myDanceControl.ClipOffsets[editCue + y + 1] = clipOffsetArray[y]; */ mySceneControl.cueTimes[editCue + y + 1] = cueTimeArray[y]; mySceneControl.cameraMoveTime[editCue + y + 1] = camMoveTimeArray[y]; mySceneControl.cameraMoveAmount[editCue + y + 1] = camMoveAmountArray[y]; // myDanceControl.cueTimes[editCue + y + 1] = cueTimeArray[y]; } editCue++; builtCues++; /* myDanceControl.Theme = theme; * myDanceControl.bodyMaterials[editCue] = bodyTex; * myDanceControl.MotionClips[editCue] = clip; * myDanceControl.ClipSpeeds[editCue] = clipSpeed; * myDanceControl.ClipOffsets[editCue] = clipOffset; * myDanceControl.cueTimes[editCue] = cueTime;*/ mySceneControl.ExecuteKey = ExecuteKey; mySceneControl.cueTimes[editCue] = cueTime; mySceneControl.cameraLoc[editCue] = mySceneControl.theCamera.transform.position; mySceneControl.cameraEffect [editCue] = camEffects; mySceneControl.cameraMoveTime[editCue] = camMoveTime; mySceneControl.camerafollowing[editCue] = cameraFollowing; mySceneControl.lightFadeTime[editCue] = lightFadeTime; mySceneControl.lightVerticalMoveAmount[editCue] = lightVerticalMoveAmount; mySceneControl.light1Loc[editCue] = mySceneControl.lights[0].transform.position; mySceneControl.light2Loc[editCue] = mySceneControl.lights[1].transform.position; mySceneControl.light3Loc[editCue] = mySceneControl.lights[2].transform.position; mySceneControl.light1Color[editCue] = light1Color; mySceneControl.light2Color[editCue] = light2Color; mySceneControl.light3Color[editCue] = light3Color; mySceneControl.floorTexture[editCue] = floorTex; mySceneControl.musicVolume = volume; mySceneControl.audioFadeOutTime = audioFadeTime; mySceneControl.lastCueNumber = builtCues; } } if (builtCues > 1) { if (GUILayout.Button("Delete Cue")) { List <Color> light1ColorArrayDel = new List <Color>(); List <Color> light2ColorArrayDel = new List <Color>(); List <Color> light3ColorArrayDel = new List <Color>(); List <Vector3> light1LocArrayDel = new List <Vector3>(); List <Vector3> light2LocArrayDel = new List <Vector3>(); List <Vector3> light3LocArrayDel = new List <Vector3>(); List <float> lightFadeTimeArrayDel = new List <float>(); List <float> clipSpeedArrayDel = new List <float>(); List <float> clipOffsetArrayDel = new List <float>(); List <bool> camFollowingArrayDel = new List <bool>(); List <SceneControl.CameraEffects> camEffectsArrayDel = new List <SceneControl.CameraEffects>(); List <SceneControl.FloorTex> floorTexArrayDel = new List <SceneControl.FloorTex>(); List <DanceControl.BodyMats> BodyTexArrayDel = new List <DanceControl.BodyMats>(); List <DanceControl.MotionClip> clipArrayDel = new List <DanceControl.MotionClip>(); List <float> camMoveTimeArrayDel = new List <float>(); List <float> camMoveAmountArrayDel = new List <float>(); List <float> cueTimeArrayDel = new List <float>(); for (int x = 0; x < 50 - editCue; x++) { light1ColorArrayDel.Add(mySceneControl.light1Color[editCue + x]); light2ColorArrayDel.Add(mySceneControl.light2Color[editCue + x]); light3ColorArrayDel.Add(mySceneControl.light3Color[editCue + x]); light1LocArrayDel.Add(mySceneControl.light1Loc[editCue + x]); light2LocArrayDel.Add(mySceneControl.light2Loc[editCue + x]); light3LocArrayDel.Add(mySceneControl.light3Loc[editCue + x]); lightFadeTimeArrayDel.Add(mySceneControl.lightFadeTime[editCue + x]); camFollowingArrayDel.Add(mySceneControl.camerafollowing[editCue + x]); camEffectsArrayDel.Add(mySceneControl.cameraEffect[editCue + x]); floorTexArrayDel.Add(mySceneControl.floorTexture[editCue + x]); /* BodyTexArrayDel.Add(myDanceControl.bodyMaterials[editCue + x]); * clipArrayDel.Add(myDanceControl.MotionClips[editCue + x]); * clipSpeedArrayDel.Add(myDanceControl.ClipSpeeds[editCue + x]); * clipOffsetArrayDel.Add(myDanceControl.ClipOffsets[editCue + x]); */ camMoveTimeArrayDel.Add(mySceneControl.cameraMoveTime[editCue + x]); camMoveAmountArrayDel.Add(mySceneControl.cameraMoveAmount[editCue + x]); cueTimeArrayDel.Add(mySceneControl.cueTimes[editCue + x]); //Debug.Log (camMoveTimeArray[x]); } for (int y = 0; y < 50 - (editCue + 1); y++) { mySceneControl.light1Color[editCue + y] = light1ColorArrayDel[y + 1]; mySceneControl.light2Color[editCue + y] = light2ColorArrayDel[y + 1]; mySceneControl.light3Color[editCue + y] = light3ColorArrayDel[y + 1]; mySceneControl.light1Loc[editCue + y] = light1LocArrayDel[y + 1]; mySceneControl.light2Loc[editCue + y] = light2LocArrayDel[y + 1]; mySceneControl.light3Loc[editCue + y] = light3LocArrayDel[y + 1]; mySceneControl.lightFadeTime[editCue + y] = lightFadeTimeArrayDel[y + 1]; mySceneControl.camerafollowing[editCue + y] = camFollowingArrayDel[y + 1]; mySceneControl.cameraEffect[editCue + y] = camEffectsArrayDel[y + 1]; mySceneControl.floorTexture[editCue + y] = floorTexArrayDel[y + 1]; /* myDanceControl.bodyMaterials[editCue +y] = BodyTexArrayDel[y+1]; * myDanceControl.MotionClips[editCue +y] = clipArrayDel[y+1]; * myDanceControl.ClipSpeeds[editCue +y] = clipSpeedArrayDel[y+1]; * myDanceControl.ClipOffsets[editCue +y] = clipOffsetArrayDel[y+1]; * myDanceControl.cueTimes[editCue + y] = cueTimeArrayDel[y+1]; */ mySceneControl.cueTimes[editCue + y] = cueTimeArrayDel[y + 1]; mySceneControl.cameraMoveTime[editCue + y] = camMoveTimeArrayDel[y + 1]; mySceneControl.cameraMoveAmount[editCue + y] = camMoveAmountArrayDel[y + 1]; mySceneControl.cueTimes[editCue + y] = cueTimeArrayDel[y + 1]; //Debug.Log (camMoveTimeArrayDel[y+1]); //Debug.Log (y); } builtCues--; mySceneControl.lastCueNumber = builtCues; if (builtCues < editCue) { editCue--; } LoadCueData(); } } else { if (GUILayout.Button("No Cue")) { } } GUILayout.EndHorizontal(); EditorGUILayout.Space(); showCameraControls = EditorGUILayout.Foldout(showCameraControls, "CAMERA");//, EditorStyles.boldLabel); if (showCameraControls) { EditorGUILayout.BeginVertical("Button"); GUILayout.BeginHorizontal("box"); EditorGUILayout.PrefixLabel("Camera Move Time"); camMoveTime = EditorGUILayout.FloatField(camMoveTime); // cameraFollowing = EditorGUILayout.Toggle("Camera Following", cameraFollowing); GUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); if (GUILayout.Button("Move Up")) { cameraPosition = mySceneControl.theCamera.transform.position; mySceneControl.theCamera.transform.Translate(Vector3.up * 0.25f, Space.Self); } GUILayout.BeginHorizontal("box"); if (GUILayout.Button("Move Left")) { cameraPosition = mySceneControl.theCamera.transform.position; mySceneControl.theCamera.transform.Translate(Vector3.right * -0.5f, Space.Self); } if (GUILayout.Button("Move Right")) { cameraPosition = mySceneControl.theCamera.transform.position; mySceneControl.theCamera.transform.Translate(Vector3.right * 0.5f, Space.Self); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if (GUILayout.Button("Move In")) { cameraPosition = mySceneControl.theCamera.transform.position; mySceneControl.theCamera.transform.Translate(Vector3.forward * 0.5f, Space.Self); } if (GUILayout.Button("Move Out")) { cameraPosition = mySceneControl.theCamera.transform.position; mySceneControl.theCamera.transform.Translate(Vector3.forward * -0.5f, Space.Self); } GUILayout.EndHorizontal(); if (GUILayout.Button("Move Down")) { cameraPosition = mySceneControl.theCamera.transform.position; mySceneControl.theCamera.transform.Translate(Vector3.up * -0.25f, Space.Self); } } /* EditorGUILayout.TextField ("DANCE CONTROLS", EditorStyles.boldLabel); * //cameraGroup = EditorGUILayout.BeginToggleGroup ("Camera Controls", cameraGroup); * EditorGUILayout.BeginVertical("Button"); * * theme = (DanceControl.Themes) EditorGUILayout.EnumPopup("Theme:", theme); * clip = (DanceControl.MotionClip) EditorGUILayout.EnumPopup("Motion Clip:", clip); * * GUILayout.BeginHorizontal("box"); * EditorGUILayout.PrefixLabel("Clip Speed"); * clipSpeed = EditorGUILayout.FloatField(clipSpeed); * EditorGUILayout.PrefixLabel("Clip Offset"); * clipOffset = EditorGUILayout.FloatField(clipOffset); * GUILayout.EndHorizontal(); * EditorGUILayout.EndVertical();*/ EditorGUILayout.Space(); //EditorGUILayout.TextField ("LIGHTING CONTROLS", EditorStyles.boldLabel); showLightControls = EditorGUILayout.Foldout(showLightControls, "LIGHTING");//, EditorStyles.boldLabel); if (showLightControls) { EditorGUILayout.BeginVertical("Button"); // GUILayout.BeginHorizontal("box"); light1Color = EditorGUILayout.ColorField("Light #1 Color", light1Color); showLightOne = EditorGUILayout.Foldout(showLightOne, "Light #1 Position");//, EditorStyles.boldLabel); if (showLightOne) { if (GUILayout.Button("Move Up")) { light1Position = mySceneControl.lightOne.transform.position; mySceneControl.lightOne.transform.Translate(Vector3.up * 0.25f, Space.Self); } GUILayout.BeginHorizontal("box"); if (GUILayout.Button("Move Left")) { light1Position = mySceneControl.theCamera.transform.position; mySceneControl.lightOne.transform.Translate(Vector3.right * -0.5f, Space.Self); } if (GUILayout.Button("Move Right")) { light1Position = mySceneControl.theCamera.transform.position; mySceneControl.lightOne.transform.Translate(Vector3.right * 0.5f, Space.Self); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if (GUILayout.Button("Move In")) { light1Position = mySceneControl.theCamera.transform.position; mySceneControl.lightOne.transform.Translate(Vector3.forward * 0.5f, Space.Self); } if (GUILayout.Button("Move Out")) { light1Position = mySceneControl.theCamera.transform.position; mySceneControl.lightOne.transform.Translate(Vector3.forward * -0.5f, Space.Self); } GUILayout.EndHorizontal(); if (GUILayout.Button("Move Down")) { light1Position = mySceneControl.theCamera.transform.position; mySceneControl.lightOne.transform.Translate(Vector3.up * -0.25f, Space.Self); } } light2Color = EditorGUILayout.ColorField("Light #2 Color", light2Color); showLightTwo = EditorGUILayout.Foldout(showLightTwo, "Light #2 Position");//, EditorStyles.boldLabel); if (showLightTwo) { if (GUILayout.Button("Move Up")) { light2Position = mySceneControl.lightTwo.transform.position; mySceneControl.lightTwo.transform.Translate(Vector3.up * 0.25f, Space.Self); } GUILayout.BeginHorizontal("box"); if (GUILayout.Button("Move Left")) { light2Position = mySceneControl.lightTwo.transform.position; mySceneControl.lightTwo.transform.Translate(Vector3.right * -0.5f, Space.Self); } if (GUILayout.Button("Move Right")) { light2Position = mySceneControl.lightTwo.transform.position; mySceneControl.lightTwo.transform.Translate(Vector3.right * 0.5f, Space.Self); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if (GUILayout.Button("Move In")) { light2Position = mySceneControl.lightTwo.transform.position; mySceneControl.lightTwo.transform.Translate(Vector3.forward * 0.5f, Space.Self); } if (GUILayout.Button("Move Out")) { light2Position = mySceneControl.lightTwo.transform.position; mySceneControl.lightTwo.transform.Translate(Vector3.forward * -0.5f, Space.Self); } GUILayout.EndHorizontal(); if (GUILayout.Button("Move Down")) { light2Position = mySceneControl.lightTwo.transform.position; mySceneControl.lightTwo.transform.Translate(Vector3.up * -0.25f, Space.Self); } } light3Color = EditorGUILayout.ColorField("Light #3 Color", light3Color); showLightThree = EditorGUILayout.Foldout(showLightThree, "Light #3 Position");//, EditorStyles.boldLabel); if (showLightThree) { if (GUILayout.Button("Move Up")) { light3Position = mySceneControl.lightThree.transform.position; mySceneControl.lightThree.transform.Translate(Vector3.up * 0.25f, Space.Self); } GUILayout.BeginHorizontal("box"); if (GUILayout.Button("Move Left")) { light3Position = mySceneControl.lightThree.transform.position; mySceneControl.lightThree.transform.Translate(Vector3.right * -0.5f, Space.Self); } if (GUILayout.Button("Move Right")) { light3Position = mySceneControl.lightThree.transform.position; mySceneControl.lightThree.transform.Translate(Vector3.right * 0.5f, Space.Self); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if (GUILayout.Button("Move In")) { light3Position = mySceneControl.lightThree.transform.position; mySceneControl.lightThree.transform.Translate(Vector3.forward * 0.5f, Space.Self); } if (GUILayout.Button("Move Out")) { light3Position = mySceneControl.lightThree.transform.position; mySceneControl.lightThree.transform.Translate(Vector3.forward * -0.5f, Space.Self); } GUILayout.EndHorizontal(); if (GUILayout.Button("Move Down")) { light3Position = mySceneControl.lightThree.transform.position; mySceneControl.lightThree.transform.Translate(Vector3.up * -0.25f, Space.Self); } } lightFadeTime = EditorGUILayout.FloatField("Light Fade Time", lightFadeTime); // GUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } EditorGUILayout.Space(); //EditorGUILayout.TextField ("Visual Effects and Audio", EditorStyles.boldLabel); showVisualEffects = EditorGUILayout.Foldout(showVisualEffects, "VISUAL EFFECTS AND AUDIO");//, EditorStyles.boldLabel); if (showVisualEffects) { EditorGUILayout.BeginVertical("Button"); camEffects = (SceneControl.CameraEffects)EditorGUILayout.EnumPopup("Camera Effects:", camEffects); bodyTex = (DanceControl.BodyMats)EditorGUILayout.EnumPopup("Body Texture:", bodyTex); floorTex = (SceneControl.FloorTex)EditorGUILayout.EnumPopup("Floor Texture:", floorTex); EditorGUILayout.EndVertical(); //EditorGUILayout.TextField ("AUDIO CONTROLS", EditorStyles.boldLabel); EditorGUILayout.BeginVertical("Button"); GUILayout.BeginHorizontal("box"); volume = EditorGUILayout.FloatField("Audio Volume:", volume); audioFadeTime = EditorGUILayout.FloatField("Audio Fade Out Length:", audioFadeTime); GUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } }
public override void OnInspectorGUI() { tk2dTextMesh textMesh = (tk2dTextMesh)target; // maybe cache this if its too slow later if (allBmFontImporters == null) { allBmFontImporters = tk2dEditorUtility.GetOrCreateIndex().GetFonts(); } if (allBmFontImporters != null) { if (textMesh.font == null) { textMesh.font = allBmFontImporters[0].data; } int currId = -1; string[] fontNames = new string[allBmFontImporters.Length]; for (int i = 0; i < allBmFontImporters.Length; ++i) { fontNames[i] = allBmFontImporters[i].name; if (allBmFontImporters[i].data == textMesh.font) { currId = i; } } int newId = EditorGUILayout.Popup("Font", currId, fontNames); if (newId != currId) { textMesh.font = allBmFontImporters[newId].data; textMesh.renderer.material = allBmFontImporters[newId].material; } EditorGUILayout.BeginHorizontal(); textMesh.maxChars = EditorGUILayout.IntField("Max Chars", textMesh.maxChars); if (textMesh.maxChars < 1) { textMesh.maxChars = 1; } if (GUILayout.Button("Fit", GUILayout.MaxWidth(32.0f))) { textMesh.maxChars = textMesh.NumDrawnCharacters(); GUI.changed = true; } EditorGUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Text"); textMesh.text = EditorGUILayout.TextArea(textMesh.text, GUILayout.Height(64)); GUILayout.EndHorizontal(); textMesh.anchor = (TextAnchor)EditorGUILayout.EnumPopup("Anchor", textMesh.anchor); textMesh.kerning = EditorGUILayout.Toggle("Kerning", textMesh.kerning); textMesh.scale = EditorGUILayout.Vector3Field("Scale", textMesh.scale); if (textMesh.font.textureGradients && textMesh.font.gradientCount > 0) { //textMesh.textureGradient = EditorGUILayout.IntSlider("Gradient", textMesh.textureGradient, 0, textMesh.font.gradientCount - 1); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("TextureGradient"); // Draw gradient scroller bool drawGradientScroller = true; if (drawGradientScroller) { textMesh.textureGradient = textMesh.textureGradient % textMesh.font.gradientCount; gradientScroll = EditorGUILayout.BeginScrollView(gradientScroll, GUILayout.ExpandHeight(false)); Rect r = GUILayoutUtility.GetRect(textMesh.font.gradientTexture.width, textMesh.font.gradientTexture.height, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false)); GUI.DrawTexture(r, textMesh.font.gradientTexture); Rect hr = r; hr.width /= textMesh.font.gradientCount; hr.x += hr.width * textMesh.textureGradient; float ox = hr.width / 8; float oy = hr.height / 8; Vector3[] rectVerts = { new Vector3(hr.x + 0.5f + ox, hr.y + oy, 0), new Vector3(hr.x + hr.width - ox, hr.y + oy, 0), new Vector3(hr.x + hr.width - ox, hr.y + hr.height - 0.5f - oy, 0), new Vector3(hr.x + ox, hr.y + hr.height - 0.5f - oy, 0) }; Handles.DrawSolidRectangleWithOutline(rectVerts, new Color(0, 0, 0, 0.2f), new Color(0, 0, 0, 1)); if (GUIUtility.hotControl == 0 && Event.current.type == EventType.MouseDown && r.Contains(Event.current.mousePosition)) { textMesh.textureGradient = (int)(Event.current.mousePosition.x / (textMesh.font.gradientTexture.width / textMesh.font.gradientCount)); GUI.changed = true; } EditorGUILayout.EndScrollView(); } GUILayout.EndHorizontal(); textMesh.inlineStyling = EditorGUILayout.Toggle("Inline Styling", textMesh.inlineStyling); if (textMesh.inlineStyling) { Color bg = GUI.backgroundColor; GUI.backgroundColor = new Color32(154, 176, 203, 255); GUILayout.TextArea("Inline style commands\n" + "^0-9 - select gradient\n" + "^^ - print ^"); GUI.backgroundColor = bg; } } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("HFlip")) { Vector3 s = textMesh.scale; s.x *= -1.0f; textMesh.scale = s; GUI.changed = true; } if (GUILayout.Button("VFlip")) { Vector3 s = textMesh.scale; s.y *= -1.0f; textMesh.scale = s; GUI.changed = true; } if (GUILayout.Button("Make Pixel Perfect", GUILayout.ExpandWidth(true))) { if (tk2dPixelPerfectHelper.inst) { tk2dPixelPerfectHelper.inst.Setup(); } textMesh.MakePixelPerfect(); GUI.changed = true; } textMesh.pixelPerfect = GUILayout.Toggle(textMesh.pixelPerfect, "Always", GUILayout.Width(60.0f)); EditorGUILayout.EndHorizontal(); textMesh.useGradient = EditorGUILayout.Toggle("Use Gradient", textMesh.useGradient); if (textMesh.useGradient) { textMesh.color = EditorGUILayout.ColorField("Top Color", textMesh.color); textMesh.color2 = EditorGUILayout.ColorField("Bottom Color", textMesh.color2); } else { textMesh.color = EditorGUILayout.ColorField("Color", textMesh.color); } if (GUI.changed) { textMesh.Commit(); EditorUtility.SetDirty(textMesh); } } }
protected override void OnGUI() { EditorGUILayout.ColorField(m_Color); }
public override void OnInspectorGUI() { mFont = target as UIFont; NGUIEditorTools.SetLabelWidth(80f); GUILayout.Space(6f); if (mFont.replacement != null) { mType = FontType.Reference; mReplacement = mFont.replacement; } else if (mFont.dynamicFont != null) { mType = FontType.Dynamic; } GUI.changed = false; GUILayout.BeginHorizontal(); mType = (FontType)EditorGUILayout.EnumPopup("Font Type", mType); GUILayout.Space(18f); GUILayout.EndHorizontal(); if (GUI.changed) { if (mType == FontType.Bitmap) { OnSelectFont(null); } if (mType != FontType.Dynamic && mFont.dynamicFont != null) { mFont.dynamicFont = null; } } if (mType == FontType.Reference) { ComponentSelector.Draw <UIFont>(mFont.replacement, OnSelectFont, true); GUILayout.Space(6f); EditorGUILayout.HelpBox("You can have one font simply point to " + "another one. This is useful if you want to be " + "able to quickly replace the contents of one " + "font with another one, for example for " + "swapping an SD font with an HD one, or " + "replacing an English font with a Chinese " + "one. All the labels referencing this font " + "will update their references to the new one.", MessageType.Info); if (mReplacement != mFont && mFont.replacement != mReplacement) { NGUIEditorTools.RegisterUndo("Font Change", mFont); mFont.replacement = mReplacement; NGUITools.SetDirty(mFont); } return; } else if (mType == FontType.Dynamic) { #if UNITY_3_5 EditorGUILayout.HelpBox("Dynamic fonts require Unity 4.0 or higher.", MessageType.Error); #else Font fnt = EditorGUILayout.ObjectField("TTF Font", mFont.dynamicFont, typeof(Font), false) as Font; if (fnt != mFont.dynamicFont) { NGUIEditorTools.RegisterUndo("Font change", mFont); mFont.dynamicFont = fnt; } Material mat = EditorGUILayout.ObjectField("Material", mFont.material, typeof(Material), false) as Material; if (mFont.material != mat) { NGUIEditorTools.RegisterUndo("Font Material", mFont); mFont.material = mat; } GUILayout.BeginHorizontal(); int size = EditorGUILayout.IntField("Default Size", mFont.defaultSize, GUILayout.Width(120f)); FontStyle style = (FontStyle)EditorGUILayout.EnumPopup(mFont.dynamicFontStyle); GUILayout.Space(18f); GUILayout.EndHorizontal(); if (size != mFont.defaultSize) { NGUIEditorTools.RegisterUndo("Font change", mFont); mFont.defaultSize = size; } if (style != mFont.dynamicFontStyle) { NGUIEditorTools.RegisterUndo("Font change", mFont); mFont.dynamicFontStyle = style; } #endif } else { ComponentSelector.Draw <UIAtlas>(mFont.atlas, OnSelectAtlas, true); if (mFont.atlas != null) { if (mFont.bmFont.isValid) { NGUIEditorTools.DrawAdvancedSpriteField(mFont.atlas, mFont.spriteName, SelectSprite, false); } EditorGUILayout.Space(); } else { // No atlas specified -- set the material and texture rectangle directly Material mat = EditorGUILayout.ObjectField("Material", mFont.material, typeof(Material), false) as Material; if (mFont.material != mat) { NGUIEditorTools.RegisterUndo("Font Material", mFont); mFont.material = mat; } } // For updating the font's data when importing from an external source, such as the texture packer bool resetWidthHeight = false; if (mFont.atlas != null || mFont.material != null) { TextAsset data = EditorGUILayout.ObjectField("Import Data", null, typeof(TextAsset), false) as TextAsset; if (data != null) { NGUIEditorTools.RegisterUndo("Import Font Data", mFont); BMFontReader.Load(mFont.bmFont, NGUITools.GetHierarchy(mFont.gameObject), data.bytes); mFont.MarkAsChanged(); resetWidthHeight = true; Debug.Log("Imported " + mFont.bmFont.glyphCount + " characters"); } } if (mFont.bmFont.isValid) { Texture2D tex = mFont.texture; if (tex != null && mFont.atlas == null) { // Pixels are easier to work with than UVs Rect pixels = NGUIMath.ConvertToPixels(mFont.uvRect, tex.width, tex.height, false); // Automatically set the width and height of the rectangle to be the original font texture's dimensions if (resetWidthHeight) { pixels.width = mFont.texWidth; pixels.height = mFont.texHeight; } // Font sprite rectangle pixels = EditorGUILayout.RectField("Pixel Rect", pixels); // Convert the pixel coordinates back to UV coordinates Rect uvRect = NGUIMath.ConvertToTexCoords(pixels, tex.width, tex.height); if (mFont.uvRect != uvRect) { NGUIEditorTools.RegisterUndo("Font Pixel Rect", mFont); mFont.uvRect = uvRect; } //NGUIEditorTools.DrawSeparator(); EditorGUILayout.Space(); } } } // Dynamic fonts don't support emoticons if (!mFont.isDynamic && mFont.bmFont.isValid) { if (mFont.atlas != null) { if (NGUIEditorTools.DrawHeader("Symbols and Emoticons")) { NGUIEditorTools.BeginContents(); List <BMSymbol> symbols = mFont.symbols; for (int i = 0; i < symbols.Count;) { BMSymbol sym = symbols[i]; GUILayout.BeginHorizontal(); GUILayout.Label(sym.sequence, GUILayout.Width(40f)); if (NGUIEditorTools.DrawSpriteField(mFont.atlas, sym.spriteName, ChangeSymbolSprite, GUILayout.MinWidth(100f))) { mSelectedSymbol = sym; } if (GUILayout.Button("Edit", GUILayout.Width(40f))) { if (mFont.atlas != null) { NGUISettings.atlas = mFont.atlas; NGUISettings.selectedSprite = sym.spriteName; NGUIEditorTools.Select(mFont.atlas.gameObject); } } GUI.backgroundColor = Color.red; if (GUILayout.Button("X", GUILayout.Width(22f))) { NGUIEditorTools.RegisterUndo("Remove symbol", mFont); mSymbolSequence = sym.sequence; mSymbolSprite = sym.spriteName; symbols.Remove(sym); mFont.MarkAsChanged(); } GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); GUILayout.Space(4f); ++i; } if (symbols.Count > 0) { GUILayout.Space(6f); } GUILayout.BeginHorizontal(); mSymbolSequence = EditorGUILayout.TextField(mSymbolSequence, GUILayout.Width(40f)); NGUIEditorTools.DrawSpriteField(mFont.atlas, mSymbolSprite, SelectSymbolSprite); bool isValid = !string.IsNullOrEmpty(mSymbolSequence) && !string.IsNullOrEmpty(mSymbolSprite); GUI.backgroundColor = isValid ? Color.green : Color.grey; if (GUILayout.Button("Add", GUILayout.Width(40f)) && isValid) { NGUIEditorTools.RegisterUndo("Add symbol", mFont); mFont.AddSymbol(mSymbolSequence, mSymbolSprite); mFont.MarkAsChanged(); mSymbolSequence = ""; mSymbolSprite = ""; } GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); if (symbols.Count == 0) { EditorGUILayout.HelpBox("Want to add an emoticon to your font? In the field above type ':)', choose a sprite, then hit the Add button.", MessageType.Info); } else { GUILayout.Space(4f); } NGUIEditorTools.EndContents(); } } } if (mFont.bmFont != null && mFont.bmFont.isValid) { if (NGUIEditorTools.DrawHeader("Modify")) { NGUIEditorTools.BeginContents(); UISpriteData sd = mFont.sprite; bool disable = (sd != null && (sd.paddingLeft != 0 || sd.paddingBottom != 0)); EditorGUI.BeginDisabledGroup(disable || mFont.packedFontShader); EditorGUILayout.BeginHorizontal(); GUILayout.Space(20f); EditorGUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); NGUISettings.foregroundColor = EditorGUILayout.ColorField("Foreground", NGUISettings.foregroundColor); NGUISettings.backgroundColor = EditorGUILayout.ColorField("Background", NGUISettings.backgroundColor); GUILayout.EndVertical(); mCurve = EditorGUILayout.CurveField("", mCurve, GUILayout.Width(40f), GUILayout.Height(40f)); GUILayout.EndHorizontal(); if (GUILayout.Button("Add a Shadow")) { ApplyEffect(Effect.Shadow, NGUISettings.foregroundColor, NGUISettings.backgroundColor); } if (GUILayout.Button("Add a Soft Outline")) { ApplyEffect(Effect.Outline, NGUISettings.foregroundColor, NGUISettings.backgroundColor); } if (GUILayout.Button("Rebalance Colors")) { ApplyEffect(Effect.Rebalance, NGUISettings.foregroundColor, NGUISettings.backgroundColor); } if (GUILayout.Button("Apply Curve to Alpha")) { ApplyEffect(Effect.AlphaCurve, NGUISettings.foregroundColor, NGUISettings.backgroundColor); } if (GUILayout.Button("Apply Curve to Foreground")) { ApplyEffect(Effect.ForegroundCurve, NGUISettings.foregroundColor, NGUISettings.backgroundColor); } if (GUILayout.Button("Apply Curve to Background")) { ApplyEffect(Effect.BackgroundCurve, NGUISettings.foregroundColor, NGUISettings.backgroundColor); } GUILayout.Space(10f); if (GUILayout.Button("Add Transparent Border (+1)")) { ApplyEffect(Effect.Border, NGUISettings.foregroundColor, NGUISettings.backgroundColor); } if (GUILayout.Button("Remove Border (-1)")) { ApplyEffect(Effect.Crop, NGUISettings.foregroundColor, NGUISettings.backgroundColor); } EditorGUILayout.EndVertical(); GUILayout.Space(20f); EditorGUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); if (disable) { GUILayout.Space(3f); EditorGUILayout.HelpBox("The sprite used by this font has been trimmed and is not suitable for modification. " + "Try re-adding this sprite with 'Trim Alpha' disabled.", MessageType.Warning); } NGUIEditorTools.EndContents(); } } // The font must be valid at this point for the rest of the options to show up if (mFont.isDynamic || mFont.bmFont.isValid) { if (mFont.atlas == null) { mView = View.Font; mUseShader = false; } } // Preview option if (!mFont.isDynamic && mFont.atlas != null) { GUILayout.BeginHorizontal(); { mView = (View)EditorGUILayout.EnumPopup("Preview", mView); GUILayout.Label("Shader", GUILayout.Width(45f)); mUseShader = EditorGUILayout.Toggle(mUseShader, GUILayout.Width(20f)); } GUILayout.EndHorizontal(); } }
private static void OnGUI() { if (CinemachineHeader != null) { const float kWidth = 350f; float aspectRatio = (float)CinemachineHeader.height / (float)CinemachineHeader.width; GUILayout.BeginScrollView(Vector2.zero, false, false, GUILayout.Width(kWidth), GUILayout.Height(kWidth * aspectRatio)); Rect texRect = new Rect(0f, 0f, kWidth, kWidth * aspectRatio); GUILayout.BeginArea(texRect); GUI.DrawTexture(texRect, CinemachineHeader, ScaleMode.ScaleToFit); GUILayout.EndArea(); GUILayout.EndScrollView(); } sScrollPosition = GUILayout.BeginScrollView(sScrollPosition); //CinemachineCore.sShowHiddenObjects // = EditorGUILayout.Toggle("Show Hidden Objects", CinemachineCore.sShowHiddenObjects); ShowCoreSettings = EditorGUILayout.Foldout(ShowCoreSettings, "Runtime Settings", true); if (ShowCoreSettings) { EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); Color newActiveGizmoColour = EditorGUILayout.ColorField(Styles.sCoreActiveGizmosColour, CinemachineCoreSettings.ActiveGizmoColour); if (EditorGUI.EndChangeCheck()) { CinemachineCoreSettings.ActiveGizmoColour = newActiveGizmoColour; UnityEditorInternal.InternalEditorUtility.RepaintAllViews(); } if (GUILayout.Button("Reset")) { CinemachineCoreSettings.ActiveGizmoColour = CinemachineCoreSettings.kDefaultActiveColour; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); Color newInactiveGizmoColour = EditorGUILayout.ColorField(Styles.sCoreInactiveGizmosColour, CinemachineCoreSettings.InactiveGizmoColour); if (EditorGUI.EndChangeCheck()) { CinemachineCoreSettings.InactiveGizmoColour = newInactiveGizmoColour; UnityEditorInternal.InternalEditorUtility.RepaintAllViews(); } if (GUILayout.Button("Reset")) { CinemachineCoreSettings.InactiveGizmoColour = CinemachineCoreSettings.kDefaultInactiveColour; } EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel--; } ShowComposerSettings = EditorGUILayout.Foldout(ShowComposerSettings, "Composer Settings", true); if (ShowComposerSettings) { EditorGUI.indentLevel++; EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); float overlayOpacity = EditorGUILayout.Slider(Styles.sComposerOverlayOpacity, ComposerSettings.OverlayOpacity, 0f, 1f); if (EditorGUI.EndChangeCheck()) { ComposerSettings.OverlayOpacity = overlayOpacity; } if (GUILayout.Button("Reset")) { ComposerSettings.OverlayOpacity = ComposerSettings.kDefaultOverlayOpacity; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); Color newHardEdgeColor = EditorGUILayout.ColorField(Styles.sComposerHardBoundsOverlay, ComposerSettings.HardBoundsOverlayColour); if (EditorGUI.EndChangeCheck()) { ComposerSettings.HardBoundsOverlayColour = newHardEdgeColor; } if (GUILayout.Button("Reset")) { ComposerSettings.HardBoundsOverlayColour = ComposerSettings.kDefaultHardBoundsColour; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); Color newSoftEdgeColor = EditorGUILayout.ColorField(Styles.sComposerSoftBoundsOverlay, ComposerSettings.SoftBoundsOverlayColour); if (EditorGUI.EndChangeCheck()) { ComposerSettings.SoftBoundsOverlayColour = newSoftEdgeColor; } if (GUILayout.Button("Reset")) { ComposerSettings.SoftBoundsOverlayColour = ComposerSettings.kDefaultSoftBoundsColour; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); Color newTargetColour = EditorGUILayout.ColorField(Styles.sComposerTargetOverlay, ComposerSettings.TargetColour); if (EditorGUI.EndChangeCheck()) { ComposerSettings.TargetColour = newTargetColour; } if (GUILayout.Button("Reset")) { ComposerSettings.TargetColour = ComposerSettings.kDefaultTargetColour; } EditorGUILayout.EndHorizontal(); EditorGUI.BeginChangeCheck(); float targetSide = EditorGUILayout.FloatField(Styles.sComposerTargetOverlayPixels, ComposerSettings.TargetSize); if (EditorGUI.EndChangeCheck()) { ComposerSettings.TargetSize = targetSide; } EditorGUI.indentLevel--; } if (AdditionalCategories != null) { AdditionalCategories(); } GUILayout.EndScrollView(); //if (GUILayout.Button("Open Documentation")) //{ // Application.OpenURL(kCinemachineDocURL); //} }
public Color ColorField(string label, Color color) { return(EditorGUILayout.ColorField(label, color)); }
private bool DrawDetailsGeneral() { bool bChanged = false; { float oldValue = HEU_PluginSettings.PinSize; float newValue = EditorGUILayout.DelayedFloatField("Pin Size", oldValue); if (newValue != oldValue) { HEU_PluginSettings.PinSize = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { Color oldValue = HEU_PluginSettings.PinColor; Color newValue = EditorGUILayout.ColorField("Pin Color", oldValue); if (newValue != oldValue) { HEU_PluginSettings.PinColor = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { float oldValue = HEU_PluginSettings.ImageGamma; float newValue = EditorGUILayout.DelayedFloatField("Texture Gamma", oldValue); if (newValue != oldValue) { HEU_PluginSettings.ImageGamma = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { Color oldValue = HEU_PluginSettings.LineColor; Color newValue = EditorGUILayout.ColorField("Line Color", oldValue); if (newValue != oldValue) { HEU_PluginSettings.LineColor = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { string oldPath = HEU_PluginSettings.AssetCachePath; string newPath = EditorGUILayout.TextField("Houdini Asset Cache Path", oldPath); if (!newPath.Equals(oldPath)) { HEU_PluginSettings.AssetCachePath = newPath; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { bool oldValue = HEU_PluginSettings.UseFullPathNamesForOutput; bool newValue = HEU_EditorUI.DrawToggleLeft(oldValue, "Use Full Path Names For Output"); if (!newValue.Equals(oldValue)) { HEU_PluginSettings.UseFullPathNamesForOutput = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { bool oldValue = HEU_PluginSettings.SetCurrentThreadToInvariantCulture; bool newValue = HEU_EditorUI.DrawToggleLeft(oldValue, "Set Current Thread To Invariant Culture", "Enabling this sets to use InvariantCutulre which fixes locale-specific parsing issues such as using comma instead of dot for decimals."); if (!newValue.Equals(oldValue)) { HEU_PluginSettings.SetCurrentThreadToInvariantCulture = newValue; bChanged = true; } } HEU_EditorUI.DrawSeparator(); { string oldPath = HEU_PluginSettings.HoudiniDebugLaunchPath; string fileExt = ""; EditorGUILayout.LabelField(new GUIContent("Houdini Debug Executable:", "Set Houdini executable to launch when opening debug scenes.")); using (new EditorGUILayout.HorizontalScope()) { string newPath = EditorGUILayout.DelayedTextField(oldPath); GUIStyle buttonStyle = HEU_EditorUI.GetNewButtonStyle_MarginPadding(0, 0); if (GUILayout.Button("...", buttonStyle, GUILayout.Width(30), GUILayout.Height(18))) { string panelMsg = "Select Houdini Executable"; #if UNITY_EDITOR_OSX panelMsg += " (.app)"; #endif string openFilePath = UnityEditor.EditorUtility.OpenFilePanel(panelMsg, newPath, fileExt); if (!string.IsNullOrEmpty(openFilePath)) { newPath = openFilePath; } } if (!newPath.Equals(oldPath)) { HEU_PluginSettings.HoudiniDebugLaunchPath = newPath; bChanged = true; } } #if UNITY_EDITOR_OSX GUIStyle labelStyle = new GUIStyle(GUI.skin.label); labelStyle.wordWrap = true; EditorGUILayout.LabelField(" On macOS, you'll need to select the path to the .app folder.\n E.g. /Applications/Houdini/Houdini16.5.616/Houdini Core 16.5.616.app", labelStyle); #endif } return bChanged; }
public static object GenericField(string name, object value, Type t, MemberInfo member = null, object context = null) { if (t == null) { GUILayout.Label("NO TYPE PROVIDED!"); return(value); } if (typeof(Delegate).IsAssignableFrom(t)) { return(value); } name = name.SplitCamelCase(); IEnumerable <Attribute> attributes = new Attribute[0]; if (member != null) { if (t.GetCustomAttributes(typeof(HideInInspector), true).FirstOrDefault() != null) { return(value); } attributes = member.GetCustomAttributes(true).Cast <Attribute>(); if (attributes.Any(a => a is HideInInspector)) { return(value); } } if (member != null) { var nameAtt = attributes.FirstOrDefault(a => a is NameAttribute) as NameAttribute; if (nameAtt != null) { name = nameAtt.name; } } if (typeof(UnityEngine.Object).IsAssignableFrom(t)) { return(EditorGUILayout.ObjectField(name, (UnityEngine.Object)value, t, typeof(Component).IsAssignableFrom(t) || t == typeof(GameObject))); } if ((value != null && value.GetType().IsAbstract) || (value == null && t.IsAbstract)) { EditorGUILayout.LabelField(name, string.Format("Abstract ({0})", t.FriendlyName())); return(value); } if (value == null && !t.IsAbstract && !t.IsInterface && (t.IsValueType || t.GetConstructor(Type.EmptyTypes) != null || t.IsArray)) { if (t.IsArray) { value = Array.CreateInstance(t.GetElementType(), 0); } else { value = Activator.CreateInstance(t); } } if (t == typeof(bool)) { return(EditorGUILayout.Toggle(name, (bool)value)); } if (t == typeof(int)) { return(EditorGUILayout.IntField(name, (int)value)); } if (t == typeof(float)) { return(EditorGUILayout.FloatField(name, (float)value)); } if (t == typeof(byte)) { return(Convert.ToByte(Mathf.Clamp(EditorGUILayout.IntField(name, (byte)value), 0, 255))); } if (t == typeof(Vector2)) { return(EditorGUILayout.Vector2Field(name, (Vector2)value)); } if (t == typeof(Vector3)) { return(EditorGUILayout.Vector3Field(name, (Vector3)value)); } if (t == typeof(Vector4)) { return(EditorGUILayout.Vector4Field(name, (Vector4)value)); } if (t == typeof(Quaternion)) { var quat = (Quaternion)value; var vec4 = new Vector4(quat.x, quat.y, quat.z, quat.w); vec4 = EditorGUILayout.Vector4Field(name, vec4); return(new Quaternion(vec4.x, vec4.y, vec4.z, vec4.w)); } if (t == typeof(Color)) { return(EditorGUILayout.ColorField(name, (Color)value)); } if (t == typeof(Rect)) { return(EditorGUILayout.RectField(name, (Rect)value)); } if (t == typeof(AnimationCurve)) { return(EditorGUILayout.CurveField(name, (AnimationCurve)value)); } if (t == typeof(Bounds)) { return(EditorGUILayout.BoundsField(name, (Bounds)value)); } if (t == typeof(string)) { return(EditorGUILayout.TextField(name, (string)value)); } if (t == typeof(LayerMask)) { return(LayerMaskField(name, (LayerMask)value)); } if (typeof(IList).IsAssignableFrom(t)) { return(ListEditor(name, (IList)value, t, context)); } if (typeof(IDictionary).IsAssignableFrom(t)) { //目前json序列化只支持以string为key的类型 var keyType = t.GetGenericArguments()[0]; if (keyType == typeof(string)) { return(DictionaryEditor(name, (IDictionary)value, t, context)); } } if (t.IsSubclassOf(typeof(System.Enum))) { #if UNITY_5 if (t.GetCustomAttributes(typeof(FlagsAttribute), true).FirstOrDefault() != null) { return(EditorGUILayout.EnumMaskPopup(new GUIContent(name), (System.Enum)value)); } #endif return(EditorGUILayout.EnumPopup(name, (System.Enum)value)); } //show nested class members recursively if (value != null && !t.IsEnum && !t.IsInterface) { GUILayout.BeginVertical(); EditorGUILayout.LabelField(name, t.FriendlyName()); EditorGUI.indentLevel++; ShowAutoEditorGUI(value); EditorGUI.indentLevel--; GUILayout.EndVertical(); } else { EditorGUILayout.LabelField(name, string.Format("({0})", t.FriendlyName())); } return(value); }
public override void OnInspectorGUI() { //draw the path? EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Path Visible"); _target.pathVisible = EditorGUILayout.Toggle(_target.pathVisible); EditorGUILayout.EndHorizontal(); //path name: EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Path Name"); _target.pathName = EditorGUILayout.TextField(_target.pathName); EditorGUILayout.EndHorizontal(); if (_target.pathName == "") { _target.pathName = _target.initialName; } //path color: EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Path Color"); _target.pathColor = EditorGUILayout.ColorField(_target.pathColor); EditorGUILayout.EndHorizontal(); //exploration segment count control: EditorGUILayout.BeginHorizontal(); //EditorGUILayout.PrefixLabel("Node Count"); _target.nodeCount = Mathf.Max(2, EditorGUILayout.IntField("Node Count", _target.nodeCount)); //_target.nodeCount = Mathf.Clamp(EditorGUILayout.IntSlider(_target.nodeCount, 0, 10), 2,100); EditorGUILayout.EndHorizontal(); //add node? if (_target.nodeCount > _target.nodes.Count) { for (int i = 0; i < _target.nodeCount - _target.nodes.Count; i++) { _target.nodes.Add(Vector3.zero); } } //remove node? if (_target.nodeCount < _target.nodes.Count) { if (EditorUtility.DisplayDialog("Remove path node?", "Shortening the node list will permantently destory parts of your path. This operation cannot be undone.", "OK", "Cancel")) { int removeCount = _target.nodes.Count - _target.nodeCount; _target.nodes.RemoveRange(_target.nodes.Count - removeCount, removeCount); } else { _target.nodeCount = _target.nodes.Count; } } //node display: EditorGUI.indentLevel = 4; for (int i = 0; i < _target.nodes.Count; i++) { _target.nodes[i] = EditorGUILayout.Vector3Field("Node " + (i + 1), _target.nodes[i]); } //update and redraw: if (GUI.changed) { EditorUtility.SetDirty(_target); } }
private void OnGUI() { //GUIStyle gstyle = new GUIStyle(); //gstyle.wordWrap = true; //gstyle.padding = new RectOffset(10, 10, 0, 5); GUILayout.Label(""); GUILayout.Label("Project Colors:", EditorStyles.boldLabel); GUILayout.Label("Select the main colors for your project."); bg_color = EditorGUILayout.ColorField("Background Color", bg_color); text_color = EditorGUILayout.ColorField("Text Color", text_color); HorizontalLine(Color.grey); if (GameObject.Find("Canvas")) { } else { GUILayout.Label("Generate Canvas:", EditorStyles.boldLabel); GUILayout.Label("Get started by creating a canvas object. It will be created with a navigation script attached. Use those methods with any created buttons to control the slides."); width = EditorGUILayout.IntField("Width", width); height = EditorGUILayout.IntField("Height", height); if (GUILayout.Button("Generate Canvas")) { GenerateCanvas(); } HorizontalLine(Color.grey); } GUILayout.Label("Generate Panels:", EditorStyles.boldLabel); GUILayout.Label("Create as many panels as you would like. Run 'Panel Cleanup' function if you remove any along the way."); if (GUILayout.Button("Generate Panel")) { GeneratePanel(); } if (GUILayout.Button("Panel Cleanup")) { if (new_canvas != null) { var nav = new_canvas.GetComponent <Navigation>(); nav.ListCleanup(); } } HorizontalLine(Color.grey); GUILayout.Label("Formatted Text Components:", EditorStyles.boldLabel); GUILayout.Label( "Use this portion of the utility to generate text objects with the pre-determined styling. Make sure to select the parent object in the hierarchy before generating."); header_txt = EditorGUILayout.TextField("Header Text", header_txt); if (GUILayout.Button("Generate Header Text")) { GenerateHeader(); } GUILayout.Label(""); body_txt = EditorGUILayout.TextArea(body_txt, GUILayout.Height(100)); if (GUILayout.Button("Generate Body Text")) { GenerateBody(); } //the code of the editor panel }
void OnGUI() { CheckInit(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); #region settings EditorGUILayout.BeginVertical(GUI.skin.box); showSettings = EditorGUILayout.Foldout(showSettings, settingsStr, groupFoldoutStyle); if (showSettings) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(showTooltipsStr, Width50); var showTooltips = EditorGUILayout.Toggle(data.showTooltips, Width50); if (showTooltips != data.showTooltips) { data.showTooltips = showTooltips; InstanceGUIContent(); MarkDirty(); } EditorGUILayout.LabelField(enableShortcutsStr, GUILayout.Width(60)); var enableShortcuts = EditorGUILayout.Toggle(data.enableShortcuts, Width50); if (enableShortcuts != data.enableShortcuts) { data.enableShortcuts = enableShortcuts; MarkDirty(); } GUILayout.FlexibleSpace(); if (GUILayout.Button(resetDataGC, GUILayout.Width(100))) { ResetData(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField(rulerThicknessStr); CheckDirty(ref data.rulerThickness, EditorGUILayout.IntSlider(data.rulerThickness, 1, 30)); EditorGUILayout.LabelField(pointSizeStr); CheckDirty(ref data.pointSize, EditorGUILayout.IntSlider(data.pointSize, 0, 100)); EditorGUILayout.LabelField(arrowSizeStr); CheckDirty(ref data.arrowSize, EditorGUILayout.IntSlider(data.arrowSize, 0, 50)); EditorGUILayout.LabelField(rulerColorStr); CheckDirty(ref data.rulerColor, EditorGUILayout.ColorField(data.rulerColor)); EditorGUILayout.LabelField(textSizeStr); CheckDirty(ref data.fontSize, EditorGUILayout.IntSlider(data.fontSize, 4, 40)); labelStyle.fontSize = data.fontSize; EditorGUILayout.LabelField(textColorStr); CheckDirty(ref data.textColor, EditorGUILayout.ColorField(data.textColor)); labelStyle.normal.textColor = data.textColor; EditorGUILayout.LabelField(displayPrecisionStr); var oldPrecision = data.precision; CheckDirty(ref data.precision, EditorGUILayout.IntSlider(data.precision, 1, 5)); if (data.precision != oldPrecision) { precisionStr = "0." + new string('0', data.precision); } } EditorGUILayout.EndVertical(); #endregion settings #region filter var toolbarSelection = GUILayout.Toolbar(-1, toolbarStrings, toolbarStyle); switch (toolbarSelection) { case 0: for (int i = 0; i < data.rulers.Length; ++i) { data.rulers[i].isVisible = false; } MarkDirty(); break; case 1: for (int i = 0; i < data.rulers.Length; ++i) { data.rulers[i].isVisible = true; } MarkDirty(); break; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(filterStr, Width50); var filterTransform = (Transform)EditorGUILayout.ObjectField(data.filterTransform, typeof(Transform), true, GUILayout.ExpandWidth(true)); if (filterTransform != data.filterTransform) { data.filterTransform = filterTransform; MarkDirty(); } if (GUILayout.Button(clearFilterGC, miniButtonStyle, Width20)) { if (data.filterTransform != null) { data.filterTransform = null; MarkDirty(); } } EditorGUILayout.EndHorizontal(); #endregion filter #region ruler EditorGUILayout.BeginVertical(); int removeRulerIndex = -1; int duplicateRulerIndex = -1; for (int i = 0; i < data.rulers.Length; ++i) { var r = data.rulers[i]; if (data.filterTransform != null && r.a != data.filterTransform && r.b != data.filterTransform) { continue; } EditorGUILayout.BeginVertical(GUI.skin.box); EditorGUILayout.BeginHorizontal(); CheckDirty(ref r.isVisible, GUILayout.Toggle(r.isVisible, visibilityGC, toggleStyle)); if (GUILayout.Button(duplicateRulerGC, miniButtonStyle, Width20)) { duplicateRulerIndex = i; } CheckDirty(ref r.color, EditorGUILayout.ColorField(r.color, Width50)); CheckDirty(ref r.textColor, EditorGUILayout.ColorField(r.textColor, Width50)); if (GUILayout.Button(r.isLocal ? exDataIsLocalGC : exDataIsGlobalGC, Width20)) { r.isLocal = !r.isLocal; MarkDirty(); } var showExDist = GUILayout.Toggle(r.showExDist, exDataDistanceGC, ButtonStr); if (showExDist != r.showExDist) { r.showExDist = showExDist; MarkDirty(); } var showExAngle = GUILayout.Toggle(r.showExAngle, exDataAngleGC, ButtonStr); if (showExAngle != r.showExAngle) { r.showExAngle = showExAngle; MarkDirty(); } GUILayout.FlexibleSpace(); if (GUILayout.Button(deleteRulerGC, miniButtonStyle, Width20)) { removeRulerIndex = i; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(frameGC, miniButtonStyle, Width20)) { // search for objects selectedTransform = r.a; } var aTransform = (Transform)EditorGUILayout.ObjectField(r.a, typeof(Transform), true); if (aTransform != r.a) { r.a = aTransform; MarkDirty(); } #region distance editor if (r.isDistanceNonzero) { if (r.isEditingDistance) { GUI.SetNextControlName("deltaEditor"); var oldDistStr = r.delta.magnitude.ToString(); var newDistStr = EditorGUILayout.TextField(oldDistStr, GUILayout.Width(40)); newDistStr = Regex.Replace(newDistStr, @"[^0-9.-]", ""); // filter for real numbers only if (oldDistStr != newDistStr) { float newDist = 0f; try { newDist = float.Parse(newDistStr); } catch (FormatException e) { // ignore } if (newDist != 0f) { var newDelta = r.delta.normalized * newDist; r.b.position = r.a.position + newDelta; MarkDirty(); } } if (Event.current.isKey && Event.current.keyCode == KeyCode.Return && GUI.GetNameOfFocusedControl() == "deltaEditor") { r.isEditingDistance = false; } } else { if (GUILayout.Button(r.delta.magnitude.ToString(precisionStr), boldStyle, GUILayout.Width(40))) { r.isEditingDistance = true; } } } else { r.isEditingDistance = false; EditorGUILayout.LabelField(r.delta.magnitude.ToString(precisionStr), EditorStyles.label, GUILayout.Width(40)); } #endregion delta editor if (GUILayout.Button(frameGC, miniButtonStyle, Width20)) { // search for objects selectedTransform = r.b; } var bTransform = (Transform)EditorGUILayout.ObjectField(r.b, typeof(Transform), true); if (bTransform != r.b) { r.b = bTransform; MarkDirty(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } #endregion ruler if (duplicateRulerIndex != -1) { var ruler = data.rulers[duplicateRulerIndex]; var r = new Ruler(); r.color = ruler.color; r.textColor = ruler.textColor; r.a = ruler.a; r.b = ruler.b; data.Add(r, duplicateRulerIndex + 1); MarkDirty(); } if (removeRulerIndex != -1) { data.RemoveAt(removeRulerIndex); MarkDirty(); } if (GUILayout.Button(addRulerGC, miniButtonStyle)) { AddRuler(); } EditorGUILayout.EndVertical(); EditorGUILayout.EndScrollView(); CheckShortcuts(); }
} // BuildPreviewInspectorHeaderGUI protected void BuildPreFillInspectorGUI(bool withKeys) { PlayMakerCollectionProxy proxy = (PlayMakerCollectionProxy)target; string preFillSuffix = ""; if (!proxy.showContent) { preFillSuffix = proxy.preFillType.ToString() + " (" + proxy.preFillCount + ")"; } if (duplicatedKey) { duplicatedKey = false; //GUI.color = Color.red; // EditorGUILayout.BeginHorizontal(); // EditorGUILayout.SelectableLabel("WARNING: Duplicates key. please remove.",EditorStyles.whiteBoldLabel); // EditorGUILayout.EndHorizontal(); // GUI.color = Color.white; } proxy.showContent = EditorGUILayout.Foldout(proxy.showContent, new GUIContent("PreFilled data : " + preFillSuffix, "Author time content definition")); GUI.contentColor = Color.white; if (proxy.showContent) { EditorGUI.indentLevel = 1; proxy.preFillType = (PlayMakerHashTableProxy.VariableEnum)EditorGUILayout.EnumPopup("Prefill type", proxy.preFillType); proxy.preFillCount = Mathf.Max(0, EditorGUILayout.IntField("Prefill count", proxy.preFillCount)); if (withKeys) { proxy.condensedView = (bool)EditorGUILayout.Toggle("Condensed view", proxy.condensedView); } if (proxy.preFillType == PlayMakerCollectionProxy.VariableEnum.Texture) { proxy.TextureElementSmall = EditorGUILayout.Toggle("Small thumbs", proxy.TextureElementSmall); } proxy.liveUpdate = EditorGUILayout.Toggle("Live update", proxy.liveUpdate); //FsmEditorGUILayout.LightDivider(); // debug to check the real array count //EditorGUILayout.LabelField("preFill real count",proxy.preFillVector3List.Count.ToString()); switch (proxy.preFillType) { case (PlayMakerCollectionProxy.VariableEnum.Bool): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillBoolList.Count < (i + 1)) { proxy.preFillBoolList.Add(false); } EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); proxy.preFillBoolList[i] = EditorGUILayout.Toggle(proxy.preFillBoolList[i]); } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } proxy.preFillBoolList[i] = EditorGUILayout.Toggle("Item " + i, proxy.preFillBoolList[i]); } EditorGUILayout.EndHorizontal(); } break; case (PlayMakerCollectionProxy.VariableEnum.Color): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillColorList.Count < (i + 1)) { proxy.preFillColorList.Add(new Color(1.0f, 1.0f, 1.0f)); } EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); proxy.preFillColorList[i] = EditorGUILayout.ColorField(proxy.preFillColorList[i]); } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } proxy.preFillColorList[i] = EditorGUILayout.ColorField("Item " + i, proxy.preFillColorList[i]); } EditorGUILayout.EndHorizontal(); } break; case (PlayMakerCollectionProxy.VariableEnum.Float): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillFloatList.Count < (i + 1)) { proxy.preFillFloatList.Add(0f); } EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); proxy.preFillFloatList[i] = EditorGUILayout.FloatField(proxy.preFillFloatList[i]); } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } proxy.preFillFloatList[i] = EditorGUILayout.FloatField("Item " + i, proxy.preFillFloatList[i]); } EditorGUILayout.EndHorizontal(); } break; case (PlayMakerCollectionProxy.VariableEnum.GameObject): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillGameObjectList.Count < (i + 1)) { proxy.preFillGameObjectList.Add(null); } EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); proxy.preFillGameObjectList[i] = (GameObject)EditorGUILayout.ObjectField(proxy.preFillGameObjectList[i], typeof(GameObject), true); } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } proxy.preFillGameObjectList[i] = (GameObject)EditorGUILayout.ObjectField("Item " + i, proxy.preFillGameObjectList[i], typeof(GameObject), true); } EditorGUILayout.EndHorizontal(); } break; case (PlayMakerCollectionProxy.VariableEnum.Int): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillIntList.Count < (i + 1)) { proxy.preFillIntList.Add(0); } EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); proxy.preFillIntList[i] = EditorGUILayout.IntField(proxy.preFillIntList[i]); } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } proxy.preFillIntList[i] = EditorGUILayout.IntField("Item " + i, proxy.preFillIntList[i]); } EditorGUILayout.EndHorizontal(); } break; case (PlayMakerCollectionProxy.VariableEnum.Material): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillMaterialList.Count < (i + 1)) { proxy.preFillMaterialList.Add(null); } EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); proxy.preFillMaterialList[i] = (Material)EditorGUILayout.ObjectField(proxy.preFillMaterialList[i], typeof(Material), false); } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } proxy.preFillMaterialList[i] = (Material)EditorGUILayout.ObjectField("Item " + i, proxy.preFillMaterialList[i], typeof(Material), false); } EditorGUILayout.EndHorizontal(); } break; /* * case (PlayMakerCollectionProxy.VariableEnum.Object): * for(int i=0;i<proxy.preFillCount;i++){ * if (proxy.preFillObjectList.Count<(i+1)){ * proxy.preFillObjectList.Add(null); * } * System.Type type = Types.GetType("material",""); * * //proxy.preFillObjectTypeIndex =EditorGUILayout. EditorGUILayout.Popup(proxy.preFillObjectTypeIndex,); * //System.Type type = FsmEditorUtility.ObjectTypeList[preFillObjectTypeIndex]; * // proxy.preFillObjectList[i]= (typeof("material"))EditorGUILayout.ObjectField("Item "+i, proxy.preFillGameObjectList[i],type,true); * } * break; */ case (PlayMakerCollectionProxy.VariableEnum.Quaternion): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillQuaternionList.Count < (i + 1)) { proxy.preFillQuaternionList.Add(Quaternion.identity); } Quaternion q = proxy.preFillQuaternionList[i]; Vector4 quat = new Vector4(q[0], q[1], q[2], q[3]); EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); EditorGUILayout.LabelField("x", "", GUILayout.MinWidth(16), GUILayout.Width(16)); quat[0] = EditorGUILayout.FloatField(quat[0], GUILayout.MinWidth(0), GUILayout.Width(30)); EditorGUILayout.LabelField("y", "", GUILayout.MinWidth(16), GUILayout.Width(16)); quat[1] = EditorGUILayout.FloatField(quat[1], GUILayout.MinWidth(0), GUILayout.Width(30)); EditorGUILayout.LabelField("z", "", GUILayout.MinWidth(16), GUILayout.Width(16)); quat[2] = EditorGUILayout.FloatField(quat[2], GUILayout.MinWidth(0), GUILayout.Width(30)); EditorGUILayout.LabelField("w", "", GUILayout.MinWidth(16), GUILayout.Width(16)); quat[3] = EditorGUILayout.FloatField(quat[3], GUILayout.MinWidth(0), GUILayout.Width(30)); } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } quat = EditorGUILayout.Vector4Field("Item " + i, quat); } EditorGUILayout.EndHorizontal(); q[0] = quat[0]; q[1] = quat[1]; q[2] = quat[2]; q[3] = quat[3]; proxy.preFillQuaternionList[i] = q; } break; case (PlayMakerCollectionProxy.VariableEnum.Rect): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillRectList.Count < (i + 1)) { proxy.preFillRectList.Add(new Rect(0f, 0f, 0f, 0f)); } EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); proxy.preFillRectList[i] = EditorGUILayout.RectField(proxy.preFillRectList[i]); } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } proxy.preFillRectList[i] = EditorGUILayout.RectField("Item " + i, proxy.preFillRectList[i]); } EditorGUILayout.EndHorizontal(); } break; case (PlayMakerCollectionProxy.VariableEnum.String): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillStringList.Count < (i + 1)) { proxy.preFillStringList.Add(""); } EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); proxy.preFillStringList[i] = EditorGUILayout.TextField(proxy.preFillStringList[i]); } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } proxy.preFillStringList[i] = EditorGUILayout.TextField("Item " + i, proxy.preFillStringList[i]); } EditorGUILayout.EndHorizontal(); } break; case (PlayMakerCollectionProxy.VariableEnum.Texture): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillTextureList.Count < (i + 1)) { proxy.preFillTextureList.Add(null); } EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); if (proxy.TextureElementSmall) { EditorGUIUtility.LookLikeInspector(); } proxy.preFillTextureList[i] = (Texture2D)EditorGUILayout.ObjectField(proxy.preFillTextureList[i], typeof(Texture2D), false); if (proxy.TextureElementSmall) { EditorGUIUtility.LookLikeControls(); } } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } if (proxy.TextureElementSmall) { EditorGUIUtility.LookLikeInspector(); } proxy.preFillTextureList[i] = (Texture2D)EditorGUILayout.ObjectField("Item " + i, proxy.preFillTextureList[i], typeof(Texture2D), false); if (proxy.TextureElementSmall) { EditorGUIUtility.LookLikeControls(); } } EditorGUILayout.EndHorizontal(); } break; case (PlayMakerCollectionProxy.VariableEnum.Vector2): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillVector2List.Count < (i + 1)) { proxy.preFillVector2List.Add(new Vector2(0f, 0f)); } EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); Vector2 tmpVector2 = proxy.preFillVector2List[i]; EditorGUILayout.LabelField("x", "", GUILayout.MinWidth(16), GUILayout.Width(16)); tmpVector2.x = EditorGUILayout.FloatField(tmpVector2.x, GUILayout.MinWidth(0), GUILayout.Width(30)); EditorGUILayout.LabelField("y", "", GUILayout.MinWidth(16), GUILayout.Width(16)); tmpVector2.y = EditorGUILayout.FloatField(tmpVector2.y, GUILayout.MinWidth(0), GUILayout.Width(30)); proxy.preFillVector2List[i] = tmpVector2; } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } proxy.preFillVector2List[i] = EditorGUILayout.Vector2Field("Item " + i, proxy.preFillVector2List[i]); } EditorGUILayout.EndHorizontal(); } break; case (PlayMakerCollectionProxy.VariableEnum.Vector3): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillVector3List.Count < (i + 1)) { proxy.preFillVector3List.Add(new Vector3(0f, 0f, 0f)); } EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); Vector3 tmpVector3 = proxy.preFillVector3List[i]; EditorGUILayout.LabelField("x", "", GUILayout.MinWidth(16), GUILayout.Width(16)); tmpVector3.x = EditorGUILayout.FloatField(tmpVector3.x, GUILayout.MinWidth(0), GUILayout.Width(30)); EditorGUILayout.LabelField("y", "", GUILayout.MinWidth(16), GUILayout.Width(16)); tmpVector3.y = EditorGUILayout.FloatField(tmpVector3.y, GUILayout.MinWidth(0), GUILayout.Width(30)); EditorGUILayout.LabelField("z", "", GUILayout.MinWidth(16), GUILayout.Width(16)); tmpVector3.z = EditorGUILayout.FloatField(tmpVector3.z, GUILayout.MinWidth(0), GUILayout.Width(30)); proxy.preFillVector3List[i] = tmpVector3; } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } proxy.preFillVector3List[i] = EditorGUILayout.Vector3Field("Item " + i, proxy.preFillVector3List[i]); } EditorGUILayout.EndHorizontal(); } break; case (PlayMakerCollectionProxy.VariableEnum.AudioClip): for (int i = 0; i < proxy.preFillCount; i++) { if (proxy.preFillAudioClipList.Count < (i + 1)) { proxy.preFillAudioClipList.Add(null); } EditorGUILayout.BeginHorizontal(); buildItemSelector(i); if (proxy.condensedView && withKeys) { buildKeyField(proxy, i); proxy.preFillAudioClipList[i] = (AudioClip)EditorGUILayout.ObjectField(proxy.preFillAudioClipList[i], typeof(AudioClip), false); } else { if (withKeys) { buildKeyField(proxy, i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } proxy.preFillAudioClipList[i] = (AudioClip)EditorGUILayout.ObjectField("Item " + i, proxy.preFillAudioClipList[i], typeof(AudioClip), false); } EditorGUILayout.EndHorizontal(); } break; default: //ERROR break; } if (duplicatedKey) { //FsmEditorGUILayout.Divider(); //.LightDivider(); Color col = GUI.color; GUI.color = Color.red; GUILayout.Label("WARNING: Keys must be unique", EditorStyles.whiteLargeLabel); GUI.color = col; } EditorGUI.indentLevel = 0; } } // BuildPreFillInspectorGUI
public override void OnInspectorGUI() { UI_Skin my_target = (UI_Skin)target; EditorGUI.BeginChangeCheck(); Undo.RecordObject(my_target, "skin"); my_target.showText = EditorGUILayout.Foldout(my_target.showText, "Text"); if (my_target.showText) { my_target.defaultFont = EditorGUILayout.ObjectField("defaultFont", my_target.defaultFont, typeof(TMP_FontAsset), true) as TMP_FontAsset; my_target.defaultFontColor = EditorGUILayout.ColorField("color", my_target.defaultFontColor); EditorGUILayout.LabelField("sizes:"); EditorGUI.indentLevel++; for (int i = 0; i < my_target.fontSizes.Length; i++) { my_target.fontSizes[i] = EditorGUILayout.IntField(Enum.GetName(typeof(UI_Skin.FontSizes), i), my_target.fontSizes[i]); my_target.defaultTexts[i].font = my_target.defaultFont; my_target.defaultTexts[i].size = my_target.fontSizes[i]; my_target.defaultTexts[i].color = my_target.defaultFontColor; } EditorGUI.indentLevel--; } my_target.showIcons = EditorGUILayout.Foldout(my_target.showIcons, "Icons"); if (my_target.showIcons) { if (my_target.icons.Length < Enum.GetNames(typeof(UI_Skin.Icon)).Length) { Sprite[] tempSprites = new Sprite[my_target.icons.Length]; for (int i = 0; i < tempSprites.Length; i++) tempSprites[i] = my_target.icons[i]; my_target.icons = new Sprite[Enum.GetNames(typeof(UI_Skin.Icon)).Length]; for (int i = 0; i < tempSprites.Length; i++) my_target.icons[i] = tempSprites[i]; } else if (my_target.icons.Length > Enum.GetNames(typeof(UI_Skin.Icon)).Length) { Sprite[] tempSprites = new Sprite[my_target.icons.Length]; for (int i = 0; i < tempSprites.Length; i++) tempSprites[i] = my_target.icons[i]; my_target.icons = new Sprite[Enum.GetNames(typeof(UI_Skin.Icon)).Length]; for (int i = 0; i < Enum.GetNames(typeof(UI_Skin.Icon)).Length; i++) my_target.icons[i] = tempSprites[i]; } for (int i = 0; i < Enum.GetNames(typeof(UI_Skin.Icon)).Length; i++) my_target.icons[i] = EditorGUILayout.ObjectField(Enum.GetName(typeof(UI_Skin.Icon), i), my_target.icons[i], typeof(Sprite), true) as Sprite; } my_target.showWindow = EditorGUILayout.Foldout(my_target.showWindow, "Window"); if (my_target.showWindow) { EditorGUILayout.LabelField("Sprites:"); EditorGUI.indentLevel++; ShowImageTemplate("windowBK", my_target.windowBK); EditorGUILayout.LabelField("windowScrollbar:"); EditorGUI.indentLevel++; ShowImageTemplate("BK",my_target.windowScrollbarBK); ShowImageTemplate("Handle",my_target.windowScrollbarHandle); EditorGUI.indentLevel--; EditorGUI.indentLevel--; EditorGUILayout.LabelField("Text:"); EditorGUI.indentLevel++; ShowTextTemplate("windowHeaderText", my_target.windowHeaderText); ShowTextTemplate("windowText", my_target.windowText); ShowTextTemplate("windowBigText", my_target.windowBigText); EditorGUI.indentLevel--; } my_target.showInputField = EditorGUILayout.Foldout(my_target.showInputField, "Input Field"); if (my_target.showInputField) { ShowImageTemplate("inputFieldBK", my_target.inputFieldBK); ShowTextTemplate("inputFieldText", my_target.inputFieldText); } my_target.showScreen = EditorGUILayout.Foldout(my_target.showScreen, "Screen"); if (my_target.showScreen) { ShowImageTemplate("screenBK", my_target.screenBK); ShowTextTemplate("screenHeaderText", my_target.screenHeaderText); } my_target.showButton = EditorGUILayout.Foldout(my_target.showButton, "Button"); if (my_target.showButton) { ShowImageTemplate("buttonSprite", my_target.buttonSprite); ShowImageTemplate("buttonSpriteOff", my_target.buttonSpriteOff); ShowTextTemplate("buttonText", my_target.buttonText); ShowTextTemplate("buttonCountText", my_target.buttonCountText); } my_target.showOptionSoundElement = EditorGUILayout.Foldout(my_target.showOptionSoundElement, "Option Sound Element"); if (my_target.showOptionSoundElement) { ShowImageTemplate("optionSoundElementBK", my_target.optionSoundElementBK); ShowImageTemplate("optionSoundElementSliderBK", my_target.optionSoundElementSliderBK); ShowImageTemplate("optionSoundElementSliderFill", my_target.optionSoundElementSliderFill); ShowImageTemplate("optionSoundElementSliderHandle", my_target.optionSoundElementSliderHandle); ShowTextTemplate("optionSoundElementText", my_target.optionSoundElementText); } my_target.showInfoBar = EditorGUILayout.Foldout(my_target.showInfoBar, "InfoBar"); if (my_target.showInfoBar) { ShowImageTemplate("infoBarBK", my_target.infoBarBK); ShowImageTemplate("infoBarTimerBK", my_target.infoBarTimerBK); ShowTextTemplate("infoBarText", my_target.infoBarText); } my_target.showStageButton = EditorGUILayout.Foldout(my_target.showStageButton, "Stage Button"); if (my_target.showStageButton) { my_target.stageButtonOn = EditorGUILayout.ObjectField("stageButtonOn", my_target.stageButtonOn, typeof(Sprite), true) as Sprite; my_target.stageButtonOff = EditorGUILayout.ObjectField("stageButtonOff", my_target.stageButtonOff, typeof(Sprite), true) as Sprite; my_target.stageButtonNextStageToPlay = EditorGUILayout.ObjectField("stageButtonNextStageToPlay", my_target.stageButtonNextStageToPlay, typeof(Sprite), true) as Sprite; my_target.stageButtonTailDotOn = EditorGUILayout.ObjectField("stageButtonTailDotOn", my_target.stageButtonTailDotOn, typeof(Sprite), true) as Sprite; my_target.stageButtonTailDotOff = EditorGUILayout.ObjectField("stageButtonTailDotOff", my_target.stageButtonTailDotOff, typeof(Sprite), true) as Sprite; ShowTextTemplate("stageButtonNumber", my_target.stageButtonNumber); ShowTextTemplate("stageButtonStarCount", my_target.stageButtonStarCount); } my_target.showWorls = EditorGUILayout.Foldout(my_target.showWorls, "Worls"); if (my_target.showWorls) { my_target.totalWorlds = EditorGUILayout.IntField("Total Worlds", my_target.totalWorlds); EditorGUILayout.LabelField("-Total Worlds- MUST be the same number that the one in Home > manage_audio > Game_manager > Worlds > Total Worlds"); EditorGUILayout.Space(); if (my_target.worldBackgrounds.Length != my_target.worldButtonIcons.Length) { my_target.worldBackgrounds = new Sprite[1]; my_target.worldButtonIcons = new Sprite[1]; } if (my_target.worldButtonIcons.Length < my_target.totalWorlds || my_target.worldBackgrounds.Length < my_target.totalWorlds) { Sprite[] temp = new Sprite[my_target.worldButtonIcons.Length]; Sprite[] tempBK = new Sprite[my_target.worldBackgrounds.Length]; for (int i = 0; i < my_target.worldButtonIcons.Length; i++) { temp[i] = my_target.worldButtonIcons[i]; tempBK[i] = my_target.worldBackgrounds[i]; } my_target.worldButtonIcons = new Sprite[my_target.totalWorlds]; my_target.worldBackgrounds = new Sprite[my_target.totalWorlds]; for (int i = 0; i < temp.Length; i++) { my_target.worldButtonIcons[i] = temp[i]; my_target.worldBackgrounds[i] = temp[i]; } } else if (my_target.worldButtonIcons.Length > my_target.totalWorlds || my_target.worldBackgrounds.Length > my_target.totalWorlds) { Sprite[] temp = new Sprite[my_target.worldButtonIcons.Length]; Sprite[] tempBK = new Sprite[my_target.worldBackgrounds.Length]; for (int i = 0; i < temp.Length; i++) { temp[i] = my_target.worldButtonIcons[i]; tempBK[i] = my_target.worldBackgrounds[i]; } my_target.worldButtonIcons = new Sprite[my_target.totalWorlds]; my_target.worldBackgrounds = new Sprite[my_target.totalWorlds]; for (int i = 0; i < my_target.worldButtonIcons.Length; i++) { my_target.worldButtonIcons[i] = temp[i]; my_target.worldBackgrounds[i] = tempBK[i]; } } for (int i = 0; i < my_target.worldButtonIcons.Length; i++) { EditorGUILayout.LabelField("World " + i.ToString()); EditorGUI.indentLevel++; my_target.worldButtonIcons[i] = EditorGUILayout.ObjectField("Icon ", my_target.worldButtonIcons[i], typeof(Sprite), true) as Sprite; my_target.worldBackgrounds[i] = EditorGUILayout.ObjectField("BK ", my_target.worldBackgrounds[i], typeof(Sprite), true) as Sprite; EditorGUI.indentLevel--; } ShowTextTemplate("worldButtonName", my_target.worldButtonName); ShowTextTemplate("worldButtonNumber", my_target.worldButtonNumber); ShowTextTemplate("worldButtonStarsNeed", my_target.worldButtonStarsNeed); } my_target.showPageDot = EditorGUILayout.Foldout(my_target.showPageDot, "PageDot"); if (my_target.showPageDot) { ShowImageTemplate("pageDotON", my_target.pageDotON); ShowImageTemplate("pageDotOFF", my_target.pageDotOFF); } my_target.showScoreRecordScreenElement = EditorGUILayout.Foldout(my_target.showScoreRecordScreenElement, "showScoreRecordScreenElement"); if (my_target.showScoreRecordScreenElement) { ShowImageTemplate("scoreScreenElementBK", my_target.scoreScreenElementBK); ShowTextTemplate("scoreRank", my_target.scoreRank); ShowTextTemplate("scoreName", my_target.scoreName); ShowTextTemplate("scoreRecord", my_target.scoreRecord); } my_target.showStoreItem = EditorGUILayout.Foldout(my_target.showStoreItem, "showStoreItem"); if (my_target.showStoreItem) { my_target.storeItemBK = EditorGUILayout.ObjectField("storeItemBK", my_target.storeItemBK, typeof(Sprite), true) as Sprite; my_target.storeItemCanBuyIco = EditorGUILayout.ObjectField("storeItemCanBuyIco", my_target.storeItemCanBuyIco, typeof(Sprite), true) as Sprite; my_target.storeItemCantBuyIco = EditorGUILayout.ObjectField("storeItemCantBuyIco", my_target.storeItemCantBuyIco, typeof(Sprite), true) as Sprite; ShowTextTemplate("storeItemName", my_target.storeItemName); ShowTextTemplate("storeItemPrice", my_target.storeItemPrice); ShowTextTemplate("storeItemQuantity", my_target.storeItemQuantity); ShowTextTemplate("storeItemBuyText", my_target.storeItemBuyText); } my_target.showProfileItem = EditorGUILayout.Foldout(my_target.showProfileItem, "showProfileItem"); if (my_target.showProfileItem) { my_target.profileItemOn = EditorGUILayout.ObjectField("profileItemOn", my_target.profileItemOn, typeof(Sprite), true) as Sprite; my_target.profileItemOff = EditorGUILayout.ObjectField("profileItemOff", my_target.profileItemOff, typeof(Sprite), true) as Sprite; my_target.profileItemSelected = EditorGUILayout.ObjectField("profileItemSelected", my_target.profileItemSelected, typeof(Sprite), true) as Sprite; ShowTextTemplate("profileItemName", my_target.profileItemName); ShowTextTemplate("profileItemNumber", my_target.profileItemNumber); ShowTextTemplate("profileItemCount", my_target.profileItemCount); ShowTextTemplate("profileItemProgress", my_target.profileItemProgress); } my_target.showGameScene = EditorGUILayout.Foldout(my_target.showGameScene, "showGameScene"); if (my_target.showGameScene) { EditorGUILayout.LabelField("starScoreProgressBar:"); EditorGUI.indentLevel++; ShowImageTemplate("BK", my_target.starScoreProgressBarBK); ShowImageTemplate("Fill", my_target.starScoreProgressBarFill); EditorGUI.indentLevel--; EditorGUILayout.LabelField("End screens emoticos:"); EditorGUI.indentLevel++; for (int i = 0; i < Enum.GetNames(typeof(UI_Skin.EndScreenEmotion)).Length; i++) my_target.endScreenEmotions[i] = EditorGUILayout.ObjectField(Enum.GetName(typeof(UI_Skin.EndScreenEmotion), i), my_target.endScreenEmotions[i], typeof(Sprite), true) as Sprite; EditorGUI.indentLevel--; ShowImageTemplate("winScreenBK", my_target.winScreenBK); ShowImageTemplate("loseScreenBK", my_target.loseScreenBK); EditorGUILayout.LabelField("bigStar:"); EditorGUI.indentLevel++; my_target.bigStarOn = EditorGUILayout.ObjectField("On", my_target.bigStarOn, typeof(Sprite), true) as Sprite; my_target.bigStarOff = EditorGUILayout.ObjectField("Off", my_target.bigStarOff, typeof(Sprite), true) as Sprite; EditorGUI.indentLevel--; } if (EditorGUI.EndChangeCheck()) EditorUtility.SetDirty(my_target); }
private bool DrawTypedPropertyInput(string label, SerializedProperty objProperty, Type type) { SerializedProperty objectValue = null; if (type == typeof(int)) { objectValue = objProperty.FindPropertyRelative("intValue"); objectValue.intValue = EditorGUILayout.IntField(new GUIContent(label), objectValue.intValue); return(true); } else if (type == typeof(bool)) { objectValue = objProperty.FindPropertyRelative("boolValue"); objectValue.boolValue = EditorGUILayout.Toggle(new GUIContent(label), objectValue.boolValue); return(true); } else if (type == typeof(float)) { objectValue = objProperty.FindPropertyRelative("floatValue"); objectValue.floatValue = EditorGUILayout.FloatField(new GUIContent(label), objectValue.floatValue); return(true); } else if (type == typeof(string)) { objectValue = objProperty.FindPropertyRelative("stringValue"); objectValue.stringValue = EditorGUILayout.TextField(new GUIContent(label), objectValue.stringValue); return(true); } else if (type == typeof(Color)) { objectValue = objProperty.FindPropertyRelative("colorValue"); objectValue.colorValue = EditorGUILayout.ColorField(new GUIContent(label), objectValue.colorValue); return(true); } else if (type == typeof(UnityEngine.GameObject)) { objectValue = objProperty.FindPropertyRelative("gameObjectValue"); objectValue.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent(label), objectValue.objectReferenceValue, typeof(UnityEngine.GameObject), true); return(true); } else if (type == typeof(UnityEngine.Material)) { objectValue = objProperty.FindPropertyRelative("materialValue"); objectValue.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent(label), objectValue.objectReferenceValue, typeof(UnityEngine.Material), true); return(true); } else if (type == typeof(UnityEngine.Sprite)) { objectValue = objProperty.FindPropertyRelative("spriteValue"); objectValue.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent(label), objectValue.objectReferenceValue, typeof(UnityEngine.Sprite), true); return(true); } else if (type == typeof(UnityEngine.Texture)) { objectValue = objProperty.FindPropertyRelative("textureValue"); objectValue.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent(label), objectValue.objectReferenceValue, typeof(UnityEngine.Texture), true); return(true); } else if (type == typeof(UnityEngine.Vector2)) { objectValue = objProperty.FindPropertyRelative("vector2Value"); objectValue.vector2Value = EditorGUILayout.Vector2Field(new GUIContent(label), objectValue.vector2Value); return(true); } else if (type == typeof(UnityEngine.Vector3)) { objectValue = objProperty.FindPropertyRelative("vector3Value"); objectValue.vector3Value = EditorGUILayout.Vector3Field(new GUIContent(label), objectValue.vector3Value); return(true); } else if (type.IsSubclassOf(typeof(UnityEngine.Object))) { objectValue = objProperty.FindPropertyRelative("objectValue"); objectValue.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent(label), objectValue.objectReferenceValue, type, true); return(true); } else if (type.IsEnum) { var enumNames = Enum.GetNames(type); objectValue = objProperty.FindPropertyRelative("intValue"); objectValue.intValue = EditorGUILayout.Popup(label, objectValue.intValue, enumNames); return(true); } return(false); }
public override void OnInspectorGUI() { if (_compass == null) { return; } _compass.isDirty = false; if (sectionHeaderStyle == null) { sectionHeaderStyle = new GUIStyle(EditorStyles.foldout); sectionHeaderStyle.SetFoldoutColor(); sectionHeaderStyle.fontStyle = FontStyle.Bold; } EditorGUILayout.Separator(); GUI.skin.label.alignment = TextAnchor.MiddleCenter; GUILayout.Label(_headerTexture, GUILayout.ExpandWidth(true)); GUI.skin.label.alignment = TextAnchor.MiddleLeft; EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); expandCompassBarSettings = DrawTitleLabel(expandCompassBarSettings, "Compass Bar Settings"); if (GUILayout.Button("Help", GUILayout.Width(50))) { EditorUtility.DisplayDialog("Help", "Move the mouse over each label to show a description of the parameter.", "Ok"); } if (GUILayout.Button("About", GUILayout.Width(60))) { CompassProAbout.ShowAboutWindow(); } EditorGUILayout.EndHorizontal(); if (expandCompassBarSettings) { _compass.cameraMain = (Camera)EditorGUILayout.ObjectField(new GUIContent("Camera", "Camera used for distance computation."), _compass.cameraMain, typeof(Camera), true); _compass.style = (COMPASS_STYLE)EditorGUILayout.EnumPopup(new GUIContent("Style", "Compass bar style."), _compass.style); _compass.verticalPosition = EditorGUILayout.Slider(new GUIContent("Vertical Position", "Distance from the bottom of the screen in %."), _compass.verticalPosition, -0.2f, 1.2f); EditorGUILayout.BeginHorizontal(); _compass.bendFactor = EditorGUILayout.Slider(new GUIContent("Bend Amount", "Bending amount. Set this to zero to disable bending effect."), _compass.bendFactor, -1f, 1f); if (GUILayout.Button("Disable", GUILayout.Width(80))) { _compass.bendFactor = 0; } EditorGUILayout.EndHorizontal(); _compass.width = EditorGUILayout.Slider(new GUIContent("Width", "Width of the compass bar in % of the screen width."), _compass.width, 0.05f, 1f); _compass.endCapsWidth = EditorGUILayout.Slider(new GUIContent("End Caps Width", "Width of the end caps of the compass bar. This setting limits the usable horizontal range of the bar in the screen to prevent icons being drawn over the art of the end caps of the bar."), _compass.endCapsWidth, 0, 100f); _compass.edgeFadeOut = EditorGUILayout.Toggle(new GUIContent("Edge Fade Out", "Enables edge fade out effect."), _compass.edgeFadeOut); if (_compass.edgeFadeOut) { EditorGUI.indentLevel++;; _compass.edgeFadeOutWidth = EditorGUILayout.Slider(new GUIContent("Width", "Width of the edge fade out."), _compass.edgeFadeOutWidth, 0f, 1f); _compass.edgeFadeOutStart = EditorGUILayout.Slider(new GUIContent("Start", "Start of the edge fade out."), _compass.edgeFadeOutStart, 0f, 1f); _compass.edgeFadeOutText = EditorGUILayout.Toggle(new GUIContent("Fade Out Text", "If edge fade out affects title and text below compass bar."), _compass.edgeFadeOutText); EditorGUI.indentLevel--; } _compass.alpha = EditorGUILayout.Slider(new GUIContent("Alpha", "Transparency of the compass bar."), _compass.alpha, 0f, 1f); _compass.alwaysVisibleInEditMode = EditorGUILayout.Toggle(new GUIContent(" Visible In Edit Mode", "Makes the bar always visible (ignored alpha property) while in Edit Mode."), _compass.alwaysVisibleInEditMode); _compass.autoHide = EditorGUILayout.Toggle(new GUIContent("Auto Hide If Empty", "Hides the compass bar if no POIs are below visible distance."), _compass.autoHide); _compass.fadeDuration = EditorGUILayout.Slider(new GUIContent("Fade Duration", "Duration of alpha changes in seconds."), _compass.fadeDuration, 0f, 8f); _compass.worldMappingMode = (WORLD_MAPPING_MODE)EditorGUILayout.EnumPopup(new GUIContent("World Mapping Mode", "How POIs positions are mapped to the bar. 1) Limited To Bar Width = the bar width determines the view angle, 2) Camera Frustum = the entire camera frustum is mapped to the bar width, 3) Full 180 degrees = all POIs in front of the camera will appear in the compass bar. 4) Full 360 degrees = all POIs are visible in the compass bar."), _compass.worldMappingMode); _compass.use3Ddistance = EditorGUILayout.Toggle(new GUIContent("Use 3D Distance", "Whether 3D distance should be computed instead of planar X/Z distance"), _compass.use3Ddistance); _compass.sameAltitudeThreshold = EditorGUILayout.Slider(new GUIContent("Same Altitude Diff.", "Minimum difference in altitude from camera to show 'above' or 'below'"), _compass.sameAltitudeThreshold, 1f, 50f); _compass.northDegrees = EditorGUILayout.Slider(new GUIContent("North Position", "The position of the North in degrees (0-360)"), _compass.northDegrees, 0, 360f); _compass.showCardinalPoints = EditorGUILayout.Toggle(new GUIContent("Show Cardinal Points", "Whether N, W, S, E should be visible in the compass bar."), _compass.showCardinalPoints); _compass.showOrdinalPoints = EditorGUILayout.Toggle(new GUIContent("Show Ordinal Points", "Whether NW, NE, SW, SE should be visible in the compass bar."), _compass.showOrdinalPoints); if (_compass.showCardinalPoints || _compass.showOrdinalPoints) { _compass.cardinalPointsVerticalOffset = EditorGUILayout.FloatField(new GUIContent(" Vertical Offset", "Optional vertical displacement for both cardinal and ordinal points."), _compass.cardinalPointsVerticalOffset); } _compass.showHalfWinds = EditorGUILayout.Toggle(new GUIContent("Show Half Winds", "Enable vertical interval marks in the compass bar."), _compass.showHalfWinds); if (_compass.showHalfWinds) { _compass.halfWindsHeight = EditorGUILayout.Slider(" Height", _compass.halfWindsHeight, 0.1f, 1f); _compass.halfWindsWidth = EditorGUILayout.Slider(" Width", _compass.halfWindsWidth, 1f, 5f); _compass.halfWindsTintColor = EditorGUILayout.ColorField(" Tint Color", _compass.halfWindsTintColor); } _compass.showDistance = EditorGUILayout.Toggle(new GUIContent("Show Distance (meters)", "Whether the distance in meters should be shown in the title."), _compass.showDistance); if (_compass.showDistance) { _compass.showDistanceFormat = EditorGUILayout.TextField(new GUIContent(" String Format", " The string format for displaying the distance. A value of F0 means 'Fixed/Decimal with 0 decimal positions'. A value of F1 includes 1 decimal position. The sintax for this string format corresponds with the available options for ToString(format) method of C#."), _compass.showDistanceFormat); } _compass.dontDestroyOnLoad = EditorGUILayout.Toggle(new GUIContent("Don't Destroy On Load", "Preserve compass bar between scene changes."), _compass.dontDestroyOnLoad); _compass.updateInterval = (UPDATE_INTERVAL)EditorGUILayout.EnumPopup(new GUIContent("Idle Update Mode", "Contents are always updated if camera moves or rotates. If not, this property specifies the intervel between POI change checks."), _compass.updateInterval); if (_compass.updateInterval == UPDATE_INTERVAL.NumberOfFrames) { _compass.updateIntervalFrameCount = EditorGUILayout.IntField(new GUIContent(" Frame Count", "Frames between change check."), _compass.updateIntervalFrameCount); } else if (_compass.updateInterval == UPDATE_INTERVAL.Time) { _compass.updateIntervalTime = EditorGUILayout.FloatField(new GUIContent(" Seconds", "Seconds between change check."), _compass.updateIntervalTime); } } EditorGUILayout.EndVertical(); EditorGUILayout.Separator(); EditorGUILayout.BeginVertical(); expandCompassPOISettings = DrawTitleLabel(expandCompassPOISettings, "Compass POIs Settings"); if (expandCompassPOISettings) { _compass.visibleDistance = EditorGUILayout.FloatField(new GUIContent("Visible Max Distance", "POIs beyond visible distance (meters) will not be shown in the compass bar."), _compass.visibleDistance); _compass.visibleMinDistance = EditorGUILayout.FloatField(new GUIContent("Visible Min Distance", "POIs nearer than this distance (meters) will not be shown in the compass bar."), _compass.visibleMinDistance); _compass.nearDistance = EditorGUILayout.Slider(new GUIContent("Near Distance", "Distance to a POI where the icon will start to grow as player approaches."), _compass.nearDistance, 10, 10000); _compass.visitedDistance = EditorGUILayout.Slider(new GUIContent("Visited Distance", "Minimum distance to a POI to be considered as explored/visited."), _compass.visitedDistance, 1, 10000); EditorGUILayout.BeginHorizontal(); float minIconSize = _compass.minIconSize; float maxIconSize = _compass.maxIconSize; EditorGUILayout.MinMaxSlider(new GUIContent("Icon Size Range", "Minimum and maximum icon sizes. Icons grow/shrink depending on distance."), ref minIconSize, ref maxIconSize, 0.1f, 2f); _compass.minIconSize = minIconSize; _compass.maxIconSize = maxIconSize; GUILayout.Label(minIconSize.ToString("F2") + "-" + maxIconSize.ToString("F2")); EditorGUILayout.EndHorizontal(); _compass.scaleInDuration = EditorGUILayout.Slider(new GUIContent("Scale In Duration", "Duration for the scale animation when the POI appears on the compass bar."), _compass.scaleInDuration, 0, 5); _compass.labelHotZone = EditorGUILayout.Slider(new GUIContent("Label Hot Zone", "The distance from the center of the compass bar where a POI's label is visible."), _compass.labelHotZone, 0.001f, 0.2f); _compass.gizmoScale = EditorGUILayout.Slider(new GUIContent("Gizmo Scale", "Scaling applied to gizmos shown during playmode."), _compass.gizmoScale, 0.01f, 1f); _compass.visitedDefaultAudioClip = (AudioClip)EditorGUILayout.ObjectField(new GUIContent("Visited Sound", "Default audio clip to be played when a POI is visited for the first time. Note that you can specify a different audio clip in the POI script itself."), _compass.visitedDefaultAudioClip, typeof(AudioClip), false); _compass.beaconDefaultAudioClip = (AudioClip)EditorGUILayout.ObjectField(new GUIContent("Beacon Sound", "Default audio clip to be played when a POI beacon is shown. Note that you can specify a different audio clip in the POI script itself."), _compass.beaconDefaultAudioClip, typeof(AudioClip), false); _compass.heartbeatDefaultAudioClip = (AudioClip)EditorGUILayout.ObjectField(new GUIContent("Heartbeat Sound", "Default audio clip to play for the heartbeat effect. This effect is enabled on each POI and will play a custom sound with variable speed depending on distance."), _compass.heartbeatDefaultAudioClip, typeof(AudioClip), false); } EditorGUILayout.EndVertical(); EditorGUILayout.Separator(); EditorGUILayout.BeginVertical(); expandTitleSettings = DrawTitleLabel(expandTitleSettings, "Title Settings"); if (expandTitleSettings) { _compass.titleFont = (Font)EditorGUILayout.ObjectField(new GUIContent("Font", "Font for the title."), _compass.titleFont, typeof(Font), false); _compass.titleVerticalPosition = EditorGUILayout.Slider(new GUIContent("Vertical Offset", "Vertical offset in pixels for the title with respect to the compass bar."), _compass.titleVerticalPosition, -200, 200); _compass.titleScale = EditorGUILayout.Slider(new GUIContent("Scale", "Scaling applied to the title."), _compass.titleScale, 0.02f, 3); _compass.titleShadowEnabled = EditorGUILayout.Toggle(new GUIContent("Text Shadow", "Enable or disable text shadow."), _compass.titleShadowEnabled); } EditorGUILayout.EndVertical(); EditorGUILayout.Separator(); EditorGUILayout.BeginVertical(); expandTextSettings = DrawTitleLabel(expandTextSettings, "Text Settings"); if (expandTextSettings) { _compass.textRevealEnabled = EditorGUILayout.Toggle(new GUIContent("Enable", "Show a revealing text effect when discovering POIs for the first time."), _compass.textRevealEnabled); _compass.textFont = (Font)EditorGUILayout.ObjectField(new GUIContent("Font", "Font for the text."), _compass.textFont, typeof(Font), false); _compass.textVerticalPosition = EditorGUILayout.Slider(new GUIContent("Vertical Offset", "Vertical offset in pixels for the text with respect to the compass bar."), _compass.textVerticalPosition, -200, 200); _compass.textScale = EditorGUILayout.Slider(new GUIContent("Scale", "Scaling applied to the text."), _compass.textScale, 0.02f, 3); _compass.textRevealDuration = EditorGUILayout.Slider(new GUIContent("Reveal Duration", "Text reveal duration in seconds."), _compass.textRevealDuration, 0, 3); _compass.letterSpacing = EditorGUILayout.Slider(new GUIContent("Letter Spacing", "Controls the spacing between each letter in the reveal text."), _compass.letterSpacing, 0.02f, 3); _compass.textRevealLetterDelay = EditorGUILayout.Slider(new GUIContent("Letter Delay", "Delay in appearance of each letter during a text reveal."), _compass.textRevealLetterDelay, 0, 1); _compass.textDuration = EditorGUILayout.Slider(new GUIContent("Duration", "Text duration in screen."), _compass.textDuration, 0, 20); _compass.textFadeOutDuration = EditorGUILayout.Slider(new GUIContent("Fade Out Duration", "Duration of the text fade out."), _compass.textFadeOutDuration, 0, 10); _compass.textShadowEnabled = EditorGUILayout.Toggle(new GUIContent("Text Shadow", "Enable or disable text shadow."), _compass.textShadowEnabled); } EditorGUILayout.EndVertical(); EditorGUILayout.Separator(); EditorGUILayout.BeginVertical(); expandMiniMapSettings = DrawTitleLabel(expandMiniMapSettings, "Mini-Map Settings"); if (expandMiniMapSettings) { _compass.showMiniMap = EditorGUILayout.Toggle(new GUIContent("Enable", "Shows the minimap."), _compass.showMiniMap); _compass.miniMapFollow = (Transform)EditorGUILayout.ObjectField(new GUIContent("Follow", "Center of the mini map."), _compass.miniMapFollow, typeof(Transform), true); _compass.miniMapKeepStraight = EditorGUILayout.Toggle(new GUIContent("Keep Straight", "Keeps the mini-map oriented to North."), _compass.miniMapKeepStraight); _compass.miniMapCameraMode = (MINIMAP_CAMERA_MODE)EditorGUILayout.EnumPopup(new GUIContent("Camera Projection", "Orthographic or perspective mode for the mini-map camera."), _compass.miniMapCameraMode); if (_compass.miniMapCameraMode == MINIMAP_CAMERA_MODE.Orthographic) { _compass.miniMapCameraHeightVSFollow = EditorGUILayout.FloatField(new GUIContent("Height vs Follow", "The altitude of the mini-map camera relative to the main camera or followed gameobject."), _compass.miniMapCameraHeightVSFollow); _compass.miniMapCaptureSize = EditorGUILayout.FloatField(new GUIContent("Captured World Size", "The orthographic size of the mini-map camera."), _compass.miniMapCaptureSize); _compass.miniMapCameraSnapshotFrequency = (MINIMAP_CAMERA_SNAPSHOT_FREQUENCY)EditorGUILayout.EnumPopup(new GUIContent("Snapshot Frequency", "Frequency of camera capture."), _compass.miniMapCameraSnapshotFrequency); if (_compass.miniMapCameraSnapshotFrequency != MINIMAP_CAMERA_SNAPSHOT_FREQUENCY.Continuous) { EditorGUILayout.BeginHorizontal(); switch (_compass.miniMapCameraSnapshotFrequency) { case MINIMAP_CAMERA_SNAPSHOT_FREQUENCY.TimeInterval: _compass.miniMapSnapshotInterval = EditorGUILayout.FloatField(new GUIContent(" Time Interval (s)", "Frequency of camera capture in seconds."), _compass.miniMapSnapshotInterval); break; case MINIMAP_CAMERA_SNAPSHOT_FREQUENCY.DistanceTravelled: _compass.miniMapSnapshotDistance = EditorGUILayout.FloatField(new GUIContent(" Distance (m)", "Distance in meters."), _compass.miniMapSnapshotDistance); break; } if (GUILayout.Button("Now!", GUILayout.Width(60))) { _compass.UpdateMiniMapContents(); } EditorGUILayout.EndHorizontal(); } _compass.miniMapZoomMin = EditorGUILayout.Slider("Zoom Min", _compass.miniMapZoomMin, 0f, 1f); _compass.miniMapZoomMax = EditorGUILayout.Slider("Zoom Max", _compass.miniMapZoomMax, 0f, 1f); } else { _compass.miniMapCameraMinAltitude = EditorGUILayout.FloatField(new GUIContent("Altitude Min", "The minimum altitude of the mini-map camera respect with the follow target."), _compass.miniMapCameraMinAltitude); _compass.miniMapCameraMaxAltitude = EditorGUILayout.FloatField(new GUIContent("Altitude Max", "The maximum altitude of the mini-map camera respect with the follow target."), _compass.miniMapCameraMaxAltitude); } _compass.miniMapZoomLevel = EditorGUILayout.Slider(new GUIContent("Current Zoom", "The current zoom for the mini-map based on the minimum / maximum ranges."), _compass.miniMapZoomLevel, 0, 1f); if (_compass.miniMapCameraMode == MINIMAP_CAMERA_MODE.Perspective) { _compass.miniMapCameraTilt = EditorGUILayout.Slider(new GUIContent("Camera Tilt", "Rotation of the mini-map camera."), _compass.miniMapCameraTilt, 0, 90); } _compass.miniMapLayerMask = LayerMaskField(new GUIContent("Layer Mask", "Which objects will be visible in the mini-map."), _compass.miniMapLayerMask); _compass.miniMapEnableShadows = EditorGUILayout.Toggle(new GUIContent("Render Shadows", "Enable to render shadows in mini-map."), _compass.miniMapEnableShadows); _compass.miniMapShowButtons = EditorGUILayout.Toggle(new GUIContent("Show Buttons", "Show zoom in/out/max buttons."), _compass.miniMapShowButtons); if (_compass.miniMapShowButtons) { _compass.miniMapButtonsScale = EditorGUILayout.Slider(new GUIContent(" Buttons Scale"), _compass.miniMapButtonsScale, 0.01f, 2f); } _compass.miniMapStyle = (MINIMAP_STYLE)EditorGUILayout.EnumPopup(new GUIContent("Style", "Mini-map style."), _compass.miniMapStyle); _compass.miniMapLocation = (MINIMAP_LOCATION)EditorGUILayout.EnumPopup(new GUIContent("Screen Location", "Location of mini-map."), _compass.miniMapLocation); if (_compass.miniMapLocation != MINIMAP_LOCATION.Custom) { _compass.miniMapLocationOffset = EditorGUILayout.Vector2Field(new GUIContent(" Offset", "Location of mini-map."), _compass.miniMapLocationOffset); } if (_compass.miniMapStyle == MINIMAP_STYLE.Custom) { _compass.miniMapBorderTexture = (Texture2D)EditorGUILayout.ObjectField(new GUIContent("Border Texture", "Texture for the border of the mini map."), _compass.miniMapBorderTexture, typeof(Texture2D), false); _compass.miniMapMaskSprite = (Sprite)EditorGUILayout.ObjectField(new GUIContent("Mask Texture", "Mask for the border of the mini map."), _compass.miniMapMaskSprite, typeof(Sprite), false); } _compass.miniMapSize = EditorGUILayout.Slider(new GUIContent("Normal Size", "Screen size of mini-map in % of screen height."), _compass.miniMapSize, 0f, 1f); _compass.miniMapResolutionNormalSize = EditorGUILayout.IntField(new GUIContent("Map Resolution", "Size of the render texture in non-full screen mode."), _compass.miniMapResolutionNormalSize); _compass.miniMapFullScreenSize = EditorGUILayout.Slider(new GUIContent("Full Screen Size", "Percentage of screen size if full-screen mode. Image resolution will increase according to screen resolution."), _compass.miniMapFullScreenSize, 0.5f, 1f); _compass.miniMapFullScreenPlaceholder = (RectTransform)EditorGUILayout.ObjectField(new GUIContent(" UI Placeholder", "Optional UI element which serves as placeholder for exact positioning of the mini-map in fullscreen mode."), _compass.miniMapFullScreenPlaceholder, typeof(RectTransform), true); GUI.enabled = _compass.miniMapFullScreenPlaceholder == null; _compass.miniMapKeepAspectRatio = EditorGUILayout.Toggle(new GUIContent(" Keep Aspect Ratio", "Keep aspect ration in full screen mode."), _compass.miniMapKeepAspectRatio); _compass.miniMapFullScreenWorldCenterFollows = EditorGUILayout.Toggle(new GUIContent(" Center On Followed", "Forces center of the world map to be the same position of the followed object."), _compass.miniMapFullScreenWorldCenterFollows); GUI.enabled = !_compass.miniMapFullScreenWorldCenterFollows; _compass.miniMapFullScreenWorldCenter = EditorGUILayout.Vector3Field(new GUIContent(" World Center", "Center of the world map."), _compass.miniMapFullScreenWorldCenter); GUI.enabled = true; _compass.miniMapFullScreenWorldSize = EditorGUILayout.Vector3Field(new GUIContent(" World Size", "Size of the world map."), _compass.miniMapFullScreenWorldSize); _compass.miniMapFullScreenFreezeCamera = EditorGUILayout.Toggle(new GUIContent(" Freeze Camera Rotation", "Prevents camera rotation while in full screen mode."), _compass.miniMapFullScreenFreezeCamera); _compass.miniMapStyleFullScreenMode = (MINIMAP_STYLE)EditorGUILayout.EnumPopup(new GUIContent(" Full Screen Style", "Mini-map style."), _compass.miniMapStyleFullScreenMode); if (_compass.miniMapStyleFullScreenMode == MINIMAP_STYLE.Custom) { _compass.miniMapBorderTextureFullScreenMode = (Texture2D)EditorGUILayout.ObjectField(new GUIContent(" Border Texture", "Texture for the border of the mini map in full screen mode."), _compass.miniMapBorderTextureFullScreenMode, typeof(Texture2D), false); _compass.miniMapMaskSpriteFullScreenMode = (Sprite)EditorGUILayout.ObjectField(new GUIContent(" Mask Texture", "Mask for the border of the mini map in full screen mode."), _compass.miniMapMaskSpriteFullScreenMode, typeof(Sprite), false); } _compass.miniMapStyleFullScreenContents = (MINIMAP_CONTENTS)EditorGUILayout.EnumPopup(new GUIContent(" Contents", "What to show when minimap is in full screen mode."), _compass.miniMapStyleFullScreenContents); if (_compass.miniMapStyleFullScreenContents == MINIMAP_CONTENTS.Texture) { _compass.miniMapStyleFullScreenContentsTexture = (Texture)EditorGUILayout.ObjectField(new GUIContent(" Texture", "The texture to be used as background for the minimap in full screen mode."), _compass.miniMapStyleFullScreenContentsTexture, typeof(Texture), false); if (_compass.miniMapCamera != null && !_compass.miniMapCamera.orthographic) { EditorGUILayout.HelpBox("Feature only available with mini camera set to orthographic mode.", MessageType.Warning); } } _compass.miniMapAlpha = EditorGUILayout.Slider(new GUIContent("Alpha", "Transparency of the mini-map."), _compass.miniMapAlpha, 0f, 1f); _compass.miniMapContrast = EditorGUILayout.Slider(new GUIContent("Contrast"), _compass.miniMapContrast, 0f, 2f); _compass.miniMapBrightness = EditorGUILayout.Slider(new GUIContent("Brightness"), _compass.miniMapBrightness, 0f, 2f); EditorGUILayout.Separator(); _compass.miniMapIconSize = EditorGUILayout.FloatField(new GUIContent("Icons Size", "The size for the icons on the mini-map."), _compass.miniMapIconSize); _compass.miniMapPlayerIconSize = EditorGUILayout.FloatField(new GUIContent("Player Icon Size", "The size for the player icon on the mini-map."), _compass.miniMapPlayerIconSize); EditorGUI.indentLevel++; _compass.miniMapPlayerIconSprite = (Sprite)EditorGUILayout.ObjectField(new GUIContent("Sprite", "The sprite for the player icon."), _compass.miniMapPlayerIconSprite, typeof(Sprite), false); _compass.miniMapPlayerIconColor = EditorGUILayout.ColorField(new GUIContent("Color", "The color for the player icon."), _compass.miniMapPlayerIconColor); EditorGUI.indentLevel--; _compass.miniMapClampBorder = EditorGUILayout.FloatField(new GUIContent("Clamp Border", "The distance of clamped icons to the edge of the mini-map."), _compass.miniMapClampBorder); _compass.miniMapClampBorderCircular = EditorGUILayout.Toggle(new GUIContent("Border Is Circular", "Enable this option if the minimap uses a circular shape."), _compass.miniMapClampBorderCircular); _compass.miniMapIconEvents = EditorGUILayout.Toggle(new GUIContent("Icon Events", "Raise pointer click, down, up, enter and exit events on icons."), _compass.miniMapIconEvents); } EditorGUILayout.EndVertical(); EditorGUILayout.Separator(); GUI.enabled = _compass.showMiniMap; EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); expandFogOfWarSettings = DrawTitleLabel(expandFogOfWarSettings, "Mini-Map Fog Of War Settings"); if (GUILayout.Button("Help", GUILayout.Width(50))) { EditorUtility.DisplayDialog("Mini-Map Fog Of War", "This feature renders animated fog on top of the mini-map. To clear certain areas from fog, select option menu GameObject -> Create Other -> Compass Navigator Pro -> Mini-Map Fog of War Volume.\n\nReposition/scale fog volumes anywhere on the map.\n\nYou can also use scripting to control fog of war opacity at any position. Please check the documentation for details.", "Ok"); } EditorGUILayout.EndHorizontal(); if (expandFogOfWarSettings) { EditorGUILayout.BeginHorizontal(); _compass.fogOfWarEnabled = EditorGUILayout.Toggle(new GUIContent("Enable", "Enables fog of war."), _compass.fogOfWarEnabled); if (_compass.fogOfWarEnabled) { if (GUILayout.Button("Fit to Active Terrain")) { FitFogOfWarLayerToActiveTerrain(); } if (GUILayout.Button("Redraw")) { _compass.UpdateFogOfWar(); } } EditorGUILayout.EndHorizontal(); if (_compass.fogOfWarEnabled && _compass.miniMapCameraMode != MINIMAP_CAMERA_MODE.Orthographic) { EditorGUILayout.HelpBox("Fog of war requires mini-map in orthographic mode.", MessageType.Warning); } _compass.fogOfWarCenter = EditorGUILayout.Vector3Field(new GUIContent("Center", "Center of the fog of war layer (only X/Z coordinates are used)"), _compass.fogOfWarCenter); _compass.fogOfWarSize = EditorGUILayout.Vector3Field(new GUIContent("Size", "Size of the fog of war layer (only X/Z coordinates are used)"), _compass.fogOfWarSize); _compass.fogOfWarTextureSize = EditorGUILayout.IntField(new GUIContent("Resolution", "Resolution for the fog of war texture effect."), _compass.fogOfWarTextureSize); _compass.fogOfWarDefaultAlpha = EditorGUILayout.Slider(new GUIContent("Default Opacity", "Default alpha value of fog of war in the scene."), _compass.fogOfWarDefaultAlpha, 0f, 1f); _compass.fogOfWarColor = EditorGUILayout.ColorField(new GUIContent("Fog Color", "Tint color."), _compass.fogOfWarColor); _compass.fogOfWarAutoClear = EditorGUILayout.Toggle(new GUIContent("Auto Clear", "Clears fog automatically as player crosses it."), _compass.fogOfWarAutoClear); if (_compass.fogOfWarAutoClear) { _compass.fogOfWarAutoClearRadius = EditorGUILayout.FloatField(" Clear Radius", _compass.fogOfWarAutoClearRadius); } } EditorGUILayout.EndVertical(); EditorGUILayout.Separator(); GUI.enabled = true; if (_compass.isDirty) { EditorUtility.SetDirty(target); if (!Application.isPlaying) { UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene()); } } }
static bool NoiseEditor(NoiseMaterial n, bool colored = true, int index = 0) { EditorGUILayout.BeginVertical("Box", GUILayout.MaxWidth(550)); EditorGUILayout.BeginHorizontal(); n.name = EditorGUILayout.TextField("Name:", n.name); if (GUILayout.Button("Remove")) { return(true); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (colored) { EditorGUILayout.BeginVertical("Box"); n.upColor = EditorGUILayout.ColorField(n.upColor); n.downColor = EditorGUILayout.ColorField(n.downColor); EditorGUILayout.EndVertical(); } n.noise.m_frequency = EditorGUILayout.Slider("Frequency:", n.noise.m_frequency, 0, 100); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); n.strength = EditorGUILayout.Slider("Strength:", n.strength, 0, 100); n.pureStrength = EditorGUILayout.Slider("Pure Strength:", n.pureStrength, 0, 100); n.exageration = EditorGUILayout.Slider("Exageration:", n.exageration, 0, 100); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); n.invert = EditorGUILayout.Toggle("Invert:", n.invert); n.rotation = EditorGUILayout.Slider("Rotation:", n.rotation, 0, 360); n.scale = EditorGUILayout.Vector2Field("Scale:", n.scale); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); n.noise.m_noiseType = (FastNoise.NoiseType)EditorGUILayout.EnumPopup("Type:", n.noise.m_noiseType); n.noise.m_interp = (FastNoise.Interp)EditorGUILayout.EnumPopup("Interpolation:", n.noise.m_interp); if (n.noise.m_noiseType == FastNoise.NoiseType.Linear) { n.noise.m_linearType = (FastNoise.LinearType)EditorGUILayout.EnumPopup("Linear Type:", n.noise.m_linearType); } if (n.noise.IsFractal()) { EditorGUILayout.BeginVertical("Box"); n.noise.m_fractalType = (FastNoise.FractalType)EditorGUILayout.EnumPopup("Type:", n.noise.m_fractalType); n.noise.SetFractalGain(EditorGUILayout.FloatField("Gain", n.noise.m_gain)); n.noise.SetFractalLacunarity(EditorGUILayout.FloatField("Lacunarity", n.noise.m_lacunarity)); n.noise.SetFractalOctaves(EditorGUILayout.IntField("Octave", n.noise.m_octaves)); EditorGUILayout.EndVertical(); } if (n.noise.m_noiseType == FastNoise.NoiseType.Cellular) { CellularParameter(n.noise); } EditorGUILayout.EndVertical(); n.noise.m_seed = EditorGUILayout.IntField("Seed:", n.noise.m_seed); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); return(false); }
public static void DrawField(this Material m, string n, ref Color v, string title) { DrawHelp(n); v = EditorGUILayout.ColorField(title, v); }
} // BuildEventsInspectorGUI private void BuildPreviewInspectorGUI() { PlayMakerArrayListProxy proxy = (PlayMakerArrayListProxy)target; if (proxy.arrayList == null) { return; } int count = proxy.arrayList.Count; BuildPreviewInspectorHeaderGUI(count); if (!proxy.showContent) { return; } if (proxy.arrayList != null) { int start = proxy.contentPreviewStartIndex; int last = Mathf.Min(count, proxy.contentPreviewStartIndex + proxy.contentPreviewMaxRows); string label; for (int i = start; i < last; i++) { label = "Item " + i; EditorGUILayout.BeginHorizontal(); if (proxy.arrayList[i] != null) { if (proxy.arrayList[i].GetType() == typeof(bool)) { proxy.arrayList[i] = (bool)EditorGUILayout.Toggle(label, (bool)proxy.arrayList[i]); } else if (proxy.arrayList[i].GetType() == typeof(Color)) { proxy.arrayList[i] = (Color)EditorGUILayout.ColorField(label, (Color)proxy.arrayList[i]); } else if (proxy.arrayList[i].GetType() == typeof(float)) { proxy.arrayList[i] = (float)EditorGUILayout.FloatField(label, (float)proxy.arrayList[i]); } else if (proxy.arrayList[i].GetType() == typeof(GameObject)) { proxy.arrayList[i] = (GameObject)EditorGUILayout.ObjectField(label, (GameObject)proxy.arrayList[i], typeof(GameObject), true); } else if (proxy.arrayList[i].GetType() == typeof(int)) { proxy.arrayList[i] = (int)EditorGUILayout.IntField(label, (int)proxy.arrayList[i]); } else if (proxy.arrayList[i].GetType() == typeof(Material)) { proxy.arrayList[i] = (Material)EditorGUILayout.ObjectField(label, (Material)proxy.arrayList[i], typeof(Material), false); } else if (proxy.arrayList[i].GetType() == typeof(Object)) { proxy.arrayList[i] = (Object)EditorGUILayout.ObjectField(label, (Object)proxy.arrayList[i], typeof(Object), true); } else if (proxy.arrayList[i].GetType() == typeof(Quaternion)) { Quaternion q = (Quaternion)proxy.arrayList[i]; Vector4 quat = new Vector4(q[0], q[1], q[2], q[3]); quat = EditorGUILayout.Vector4Field(label, quat); q[0] = quat[0]; q[1] = quat[1]; q[2] = quat[2]; q[3] = quat[3]; proxy.arrayList[i] = q; } else if (proxy.arrayList[i].GetType() == typeof(Rect)) { proxy.arrayList[i] = (Rect)EditorGUILayout.RectField(label, (Rect)proxy.arrayList[i]); } else if (proxy.arrayList[i].GetType() == typeof(string)) { proxy.arrayList[i] = (string)EditorGUILayout.TextField(label, (string)proxy.arrayList[i]); } else if (proxy.arrayList[i].GetType() == typeof(Texture2D)) { if (proxy.TextureElementSmall) { EditorGUIUtility.LookLikeInspector(); } proxy.arrayList[i] = (Texture2D)EditorGUILayout.ObjectField(label, (Texture2D)proxy.arrayList[i], typeof(Texture2D), false); if (proxy.TextureElementSmall) { EditorGUIUtility.LookLikeControls(); } } else if (proxy.arrayList[i].GetType() == typeof(Vector2)) { proxy.arrayList[i] = (Vector2)EditorGUILayout.Vector2Field(label, (Vector2)proxy.arrayList[i]); } else if (proxy.arrayList[i].GetType() == typeof(Vector3)) { proxy.arrayList[i] = (Vector3)EditorGUILayout.Vector3Field(label, (Vector3)proxy.arrayList[i]); } else if (proxy.arrayList[i].GetType() == typeof(AudioClip)) { proxy.arrayList[i] = (AudioClip)EditorGUILayout.ObjectField(label, (AudioClip)proxy.arrayList[i], typeof(AudioClip), true); } else { //(FsmBool)proxy.arrayList[i].Value = (bool)EditorGUILayout.Toggle(label, (FsmBool)proxy.arrayList[i].Value); // OUPS Debug.Log(proxy.arrayList[i].GetType()); //EditorGUILayout.TextField(label, (string)proxy.arrayList[i]); } } else { EditorGUILayout.LabelField(label, "-- NULL --"); } EditorGUILayout.EndHorizontal(); if (Application.isPlaying && GUI.changed) { proxy.InspectorEdit(i); } } } else { EditorGUILayout.LabelField("-- Empty --", ""); } if (proxy.liveUpdate) { Repaint(); } }
private void CustomShadingModule( ref bool ShowShading, ref MaterialProperty Show, string ShadingSide, ref ShadingMode ShadingType, ref MaterialProperty ShadeMode, ref MaterialProperty Color1, ref MaterialProperty Color2, ref GradientSettings GradSettings, ref MaterialProperty GradientSettings, ref MaterialProperty GradHeight, ref MaterialProperty GradPivot, ref MaterialProperty Rotation, string shaderKeywordG, string shaderKeywordS, MaterialProperty Gizmopos) { EditorGUILayout.BeginVertical(); { ShowShading = EditorGUILayout.Foldout(ShowShading, ShadingSide); } EditorGUILayout.EndVertical(); if (ShowShading) { Show.floatValue = 1; ShadingType = (ShadingMode)EditorGUILayout.EnumPopup("Shading Mode", ShadingType); ShadeMode.floatValue = (float)ShadingType; if (ShadingType == ShadingMode.VertexColor) { targetMat.DisableKeyword(shaderKeywordS); } else if (ShadingType == ShadingMode.SolidColor) { ColorProperty(Color1, "Color"); targetMat.EnableKeyword(shaderKeywordS); } else if (ShadingType == ShadingMode.Gradient_ProOnly) { EditorGUI.BeginDisabledGroup(true); EditorGUILayout.BeginHorizontal("Box"); { EditorGUILayout.BeginVertical(GUILayout.Width(50)); { Color1.colorValue = EditorGUILayout.ColorField(Color1.colorValue); Color2.colorValue = EditorGUILayout.ColorField(Color2.colorValue); if (GUILayout.Button("Swap")) { } Rect R = EditorGUILayout.GetControlRect(GUILayout.Height(50), GUILayout.Width(50)); if (ShadingSide == TOP || ShadingSide == DOWN) { GUI.DrawTexture(R, GetTexture(Color1.colorValue, Color2.colorValue, true)); } else { GUI.DrawTexture(R, GetTexture(Color1.colorValue, Color2.colorValue, false)); } } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width - 112)); { GradSettings = (GradientSettings)EditorGUILayout.EnumPopup("", GradSettings, GUILayout.Width(Screen.width - 110)); GradientSettings.floatValue = (float)GradSettings; EditorGUI.BeginDisabledGroup(IsGlobal(GradSettings)); { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.BeginVertical(GUILayout.Width(Screen.width - 142)); { if (IsGlobal(GradSettings)) { GradHeight.floatValue = CEditor.FloatField("Falloff", 70, _GradientHeight_G.floatValue); EditorGUILayout.LabelField("Pivot", GUILayout.Width(60)); GradPivot.vectorValue = EditorGUILayout.Vector2Field("", _GradPivot_G.vectorValue, GUILayout.Width(Screen.width - 142)); EditorGUILayout.LabelField("Rotation", GUILayout.Width(60)); Rotation.floatValue = EditorGUILayout.Slider(_Rotation_G.floatValue, 0f, 360f, GUILayout.Width(Screen.width - 142)); } else { GradHeight.floatValue = CEditor.FloatField("Falloff", 70, GradHeight.floatValue); EditorGUILayout.LabelField("Pivot", GUILayout.Width(60)); GradPivot.vectorValue = EditorGUILayout.Vector2Field("", GradPivot.vectorValue, GUILayout.Width(Screen.width - 142)); EditorGUILayout.LabelField("Rotation", GUILayout.Width(60)); Rotation.floatValue = EditorGUILayout.Slider(Rotation.floatValue, 0f, 360f, GUILayout.Width(Screen.width - 142)); } } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); { EditorGUI.BeginDisabledGroup(!isAnythingSelected()); { if (GUILayout.Button(EditorGUIUtility.IconContent("EditCollider", "Edit in Scene"), GUILayout.Height(28))) { } if (GUILayout.Button(EditorGUIUtility.IconContent("TreeEditor.Duplicate"), GUILayout.Height(28))) { } if (GUILayout.Button(EditorGUIUtility.IconContent("Clipboard", "Paste"), GUILayout.Height(28))) { } } EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); } EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); } else { Color1.colorValue = Color.white; Color2.colorValue = Color.white; } } else { Show.floatValue = 0; } }
void OnGUI() { grid.color = EditorGUILayout.ColorField(grid.color, GUILayout.Width(200)); }
override protected bool OnDrawProperties () { mLabel = mWidget as UILabel; ComponentSelector.Draw<UIFont>(mLabel.font, OnSelectFont); if (mLabel.font == null) return false; GUI.skin.textArea.wordWrap = true; string text = string.IsNullOrEmpty(mLabel.text) ? "" : mLabel.text; text = EditorGUILayout.TextArea(mLabel.text, GUI.skin.textArea, GUILayout.Height(100f)); if (!text.Equals(mLabel.text)) { RegisterUndo(); mLabel.text = text; } GUILayout.BeginHorizontal(); { int len = EditorGUILayout.IntField("Line Width", mLabel.lineWidth, GUILayout.Width(120f)); if (len != mLabel.lineWidth) { RegisterUndo(); mLabel.lineWidth = len; } int count = EditorGUILayout.IntField("Line Count", mLabel.maxLineCount, GUILayout.Width(100f)); if (count != mLabel.maxLineCount) { RegisterUndo(); mLabel.maxLineCount = count; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); bool password = EditorGUILayout.Toggle("Password", mLabel.password, GUILayout.Width(120f)); if (password != mLabel.password) { RegisterUndo(); mLabel.password = password; } bool encoding = EditorGUILayout.Toggle("Encoding", mLabel.supportEncoding, GUILayout.Width(100f)); if (encoding != mLabel.supportEncoding) { RegisterUndo(); mLabel.supportEncoding = encoding; } GUILayout.EndHorizontal(); if (encoding && mLabel.font.hasSymbols) { UIFont.SymbolStyle sym = (UIFont.SymbolStyle)EditorGUILayout.EnumPopup("Symbols", mLabel.symbolStyle, GUILayout.Width(170f)); if (sym != mLabel.symbolStyle) { RegisterUndo(); mLabel.symbolStyle = sym; } } GUILayout.BeginHorizontal(); { UILabel.Effect effect = (UILabel.Effect)EditorGUILayout.EnumPopup("Effect", mLabel.effectStyle, GUILayout.Width(170f)); if (effect != mLabel.effectStyle) { RegisterUndo(); mLabel.effectStyle = effect; } if (effect != UILabel.Effect.None) { Color c = EditorGUILayout.ColorField(mLabel.effectColor); if (mLabel.effectColor != c) { RegisterUndo(); mLabel.effectColor = c; } } } GUILayout.EndHorizontal(); if (mLabel.effectStyle != UILabel.Effect.None) { GUILayout.Label("Distance", GUILayout.Width(70f)); GUILayout.Space(-34f); GUILayout.BeginHorizontal(); GUILayout.Space(70f); Vector2 offset = EditorGUILayout.Vector2Field("", mLabel.effectDistance); GUILayout.Space(20f); if (offset != mLabel.effectDistance) { RegisterUndo(); mLabel.effectDistance = offset; } GUILayout.EndHorizontal(); } return true; }
public override void OnInspectorGUI() { EasyButton t = (EasyButton)target; // Button Properties HTGUILayout.FoldOut(ref t.showInspectorProperties, "Button properties", false); if (t.showInspectorProperties) { EditorGUILayout.BeginVertical(paddingStyle1); t.name = EditorGUILayout.TextField("Button name", t.name); if (t.enable) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.enable = EditorGUILayout.Toggle("Enable button", t.enable); if (t.isActivated) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.isActivated = EditorGUILayout.Toggle("Activated", t.isActivated); if (t.showDebugArea) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.showDebugArea = EditorGUILayout.Toggle("Show debug area", t.showDebugArea); GUI.backgroundColor = Color.white; HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left); EditorGUILayout.Separator(); if (t.isUseGuiLayout) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.isUseGuiLayout = EditorGUILayout.Toggle("Use GUI Layout", t.isUseGuiLayout); GUI.backgroundColor = Color.white; if (!t.isUseGuiLayout) { EditorGUILayout.HelpBox("This lets you skip the GUI layout phase (Increase GUI performance). It can only be used if you do not use GUI.Window and GUILayout inside of this OnGUI call.", MessageType.Warning); } EditorGUILayout.EndVertical(); } // Button position and size HTGUILayout.FoldOut(ref t.showInspectorPosition, "Button position & size", false); if (t.showInspectorPosition) { GUI.backgroundColor = Color.cyan; t.Anchor = (EasyButton.ButtonAnchor)EditorGUILayout.EnumPopup("Anchor", t.Anchor); GUI.backgroundColor = Color.white; t.Offset = EditorGUILayout.Vector2Field("Offset", t.Offset); t.Scale = EditorGUILayout.Vector2Field("Scale", t.Scale); HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left); EditorGUILayout.Separator(); if (t.isSwipeIn) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.isSwipeIn = EditorGUILayout.Toggle("Swipe in", t.isSwipeIn); if (t.isSwipeOut) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.isSwipeOut = EditorGUILayout.Toggle("Swipe out", t.isSwipeOut); GUI.backgroundColor = Color.white; } // Event HTGUILayout.FoldOut(ref t.showInspectorEvent, "Button Interaction & Events", false); if (t.showInspectorEvent) { EditorGUILayout.BeginVertical(paddingStyle1); GUI.backgroundColor = Color.cyan; t.interaction = (EasyButton.InteractionType)EditorGUILayout.EnumPopup("Interaction type", t.interaction); GUI.backgroundColor = Color.white; if (t.interaction == EasyButton.InteractionType.Event) { if (t.useBroadcast) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.useBroadcast = EditorGUILayout.Toggle("Broadcast messages", t.useBroadcast); GUI.backgroundColor = Color.white; if (t.useBroadcast) { EditorGUILayout.BeginVertical(paddingStyle1); t.receiverGameObject = (GameObject)EditorGUILayout.ObjectField("Receiver object", t.receiverGameObject, typeof(GameObject), true); GUI.backgroundColor = Color.cyan; t.messageMode = (EasyButton.Broadcast)EditorGUILayout.EnumPopup("Sending mode", t.messageMode); GUI.backgroundColor = Color.white; EditorGUILayout.Separator(); if (t.useSpecificalMethod) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.useSpecificalMethod = EditorGUILayout.Toggle("Use specific method", t.useSpecificalMethod); GUI.backgroundColor = Color.white; if (t.useSpecificalMethod) { t.downMethodName = EditorGUILayout.TextField(" Down method name", t.downMethodName); t.pressMethodName = EditorGUILayout.TextField(" Press method name", t.pressMethodName); t.upMethodName = EditorGUILayout.TextField(" Up method name", t.upMethodName); } EditorGUILayout.EndVertical(); } } EditorGUILayout.EndVertical(); } // Button texture HTGUILayout.FoldOut(ref t.showInspectorTexture, "Button textures", false); if (t.showInspectorTexture) { EditorGUILayout.BeginVertical(paddingStyle1); t.guiDepth = EditorGUILayout.IntField("Gui depth", t.guiDepth); EditorGUILayout.Separator(); t.buttonNormalColor = EditorGUILayout.ColorField("Color", t.buttonNormalColor); t.NormalTexture = (Texture2D)EditorGUILayout.ObjectField("Normal texture", t.NormalTexture, typeof(Texture), true); EditorGUILayout.Separator(); t.buttonActiveColor = EditorGUILayout.ColorField("Color", t.buttonActiveColor); t.ActiveTexture = (Texture2D)EditorGUILayout.ObjectField("Active texture", t.ActiveTexture, typeof(Texture), true); EditorGUILayout.EndVertical(); } // Refresh if (GUI.changed) { EditorUtility.SetDirty(t); } }
/// <summary> /// Draw the POI gui /// </summary> public override void OnInspectorGUI() { //Get our trigger m_trigger = (TriggerControlHeliosFade)target; //Set up the box style if (m_boxStyle == null) { m_boxStyle = new GUIStyle(GUI.skin.box); m_boxStyle.normal.textColor = GUI.skin.label.normal.textColor; m_boxStyle.fontStyle = FontStyle.Bold; m_boxStyle.alignment = TextAnchor.UpperLeft; } //Setup the wrap style if (m_wrapStyle == null) { m_wrapStyle = new GUIStyle(GUI.skin.label); m_wrapStyle.wordWrap = true; } //Create a nice text intro GUILayout.BeginVertical("Helios Fade Trigger", m_boxStyle); GUILayout.Space(20); EditorGUILayout.LabelField("This trigger controls Helios Fades.", m_wrapStyle); GUILayout.EndVertical(); EditorGUI.BeginChangeCheck(); GUILayout.Space(5); PegasusConstants.PoiHeliosTriggerAction actionOnStart = m_trigger.m_actionOnStart; PegasusConstants.PoiHeliosTriggerAction actionOnEnd = m_trigger.m_actionOnEnd; float startDuration = m_trigger.m_startDuration; float endDuration = m_trigger.m_endDuration; Color startColor = m_trigger.m_startColour; Color endColor = m_trigger.m_endColour; actionOnStart = (PegasusConstants.PoiHeliosTriggerAction)EditorGUILayout.EnumPopup(GetLabel("Action On Start"), actionOnStart); if (actionOnStart != PegasusConstants.PoiHeliosTriggerAction.DoNothing) { startColor = EditorGUILayout.ColorField(GetLabel("Color"), startColor); startDuration = EditorGUILayout.Slider(GetLabel("Duration"), startDuration, 0.1f, 10f); } actionOnEnd = (PegasusConstants.PoiHeliosTriggerAction)EditorGUILayout.EnumPopup(GetLabel("Action On End"), actionOnEnd); if (actionOnEnd != PegasusConstants.PoiHeliosTriggerAction.DoNothing) { endColor = EditorGUILayout.ColorField(GetLabel("Color"), endColor); endDuration = EditorGUILayout.Slider(GetLabel("Duration"), endDuration, 0.1f, 10f); } GUILayout.Space(5); //Check for changes, make undo record, make changes and let editor know we are dirty if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(m_trigger, "Made trigger changes"); m_trigger.m_triggerAtStart = true; m_trigger.m_triggerOnUpdate = true; m_trigger.m_triggerAtEnd = false; m_trigger.m_actionOnStart = actionOnStart; m_trigger.m_startColour = startColor; m_trigger.m_startDuration = startDuration; m_trigger.m_actionOnEnd = actionOnEnd; m_trigger.m_endColour = endColor; m_trigger.m_endDuration = endDuration; //Mark it as dirty EditorUtility.SetDirty(m_trigger); } }
void DrawVolumeEffectFields(AmplifyColorVolume volume) { List <VolumeEffect> effectsToDelete = new List <VolumeEffect>(); float removeButtonSize = 16; List <NewLineContainer> volumeLines = null; if (!(newLines.TryGetValue(volume, out volumeLines))) { volumeLines = newLines[volume] = new List <NewLineContainer>(); } GUIStyle minusStyle = new GUIStyle(( GUIStyle )"OL Minus"); GUIStyle plusStyle = new GUIStyle(( GUIStyle )"OL Plus"); minusStyle.margin.top = 2; plusStyle.margin.top = 2; #region CurrentEffectFields int fieldPosition = 0; foreach (VolumeEffect effectVol in volume.EffectContainer.volumes) { if (effectVol.gameObject == null) { continue; } AmplifyColorBase effect = effectVol.gameObject; List <VolumeEffectComponent> compsToDelete = new List <VolumeEffectComponent>(); foreach (VolumeEffectComponent comp in effectVol.components) { Component c = effect.GetComponent(comp.componentName); if (c == null) { continue; } List <VolumeEffectField> fieldsToDelete = new List <VolumeEffectField>(); List <KeyValuePair <string, int> > fieldsToAdd = new List <KeyValuePair <string, int> >(); foreach (VolumeEffectField field in comp.fields) { EditorGUILayout.BeginHorizontal(); GUILayout.Label("", GUILayout.MinWidth(minIndentWidth), GUILayout.MaxWidth(maxIndentWidth)); GUILayout.Space(0); if (GUILayout.Button("", minusStyle, GUILayout.MinWidth(18), GUILayout.MaxWidth(18), GUILayout.Height(20))) { fieldsToDelete.Add(field); } Camera selectedCamera = EditorGUILayout.ObjectField(effect.GetComponent <Camera>(), typeof(Camera), true, GUILayout.MinWidth(minColumnWidth * 1.5f), GUILayout.MaxWidth(maxColumnWidth * 1.5f)) as Camera; AmplifyColorBase selectedEffect = (selectedCamera != null) ? selectedCamera.GetComponent <AmplifyColorBase>() : null; if (selectedEffect != effect) { fieldsToDelete.Add(field); dirtyVolumeFlags = true; volumeLines.Add(new NewLineContainer(selectedEffect)); } Component[] compArray = VolumeEffect.ListAcceptableComponents(effectVol.gameObject); List <string> compFlagsArray = compArray.Select(s => s.GetType().Name).ToList(); compFlagsArray.Remove(comp.componentName); string[] compNamesArray = new string[] { comp.componentName }.Concat(compFlagsArray).ToArray(); int selectedComponent = 0; selectedComponent = EditorGUILayout.Popup(selectedComponent, compNamesArray, GUILayout.MinWidth(minColumnWidth), GUILayout.MaxWidth(maxColumnWidth)); if (selectedComponent != 0) { volumeLines.Add(new NewLineContainer(effect, compNamesArray[selectedComponent])); fieldsToDelete.Add(field); dirtyVolumeFlags = true; } FieldInfo[] fieldArray = VolumeEffectComponent.ListAcceptableFields(c); string[] fieldFlagsArray = fieldArray.Select(s => s.Name).ToArray(); string[] fieldNamesArray = comp.GetFieldNames(); fieldFlagsArray = fieldFlagsArray.Except(fieldNamesArray).ToArray(); List <string> names = new List <string>(); names.Add(field.fieldName); names.AddRange(fieldFlagsArray); for (int i = 0; i < names.Count; i++) { if (i == 0) { continue; } FieldInfo fi = Array.Find(fieldArray, s => (names[i] == s.Name)); if (fi != null) { names[i] += " : " + fi.FieldType.Name; } } int selectedField = 0; selectedField = EditorGUILayout.Popup(selectedField, names.ToArray(), GUILayout.MinWidth(minColumnWidth), GUILayout.MaxWidth(maxColumnWidth)); if (selectedField != 0) { fieldsToAdd.Add(new KeyValuePair <string, int>(fieldFlagsArray[selectedField - 1], fieldPosition)); fieldsToDelete.Add(field); dirtyVolumeFlags = true; } fieldPosition++; switch (field.fieldType) { case "System.Single": field.valueSingle = EditorGUILayout.FloatField(field.valueSingle, GUILayout.MinWidth(minValueWidth), GUILayout.MaxWidth(maxValueWidth)); break; case "System.Boolean": field.valueBoolean = EditorGUILayout.Toggle("", field.valueBoolean, GUILayout.MinWidth(minValueWidth), GUILayout.MaxWidth(maxValueWidth)); break; case "UnityEngine.Vector2": field.valueVector2 = EditorGUILayout.Vector2Field("", field.valueVector2, GUILayout.MinWidth(minValueWidth), GUILayout.MaxWidth(maxValueWidth), GUILayout.MaxHeight(16)); break; case "UnityEngine.Vector3": field.valueVector3 = EditorGUILayout.Vector3Field("", field.valueVector3, GUILayout.MinWidth(minValueWidth), GUILayout.MaxWidth(maxValueWidth), GUILayout.MaxHeight(16)); break; case "UnityEngine.Vector4": field.valueVector4 = DrawFixedVector4Field(field.valueVector4); break; case "UnityEngine.Color": field.valueColor = EditorGUILayout.ColorField(field.valueColor, GUILayout.MinWidth(minValueWidth), GUILayout.MaxWidth(maxValueWidth)); break; default: EditorGUILayout.LabelField(field.fieldType, GUILayout.MinWidth(minValueWidth), GUILayout.MaxWidth(maxValueWidth)); break; } // COPY TO CLIPBOARD string luid = NewLineContainer.GenerateUniqueID(effect, comp.componentName, field.fieldName); bool copied = copyLines.ContainsKey(luid); bool keep = GUILayout.Toggle(copied, "c", removeButtonStyle, GUILayout.Width(removeButtonSize), GUILayout.Height(removeButtonSize)); if (keep != copied) { if (keep) { object valueCopy = null; switch (field.fieldType) { case "System.Single": valueCopy = field.valueSingle; break; case "System.Boolean": valueCopy = field.valueBoolean; break; case "UnityEngine.Vector2": valueCopy = field.valueVector2; break; case "UnityEngine.Vector3": valueCopy = field.valueVector3; break; case "UnityEngine.Vector4": valueCopy = field.valueVector4; break; case "UnityEngine.Color": valueCopy = field.valueColor; break; } copyLines.Add(luid, new NewLineContainer(effect, comp.componentName, field.fieldName, field.fieldType, valueCopy)); } else { copyLines.Remove(luid); } //Debug.Log( "CopyComplete: " + luid + ", " + keep + ", " + volume.name ); } EditorGUILayout.EndHorizontal(); GUILayout.Space(2); } bool fieldRemoved = false; foreach (VolumeEffectField field in fieldsToDelete) { comp.RemoveEffectField(field); fieldRemoved = true; } foreach (KeyValuePair <string, int> pair in fieldsToAdd) { FieldInfo pi = c.GetType().GetField(pair.Key); if (pi != null) { comp.AddField(pi, c, pair.Value); } } if (fieldRemoved && comp.fields.Count <= 0) { compsToDelete.Add(comp); } } bool compRemoved = false; foreach (VolumeEffectComponent comp in compsToDelete) { effectVol.RemoveEffectComponent(comp); compRemoved = true; } if (compRemoved && effectVol.components.Count <= 0) { effectsToDelete.Add(effectVol); } } foreach (VolumeEffect effectVol in effectsToDelete) { volume.EffectContainer.RemoveVolumeEffect(effectVol); } #endregion CurrentEffectFields #region NewLines List <NewLineContainer> linesToDelete = new List <NewLineContainer>(); foreach (NewLineContainer line in volumeLines) { EditorGUILayout.BeginHorizontal(); GUILayout.Label("", GUILayout.MinWidth(minIndentWidth), GUILayout.MaxWidth(maxIndentWidth)); GUILayout.Space(0); if (GUILayout.Button("", minusStyle, GUILayout.MinWidth(18), GUILayout.MaxWidth(18), GUILayout.Height(20))) { linesToDelete.Add(line); } Camera selectedCamera = EditorGUILayout.ObjectField(line.camera, typeof(Camera), true, GUILayout.MinWidth(minColumnWidth * 1.5f), GUILayout.MaxWidth(maxColumnWidth * 1.5f)) as Camera; AmplifyColorBase selectedEffect = (selectedCamera != null) ? selectedCamera.GetComponent <AmplifyColorBase>() : null; if (selectedEffect != null && selectedEffect != line.camera) { line.SetCamera(selectedEffect); } VolumeEffect effectVol = null; if (line.camera != null) { effectVol = volume.EffectContainer.GetVolumeEffect(line.camera); } if (line.camera != null) { Component[] compArray = VolumeEffect.ListAcceptableComponents(line.camera); List <string> names = compArray.Select(s => s.GetType().Name).ToList <string>(); int popupSelected = names.IndexOf(line.component) + 1; names.Insert(0, "<Component>"); int selectedComponent = popupSelected; selectedComponent = EditorGUILayout.Popup(selectedComponent, names.ToArray(), GUILayout.MinWidth(minColumnWidth), GUILayout.MaxWidth(maxColumnWidth)); if (selectedComponent != popupSelected) { line.SetComponent(selectedComponent == 0 ? null : names[selectedComponent]); } } else { GUI.enabled = false; EditorGUILayout.Popup(0, new string[] { "<Component>" }, GUILayout.MaxWidth(maxColumnWidth)); GUI.enabled = true; } Component c = (line.camera == null) ? null : line.camera.GetComponent(line.component); VolumeEffectComponent comp = null; if (effectVol != null) { comp = effectVol.GetEffectComponent(line.component); } if (c != null) { FieldInfo[] fieldArray = VolumeEffectComponent.ListAcceptableFields(c); string[] fieldFlagsArray = fieldArray.Select(s => s.Name).ToArray(); if (comp != null) { string[] fieldNamesArray = comp.GetFieldNames(); fieldFlagsArray = fieldFlagsArray.Except(fieldNamesArray).ToArray(); } List <string> names = fieldFlagsArray.ToList(); for (int i = 0; i < names.Count; i++) { FieldInfo fi = Array.Find(fieldArray, s => (names[i] == s.Name)); if (fi != null) { names[i] += " : " + fi.FieldType.Name; } } names.Insert(0, "<Field>"); int selectedField = 0; selectedField = EditorGUILayout.Popup(selectedField, names.ToArray(), GUILayout.MinWidth(minColumnWidth), GUILayout.MaxWidth(maxColumnWidth)); if (selectedField > 0) { FieldInfo pi = c.GetType().GetField(fieldFlagsArray[selectedField - 1]); if (pi != null) { if (effectVol == null) { effectVol = volume.EffectContainer.AddJustColorEffect(line.camera); } if (comp == null) { comp = effectVol.AddComponent(c, null); } comp.AddField(pi, c); linesToDelete.Add(line); dirtyVolumeFlags = true; } } EditorGUILayout.LabelField("", GUILayout.MinWidth(minValueWidth), GUILayout.MaxWidth(maxValueWidth)); } else { GUI.enabled = false; EditorGUILayout.Popup(0, new string[] { "<Field>" }, GUILayout.MaxWidth(maxColumnWidth)); EditorGUILayout.TextField("", GUILayout.MinWidth(minValueWidth), GUILayout.MaxWidth(maxValueWidth)); GUI.enabled = true; } if (line.camera != null) { string luid = NewLineContainer.GenerateUniqueID(line.camera, line.component, line.fieldName); bool copied = copyLines.ContainsKey(luid); bool keep = GUILayout.Toggle(copied, "c", removeButtonStyle, GUILayout.Width(removeButtonSize), GUILayout.Height(removeButtonSize)); if (keep != copied) { if (keep) { copyLines.Add(luid, new NewLineContainer(line.camera, line.component, line.fieldName, line.fieldType, line.value)); } else { copyLines.Remove(luid); } //Debug.Log( "CopyIncomplete: " + luid + ", " + keep + ", " + volume.name ); } } else { GUI.enabled = false; GUILayout.Button("c", removeButtonStyle, GUILayout.Width(removeButtonSize), GUILayout.Height(removeButtonSize)); GUI.enabled = true; } EditorGUILayout.EndHorizontal(); GUILayout.Space(2); } foreach (NewLineContainer line in linesToDelete) { copyLines.Remove(line.GenerateUniqueID()); //Debug.Log( "Removed " + line.GenerateUniqueID() ); volumeLines.Remove(line); } #endregion NewLines #region AddPaste EditorGUILayout.BeginHorizontal(); GUILayout.Label("", GUILayout.MinWidth(minIndentWidth), GUILayout.MaxWidth(maxIndentWidth)); GUILayout.Space(0); bool add = GUILayout.Button("", plusStyle, GUILayout.MinWidth(18), GUILayout.MaxWidth(18), GUILayout.Height(20)); if (add || GUILayout.Button("Add New", GUILayout.MinWidth(minColumnWidth), GUILayout.MaxWidth(maxColumnWidth), GUILayout.Height(20))) { volumeLines.Add(new NewLineContainer()); } GUI.enabled = (copyLines.Count > 0); if (GUILayout.Button("Paste", GUILayout.MinWidth(minColumnWidth), GUILayout.MaxWidth(maxColumnWidth), GUILayout.Height(20))) { foreach (var pair in copyLines) { NewLineContainer line = pair.Value; Component c = (line.camera == null) ? null : line.camera.GetComponent(line.component); FieldInfo pi = (c != null) ? c.GetType().GetField(line.fieldName) : null; if (pi == null) { volumeLines.Add(new NewLineContainer(line.camera, line.component, line.fieldName, line.fieldType, line.value)); } else { VolumeEffect effectVol = volume.EffectContainer.GetVolumeEffect(line.camera); if (effectVol == null) { effectVol = volume.EffectContainer.AddJustColorEffect(line.camera); } VolumeEffectComponent comp = effectVol.GetEffectComponent(line.component); if (comp == null) { comp = effectVol.AddComponent(c, null); } VolumeEffectField field = comp.GetEffectField(line.fieldName); if (field == null) { field = comp.AddField(pi, c); } else { Debug.LogWarning("[AmplifyColor] Blend Effect field already added to Volume " + volume.name + "."); } field.UpdateValue(line.value); } } dirtyVolumeFlags = true; } GUI.enabled = true; EditorGUILayout.EndHorizontal(); GUILayout.Space(5); #endregion AddPaste }
public override void OnInspectorGUI() { //base.OnInspectorGUI(); PostProcessChain sv = target as PostProcessChain; // brightness & contrast //if (sv.Brightness_Contrast != null) { DrawItem( () => { EditorGUILayout.LabelField("# Motion Blur"); sv.EnableMotionBlur = EditorGUILayout.Toggle(" ", sv.EnableMotionBlur); return(sv.EnableMotionBlur); }, () => { EditorGUI.BeginDisabledGroup(true); sv.MotionBlurParamter = EditorGUILayout.Vector4Field("Mix", sv.MotionBlurParamter); EditorGUI.EndDisabledGroup(); }); } { DrawItem( () => { EditorGUILayout.LabelField("# Fog"); sv.EnableFog = EditorGUILayout.Toggle(" ", sv.EnableFog); return(sv.EnableFog); }, () => { sv.fog_color = EditorGUILayout.ColorField("Fog Color", sv.fog_color); sv.fog_paramter.x = EditorGUILayout.FloatField("Distance Fog Begin", sv.fog_paramter.x); sv.fog_paramter.y = EditorGUILayout.FloatField("Distance Fog Length", sv.fog_paramter.y); sv.fog_paramter.z = EditorGUILayout.FloatField("Height Fog Begin", sv.fog_paramter.z); sv.fog_paramter.w = EditorGUILayout.FloatField("Height Fog Length", sv.fog_paramter.w); }); } { DrawItem( () => { EditorGUILayout.LabelField("# Depth Of Field"); sv.EnableDepthOfField = EditorGUILayout.Toggle(" ", sv.EnableDepthOfField); return(sv.EnableDepthOfField); }, () => { sv.depthoffield_paramter.x = EditorGUILayout.FloatField("Distance", sv.depthoffield_paramter.x); sv.depthoffield_paramter.y = EditorGUILayout.FloatField("Range", sv.depthoffield_paramter.y); sv.depthoffield_paramter.z = EditorGUILayout.FloatField("Bokeh", sv.depthoffield_paramter.z); }); } { DrawItem( () => { EditorGUILayout.LabelField("# HSV"); sv.EnableHsvAdjust = EditorGUILayout.Toggle(" ", sv.EnableHsvAdjust); return(sv.EnableHsvAdjust); }, () => { sv._hsv_adjust_paramters.x = EditorGUILayout.FloatField("Hue [0, 360]", sv._hsv_adjust_paramters.x); sv._hsv_adjust_paramters.y = EditorGUILayout.FloatField("Saturation [0, 1]", sv._hsv_adjust_paramters.y); sv._hsv_adjust_paramters.z = EditorGUILayout.FloatField("Value [0, 1]", sv._hsv_adjust_paramters.z); }); } { DrawItem( () => { EditorGUI.BeginDisabledGroup(true); EditorGUILayout.LabelField("# Brightness & Contrast"); EditorGUI.EndDisabledGroup(); return(sv.EnableHsvAdjust); }, () => { //EditorGUI.BeginDisabledGroup(true); sv.brightness_contrast_paramters.x = EditorGUILayout.FloatField("Brightness Factor [0, 2]", sv.brightness_contrast_paramters.x); //EditorGUI.EndDisabledGroup(); sv.brightness_contrast_paramters.y = EditorGUILayout.FloatField("Contrast Factor [0, 2]", sv.brightness_contrast_paramters.y); sv.brightness_contrast_paramters.z = EditorGUILayout.FloatField("Average Brightness [0, 1]", sv.brightness_contrast_paramters.z); }); } // bloom //if (sv.Bloom != null) { DrawItem( () => { EditorGUILayout.LabelField("# BloomHD"); EditorGUI.BeginDisabledGroup(true); sv.EnableBloomHD = EditorGUILayout.Toggle(" ", sv.EnableBloomHD); EditorGUI.EndDisabledGroup(); return(sv.EnableBloomHD); }, () => { //sv.bloom_paramters.x = EditorGUILayout.FloatField("Brightness Threshold [0, 1]", sv.bloom_paramters.x); //sv.bloom_paramters.y = EditorGUILayout.FloatField("Bloom Blend Factor [0, 1]", sv.bloom_paramters.y); }); } { DrawItem( () => { EditorGUILayout.LabelField("# Simple Radial Blur"); sv.EnableRadialBlur = EditorGUILayout.Toggle(" ", sv.EnableRadialBlur); return(sv.EnableRadialBlur); }, () => { sv.radial_blur_pos = EditorGUILayout.Vector2Field("Pos", sv.radial_blur_pos); sv.radial_blur_paramters.x = EditorGUILayout.FloatField("P1", sv.radial_blur_paramters.x); sv.radial_blur_paramters.y = EditorGUILayout.FloatField("P2", sv.radial_blur_paramters.y); }); } // special vision //if (sv.SpecialVision != null) { DrawItem( () => { EditorGUILayout.LabelField("# Special Vision"); sv.EnableSpecialVision = EditorGUILayout.Toggle(" ", sv.EnableSpecialVision); return(sv.EnableSpecialVision); }, () => { sv.vision_color = EditorGUILayout.ColorField("Special Vision Color (RGB)", sv.vision_color); sv.special_vision_paramters.x = EditorGUILayout.FloatField("Fuzzy Factor", sv.special_vision_paramters.x); sv.special_vision_paramters.y = EditorGUILayout.FloatField("Brightness Factor [0, 2]", sv.special_vision_paramters.y); }); } }