可选的 type 类型有: cc.SystemEvent.EventType.KEY_DOWN (键盘按下) cc.SystemEvent.EventType.KEY_UP (键盘释放) cc.SystemEvent.EventType.DEVICEMOTION (设备重力传感) 键盘事件 事件监听器类型:cc.SystemEvent.EventType.KEY_DOWN 和 cc.SystemEvent.EventType.KEY_UP 事件触发后的回调函数 (cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP , this.onKeyUp, this); }, destroy () { cc.systemEvent.off(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown , this); cc.systemEvent.off(cc.SystemEvent.EventType.KEY_UP, this.onKeyUp, this); }, onKeyDown: function
(1)控制事件处理 onLoad() { cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP, this.onKeyUp, this); } onDestroy() { cc.systemEvent.off (cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); cc.systemEvent.off(cc.SystemEvent.EventType.KEY_UP
bullet: Prefab; @property(cc.Float) speed = 0; start () { //注册全局触摸点击事件 cc.systemEvent.on RigidBodyComponent); bullet.applyImpulse(new Vec3(0, 2.29, -1 * this.speed)); } 这里需要注意两点: 触摸事件是使用cc.systemEvent 下面重点分析使用键盘控制摄像机移动的相关代码: //使用 cc.systemEvent.on 注册全局键盘事件 start() { cc.systemEvent.on(Node.EventType.KEY_DOWN , this.onKeyDown, this); cc.systemEvent.on(Node.EventType.KEY_UP, this.onKeyUp, this); ..
this.accRight = false; // 主角当前水平方向速度 this.xSpeed = 0; // 初始化键盘输入监听 cc.systemEvent.on (cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP , this.onKeyUp, this); }, onDestroy () { // 取消键盘输入监听 cc.systemEvent.off(cc.SystemEvent.EventType.KEY_DOWN , this.onKeyDown, this); cc.systemEvent.off(cc.SystemEvent.EventType.KEY_UP, this.onKeyUp, this
SystemEvent 3. View 4. action 5. audioEngine 6. ParticleSystem 『 游戏模块 』 1. 游戏层 2. 重力传感系统设置 10.1 开启重力传感系统 cc.systemEvent.setAccelerometerEnabled(true); cc.systemEvent.on(cc.SystemEvent.EventType.DEVICEMOTION ,this.onDeviceMotionEvent, this); 10.2 关闭重力传感系统 cc.systemEvent.off(cc.SystemEvent.EventType.DEVICEMOTION
this.instance.node.getPosition(); } protected onLoad() { Head.instance = this; cc.systemEvent.on (cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); GameEvent.on('gameinit', this.onGameInit GameEvent.on('gamestart', this.onGameStart, this); } protected onDestroy() { cc.systemEvent.off (cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); GameEvent.off('gameinit', this.onGameInit
false; this.left = false; this.right = false; // 键盘事件,w s a d 上下左右 cc.systemEvent.on (cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP
this.instance.node.getPosition(); } protected onLoad() { Head.instance = this; cc.systemEvent.on (cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); GameEvent.on('gameinit', this.onGameInit GameEvent.on('gamestart', this.onGameStart, this); } protected onDestroy() { cc.systemEvent.off (cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); GameEvent.off('gameinit', this.onGameInit
我总结了最常见的几个原因: payload.kind 配置错误:用了 systemEvent 而不是 agentTurn 推送参数缺失:没指定正确的 channel、to 地址 权限问题:机器人没有主动消息推送权限 时区不对或者时间戳格式错误 任务状态异常:任务被禁用或者执行失败没日志 二、一步步排查问题 第一步:检查 payload 类型(最常见的坑) 很多人照着老文档配置,会把 payload.kind 设为 systemEvent 正确的配置必须是: "payload": { "kind": "agentTurn", // 绝对不能用 systemEvent! 调试过程中遇到的坑 问题现象 原因 解决方案 任务创建成功但到点没反应 payload.kind 用了 systemEvent 改成 agentTurn 推送时间总是差8小时 没指定时区 加上 --tz
pcPackets = 0; *pcbPacket = 0; *pPackets = NULL; break; case WM_TABLET_SYSTEMEVENT (WM_TABLET_DEFBASE + 8) #define WM_TABLET_DELETED (WM_TABLET_DEFBASE + 9) #define WM_TABLET_SYSTEMEVENT
start() { systemEvent.on(SystemEventType.TOUCH_START, this.onClickBall, this); } private _ray = new
= false; this.accRight = false; // 主角当前水平方向速度 this.xSpeed = 0; // 初始化键盘输入监听 cc.systemEvent.on (cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP
<appender-ref ref="rollingFile" /> <appender-ref ref="coloredConsoleApp" /> <appender-ref ref="<em>SystemEvent</em>
publicAnalysisResultanalyzeFault(FaultEventevent){List<CorrelatedIssue>correlatedIssues=newArrayList<>();//1.时间窗口内的关联事件List<SystemEvent
UnmanagedType.LPStruct), In] Guid stylusButtonGuid, [In, Out] ref IntPtr pStylusPos); new void SystemEvent ), In] IRealTimeStylus realTime, [In] uint tcid, [In] uint cid, [In] ushort systemEvent
UnmanagedType.LPStruct), In] Guid stylusButtonGuid, [In, Out] ref IntPtr pStylusPos); new void SystemEvent ), In] IRealTimeStylus realTime, [In] uint tcid, [In] uint cid, [In] ushort systemEvent
windows.backgroundTasks" EntryPoint = "Tasks.BackgroundTaskClass" > <BackgroundTasks> <Task Type="<em>systemEvent</em>
windows.backgroundTasks" EntryPoint = "Tasks.BackgroundTaskClass" > <BackgroundTasks> <Task Type="<em>systemEvent</em>
开发者主动启用加速度计(Accelerometer)之后,引擎会定时通过 InputManager 发送 cc.SystemEvent.EventType.DEVICEMOTION 事件(默认间隔为 0.2
- cron: Manage cron jobs and wake events (use for reminders; when scheduling a reminder, write the systemEvent