static void Gen_GF_UIPreview() { GameObject go = new GameObject("UIPreview"); go.layer = LayerMask.NameToLayer("UI"); go.AddComponent <RectTransform>().sizeDelta = new Vector2(100, 100); UIPreview uit = go.AddComponent <UIPreview>(); uit.raycastTarget = true; AddToUIRoot(go); }
public override void OnInspectorGUI() { UIPreview ui = target as UIPreview; EditorTools.DrawUpdateKeyTextField(ui); UITextureEditor.DrawSpriteElement(ui.texture as Texture2D); base.OnInspectorGUI(); GUILayout.Space(10); Vector3 previewPos = EditorGUILayout.Vector3Field("Preview Pos", ui.previewPos); Vector3 previewEuler = EditorGUILayout.Vector3Field("Preview Pos", ui.previewEuler); float FOV = EditorGUILayout.FloatField("Filed Of View", ui.FOV); float fieldDistance = EditorGUILayout.FloatField("Filed Distance", ui.fieldDistance); bool useDragRotate = EditorGUILayout.Toggle("Drag Rotate", ui.useDragRotate); float speedRotate = EditorGUILayout.FloatField("Speed Rotate", ui.speedRotate); string ePressClick = EditorGUILayout.TextField("Click Event", ui.ePressClick); string eParam = EditorGUILayout.TextField("Click Param", ui.eParam); if (GUI.changed) { EditorTools.RegisterUndo("UITexture", ui); ui.previewPos = previewPos; ui.previewEuler = previewEuler; ui.FOV = FOV; ui.fieldDistance = fieldDistance; ui.useDragRotate = useDragRotate; ui.speedRotate = speedRotate; ui.ePressClick = ePressClick; ui.eParam = eParam; EditorTools.SetDirty(ui); } }
private void Start() { Button retakeButton = transform.Find("RetakePhoto").GetComponent <Button>(); Button nextButton = transform.Find("Next").GetComponent <Button>(); Button middleButton = transform.Find("Middle").GetComponent <Button>(); Button rightButton = transform.Find("Right").GetComponent <Button>(); Button leftButton = transform.Find("Left").GetComponent <Button>(); retakeButton.onClick.AddListener(OnButtonRetake); nextButton.onClick.AddListener(OnButtonNext); middleButton.onClick.AddListener(OnButtonMiddle); rightButton.onClick.AddListener(OnButtonRight); leftButton.onClick.AddListener(OnButtonLeft); InitToggleListener(); previewPanel = DictionaryExtension.TryGet(UIManager.Instance.PanelDict, UIPanelType.Preview) as UIPreview; }