15 this.texDefault = this.image.texture;
22 if (this.thread ==
null)
29 if (!this.thread.done)
33 this.image.texture = this.texDefault;
36 this.thread.bp.genSetting = bp.genSetting;
37 this.thread.bp.zoneProfile = bp.zoneProfile;
38 this.thread.bp.genSetting.seed =
EMono.rnd(20000);
39 ThreadPool.QueueUserWorkItem(delegate(
object a)
44 base.InvokeRepeating(
"CheckThread", 0f, 0.1f);
48 public void CheckThread()
52 this.SetMap(this.thread.bp.map);
58 public void SetMap(
Map _map)
63 this.image.texture = this.texDefault;
66 this.cells = this.map.cells;
67 int num = this.limitBounds ? ((this.map.bounds.Width > this.map.bounds.Height) ? this.map.bounds.Width : this.map.bounds.Height) : this.map.Size;
69 this.offsetX = ((this.map.bounds.Width > this.map.bounds.Height) ? 0 : ((num - _map.bounds.Width) / 2));
70 this.offsetZ = ((this.map.bounds.Width > this.map.bounds.Height) ? ((num - _map.bounds.Height) / 2) : 0);
71 this.px =
new Color[this.Size * this.Size];
74 UnityEngine.Object.DestroyImmediate(this.tex);
76 this.tex =
new Texture2D(this.Size, this.Size)
78 filterMode = this.filter,
79 wrapMode = TextureWrapMode.Clamp
81 for (
int i = 0; i < this.Size * this.Size; i++)
83 this.px[i].a = this.voidAlpha;
85 this.tex.SetPixels(this.px);
88 for (
int j = 0; j < this.map.bounds.Height; j++)
90 for (
int k = 0; k < this.map.bounds.Width; k++)
92 this._RefreshPoint(this.map.bounds.x + k,
this.map.bounds.z + j,
false);
98 for (
int l = 0; l < this.Size; l++)
100 for (
int m = 0; m < this.Size; m++)
102 this._RefreshPoint(m, l,
false);
106 this.tex.SetPixels(this.px);
110 this.matMap.SetTexture(
"_MainTex", this.tex);
114 this.image.texture = this.tex;
119 public void UpdateMap(
int x,
int z)
121 this._RefreshPoint(x, z,
true);
126 public void UpdateMap(List<Cell> newPoints)
128 foreach (
Cell cell
in newPoints)
130 this._RefreshPoint((
int)cell.x, (
int)cell.z,
true);
136 public void _RefreshPoint(
int x,
int z,
bool apply =
true)
138 if (x >=
EMono._map.Size || z >=
EMono._map.Size)
142 Cell cell = this.cells[x, z];
145 if (this.limitBounds)
147 num = x - EMono._map.bounds.x + this.offsetX;
148 num2 = z - EMono._map.bounds.z + this.offsetZ;
150 int num3 = num2 * this.Size + num;
151 if (num3 >= this.px.Length || num3 < 0)
159 this.px[num3] = this.colorSurround;
161 else if (cell.isSurrounded)
163 this.px[num3] = this.colorSurround;
165 else if (cell.IsTopWater)
167 this.px[num3] = this.colorWater;
169 else if (cell.HasBlock)
171 this.px[num3] = this.colorEdge;
175 this.px[num3] = this.colorDefault;
178 else if (!cell.isSeen)
180 this.px[num3] = this.colorSurround;
182 else if (cell.HasZoneStairs(
true))
184 this.px[num3] = this.colorStairs;
186 else if (cell.isSurrounded)
188 this.px[num3] = this.colorSurround;
190 else if (cell.HasBlock)
192 this.px[num3] = cell.matBlock.GetColor();
197 if (!Application.isEditor && !
EMono._zone.IsRegion && cell.IsSnowTile)
201 Color color = cell.IsSky ? this.colorSky : row.GetColor();
202 if (color.r >
this.maxColor)
204 color.r = this.maxColor;
206 else if (color.r <
this.minColor)
208 color.r = this.minColor;
210 if (color.g >
this.maxColor)
212 color.g = this.maxColor;
214 else if (color.g <
this.minColor)
216 color.g = this.minColor;
218 if (color.b >
this.maxColor)
220 color.b = this.maxColor;
222 else if (color.b <
this.minColor)
224 color.b = this.minColor;
226 this.px[num3] = color;
232 this.px[num3] *= 0.4f;
234 else if (cell.room !=
null)
236 this.px[num3] *= 0.9f;
239 if (!
EMono._map.bounds.Contains(x, z))
241 this.px[num3].a = this.voidAlpha;
245 this.px[num3].a = 1f;
251 this.tex.SetPixel(num, num2, this.px[num3]);
255 public Color colorDefault;
258 public Color colorWater;
261 public Color colorSurround;
264 public Color colorEdge;
267 public Color colorFog;
270 public Color colorSky;
273 public Color colorStairs;
276 public Material matMap;
279 public RawImage image;
282 public UIButton button;
285 private Texture texDefault;
288 private Texture2D tex;
294 private Cell[,] cells;
309 public FilterMode filter = FilterMode.Bilinear;
315 public bool monoColor;
318 public bool createNewMaterial;
321 public bool limitBounds;
327 public float voidAlpha;
330 public float minColor;
333 public float maxColor;
365 public bool done =
true;