本文整理汇总了C#中dfMouseEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# dfMouseEventArgs类的具体用法?C# dfMouseEventArgs怎么用?C# dfMouseEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
dfMouseEventArgs类属于命名空间,在下文中一共展示了dfMouseEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMouseMove
public void OnMouseMove( dfControl control, dfMouseEventArgs args )
{
if( animating || !dragging )
return;
this.momentum = ( momentum + args.MoveDelta.Scale( 1, -1 ) ) * 0.5f;
args.Use();
if( args.Buttons.IsSet( dfMouseButtons.Left ) )
{
var ray = args.Ray;
var distance = 0f;
var direction = Camera.main.transform.TransformDirection( Vector3.back );
var plane = new Plane( direction, lastPosition );
plane.Raycast( ray, out distance );
var pos = ( ray.origin + ray.direction * distance ).Quantize( control.PixelsToUnits() );
var offset = pos - lastPosition;
var transformPos = ( control.transform.position + offset ).Quantize( control.PixelsToUnits() );
control.transform.position = transformPos;
lastPosition = pos;
}
}
示例2: OnMouseDown
public void OnMouseDown( dfControl source, dfMouseEventArgs args )
{
if( State == dfGestureState.Possible )
{
var elapsed = Time.realtimeSinceStartup - StartTime;
if( elapsed <= timeout && Vector2.Distance( args.Position, StartPosition ) <= maxDistance )
{
StartPosition = CurrentPosition = args.Position;
State = dfGestureState.Began;
if( DoubleTapGesture != null ) DoubleTapGesture( this );
gameObject.Signal( "OnDoubleTapGesture", this );
endGesture();
return;
}
}
StartPosition = CurrentPosition = args.Position;
State = dfGestureState.Possible;
StartTime = Time.realtimeSinceStartup;
}
示例3: OnClick
public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
{
Ship.PlayerController.pHull hull;
switch(shipSelect.selectedIndex)
{
case 0:
hull = Ship.PlayerController.pHull.Viper;
GameManager.Instance.initializeShip(hull);
break;
case 1:
hull = Ship.PlayerController.pHull.Anvil;
GameManager.Instance.initializeShip(hull);
break;
case 2:
hull = Ship.PlayerController.pHull.Shark;
GameManager.Instance.initializeShip(hull);
break;
case 3:
hull = Ship.PlayerController.pHull.Marauder;
GameManager.Instance.initializeShip(hull);
break;
case 4:
hull = Ship.PlayerController.pHull.Vulture;
GameManager.Instance.initializeShip(hull);
break;
}
Application.LoadLevel("CustomizeShip");
}
示例4: OnMouseDown
protected void OnMouseDown( dfControl source, dfMouseEventArgs args )
{
StartPosition = CurrentPosition = args.Position;
State = dfGestureState.Possible;
StartTime = Time.realtimeSinceStartup;
hoverTime = Time.realtimeSinceStartup;
}
示例5: OnMouseHover
public void OnMouseHover( dfControl control, dfMouseEventArgs mouseEvent )
{
if( isTooltipVisible )
return;
var isSpellSlot = actionBar.Controls.Contains( mouseEvent.Source );
if( isSpellSlot )
{
target = mouseEvent.Source;
if( target == lastTarget )
return;
lastTarget = target;
isTooltipVisible = true;
var slot = target.GetComponentInChildren<SpellSlot>();
if( string.IsNullOrEmpty( slot.Spell ) )
return;
var spell = SpellDefinition.FindByName( slot.Spell );
if( spell == null )
return;
ActionbarsTooltip.Show( spell );
}
else
{
lastTarget = null;
}
}
示例6: OnClick
public void OnClick( dfControl sender, dfMouseEventArgs args )
{
// No need to do anything unless an actual item was clicked
if( args.Source == container )
return;
// Do not process click event if the user was scrolling by
// dragging the mouse. Not needed for mobile.
if( Vector2.Distance( args.Position, touchStartPosition ) > 20 )
return;
// Find highest-level control containing the click
var source = args.Source;
while( source != null && !controls.Contains( source ) )
{
source = source.Parent;
}
// If an item in the scroller was clicked, select it
if( source != null )
{
// Select the clicked item
lastSelected = -1;
setSelectedIndex( controls.IndexOf( source ) );
// Do not need to try to select "most centered" item
isMouseDown = false;
}
}
示例7: OnMouseMove
public void OnMouseMove( dfControl source, dfMouseEventArgs args )
{
if( State == dfGestureState.Possible )
{
if( Vector2.Distance( args.Position, StartPosition ) >= minDistance )
{
State = dfGestureState.Began;
CurrentPosition = args.Position;
Delta = args.Position - StartPosition;
if( PanGestureStart != null ) PanGestureStart( this );
gameObject.Signal( "OnPanGestureStart", this );
}
}
else if( State == dfGestureState.Began || State == dfGestureState.Changed )
{
State = dfGestureState.Changed;
Delta = args.Position - CurrentPosition;
CurrentPosition = args.Position;
if( PanGestureMove != null ) PanGestureMove( this );
gameObject.Signal( "OnPanGestureMove", this );
}
}
示例8: OnMouseDown
public void OnMouseDown( dfControl control, dfMouseEventArgs args )
{
if( !args.Used && args.Buttons == dfMouseButtons.Middle )
{
if( contextMenu.IsOpen )
{
contextMenu.Close();
return;
}
args.Use();
var hitPosition = control.GetHitPosition( args );
var host = contextMenu.host;
host.RelativePosition = hitPosition - host.Size * 0.5f;
host.BringToFront();
host.Show();
host.Focus();
contextMenu.Open();
}
}
示例9: OnMouseMove
protected internal override void OnMouseMove( dfMouseEventArgs args )
{
args.Use();
if( args.Buttons.IsSet( dfMouseButtons.Left ) )
{
var ray = args.Ray;
var distance = 0f;
var direction = GetCamera().transform.TransformDirection( Vector3.back );
var plane = new Plane( direction, lastPosition );
plane.Raycast( ray, out distance );
var pos = ( ray.origin + ray.direction * distance ).Quantize( parent.PixelsToUnits() );
var offset = pos - lastPosition;
var transformPos = ( parent.transform.position + offset ).Quantize( parent.PixelsToUnits() );
parent.transform.position = transformPos;
lastPosition = pos;
}
base.OnMouseMove( args );
}
示例10: OnMouseDown
public void OnMouseDown( dfControl source, dfMouseEventArgs args )
{
StartPosition = CurrentPosition = args.Position;
State = dfGestureState.Possible;
StartTime = Time.realtimeSinceStartup;
Delta = Vector2.zero;
}
示例11: OnMouseMove
public void OnMouseMove( dfControl control, dfMouseEventArgs mouseEvent )
{
if( mouseEvent.Buttons == dfMouseButtons.Left )
{
updateHotspot( mouseEvent );
}
}
示例12: OnClick
void OnClick( dfControl sender, dfMouseEventArgs args )
{
if( SelectOnClick != null )
{
SelectOnClick.Focus();
}
}
示例13: HelpClicked
public void HelpClicked(dfControl control, dfMouseEventArgs args)
{
args.Use();
TextAsset description = Resources.Load<TextAsset>("Descriptions/" + bi.className);
GameObject prefab = (GameObject)Resources.Load("Prefabs/Buildings/" + bi.className);
Dialog.Instance.SetDialog(bi.buildingName, description.text, "Continue", true, false,prefab);
}
示例14: OnClick
public void OnClick( dfControl control, dfMouseEventArgs mouseEvent )
{
if( colorField != null )
{
colorField.Hue = HSBColor.GetHue( control.Color );
colorField.SelectedColor = control.Color;
}
}
示例15: UI_Button_NewGame_Click
/// <summary>
/// Starts a new game
/// </summary>
/// <param name="s">Button</param>
/// <param name="e">Mouse events</param>
/// <remarks>
/// <para>
/// Only hides the main menu and displays the New Game UI
/// </para>
/// </remarks>
public void UI_Button_NewGame_Click(dfControl s, dfMouseEventArgs e)
{
//Show the New Game UI
uim.HideUI(UIManager.UIELEMENTS.MainMenu);
uim.ShowUI(UIManager.UIELEMENTS.NewGameUI);
}