static public void DrawDay(DayNormalMapMode bumpMapMode) { bool value = GUIFoldout.Draw("Mask Normal Map", bumpMapMode); if (value == false) { return; } EditorGUI.indentLevel++; bumpMapMode.textureType = (NormalMapTextureType)EditorGUILayout.EnumPopup("Texture Type", bumpMapMode.textureType); switch (bumpMapMode.textureType) { case NormalMapTextureType.Texture: bumpMapMode.texture = (Texture)EditorGUILayout.ObjectField("Texture", bumpMapMode.texture, typeof(Texture), true); break; case NormalMapTextureType.Sprite: bumpMapMode.sprite = (Sprite)EditorGUILayout.ObjectField("Sprite", bumpMapMode.sprite, typeof(Sprite), true); break; } EditorGUI.indentLevel--; }
static public void Draw(SerializedObject serializedObject, LightingSettings.SortingLayer sortingLayer, string serializationDepth = "") { bool value = GUIFoldout.Draw("Sorting Layer", sortingLayer); if (value == false) { return; } SerializedProperty order = serializedObject.FindProperty(serializationDepth + "sortingLayer.Order"); SerializedProperty name = serializedObject.FindProperty(serializationDepth + "sortingLayer.name"); EditorGUI.indentLevel++; string[] sortingLayerNames = GetSortingLayerNames(); int id = Array.IndexOf(sortingLayerNames, sortingLayer.Name); int newId = EditorGUILayout.Popup("Name", id, sortingLayerNames); if (newId > -1 && newId < sortingLayerNames.Length) { string newName = sortingLayerNames[newId]; if (newName != sortingLayer.Name) { name.stringValue = newName; } } EditorGUILayout.PropertyField(order, new GUIContent("Order")); EditorGUI.indentLevel--; }
static public void Draw(LightingSettings.SortingLayer sortingLayer) { bool value = GUIFoldout.Draw("Sorting Layer", sortingLayer); if (value == false) { return; } EditorGUI.indentLevel++; string[] sortingLayerNames = GetSortingLayerNames(); int id = Array.IndexOf(sortingLayerNames, sortingLayer.Name); int newId = EditorGUILayout.Popup("Name", id, sortingLayerNames); if (newId > -1 && newId < sortingLayerNames.Length) { string newName = sortingLayerNames[newId]; if (newName != sortingLayer.Name) { sortingLayer.Name = newName; } } sortingLayer.Order = EditorGUILayout.IntField("Order", sortingLayer.Order); EditorGUI.indentLevel--; }
public static void DrawList(LightingSettings.LayersList layerList, string name, string singular) { bool foldout = GUIFoldout.Draw(name, layerList); if (foldout == false) { return; } EditorGUI.indentLevel++; int lightLayerCount = EditorGUILayout.IntSlider("Count", layerList.names.Length, 1, 10); if (lightLayerCount != layerList.names.Length) { int oldCount = layerList.names.Length; System.Array.Resize(ref layerList.names, lightLayerCount); for (int i = oldCount; i < lightLayerCount; i++) { layerList.names[i] = singular + " " + (i); } } for (int i = 0; i < lightLayerCount; i++) { layerList.names[i] = EditorGUILayout.TextField(" ", layerList.names[i]); } EditorGUI.indentLevel--; }
void DrawSpriteRenderer(LightSprite2D script) { if (script.spriteMode == LightSprite2D.SpriteMode.Custom) { bool foldout0 = GUIFoldout.Draw("Sprite Renderer", script); if (foldout0) { EditorGUI.indentLevel++; sprite.objectReferenceValue = (Sprite)EditorGUILayout.ObjectField("Sprite", sprite.objectReferenceValue, typeof(Sprite), true); DrawColor(); EditorGUILayout.PropertyField(flipX, new GUIContent("Flip X")); EditorGUILayout.PropertyField(flipY, new GUIContent("Flip Y")); EditorGUI.indentLevel--; } } else { DrawColor(); } }
public static void Draw(SerializedObject serializedObject, MeshMode meshMode) { bool value = GUIFoldout.Draw("Mesh Mode", meshMode); if (value == false) { return; } EditorGUI.indentLevel++; SerializedProperty meshModeEnable = serializedObject.FindProperty("meshMode.enable"); SerializedProperty meshModeAlpha = serializedObject.FindProperty("meshMode.alpha"); SerializedProperty meshModeShader = serializedObject.FindProperty("meshMode.shader"); EditorGUILayout.PropertyField(meshModeEnable, new GUIContent("Enable")); meshModeAlpha.floatValue = EditorGUILayout.Slider("Alpha", meshModeAlpha.floatValue, 0, 1); EditorGUILayout.PropertyField(meshModeShader, new GUIContent("Shader")); if (meshModeShader.intValue == (int)MeshModeShader.Custom) { bool value2 = GUIFoldout.Draw("Materials", meshMode.materials); if (value2) { EditorGUI.indentLevel++; int count = meshMode.materials.Length; count = EditorGUILayout.IntSlider("Material Count", count, 0, 10); if (count != meshMode.materials.Length) { System.Array.Resize(ref meshMode.materials, count); } for (int id = 0; id < meshMode.materials.Length; id++) { Material material = meshMode.materials[id]; material = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), true); meshMode.materials[id] = material; } EditorGUI.indentLevel--; } } GUISortingLayer.Draw(serializedObject, meshMode.sortingLayer, "meshMode."); EditorGUI.indentLevel--; }
public static void DrawList(PresetLayers bufferLayers, string name, LayersList layerList, bool drawType) { bool foldout = GUIFoldout.Draw(name, bufferLayers); if (foldout == false) { return; } EditorGUI.indentLevel++; LightingLayerSetting[] layerSettings = bufferLayers.Get(); int layerCount = EditorGUILayout.IntSlider("Count", layerSettings.Length, 0, 10); EditorGUILayout.Space(); if (layerCount != layerSettings.Length) { int oldCount = layerSettings.Length; System.Array.Resize(ref layerSettings, layerCount); for (int i = oldCount; i < layerCount; i++) { if (layerSettings[i] == null) { layerSettings[i] = new LightingLayerSetting(); layerSettings[i].layer = i; } } bufferLayers.SetArray(layerSettings); } for (int i = 0; i < layerSettings.Length; i++) { layerSettings[i].layer = EditorGUILayout.Popup("Layer", layerSettings[i].layer, layerList.GetNames()); if (drawType) { layerSettings[i].type = (LayerType)EditorGUILayout.EnumPopup("Type", layerSettings[i].type); } layerSettings[i].sorting = (LayerSorting)EditorGUILayout.EnumPopup("Sorting", layerSettings[i].sorting); EditorGUILayout.Space(); } EditorGUI.indentLevel--; }
public static void Draw(EventPresetList lightPresetList) { bool foldout = GUIFoldoutHeader.Begin("Light Event Presets (" + (lightPresetList.list.Length - 1) + ")", lightPresetList); if (foldout == false) { GUIFoldoutHeader.End(); return; } EditorGUI.indentLevel++; int bufferCount = EditorGUILayout.IntSlider("Count", lightPresetList.list.Length - 1, 1, 4) + 1; if (bufferCount != lightPresetList.list.Length) { int oldCount = lightPresetList.list.Length; System.Array.Resize(ref lightPresetList.list, bufferCount); for (int i = oldCount; i < bufferCount; i++) { lightPresetList.list[i] = new EventPreset(i); } } for (int i = 1; i < lightPresetList.list.Length; i++) { bool fold = GUIFoldout.Draw("Preset " + (i), lightPresetList.list[i]); if (fold == false) { continue; } EditorGUI.indentLevel++; lightPresetList.list[i].name = EditorGUILayout.TextField("Name", lightPresetList.list[i].name); EditorGUILayout.Space(); DrawEventLayers(lightPresetList.list[i].layerSetting); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; GUIFoldoutHeader.End(); }
public static void Draw(LightingSettings.Profile profile) { bool foldout = GUIFoldout.Draw("Normal Map", profile.dayLightingSettings.bumpMap); if (foldout == false) { return; } EditorGUI.indentLevel++; profile.dayLightingSettings.bumpMap.height = EditorGUILayout.Slider("Height", profile.dayLightingSettings.bumpMap.height, 0, 5); profile.dayLightingSettings.bumpMap.strength = EditorGUILayout.Slider("Strength", profile.dayLightingSettings.bumpMap.strength, 0, 5); EditorGUI.indentLevel--; }
void DrawTransform(LightSprite2D script) { bool foldout = GUIFoldout.Draw("Transform", script.lightSpriteTransform); if (foldout) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(transform_position, new GUIContent("Position")); EditorGUILayout.PropertyField(transform_scale, new GUIContent("Scale")); EditorGUILayout.PropertyField(transform_rotation, new GUIContent("Rotation")); EditorGUILayout.PropertyField(transform_applyRotation, new GUIContent("Apply Rotation")); EditorGUI.indentLevel--; } }
static public void Draw(GlowMode glowMode) { bool value = GUIFoldout.Draw("Glow Mode", glowMode); if (value == false) { return; } EditorGUI.indentLevel++; glowMode.enable = EditorGUILayout.Toggle("Enable", glowMode.enable); glowMode.glowRadius = EditorGUILayout.Slider("Glow Size", glowMode.glowRadius, 0.1f, 10); EditorGUI.indentLevel--; }
public static void Draw(LightingSettings.Profile profile) { bool foldout = GUIFoldout.Draw("Softness", profile.dayLightingSettings.softness); if (foldout == false) { return; } EditorGUI.indentLevel++; profile.dayLightingSettings.softness.enable = EditorGUILayout.Toggle("Enable", profile.dayLightingSettings.softness.enable); profile.dayLightingSettings.softness.intensity = EditorGUILayout.FloatField("Intensity", profile.dayLightingSettings.softness.intensity); if (profile.dayLightingSettings.softness.intensity < 0) { profile.dayLightingSettings.softness.intensity = 0; } EditorGUI.indentLevel--; }
static public void Draw(SerializedObject serializedObject, object obj) // Serialized property { bool value = GUIFoldout.Draw("Mask Bump Map", obj); if (value == false) { return; } EditorGUI.indentLevel++; SerializedProperty bumpType = serializedObject.FindProperty("bumpMapMode.type"); SerializedProperty bumpTextureType = serializedObject.FindProperty("bumpMapMode.textureType"); SerializedProperty bumpTexture = serializedObject.FindProperty("bumpMapMode.texture"); SerializedProperty bumpSprite = serializedObject.FindProperty("bumpMapMode.sprite"); SerializedProperty invertX = serializedObject.FindProperty("bumpMapMode.invertX"); SerializedProperty invertY = serializedObject.FindProperty("bumpMapMode.invertY"); SerializedProperty depth = serializedObject.FindProperty("bumpMapMode.depth"); SerializedProperty spriteRenderer = serializedObject.FindProperty("bumpMapMode.spriteRenderer"); SpriteRenderer sr = (SpriteRenderer)spriteRenderer.objectReferenceValue; EditorGUILayout.PropertyField(bumpType, new GUIContent("Type")); EditorGUILayout.PropertyField(bumpTextureType, new GUIContent("Texture Type")); EditorGUILayout.PropertyField(invertX, new GUIContent("Invert X")); EditorGUILayout.PropertyField(invertY, new GUIContent("Invert Y")); EditorGUILayout.PropertyField(depth, new GUIContent("Depth")); switch (bumpTextureType.intValue) { case (int)NormalMapTextureType.Texture: bumpTexture.objectReferenceValue = (Texture)EditorGUILayout.ObjectField("Texture", bumpTexture.objectReferenceValue, typeof(Texture), true); break; case (int)NormalMapTextureType.Sprite: bumpSprite.objectReferenceValue = (Sprite)EditorGUILayout.ObjectField("Sprite", bumpSprite.objectReferenceValue, typeof(Sprite), true); break; case (int)NormalMapTextureType.SecondaryTexture: MaterialPropertyBlock matBlock = new MaterialPropertyBlock(); sr.GetPropertyBlock(matBlock); Texture secondaryTexture = matBlock.GetTexture("_SecondaryTex"); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ObjectField("Sprite", secondaryTexture, typeof(Sprite), true); EditorGUI.EndDisabledGroup(); break; } EditorGUI.indentLevel--; }
public static void Draw(BufferPresetList bufferList) { bool foldout = GUIFoldoutHeader.Begin("Buffer Presets (" + bufferList.list.Length + ")", bufferList); if (foldout == false) { GUIFoldoutHeader.End(); return; } EditorGUI.indentLevel++; int bufferCount = EditorGUILayout.IntSlider("Count", bufferList.list.Length, 1, 4); if (bufferCount != bufferList.list.Length) { int oldCount = bufferList.list.Length; System.Array.Resize(ref bufferList.list, bufferCount); for (int i = oldCount; i < bufferCount; i++) { bufferList.list[i] = new BufferPreset(i); } } for (int i = 0; i < bufferList.list.Length; i++) { bool fold = GUIFoldout.Draw("Preset " + (i + 1), bufferList.list[i]); if (fold == false) { continue; } EditorGUI.indentLevel++; bufferList.list[i].name = EditorGUILayout.TextField("Name", bufferList.list[i].name); EditorGUILayout.Space(); CommonSettings(bufferList.list[i]); EditorGUILayout.Space(); if (Lighting2D.ProjectSettings.renderingMode == RenderingMode.OnRender) { SortingLayer(bufferList.list[i].sortingLayer); } EditorGUILayout.Space(); LayerSettings.DrawList(bufferList.list[i].dayLayers, "Day Layers (" + bufferList.list[i].dayLayers.list.Length + ")", Lighting2D.Profile.layers.dayLayers, true); EditorGUILayout.Space(); LayerSettings.DrawList(bufferList.list[i].nightLayers, "Night Layers (" + bufferList.list[i].nightLayers.list.Length + ")", Lighting2D.Profile.layers.nightLayers, false); EditorGUILayout.Space(); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; GUIFoldoutHeader.End(); }
static public void DrawLightLayers(LightPresetLayers presetLayers) { LayerSetting[] layerSetting = presetLayers.Get(); int layerCount = layerSetting.Length; layerCount = EditorGUILayout.IntSlider("Layer Count", layerCount, 1, 4); EditorGUILayout.Space(); if (layerCount != layerSetting.Length) { int oldCount = layerSetting.Length; System.Array.Resize(ref layerSetting, layerCount); for (int i = oldCount; i < layerCount; i++) { if (layerSetting[i] == null) { layerSetting[i] = new LayerSetting(); layerSetting[i].layerID = i; } } presetLayers.SetArray(layerSetting); } for (int i = 0; i < layerSetting.Length; i++) { LayerSetting layer = layerSetting[i]; bool foldout = GUIFoldout.Draw("Layer " + (i + 1), layer); if (foldout) { EditorGUI.indentLevel++; layer.layerID = EditorGUILayout.Popup("Layer (Light)", layer.layerID, Lighting2D.Profile.layers.lightLayers.GetNames()); layer.type = (LightLayerType)EditorGUILayout.EnumPopup("Type", layer.type); bool shadowEnabled = layer.type != LightLayerType.MaskOnly; bool maskEnabled = layer.type != LightLayerType.ShadowOnly; EditorGUILayout.Space(); layer.sorting = (LightLayerSorting)EditorGUILayout.EnumPopup("Sorting", layer.sorting); EditorGUI.BeginDisabledGroup(layer.sorting == LightLayerSorting.None); layer.sortingIgnore = (LightLayerSortingIgnore)EditorGUILayout.EnumPopup("Sorting Ignore", layer.sortingIgnore); EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(shadowEnabled == false); layer.shadowEffect = (LightLayerShadowEffect)EditorGUILayout.EnumPopup("Shadow Effect", layer.shadowEffect); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(shadowEnabled == false || layer.shadowEffect != LightLayerShadowEffect.Projected); layer.shadowEffectLayer = EditorGUILayout.Popup("Effect Layer (Light)", layer.shadowEffectLayer, Lighting2D.Profile.layers.lightLayers.GetNames()); EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(maskEnabled == false); layer.maskEffect = (LightLayerMaskEffect)EditorGUILayout.EnumPopup("Mask Effect", layer.maskEffect); EditorGUI.EndDisabledGroup(); bool maskEffectLit = (layer.maskEffect == LightLayerMaskEffect.AboveLit); EditorGUI.BeginDisabledGroup(maskEnabled == false || maskEffectLit == false); layer.maskEffectDistance = EditorGUILayout.FloatField("Mask Effect Distance", layer.maskEffectDistance); if (layer.maskEffectDistance < 0) { layer.maskEffectDistance = 0; } EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); EditorGUI.indentLevel--; } EditorGUILayout.Space(); } }