-
Notifications
You must be signed in to change notification settings - Fork 0
/
DebugWeatherUI.cs
159 lines (139 loc) · 5.39 KB
/
DebugWeatherUI.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
public class DebugWeatherUI
{
public FContainer container;
public List<FLabel> labels;
public WeatherController.WeatherSettings settings;
public int activeCounter;
public int refreshCounter;
public bool toggle;
public DebugWeatherUI()
{
container = new FContainer();
labels = new List<FLabel>();
Futile.stage.AddChild(container);
}
public void RemoveSprites()
{
container.RemoveAllChildren();
container.RemoveFromContainer();
}
public void Update()
{
activeCounter--;
if (activeCounter <= 0)
{
for (int i = 0; i < labels.Count; i++)
{
labels[i].alpha -= 0.025f;
}
}
else
{
for (int i = 0; i < labels.Count; i++)
{
labels[i].alpha += 0.025f;
labels[i].alpha = Mathf.Clamp(labels[i].alpha, 0f, 1f);
}
}
if (Input.GetKeyDown(KeyCode.F9))
{
if(toggle)
{
toggle = false;
}
else
{
toggle = true;
}
}
}
public void UpdateLabels(WeatherController.WeatherSettings settings)
{
this.settings = settings;
container.RemoveAllChildren();
labels = new List<FLabel>();
FLabel toggleLabel = new FLabel("font", "TOGGLE UI - F9\n");
labels.Add(toggleLabel);
FLabel roomHeading = new FLabel("font", $"{settings.roomName} - Weather Settings");
labels.Add(roomHeading);
if (ForecastConfig.customRegionSettings.ContainsKey(settings.regionName))
{
foreach (KeyValuePair<string, List<string>> pair in ForecastConfig.customRegionSettings[settings.regionName])
{
//GLOBAL TAGS
if (pair.Key == "GLOBAL")
{
FLabel globalTags = new FLabel("font", "Global Tags: ");
for (int i = 0; i < pair.Value.Count; i++)
{
globalTags.text += pair.Value[i] + ", ";
}
labels.Add(globalTags);
}
//ROOM TAGS
else if (pair.Key == settings.roomName)
{
FLabel roomLabel = new FLabel("font", "Room Tags: ");
for (int i = 0; i < pair.Value.Count; i++)
{
roomLabel.text += pair.Value[i] + ", ";
}
roomLabel.text += "\n";
labels.Add(roomLabel);
}
}
}
//SETTINGS
FLabel settingsLabel = new FLabel("font", "\n\n\nGENERAL:\n\n");
if(settings.currentWeather != null)
{
settingsLabel.text +=
$"Forecast:\nNow: {settings.currentWeather.type}" +
$"\nNext: {WeatherForecast.regionWeatherForecasts[settings.regionName][1]}" +
$"\nLater: {WeatherForecast.regionWeatherForecasts[settings.regionName][2]}\n\n";
}
settingsLabel.text += $"Interior: {(settings.owner.interior ? "YES" : "NO")}\n";
settingsLabel.text += $"DangerType: {settings.owner.room.roomSettings.DangerType.value}\n";
settingsLabel.text += $"Intensity: {Mathf.RoundToInt(settings.currentIntensity * 100f)}% - {(settings.weatherIntensity == 0 ? "DYNAMIC" : "FIXED")}\n";
settingsLabel.text += $"Particle Limit: {settings.particleLimit}\n";
settingsLabel.text += $"Wind Direction: {WindDir(settings.windDirection)}\n";
settingsLabel.text += $"Rain Volume: {(settings.rainVolume ? "ON" : "OFF")}\n\n";
settingsLabel.text += "VISUALS:\n";
settingsLabel.text += $"Background Collision: {(settings.backgroundCollision ? "ON" : "OFF")}\n";
settingsLabel.text += $"Water Collision: {(settings.waterCollision ? "ON" : "OFF")}\n";
settingsLabel.text += $"Dynamic Clouds: {(settings.dynamicClouds ? "ON" : "OFF")}\n";
settingsLabel.text += $"Background Lightning: {(settings.backgroundLightning ? "ON" : "OFF")}\n\n";
settingsLabel.text += $"LIGHTNING:\n";
settingsLabel.text += $"Lightning Strikes: {(settings.lightningStrikes ? "ON" : "OFF")}\n";
settingsLabel.text += $"Lightning Interval: {Mathf.RoundToInt(settings.lightningInterval)} seconds\n";
settingsLabel.text += $"Lightning Chance: {Mathf.RoundToInt(settings.lightningChance)}%\n";
settingsLabel.text += $"Lightning Color: R:{Mathf.RoundToInt(settings.strikeColor.r * 255)}, G:{Mathf.RoundToInt(settings.strikeColor.g * 255)}, B:{Mathf.RoundToInt(settings.strikeColor.b * 255)}\n";
labels.Add(settingsLabel);
for (int i = 0; i < labels.Count; i++)
{
labels[i].SetAnchor(0f, 1f);
labels[i].SetPosition(new Vector2(20.01f, 768.01f - 45f - (20f * i)));
container.AddChild(labels[i]);
}
container.MoveToFront();
}
public string WindDir(int i)
{
switch (i)
{
case 1:
return "LEFT";
case 2:
return "MID";
case 3:
return "RIGHT";
}
return "RANDOM";
}
}