Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
UIMapPreview Class Reference
Inheritance diagram for UIMapPreview:
EMono

Classes

class  GenThread
 

Public Member Functions

void GenerateMap (ZoneBlueprint bp)
 
void CheckThread ()
 
void SetMap (Map _map)
 
void UpdateMap (int x, int z)
 
void UpdateMap (List< Cell > newPoints)
 
void _RefreshPoint (int x, int z, bool apply=true)
 

Public Attributes

Color colorDefault
 
Color colorWater
 
Color colorSurround
 
Color colorEdge
 
Color colorFog
 
Color colorSky
 
Color colorStairs
 
Color colorVoid
 
Color colorVoidWorld
 
Material matMap
 
RawImage image
 
UIButton button
 
int Size
 
int offsetX
 
int offsetZ
 
FilterMode filter = FilterMode.Bilinear
 
Map map
 
bool monoColor
 
bool createNewMaterial
 
bool limitBounds
 
GenThread thread
 
float voidAlpha
 
float minColor
 
float maxColor
 

Private Member Functions

void Awake ()
 

Private Attributes

Texture texDefault
 
Texture2D tex
 
Color[] px
 
Cell[,] cells
 

Additional Inherited Members

- Static Public Member Functions inherited from EMono
static int rnd (int a)
 
- Static Public Attributes inherited from EMono
static Core core
 
- Properties inherited from EMono
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 7 of file UIMapPreview.cs.

Member Function Documentation

◆ _RefreshPoint()

void UIMapPreview._RefreshPoint ( int  x,
int  z,
bool  apply = true 
)
inline

Definition at line 212 of file UIMapPreview.cs.

213 {
214 if (x >= EMono._map.Size || z >= EMono._map.Size)
215 {
216 return;
217 }
218 Cell cell = cells[x, z];
219 int num = x;
220 int num2 = z;
221 if (limitBounds)
222 {
223 num = x - EMono._map.bounds.x + offsetX;
224 num2 = z - EMono._map.bounds.z + offsetZ;
225 }
226 int num3 = num2 * Size + num;
227 if (num3 >= px.Length || num3 < 0)
228 {
229 return;
230 }
231 if (monoColor)
232 {
233 if (!cell.isSeen)
234 {
235 px[num3] = colorSurround;
236 }
237 else if (cell.isSurrounded)
238 {
239 px[num3] = colorSurround;
240 }
241 else if (cell.IsTopWater)
242 {
243 px[num3] = colorWater;
244 }
245 else if (cell.HasBlock)
246 {
247 px[num3] = colorEdge;
248 }
249 else
250 {
251 px[num3] = colorDefault;
252 }
253 }
254 else if (!cell.isSeen)
255 {
256 px[num3] = colorSurround;
257 }
258 else if (cell.HasZoneStairs())
259 {
260 px[num3] = colorStairs;
261 }
262 else if (cell.isSurrounded)
263 {
264 px[num3] = colorSurround;
265 }
266 else if (cell.HasBlock)
267 {
268 px[num3] = cell.matBlock.GetColor();
269 }
270 else
271 {
272 SourceMaterial.Row row = ((cell.bridgeHeight != 0) ? cell.matBridge : cell.matFloor);
273 if (!Application.isEditor && !EMono._zone.IsRegion && cell.IsSnowTile)
274 {
275 row = MATERIAL.sourceSnow;
276 }
277 Color color = (cell.IsSky ? colorSky : row.GetColor());
278 if (row.id == 0 && EMono._zone.IsRegion)
279 {
280 color = colorVoidWorld;
281 }
282 if (color.r > maxColor)
283 {
284 color.r = maxColor;
285 }
286 else if (color.r < minColor)
287 {
288 color.r = minColor;
289 }
290 if (color.g > maxColor)
291 {
292 color.g = maxColor;
293 }
294 else if (color.g < minColor)
295 {
296 color.g = minColor;
297 }
298 if (color.b > maxColor)
299 {
300 color.b = maxColor;
301 }
302 else if (color.b < minColor)
303 {
304 color.b = minColor;
305 }
306 px[num3] = color;
307 }
308 if (cell.isSeen)
309 {
310 if (cell.HasBlock)
311 {
312 px[num3] *= 0.4f;
313 }
314 else if (cell.room != null)
315 {
316 px[num3] *= 0.9f;
317 }
318 }
319 if (!EMono._map.bounds.Contains(x, z))
320 {
321 px[num3].a = voidAlpha;
322 }
323 else
324 {
325 px[num3].a = 1f;
326 }
327 if (apply)
328 {
329 tex.SetPixel(num, num2, px[num3]);
330 }
331 }
Definition: Cell.cs:7
Room room
Definition: Cell.cs:102
bool IsSnowTile
Definition: Cell.cs:782
SourceMaterial.Row matBlock
Definition: Cell.cs:1030
bool HasBlock
Definition: Cell.cs:643
SourceMaterial.Row matBridge
Definition: Cell.cs:1034
bool IsTopWater
Definition: Cell.cs:700
SourceMaterial.Row matFloor
Definition: Cell.cs:1032
bool isSeen
Definition: Cell.cs:282
bool isSurrounded
Definition: Cell.cs:234
bool HasZoneStairs(bool includeLocked=true)
Definition: Cell.cs:1713
Definition: EMono.cs:4
static Zone _zone
Definition: EMono.cs:19
static Map _map
Definition: EMono.cs:17
static SourceMaterial.Row sourceSnow
Definition: MATERIAL.cs:33
int Size
Definition: MapBounds.cs:20
bool Contains(int dx, int dz)
Definition: MapBounds.cs:38
MapBounds bounds
Definition: Map.cs:52
virtual bool IsRegion
Definition: Spatial.cs:501
Color colorSurround
Definition: UIMapPreview.cs:39
float maxColor
Definition: UIMapPreview.cs:92
Color colorDefault
Definition: UIMapPreview.cs:35
Color colorEdge
Definition: UIMapPreview.cs:41
Cell[,] cells
Definition: UIMapPreview.cs:65
bool limitBounds
Definition: UIMapPreview.cs:84
Color colorStairs
Definition: UIMapPreview.cs:47
Color colorSky
Definition: UIMapPreview.cs:45
Color colorVoidWorld
Definition: UIMapPreview.cs:51
Color[] px
Definition: UIMapPreview.cs:63
Color colorWater
Definition: UIMapPreview.cs:37
float voidAlpha
Definition: UIMapPreview.cs:88
Texture2D tex
Definition: UIMapPreview.cs:61
float minColor
Definition: UIMapPreview.cs:90

