本文整理汇总了C#中CustomInput类的典型用法代码示例。如果您正苦于以下问题:C# CustomInput类的具体用法?C# CustomInput怎么用?C# CustomInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CustomInput类属于命名空间,在下文中一共展示了CustomInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RaiseOnNewBoardPieceSelected
protected void RaiseOnNewBoardPieceSelected(AbstractBoardPiece boardPiece, CustomInput.TouchInfo touchInfo)
{
if(OnNewBoardPieceSelected != null)
{
OnNewBoardPieceSelected(boardPiece, touchInfo);
}
}
示例2: KeyMapping
/// <summary>
/// Create a new instance of <see cref="KeyMapping"/> with 3 specified <see cref="CustomInput"/>.
/// </summary>
/// <param name="name">KeyMapping name.</param>
/// <param name="primaryCustomInput">Primary input.</param>
/// <param name="secondaryCustomInput">Secondary input.</param>
/// <param name="thirdCustomInput">Third input.</param>
public KeyMapping(string name = "", CustomInput primaryCustomInput = null, CustomInput secondaryCustomInput = null, CustomInput thirdCustomInput = null)
{
mName = name;
primaryInput = primaryCustomInput;
secondaryInput = secondaryCustomInput;
thirdInput = thirdCustomInput;
}
示例3: Enqueue
public void Enqueue (CustomInput currentInput)
{
if (currentInput.IsDown) {
TouchManager.Instance.OnTouchStart (currentInput);
}
if (currentInput.IsUp) {
TouchManager.Instance.OnTouchEnd (currentInput);
}
}
示例4: Navigate
private void Navigate(CustomInput.UserInput direction)
{
if ( EventSystem.current.currentSelectedGameObject == this.gameObject) {
switch(direction)
{
case CustomInput.UserInput.Left:
slider.value -= 1;
break;
case CustomInput.UserInput.Right:
slider.value += 1;
break;
}
if (sp) sp.SetVolume(slider.value);
}
}
示例5: setInput
private void setInput(CustomInput input)
{
switch (keyIndex)
{
case 0:
keyMapping.primaryInput = input;
break;
case 1:
keyMapping.secondaryInput = input;
break;
case 2:
keyMapping.thirdInput = input;
break;
}
updateText();
selectedButton = null;
}
示例6: Navigate
public static void Navigate(CustomInput.UserInput direction, GameObject defaultGameObject)
{
GameObject next = EventSystem.current.currentSelectedGameObject;
if (next == null)
{
if(defaultGameObject != null) EventSystem.current.SetSelectedGameObject(defaultGameObject);
return;
}
bool nextIsValid = false;
while (!nextIsValid)
{
switch (direction)
{
case CustomInput.UserInput.Up:
if (EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnUp() != null)
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnUp().gameObject;
else next = null;
break;
case CustomInput.UserInput.Down:
if (EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnDown() != null)
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnDown().gameObject;
else next = null;
break;
case CustomInput.UserInput.Left:
if (EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnLeft() != null)
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnLeft().gameObject;
else next = null;
break;
case CustomInput.UserInput.Right:
if (EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnRight() != null)
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnRight().gameObject;
else next = null;
break;
}
if (next != null)
{
EventSystem.current.SetSelectedGameObject(next);
nextIsValid = next.GetComponent<Selectable>().interactable;
}
else nextIsValid = true;
}
}
示例7: Navigate
private void Navigate(CustomInput.UserInput direction)
{
if ( EventSystem.current.currentSelectedGameObject == this.gameObject) {
switch(direction)
{
case CustomInput.UserInput.Left:
slider.value -= .01f;
break;
case CustomInput.UserInput.Right:
slider.value += .01f;
break;
}
}
if (isSfx)
GameManager.SFXVol = slider.value;
else
GameManager.MusicVol = slider.value;
}
示例8: Navigate
private void Navigate(CustomInput.UserInput direction)
{
GameObject next = EventSystem.current.currentSelectedGameObject;
switch(direction)
{
case CustomInput.UserInput.Up:
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnUp().gameObject;
break;
case CustomInput.UserInput.Down:
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnDown().gameObject;
break;
case CustomInput.UserInput.Accept:
var pointer = new PointerEventData(EventSystem.current);
ExecuteEvents.Execute(EventSystem.current.currentSelectedGameObject, pointer, ExecuteEvents.submitHandler);
return;
}
EventSystem.current.SetSelectedGameObject(next);
}
示例9: Navigate
private void Navigate(CustomInput.UserInput direction)
{
GameObject next = EventSystem.current.currentSelectedGameObject;
switch(direction)
{
case CustomInput.UserInput.Up:
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnUp().gameObject;
break;
case CustomInput.UserInput.Down:
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnDown().gameObject;
break;
case CustomInput.UserInput.Left:
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnLeft().gameObject;
break;
case CustomInput.UserInput.Right:
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnRight().gameObject;
break;
}
EventSystem.current.SetSelectedGameObject(next);
}
示例10: OnNewBoardPieceSelected
public void OnNewBoardPieceSelected(AbstractBoardPiece boardPiece, CustomInput.TouchInfo touchInfo)
{
if(BoardShuffleController.Instance.IsBoardReshuffling)
{
return;
}
bool selectionSucces = false;
selectedBoardPiece = boardPiece;
tileToDestroy = boardPiece.Tile as Match3Tile;
effectPosition = boardPiece.cachedTransform;
//Decide wether this selection is icepick worthy or not
if(boardPiece.Tile == null)
{
if(boardPiece is LayeredBoardPiece && (boardPiece as LayeredBoardPiece).NumLayers > 0 )
{
selectionSucces = true;
}
}
else if (!tileToDestroy.IsMoving && tileToDestroy.IsDestructible && !tileToDestroy.IsDestroying && !(tileToDestroy as NormalTile).IsFrozen())
{
selectionSucces = true;
}
if(selectionSucces)
{
SoundManager.Instance.PlayOneShot("icepick_sfx");
touchController.StopInputController();
touchController.OnNewBoardPieceSelected -= OnNewBoardPieceSelected;
StartItemEffects();
}
}
示例11: SetKey
/// <summary>
/// Create new <see cref="KeyMapping"/> with specified name and inputs.
/// </summary>
/// <returns>Created KeyMapping.</returns>
/// <param name="name">KeyMapping name.</param>
/// <param name="primary">Primary input.</param>
/// <param name="secondary">Secondary input.</param>
/// <param name="third">Third input.</param>
public static KeyMapping SetKey(string name, CustomInput primary=null, CustomInput secondary=null, CustomInput third=null)
{
KeyMapping outKey = null;
if (sKeysMap.TryGetValue(name, out outKey))
{
outKey.primaryInput = primary;
outKey.secondaryInput = secondary;
outKey.thirdInput = third;
}
else
{
outKey = new KeyMapping(name, primary, secondary, third);
sKeysList.Add(outKey);
sKeysMap.Add(name, outKey);
}
return outKey;
}
示例12: OnNewBoardPieceSelected
protected void OnNewBoardPieceSelected(AbstractBoardPiece boardPiece, CustomInput.TouchInfo touchInfo)
{
// Debug.LogWarning("[OnNewBoardPieceSelect]");
if(BoardShuffleController.Instance.IsBoardReshuffling)
{
return;
}
if(startPosition == Vector3.zero)
{
startPosition = boardPiece.cachedTransform.position;
}
else
{
endPosition = boardPiece.cachedTransform.position;
}
}
示例13: Enqueue
public void Enqueue(CustomInput currentInput)
{
if (!(currentInput.IsDown || currentInput.IsDrag || currentInput.IsUp))
return;
this.pastInputs.Add (currentInput);
if (this.pastInputs.Count == 1) {
//First Input
currentInput.MovedDistance = Vector3.zero;
currentInput.LevelingTime = 0;
currentInput.LevelingOriginSpeedVector = Vector3.zero;
} else {
//currentInputからLevelingFrame数だけ古いフレームのInput
CustomInput levelingOriginInput = this.pastInputs [0];
currentInput.MovedDistance = currentInput.ScreenPosition - levelingOriginInput.ScreenPosition;
currentInput.LevelingTime = currentInput.Time - levelingOriginInput.Time;// this.LevelingFrameCount;
currentInput.LevelingOriginSpeedVector = levelingOriginInput.SpeedVector;
//フリック開始&継続判定
var lastInput = this.pastInputs [this.pastInputs.Count - 2];
if (lastInput.IsFlicking) {
//継続判定
if (currentInput.SpeedVector.magnitude > this.DefeatSpeed) {
currentInput.IsFlicking = true;
} else {
//フリック中止
this.FlickStartInput = null;
currentInput.IsFlicking = false;
this.FlickStartInput = null;
}
} else {
//フリック開始判定
if (currentInput.AccelerationVector.magnitude > this.DetectAcceleration) {
if (currentInput.SpeedVector.magnitude > 0.0001f) {
if (!this.ContinuousDetect && this.IsDetected) {
//指を離すまで再検知しない
} else {
currentInput.IsFlicking = true;
this.FlickStartInput = currentInput;
this.IsDetected = true;
//フリック開始イベント
TouchManager.Instance.OnFlickStart (new FlickEventArgs (levelingOriginInput, currentInput));
}
}
}
}
//フリック完了判定
if (currentInput.IsFlicking && currentInput.IsUp) {
Vector3 flickDistance = currentInput.ScreenPosition - this.FlickStartInput.ScreenPosition;
if (flickDistance.magnitude > this.MinFlickDistance) {
//フリック成立
TouchManager.Instance.OnFlickComplete (new FlickEventArgs (this.pastInputs [this.pastInputs.Count - 2], currentInput));
//TouchManager.Instance.OnFlickComplete (new FlickEventArgs (this.FlickStartInput, currentInput));
currentInput.IsFlicking = false;
this.FlickStartInput = null;
}
}
//指が離れた
if (currentInput.IsUp) {
this.IsDetected = false;
this.pastInputs.Clear();
}
}
while (this.pastInputs.Count > this.LevelingFrameCount) {
this.pastInputs.RemoveAt (0);
}
}
示例14: OnTouchStart
public void OnTouchStart(CustomInput input)
{
if (this.TouchStart != null)
this.TouchStart (this.gameObject, new CustomInputEventArgs (input));
}
示例15: CustomInputEventArgs
public CustomInputEventArgs (CustomInput input)
{
this.Input = input;
}