Beispiel #1
0
 public override void ControlPressed(Input.Controls control)
 {
     if (hovered && control == Input.Controls.LeftClick)
     {
         Select();
     }
 }
Beispiel #2
0
 public override void ControlPressed(Input.Controls control)
 {
     if (hovered && control == Input.Controls.LeftClick)
     {
         state = ButtonState.Pressed;
     }
 }
Beispiel #3
0
 public override void ControlPressed(Input.Controls control)
 {
     if (!hovered && (control == Input.Controls.LeftClick || control == Input.Controls.RightClick))             //TODO: more ways to close this, like ESC
     {
         Close();
     }
 }
Beispiel #4
0
 public override void ControlReleased(Input.Controls control)
 {
     if (control == Input.Controls.RightClick)
     {
         panning = false;
     }
     if (control == Input.Controls.EditorErase)
     {
         eraseMode = false;
     }
 }
Beispiel #5
0
 public override void ControlPressed(Input.Controls control)
 {
     if (hovered)
     {
         if (control == Input.Controls.ScrollUp)
         {
             ScrollUp();
         }
         else if (control == Input.Controls.ScrollDown)
         {
             ScrollDown();
         }
     }
 }
Beispiel #6
0
 public override void ControlReleased(Input.Controls control)
 {
     if (control == Input.Controls.LeftClick)
     {
         //Only perform the action if this is the same button that was pressed initially, otherwise just release
         if (state == ButtonState.Pressed)
         {
             clickAction();
             state = ButtonState.Hovered;
         }
         else if (state == ButtonState.DraggedAway)
         {
             state = ButtonState.None;
         }
     }
 }
Beispiel #7
0
 public override void ControlHeld(Input.Controls control)
 {
     if (hovered)
     {
         if (control == Input.Controls.LeftClick)
         {
             if (eraseMode)
             {
                 EraseBlock(GetHoveredBlockPos(), editor.IsBackground());
             }
             else
             {
                 SelectableBlock selectedBlock = editor.GetSelectedBlock();
                 if (selectedBlock != null)
                 {
                     SetBlock(GetHoveredBlockPos(), selectedBlock.GetBlock(), editor.IsBackground());
                     editor.MarkChanged();
                 }
             }
         }
     }
 }
Beispiel #8
0
 public override void ControlPressed(Input.Controls control)
 {
     if (hovered)
     {
         if (control == Input.Controls.RightClick)
         {
             panning = true;
         }
         else if (control == Input.Controls.EditorPickBlock)
         {
             StructureBlockInfo blockInfo = GetHoveredBlockInfo();
             if (blockInfo.block != null)
             {
                 editor.SetSelectedBlock(blockInfo.block.name);
             }
         }
     }
     if (control == Input.Controls.EditorErase)
     {
         eraseMode = true;
     }
 }
Beispiel #9
0
 /// <summary>
 /// Called when the control is released (anywhere on the screen).
 /// In many cases, should be ignored if !this.hovered.
 /// </summary>
 /// <param name="control">The control that was released.</param>
 public virtual void ControlReleased(Input.Controls control)
 {
 }
Beispiel #10
0
 /// <summary>
 /// Called when the control is held down (anywhere on the screen).
 /// In many cases, should be ignored if !this.hovered.
 /// </summary>
 /// <param name="control">The control that was held.</param>
 public virtual void ControlHeld(Input.Controls control)
 {
 }
Beispiel #11
0
 /// <summary>
 /// Called when the control is pressed (anywhere on the screen).
 /// In many cases, should be ignored if !this.hovered.
 /// </summary>
 /// <param name="control">The control that was pressed.</param>
 public virtual void ControlPressed(Input.Controls control)
 {
 }