CreativeRoomUIObjectSettings.cs 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242
  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. componentsInChildren[0].onClick.RemoveAllListeners();
  767. componentsInChildren[1].onClick.RemoveAllListeners();
  768. componentsInChildren[0].onClick.AddListener(delegate()
  769. {
  770. if (this.m_SelectingObject == Obj)
  771. {
  772. this.ButtonEvent_CameraFocus();
  773. }
  774. else
  775. {
  776. this.SetSelectingObject(Obj, null);
  777. }
  778. });
  779. componentsInChildren[1].onClick.AddListener(delegate()
  780. {
  781. this.DestroyDeploymentObject(Obj);
  782. });
  783. deployObjectInstanceData.uiButtonObject = transform2.gameObject;
  784. }
  785. }
  786. }
  787. this.m_UITextDeployObjectNum.text = this.m_DeploymentObjectInstanceArray.Count.ToString() + "個";
  788. component.enabled = true;
  789. }
  790. private void DestroyDeploymentObject(GameObject Obj)
  791. {
  792. if (this.m_SelectingObject != null && this.m_SelectingObject == Obj)
  793. {
  794. this.SetDeploymentObjectGizmoEnable(false);
  795. }
  796. if (this.m_DeploymentObjectInstanceArray.ContainsKey(Obj))
  797. {
  798. UnityEngine.Object.Destroy(this.m_DeploymentObjectInstanceArray[Obj].uiButtonObject);
  799. this.m_DeploymentObjectInstanceArray.Remove(Obj);
  800. UnityEngine.Object.Destroy(Obj);
  801. }
  802. this.m_UITextDeployObjectNum.text = this.m_DeploymentObjectInstanceArray.Count.ToString() + "個";
  803. }
  804. public void SaveDeployObjectData(BinaryWriter binary)
  805. {
  806. int count = this.m_DeploymentObjectInstanceArray.Count;
  807. binary.Write(count);
  808. List<GameObject> list = new List<GameObject>(this.m_DeploymentObjectInstanceArray.Keys);
  809. for (int i = 0; i < count; i++)
  810. {
  811. GameObject gameObject = list[i];
  812. CreativeRoomUIObjectSettings.DeployObjectInstanceData deployObjectInstanceData = this.m_DeploymentObjectInstanceArray[gameObject];
  813. binary.Write(gameObject.transform.position.x);
  814. binary.Write(gameObject.transform.position.y);
  815. binary.Write(gameObject.transform.position.z);
  816. binary.Write(gameObject.transform.eulerAngles.x);
  817. binary.Write(gameObject.transform.eulerAngles.y);
  818. binary.Write(gameObject.transform.eulerAngles.z);
  819. binary.Write(gameObject.transform.localScale.x);
  820. binary.Write(deployObjectInstanceData.active);
  821. binary.Write(deployObjectInstanceData.objectID);
  822. }
  823. }
  824. public void LoadDeployObjectData(BinaryReader brRead)
  825. {
  826. List<GameObject> list = new List<GameObject>(this.m_DeploymentObjectInstanceArray.Keys);
  827. for (int i = 0; i < list.Count; i++)
  828. {
  829. this.DestroyDeploymentObject(list[i]);
  830. }
  831. int num = brRead.ReadInt32();
  832. for (int j = 0; j < num; j++)
  833. {
  834. Vector3 zero = Vector3.zero;
  835. Vector3 zero2 = Vector3.zero;
  836. Vector3 localScale = Vector3.zero;
  837. zero[0] = brRead.ReadSingle();
  838. zero[1] = brRead.ReadSingle();
  839. zero[2] = brRead.ReadSingle();
  840. zero2[0] = brRead.ReadSingle();
  841. zero2[1] = brRead.ReadSingle();
  842. zero2[2] = brRead.ReadSingle();
  843. localScale = brRead.ReadSingle() * Vector3.one;
  844. bool active = brRead.ReadBoolean();
  845. int objectID = brRead.ReadInt32();
  846. GameObject gameObject = this.CreateOdoguObject(objectID);
  847. if (gameObject)
  848. {
  849. Transform transform = gameObject.transform;
  850. transform.position = zero;
  851. transform.eulerAngles = zero2;
  852. transform.localScale = localScale;
  853. gameObject.SetActive(active);
  854. this.AddEvent_ObjectClickSelect(gameObject);
  855. }
  856. }
  857. this.SetSelectingObject(null, null);
  858. this.CreateDeploymentObjectButtons();
  859. this.m_UIToggleVisibleDeployObject.isOn = true;
  860. }
  861. public static GameObject Load(BinaryReader brRead)
  862. {
  863. GameObject gameObject = new GameObject("Parent Deployment Object");
  864. Transform transform = gameObject.transform;
  865. int num = brRead.ReadInt32();
  866. for (int i = 0; i < num; i++)
  867. {
  868. Vector3 zero = Vector3.zero;
  869. Vector3 zero2 = Vector3.zero;
  870. Vector3 localScale = Vector3.zero;
  871. zero[0] = brRead.ReadSingle();
  872. zero[1] = brRead.ReadSingle();
  873. zero[2] = brRead.ReadSingle();
  874. zero2[0] = brRead.ReadSingle();
  875. zero2[1] = brRead.ReadSingle();
  876. zero2[2] = brRead.ReadSingle();
  877. localScale = brRead.ReadSingle() * Vector3.one;
  878. bool active = brRead.ReadBoolean();
  879. int num2 = brRead.ReadInt32();
  880. if (!PlacementData.Contains(num2))
  881. {
  882. Debug.LogWarningFormat("[Creative Room]配置物データID[{0}]の情報は存在しません", new object[]
  883. {
  884. num2
  885. });
  886. }
  887. else
  888. {
  889. PlacementData.Data data = PlacementData.GetData(num2);
  890. GameObject prefab = data.GetPrefab();
  891. if (!(prefab == null))
  892. {
  893. GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(prefab);
  894. GameObject gameObject3 = new GameObject(gameObject2.name);
  895. gameObject2.transform.SetParent(gameObject3.transform, true);
  896. Transform transform2 = gameObject3.transform;
  897. transform2.position = zero;
  898. transform2.eulerAngles = zero2;
  899. transform2.localScale = localScale;
  900. gameObject2.SetActive(active);
  901. transform2.SetParent(transform, true);
  902. }
  903. }
  904. }
  905. return gameObject;
  906. }
  907. private void OnEnable()
  908. {
  909. CreativeRoomUIObjectSettings.<OnEnable>c__AnonStorey8 <OnEnable>c__AnonStorey = new CreativeRoomUIObjectSettings.<OnEnable>c__AnonStorey8();
  910. <OnEnable>c__AnonStorey.$this = this;
  911. <OnEnable>c__AnonStorey.categoryIDList = PlacementData.CategoryIDList;
  912. this.m_UIParentDeployableObjectCategoryButtons.Show<Button>(<OnEnable>c__AnonStorey.categoryIDList.Count, delegate(int i, Button button)
  913. {
  914. Text componentInChildren = button.GetComponentInChildren<Text>();
  915. componentInChildren.text = PlacementData.GetCategoryName(<OnEnable>c__AnonStorey.categoryIDList[i]);
  916. button.onClick.AddListener(delegate()
  917. {
  918. Debug.LogFormat("カテゴリ「{0}」", new object[]
  919. {
  920. PlacementData.GetCategoryName(<OnEnable>c__AnonStorey.categoryIDList[i])
  921. });
  922. <OnEnable>c__AnonStorey.CreateOdoguObjectButtons(<OnEnable>c__AnonStorey.categoryIDList[i]);
  923. });
  924. });
  925. }
  926. private void OnDisable()
  927. {
  928. this.SetDeploymentObjectGizmoEnable(false);
  929. }
  930. private void OnDestroy()
  931. {
  932. if (this.m_DeploymentObjectInstanceArray != null)
  933. {
  934. this.m_DeploymentObjectInstanceArray.Clear();
  935. }
  936. if (this.m_Clipboard != null)
  937. {
  938. this.m_Clipboard.Clear();
  939. }
  940. GameObject gameObject = GameObject.Find("Deployment Object Parent");
  941. if (gameObject != null)
  942. {
  943. UnityEngine.Object.Destroy(gameObject);
  944. }
  945. if (this.m_CachedItemIconDic != null)
  946. {
  947. int count = this.m_CachedItemIconDic.Count;
  948. List<Texture> list = new List<Texture>(this.m_CachedItemIconDic.Values);
  949. for (int i = 0; i < list.Count; i++)
  950. {
  951. if (list[i] != null)
  952. {
  953. UnityEngine.Object.DestroyImmediate(list[i], true);
  954. }
  955. list[i] = null;
  956. }
  957. this.m_CachedItemIconDic.Clear();
  958. }
  959. if (this.m_GizmoControlObject)
  960. {
  961. UnityEngine.Object.Destroy(this.m_GizmoControlObject);
  962. }
  963. }
  964. [Header("配置オブジェクトのカテゴリ一覧関連")]
  965. [SerializeField]
  966. [Tooltip("配置オブジェクトのカテゴリ一覧関連")]
  967. private uGUIListViewer m_UIParentDeployableObjectCategoryButtons;
  968. [Header("配置可能オブジェクト一覧関連")]
  969. [SerializeField]
  970. [Tooltip("配置可能オブジェクトのボタンを並べている親オブジェクト")]
  971. private uGUIListViewer m_UIParentDeployableObjectButtons;
  972. [Header("オブジェクトパラメータ一覧関連")]
  973. [SerializeField]
  974. [Tooltip("選択中の配置オブジェクトの有効/無効を切り替えるトグル ")]
  975. private Toggle m_UIToggleObjectEnable;
  976. [SerializeField]
  977. [Tooltip("オブジェクトのパラメータ操作スナップの有効/無効を切り替えるトグル")]
  978. private Toggle m_UIToggleGizmoGridEnable;
  979. [SerializeField]
  980. [Tooltip("選択中の配置オブジェクトの座標を入出力するエリア")]
  981. private InputField m_UIInputFieldPosX;
  982. [SerializeField]
  983. [Tooltip("選択中の配置オブジェクトの座標を入出力するエリア")]
  984. private InputField m_UIInputFieldPosY;
  985. [SerializeField]
  986. [Tooltip("選択中の配置オブジェクトの座標を入出力するエリア")]
  987. private InputField m_UIInputFieldPosZ;
  988. [SerializeField]
  989. [Tooltip("選択中の配置オブジェクトの回転を入出力するエリア")]
  990. private InputField m_UIInputFieldEulerX;
  991. [SerializeField]
  992. [Tooltip("選択中の配置オブジェクトの回転を入出力するエリア")]
  993. private InputField m_UIInputFieldEulerY;
  994. [SerializeField]
  995. [Tooltip("選択中の配置オブジェクトの回転を入出力するエリア")]
  996. private InputField m_UIInputFieldEulerZ;
  997. [SerializeField]
  998. [Tooltip("選択中の配置オブジェクトの大きさを入出力するエリア")]
  999. private InputField m_UIInputFieldScale;
  1000. [SerializeField]
  1001. [Tooltip("選択中の配置オブジェクトの大きさを入出力するスライダー")]
  1002. private Slider m_UISliderScale;
  1003. [Header("配置中オブジェクト一覧関連")]
  1004. [SerializeField]
  1005. [Tooltip("配置中オブジェクトの数を表示するテキスト")]
  1006. private Text m_UITextDeployObjectNum;
  1007. [SerializeField]
  1008. [Tooltip("配置中オブジェクトのボタンを並べている親オブジェクト")]
  1009. private uGUIListViewer m_UIParentDeploymentObjectButtons;
  1010. [SerializeField]
  1011. [Tooltip("すべての配置中オブジェクトの表示/非表示を切り替えるトグル")]
  1012. private Toggle m_UIToggleVisibleDeployObject;
  1013. private GameObject m_SelectingObject;
  1014. private CreativeRoomUIObjectSettings.GizmoObject m_GizmoControlObject;
  1015. private Dictionary<GameObject, CreativeRoomUIObjectSettings.DeployObjectInstanceData> m_DeploymentObjectInstanceArray = new Dictionary<GameObject, CreativeRoomUIObjectSettings.DeployObjectInstanceData>();
  1016. private Dictionary<string, string> m_Clipboard = new Dictionary<string, string>();
  1017. private Dictionary<int, Texture> m_CachedItemIconDic = new Dictionary<int, Texture>();
  1018. private CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL m_TypeGizmoControl;
  1019. private CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL m_TypeObjectControl;
  1020. private float m_SnapValuePosition = 0.5f;
  1021. private float m_SnapValueRotation = 15f;
  1022. private float m_SnapValueScale = 0.1f;
  1023. private bool m_IsVisibleDeployObject;
  1024. private enum TYPE_GIZMO_CONTROL
  1025. {
  1026. Move,
  1027. Rotate,
  1028. None
  1029. }
  1030. private enum TYPE_OBJECT_CONTROL
  1031. {
  1032. Default,
  1033. Snap
  1034. }
  1035. private class DeployObjectInstanceData
  1036. {
  1037. public DeployObjectInstanceData(CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL type_, int objectID_, GameObject uiButtonObject_)
  1038. {
  1039. this.type = type_;
  1040. this.objectID = objectID_;
  1041. this.uiButtonObject = uiButtonObject_;
  1042. this.active = true;
  1043. }
  1044. public CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL type;
  1045. public int objectID;
  1046. public GameObject uiButtonObject;
  1047. public bool active;
  1048. }
  1049. private class MouseEvent : MonoBehaviour, IPointerClickHandler, IBeginDragHandler, IEndDragHandler, IEventSystemHandler
  1050. {
  1051. public void OnPointerClick(PointerEventData data)
  1052. {
  1053. if (this.onPointerClick != null)
  1054. {
  1055. this.onPointerClick(data);
  1056. }
  1057. }
  1058. public void OnBeginDrag(PointerEventData data)
  1059. {
  1060. if (this.onBeginDrag != null)
  1061. {
  1062. this.onBeginDrag(data);
  1063. }
  1064. }
  1065. public void OnEndDrag(PointerEventData data)
  1066. {
  1067. if (this.onEndDrag != null)
  1068. {
  1069. this.onEndDrag(data);
  1070. }
  1071. }
  1072. public Action<PointerEventData> onPointerClick;
  1073. public Action<PointerEventData> onBeginDrag;
  1074. public Action<PointerEventData> onEndDrag;
  1075. }
  1076. private class GizmoObject : MonoBehaviour
  1077. {
  1078. public GizmoRender gizmoRot { get; private set; }
  1079. public WorldTransformAxis gizmoAxis { get; private set; }
  1080. public Vector3 pos
  1081. {
  1082. get
  1083. {
  1084. return base.transform.position;
  1085. }
  1086. set
  1087. {
  1088. base.transform.position = value;
  1089. }
  1090. }
  1091. public Vector3 eulerAngles
  1092. {
  1093. get
  1094. {
  1095. return this.gizmoRot.transform.eulerAngles;
  1096. }
  1097. set
  1098. {
  1099. this.gizmoRot.transform.eulerAngles = value;
  1100. }
  1101. }
  1102. public Vector3 scale
  1103. {
  1104. get
  1105. {
  1106. return this.gizmoRot.transform.localScale;
  1107. }
  1108. set
  1109. {
  1110. this.gizmoRot.transform.localScale = value;
  1111. }
  1112. }
  1113. public Quaternion rot
  1114. {
  1115. get
  1116. {
  1117. return this.gizmoRot.transform.rotation;
  1118. }
  1119. set
  1120. {
  1121. this.gizmoRot.transform.rotation = value;
  1122. }
  1123. }
  1124. public bool activeAxis
  1125. {
  1126. get
  1127. {
  1128. return this.gizmoAxis.gameObject.activeInHierarchy;
  1129. }
  1130. set
  1131. {
  1132. this.gizmoAxis.gameObject.SetActive(value);
  1133. }
  1134. }
  1135. public bool activeRot
  1136. {
  1137. get
  1138. {
  1139. return this.gizmoRot.gameObject.activeInHierarchy;
  1140. }
  1141. set
  1142. {
  1143. this.gizmoRot.gameObject.SetActive(value);
  1144. }
  1145. }
  1146. public void Initialize(GizmoRender gizmoRot, WorldTransformAxis gizmoAxis)
  1147. {
  1148. this.gizmoRot = gizmoRot;
  1149. this.gizmoAxis = gizmoAxis;
  1150. this.gizmoRot.transform.SetParent(base.gameObject.transform);
  1151. this.gizmoAxis.transform.SetParent(base.gameObject.transform);
  1152. }
  1153. private void OnDestroy()
  1154. {
  1155. if (this.gizmoRot != null && this.gizmoRot.lineMaterial != null)
  1156. {
  1157. UnityEngine.Object.Destroy(this.gizmoRot.lineMaterial);
  1158. }
  1159. }
  1160. }
  1161. }
  1162. }