Exemplo n.º 1
0
        public void InspectorWindow(int windowID)
        {
            GUI.DragWindow(new Rect(0, 0, 10000, 20));
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("X"))
            {
                SelectedGameObject = null;
            }
            GUILayout.EndHorizontal();
            GUILayout.Label("Transform");
            GUILayoutHelper.Vector3Label("LocalPosition", SelectedGameObject.transform.localPosition);
            GUILayoutHelper.QuaternionLabel("LocalRotation", SelectedGameObject.transform.localRotation);
            GUILayoutHelper.Vector3Label("LocalScale", SelectedGameObject.transform.localScale);
            GUILayout.Space(2);
            GUILayoutHelper.Vector3Label("Position", SelectedGameObject.transform.position);
            GUILayoutHelper.QuaternionLabel("Rotation", SelectedGameObject.transform.rotation);
            GUILayoutHelper.Vector3Label("Scale", SelectedGameObject.transform.lossyScale);
            var transformIndex = XLShredReplayEditor.ReplayManager.Instance.recorder.transformsToBeRecorded.IndexOf(SelectedGameObject.transform);
            int prevIndex      = XLShredReplayEditor.ReplayManager.Instance.previousFrameIndex;

            if (transformIndex >= 0 && transformIndex < XLShredReplayEditor.ReplayManager.Instance.recorder.transformsToBeRecorded.Count &&
                prevIndex >= 0 && prevIndex < XLShredReplayEditor.ReplayManager.Instance.recorder.ClipFrames.Count)
            {
                var prevFrame = XLShredReplayEditor.ReplayManager.Instance.recorder.ClipFrames[prevIndex];
                var prevFrameTransformInfo = prevFrame.transformInfos[transformIndex];

                GUILayout.Space(10);
                GUILayout.Label("PreviousFrame");
                GUILayoutHelper.Vector3Label("LocalPosition", prevFrameTransformInfo.position);
                GUILayoutHelper.QuaternionLabel("LocalRotation", prevFrameTransformInfo.rotation);
                GUILayoutHelper.Vector3Label("LocalScale", prevFrameTransformInfo.scale);

                if ((prevIndex + 1) < XLShredReplayEditor.ReplayManager.Instance.recorder.ClipFrames.Count)
                {
                    var nextFrame = XLShredReplayEditor.ReplayManager.Instance.recorder.ClipFrames[prevIndex + 1];
                    var nextFrameTransformInfo = nextFrame.transformInfos[transformIndex];

                    GUILayout.Label("NextFrame");
                    GUILayoutHelper.Vector3Label("LocalPosition", nextFrameTransformInfo.position);
                    GUILayoutHelper.QuaternionLabel("LocalRotation", nextFrameTransformInfo.rotation);
                    GUILayoutHelper.Vector3Label("LocalScale", nextFrameTransformInfo.scale);
                }
            }
            GUILayout.Space(10);
            GUILayout.Label("Components");
            GUILayout.Space(5);
            foreach (Component component in SelectedGameObject.GetComponents <Component>())
            {
                GUILayout.Label("  " + component.GetType().ToString());
            }


            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            if (GUILayout.RepeatButton("+"))
            {
                if (!resizingWindow)
                {
                    StartCoroutine(ChangeInspectorWindowSize(true));
                }
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.RepeatButton("+"))
            {
                if (!resizingWindow)
                {
                    StartCoroutine(ChangeInspectorWindowSize(false));
                }
            }
            GUILayout.EndHorizontal();
        }