17 return this.board.data;
22 public override void OnInit()
24 this.windows[0].AddBottomButton(
"save", delegate
26 ELayer.core.WaitForEndOfFrame(delegate
28 string text = StandaloneFileBrowser.SaveFilePanel(
"Save Template", CorePath.LotTemplate,
"new house",
"tpl");
29 if (!
string.IsNullOrEmpty(text))
31 IO.SaveFile(text, this.board.data,
false,
null);
32 this.RefreshTemplates();
45 ELayer.screen.tileMap.usingHouseBoard =
true;
47 this.ddRoofStyle.SetList<
RoofStyle>(this.data.idRoofStyle,
ELayer.screen.tileMap.roofStyles, (
RoofStyle a,
int b) => a.GetName(b).lang(), delegate(
int a,
RoofStyle b)
49 this.data.idRoofStyle = a;
51 this.RefreshBlockList();
53 this.toggleReverse.SetToggle(this.data.reverse, delegate(
bool on)
55 this.data.reverse = on;
58 this.toggleAltRoof.SetToggle(this.data.altRoof, delegate(
bool on)
60 this.data.altRoof = on;
63 List<int> blocks =
new List<int>();
67 if (row.tileType ==
TileType.Roof && !row.tag.Contains(
"hidden"))
72 int num = blocks.IndexOf(this.data.idRoofTile);
77 this.sliderRoof.SetList<
int>(num, blocks, delegate(
int a,
int b)
79 this.data.idRoofTile = b;
81 }, (
int a) => blocks.IndexOf(a).ToString() ??
"");
82 List<int> ramps =
new List<int>();
90 int num2 = ramps.IndexOf(this.data.idRamp);
95 this.sliderRamp.SetList<
int>(num2, ramps, delegate(
int a,
int b)
99 }, (
int a) => ramps.IndexOf(a).ToString() ??
"");
100 this.sliderWallHeight.SetSlider((
float)this.data.height, delegate(
float a)
102 this.data.height = (int)a;
104 return a.ToString() ??
"";
106 this.sliderHeightFix.SetSlider((
float)this.data.heightFix, delegate(
float a)
108 this.data.heightFix = (int)a;
110 return a.ToString() ??
"";
112 this.sliderDecoFix.SetSlider((
float)this.data.decoFix, delegate(
float a)
114 this.data.decoFix = (int)a;
116 return a.ToString() ??
"";
118 this.sliderDecoFix2.SetSlider((
float)this.data.decoFix2, delegate(
float a)
120 this.data.decoFix2 = (int)a;
122 return a.ToString() ??
"";
124 this.sliderDeco.SetSlider((
float)this.data.idDeco, delegate(
float a)
126 this.data.idDeco = (int)a;
128 return a.ToString() ??
"";
129 }, 0, this.maxWallDeco,
true);
130 this.sliderDeco2.SetSlider((
float)this.data.idDeco2, delegate(
float a)
132 this.data.idDeco2 = (int)a;
134 return a.ToString() ??
"";
135 }, 0, this.maxWallDeco,
true);
138 this.RefreshTemplates();
140 this.RefreshBlockList();
145 private void RefreshBlockList()
147 bool flag =
ELayer.screen.tileMap.roofStyles[this.data.idRoofStyle].type !=
RoofStyle.Type.FlatFloor;
148 List<int> blocks =
new List<int>();
151 using (List<
SourceBlock.
Row>.Enumerator enumerator =
ELayer.sources.blocks.rows.GetEnumerator())
153 while (enumerator.MoveNext())
169 int num = blocks.IndexOf(this.data.idBlock);
174 this.sliderBlock.SetList<
int>(num, blocks, delegate(
int a,
int b)
176 this.data.idBlock = b;
178 }, (
int a) => blocks.IndexOf(a).ToString() ??
"");
179 this.buttonColorRoof.icon.color = IntColor.FromInt(this.data.colRoof);
180 Action<PickerState, Color> <>9__6;
181 this.buttonColorRoof.SetOnClick(delegate
184 Color startColor = IntColor.FromInt(this.data.colRoof);
185 Color resetColor = IntColor.FromInt(this.data.colRoof);
186 Action<PickerState, Color> onChangeColor;
187 if ((onChangeColor = <>9__6) ==
null)
189 onChangeColor = (<>9__6 = delegate(PickerState state, Color c)
191 this.data.colRoof = IntColor.ToInt(c);
192 this.buttonColorRoof.icon.color = c;
193 this.board.ApplyData();
196 layerColorPicker.SetColor(startColor, resetColor, onChangeColor);
198 this.buttonColorBlock.icon.color = IntColor.FromInt(this.data.colBlock);
199 Action<PickerState, Color> <>9__7;
200 this.buttonColorBlock.SetOnClick(delegate
203 Color startColor = IntColor.FromInt(this.data.colBlock);
204 Color resetColor = IntColor.FromInt(this.data.colBlock);
205 Action<PickerState, Color> onChangeColor;
206 if ((onChangeColor = <>9__7) ==
null)
208 onChangeColor = (<>9__7 = delegate(PickerState state, Color c)
210 this.data.colBlock = IntColor.ToInt(c);
211 this.buttonColorBlock.icon.color = c;
212 this.board.ApplyData();
215 layerColorPicker.SetColor(startColor, resetColor, onChangeColor);
217 this.buttonColorDeco.icon.color = IntColor.FromInt(this.data.colDeco);
218 Action<PickerState, Color> <>9__8;
219 this.buttonColorDeco.SetOnClick(delegate
222 Color startColor = IntColor.FromInt(this.data.colDeco);
223 Color resetColor = IntColor.FromInt(this.data.colDeco);
224 Action<PickerState, Color> onChangeColor;
225 if ((onChangeColor = <>9__8) ==
null)
227 onChangeColor = (<>9__8 = delegate(PickerState state, Color c)
229 this.data.colDeco = IntColor.ToInt(c);
230 this.buttonColorDeco.icon.color = c;
231 this.board.ApplyData();
234 layerColorPicker.SetColor(startColor, resetColor, onChangeColor);
236 this.buttonColorDeco2.icon.color = IntColor.FromInt(this.data.colDeco2);
237 Action<PickerState, Color> <>9__9;
238 this.buttonColorDeco2.SetOnClick(delegate
241 Color startColor = IntColor.FromInt(this.data.colDeco2);
242 Color resetColor = IntColor.FromInt(this.data.colDeco2);
243 Action<PickerState, Color> onChangeColor;
244 if ((onChangeColor = <>9__9) ==
null)
246 onChangeColor = (<>9__9 = delegate(PickerState state, Color c)
248 this.data.colDeco2 = IntColor.ToInt(c);
249 this.buttonColorDeco2.icon.color = c;
250 this.board.ApplyData();
253 layerColorPicker.SetColor(startColor, resetColor, onChangeColor);
258 public void RefreshTemplates()
260 FileInfo[] list = (from a in
new DirectoryInfo(CorePath.LotTemplate).GetFiles()
261 where a.Name.EndsWith(
".tpl")
262 select a).ToArray<FileInfo>();
263 this.ddTemplate.SetList<FileInfo>(0, list, (FileInfo a,
int b) => a.Name, delegate(
int a, FileInfo b)
267 this.SetBoard(this.board);
272 public void ApplyData()
274 this.board.ApplyData();
275 this.toggleAltRoof.SetActive(this.board.data.idRoofTile != 0);
279 public override void OnKill()
281 ELayer.screen.tileMap.usingHouseBoard =
false;
292 public UISlider sliderBlock;
295 public UISlider sliderRoof;
298 public UISlider sliderRamp;
301 public UISlider sliderWallHeight;
304 public UISlider sliderHeightFix;
307 public UISlider sliderDeco;
310 public UISlider sliderDeco2;
313 public UISlider sliderDecoFix;
316 public UISlider sliderDecoFix2;
319 public UIDropdown ddRoofStyle;
322 public UIDropdown ddTemplate;
325 public UIButton toggleReverse;
328 public UIButton toggleAltRoof;
331 public UIButton buttonColorRoof;
334 public UIButton buttonColorBlock;
337 public UIButton buttonColorDeco;
340 public UIButton buttonColorDeco2;
343 public UIButton toggleAtrium;
346 public int maxWallDeco;
349 private bool first =
true;