Files
3d-fengji/Assets/Editor/DebugTools.cs

195 lines
6.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class DebugTools
{
// 切换天气
[MenuItem("TestWeather/Sunny")]
static void Sunny()
{
GameObject.Find("Enviro 3").GetComponent<WeatherAndTime>().Sunny();
}
[MenuItem("TestWeather/Sprinkle")]
static void Sprinkle()
{
GameObject.Find("Enviro 3").GetComponent<WeatherAndTime>().Sprinkle();
}
[MenuItem("TestWeather/ModerateRain")]
static void ModerateRain()
{
GameObject.Find("Enviro 3").GetComponent<WeatherAndTime>().ModerateRain();
}
[MenuItem("TestWeather/HeavyRain")]
static void HeavyRain()
{
GameObject.Find("Enviro 3").GetComponent<WeatherAndTime>().HeavyRain();
}
[MenuItem("TestWeather/Storm")]
static void Storm()
{
GameObject.Find("Enviro 3").GetComponent<WeatherAndTime>().Storm();
}
[MenuItem("TestWeather/Snow")]
static void Snow()
{
GameObject.Find("Enviro 3").GetComponent<WeatherAndTime>().Snow();
}
[MenuItem("TestWeather/Cloudy")]
static void Cloudy()
{
GameObject.Find("Enviro 3").GetComponent<WeatherAndTime>().Cloudy();
}
//切换时间
[MenuItem("TestTime/TwoOcloak")]
static void TwoOcloak()
{
GameObject.Find("Enviro 3").GetComponent<WeatherAndTime>().SetTime(2);
}
[MenuItem("TestTime/TwelveOcloak")]
static void TwelveOcloak()
{
GameObject.Find("Enviro 3").GetComponent<WeatherAndTime>().SetTime(12);
}
[MenuItem("TestTime/realTime")]
static void realTime()
{
GameObject.Find("Enviro 3").GetComponent<WeatherAndTime>().RealTime();
}
//声音控制
[MenuItem("AudioManage/Mute")]
static void Mute()
{
GameObject.Find("AudioManage").GetComponent<Mute>().GlobalMute();
}
[MenuItem("AudioManage/UnMute")]
static void UnMute()
{
GameObject.Find("AudioManage").GetComponent<Mute>().UnMute();
}
//视角切换
[MenuItem("SwitchView/SwitchToWorkerView")]
static void SwitchToWorkerView()
{
//禁用游戏对象改为禁用组件
GameObject.Find("Main Camera").GetComponent<Camera>().enabled = false;
GameObject.Find("Main Camera").GetComponent<ControlMoving>().enabled = false;
GameObject.Find("Main Camera").GetComponent<DoubleClickToFocus>().enabled = false;
foreach (Transform child in GameObject.Find("Worker").transform)
{
child.gameObject.SetActive(true);
}
for (int i = 0; i < GameObject.Find("ICONS").transform.childCount; i++)
{
GameObject.Find("ICONS").transform.GetChild(i).transform.localScale = Vector3.one * 0.5f;//工人视角下重置大小
}
}
[MenuItem("SwitchView/SwitchToFreeView")]
static void SwitchToFreeView()
{
//禁用游戏对象改为禁用组件
GameObject.Find("Main Camera").GetComponent<Camera>().enabled = true;
GameObject.Find("Main Camera").GetComponent<ControlMoving>().enabled = true;
GameObject.Find("Main Camera").GetComponent<DoubleClickToFocus>().enabled = true;
foreach (Transform child in GameObject.Find("Worker").transform)
{
child.gameObject.SetActive(false);
}
}
[MenuItem("Copy/CopyPosition")]
static void CopyPosition()
{
PointPosInfo[] pointDataArray = new PointPosInfo[]
{
new PointPosInfo("sb_wuxianqingjiaoji001", new Vector3(-35.69f, 62.82f, -12.18f)),
new PointPosInfo("sb_wuxianqingjiaoji002", new Vector3(-39.52f, 62.94f, -14.66f)),
new PointPosInfo("sb_wuxianqingjiaoji003", new Vector3(-35.82f, 63f, -16.84f)),
new PointPosInfo("sb_wuxianqingjiaoji004", new Vector3(-121.8f, 18f, -74.3f)),
new PointPosInfo("sb_gnss001", new Vector3(-27.6f, 52f, -18.12f)),
new PointPosInfo("sb_gnss002", new Vector3(-68f, 20.6f, -60f)),
new PointPosInfo("sb_gnss003", new Vector3(-18.4f, 19.5f, -35f)),
new PointPosInfo("sb_gnss004", new Vector3(-28.8f, 20.4f, -23.5f)),
new PointPosInfo("sb_liefengji001", new Vector3(-82f, 17.87f, -70.26f)),
new PointPosInfo("sb_liefengji002", new Vector3(-70.2f, 18f, -58.4f)),
new PointPosInfo("sb_liefengji003", new Vector3(-55.84f, 18.145f, -47.3f)),
new PointPosInfo("sb_liefengji004", new Vector3(-42.8f, 18.25f, -35.47f)),
new PointPosInfo("sb_liefengji005", new Vector3(-30.5f, 18f, -22.5f)),
new PointPosInfo("sb_yachashi001", new Vector3(-25f, 50.28f, -17.22f)),
new PointPosInfo("sb_yachashi002", new Vector3(-36.94f, 50.28f, -10.91f)),
new PointPosInfo("sb_yachashi003", new Vector3(-36.97f, 50.28f, -18.37f)),
new PointPosInfo("sb_yachashi004", new Vector3(-33.5f, 50.28f, -14.65f)),
new PointPosInfo("sb_yachashi005", new Vector3(-40.59f, 50.28f, -14.65f)),
new PointPosInfo("sb_yingbianji001", new Vector3(-37.96f, 73.14f, -12f)),
new PointPosInfo("sb_yingbianji002", new Vector3(-39.83f, 73f, -14.74f)),
new PointPosInfo("sb_yingbianji003", new Vector3(-37.86f, 73f, -17f)),
new PointPosInfo("sb_yingbianji004", new Vector3(-35f, 73.14f, -16.23f)),
new PointPosInfo("sb_yingbianji005", new Vector3(-34.88f, 73f, -13.06f)),
new PointPosInfo("sb_fengjizhendong001", new Vector3(-34.38f, 118.09f, -14.05f)),
new PointPosInfo("sb_fengjizhendong002", new Vector3(-34.52f, 118.09f, -15.17f)),
new PointPosInfo("sb_yulaingji001", new Vector3(-103.65f, 29.63f, 125.45f)),
new PointPosInfo("sb_wenshiya001", new Vector3(-106.73f, 29.08f, 125.36f)),
new PointPosInfo("sb_qixiangfengxiang001", new Vector3(-105.29f, 29.16f, 127.22f)),
new PointPosInfo("sb_qixiangfengsu001", new Vector3(-104.87f, 29.06f, 123.55f)),
new PointPosInfo("全部ViewPort", new Vector3(16f, 113f, -167f)),
new PointPosInfo("沉降监测ViewPort", new Vector3(16f, 113f, -167f)),
new PointPosInfo("振动加速度ViewPort", new Vector3(16f, 113f, -167f)),
new PointPosInfo("应变监测ViewPort", new Vector3(16f, 113f, -167f)),
new PointPosInfo("裂缝监测ViewPort", new Vector3(16f, 113f, -167f)),
new PointPosInfo("倾角监测ViewPort", new Vector3(16f, 113f, -167f)),
new PointPosInfo("气象监测ViewPort", new Vector3(16f, 113f, -167f)),
new PointPosInfo("流量监测ViewPort", new Vector3(16f, 113f, -167f)),
};
foreach (var item in pointDataArray)
{
GameObject obj = new GameObject(item.SNWithdeviceName);
obj.transform.SetParent(GameObject.Find("CameraParkingPosition").transform);
obj.transform.position = item.localPosition;
}
}
struct PointPosInfo
{
public string SNWithdeviceName;
public Vector3 localPosition;
public PointPosInfo(string sn, Vector3 pos)
{
SNWithdeviceName = sn;
localPosition = pos;
}
}
}