Exemple #1
0
 public override void ControlPressed(Input.Controls control)
 {
     if (hovered && control == Input.Controls.LeftClick)
     {
         Select();
     }
 }
Exemple #2
0
 public override void ControlPressed(Input.Controls control)
 {
     if (hovered && control == Input.Controls.LeftClick)
     {
         state = ButtonState.Pressed;
     }
 }
Exemple #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();
     }
 }
Exemple #4
0
 public override void ControlReleased(Input.Controls control)
 {
     if (control == Input.Controls.RightClick)
     {
         panning = false;
     }
     if (control == Input.Controls.EditorErase)
     {
         eraseMode = false;
     }
 }
Exemple #5
0
 public override void ControlPressed(Input.Controls control)
 {
     if (hovered)
     {
         if (control == Input.Controls.ScrollUp)
         {
             ScrollUp();
         }
         else if (control == Input.Controls.ScrollDown)
         {
             ScrollDown();
         }
     }
 }
Exemple #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;
         }
     }
 }
Exemple #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();
                 }
             }
         }
     }
 }
Exemple #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;
     }
 }
Exemple #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)
 {
 }
Exemple #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)
 {
 }
Exemple #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)
 {
 }