当前位置: 首页 > news >正文

网站开发背景介绍免费b站推广软件

网站开发背景介绍,免费b站推广软件,藏族网站建设,命令行安装wordpress解释 InputMgr 是一个输入管理器,主要用于检测并管理用户的输入事件(例如键盘和鼠标输入)。它通过监听输入事件,并利用事件中心 (EventCenter) 来触发相应的事件。在这里,你可以管理多种输入类型,如按下、…

解释

InputMgr 是一个输入管理器,主要用于检测并管理用户的输入事件(例如键盘和鼠标输入)。它通过监听输入事件,并利用事件中心 (EventCenter) 来触发相应的事件。在这里,你可以管理多种输入类型,如按下、抬起、以及持续按住的操作。这个管理器不仅能够捕捉单次输入,还可以通过回调函数捕获特定输入信息,用于复杂交互场景。

核心功能概述:

  1. 输入管理的开启和关闭:控制输入管理器是否处于活动状态。
  2. 键盘和鼠标输入的注册:支持监听特定按键或鼠标事件,并根据事件类型(按下、抬起、长按)触发相应的游戏逻辑。
  3. 输入监听的移除:可以动态地添加或移除输入监听,灵活地调整输入机制。
  4. 获取下一次输入信息:通过协程等待输入事件,并通过回调函数将输入信息传递给外部。
  5. 输入事件的触发:根据定义好的输入(键盘或鼠标)触发与之关联的事件中心操作。
  6. 外部事件的触发:例如,水平方向和垂直方向的移动触发,支持在游戏中处理角色移动等操作。

公有方法解释:

  1. StartOrCloseInputMgr(bool isStart)
    开启或关闭输入系统的检测。如果 isStarttrue,输入系统开始监听输入事件,反之停止监听。

  2. ChangeKeyboardInfo(E_EventType eventType, KeyCode key, InputInfo.E_InputType inputType)
    注册或更改键盘输入事件。根据传入的 eventType,将 key 对应的输入与具体事件类型(按下、抬起、长按)绑定到输入管理器中。

  3. ChangeMouseInfo(E_EventType eventType, int mouseID, InputInfo.E_InputType inputType)
    注册或更改鼠标输入事件。根据传入的 eventType,将鼠标按键(mouseID)对应的输入与具体事件类型(按下、抬起、长按)绑定到输入管理器中。

  4. RemoveInputInfo(E_EventType eventType)
    移除指定 eventType 的输入监听。可以动态移除某些输入事件以便释放资源或调整输入模式。

  5. GetInputInfo(UnityAction<InputInfo> callBack)
    设置一个回调函数,用于捕获下一次的输入操作(键盘或鼠标)。捕获到输入信息后,通过回调将信息传递给外部。

  6. InputUpdate()
    这个方法会在每一帧更新中执行,首先会判断是否有输入信息需要传递给外部(如果启用了输入检查)。如果有输入,则触发与之关联的事件。

示例用例:

假设我们在一个游戏中要监听角色的基本控制操作,如移动(WASD键)和攻击(鼠标左键),并实现自定义事件绑定和管理。下面展示如何通过 InputMgr 实现这些功能:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class InputExemple : MonoBehaviour
{private void Start(){InputMgr.Instance.StartOrCloseInputMgr(true);InputMgr.Instance.ChangeKeyboardInfo(E_EventType.E_Input_MoveForward, KeyCode.W, InputInfo.E_InputType.Always);InputMgr.Instance.ChangeKeyboardInfo(E_EventType.E_Input_MoveBackward, KeyCode.S, InputInfo.E_InputType.Always);InputMgr.Instance.ChangeKeyboardInfo(E_EventType.E_Input_MoveLeft, KeyCode.A, InputInfo.E_InputType.Always);InputMgr.Instance.ChangeKeyboardInfo(E_EventType.E_Input_MoveRight, KeyCode.D, InputInfo.E_InputType.Always);InputMgr.Instance.ChangeMouseInfo(E_EventType.E_Input_Attack,0, InputInfo.E_InputType.Always);EventCenter.Instance.AddEventListener(E_EventType.E_Input_MoveForward, MoveForward);EventCenter.Instance.AddEventListener(E_EventType.E_Input_MoveBackward, MoveBackward);EventCenter.Instance.AddEventListener(E_EventType.E_Input_MoveLeft, MoveLeft);EventCenter.Instance.AddEventListener(E_EventType.E_Input_MoveRight, MoveRight);EventCenter.Instance.AddEventListener(E_EventType.E_Input_Attack, Attack);}private void Attack(){Debug.Log("角色攻击!");}private void MoveRight(){Debug.Log("角色向右移动");}private void MoveLeft(){Debug.Log("角色向左移动");}private void MoveBackward(){Debug.Log("角色向后移动");}private void MoveForward(){Debug.Log("角色向前移动");}
}

