Paint() abstract private method

abstract private Paint ( bool paintAll ) : void
paintAll bool
return void
コード例 #1
0
ファイル: tp_Input.cs プロジェクト: Stumpstump/RoverGame
        /// <summary>
        /// Get input
        /// </summary>
        /// <param name="method">Delegate method</param>
        /// <param name="position">Mouse world position</param>
        /// <param name="active">Is painting</param>
        /// <param name="saveMsg">Undo message</param>
        internal static void Update(TP component, tp_ComponentBaseEditor target, ref Vector3 position, ref bool active, string saveMsg = default(string))
        {
            // Get current event
            Event current = Event.current;

            // checkkeys
            int controlID = GUIUtility.GetControlID(TP.HashCode, FocusType.Passive);
            int hotControl = GUIUtility.hotControl;
            EventType filteredControlID = current.GetTypeForControl(controlID);

            switch (filteredControlID)
            {
                // (If mouse down or mouse drag)
                case EventType.MouseDown:
                case EventType.MouseDrag:
                    // Check if current control is Terrain Painter control
                    if (hotControl != controlID && (hotControl != 0) || TP.Instance.SplatmapLock || RotateButtonPressed) { return; }
                    if (current.button != 0 || HandleUtility.nearestControl != controlID || (TP.Instance.EditingTool == EditingTool.Texture && TP.Instance.SplatTool == SplatTool.None)) { return; }

                    if (current.type == EventType.MouseDown) { GUIUtility.hotControl = controlID; }
                    if (!GetPosition(out position)) { break; }
                    if (current.type == EventType.MouseDown)
                    {
                        // Save current splatmap
                        TP.Instance.History.CreateRestorePoint(target.UndoType, saveMsg);
                        if (TP.Instance.Noise.GenerateOnClick) { TP.Instance.Noise.Generate(new Point(component.TerrainData.alphamapWidth, component.TerrainData.alphamapHeight)); }
                    }
                    
                    // Run method, and Painting is in use
                    if (target != null) { target.Paint(false); }
                    active = true;
                    current.Use();
                    break;

                // Update projector position
                case EventType.MouseMove:
                    if (GetPosition(out position)) { HandleUtility.Repaint(); }
                    break;

                // Disable painting, and current control is not Terrain Painter any more
                case EventType.MouseUp:
                    active = false;
                    if (hotControl != controlID || TP.Instance.SplatmapLock) { return; }
                    GUIUtility.hotControl = hotControl = 0;
                    if (TP.Instance.EditingTool == EditingTool.Texture && TP.Instance.SplatTool == SplatTool.None) { return; }
                    current.Use();
                    break;

                // Disable the selection tool
                case EventType.Layout:
                    if (RotateButtonPressed)
                    {
                        HandleUtility.AddDefaultControl(controlID);
                        HandleUtility.Repaint();
                        current.Use();
                        break;
                    }
                    if ((TP.Instance.EditingTool == EditingTool.Texture && TP.Instance.SplatTool == SplatTool.None) || TP.Instance.SplatmapLock) { return; }
                    HandleUtility.AddDefaultControl(controlID);
                    break;
            }
        }
コード例 #2
0
ファイル: tp_Input.cs プロジェクト: yazici/RoverGame
        /// <summary>
        /// Get input
        /// </summary>
        /// <param name="method">Delegate method</param>
        /// <param name="position">Mouse world position</param>
        /// <param name="active">Is painting</param>
        /// <param name="saveMsg">Undo message</param>
        internal static void Update(TP component, tp_ComponentBaseEditor target, ref Vector3 position, ref bool active, string saveMsg = default(string))
        {
            // Get current event
            Event current = Event.current;

            // checkkeys
            int       controlID         = GUIUtility.GetControlID(TP.HashCode, FocusType.Passive);
            int       hotControl        = GUIUtility.hotControl;
            EventType filteredControlID = current.GetTypeForControl(controlID);

            switch (filteredControlID)
            {
            // (If mouse down or mouse drag)
            case EventType.MouseDown:
            case EventType.MouseDrag:
                // Check if current control is Terrain Painter control
                if (hotControl != controlID && (hotControl != 0) || TP.Instance.SplatmapLock || RotateButtonPressed)
                {
                    return;
                }
                if (current.button != 0 || HandleUtility.nearestControl != controlID || (TP.Instance.EditingTool == EditingTool.Texture && TP.Instance.SplatTool == SplatTool.None))
                {
                    return;
                }

                if (current.type == EventType.MouseDown)
                {
                    GUIUtility.hotControl = controlID;
                }
                if (!GetPosition(out position))
                {
                    break;
                }
                if (current.type == EventType.MouseDown)
                {
                    // Save current splatmap
                    TP.Instance.History.CreateRestorePoint(target.UndoType, saveMsg);
                    if (TP.Instance.Noise.GenerateOnClick)
                    {
                        TP.Instance.Noise.Generate(new Point(component.TerrainData.alphamapWidth, component.TerrainData.alphamapHeight));
                    }
                }

                // Run method, and Painting is in use
                if (target != null)
                {
                    target.Paint(false);
                }
                active = true;
                current.Use();
                break;

            // Update projector position
            case EventType.MouseMove:
                if (GetPosition(out position))
                {
                    HandleUtility.Repaint();
                }
                break;

            // Disable painting, and current control is not Terrain Painter any more
            case EventType.MouseUp:
                active = false;
                if (hotControl != controlID || TP.Instance.SplatmapLock)
                {
                    return;
                }
                GUIUtility.hotControl = hotControl = 0;
                if (TP.Instance.EditingTool == EditingTool.Texture && TP.Instance.SplatTool == SplatTool.None)
                {
                    return;
                }
                current.Use();
                break;

            // Disable the selection tool
            case EventType.Layout:
                if (RotateButtonPressed)
                {
                    HandleUtility.AddDefaultControl(controlID);
                    HandleUtility.Repaint();
                    current.Use();
                    break;
                }
                if ((TP.Instance.EditingTool == EditingTool.Texture && TP.Instance.SplatTool == SplatTool.None) || TP.Instance.SplatmapLock)
                {
                    return;
                }
                HandleUtility.AddDefaultControl(controlID);
                break;
            }
        }