• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CustomInput类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CustomInput的典型用法代码示例。如果您正苦于以下问题:C# CustomInput类的具体用法?C# CustomInput怎么用?C# CustomInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CustomInput类属于命名空间,在下文中一共展示了CustomInput类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RaiseOnNewBoardPieceSelected

	protected void RaiseOnNewBoardPieceSelected(AbstractBoardPiece boardPiece, CustomInput.TouchInfo touchInfo)
	{
		if(OnNewBoardPieceSelected != null)
		{
			OnNewBoardPieceSelected(boardPiece, touchInfo);
		}
	}
开发者ID:JulyMars,项目名称:frozen_free_fall,代码行数:7,代码来源:BoardPieceTouchController.cs


示例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;
 }
开发者ID:HaKDMoDz,项目名称:UnityEditor,代码行数:14,代码来源:KeyMapping.cs


示例3: Enqueue

		public void Enqueue (CustomInput currentInput)
		{
				if (currentInput.IsDown) {
						TouchManager.Instance.OnTouchStart (currentInput);
				}
				if (currentInput.IsUp) {
						TouchManager.Instance.OnTouchEnd (currentInput);
				}
		}
开发者ID:Furuta0316,项目名称:GGJ2016,代码行数:9,代码来源:TouchDetector.cs


示例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);
     }
 }
开发者ID:JonathanHunter,项目名称:CardNinjas,代码行数:15,代码来源:SliderFix1.cs


示例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;
    }
开发者ID:Gris87,项目名称:InputControl,代码行数:19,代码来源:InputControlDemo_KeyButtonScript.cs


示例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;
        }
    }
开发者ID:JonathanHunter,项目名称:Nullptr,代码行数:43,代码来源:Navigator.cs


示例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;
    }
开发者ID:JonathanHunter,项目名称:CardNinjas,代码行数:19,代码来源:SliderFix.cs


示例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);
    }
开发者ID:Ominous,项目名称:CardNinjas,代码行数:19,代码来源:MenusController.cs


示例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);
    }
开发者ID:szhangGT,项目名称:CardNinjas,代码行数:21,代码来源:MenusController.cs


示例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();
		}
	}
开发者ID:JulyMars,项目名称:frozen_free_fall,代码行数:36,代码来源:IcePick.cs


示例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;
    }
开发者ID:Gris87,项目名称:UnityEditorCommonAssets,代码行数:28,代码来源:InputControl.cs


示例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;
		}
	}
开发者ID:JulyMars,项目名称:frozen_free_fall,代码行数:18,代码来源:Sword.cs


示例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);
                }
    }
开发者ID:EsProgram,项目名称:Unity-TouchManager,代码行数:76,代码来源:FlickDetector.cs


示例14: OnTouchStart

 public void OnTouchStart(CustomInput input)
 {
     if (this.TouchStart != null)
                     this.TouchStart (this.gameObject, new CustomInputEventArgs (input));
 }
开发者ID:yota2013,项目名称:ApplicationProject,代码行数:5,代码来源:TouchManager.cs


示例15: CustomInputEventArgs

		public CustomInputEventArgs (CustomInput input)
		{
				this.Input = input;
		}
开发者ID:Furuta0316,项目名称:GGJ2016,代码行数:4,代码来源:CustomInputEventArgs.cs