References EMono._map, EMono._zone, Map.bounds, cells, Color, colorDefault, colorEdge, colorSky, colorStairs, colorSurround, colorVoidWorld, colorWater, MapBounds.Contains(), SourceMaterial.Row.GetColor(), Cell.HasBlock, Cell.HasZoneStairs(), SourceMaterial.Row.id, Spatial.IsRegion, Cell.isSeen, Cell.IsSnowTile, Cell.isSurrounded, Cell.IsTopWater, limitBounds, Cell.matBlock, Cell.matBridge, Cell.matFloor, maxColor, minColor, monoColor, offsetX, offsetZ, px, Cell.room, MapBounds.Size, Size, MATERIAL.sourceSnow, tex, and voidAlpha.

Referenced by SetMap(), and UpdateMap().

◆ Awake()

void UIMapPreview.Awake ( )
inlineprivate

Definition at line 94 of file UIMapPreview.cs.

95 {
96 if ((bool)image)
97 {
98 texDefault = image.texture;
99 }
100 }
RawImage image
Definition: UIMapPreview.cs:55
Texture texDefault
Definition: UIMapPreview.cs:59

References image, and texDefault.

◆ CheckThread()

void UIMapPreview.CheckThread ( )
inline

Definition at line 129 of file UIMapPreview.cs.

130 {
131 if (thread.done)
132 {
134 CancelInvoke();
135 }
136 }
void SetMap(Map _map)
GenThread thread
Definition: UIMapPreview.cs:86

References UIMapPreview.GenThread.bp, UIMapPreview.GenThread.done, ZoneBlueprint.map, SetMap(), and thread.

◆ GenerateMap()

void UIMapPreview.GenerateMap ( ZoneBlueprint  bp)
inline

Definition at line 102 of file UIMapPreview.cs.

