You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
273 lines
12 KiB
273 lines
12 KiB
using AX.PlaneTools; |
|
using UnityEditor; |
|
using UnityEditor.Animations; |
|
using UnityEngine; |
|
|
|
public class PlanTools : EditorWindow |
|
{ |
|
[MenuItem("Tools/预案制作工具")] |
|
static void PlanningToolsWindow() |
|
{ |
|
var window = (PlanTools)EditorWindow.GetWindow(typeof(PlanTools), true, "Standard Plan Tools V5.1.0"); |
|
GameManager.LoadConfig(); |
|
window.Show(); |
|
} |
|
//定义滑条 |
|
private Vector2 UIScrollow; |
|
|
|
private void OnEnable() |
|
{ |
|
PlanToolsEditor._productName = PlayerSettings.productName; |
|
if (Camera.main) |
|
PlanToolsEditor.MainCamera = Camera.main.gameObject; |
|
|
|
PlanToolsEditor.GetInitAngele(); |
|
} |
|
|
|
void OnGUI() |
|
{ |
|
UIScrollow = EditorGUILayout.BeginScrollView(UIScrollow, false, false); |
|
#region 设置单位名称 |
|
EditorGUILayout.Space(); |
|
PlanToolsEditor.isPlayerSetting = GUILayout.Toggle(PlanToolsEditor.isPlayerSetting, "产品名称", EditorStyles.foldout); |
|
if (PlanToolsEditor.isPlayerSetting) |
|
{ |
|
GUILayout.BeginVertical("Box"); |
|
EditorGUILayout.Space(); |
|
GUILayout.BeginHorizontal(); |
|
GUILayout.Label("单位名称:"); |
|
PlanToolsEditor._productName = EditorGUILayout.TextField(PlanToolsEditor._productName); |
|
GUILayout.EndHorizontal(); |
|
EditorGUILayout.Space(); |
|
if (GUILayout.Button("Set")) |
|
{ |
|
PlayerSettings.productName = PlanToolsEditor._productName; |
|
} |
|
GUILayout.EndVertical(); |
|
} |
|
#endregion |
|
#region 存储设置 |
|
EditorGUILayout.Space(); |
|
PlanToolsEditor.isShowStroe = GUILayout.Toggle(PlanToolsEditor.isShowStroe, "存储设置", EditorStyles.foldout); |
|
if (PlanToolsEditor.isShowStroe) |
|
{ |
|
GUILayout.BeginVertical("Box"); |
|
|
|
GUILayout.BeginHorizontal("Box"); |
|
GUILayout.Label("存储地址(必填):"); |
|
Config.ServerAddress = EditorGUILayout.TextField(Config.ServerAddress); |
|
GUILayout.EndHorizontal(); |
|
|
|
GUILayout.BeginHorizontal("Box"); |
|
GUILayout.Label("单位区域(必填):"); |
|
Config.AreaName = EditorGUILayout.TextField(Config.AreaName); |
|
GUILayout.EndHorizontal(); |
|
|
|
GUILayout.BeginHorizontal("Box"); |
|
GUILayout.Label("单位名称(必填):"); |
|
Config.CompanyName = EditorGUILayout.TextField(Config.CompanyName); |
|
GUILayout.EndHorizontal(); |
|
|
|
GUILayout.BeginHorizontal("Box"); |
|
EditorGUILayout.LabelField($"存储路径预览:{Config.ServerAddress}/{Config.BucketName}/{Config.AreaName}/{Config.CompanyName}/File", new GUIStyle() { normal = new GUIStyleState() { textColor = Color.green } }); |
|
GUILayout.EndHorizontal(); |
|
|
|
EditorGUILayout.Space(5); |
|
if (GUILayout.Button("保存")) |
|
{ |
|
GameManager.SaveConfig(); |
|
} |
|
GUILayout.EndVertical(); |
|
} |
|
#endregion |
|
#region 模型初始角度 |
|
EditorGUILayout.Space(); |
|
PlanToolsEditor.isInitAngele = GUILayout.Toggle(PlanToolsEditor.isInitAngele, "模型旋转角度", EditorStyles.foldout); |
|
if (PlanToolsEditor.isInitAngele) |
|
{ |
|
GUILayout.BeginVertical("Box"); |
|
GUILayout.BeginHorizontal(); |
|
GUILayout.Label("角度:"); |
|
PlanToolsEditor.InitAngele = EditorGUILayout.Slider(PlanToolsEditor.InitAngele, -360, 360); |
|
if (GUILayout.Button("GET")) |
|
{ |
|
PlanToolsEditor.GetInitAngele(); |
|
} |
|
if (GUILayout.Button("SET")) |
|
{ |
|
PlanToolsEditor.SetInitAngele(); |
|
} |
|
GUILayout.EndHorizontal(); |
|
GUILayout.EndVertical(); |
|
} |
|
#endregion |
|
#region 摄影机位置 |
|
EditorGUILayout.Space(); |
|
PlanToolsEditor.isSetCamera = GUILayout.Toggle(PlanToolsEditor.isSetCamera, "摄影机角度", EditorStyles.foldout); |
|
if (PlanToolsEditor.isSetCamera) |
|
{ |
|
GUILayout.BeginVertical("Box"); |
|
EditorGUILayout.Space(); |
|
PlanToolsEditor.MainCamera = EditorGUILayout.ObjectField("摄影机:", PlanToolsEditor.MainCamera, typeof(GameObject), true) as GameObject; |
|
EditorGUILayout.Space(); |
|
GUILayout.BeginVertical("Box"); |
|
PlanToolsEditor.CamPostion = EditorGUILayout.Vector3Field("摄影机位置", PlanToolsEditor.CamPostion); |
|
PlanToolsEditor.CamRotation = EditorGUILayout.Vector3Field("摄影机旋转", PlanToolsEditor.CamRotation); |
|
PlanToolsEditor.CamDistance = EditorGUILayout.FloatField("Distance", PlanToolsEditor.CamDistance); |
|
PlanToolsEditor.CamXY = EditorGUILayout.Vector2Field("XY", PlanToolsEditor.CamXY); |
|
PlanToolsEditor.TargetPosition = EditorGUILayout.Vector3Field("目标点位置", PlanToolsEditor.TargetPosition); |
|
GUILayout.EndVertical(); |
|
/////////////////////////////初始镜头 |
|
GUILayout.BeginVertical("Box"); |
|
if (GUILayout.Button("获取位置")) { PlanToolsEditor.GetCameraParameter(); } |
|
GUILayout.BeginHorizontal(); |
|
if (GUILayout.Button("初始位置")) { PlanToolsEditor.SetInitializationCamera(); } |
|
if (GUILayout.Button("高度")) { PlanToolsEditor.SetHeightCamera(); } |
|
if (GUILayout.Button("毗邻")) { PlanToolsEditor.SetAdjacentCamera(); } |
|
GUILayout.EndHorizontal(); |
|
GUILayout.EndVertical(); |
|
GUILayout.EndVertical();//SetCameraEnd |
|
} |
|
#endregion |
|
#region 常用名称 |
|
EditorGUILayout.Space(); |
|
PlanToolsEditor.isCommonNames = GUILayout.Toggle(PlanToolsEditor.isCommonNames, "常用名称", EditorStyles.foldout); |
|
if (PlanToolsEditor.isCommonNames) |
|
{ |
|
GUILayout.BeginVertical("Box"); |
|
GUILayout.BeginHorizontal("Box"); |
|
if (GUILayout.Button("防火分区组")) |
|
{ |
|
PlanToolsEditor.CommonNames("FireCompartments"); |
|
} |
|
if (GUILayout.Button("防火门组")) |
|
{ |
|
PlanToolsEditor.CommonNames("FireDoors"); |
|
} |
|
if (GUILayout.Button("防火卷帘组")) |
|
{ |
|
PlanToolsEditor.CommonNames("FireShutters"); |
|
} |
|
if (GUILayout.Button("室内消火栓组")) |
|
{ |
|
PlanToolsEditor.CommonNames("Hydrants"); |
|
} |
|
GUILayout.EndHorizontal(); |
|
GUILayout.EndVertical(); |
|
} |
|
#endregion |
|
#region 防火设计 |
|
EditorGUILayout.Space(); |
|
PlanToolsEditor.isFireDesign = GUILayout.Toggle(PlanToolsEditor.isFireDesign, "防火设计", EditorStyles.foldout); |
|
if (PlanToolsEditor.isFireDesign) |
|
{ |
|
GUILayout.BeginVertical("Box"); |
|
GUILayout.BeginVertical("Box"); |
|
PlanToolsEditor.fireDesignMode = (FireDesignMode)EditorGUILayout.EnumPopup("类型", PlanToolsEditor.fireDesignMode); |
|
GUILayout.EndVertical(); |
|
EditorGUILayout.Space(); |
|
GUILayout.BeginVertical("Box"); |
|
switch (PlanToolsEditor.fireDesignMode) |
|
{ |
|
case FireDesignMode.避难层: |
|
if (GUILayout.Button("Set")) |
|
{ |
|
PlanToolsEditor.SetRefugeFloor(); |
|
Debug.Log("---->避难层设置成功!"); |
|
} |
|
break; |
|
case FireDesignMode.防火分区: |
|
if (GUILayout.Button("Set")) |
|
{ |
|
PlanToolsEditor.SetFireZones(); |
|
Debug.Log("---->防火分区设置成功!"); |
|
} |
|
break; |
|
case FireDesignMode.防火门: |
|
PlanToolsEditor.FireDoorDefaultColor = EditorGUILayout.ColorField("开始颜色", PlanToolsEditor.FireDoorDefaultColor); |
|
PlanToolsEditor.FireDoorActiveColor = EditorGUILayout.ColorField("结束颜色", PlanToolsEditor.FireDoorActiveColor); |
|
if (GUILayout.Button("Set")) |
|
{ |
|
PlanToolsEditor.SetFireDoors(); |
|
Debug.Log("---->防火门设置成功!"); |
|
} |
|
break; |
|
case FireDesignMode.防火卷帘: |
|
PlanToolsEditor.FireShutterDefaultColor = EditorGUILayout.ColorField("开始颜色", PlanToolsEditor.FireShutterDefaultColor); |
|
PlanToolsEditor.FireShutterActiveColor = EditorGUILayout.ColorField("结束颜色", PlanToolsEditor.FireShutterActiveColor); |
|
if (GUILayout.Button("Set")) |
|
{ |
|
PlanToolsEditor.SetFireShutters(); |
|
Debug.Log("---->防火卷帘设置成功!"); |
|
} |
|
break; |
|
} |
|
GUILayout.EndVertical(); |
|
GUILayout.EndVertical(); |
|
} |
|
#endregion |
|
#region 供水系统 |
|
EditorGUILayout.Space(); |
|
PlanToolsEditor.isWaterSupply = GUILayout.Toggle(PlanToolsEditor.isWaterSupply, "供水系统", EditorStyles.foldout); |
|
if (PlanToolsEditor.isWaterSupply) |
|
{ |
|
GUILayout.BeginVertical("Box"); |
|
GUILayout.BeginVertical("Box"); |
|
PlanToolsEditor.waterMode = (WaterMode)EditorGUILayout.EnumPopup("类型", PlanToolsEditor.waterMode); |
|
GUILayout.EndVertical(); |
|
EditorGUILayout.Space(); |
|
GUILayout.BeginVertical("Box"); |
|
switch (PlanToolsEditor.waterMode) |
|
{ |
|
|
|
case WaterMode.室内消火栓: |
|
PlanToolsEditor.HydrantController = EditorGUILayout.ObjectField("Animator:", PlanToolsEditor.HydrantController, typeof(AnimatorController), true) as AnimatorController; |
|
if (GUILayout.Button("Set")) { PlanToolsEditor.OnIndoorHydrants(); } |
|
break; |
|
case WaterMode.消防泵: |
|
PlanToolsEditor.PumpDefaultColor = EditorGUILayout.ColorField("开始颜色", PlanToolsEditor.PumpDefaultColor); |
|
PlanToolsEditor.PumpActiveColor = EditorGUILayout.ColorField("结束颜色", PlanToolsEditor.PumpActiveColor); |
|
if (GUILayout.Button("Set")) |
|
{ |
|
PlanToolsEditor.OnFirePump(); |
|
Debug.Log("---->消防泵设置成功!"); |
|
} |
|
break; |
|
} |
|
GUILayout.EndVertical(); |
|
GUILayout.EndVertical(); |
|
} |
|
#endregion |
|
#region 疏散系统 |
|
EditorGUILayout.Space(); |
|
PlanToolsEditor.isEvacuation = GUILayout.Toggle(PlanToolsEditor.isEvacuation, "疏散系统", EditorStyles.foldout); |
|
if (PlanToolsEditor.isEvacuation) |
|
{ |
|
GUILayout.BeginVertical("Box"); |
|
GUILayout.BeginVertical("Box"); |
|
PlanToolsEditor.evacuationMode = (EvacuationMode)EditorGUILayout.EnumPopup("类型", PlanToolsEditor.evacuationMode); |
|
GUILayout.EndVertical(); |
|
EditorGUILayout.Space(); |
|
GUILayout.BeginVertical("Box"); |
|
switch (PlanToolsEditor.evacuationMode) |
|
{ |
|
case EvacuationMode.安全出口: |
|
if (GUILayout.Button("Set")) { PlanToolsEditor.OnFireEscape(); } |
|
break; |
|
case EvacuationMode.疏散楼梯: |
|
if (GUILayout.Button("Set")) { PlanToolsEditor.OnEscapeStair(); } |
|
break; |
|
case EvacuationMode.消防电梯: |
|
if (GUILayout.Button("Set")) { PlanToolsEditor.OnFireElevator(); } |
|
break; |
|
|
|
} |
|
GUILayout.EndVertical(); |
|
GUILayout.EndVertical(); |
|
} |
|
#endregion |
|
//滑条结束,所有包含在滑条内的UI在此之上 |
|
EditorGUILayout.EndScrollView(); |
|
} |
|
|
|
}
|
|
|