using System; using System.Collections.Generic; using System.IO; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; using wf; namespace MyRoomCustom { public class CreativeRoomUIObjectSettings : MonoBehaviour { private CreativeRoomUIObjectSettings.TYPE_GIZMO_CONTROL typeGizmoControl { get { return this.m_TypeGizmoControl; } set { this.m_TypeGizmoControl = value; } } private CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL typeObjectControl { get { return this.m_TypeObjectControl; } set { this.m_TypeObjectControl = value; } } public float snapValuePosition { get { return this.m_SnapValuePosition; } set { this.m_SnapValuePosition = value; } } public float snapValueRotation { get { return this.m_SnapValueRotation; } set { this.m_SnapValueRotation = value; } } public float snapValueScale { get { return this.m_SnapValueScale; } set { this.m_SnapValueScale = value; } } public bool isVisibleDeployObject { get { return this.m_IsVisibleDeployObject; } set { Toggle uitoggleVisibleDeployObject = this.m_UIToggleVisibleDeployObject; this.m_IsVisibleDeployObject = value; uitoggleVisibleDeployObject.isOn = value; } } private void Awake() { } private void Start() { if (this.m_GizmoControlObject == null) { this.m_GizmoControlObject = new GameObject("[CreativeRoomUI ObjectSettings] GizmoControlObject").AddComponent(); GameObject gameObject = new GameObject("Gizmo Rot"); GameObject gameObject2 = Utility.CreatePrefab(null, "System/Prefab/XYZAxis", true); GizmoRender gizmoRender = gameObject.AddComponent(); WorldTransformAxis component = gameObject2.GetComponent(); this.m_GizmoControlObject.Initialize(gizmoRender, component); gizmoRender.offsetScale = 1f; gizmoRender.eAxis = false; gizmoRender.eRotate = true; gizmoRender.eScal = false; component.TargetObject = this.m_GizmoControlObject.gameObject; this.ButtonEvent_SetSelectingObjectEnableMove(); if (this.m_SelectingObject != null) { Transform transform = this.m_SelectingObject.transform; this.m_GizmoControlObject.pos = transform.position; this.m_GizmoControlObject.eulerAngles = transform.eulerAngles; this.m_GizmoControlObject.scale = transform.localScale; } else { this.SetDeploymentObjectGizmoEnable(false); } } this.m_UIToggleObjectEnable.onValueChanged.AddListener(delegate(bool value) { if (this.m_SelectingObject) { this.m_SelectingObject.SetActive(value); this.m_DeploymentObjectInstanceArray[this.m_SelectingObject].active = value; } }); this.m_UIToggleGizmoGridEnable.onValueChanged.AddListener(delegate(bool value) { this.typeObjectControl = ((!value) ? CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL.Default : CreativeRoomUIObjectSettings.TYPE_OBJECT_CONTROL.Snap); }); Action, Action> action = delegate(InputField input_field_, Action delegate_changed, Action delegate_end) { input_field_.onValueChanged.AddListener(delegate(string str) { if (!input_field_.isFocused || this.m_SelectingObject == null || delegate_changed == null) { return; } float obj; if (float.TryParse(str, out obj)) { delegate_changed(obj); } }); input_field_.onEndEdit.AddListener(delegate(string str) { if (this.m_SelectingObject == null || delegate_end == null) { return; } delegate_end(); }); }; action(this.m_UIInputFieldPosX, delegate(float value) { Vector3 pos = this.m_GizmoControlObject.pos; pos.x = value; Transform transform2 = this.m_SelectingObject.transform; Vector3 vector = pos; this.m_GizmoControlObject.pos = vector; transform2.position = vector; }, delegate { this.m_UIInputFieldPosX.text = this.m_GizmoControlObject.pos.x.ToString("f3"); }); action(this.m_UIInputFieldPosY, delegate(float value) { Vector3 pos = this.m_GizmoControlObject.pos; pos.y = value; Transform transform2 = this.m_SelectingObject.transform; Vector3 vector = pos; this.m_GizmoControlObject.pos = vector; transform2.position = vector; }, delegate { this.m_UIInputFieldPosY.text = this.m_GizmoControlObject.pos.y.ToString("f3"); }); action(this.m_UIInputFieldPosZ, delegate(float value) { Vector3 pos = this.m_GizmoControlObject.pos; pos.z = value; Transform transform2 = this.m_SelectingObject.transform; Vector3 vector = pos; this.m_GizmoControlObject.pos = vector; transform2.position = vector; }, delegate { this.m_UIInputFieldPosZ.text = this.m_GizmoControlObject.pos.z.ToString("f3"); }); action(this.m_UIInputFieldEulerX, delegate(float value) { Vector3 eulerAngles = this.m_GizmoControlObject.eulerAngles; eulerAngles.x = value; Transform transform2 = this.m_SelectingObject.transform; Vector3 eulerAngles2 = eulerAngles; this.m_GizmoControlObject.eulerAngles = eulerAngles2; transform2.eulerAngles = eulerAngles2; }, delegate { this.m_UIInputFieldEulerX.text = this.m_GizmoControlObject.eulerAngles.x.ToString("f3"); }); action(this.m_UIInputFieldEulerY, delegate(float value) { Vector3 eulerAngles = this.m_GizmoControlObject.eulerAngles; eulerAngles.y = value; Transform transform2 = this.m_SelectingObject.transform; Vector3 eulerAngles2 = eulerAngles; this.m_GizmoControlObject.eulerAngles = eulerAngles2; transform2.eulerAngles = eulerAngles2; }, delegate { this.m_UIInputFieldEulerY.text = this.m_GizmoControlObject.eulerAngles.y.ToString("f3"); }); action(this.m_UIInputFieldEulerZ, delegate(float value) { Vector3 eulerAngles = this.m_GizmoControlObject.eulerAngles; eulerAngles.z = value; Transform transform2 = this.m_SelectingObject.transform; Vector3 eulerAngles2 = eulerAngles; this.m_GizmoControlObject.eulerAngles = eulerAngles2; transform2.eulerAngles = eulerAngles2; }, delegate { this.m_UIInputFieldEulerZ.text = this.m_GizmoControlObject.eulerAngles.z.ToString("f3"); }); action(this.m_UIInputFieldScale, delegate(float value) { Vector3 scale = this.m_GizmoControlObject.scale; value = Mathf.Clamp(value, this.m_UISliderScale.minValue, this.m_UISliderScale.maxValue); scale.x = (scale.y = (scale.z = value)); Transform transform2 = this.m_SelectingObject.transform; Vector3 vector = scale; this.m_GizmoControlObject.scale = vector; transform2.localScale = vector; this.m_UISliderScale.value = value; }, delegate { this.m_UIInputFieldScale.text = this.m_GizmoControlObject.scale.x.ToString("f3"); }); this.m_UISliderScale.onValueChanged.AddListener(delegate(float value) { if (this.m_GizmoControlObject == null || this.m_SelectingObject == null) { return; } Vector3 scale = this.m_GizmoControlObject.scale; scale.x = (scale.y = scale.z); if (!this.m_SelectingObject.activeInHierarchy) { if (Mathf.Approximately(scale.x, value)) { return; } this.m_UISliderScale.value = scale.x; return; } else { if (Mathf.Approximately(scale.x, value)) { return; } this.m_GizmoControlObject.scale = Vector3.one * value; this.m_UIInputFieldScale.text = value.ToString("f3"); return; } }); Action> action2 = delegate(string key, Button button, Func delegate_get_vector3) { button.onClick.AddListener(delegate() { if (this.m_SelectingObject == null) { return; } Vector3 vector = delegate_get_vector3(); StringWriter stringWriter = new StringWriter(); stringWriter.WriteLine(vector.x); stringWriter.WriteLine(vector.y); stringWriter.WriteLine(vector.z); this.SetClipboardData(key, stringWriter.ToString()); }); }; Action> action3 = delegate(string key, Button button, Action delegate_return_vector3) { button.onClick.AddListener(delegate() { if (this.m_SelectingObject == null) { return; } string clipboardData = this.GetClipboardData(key); if (clipboardData == string.Empty) { return; } StringReader stringReader = new StringReader(clipboardData); try { Vector3 obj = default(Vector3); obj.x = float.Parse(stringReader.ReadLine()); obj.y = float.Parse(stringReader.ReadLine()); obj.z = float.Parse(stringReader.ReadLine()); delegate_return_vector3(obj); } catch { } }); }; Action, Action> action4 = delegate(Button button, Func delegate_get_vector3, Action delegate_return_vector3) { button.onClick.AddListener(delegate() { if (this.m_SelectingObject == null) { return; } delegate_return_vector3(delegate_get_vector3()); this.UpdateInputFieldText(this.m_SelectingObject.transform); }); }; Transform parent = this.m_UIInputFieldPosX.transform.parent; Button component2 = parent.Find("Button Copy").GetComponent