103 {
104 if (thread == null)
105 {
106 thread = new GenThread();
107 thread.Init();
108 }
109 else
110 {
111 if (!thread.done)
112 {
113 return;
114 }
115 image.texture = texDefault;
116 thread.Reset();
117 }
118 thread.bp.genSetting = bp.genSetting;
119 thread.bp.zoneProfile = bp.zoneProfile;
120 thread.bp.genSetting.seed = EMono.rnd(20000);
121 ThreadPool.QueueUserWorkItem(delegate
122 {
123 thread.Start();
124 });
125 CancelInvoke();
126 InvokeRepeating("CheckThread", 0f, 0.1f);
127 }
static int rnd(int a)
Definition: EMono.cs:47
ZoneProfile zoneProfile
MapGenSetting genSetting

References UIMapPreview.GenThread.done, ZoneBlueprint.genSetting, UIMapPreview.GenThread.Init(), UIMapPreview.GenThread.Reset(), EMono.rnd(), UIMapPreview.GenThread.Start(), texDefault, thread, and ZoneBlueprint.zoneProfile.

Referenced by LayerEmbark.RerollPreviewMap().

◆ SetMap()

void UIMapPreview.SetMap ( Map  _map)
inline

Definition at line 138 of file UIMapPreview.cs.

139 {
140 map = _map;
141 if (_map == null)
142 {
143 image.texture = texDefault;
144 return;
145 }
146 cells = map.cells;
147 int num = (Size = ((!limitBounds) ? map.Size : ((map.bounds.Width > map.bounds.Height) ? map.bounds.Width : map.bounds.Height)));
148 offsetX = ((map.bounds.Width <= map.bounds.Height) ? ((num - _map.bounds.Width) / 2) : 0);
149 offsetZ = ((map.bounds.Width > map.bounds.Height) ? ((num - _map.bounds.Height) / 2) : 0);
150 px = new Color[Size * Size];
151 if ((bool)tex)
152 {
153 UnityEngine.Object.DestroyImmediate(tex);
154 }
155 tex = new Texture2D(Size, Size)
156 {
157 filterMode = filter,
158 wrapMode = TextureWrapMode.Clamp
159 };
160 for (int i = 0; i < Size * Size; i++)
161 {
162 px[i].a = voidAlpha;
163 }
164 tex.SetPixels(px);
165 if (limitBounds)
166 {
167 for (int j = 0; j < map.bounds.Height; j++)
168 {
169 for (int k = 0; k < map.bounds.Width; k++)
170 {
171 _RefreshPoint(map.bounds.x + k, map.bounds.z + j, apply: false);
172 }
173 }
174 }
175 else
176 {
177 for (int l = 0; l < Size; l++)
178 {
179 for (int m = 0; m < Size; m++)
180 {
181 _RefreshPoint(m, l, apply: false);
182 }
183 }
184 }
185 tex.SetPixels(px);
186 tex.Apply();
187 if ((bool)matMap)
188 {
189 matMap.SetTexture("_MainTex", tex);
190 }
191 if ((bool)image)
192 {
193 image.texture = tex;
194 }
195 }
int Width
Definition: MapBounds.cs:26
int x
Definition: MapBounds.cs:8
int Height
Definition: MapBounds.cs:28
Cell[,] cells
Definition: Map.cs:85
FilterMode filter
Definition: UIMapPreview.cs:76
void _RefreshPoint(int x, int z, bool apply=true)
Material matMap
Definition: UIMapPreview.cs:53

References EMono._map, _RefreshPoint(), Map.bounds, Map.cells, cells, Color, filter, MapBounds.Height, image, limitBounds, map, matMap, offsetX, offsetZ, px, MapBounds.Size, Size, tex, texDefault, voidAlpha, MapBounds.Width, MapBounds.x, and MapBounds.z.

Referenced by CheckThread(), WidgetMinimap.OnActivate(), LayerEmbark.OnAfterAddLayer(), LayerEmbark.OnClickPreview(), WidgetMinimap.OnMoveZone(), WidgetMinimap.OnSetContextMenu(), WidgetMinimap.Reload(), and WidgetMinimap.UpdateMap().

◆ UpdateMap() [1/2]

void UIMapPreview.UpdateMap ( int  x,
int  z 
)
inline

Definition at line 197 of file UIMapPreview.cs.

198 {
199 _RefreshPoint(x, z);
200 tex.Apply();
201 }

References _RefreshPoint(), and tex.

Referenced by WidgetMinimap.UpdateMap().

◆ UpdateMap() [2/2]

void UIMapPreview.UpdateMap ( List< Cell newPoints)
inline

