CreativeRoomUIObjectSettings.cs 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237
  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. List<PlacementData.Data> dataList = PlacementData.GetDatas((PlacementData.Data data) => data.categoryID == placementObjCategoryID);
  501. Debug.LogFormat("カテゴリID「{0}」\nデータ数「{1}」", new object[]
  502. {
  503. placementObjCategoryID,
  504. dataList.Count
  505. });
  506. this.m_UIParentDeployableObjectButtons.Show<Button>(dataList.Count, delegate(int i, Button button)
  507. {
  508. PlacementData.Data data = dataList[i];
  509. Text componentInChildren = button.GetComponentInChildren<Text>();
  510. RawImage component = button.GetComponent<RawImage>();
  511. Texture texture = null;
  512. if (!this.m_CachedItemIconDic.TryGetValue(data.ID, out texture))
  513. {
  514. texture = data.GetThumbnail();
  515. this.m_CachedItemIconDic.Add(data.ID, texture);
  516. }
  517. if (texture != null)
  518. {
  519. componentInChildren.gameObject.SetActive(false);
  520. component.texture = texture;
  521. }
  522. else
  523. {
  524. componentInChildren.text = data.drawName;
  525. }
  526. button.onClick.AddListener(delegate
  527. {
  528. GameObject gameObject = this.CreateOdoguObject(data.ID);
  529. if (!gameObject)
  530. {
  531. return;
  532. }
  533. this.AddEvent_ObjectClickSelect(gameObject);
  534. this.CreateDeploymentObjectButtons();
  535. this.SetSelectingObject(gameObject, null);
  536. this.m_UIToggleVisibleDeployObject.isOn = true;
  537. });
  538. });
  539. }
  540. private GameObject CreateOdoguObject(int objectID)
  541. {
  542. GameObject gameObject = GameObject.Find("Deployment Object Parent");
  543. if (gameObject == null)
  544. {
  545. gameObject = new GameObject("Deployment Object Parent");
  546. }
  547. if (!PlacementData.Contains(objectID))
  548. {
  549. Debug.LogWarningFormat("[Creative Room]配置物データID[{0}]の情報は存在しません", new object[]
  550. {
  551. objectID
  552. });
  553. return null;
  554. }
  555. PlacementData.Data data = PlacementData.GetData(objectID);
  556. GameObject prefab = data.GetPrefab();
  557. if (prefab == null)
  558. {
  559. return null;
  560. }
  561. GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(prefab);
  562. GameObject gameObject3 = new GameObject(gameObject2.name);
  563. gameObject2.transform.SetParent(gameObject3.transform, true);
  564. CreativeRoomUIObjectSettings.DeployObjectInstanceData value = new CreativeRoomUIObjectSettings.DeployObjectInstanceData(CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL.Default, objectID, null);
  565. this.m_DeploymentObjectInstanceArray.Add(gameObject3, value);
  566. gameObject3.transform.SetParent(gameObject.transform, false);
  567. return gameObject3;
  568. }
  569. private void AddEvent_ObjectClickSelect(GameObject Obj)
  570. {
  571. Collider[] cols = Obj.GetComponentsInChildren<Collider>();
  572. if (cols.Length <= 0)
  573. {
  574. Debug.LogWarning("配置物[" + Obj.name + "]に、当たり判定がついていないので強制的に追加しました");
  575. MeshRenderer componentInChildren = Obj.GetComponentInChildren<MeshRenderer>(true);
  576. if (componentInChildren != null)
  577. {
  578. componentInChildren.gameObject.AddComponent<BoxCollider>();
  579. }
  580. cols = Obj.GetComponentsInChildren<Collider>();
  581. }
  582. CreativeRoomUIObjectSettings.MouseEvent mouseEvent = cols[0].gameObject.AddComponent<CreativeRoomUIObjectSettings.MouseEvent>();
  583. mouseEvent.onPointerClick = delegate(PointerEventData data)
  584. {
  585. if (NInput.GetMouseButtonUp(0))
  586. {
  587. this.SetSelectingObject(Obj, null);
  588. }
  589. };
  590. mouseEvent.onBeginDrag = delegate(PointerEventData data)
  591. {
  592. for (int i = 0; i < cols.Length; i++)
  593. {
  594. cols[i].enabled = false;
  595. }
  596. };
  597. mouseEvent.onEndDrag = delegate(PointerEventData data)
  598. {
  599. for (int i = 0; i < cols.Length; i++)
  600. {
  601. cols[i].enabled = true;
  602. }
  603. };
  604. }
  605. public void ButtonEvent_SetSelectingObjectEnableMove()
  606. {
  607. this.m_GizmoControlObject.activeAxis = true;
  608. this.m_GizmoControlObject.activeRot = false;
  609. this.m_TypeGizmoControl = CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL.Move;
  610. }
  611. public void ButtonEvent_SetSelectingObjectEnableRot()
  612. {
  613. this.m_GizmoControlObject.activeAxis = false;
  614. this.m_GizmoControlObject.activeRot = true;
  615. this.m_TypeGizmoControl = CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL.Rotate;
  616. }
  617. public void ButtonEvent_SetSelectingObjectDisableGizmo()
  618. {
  619. this.m_GizmoControlObject.activeAxis = false;
  620. this.m_GizmoControlObject.activeRot = false;
  621. this.m_TypeGizmoControl = CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL.None;
  622. }
  623. public void SetSelectingObject(GameObject newObj, GameObject buttonObj = null)
  624. {
  625. if (newObj && this.m_GizmoControlObject)
  626. {
  627. this.m_GizmoControlObject.pos = newObj.transform.position;
  628. this.m_GizmoControlObject.eulerAngles = newObj.transform.eulerAngles;
  629. this.m_GizmoControlObject.scale = newObj.transform.localScale;
  630. this.SetDeploymentObjectGizmoEnable(true);
  631. if (this.typeGizmoControl == CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL.Move)
  632. {
  633. this.ButtonEvent_SetSelectingObjectEnableMove();
  634. }
  635. else if (this.typeGizmoControl == CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL.Rotate)
  636. {
  637. this.ButtonEvent_SetSelectingObjectEnableRot();
  638. }
  639. else if (this.typeGizmoControl == CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL.None)
  640. {
  641. this.ButtonEvent_SetSelectingObjectDisableGizmo();
  642. }
  643. }
  644. this.m_SelectingObject = newObj;
  645. this.typeGizmoControl = this.typeGizmoControl;
  646. if (newObj)
  647. {
  648. this.m_UIToggleObjectEnable.isOn = newObj.activeInHierarchy;
  649. }
  650. if (newObj)
  651. {
  652. this.UpdateInputFieldText(newObj.transform);
  653. }
  654. if (newObj == null)
  655. {
  656. if (this.m_GizmoControlObject)
  657. {
  658. this.SetDeploymentObjectGizmoEnable(false);
  659. }
  660. return;
  661. }
  662. Transform transform = this.m_UIParentDeploymentObjectButtons.transform;
  663. if (buttonObj == null && (buttonObj = this.m_DeploymentObjectInstanceArray[newObj].uiButtonObject) == null)
  664. {
  665. return;
  666. }
  667. Color color = new Color(0.65f, 0.65f, 0.65f, 1f);
  668. Color white = Color.white;
  669. for (int i = 0; i < transform.childCount; i++)
  670. {
  671. Transform child = transform.GetChild(i);
  672. Graphic targetGraphic = child.GetChild(0).GetComponent<Selectable>().targetGraphic;
  673. if (buttonObj != child.gameObject)
  674. {
  675. targetGraphic.color = color;
  676. }
  677. else
  678. {
  679. targetGraphic.color = white;
  680. }
  681. }
  682. }
  683. public void ButtonEvent_CameraFocus()
  684. {
  685. if (this.m_SelectingObject == null)
  686. {
  687. return;
  688. }
  689. WfCameraMoveSupport wfCameraMoveSupport = base.GetComponent<WfCameraMoveSupport>();
  690. if (wfCameraMoveSupport == null)
  691. {
  692. wfCameraMoveSupport = base.gameObject.AddComponent<WfCameraMoveSupport>();
  693. }
  694. Vector3 position = this.m_SelectingObject.transform.position;
  695. float distance = 5f;
  696. Vector2 aroundAngle = new Vector2(-135f, 45f);
  697. wfCameraMoveSupport.StartCameraPosition(position, distance, aroundAngle);
  698. }
  699. private void UpdateInputFieldText(Transform trans)
  700. {
  701. if (trans)
  702. {
  703. this.UpdateInputFieldText(trans.position, trans.eulerAngles, trans.lossyScale);
  704. }
  705. else
  706. {
  707. this.UpdateInputFieldText(Vector3.zero, Vector3.zero, Vector3.zero);
  708. }
  709. }
  710. private void UpdateInputFieldText(Vector3 pos, Vector3 euler, Vector3 scale)
  711. {
  712. if (!this.m_UIInputFieldPosX.isFocused)
  713. {
  714. this.m_UIInputFieldPosX.text = pos.x.ToString("f3");
  715. }
  716. if (!this.m_UIInputFieldPosY.isFocused)
  717. {
  718. this.m_UIInputFieldPosY.text = pos.y.ToString("f3");
  719. }
  720. if (!this.m_UIInputFieldPosZ.isFocused)
  721. {
  722. this.m_UIInputFieldPosZ.text = pos.z.ToString("f3");
  723. }
  724. if (!this.m_UIInputFieldEulerX.isFocused)
  725. {
  726. this.m_UIInputFieldEulerX.text = euler.x.ToString("f3");
  727. }
  728. if (!this.m_UIInputFieldEulerY.isFocused)
  729. {
  730. this.m_UIInputFieldEulerY.text = euler.y.ToString("f3");
  731. }
  732. if (!this.m_UIInputFieldEulerZ.isFocused)
  733. {
  734. this.m_UIInputFieldEulerZ.text = euler.z.ToString("f3");
  735. }
  736. if (!this.m_UIInputFieldScale.isFocused)
  737. {
  738. this.m_UIInputFieldScale.text = scale.x.ToString("f3");
  739. }
  740. this.m_UISliderScale.value = scale.x;
  741. }
  742. private void CreateDeploymentObjectButtons()
  743. {
  744. uGUIListViewer uiparentDeploymentObjectButtons = this.m_UIParentDeploymentObjectButtons;
  745. Transform transform = uiparentDeploymentObjectButtons.transform;
  746. VerticalLayoutGroup component = uiparentDeploymentObjectButtons.GetComponent<VerticalLayoutGroup>();
  747. component.enabled = false;
  748. Transform child = transform.GetChild(0);
  749. List<GameObject> list = new List<GameObject>(this.m_DeploymentObjectInstanceArray.Keys);
  750. for (int i = 0; i < this.m_DeploymentObjectInstanceArray.Count; i++)
  751. {
  752. GameObject Obj = list[i];
  753. CreativeRoomUIObjectSettings.DeployObjectInstanceData deployObjectInstanceData = this.m_DeploymentObjectInstanceArray[Obj];
  754. if (!(deployObjectInstanceData.uiButtonObject != null))
  755. {
  756. if (PlacementData.Contains(deployObjectInstanceData.objectID))
  757. {
  758. Transform transform2 = UnityEngine.Object.Instantiate<Transform>(child);
  759. transform2.gameObject.SetActive(true);
  760. transform2.SetParent(transform, false);
  761. Button[] componentsInChildren = transform2.GetComponentsInChildren<Button>();
  762. componentsInChildren[0].GetComponentInChildren<Text>().text = PlacementData.GetData(deployObjectInstanceData.objectID).drawName;
  763. componentsInChildren[0].onClick.RemoveAllListeners();
  764. componentsInChildren[1].onClick.RemoveAllListeners();
  765. componentsInChildren[0].onClick.AddListener(delegate
  766. {
  767. if (this.m_SelectingObject == Obj)
  768. {
  769. this.ButtonEvent_CameraFocus();
  770. }
  771. else
  772. {
  773. this.SetSelectingObject(Obj, null);
  774. }
  775. });
  776. componentsInChildren[1].onClick.AddListener(delegate
  777. {
  778. this.DestroyDeploymentObject(Obj);
  779. });
  780. deployObjectInstanceData.uiButtonObject = transform2.gameObject;
  781. }
  782. }
  783. }
  784. this.m_UITextDeployObjectNum.text = this.m_DeploymentObjectInstanceArray.Count.ToString() + "個";
  785. component.enabled = true;
  786. }
  787. private void DestroyDeploymentObject(GameObject Obj)
  788. {
  789. if (this.m_SelectingObject != null && this.m_SelectingObject == Obj)
  790. {
  791. this.SetDeploymentObjectGizmoEnable(false);
  792. }
  793. if (this.m_DeploymentObjectInstanceArray.ContainsKey(Obj))
  794. {
  795. UnityEngine.Object.Destroy(this.m_DeploymentObjectInstanceArray[Obj].uiButtonObject);
  796. this.m_DeploymentObjectInstanceArray.Remove(Obj);
  797. UnityEngine.Object.Destroy(Obj);
  798. }
  799. this.m_UITextDeployObjectNum.text = this.m_DeploymentObjectInstanceArray.Count.ToString() + "個";
  800. }
  801. public void SaveDeployObjectData(BinaryWriter binary)
  802. {
  803. int count = this.m_DeploymentObjectInstanceArray.Count;
  804. binary.Write(count);
  805. List<GameObject> list = new List<GameObject>(this.m_DeploymentObjectInstanceArray.Keys);
  806. for (int i = 0; i < count; i++)
  807. {
  808. GameObject gameObject = list[i];
  809. CreativeRoomUIObjectSettings.DeployObjectInstanceData deployObjectInstanceData = this.m_DeploymentObjectInstanceArray[gameObject];
  810. binary.Write(gameObject.transform.position.x);
  811. binary.Write(gameObject.transform.position.y);
  812. binary.Write(gameObject.transform.position.z);
  813. binary.Write(gameObject.transform.eulerAngles.x);
  814. binary.Write(gameObject.transform.eulerAngles.y);
  815. binary.Write(gameObject.transform.eulerAngles.z);
  816. binary.Write(gameObject.transform.localScale.x);
  817. binary.Write(deployObjectInstanceData.active);
  818. binary.Write(deployObjectInstanceData.objectID);
  819. }
  820. }
  821. public void LoadDeployObjectData(BinaryReader brRead)
  822. {
  823. List<GameObject> list = new List<GameObject>(this.m_DeploymentObjectInstanceArray.Keys);
  824. for (int i = 0; i < list.Count; i++)
  825. {
  826. this.DestroyDeploymentObject(list[i]);
  827. }
  828. int num = brRead.ReadInt32();
  829. for (int j = 0; j < num; j++)
  830. {
  831. Vector3 zero = Vector3.zero;
  832. Vector3 zero2 = Vector3.zero;
  833. Vector3 localScale = Vector3.zero;
  834. zero[0] = brRead.ReadSingle();
  835. zero[1] = brRead.ReadSingle();
  836. zero[2] = brRead.ReadSingle();
  837. zero2[0] = brRead.ReadSingle();
  838. zero2[1] = brRead.ReadSingle();
  839. zero2[2] = brRead.ReadSingle();
  840. localScale = brRead.ReadSingle() * Vector3.one;
  841. bool active = brRead.ReadBoolean();
  842. int objectID = brRead.ReadInt32();
  843. GameObject gameObject = this.CreateOdoguObject(objectID);
  844. if (gameObject)
  845. {
  846. Transform transform = gameObject.transform;
  847. transform.position = zero;
  848. transform.eulerAngles = zero2;
  849. transform.localScale = localScale;
  850. gameObject.SetActive(active);
  851. this.AddEvent_ObjectClickSelect(gameObject);
  852. }
  853. }
  854. this.SetSelectingObject(null, null);
  855. this.CreateDeploymentObjectButtons();
  856. this.m_UIToggleVisibleDeployObject.isOn = true;
  857. }
  858. public static GameObject Load(BinaryReader brRead)
  859. {
  860. GameObject gameObject = new GameObject("Parent Deployment Object");
  861. Transform transform = gameObject.transform;
  862. int num = brRead.ReadInt32();
  863. for (int i = 0; i < num; i++)
  864. {
  865. Vector3 zero = Vector3.zero;
  866. Vector3 zero2 = Vector3.zero;
  867. Vector3 localScale = Vector3.zero;
  868. zero[0] = brRead.ReadSingle();
  869. zero[1] = brRead.ReadSingle();
  870. zero[2] = brRead.ReadSingle();
  871. zero2[0] = brRead.ReadSingle();
  872. zero2[1] = brRead.ReadSingle();
  873. zero2[2] = brRead.ReadSingle();
  874. localScale = brRead.ReadSingle() * Vector3.one;
  875. bool active = brRead.ReadBoolean();
  876. int num2 = brRead.ReadInt32();
  877. if (!PlacementData.Contains(num2))
  878. {
  879. Debug.LogWarningFormat("[Creative Room]配置物データID[{0}]の情報は存在しません", new object[]
  880. {
  881. num2
  882. });
  883. }
  884. else
  885. {
  886. PlacementData.Data data = PlacementData.GetData(num2);
  887. GameObject prefab = data.GetPrefab();
  888. if (!(prefab == null))
  889. {
  890. GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(prefab);
  891. GameObject gameObject3 = new GameObject(gameObject2.name);
  892. gameObject2.transform.SetParent(gameObject3.transform, true);
  893. Transform transform2 = gameObject3.transform;
  894. transform2.position = zero;
  895. transform2.eulerAngles = zero2;
  896. transform2.localScale = localScale;
  897. gameObject2.SetActive(active);
  898. transform2.SetParent(transform, true);
  899. }
  900. }
  901. }
  902. return gameObject;
  903. }
  904. private void OnEnable()
  905. {
  906. List<int> categoryIDList = PlacementData.CategoryIDList;
  907. this.m_UIParentDeployableObjectCategoryButtons.Show<Button>(categoryIDList.Count, delegate(int i, Button button)
  908. {
  909. Text componentInChildren = button.GetComponentInChildren<Text>();
  910. componentInChildren.text = PlacementData.GetCategoryName(categoryIDList[i]);
  911. button.onClick.AddListener(delegate
  912. {
  913. Debug.LogFormat("カテゴリ「{0}」", new object[]
  914. {
  915. PlacementData.GetCategoryName(categoryIDList[i])
  916. });
  917. this.CreateOdoguObjectButtons(categoryIDList[i]);
  918. });
  919. });
  920. }
  921. private void OnDisable()
  922. {
  923. this.SetDeploymentObjectGizmoEnable(false);
  924. }
  925. private void OnDestroy()
  926. {
  927. if (this.m_DeploymentObjectInstanceArray != null)
  928. {
  929. this.m_DeploymentObjectInstanceArray.Clear();
  930. }
  931. if (this.m_Clipboard != null)
  932. {
  933. this.m_Clipboard.Clear();
  934. }
  935. GameObject gameObject = GameObject.Find("Deployment Object Parent");
  936. if (gameObject != null)
  937. {
  938. UnityEngine.Object.Destroy(gameObject);
  939. }
  940. if (this.m_CachedItemIconDic != null)
  941. {
  942. int count = this.m_CachedItemIconDic.Count;
  943. List<Texture> list = new List<Texture>(this.m_CachedItemIconDic.Values);
  944. for (int i = 0; i < list.Count; i++)
  945. {
  946. if (list[i] != null)
  947. {
  948. UnityEngine.Object.DestroyImmediate(list[i], true);
  949. }
  950. list[i] = null;
  951. }
  952. this.m_CachedItemIconDic.Clear();
  953. }
  954. if (this.m_GizmoControlObject)
  955. {
  956. UnityEngine.Object.Destroy(this.m_GizmoControlObject);
  957. }
  958. }
  959. [Header("配置オブジェクトのカテゴリ一覧関連")]
  960. [SerializeField]
  961. [Tooltip("配置オブジェクトのカテゴリ一覧関連")]
  962. private uGUIListViewer m_UIParentDeployableObjectCategoryButtons;
  963. [Header("配置可能オブジェクト一覧関連")]
  964. [SerializeField]
  965. [Tooltip("配置可能オブジェクトのボタンを並べている親オブジェクト")]
  966. private uGUIListViewer m_UIParentDeployableObjectButtons;
  967. [Header("オブジェクトパラメータ一覧関連")]
  968. [SerializeField]
  969. [Tooltip("選択中の配置オブジェクトの有効/無効を切り替えるトグル ")]
  970. private Toggle m_UIToggleObjectEnable;
  971. [SerializeField]
  972. [Tooltip("オブジェクトのパラメータ操作スナップの有効/無効を切り替えるトグル")]
  973. private Toggle m_UIToggleGizmoGridEnable;
  974. [SerializeField]
  975. [Tooltip("選択中の配置オブジェクトの座標を入出力するエリア")]
  976. private InputField m_UIInputFieldPosX;
  977. [SerializeField]
  978. [Tooltip("選択中の配置オブジェクトの座標を入出力するエリア")]
  979. private InputField m_UIInputFieldPosY;
  980. [SerializeField]
  981. [Tooltip("選択中の配置オブジェクトの座標を入出力するエリア")]
  982. private InputField m_UIInputFieldPosZ;
  983. [SerializeField]
  984. [Tooltip("選択中の配置オブジェクトの回転を入出力するエリア")]
  985. private InputField m_UIInputFieldEulerX;
  986. [SerializeField]
  987. [Tooltip("選択中の配置オブジェクトの回転を入出力するエリア")]
  988. private InputField m_UIInputFieldEulerY;
  989. [SerializeField]
  990. [Tooltip("選択中の配置オブジェクトの回転を入出力するエリア")]
  991. private InputField m_UIInputFieldEulerZ;
  992. [SerializeField]
  993. [Tooltip("選択中の配置オブジェクトの大きさを入出力するエリア")]
  994. private InputField m_UIInputFieldScale;
  995. [SerializeField]
  996. [Tooltip("選択中の配置オブジェクトの大きさを入出力するスライダー")]
  997. private Slider m_UISliderScale;
  998. [Header("配置中オブジェクト一覧関連")]
  999. [SerializeField]
  1000. [Tooltip("配置中オブジェクトの数を表示するテキスト")]
  1001. private Text m_UITextDeployObjectNum;
  1002. [SerializeField]
  1003. [Tooltip("配置中オブジェクトのボタンを並べている親オブジェクト")]
  1004. private uGUIListViewer m_UIParentDeploymentObjectButtons;
  1005. [SerializeField]
  1006. [Tooltip("すべての配置中オブジェクトの表示/非表示を切り替えるトグル")]
  1007. private Toggle m_UIToggleVisibleDeployObject;
  1008. private GameObject m_SelectingObject;
  1009. private CreativeRoomUIObjectSettings.GizmoObject m_GizmoControlObject;
  1010. private Dictionary<GameObject, CreativeRoomUIObjectSettings.DeployObjectInstanceData> m_DeploymentObjectInstanceArray = new Dictionary<GameObject, CreativeRoomUIObjectSettings.DeployObjectInstanceData>();
  1011. private Dictionary<string, string> m_Clipboard = new Dictionary<string, string>();
  1012. private Dictionary<int, Texture> m_CachedItemIconDic = new Dictionary<int, Texture>();
  1013. private CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL m_TypeGizmoControl;
  1014. private CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL m_TypeObjectControl;
  1015. private float m_SnapValuePosition = 0.5f;
  1016. private float m_SnapValueRotation = 15f;
  1017. private float m_SnapValueScale = 0.1f;
  1018. private bool m_IsVisibleDeployObject;
  1019. private enum TYPE_GIZMO_CONTROL
  1020. {
  1021. Move,
  1022. Rotate,
  1023. None
  1024. }
  1025. private enum TYPE_OBJECT_CONTROL
  1026. {
  1027. Default,
  1028. Snap
  1029. }
  1030. private class DeployObjectInstanceData
  1031. {
  1032. public DeployObjectInstanceData(CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL type_, int objectID_, GameObject uiButtonObject_)
  1033. {
  1034. this.type = type_;
  1035. this.objectID = objectID_;
  1036. this.uiButtonObject = uiButtonObject_;
  1037. this.active = true;
  1038. }
  1039. public CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL type;
  1040. public int objectID;
  1041. public GameObject uiButtonObject;
  1042. public bool active;
  1043. }
  1044. private class MouseEvent : MonoBehaviour, IPointerClickHandler, IBeginDragHandler, IEndDragHandler, IEventSystemHandler
  1045. {
  1046. public void OnPointerClick(PointerEventData data)
  1047. {
  1048. if (this.onPointerClick != null)
  1049. {
  1050. this.onPointerClick(data);
  1051. }
  1052. }
  1053. public void OnBeginDrag(PointerEventData data)
  1054. {
  1055. if (this.onBeginDrag != null)
  1056. {
  1057. this.onBeginDrag(data);
  1058. }
  1059. }
  1060. public void OnEndDrag(PointerEventData data)
  1061. {
  1062. if (this.onEndDrag != null)
  1063. {
  1064. this.onEndDrag(data);
  1065. }
  1066. }
  1067. public Action<PointerEventData> onPointerClick;
  1068. public Action<PointerEventData> onBeginDrag;
  1069. public Action<PointerEventData> onEndDrag;
  1070. }
  1071. private class GizmoObject : MonoBehaviour
  1072. {
  1073. public GizmoRender gizmoRot { get; private set; }
  1074. public WorldTransformAxis gizmoAxis { get; private set; }
  1075. public Vector3 pos
  1076. {
  1077. get
  1078. {
  1079. return base.transform.position;
  1080. }
  1081. set
  1082. {
  1083. base.transform.position = value;
  1084. }
  1085. }
  1086. public Vector3 eulerAngles
  1087. {
  1088. get
  1089. {
  1090. return this.gizmoRot.transform.eulerAngles;
  1091. }
  1092. set
  1093. {
  1094. this.gizmoRot.transform.eulerAngles = value;
  1095. }
  1096. }
  1097. public Vector3 scale
  1098. {
  1099. get
  1100. {
  1101. return this.gizmoRot.transform.localScale;
  1102. }
  1103. set
  1104. {
  1105. this.gizmoRot.transform.localScale = value;
  1106. }
  1107. }
  1108. public Quaternion rot
  1109. {
  1110. get
  1111. {
  1112. return this.gizmoRot.transform.rotation;
  1113. }
  1114. set
  1115. {
  1116. this.gizmoRot.transform.rotation = value;
  1117. }
  1118. }
  1119. public bool activeAxis
  1120. {
  1121. get
  1122. {
  1123. return this.gizmoAxis.gameObject.activeInHierarchy;
  1124. }
  1125. set
  1126. {
  1127. this.gizmoAxis.gameObject.SetActive(value);
  1128. }
  1129. }
  1130. public bool activeRot
  1131. {
  1132. get
  1133. {
  1134. return this.gizmoRot.gameObject.activeInHierarchy;
  1135. }
  1136. set
  1137. {
  1138. this.gizmoRot.gameObject.SetActive(value);
  1139. }
  1140. }
  1141. public void Initialize(GizmoRender gizmoRot, WorldTransformAxis gizmoAxis)
  1142. {
  1143. this.gizmoRot = gizmoRot;
  1144. this.gizmoAxis = gizmoAxis;
  1145. this.gizmoRot.transform.SetParent(base.gameObject.transform);
  1146. this.gizmoAxis.transform.SetParent(base.gameObject.transform);
  1147. }
  1148. private void OnDestroy()
  1149. {
  1150. if (this.gizmoRot != null && this.gizmoRot.lineMaterial != null)
  1151. {
  1152. UnityEngine.Object.Destroy(this.gizmoRot.lineMaterial);
  1153. }
  1154. }
  1155. }
  1156. }
  1157. }