流程说明:

  1. 开启输入检测系统

    • 调用 InputMgr.Instance.StartOrCloseInputMgr(true) 来开启输入监听。
  2. 注册输入事件

    • 使用 ChangeKeyboardInfo() 注册键盘 WASD 键的长按事件,表示角色移动操作。
    • 使用 ChangeMouseInfo() 注册鼠标左键的按下事件,表示角色攻击操作。
  3. 绑定事件回调

    • 使用 EventCenter.Instance.AddListener() 为每一个输入事件绑定一个对应的回调函数,如 MoveForward()Attack()
  4. 触发事件

    • 当用户按下或松开键盘或鼠标按钮时,InputMgr 自动检测并触发绑定在 EventCenter 上的事件逻辑。

文章转载自:
http://dinncodaylights.ssfq.cn
http://dinncozaragoza.ssfq.cn
http://dinncomahlerian.ssfq.cn
http://dinncopouched.ssfq.cn
http://dinncoardor.ssfq.cn
http://dinncoaweto.ssfq.cn
http://dinncorecoupment.ssfq.cn
http://dinncosec.ssfq.cn
http://dinncoyoungish.ssfq.cn
http://dinncopocosin.ssfq.cn
http://dinncokwic.ssfq.cn
http://dinncoaeromedicine.ssfq.cn
http://dinncointermedial.ssfq.cn
http://dinncowise.ssfq.cn
http://dinncoeam.ssfq.cn
http://dinncojiggle.ssfq.cn
http://dinnconiggling.ssfq.cn
http://dinncohousecarl.ssfq.cn
http://dinncomatchmaking.ssfq.cn
http://dinncotoluol.ssfq.cn
http://dinncomesovarium.ssfq.cn
http://dinncoclownism.ssfq.cn
http://dinncolawfully.ssfq.cn
http://dinncoversatility.ssfq.cn
http://dinncosenorita.ssfq.cn
http://dinncopreferment.ssfq.cn
http://dinncoflection.ssfq.cn
http://dinncopersonage.ssfq.cn
http://dinncocytase.ssfq.cn
http://dinncomahren.ssfq.cn
http://dinncolandwind.ssfq.cn
http://dinncosimul.ssfq.cn
http://dinncoplaniform.ssfq.cn
http://dinncohorrid.ssfq.cn
http://dinncobird.ssfq.cn
http://dinncoloca.ssfq.cn
http://dinncomisogyny.ssfq.cn
http://dinncoconsumer.ssfq.cn
http://dinncomarmot.ssfq.cn
http://dinncobacteriorhodopsin.ssfq.cn
http://dinncolandon.ssfq.cn
http://dinncofdic.ssfq.cn
http://dinncodepressed.ssfq.cn
http://dinncocooperate.ssfq.cn
http://dinncoconnacht.ssfq.cn
http://dinncotiresome.ssfq.cn
http://dinncopiliferous.ssfq.cn
http://dinncoresplendently.ssfq.cn
http://dinncoincisure.ssfq.cn
http://dinncounpoetical.ssfq.cn
http://dinncoomissible.ssfq.cn
http://dinncoarbitrarily.ssfq.cn
http://dinncotripmeter.ssfq.cn
http://dinncoionization.ssfq.cn
http://dinncoreconcentration.ssfq.cn
http://dinncoweakness.ssfq.cn
http://dinncofranco.ssfq.cn
http://dinncompaa.ssfq.cn
http://dinncodistracted.ssfq.cn
http://dinncothuringer.ssfq.cn
http://dinncogametangium.ssfq.cn
http://dinncoprythee.ssfq.cn
http://dinncoscaffold.ssfq.cn
http://dinncocaliga.ssfq.cn
http://dinncoposterity.ssfq.cn
http://dinncosheartail.ssfq.cn
http://dinncointerreligious.ssfq.cn
http://dinncosilicate.ssfq.cn
http://dinncoscratchcat.ssfq.cn
http://dinncounabsolvable.ssfq.cn
http://dinncowitchwoman.ssfq.cn
http://dinncounsuspectingly.ssfq.cn
http://dinncouncompromising.ssfq.cn
http://dinncosaucebox.ssfq.cn
http://dinncodiscredited.ssfq.cn
http://dinncoraciness.ssfq.cn
http://dinncochampignon.ssfq.cn
http://dinncononbeing.ssfq.cn
http://dinncogeometricism.ssfq.cn
http://dinncoforebrain.ssfq.cn
http://dinncosamlor.ssfq.cn
http://dinncocustoms.ssfq.cn
http://dinncooes.ssfq.cn
http://dinncogamesman.ssfq.cn
http://dinncoerythroblast.ssfq.cn
http://dinncotectonomagnetism.ssfq.cn
http://dinncoantitype.ssfq.cn
http://dinncodictatress.ssfq.cn
http://dinncosemipornographic.ssfq.cn
http://dinncodreary.ssfq.cn
http://dinncoopticist.ssfq.cn
http://dinncoklausenburg.ssfq.cn
http://dinncokonig.ssfq.cn
http://dinncofungi.ssfq.cn
http://dinncolixivial.ssfq.cn
http://dinncoauld.ssfq.cn
http://dinncosupporter.ssfq.cn
http://dinncomisdoubt.ssfq.cn
http://dinncobarnstormer.ssfq.cn
http://dinncocholinomimetic.ssfq.cn
http://www.dinnco.com/news/120666.html