Definition at line 203 of file UIMapPreview.cs.

204 {
205 foreach (Cell newPoint in newPoints)
206 {
207 _RefreshPoint(newPoint.x, newPoint.z);
208 }
209 tex.Apply();
210 }
byte z
Definition: Cell.cs:58
byte x
Definition: Cell.cs:56

References _RefreshPoint(), tex, Cell.x, and Cell.z.

Member Data Documentation

◆ button

UIButton UIMapPreview.button

Definition at line 57 of file UIMapPreview.cs.

Referenced by LayerEmbark.RerollPreviewMap().

◆ cells

Cell [,] UIMapPreview.cells
private

Definition at line 65 of file UIMapPreview.cs.

Referenced by _RefreshPoint(), and SetMap().

◆ colorDefault

Color UIMapPreview.colorDefault

Definition at line 35 of file UIMapPreview.cs.

Referenced by _RefreshPoint().

◆ colorEdge

Color UIMapPreview.colorEdge

Definition at line 41 of file UIMapPreview.cs.

Referenced by _RefreshPoint().

◆ colorFog

Color UIMapPreview.colorFog

Definition at line 43 of file UIMapPreview.cs.

◆ colorSky

Color UIMapPreview.colorSky

Definition at line 45 of file UIMapPreview.cs.

Referenced by _RefreshPoint().

◆ colorStairs

Color UIMapPreview.colorStairs

Definition at line 47 of file UIMapPreview.cs.

Referenced by _RefreshPoint().

◆ colorSurround

Color UIMapPreview.colorSurround

Definition at line 39 of file UIMapPreview.cs.

Referenced by _RefreshPoint().

◆ colorVoid

Color UIMapPreview.colorVoid

Definition at line 49 of file UIMapPreview.cs.

◆ colorVoidWorld

Color UIMapPreview.colorVoidWorld

Definition at line 51 of file UIMapPreview.cs.

Referenced by _RefreshPoint().

◆ colorWater

Color UIMapPreview.colorWater

Definition at line 37 of file UIMapPreview.cs.

Referenced by _RefreshPoint().

◆ createNewMaterial

bool UIMapPreview.createNewMaterial

Definition at line 82 of file UIMapPreview.cs.

◆ filter

FilterMode UIMapPreview.filter = FilterMode.Bilinear

Definition at line 76 of file UIMapPreview.cs.

Referenced by SetMap().

◆ image

RawImage UIMapPreview.image

Definition at line 55 of file UIMapPreview.cs.

Referenced by Awake(), and SetMap().

◆ limitBounds

bool UIMapPreview.limitBounds

◆ map

Map UIMapPreview.map

◆ matMap

Material UIMapPreview.matMap

Definition at line 53 of file UIMapPreview.cs.

Referenced by WidgetMinimap.RefreshStyle(), and SetMap().

◆ maxColor

float UIMapPreview.maxColor

Definition at line 92 of file UIMapPreview.cs.

Referenced by _RefreshPoint().

◆ minColor

float UIMapPreview.minColor

Definition at line 90 of file UIMapPreview.cs.

Referenced by _RefreshPoint().

◆ monoColor

bool UIMapPreview.monoColor

Definition at line 80 of file UIMapPreview.cs.

Referenced by _RefreshPoint().

◆ offsetX

int UIMapPreview.offsetX

◆ offsetZ

int UIMapPreview.offsetZ

◆ px

Color [] UIMapPreview.px
private

Definition at line 63 of file UIMapPreview.cs.

Referenced by _RefreshPoint(), and SetMap().

◆ Size

int UIMapPreview.Size

Definition at line 68 of file UIMapPreview.cs.

Referenced by _RefreshPoint(), and SetMap().

◆ tex

Texture2D UIMapPreview.tex
private

Definition at line 61 of file UIMapPreview.cs.

Referenced by _RefreshPoint(), SetMap(), and UpdateMap().

◆ texDefault

Texture UIMapPreview.texDefault
private

Definition at line 59 of file UIMapPreview.cs.

Referenced by Awake(), GenerateMap(), and SetMap().

◆ thread

GenThread UIMapPreview.thread

◆ voidAlpha

float UIMapPreview.voidAlpha

Definition at line 88 of file UIMapPreview.cs.

Referenced by _RefreshPoint(), and SetMap().


The documentation for this class was generated from the following file: