CreativeRoomUIObjectSettings.cs 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using UnityEngine;
  5. using UnityEngine.EventSystems;
  6. using UnityEngine.UI;
  7. using wf;
  8. namespace MyRoomCustom
  9. {
  10. public class CreativeRoomUIObjectSettings : MonoBehaviour
  11. {
  12. private CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL typeGizmoControl
  13. {
  14. get
  15. {
  16. return this.m_TypeGizmoControl;
  17. }
  18. set
  19. {
  20. this.m_TypeGizmoControl = value;
  21. }
  22. }
  23. private CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL typeObjectControl
  24. {
  25. get
  26. {
  27. return this.m_TypeObjectControl;
  28. }
  29. set
  30. {
  31. this.m_TypeObjectControl = value;
  32. }
  33. }
  34. public float snapValuePosition
  35. {
  36. get
  37. {
  38. return this.m_SnapValuePosition;
  39. }
  40. set
  41. {
  42. this.m_SnapValuePosition = value;
  43. }
  44. }
  45. public float snapValueRotation
  46. {
  47. get
  48. {
  49. return this.m_SnapValueRotation;
  50. }
  51. set
  52. {
  53. this.m_SnapValueRotation = value;
  54. }
  55. }
  56. public float snapValueScale
  57. {
  58. get
  59. {
  60. return this.m_SnapValueScale;
  61. }
  62. set
  63. {
  64. this.m_SnapValueScale = value;
  65. }
  66. }
  67. public bool isVisibleDeployObject
  68. {
  69. get
  70. {
  71. return this.m_IsVisibleDeployObject;
  72. }
  73. set
  74. {
  75. Toggle uitoggleVisibleDeployObject = this.m_UIToggleVisibleDeployObject;
  76. this.m_IsVisibleDeployObject = value;
  77. uitoggleVisibleDeployObject.isOn = value;
  78. }
  79. }
  80. private void Awake()
  81. {
  82. }
  83. private void Start()
  84. {
  85. if (this.m_GizmoControlObject == null)
  86. {
  87. this.m_GizmoControlObject = new GameObject("[CreativeRoomUI ObjectSettings] GizmoControlObject").AddComponent<CreativeRoomUIObjectSettings.GizmoObject>();
  88. GameObject gameObject = new GameObject("Gizmo Rot");
  89. GameObject gameObject2 = Utility.CreatePrefab(null, "System/Prefab/XYZAxis", true);
  90. GizmoRender gizmoRender = gameObject.AddComponent<GizmoRender>();
  91. WorldTransformAxis component = gameObject2.GetComponent<WorldTransformAxis>();
  92. this.m_GizmoControlObject.Initialize(gizmoRender, component);
  93. gizmoRender.offsetScale = 1f;
  94. gizmoRender.eAxis = false;
  95. gizmoRender.eRotate = true;
  96. gizmoRender.eScal = false;
  97. component.TargetObject = this.m_GizmoControlObject.gameObject;
  98. this.ButtonEvent_SetSelectingObjectEnableMove();
  99. if (this.m_SelectingObject != null)
  100. {
  101. Transform transform = this.m_SelectingObject.transform;
  102. this.m_GizmoControlObject.pos = transform.position;
  103. this.m_GizmoControlObject.eulerAngles = transform.eulerAngles;
  104. this.m_GizmoControlObject.scale = transform.localScale;
  105. }
  106. else
  107. {
  108. this.SetDeploymentObjectGizmoEnable(false);
  109. }
  110. }
  111. this.m_UIToggleObjectEnable.onValueChanged.AddListener(delegate(bool value)
  112. {
  113. if (this.m_SelectingObject)
  114. {
  115. this.m_SelectingObject.SetActive(value);
  116. this.m_DeploymentObjectInstanceArray[this.m_SelectingObject].active = value;
  117. }
  118. });
  119. this.m_UIToggleGizmoGridEnable.onValueChanged.AddListener(delegate(bool value)
  120. {
  121. this.typeObjectControl = ((!value) ? CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL.Default : CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL.Snap);
  122. });
  123. Action<InputField, Action<float>, Action> action = delegate(InputField input_field_, Action<float> delegate_changed, Action delegate_end)
  124. {
  125. input_field_.onValueChanged.AddListener(delegate(string str)
  126. {
  127. if (!input_field_.isFocused || this.m_SelectingObject == null || delegate_changed == null)
  128. {
  129. return;
  130. }
  131. float obj;
  132. if (float.TryParse(str, out obj))
  133. {
  134. delegate_changed(obj);
  135. }
  136. });
  137. input_field_.onEndEdit.AddListener(delegate(string str)
  138. {
  139. if (this.m_SelectingObject == null || delegate_end == null)
  140. {
  141. return;
  142. }
  143. delegate_end();
  144. });
  145. };
  146. action(this.m_UIInputFieldPosX, delegate(float value)
  147. {
  148. Vector3 pos = this.m_GizmoControlObject.pos;
  149. pos.x = value;
  150. Transform transform2 = this.m_SelectingObject.transform;
  151. Vector3 vector = pos;
  152. this.m_GizmoControlObject.pos = vector;
  153. transform2.position = vector;
  154. }, delegate
  155. {
  156. this.m_UIInputFieldPosX.text = this.m_GizmoControlObject.pos.x.ToString("f3");
  157. });
  158. action(this.m_UIInputFieldPosY, delegate(float value)
  159. {
  160. Vector3 pos = this.m_GizmoControlObject.pos;
  161. pos.y = value;
  162. Transform transform2 = this.m_SelectingObject.transform;
  163. Vector3 vector = pos;
  164. this.m_GizmoControlObject.pos = vector;
  165. transform2.position = vector;
  166. }, delegate
  167. {
  168. this.m_UIInputFieldPosY.text = this.m_GizmoControlObject.pos.y.ToString("f3");
  169. });
  170. action(this.m_UIInputFieldPosZ, delegate(float value)
  171. {
  172. Vector3 pos = this.m_GizmoControlObject.pos;
  173. pos.z = value;
  174. Transform transform2 = this.m_SelectingObject.transform;
  175. Vector3 vector = pos;
  176. this.m_GizmoControlObject.pos = vector;
  177. transform2.position = vector;
  178. }, delegate
  179. {
  180. this.m_UIInputFieldPosZ.text = this.m_GizmoControlObject.pos.z.ToString("f3");
  181. });
  182. action(this.m_UIInputFieldEulerX, delegate(float value)
  183. {
  184. Vector3 eulerAngles = this.m_GizmoControlObject.eulerAngles;
  185. eulerAngles.x = value;
  186. Transform transform2 = this.m_SelectingObject.transform;
  187. Vector3 eulerAngles2 = eulerAngles;
  188. this.m_GizmoControlObject.eulerAngles = eulerAngles2;
  189. transform2.eulerAngles = eulerAngles2;
  190. }, delegate
  191. {
  192. this.m_UIInputFieldEulerX.text = this.m_GizmoControlObject.eulerAngles.x.ToString("f3");
  193. });
  194. action(this.m_UIInputFieldEulerY, delegate(float value)
  195. {
  196. Vector3 eulerAngles = this.m_GizmoControlObject.eulerAngles;
  197. eulerAngles.y = value;
  198. Transform transform2 = this.m_SelectingObject.transform;
  199. Vector3 eulerAngles2 = eulerAngles;
  200. this.m_GizmoControlObject.eulerAngles = eulerAngles2;
  201. transform2.eulerAngles = eulerAngles2;
  202. }, delegate
  203. {
  204. this.m_UIInputFieldEulerY.text = this.m_GizmoControlObject.eulerAngles.y.ToString("f3");
  205. });
  206. action(this.m_UIInputFieldEulerZ, delegate(float value)
  207. {
  208. Vector3 eulerAngles = this.m_GizmoControlObject.eulerAngles;
  209. eulerAngles.z = value;
  210. Transform transform2 = this.m_SelectingObject.transform;
  211. Vector3 eulerAngles2 = eulerAngles;
  212. this.m_GizmoControlObject.eulerAngles = eulerAngles2;
  213. transform2.eulerAngles = eulerAngles2;
  214. }, delegate
  215. {
  216. this.m_UIInputFieldEulerZ.text = this.m_GizmoControlObject.eulerAngles.z.ToString("f3");
  217. });
  218. action(this.m_UIInputFieldScale, delegate(float value)
  219. {
  220. Vector3 scale = this.m_GizmoControlObject.scale;
  221. value = Mathf.Clamp(value, this.m_UISliderScale.minValue, this.m_UISliderScale.maxValue);
  222. scale.x = (scale.y = (scale.z = value));
  223. Transform transform2 = this.m_SelectingObject.transform;
  224. Vector3 vector = scale;
  225. this.m_GizmoControlObject.scale = vector;
  226. transform2.localScale = vector;
  227. this.m_UISliderScale.value = value;
  228. }, delegate
  229. {
  230. this.m_UIInputFieldScale.text = this.m_GizmoControlObject.scale.x.ToString("f3");
  231. });
  232. this.m_UISliderScale.onValueChanged.AddListener(delegate(float value)
  233. {
  234. if (this.m_GizmoControlObject == null || this.m_SelectingObject == null)
  235. {
  236. return;
  237. }
  238. Vector3 scale = this.m_GizmoControlObject.scale;
  239. scale.x = (scale.y = scale.z);
  240. if (!this.m_SelectingObject.activeInHierarchy)
  241. {
  242. if (Mathf.Approximately(scale.x, value))
  243. {
  244. return;
  245. }
  246. this.m_UISliderScale.value = scale.x;
  247. return;
  248. }
  249. else
  250. {
  251. if (Mathf.Approximately(scale.x, value))
  252. {
  253. return;
  254. }
  255. this.m_GizmoControlObject.scale = Vector3.one * value;
  256. this.m_UIInputFieldScale.text = value.ToString("f3");
  257. return;
  258. }
  259. });
  260. Action<string, Button, Func<Vector3>> action2 = delegate(string key, Button button, Func<Vector3> delegate_get_vector3)
  261. {
  262. button.onClick.AddListener(delegate()
  263. {
  264. if (this.m_SelectingObject == null)
  265. {
  266. return;
  267. }
  268. Vector3 vector = delegate_get_vector3();
  269. StringWriter stringWriter = new StringWriter();
  270. stringWriter.WriteLine(vector.x);
  271. stringWriter.WriteLine(vector.y);
  272. stringWriter.WriteLine(vector.z);
  273. this.SetClipboardData(key, stringWriter.ToString());
  274. });
  275. };
  276. Action<string, Button, Action<Vector3>> action3 = delegate(string key, Button button, Action<Vector3> delegate_return_vector3)
  277. {
  278. button.onClick.AddListener(delegate()
  279. {
  280. if (this.m_SelectingObject == null)
  281. {
  282. return;
  283. }
  284. string clipboardData = this.GetClipboardData(key);
  285. if (clipboardData == string.Empty)
  286. {
  287. return;
  288. }
  289. StringReader stringReader = new StringReader(clipboardData);
  290. try
  291. {
  292. Vector3 obj = default(Vector3);
  293. obj.x = float.Parse(stringReader.ReadLine());
  294. obj.y = float.Parse(stringReader.ReadLine());
  295. obj.z = float.Parse(stringReader.ReadLine());
  296. delegate_return_vector3(obj);
  297. }
  298. catch
  299. {
  300. }
  301. });
  302. };
  303. Action<Button, Func<Vector3>, Action<Vector3>> action4 = delegate(Button button, Func<Vector3> delegate_get_vector3, Action<Vector3> delegate_return_vector3)
  304. {
  305. button.onClick.AddListener(delegate()
  306. {
  307. if (this.m_SelectingObject == null)
  308. {
  309. return;
  310. }
  311. delegate_return_vector3(delegate_get_vector3());
  312. this.UpdateInputFieldText(this.m_SelectingObject.transform);
  313. });
  314. };
  315. Transform parent = this.m_UIInputFieldPosX.transform.parent;
  316. Button component2 = parent.Find("Button Copy").GetComponent<Button>();
  317. action2("pos", component2, () => this.m_GizmoControlObject.pos);
  318. component2 = parent.Find("Button Paste").GetComponent<Button>();
  319. action3("pos", component2, delegate(Vector3 vec)
  320. {
  321. Transform transform2 = this.m_SelectingObject.transform;
  322. this.m_GizmoControlObject.pos = vec;
  323. transform2.position = vec;
  324. this.UpdateInputFieldText(this.m_SelectingObject.transform);
  325. });
  326. component2 = parent.Find("Button Reset").GetComponent<Button>();
  327. action4(component2, () => Vector3.zero, delegate(Vector3 vec)
  328. {
  329. Transform transform2 = this.m_SelectingObject.transform;
  330. this.m_GizmoControlObject.pos = vec;
  331. transform2.position = vec;
  332. });
  333. parent = this.m_UIInputFieldEulerX.transform.parent;
  334. component2 = parent.Find("Button Copy").GetComponent<Button>();
  335. action2("rot", component2, () => this.m_GizmoControlObject.eulerAngles);
  336. component2 = parent.Find("Button Paste").GetComponent<Button>();
  337. action3("rot", component2, delegate(Vector3 vec)
  338. {
  339. Transform transform2 = this.m_SelectingObject.transform;
  340. this.m_GizmoControlObject.eulerAngles = vec;
  341. transform2.eulerAngles = vec;
  342. this.UpdateInputFieldText(this.m_SelectingObject.transform);
  343. });
  344. component2 = parent.Find("Button Reset").GetComponent<Button>();
  345. action4(component2, () => Vector3.zero, delegate(Vector3 vec)
  346. {
  347. Transform transform2 = this.m_SelectingObject.transform;
  348. this.m_GizmoControlObject.eulerAngles = vec;
  349. transform2.eulerAngles = vec;
  350. });
  351. parent = this.m_UIInputFieldScale.transform.parent;
  352. component2 = parent.Find("Button Copy").GetComponent<Button>();
  353. action2("scale", component2, () => this.m_GizmoControlObject.scale);
  354. component2 = parent.Find("Button Paste").GetComponent<Button>();
  355. action3("scale", component2, delegate(Vector3 vec)
  356. {
  357. Transform transform2 = this.m_SelectingObject.transform;
  358. this.m_GizmoControlObject.scale = vec;
  359. transform2.localScale = vec;
  360. this.UpdateInputFieldText(this.m_SelectingObject.transform);
  361. });
  362. component2 = parent.Find("Button Reset").GetComponent<Button>();
  363. action4(component2, () => Vector3.one, delegate(Vector3 vec)
  364. {
  365. Transform transform2 = this.m_SelectingObject.transform;
  366. this.m_GizmoControlObject.scale = vec;
  367. transform2.localScale = vec;
  368. });
  369. this.m_UIToggleVisibleDeployObject.onValueChanged.AddListener(delegate(bool value)
  370. {
  371. this.isVisibleDeployObject = value;
  372. List<GameObject> list = new List<GameObject>(this.m_DeploymentObjectInstanceArray.Keys);
  373. List<CreativeRoomUIObjectSettings.DeployObjectInstanceData> list2 = new List<CreativeRoomUIObjectSettings.DeployObjectInstanceData>(this.m_DeploymentObjectInstanceArray.Values);
  374. for (int i = 0; i < list.Count; i++)
  375. {
  376. list[i].SetActive(value & list2[i].active);
  377. }
  378. });
  379. }
  380. private void LateUpdate()
  381. {
  382. if (this.m_SelectingObject == null)
  383. {
  384. return;
  385. }
  386. Transform transform = this.m_SelectingObject.transform;
  387. Vector3 vector = this.m_GizmoControlObject.pos - transform.position;
  388. Vector3 vector2 = this.m_GizmoControlObject.eulerAngles - transform.eulerAngles;
  389. Vector3 vector3 = this.m_GizmoControlObject.scale - transform.localScale;
  390. if (this.m_SelectingObject.activeInHierarchy && (vector.sqrMagnitude > 0f || vector2.sqrMagnitude > 0f || vector3.sqrMagnitude > 0f))
  391. {
  392. if (this.typeObjectControl == CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL.Default)
  393. {
  394. transform.position = this.m_GizmoControlObject.pos;
  395. transform.rotation = this.m_GizmoControlObject.rot;
  396. transform.localScale = this.m_GizmoControlObject.scale;
  397. this.UpdateInputFieldText(transform);
  398. }
  399. else if (this.typeObjectControl == CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL.Snap)
  400. {
  401. if (vector.sqrMagnitude >= this.snapValuePosition * this.snapValuePosition)
  402. {
  403. Vector3 pos = this.m_GizmoControlObject.pos;
  404. pos.x = Mathf.Round(pos.x / this.snapValuePosition) * this.snapValuePosition;
  405. pos.y = Mathf.Round(pos.y / this.snapValuePosition) * this.snapValuePosition;
  406. pos.z = Mathf.Round(pos.z / this.snapValuePosition) * this.snapValuePosition;
  407. transform.position = pos;
  408. }
  409. if (vector2.sqrMagnitude >= this.snapValueRotation * this.snapValueRotation)
  410. {
  411. Quaternion rot = this.m_GizmoControlObject.rot;
  412. Quaternion rotation = transform.rotation;
  413. float snapValueRotation = this.snapValueRotation;
  414. float num = Quaternion.Angle(rotation, rot);
  415. if (Mathf.Abs(num) > snapValueRotation)
  416. {
  417. Quaternion rotation2 = Quaternion.RotateTowards(rotation, rot, Mathf.Floor(num / snapValueRotation) * snapValueRotation);
  418. transform.rotation = rotation2;
  419. }
  420. }
  421. if (vector3.sqrMagnitude >= this.snapValueScale * this.snapValueScale)
  422. {
  423. Vector3 localScale = Mathf.Round(this.m_GizmoControlObject.scale.x / this.snapValueScale) * this.snapValueScale * Vector3.one;
  424. transform.localScale = localScale;
  425. }
  426. if (vector.sqrMagnitude + vector2.sqrMagnitude + vector3.sqrMagnitude > 0f)
  427. {
  428. this.UpdateInputFieldText(transform);
  429. }
  430. }
  431. }
  432. if (NInput.GetMouseButtonUp(0) && this.m_SelectingObject)
  433. {
  434. this.m_GizmoControlObject.pos = transform.position;
  435. this.m_GizmoControlObject.eulerAngles = transform.eulerAngles;
  436. }
  437. if (!GizmoRender.UIVisible && GizmoRender.UIVisible != this.m_GizmoControlObject.gameObject.activeSelf)
  438. {
  439. this.SetDeploymentObjectGizmoEnable(false);
  440. }
  441. }
  442. public void Update()
  443. {
  444. if (EventSystem.current != null)
  445. {
  446. if (NInput.GetMouseButtonDown(0))
  447. {
  448. GameObject currentSelectedGameObject = EventSystem.current.currentSelectedGameObject;
  449. if (EventSystem.current.IsPointerOverGameObject() && currentSelectedGameObject != null && currentSelectedGameObject.GetComponent<RectTransform>())
  450. {
  451. this.SetDeploymentObjectGizmoEnable(false);
  452. }
  453. }
  454. else if (NInput.GetMouseButtonUp(0))
  455. {
  456. this.SetDeploymentObjectGizmoEnable(true);
  457. }
  458. }
  459. }
  460. private void SetClipboardData(string key, string value)
  461. {
  462. if (this.m_Clipboard.ContainsKey(key))
  463. {
  464. this.m_Clipboard[key] = value;
  465. }
  466. else
  467. {
  468. this.m_Clipboard.Add(key, value);
  469. }
  470. }
  471. private string GetClipboardData(string key)
  472. {
  473. if (!this.m_Clipboard.ContainsKey(key))
  474. {
  475. return string.Empty;
  476. }
  477. return this.m_Clipboard[key];
  478. }
  479. public void SetDeploymentObjectGizmoEnable(bool b)
  480. {
  481. if (this.m_GizmoControlObject == null)
  482. {
  483. return;
  484. }
  485. if (!base.gameObject.activeInHierarchy)
  486. {
  487. this.m_GizmoControlObject.gameObject.SetActive(false);
  488. }
  489. else if (this.m_SelectingObject == null)
  490. {
  491. this.m_GizmoControlObject.gameObject.SetActive(false);
  492. }
  493. else
  494. {
  495. this.m_GizmoControlObject.gameObject.SetActive(b);
  496. }
  497. }
  498. public void CreateOdoguObjectButtons(int placementObjCategoryID)
  499. {
  500. CreativeRoomUIObjectSettings.<CreateOdoguObjectButtons>c__AnonStorey4 <CreateOdoguObjectButtons>c__AnonStorey = new CreativeRoomUIObjectSettings.<CreateOdoguObjectButtons>c__AnonStorey4();
  501. <CreateOdoguObjectButtons>c__AnonStorey.placementObjCategoryID = placementObjCategoryID;
  502. <CreateOdoguObjectButtons>c__AnonStorey.$this = this;
  503. <CreateOdoguObjectButtons>c__AnonStorey.dataList = PlacementData.GetDatas((PlacementData.Data data) => data.categoryID == <CreateOdoguObjectButtons>c__AnonStorey.placementObjCategoryID);
  504. Debug.LogFormat("カテゴリID「{0}」\nデータ数「{1}」", new object[]
  505. {
  506. <CreateOdoguObjectButtons>c__AnonStorey.placementObjCategoryID,
  507. <CreateOdoguObjectButtons>c__AnonStorey.dataList.Count
  508. });
  509. this.m_UIParentDeployableObjectButtons.Show<Button>(<CreateOdoguObjectButtons>c__AnonStorey.dataList.Count, delegate(int i, Button button)
  510. {
  511. PlacementData.Data data = <CreateOdoguObjectButtons>c__AnonStorey.dataList[i];
  512. Text componentInChildren = button.GetComponentInChildren<Text>();
  513. RawImage component = button.GetComponent<RawImage>();
  514. Texture texture = null;
  515. if (!<CreateOdoguObjectButtons>c__AnonStorey.$this.m_CachedItemIconDic.TryGetValue(data.ID, out texture))
  516. {
  517. texture = data.GetThumbnail();
  518. <CreateOdoguObjectButtons>c__AnonStorey.$this.m_CachedItemIconDic.Add(data.ID, texture);
  519. }
  520. if (texture != null)
  521. {
  522. componentInChildren.gameObject.SetActive(false);
  523. component.texture = texture;
  524. }
  525. else
  526. {
  527. componentInChildren.text = data.drawName;
  528. }
  529. button.onClick.AddListener(delegate()
  530. {
  531. GameObject gameObject = <CreateOdoguObjectButtons>c__AnonStorey.CreateOdoguObject(data.ID);
  532. if (!gameObject)
  533. {
  534. return;
  535. }
  536. <CreateOdoguObjectButtons>c__AnonStorey.AddEvent_ObjectClickSelect(gameObject);
  537. <CreateOdoguObjectButtons>c__AnonStorey.CreateDeploymentObjectButtons();
  538. <CreateOdoguObjectButtons>c__AnonStorey.SetSelectingObject(gameObject, null);
  539. <CreateOdoguObjectButtons>c__AnonStorey.m_UIToggleVisibleDeployObject.isOn = true;
  540. });
  541. });
  542. }
  543. private GameObject CreateOdoguObject(int objectID)
  544. {
  545. GameObject gameObject = GameObject.Find("Deployment Object Parent");
  546. if (gameObject == null)
  547. {
  548. gameObject = new GameObject("Deployment Object Parent");
  549. }
  550. if (!PlacementData.Contains(objectID))
  551. {
  552. Debug.LogWarningFormat("[Creative Room]配置物データID[{0}]の情報は存在しません", new object[]
  553. {
  554. objectID
  555. });
  556. return null;
  557. }
  558. PlacementData.Data data = PlacementData.GetData(objectID);
  559. GameObject prefab = data.GetPrefab();
  560. if (prefab == null)
  561. {
  562. return null;
  563. }
  564. GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(prefab);
  565. GameObject gameObject3 = new GameObject(gameObject2.name);
  566. gameObject2.transform.SetParent(gameObject3.transform, true);
  567. CreativeRoomUIObjectSettings.DeployObjectInstanceData value = new CreativeRoomUIObjectSettings.DeployObjectInstanceData(CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL.Default, objectID, null);
  568. this.m_DeploymentObjectInstanceArray.Add(gameObject3, value);
  569. gameObject3.transform.SetParent(gameObject.transform, false);
  570. return gameObject3;
  571. }
  572. private void AddEvent_ObjectClickSelect(GameObject Obj)
  573. {
  574. Collider[] cols = Obj.GetComponentsInChildren<Collider>();
  575. if (cols.Length <= 0)
  576. {
  577. Debug.LogWarning("配置物[" + Obj.name + "]に、当たり判定がついていないので強制的に追加しました");
  578. MeshRenderer componentInChildren = Obj.GetComponentInChildren<MeshRenderer>(true);
  579. if (componentInChildren != null)
  580. {
  581. componentInChildren.gameObject.AddComponent<BoxCollider>();
  582. }
  583. cols = Obj.GetComponentsInChildren<Collider>();
  584. }
  585. CreativeRoomUIObjectSettings.MouseEvent mouseEvent = cols[0].gameObject.AddComponent<CreativeRoomUIObjectSettings.MouseEvent>();
  586. mouseEvent.onPointerClick = delegate(PointerEventData data)
  587. {
  588. if (NInput.GetMouseButtonUp(0))
  589. {
  590. this.SetSelectingObject(Obj, null);
  591. }
  592. };
  593. mouseEvent.onBeginDrag = delegate(PointerEventData data)
  594. {
  595. for (int i = 0; i < cols.Length; i++)
  596. {
  597. cols[i].enabled = false;
  598. }
  599. };
  600. mouseEvent.onEndDrag = delegate(PointerEventData data)
  601. {
  602. for (int i = 0; i < cols.Length; i++)
  603. {
  604. cols[i].enabled = true;
  605. }
  606. };
  607. }
  608. public void ButtonEvent_SetSelectingObjectEnableMove()
  609. {
  610. this.m_GizmoControlObject.activeAxis = true;
  611. this.m_GizmoControlObject.activeRot = false;
  612. this.m_TypeGizmoControl = CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL.Move;
  613. }
  614. public void ButtonEvent_SetSelectingObjectEnableRot()
  615. {
  616. this.m_GizmoControlObject.activeAxis = false;
  617. this.m_GizmoControlObject.activeRot = true;
  618. this.m_TypeGizmoControl = CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL.Rotate;
  619. }
  620. public void ButtonEvent_SetSelectingObjectDisableGizmo()
  621. {
  622. this.m_GizmoControlObject.activeAxis = false;
  623. this.m_GizmoControlObject.activeRot = false;
  624. this.m_TypeGizmoControl = CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL.None;
  625. }
  626. public void SetSelectingObject(GameObject newObj, GameObject buttonObj = null)
  627. {
  628. if (newObj && this.m_GizmoControlObject)
  629. {
  630. this.m_GizmoControlObject.pos = newObj.transform.position;
  631. this.m_GizmoControlObject.eulerAngles = newObj.transform.eulerAngles;
  632. this.m_GizmoControlObject.scale = newObj.transform.localScale;
  633. this.SetDeploymentObjectGizmoEnable(true);
  634. if (this.typeGizmoControl == CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL.Move)
  635. {
  636. this.ButtonEvent_SetSelectingObjectEnableMove();
  637. }
  638. else if (this.typeGizmoControl == CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL.Rotate)
  639. {
  640. this.ButtonEvent_SetSelectingObjectEnableRot();
  641. }
  642. else if (this.typeGizmoControl == CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL.None)
  643. {
  644. this.ButtonEvent_SetSelectingObjectDisableGizmo();
  645. }
  646. }
  647. this.m_SelectingObject = newObj;
  648. this.typeGizmoControl = this.typeGizmoControl;
  649. if (newObj)
  650. {
  651. this.m_UIToggleObjectEnable.isOn = newObj.activeInHierarchy;
  652. }
  653. if (newObj)
  654. {
  655. this.UpdateInputFieldText(newObj.transform);
  656. }
  657. if (newObj == null)
  658. {
  659. if (this.m_GizmoControlObject)
  660. {
  661. this.SetDeploymentObjectGizmoEnable(false);
  662. }
  663. return;
  664. }
  665. Transform transform = this.m_UIParentDeploymentObjectButtons.transform;
  666. if (buttonObj == null && (buttonObj = this.m_DeploymentObjectInstanceArray[newObj].uiButtonObject) == null)
  667. {
  668. return;
  669. }
  670. Color color = new Color(0.65f, 0.65f, 0.65f, 1f);
  671. Color white = Color.white;
  672. for (int i = 0; i < transform.childCount; i++)
  673. {
  674. Transform child = transform.GetChild(i);
  675. Graphic targetGraphic = child.GetChild(0).GetComponent<Selectable>().targetGraphic;
  676. if (buttonObj != child.gameObject)
  677. {
  678. targetGraphic.color = color;
  679. }
  680. else
  681. {
  682. targetGraphic.color = white;
  683. }
  684. }
  685. }
  686. public void ButtonEvent_CameraFocus()
  687. {
  688. if (this.m_SelectingObject == null)
  689. {
  690. return;
  691. }
  692. WfCameraMoveSupport wfCameraMoveSupport = base.GetComponent<WfCameraMoveSupport>();
  693. if (wfCameraMoveSupport == null)
  694. {
  695. wfCameraMoveSupport = base.gameObject.AddComponent<WfCameraMoveSupport>();
  696. }
  697. Vector3 position = this.m_SelectingObject.transform.position;
  698. float distance = 5f;
  699. Vector2 aroundAngle = new Vector2(-135f, 45f);
  700. wfCameraMoveSupport.StartCameraPosition(position, distance, aroundAngle);
  701. }
  702. private void UpdateInputFieldText(Transform trans)
  703. {
  704. if (trans)
  705. {
  706. this.UpdateInputFieldText(trans.position, trans.eulerAngles, trans.lossyScale);
  707. }
  708. else
  709. {
  710. this.UpdateInputFieldText(Vector3.zero, Vector3.zero, Vector3.zero);
  711. }
  712. }
  713. private void UpdateInputFieldText(Vector3 pos, Vector3 euler, Vector3 scale)
  714. {
  715. if (!this.m_UIInputFieldPosX.isFocused)
  716. {
  717. this.m_UIInputFieldPosX.text = pos.x.ToString("f3");
  718. }
  719. if (!this.m_UIInputFieldPosY.isFocused)
  720. {
  721. this.m_UIInputFieldPosY.text = pos.y.ToString("f3");
  722. }
  723. if (!this.m_UIInputFieldPosZ.isFocused)
  724. {
  725. this.m_UIInputFieldPosZ.text = pos.z.ToString("f3");
  726. }
  727. if (!this.m_UIInputFieldEulerX.isFocused)
  728. {
  729. this.m_UIInputFieldEulerX.text = euler.x.ToString("f3");
  730. }
  731. if (!this.m_UIInputFieldEulerY.isFocused)
  732. {
  733. this.m_UIInputFieldEulerY.text = euler.y.ToString("f3");
  734. }
  735. if (!this.m_UIInputFieldEulerZ.isFocused)
  736. {
  737. this.m_UIInputFieldEulerZ.text = euler.z.ToString("f3");
  738. }
  739. if (!this.m_UIInputFieldScale.isFocused)
  740. {
  741. this.m_UIInputFieldScale.text = scale.x.ToString("f3");
  742. }
  743. this.m_UISliderScale.value = scale.x;
  744. }
  745. private void CreateDeploymentObjectButtons()
  746. {
  747. uGUIListViewer uiparentDeploymentObjectButtons = this.m_UIParentDeploymentObjectButtons;
  748. Transform transform = uiparentDeploymentObjectButtons.transform;
  749. VerticalLayoutGroup component = uiparentDeploymentObjectButtons.GetComponent<VerticalLayoutGroup>();
  750. component.enabled = false;
  751. Transform child = transform.GetChild(0);
  752. List<GameObject> list = new List<GameObject>(this.m_DeploymentObjectInstanceArray.Keys);
  753. for (int i = 0; i < this.m_DeploymentObjectInstanceArray.Count; i++)
  754. {
  755. GameObject Obj = list[i];
  756. CreativeRoomUIObjectSettings.DeployObjectInstanceData deployObjectInstanceData = this.m_DeploymentObjectInstanceArray[Obj];
  757. if (!(deployObjectInstanceData.uiButtonObject != null))
  758. {
  759. if (PlacementData.Contains(deployObjectInstanceData.objectID))
  760. {
  761. Transform transform2 = UnityEngine.Object.Instantiate<Transform>(child);
  762. transform2.gameObject.SetActive(true);
  763. transform2.SetParent(transform, false);
  764. Button[] componentsInChildren = transform2.GetComponentsInChildren<Button>();
  765. componentsInChildren[0].GetComponentInChildren<Text>().text = PlacementData.GetData(deployObjectInstanceData.objectID).drawName;
  766. Utility.SetLocalizeTerm(componentsInChildren[0].GetComponentInChildren<Text>(), PlacementData.GetData(deployObjectInstanceData.objectID).drawNameTerm);
  767. componentsInChildren[0].onClick.RemoveAllListeners();
  768. componentsInChildren[1].onClick.RemoveAllListeners();
  769. componentsInChildren[0].onClick.AddListener(delegate()
  770. {
  771. if (this.m_SelectingObject == Obj)
  772. {
  773. this.ButtonEvent_CameraFocus();
  774. }
  775. else
  776. {
  777. this.SetSelectingObject(Obj, null);
  778. }
  779. });
  780. componentsInChildren[1].onClick.AddListener(delegate()
  781. {
  782. this.DestroyDeploymentObject(Obj);
  783. });
  784. deployObjectInstanceData.uiButtonObject = transform2.gameObject;
  785. }
  786. }
  787. }
  788. this.m_UITextDeployObjectNum.text = this.m_DeploymentObjectInstanceArray.Count.ToString();
  789. component.enabled = true;
  790. }
  791. private void DestroyDeploymentObject(GameObject Obj)
  792. {
  793. if (this.m_SelectingObject != null && this.m_SelectingObject == Obj)
  794. {
  795. this.SetDeploymentObjectGizmoEnable(false);
  796. }
  797. if (this.m_DeploymentObjectInstanceArray.ContainsKey(Obj))
  798. {
  799. UnityEngine.Object.Destroy(this.m_DeploymentObjectInstanceArray[Obj].uiButtonObject);
  800. this.m_DeploymentObjectInstanceArray.Remove(Obj);
  801. UnityEngine.Object.Destroy(Obj);
  802. }
  803. this.m_UITextDeployObjectNum.text = this.m_DeploymentObjectInstanceArray.Count.ToString();
  804. }
  805. public void SaveDeployObjectData(BinaryWriter binary)
  806. {
  807. int count = this.m_DeploymentObjectInstanceArray.Count;
  808. binary.Write(count);
  809. List<GameObject> list = new List<GameObject>(this.m_DeploymentObjectInstanceArray.Keys);
  810. for (int i = 0; i < count; i++)
  811. {
  812. GameObject gameObject = list[i];
  813. CreativeRoomUIObjectSettings.DeployObjectInstanceData deployObjectInstanceData = this.m_DeploymentObjectInstanceArray[gameObject];
  814. binary.Write(gameObject.transform.position.x);
  815. binary.Write(gameObject.transform.position.y);
  816. binary.Write(gameObject.transform.position.z);
  817. binary.Write(gameObject.transform.eulerAngles.x);
  818. binary.Write(gameObject.transform.eulerAngles.y);
  819. binary.Write(gameObject.transform.eulerAngles.z);
  820. binary.Write(gameObject.transform.localScale.x);
  821. binary.Write(deployObjectInstanceData.active);
  822. binary.Write(deployObjectInstanceData.objectID);
  823. }
  824. }
  825. public void LoadDeployObjectData(BinaryReader brRead)
  826. {
  827. List<GameObject> list = new List<GameObject>(this.m_DeploymentObjectInstanceArray.Keys);
  828. for (int i = 0; i < list.Count; i++)
  829. {
  830. this.DestroyDeploymentObject(list[i]);
  831. }
  832. int num = brRead.ReadInt32();
  833. for (int j = 0; j < num; j++)
  834. {
  835. Vector3 zero = Vector3.zero;
  836. Vector3 zero2 = Vector3.zero;
  837. Vector3 localScale = Vector3.zero;
  838. zero[0] = brRead.ReadSingle();
  839. zero[1] = brRead.ReadSingle();
  840. zero[2] = brRead.ReadSingle();
  841. zero2[0] = brRead.ReadSingle();
  842. zero2[1] = brRead.ReadSingle();
  843. zero2[2] = brRead.ReadSingle();
  844. localScale = brRead.ReadSingle() * Vector3.one;
  845. bool active = brRead.ReadBoolean();
  846. int objectID = brRead.ReadInt32();
  847. GameObject gameObject = this.CreateOdoguObject(objectID);
  848. if (gameObject)
  849. {
  850. Transform transform = gameObject.transform;
  851. transform.position = zero;
  852. transform.eulerAngles = zero2;
  853. transform.localScale = localScale;
  854. gameObject.SetActive(active);
  855. this.AddEvent_ObjectClickSelect(gameObject);
  856. }
  857. }
  858. this.SetSelectingObject(null, null);
  859. this.CreateDeploymentObjectButtons();
  860. this.m_UIToggleVisibleDeployObject.isOn = true;
  861. }
  862. public static GameObject Load(BinaryReader brRead)
  863. {
  864. GameObject gameObject = new GameObject("Parent Deployment Object");
  865. Transform transform = gameObject.transform;
  866. int num = brRead.ReadInt32();
  867. for (int i = 0; i < num; i++)
  868. {
  869. Vector3 zero = Vector3.zero;
  870. Vector3 zero2 = Vector3.zero;
  871. Vector3 localScale = Vector3.zero;
  872. zero[0] = brRead.ReadSingle();
  873. zero[1] = brRead.ReadSingle();
  874. zero[2] = brRead.ReadSingle();
  875. zero2[0] = brRead.ReadSingle();
  876. zero2[1] = brRead.ReadSingle();
  877. zero2[2] = brRead.ReadSingle();
  878. localScale = brRead.ReadSingle() * Vector3.one;
  879. bool active = brRead.ReadBoolean();
  880. int num2 = brRead.ReadInt32();
  881. if (!PlacementData.Contains(num2))
  882. {
  883. Debug.LogWarningFormat("[Creative Room]配置物データID[{0}]の情報は存在しません", new object[]
  884. {
  885. num2
  886. });
  887. }
  888. else
  889. {
  890. PlacementData.Data data = PlacementData.GetData(num2);
  891. GameObject prefab = data.GetPrefab();
  892. if (!(prefab == null))
  893. {
  894. GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(prefab);
  895. GameObject gameObject3 = new GameObject(gameObject2.name);
  896. gameObject2.transform.SetParent(gameObject3.transform, true);
  897. Transform transform2 = gameObject3.transform;
  898. transform2.position = zero;
  899. transform2.eulerAngles = zero2;
  900. transform2.localScale = localScale;
  901. gameObject2.SetActive(active);
  902. transform2.SetParent(transform, true);
  903. }
  904. }
  905. }
  906. return gameObject;
  907. }
  908. private void OnEnable()
  909. {
  910. CreativeRoomUIObjectSettings.<OnEnable>c__AnonStorey8 <OnEnable>c__AnonStorey = new CreativeRoomUIObjectSettings.<OnEnable>c__AnonStorey8();
  911. <OnEnable>c__AnonStorey.$this = this;
  912. <OnEnable>c__AnonStorey.categoryIDList = PlacementData.CategoryIDList;
  913. this.m_UIParentDeployableObjectCategoryButtons.Show<Button>(<OnEnable>c__AnonStorey.categoryIDList.Count, delegate(int i, Button button)
  914. {
  915. Text componentInChildren = button.GetComponentInChildren<Text>();
  916. componentInChildren.text = PlacementData.GetCategoryName(<OnEnable>c__AnonStorey.categoryIDList[i]);
  917. Utility.SetLocalizeTerm(componentInChildren, "SceneCreativeRoom/カテゴリー/" + <OnEnable>c__AnonStorey.categoryIDList[i].ToString());
  918. button.onClick.AddListener(delegate()
  919. {
  920. Debug.LogFormat("カテゴリ「{0}」", new object[]
  921. {
  922. PlacementData.GetCategoryName(<OnEnable>c__AnonStorey.categoryIDList[i])
  923. });
  924. <OnEnable>c__AnonStorey.CreateOdoguObjectButtons(<OnEnable>c__AnonStorey.categoryIDList[i]);
  925. });
  926. });
  927. }
  928. private void OnDisable()
  929. {
  930. this.SetDeploymentObjectGizmoEnable(false);
  931. }
  932. private void OnDestroy()
  933. {
  934. if (this.m_DeploymentObjectInstanceArray != null)
  935. {
  936. this.m_DeploymentObjectInstanceArray.Clear();
  937. }
  938. if (this.m_Clipboard != null)
  939. {
  940. this.m_Clipboard.Clear();
  941. }
  942. GameObject gameObject = GameObject.Find("Deployment Object Parent");
  943. if (gameObject != null)
  944. {
  945. UnityEngine.Object.Destroy(gameObject);
  946. }
  947. if (this.m_CachedItemIconDic != null)
  948. {
  949. int count = this.m_CachedItemIconDic.Count;
  950. List<Texture> list = new List<Texture>(this.m_CachedItemIconDic.Values);
  951. for (int i = 0; i < list.Count; i++)
  952. {
  953. if (list[i] != null)
  954. {
  955. UnityEngine.Object.DestroyImmediate(list[i], true);
  956. }
  957. list[i] = null;
  958. }
  959. this.m_CachedItemIconDic.Clear();
  960. }
  961. if (this.m_GizmoControlObject)
  962. {
  963. UnityEngine.Object.Destroy(this.m_GizmoControlObject);
  964. }
  965. }
  966. [Header("配置オブジェクトのカテゴリ一覧関連")]
  967. [SerializeField]
  968. [Tooltip("配置オブジェクトのカテゴリ一覧関連")]
  969. private uGUIListViewer m_UIParentDeployableObjectCategoryButtons;
  970. [Header("配置可能オブジェクト一覧関連")]
  971. [SerializeField]
  972. [Tooltip("配置可能オブジェクトのボタンを並べている親オブジェクト")]
  973. private uGUIListViewer m_UIParentDeployableObjectButtons;
  974. [Header("オブジェクトパラメータ一覧関連")]
  975. [SerializeField]
  976. [Tooltip("選択中の配置オブジェクトの有効/無効を切り替えるトグル ")]
  977. private Toggle m_UIToggleObjectEnable;
  978. [SerializeField]
  979. [Tooltip("オブジェクトのパラメータ操作スナップの有効/無効を切り替えるトグル")]
  980. private Toggle m_UIToggleGizmoGridEnable;
  981. [SerializeField]
  982. [Tooltip("選択中の配置オブジェクトの座標を入出力するエリア")]
  983. private InputField m_UIInputFieldPosX;
  984. [SerializeField]
  985. [Tooltip("選択中の配置オブジェクトの座標を入出力するエリア")]
  986. private InputField m_UIInputFieldPosY;
  987. [SerializeField]
  988. [Tooltip("選択中の配置オブジェクトの座標を入出力するエリア")]
  989. private InputField m_UIInputFieldPosZ;
  990. [SerializeField]
  991. [Tooltip("選択中の配置オブジェクトの回転を入出力するエリア")]
  992. private InputField m_UIInputFieldEulerX;
  993. [SerializeField]
  994. [Tooltip("選択中の配置オブジェクトの回転を入出力するエリア")]
  995. private InputField m_UIInputFieldEulerY;
  996. [SerializeField]
  997. [Tooltip("選択中の配置オブジェクトの回転を入出力するエリア")]
  998. private InputField m_UIInputFieldEulerZ;
  999. [SerializeField]
  1000. [Tooltip("選択中の配置オブジェクトの大きさを入出力するエリア")]
  1001. private InputField m_UIInputFieldScale;
  1002. [SerializeField]
  1003. [Tooltip("選択中の配置オブジェクトの大きさを入出力するスライダー")]
  1004. private Slider m_UISliderScale;
  1005. [Header("配置中オブジェクト一覧関連")]
  1006. [SerializeField]
  1007. [Tooltip("配置中オブジェクトの数を表示するテキスト")]
  1008. private Text m_UITextDeployObjectNum;
  1009. [SerializeField]
  1010. [Tooltip("配置中オブジェクトのボタンを並べている親オブジェクト")]
  1011. private uGUIListViewer m_UIParentDeploymentObjectButtons;
  1012. [SerializeField]
  1013. [Tooltip("すべての配置中オブジェクトの表示/非表示を切り替えるトグル")]
  1014. private Toggle m_UIToggleVisibleDeployObject;
  1015. private GameObject m_SelectingObject;
  1016. private CreativeRoomUIObjectSettings.GizmoObject m_GizmoControlObject;
  1017. private Dictionary<GameObject, CreativeRoomUIObjectSettings.DeployObjectInstanceData> m_DeploymentObjectInstanceArray = new Dictionary<GameObject, CreativeRoomUIObjectSettings.DeployObjectInstanceData>();
  1018. private Dictionary<string, string> m_Clipboard = new Dictionary<string, string>();
  1019. private Dictionary<int, Texture> m_CachedItemIconDic = new Dictionary<int, Texture>();
  1020. private CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL m_TypeGizmoControl;
  1021. private CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL m_TypeObjectControl;
  1022. private float m_SnapValuePosition = 0.5f;
  1023. private float m_SnapValueRotation = 15f;
  1024. private float m_SnapValueScale = 0.1f;
  1025. private bool m_IsVisibleDeployObject;
  1026. private enum TYPE_GIZMO_CONTROL
  1027. {
  1028. Move,
  1029. Rotate,
  1030. None
  1031. }
  1032. private enum TYPE_OBJECT_CONTROL
  1033. {
  1034. Default,
  1035. Snap
  1036. }
  1037. private class DeployObjectInstanceData
  1038. {
  1039. public DeployObjectInstanceData(CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL type_, int objectID_, GameObject uiButtonObject_)
  1040. {
  1041. this.type = type_;
  1042. this.objectID = objectID_;
  1043. this.uiButtonObject = uiButtonObject_;
  1044. this.active = true;
  1045. }
  1046. public CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL type;
  1047. public int objectID;
  1048. public GameObject uiButtonObject;
  1049. public bool active;
  1050. }
  1051. private class MouseEvent : MonoBehaviour, IPointerClickHandler, IBeginDragHandler, IEndDragHandler, IEventSystemHandler
  1052. {
  1053. public void OnPointerClick(PointerEventData data)
  1054. {
  1055. if (this.onPointerClick != null)
  1056. {
  1057. this.onPointerClick(data);
  1058. }
  1059. }
  1060. public void OnBeginDrag(PointerEventData data)
  1061. {
  1062. if (this.onBeginDrag != null)
  1063. {
  1064. this.onBeginDrag(data);
  1065. }
  1066. }
  1067. public void OnEndDrag(PointerEventData data)
  1068. {
  1069. if (this.onEndDrag != null)
  1070. {
  1071. this.onEndDrag(data);
  1072. }
  1073. }
  1074. public Action<PointerEventData> onPointerClick;
  1075. public Action<PointerEventData> onBeginDrag;
  1076. public Action<PointerEventData> onEndDrag;
  1077. }
  1078. private class GizmoObject : MonoBehaviour
  1079. {
  1080. public GizmoRender gizmoRot { get; private set; }
  1081. public WorldTransformAxis gizmoAxis { get; private set; }
  1082. public Vector3 pos
  1083. {
  1084. get
  1085. {
  1086. return base.transform.position;
  1087. }
  1088. set
  1089. {
  1090. base.transform.position = value;
  1091. }
  1092. }
  1093. public Vector3 eulerAngles
  1094. {
  1095. get
  1096. {
  1097. return this.gizmoRot.transform.eulerAngles;
  1098. }
  1099. set
  1100. {
  1101. this.gizmoRot.transform.eulerAngles = value;
  1102. }
  1103. }
  1104. public Vector3 scale
  1105. {
  1106. get
  1107. {
  1108. return this.gizmoRot.transform.localScale;
  1109. }
  1110. set
  1111. {
  1112. this.gizmoRot.transform.localScale = value;
  1113. }
  1114. }
  1115. public Quaternion rot
  1116. {
  1117. get
  1118. {
  1119. return this.gizmoRot.transform.rotation;
  1120. }
  1121. set
  1122. {
  1123. this.gizmoRot.transform.rotation = value;
  1124. }
  1125. }
  1126. public bool activeAxis
  1127. {
  1128. get
  1129. {
  1130. return this.gizmoAxis.gameObject.activeInHierarchy;
  1131. }
  1132. set
  1133. {
  1134. this.gizmoAxis.gameObject.SetActive(value);
  1135. }
  1136. }
  1137. public bool activeRot
  1138. {
  1139. get
  1140. {
  1141. return this.gizmoRot.gameObject.activeInHierarchy;
  1142. }
  1143. set
  1144. {
  1145. this.gizmoRot.gameObject.SetActive(value);
  1146. }
  1147. }
  1148. public void Initialize(GizmoRender gizmoRot, WorldTransformAxis gizmoAxis)
  1149. {
  1150. this.gizmoRot = gizmoRot;
  1151. this.gizmoAxis = gizmoAxis;
  1152. this.gizmoRot.transform.SetParent(base.gameObject.transform);
  1153. this.gizmoAxis.transform.SetParent(base.gameObject.transform);
  1154. }
  1155. private void OnDestroy()
  1156. {
  1157. if (this.gizmoRot != null && this.gizmoRot.lineMaterial != null)
  1158. {
  1159. UnityEngine.Object.Destroy(this.gizmoRot.lineMaterial);
  1160. }
  1161. }
  1162. }
  1163. }
  1164. }