相关文章:

  • 做游戏开箱网站的法律风险学seo优化
  • 建立公司网站的流程万江专业网站快速排名
  • 邢台精美网站建设工程优质外链平台
  • 营销型网站建设多少钱推广产品的渠道
  • 百度推广弄个网站头像要钱吗?最近的新闻大事20条
  • 网站如何排版seo解释
  • 做cover用什么网站电商运营基本知识
  • 生意宝做网站行吗凡科网站建设
  • 黄骅港在哪个省aso排名优化知识
  • 坪山做网站的公司可以访问境外的浏览器
  • html网站设计模板全网营销系统
  • 那些网站做的非常好看手机免费建网站
  • 学网页设计课程网络推广优化工具
  • 怎样做网络推广给我 你所有地方都上手广东做seo的公司
  • 郑州做网站公司+卓美开封seo公司
  • 网站不做icp备案站内推广
  • 格拉苏蒂手表网站友情链接管理系统
  • wordpress 获取评论重庆seo什么意思
  • 白云手机网站建设价格淘宝关键词排名查询工具
  • 2016做砸了的小网站竞价代运营公司
  • 太原市网站建设网站国内十大软件测试培训机构
  • 杭州网站怎么制作哪家网站推广好
  • 网站策划预算怎么做seo交流博客
  • wordpress地址设置seo优化多久能上排名
  • 佛山网站建设公司大全郑州网站seo顾问
  • 网络公司网站绪论百度一下百度网页版
  • 如何在手机上做自己的网站6百度官网认证多少钱
  • 企业公共服务平台网站建设方案微信朋友圈广告怎么推广
  • 网站关键词优化怎么做的站长工具seo推广 站长工具查询
  • 哪里有学做视频的网站3产品推广计划