unityzgy/Assets/ThirdPackages/Enviro - Sky and Weather/Enviro Standard/Scripts/Editor/EnviroVolumeLightEditor.cs
ayuan9957 bf12e02276 feat: 多语言本地化系统 - 支持中/英/法/俄实时切换
- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg)
- LoginPanel: InputField placeholder本地化、字体颜色保持
- HistoryPanel: 用时数据本地化、placeholder本地化
- RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建)
- AppraiseWindowBase: 评价等级本地化、操作消息重建
- EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized
- StudentOperateRecorder: 新增InjectOperateMsgLocalized方法
- LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选
- 字体切换时保留颜色和verticalOverflow
2026-07-16 10:05:59 +08:00

99 lines
3.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(EnviroVolumeLight))]
[CanEditMultipleObjects]
public class EnviroVolumeLightEditor : Editor
{
private GUIStyle boxStyle;
private GUIStyle wrapStyle;
private GUIStyle headerStyle;
private EnviroVolumeLight myTarget;
SerializedProperty SampleCount, ScatteringCoef, ExtinctionCoef, Anistropy, Noise, scaleWithTime;
void OnEnable()
{
myTarget = serializedObject.targetObject as EnviroVolumeLight;
SampleCount = serializedObject.FindProperty("SampleCount");
scaleWithTime = serializedObject.FindProperty("scaleWithTime");
ScatteringCoef = serializedObject.FindProperty("ScatteringCoef");
ExtinctionCoef = serializedObject.FindProperty("ExtinctionCoef");
Anistropy = serializedObject.FindProperty("Anistropy");
Noise = serializedObject.FindProperty("Noise");
}
public override void OnInspectorGUI()
{
if (boxStyle == null)
{
boxStyle = new GUIStyle(GUI.skin.box);
boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
boxStyle.fontStyle = FontStyle.Bold;
boxStyle.alignment = TextAnchor.UpperLeft;
}
if (wrapStyle == null)
{
wrapStyle = new GUIStyle(GUI.skin.label);
wrapStyle.fontStyle = FontStyle.Normal;
wrapStyle.wordWrap = true;
}
if (headerStyle == null)
{
headerStyle = new GUIStyle(GUI.skin.label);
headerStyle.fontStyle = FontStyle.Bold;
headerStyle.wordWrap = true;
}
#if UNITY_5_6_OR_NEWER
serializedObject.UpdateIfRequiredOrScript();
#else
serializedObject.UpdateIfDirtyOrScript();
#endif
EditorGUI.BeginChangeCheck();
GUILayout.BeginVertical("Enviro - Volume Light", boxStyle);
GUILayout.Space(20);
EditorGUILayout.LabelField("This component adds volume lighting effects to your scene lights!", wrapStyle);
GUILayout.EndVertical();
if (myTarget != null)
{
if (myTarget.GetComponent<Light>() == null)
{
EditorGUILayout.LabelField("No Light found on this gameobject. Please add Point or Spot Light!", wrapStyle);
}
else if (myTarget.GetComponent<Light>().type == LightType.Directional)
{
GUILayout.BeginVertical("", boxStyle);
EditorGUILayout.LabelField("Please control directional light directly in EnviroSky Manager -> Lighting category!", wrapStyle);
GUILayout.EndVertical();
}
else
{
GUILayout.BeginVertical("Settings", boxStyle);
GUILayout.Space(20);
EditorGUILayout.PropertyField(SampleCount, true, null);
GUILayout.Space(10);
EditorGUILayout.LabelField("Light Settings", headerStyle);
EditorGUILayout.PropertyField(scaleWithTime, true, null);
EditorGUILayout.PropertyField(ScatteringCoef, true, null);
EditorGUILayout.PropertyField(ExtinctionCoef, true, null);
EditorGUILayout.PropertyField(Anistropy, true, null);
GUILayout.Space(10);
EditorGUILayout.PropertyField(Noise, true, null);
GUILayout.EndVertical();
}
}
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
}
}
}