Example #1
0
        public void Render()
        {
            if (Target.Predefined && Delay > 0)
            {
                float size = Delay * InternalUiAnimationEditorTimeline.SegmentWidth * 10;

                InternalUiAnimationEditorGUI.DrawTexture
                (
                    X - size,
                    Y,
                    size,
                    Height,
                    InternalUiAnimationEditorTextures.GenerateCanvasItemBackground
                    (
                        (int)size,
                        (int)Height,
                        Target.ItemType,
                        Target.EasingType,
                        true
                    )
                );
            }

            InternalUiAnimationEditorGUI.DrawTexture(X, Y, Width, Height, InternalUiAnimationEditorTextures.GenerateCanvasItemBackground((int)Width, (int)Height, Target.ItemType, Target.EasingType));

            if (InternalUiAnimationEditorSelection.CanvasItemToEdit == this)
            {
                InternalUiAnimationEditorGUI.DrawTexture(X, Y, Width, Height, InternalUiAnimationEditorTextures.ColorWhite20);
            }

            GUILayout.BeginArea(new Rect(Mathf.Round(X) + 5, Mathf.Round(Y) + 3, Mathf.Round(Width) - 10, Mathf.Round(Height) - 3));

            if (Target != null && Target.GameObject != null)
            {
                GUIStyle labelStyle = new GUIStyle(GUI.skin.GetStyle("Label"));

                if (IsCollided)
                {
                    labelStyle.normal.textColor = Color.red;
                    //IsCollided = false;
                }

                GUILayout.Label(Target.GameObject.name + " " + Target.ItemType.ToString(), labelStyle);
            }
            else
            {
                GUIStyle labelStyle = new GUIStyle(GUI.skin.GetStyle("Label"));

                labelStyle.normal.textColor = Color.red;

                GUILayout.Label("Missed", labelStyle);
            }

            GUILayout.EndArea();
        }
Example #2
0
        private void OnGUI()
        {
            if (Application.isPlaying)
            {
                RenderPlayMode();
                return;
            }

            if (InternalUiAnimationEditorSelection.TargetGameObject == null)
            {
                RenderNoGameObject();
                return;
            }

            if (InternalUiAnimationEditorSelection.TargetAnimation == null)
            {
                RenderNoComponent();
                return;
            }

            if (Event.current.type == EventType.Repaint)
            {
                MousePosition.x = Event.current.mousePosition.x;
                MousePosition.y = Event.current.mousePosition.y;
            }

            if (Event.current.type == EventType.MouseDown)
            {
                MousePositionPress.x = Event.current.mousePosition.x;
                MousePositionPress.y = Event.current.mousePosition.y;
            }

            if (Event.current.type == EventType.MouseUp)
            {
                //MousePositionPress = Vector2.zero;
                //GUI.FocusControl(string.Empty);
            }

            if (Event.current.type == EventType.DragUpdated)
            {
                MouseDragFromScene = true;
            }

            if (Event.current.type == EventType.DragExited)
            {
                MouseDragFromScene = false;
            }

            if (MousePosition.x > InternalUiAnimationEditorInspector.Width && MousePosition.y > InternalUiAnimationEditorTimeline.Height)
            {
                DragAndDrop.visualMode = DragAndDropVisualMode.Generic;
            }

            InternalUiAnimationEditorTextures.Setup();

            InternalUiAnimationEditorTimeline.OnEvent();
            InternalUiAnimationEditorInspector.OnEvent();
            InternalUiAnimationEditorCanvas.OnEvent();

            InternalUiAnimationEditorTimeline.Render(InternalUiAnimationEditorInspector.Width, 0, InternalUiAnimationEditorTimeline.Width, InternalUiAnimationEditorTimeline.Height);
            InternalUiAnimationEditorInspector.Render(0, InternalUiAnimationEditorTimeline.Height, InternalUiAnimationEditorInspector.Width, WindowHeight);
            InternalUiAnimationEditorCanvas.Render(InternalUiAnimationEditorInspector.Width, InternalUiAnimationEditorTimeline.Height, InternalUiAnimationEditorCanvas.Width, WindowHeight - InternalUiAnimationEditorTimeline.Height);
        }