Files
2026-03-04 10:03:45 +08:00

286 lines
12 KiB
C#

using UnityEngine;
namespace Artngame.SKYMASTER
{
public class SKYMASTER_DemoV34WEBGL : MonoBehaviour
{
public float Sun_time_start = 14.43f;
public GameObject SKYMASTER_OBJ;
private SkyMasterManager SUNMASTER;
public bool HUD_ON = true;
private bool set_sun_start;
private float Dome_rot;
private float Camera_up;
private float TOD;
private float SPEED;
private WaterHeightSM WaterHeightHandle;
private WaterHandlerSM WaterHandler;
private int windowsON;
public Transform windowsSpot;
public Transform underwaterSpot;
public Transform AtollViewSpot;
public Transform oceanSpot;
public Transform boatSpot;
public Transform boatSpot2;
public Transform smokeSPOT;
public GameObject farOceanplane;
private bool offsetsON;
private bool colorsON;
private void Start()
{
if (SKYMASTER_OBJ != null)
{
SUNMASTER = SKYMASTER_OBJ.GetComponent(typeof(SkyMasterManager)) as SkyMasterManager;
}
SPEED = SUNMASTER.SPEED;
SUNMASTER.Seasonal_change_auto = false;
TOD = SUNMASTER.Current_Time;
WaterHeightHandle = SUNMASTER.water.gameObject.GetComponent<WaterHeightSM>();
WaterHandler = SUNMASTER.water.gameObject.GetComponent<WaterHandlerSM>();
Dome_rot = SUNMASTER.Rot_Sun_Y;
}
private void OnGUI()
{
float num = 100f;
float num2 = 30f;
string text = "Disable HUD";
if (!HUD_ON)
{
text = "Enable HUD";
}
if (GUI.Button(new Rect(2f, 0f * num2, num - 2f, 22f), text))
{
if (HUD_ON)
{
HUD_ON = false;
}
else
{
HUD_ON = true;
}
}
float num3 = 5f;
if (!HUD_ON)
{
return;
}
GUI.TextArea(new Rect(2f, 1f * num2, 98f, 20f), "Sun Speed");
SPEED = GUI.HorizontalSlider(new Rect(2f, 1f * num2 + 25f, 98f, 30f), SPEED, 0.01f, 70f);
SUNMASTER.SPEED = SPEED;
GUI.TextArea(new Rect(2f, 1f * num2 + 50f, 98f, 20f), "Sun Intensity");
SUNMASTER.Max_sun_intensity = GUI.HorizontalSlider(new Rect(2f, 1f * num2 + 25f + 50f, 98f, 15f), SUNMASTER.Max_sun_intensity, 0.5f, 2.5f);
if ((windowsON == 0) | (windowsON == 3))
{
GUI.TextArea(new Rect(6f * (num + num3), 1f * num2 + 25f, num + 0f, 20f), "Camera height");
float leftValue = -6f;
Camera_up = GUI.HorizontalSlider(new Rect(6f * (num + num3), 1f * num2 + 25f + 25f, num + 315f, 30f), Camera.main.transform.position.y, leftValue, 1760f);
Camera.main.transform.position = new Vector3(Camera.main.transform.position.x, Camera_up, Camera.main.transform.position.z);
}
if (Camera_up > 200f)
{
if (farOceanplane.activeInHierarchy)
{
farOceanplane.SetActive(value: false);
}
}
else if (!farOceanplane.activeInHierarchy)
{
farOceanplane.SetActive(value: true);
}
GUI.TextArea(new Rect(2f * (num + num3), 1f * num2, num + 0f, 20f), "SkyDome rot");
Dome_rot = GUI.HorizontalSlider(new Rect(2f * (num + num3), 1f * num2 + 25f, num + 0f, 30f), Dome_rot, 0f, 360f);
SUNMASTER.Rot_Sun_Y = Dome_rot;
GUI.TextArea(new Rect(3f * (num + num3), 1f * num2, num + 0f, 20f), "Wind direction");
float y = GUI.HorizontalSlider(new Rect(3f * (num + num3), 1f * num2 + 25f, num + 0f, 30f), SUNMASTER.windZone.transform.eulerAngles.y, 0f, 360f);
Vector3 eulerAngles = SUNMASTER.windZone.gameObject.transform.eulerAngles;
SUNMASTER.windZone.gameObject.transform.eulerAngles = new Vector3(eulerAngles.x, y, eulerAngles.z);
GUI.TextArea(new Rect(4f * (num + num3), 1f * num2, num + 0f, 20f), "Wind intensity");
SUNMASTER.windZone.windMain = GUI.HorizontalSlider(new Rect(4f * (num + num3), 1f * num2 + 25f, num + 0f, 30f), SUNMASTER.windZone.windMain, 0f, 24f);
GUI.TextArea(new Rect(1f * (num + num3), 1f * num2, num, 20f), "Time of Day");
TOD = GUI.HorizontalSlider(new Rect(1f * (num + num3), 1f * num2 + 25f, num, 20f), SUNMASTER.Current_Time, 0f, 24f);
SUNMASTER.Current_Time = TOD;
GUI.TextArea(new Rect(5f * (num + num3), 1f * num2, num, 20f), "Wave height");
WaterHandler.waterScaleOffset.y = GUI.HorizontalSlider(new Rect(5f * (num + num3), 1f * num2 + 25f, num, 20f), WaterHandler.waterScaleOffset.y, 0f, 3f);
GUI.TextArea(new Rect(11f * (num + num3), 1f * num2 + 50f + 50f, num, 20f), "Boat Speed");
WaterHeightHandle.BoatSpeed = GUI.HorizontalSlider(new Rect(11f * (num + num3), 1f * num2 + 25f + 50f + 50f, num, 20f), WaterHeightHandle.BoatSpeed, 0.3f, 5f);
if (GUI.Button(new Rect(10f * (num + num3), 1f * num2 + 50f + 50f, num, 20f), "Reset params"))
{
WaterHandler.FresnelOffset = 0f;
WaterHandler.FresnelBias = 0f;
WaterHandler.BumpFocusOffset = 0f;
WaterHandler.DepthColorOffset = 0f;
WaterHandler.ShoreBlendOffset = 0f;
}
if (GUI.Button(new Rect(10f * (num + num3), 1f * num2 + 50f + 50f + 25f, num, 20f), "Water params"))
{
if (offsetsON)
{
offsetsON = false;
}
else
{
offsetsON = true;
}
}
if (offsetsON)
{
GUI.TextArea(new Rect(9f * (num + num3), 1f * num2 + 50f + 50f + 50f, num * 1f, 20f), "Fresnel Power");
WaterHandler.FresnelOffset = GUI.HorizontalSlider(new Rect(9f * (num + num3), 1f * num2 + 25f + 50f + 50f + 50f, num * 3f, 20f), WaterHandler.FresnelOffset, -0.5f, 1.7905f);
GUI.TextArea(new Rect(9f * (num + num3), 1f * num2 + 50f + 50f + 100f, num * 1f, 20f), "Fresnel Bias");
WaterHandler.FresnelBias = GUI.HorizontalSlider(new Rect(9f * (num + num3), 1f * num2 + 25f + 50f + 50f + 100f, num * 3f, 20f), WaterHandler.FresnelBias, -130f, 240f);
GUI.TextArea(new Rect(9f * (num + num3), 1f * num2 + 50f + 50f + 150f, num * 1f, 20f), "Specular focus");
WaterHandler.BumpFocusOffset = GUI.HorizontalSlider(new Rect(9f * (num + num3), 1f * num2 + 25f + 50f + 50f + 150f, num * 3f, 20f), WaterHandler.BumpFocusOffset, -4f, 4f);
GUI.TextArea(new Rect(9f * (num + num3), 1f * num2 + 50f + 50f + 200f, num * 1f, 20f), "Depth Offset");
WaterHandler.ShoreBlendOffset = GUI.HorizontalSlider(new Rect(9f * (num + num3), 1f * num2 + 25f + 50f + 50f + 200f, num * 3f, 20f), WaterHandler.ShoreBlendOffset, -1.155f, 1.1f);
GUI.TextArea(new Rect(9f * (num + num3), 1f * num2 + 50f + 50f + 250f, num * 1f, 20f), "Depth FX");
WaterHandler.DepthColorOffset = GUI.HorizontalSlider(new Rect(9f * (num + num3), 1f * num2 + 25f + 50f + 50f + 250f, num * 3f, 20f), WaterHandler.DepthColorOffset, -140f, 10f);
GUI.TextArea(new Rect(9f * (num + num3), 1f * num2 + 50f + 50f + 300f, num * 2f, 20f), "Shore Waves height control");
WaterHandler.ShoreWavesFade = GUI.HorizontalSlider(new Rect(9f * (num + num3), 1f * num2 + 25f + 50f + 50f + 300f, num * 3f, 20f), WaterHandler.ShoreWavesFade, 0f, 5f);
}
if (GUI.Button(new Rect(11f * (num + num3), 0f, num, 22f), "Smoke & FX") && smokeSPOT != null)
{
if (smokeSPOT.gameObject.activeInHierarchy)
{
smokeSPOT.gameObject.SetActive(value: false);
}
else
{
smokeSPOT.gameObject.SetActive(value: true);
WaterHandler.waterScaleOffset.y = 0f;
WaterHandler.waterType = WaterHandlerSM.WaterPreset.Atoll;
}
}
if ((SUNMASTER.currentWeather != null && SUNMASTER.currentWeather.currentState != WeatherSM.Volume_Weather_State.FadeIn) | (SUNMASTER.currentWeather == null))
{
if (GUI.Button(new Rect(2f * (num + num3), 0f, num, 22f), "Cloudy"))
{
SUNMASTER.currentWeatherName = SkyMasterManager.Volume_Weather_types.Cloudy;
}
if (GUI.Button(new Rect(3f * (num + num3), 0f, num, 22f), "Snow"))
{
SUNMASTER.currentWeatherName = SkyMasterManager.Volume_Weather_types.SnowStorm;
}
if (SUNMASTER.currentWeatherName != SkyMasterManager.Volume_Weather_types.Rain && SUNMASTER.currentWeatherName != SkyMasterManager.Volume_Weather_types.HeavyStorm)
{
if (GUI.Button(new Rect(4f * (num + num3), 0f, num, 22f), "Heavy Storm"))
{
SUNMASTER.currentWeatherName = SkyMasterManager.Volume_Weather_types.HeavyStorm;
}
if (GUI.Button(new Rect(5f * (num + num3), 0f, num, 22f), "Rain"))
{
SUNMASTER.currentWeatherName = SkyMasterManager.Volume_Weather_types.Rain;
}
}
}
if (windowsON == 2)
{
if (GUI.Button(new Rect(7f * (num + num3), 0f, num, 22f), "Turbulent"))
{
WaterHandler.underWaterType = WaterHandlerSM.UnderWaterPreset.Turbulent;
}
if (GUI.Button(new Rect(6f * (num + num3), 0f, num, 22f), "Calm"))
{
WaterHandler.underWaterType = WaterHandlerSM.UnderWaterPreset.Calm;
}
}
else
{
if (GUI.Button(new Rect(6f * (num + num3), 30f, num, 22f), "Caribbean"))
{
WaterHandler.waterType = WaterHandlerSM.WaterPreset.Caribbean;
}
if (GUI.Button(new Rect(6f * (num + num3), 0f, num, 22f), "Lake"))
{
WaterHandler.waterType = WaterHandlerSM.WaterPreset.Lake;
}
if (GUI.Button(new Rect(10f * (num + num3), 0f, num, 22f), "Atoll"))
{
WaterHandler.waterType = WaterHandlerSM.WaterPreset.Atoll;
}
if (GUI.Button(new Rect(9f * (num + num3), 0f, num, 22f), "Dark Ocean"))
{
WaterHandler.waterType = WaterHandlerSM.WaterPreset.DarkOcean;
}
if (GUI.Button(new Rect(8f * (num + num3), 0f, num, 22f), "Focus Ocean"))
{
WaterHandler.waterType = WaterHandlerSM.WaterPreset.FocusOcean;
}
if (GUI.Button(new Rect(7f * (num + num3), 0f, num, 22f), "Muddy Water"))
{
WaterHandler.waterType = WaterHandlerSM.WaterPreset.Muddy;
}
if (GUI.Button(new Rect(7f * (num + num3), 30f, num, 22f), "River"))
{
WaterHandler.waterType = WaterHandlerSM.WaterPreset.River;
}
if (GUI.Button(new Rect(9f * (num + num3), 30f, num, 22f), "Ocean"))
{
WaterHandler.waterType = WaterHandlerSM.WaterPreset.Ocean;
}
}
GUI.TextArea(new Rect(11f * (num + num3), 1f * num2, num, 20f), "Water detail");
WaterHandler.bumpTilingXoffset = GUI.HorizontalSlider(new Rect(11f * (num + num3), 1f * num2 + 25f, num, 20f), WaterHandler.bumpTilingXoffset, 0.02f, 0.3f);
WaterHandler.bumpTilingYoffset = WaterHandler.bumpTilingXoffset;
GUI.TextArea(new Rect(11f * (num + num3), 2f * num2 + 20f, num, 20f), "Refraction");
WaterHandler.RefractOffset = GUI.HorizontalSlider(new Rect(11f * (num + num3), 2f * num2 + 25f + 20f, num, 20f), WaterHandler.RefractOffset, -0.2f, 2f);
GUI.TextArea(new Rect(10f * (num + num3), 1f * num2, num, 20f), "Extra Waves");
WaterHandler.ExtraWavesFactor.x = GUI.HorizontalSlider(new Rect(10f * (num + num3), 1f * num2 + 25f, num, 20f), WaterHandler.ExtraWavesFactor.x, 0f, 4f);
WaterHandler.ExtraWavesFactor.y = GUI.HorizontalSlider(new Rect(10f * (num + num3), 1f * num2 + 25f + 25f, num, 20f), WaterHandler.ExtraWavesFactor.y, 0f, 1f);
WaterHandler.ExtraWavesFactor.z = GUI.HorizontalSlider(new Rect(10f * (num + num3), 1f * num2 + 25f + 25f + 25f, num, 20f), WaterHandler.ExtraWavesFactor.z, 0f, 1f);
if (GUI.Button(new Rect(0f * (num + num3), 1f * num2 + 50f + 20f + 25f, num, 20f), "Atoll colors"))
{
if (colorsON)
{
colorsON = false;
}
else
{
colorsON = true;
}
}
if (colorsON)
{
GUI.TextArea(new Rect(1f * (num + num3), 5f * num2, num + 32f, 20f), "Base Color (RGBA)");
WaterHandler.AtollWaterColor.r = GUI.HorizontalSlider(new Rect(1f * (num + num3), 5f * num2 + 25f, num, 20f), WaterHandler.AtollWaterColor.r, 0f, 4f);
WaterHandler.AtollWaterColor.g = GUI.HorizontalSlider(new Rect(1f * (num + num3), 5f * num2 + 25f + 25f, num, 20f), WaterHandler.AtollWaterColor.g, 0f, 1f);
WaterHandler.AtollWaterColor.b = GUI.HorizontalSlider(new Rect(1f * (num + num3), 5f * num2 + 25f + 25f + 25f, num, 20f), WaterHandler.AtollWaterColor.b, 0f, 1f);
WaterHandler.AtollWaterColor.a = GUI.HorizontalSlider(new Rect(1f * (num + num3), 5f * num2 + 25f + 25f + 25f + 25f, num, 20f), WaterHandler.AtollWaterColor.a, 0f, 1f);
GUI.TextArea(new Rect(1f * (num + num3), 9f * num2, num + 32f, 20f), "Reflect Color (RGBA)");
WaterHandler.AtollReflectColor.r = GUI.HorizontalSlider(new Rect(1f * (num + num3), 9f * num2 + 25f, num, 20f), WaterHandler.AtollReflectColor.r, 0f, 4f);
WaterHandler.AtollReflectColor.g = GUI.HorizontalSlider(new Rect(1f * (num + num3), 9f * num2 + 25f + 25f, num, 20f), WaterHandler.AtollReflectColor.g, 0f, 1f);
WaterHandler.AtollReflectColor.b = GUI.HorizontalSlider(new Rect(1f * (num + num3), 9f * num2 + 25f + 25f + 25f, num, 20f), WaterHandler.AtollReflectColor.b, 0f, 1f);
WaterHandler.AtollReflectColor.a = GUI.HorizontalSlider(new Rect(1f * (num + num3), 9f * num2 + 25f + 25f + 25f + 25f, num, 20f), WaterHandler.AtollReflectColor.a, 0f, 1f);
}
_ = SPEED;
_ = 1f;
if ((SUNMASTER.Current_Time != Sun_time_start) & !set_sun_start)
{
set_sun_start = true;
}
}
}
}