示例16: OnGUI

    public void OnGUI()
    {
        if (!this.DebugMode)
                        return;
                CustomInput input = this.lastInput;
                if (input == null) {
                        input = new CustomInput ();
                }

                int i = 0;
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("ScreenPosition : X:{0} Y:{1}", input.ScreenPosition.x.ToString ("0"), input.ScreenPosition.y.ToString ("0")));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("DeltaPosition : X:{0} Y:{1}", input.DeltaPosition.x.ToString ("0"), input.DeltaPosition.y.ToString ("0")));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("DeltaTime : {0}sec", input.DeltaTime.ToString ("0.000")));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("Time : {0}sec", input.Time.ToString ("0.000")));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("IsDown : {0}", input.IsDown.ToString ()));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("IsUp : {0}", input.IsUp.ToString ()));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("IsDrag : {0}", input.IsDrag.ToString ()));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("IsFlicking : {0}", input.IsFlicking.ToString ()));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("TouchID : {0}", input.TouchId));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("", ""));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("LevelingTime : {0}sec", input.LevelingTime.ToString ("0.000")));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("MovedDistance : {0}", input.MovedDistance.magnitude));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("Speed : {0} [X:{1},Y:{2}]", input.SpeedVector.magnitude, input.SpeedVector.x.ToString ("0"), input.SpeedVector.y.ToString ("0")));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("LevelingOriginSpeed : {0} [X:{1},Y:{2}]", input.LevelingOriginSpeedVector.magnitude, input.LevelingOriginSpeedVector.x.ToString ("0"), input.LevelingOriginSpeedVector.y.ToString ("0")));
                GUI.Label (new Rect (20, 20 + i++ * 20, 400, 20), string.Format ("Acceleration : {0} [X:{1},Y:{2}]", input.AccelerationVector.magnitude, input.AccelerationVector.x.ToString ("0"), input.AccelerationVector.y.ToString ("0")));
    }
开发者ID:yota2013,项目名称:ApplicationProject,代码行数:26,代码来源:TouchManager.cs


示例17: 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, MouseButton primary, KeyCode secondary, CustomInput third)
 {
     return setKey(name, argToInput(primary), argToInput(secondary), argToInput(third));
 }
开发者ID:HaKDMoDz,项目名称:UnityEditor,代码行数:12,代码来源:InputControl.cs


示例18: ArgToInput

 /// <summary>
 /// Convert argument to <see cref="CustomInput"/>.
 /// </summary>
 /// <returns>Converted CustomInput.</returns>
 /// <param name="arg">Some kind of argument.</param>
 private static CustomInput ArgToInput(CustomInput arg)
 {
     return arg;
 }
开发者ID:Gris87,项目名称:UnityEditorCommonAssets,代码行数:9,代码来源:InputControl.cs


示例19: CheckBoardTouch

	protected void CheckBoardTouch(Vector3 position, CustomInput.TouchInfo touchInfo)
	{
		boardCoord = ConvertToBoardCoord(position);
			
		if(boardCoord.row < 0 || boardCoord.row >= Match3BoardRenderer.Instance.Board.NumRows || boardCoord.col < 0 || boardCoord.col >= Match3BoardRenderer.Instance.Board.NumColumns)
		{
			return;
		}
		
		CustomInput.TouchInfo modifiedTouchInfo = new CustomInput.TouchInfo(touchInfo);
		modifiedTouchInfo.position = position;
		
		if(prevBoardCoord != boardCoord)
		{
			boardPiece = Match3BoardRenderer.Instance.Board[boardCoord.row, boardCoord.col];
			RaiseOnNewBoardPieceSelected(boardPiece, modifiedTouchInfo);
			prevBoardCoord = boardCoord;
		}
	}
开发者ID:JulyMars,项目名称:frozen_free_fall,代码行数:19,代码来源:BoardPieceTouchController.cs


示例20: set

 /// <summary>
 /// Set the same <see cref="CustomInput"/> as in another instance.
 /// </summary>
 /// <param name="another">Another KeyMapping instance.</param>
 public void set(KeyMapping another)
 {
     mPrimaryInput   = another.mPrimaryInput;
     mSecondaryInput = another.mSecondaryInput;
     mThirdInput     = another.mThirdInput;
 }
开发者ID:HaKDMoDz,项目名称:UnityEditor,代码行数:10,代码来源:KeyMapping.cs



注:本文中的CustomInput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CustomList类代码示例发布时间:2022-05-24
下一篇:
C# CustomEventDeclaration类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap