chinese直男口爆体育生外卖, 99久久er热在这里只有精品99, 又色又爽又黄18禁美女裸身无遮挡, gogogo高清免费观看日本电视,私密按摩师高清版在线,人妻视频毛茸茸,91论坛 兴趣闲谈,欧美 亚洲 精品 8区,国产精品久久久久精品免费

電子發(fā)燒友App

硬聲App

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示
創(chuàng)作
電子發(fā)燒友網(wǎng)>電子資料下載>電子資料>按鈕尋找開源項(xiàng)目

按鈕尋找開源項(xiàng)目

2023-07-12 | zip | 0.00 MB | 次下載 | 免費(fèi)

資料介紹

描述

關(guān)于

Find the Button 是一款簡(jiǎn)單的游戲,卻提供了驚人的樂趣!在這個(gè)游戲中,一個(gè)玩家隱藏一個(gè)回聲按鈕,另一個(gè)玩家去找到它。這對(duì)小孩子來說特別有趣!我兩歲的兒子喜歡跑來跑去,從閃爍的燈光中找出按鈕的位置。

要玩游戲,您只需在隱藏或找到它時(shí)按一下按鈕即可。每個(gè)動(dòng)作有 30 秒的時(shí)間,以努力提高游戲的速度和節(jié)奏。

啟動(dòng)技能并啟動(dòng)后,整個(gè)游戲循環(huán)只需一個(gè)按鈕即可操作!無需語音!您當(dāng)然可以隨時(shí)尋求幫助。

此外,由于這是一項(xiàng)不明確依賴于播放按鈕顏色的技能,您可以隨時(shí)禁用和啟用按鈕燈。我為那些可能對(duì)閃光燈敏感的人加入了這個(gè)功能,但在我這樣做之后我意識(shí)到它也大大增加了找到按鈕的挑戰(zhàn)。

執(zhí)行

我使用 Typescript 和 ask-sdk v2 來提高我的技能,并將我的代碼托管在 AWS Lambda 上。

我喜歡盡可能地劃分我的代碼,所以我的處理程序索引文件總是相當(dāng)簡(jiǎn)單:

import { SkillBuilders } from 'ask-sdk';import { RequestHandlers, ErrorHandlers } from './handlers';import { RequestInterceptors } from './request-interceptors';import { ResponseInterceptors } from './response-interceptors';const skillBuilder = SkillBuilders.custom();export const handler = skillBuilder    .addRequestInterceptors(...RequestInterceptors)    .addRequestHandlers(...RequestHandlers)    .addErrorHandlers(...ErrorHandlers)    .addResponseInterceptors(...ResponseInterceptors)    .lambda();

我有處理程序和攔截器的索引文件,所以我可以像這樣同時(shí)導(dǎo)入所有處理程序。這是 RequestHandlers 索引文件:

import { RollCallStateRequestHandlers } from './RollCallState';import { GenericRequestHandlers, GenericErrorHandlers } from './Stateless';import { HideButtonStateRequestHandlers } from './HideButtonState';import { FindButtonStateRequestHandlers } from './FindButtonState';import { GameOverStateRequestHandlers } from './GameOverState';import { LaunchStateRequestHandlers } from './LaunchState';export const RequestHandlers = [ ...LaunchStateRequestHandlers, ...RollCallStateRequestHandlers, ...HideButtonStateRequestHandlers, ...FindButtonStateRequestHandlers, ...GameOverStateRequestHandlers, ...GenericRequestHandlers];export const ErrorHandlers = [ ...GenericErrorHandlers];

我將所有可能的意圖分配給執(zhí)行狀態(tài),然后以這種方式將它們分成文件夾。這是我的處理程序目錄的結(jié)構(gòu):

?
poYBAGO0Hg-ARHObAABWB8XsMmA523.png
Stateless 子目錄包含不需要為其分配狀態(tài)的通用處理程序(Fallback、LaunchRequest 等)
?

每個(gè)狀態(tài)都有處理程序,需要根據(jù)狀態(tài)執(zhí)行特定操作。例如,AMAZON.HelpIntent 處理程序(認(rèn)證所需的處理程序)需要根據(jù)您在技能中的位置說出不同的內(nèi)容,并且始終需要以問題結(jié)束。由于基本行為始終相同(唯一可以保證在不同狀態(tài)的幫助處理程序之間發(fā)生變化的是Alexa所說的),我創(chuàng)建了一個(gè)通用的 HelpIntentHandler 類,我對(duì)其進(jìn)行擴(kuò)展并且只將狀態(tài)傳遞到其中。由于我按狀態(tài)名稱對(duì)所有語音消息進(jìn)行排序,處理程序只需將messages[this.state].Help()傳遞給speak調(diào)用即可給出響應(yīng):

import { HandlerInput, ResponseBuilder } from "ask-sdk";import { MyRequestHandler } from "./MyRequestHandler.class";import { GadgetController } from "../../utils";export class HelpIntentHandler extends MyRequestHandler { constructor(private state: string) { super();    } public canHandle(handlerInput: HandlerInput): boolean { const request = handlerInput.requestEnvelope.request; const state = handlerInput.attributesManager.getSessionAttributes().state; return state === this.state && request.type === 'IntentRequest' && request.intent.name === 'AMAZON.HelpIntent';    } protected updateSessionAttributes(handlerInput: HandlerInput) { this.setSessionAttribute('hasBeenAskedAQuestion', true); this.removeSessionAttribute('inputHandlerId'); this.removeSessionAttribute('handlerStartTime'); this.saveSessionAttributes();    } protected createResponse(handlerInput: HandlerInput): ResponseBuilder { const messages = this.getRequestAttribute('messages');; const flashingDisabled = this.getSessionAttribute('flashingDisabled'); const buttonId = this.getSessionAttribute('buttonId'); let response = handlerInput.responseBuilder            .speak(messages[this.state].Help())            .addDirective(GadgetController.stopButtonDownAnimation())            .addDirective(GadgetController.stopButtonUpAnimation())            .addDirective(GadgetController.stopDefaultAnimation())            .withShouldEndSession(false); if (!flashingDisabled) { response = response                .addDirective(GadgetController.createButtonDownAnimation(undefined, 'FF0000'))                .addDirective(GadgetController.createButtonUpAnimation(undefined, 'FF0000'))                .addDirective(GadgetController.createHelpAnimation(buttonId));        } return response;    }}

您可能會(huì)注意到 HelpIntentHandler 擴(kuò)展了一個(gè)名為 MyRequestHandler 的。這是我創(chuàng)建的一個(gè)類,它封裝了所有處理程序共有的行為,包括設(shè)置您可能已經(jīng)注意到我在幫助處理程序中調(diào)用的方法、setSessionAttrribute 、removeSessionAttribute、getRequestAttribute等。這些方法和其他方法我已經(jīng)寫過,允許我以更方便的方式使用handlerInput中包含的attributesManager 。

我還編寫了實(shí)用程序類GadgetControllerGameEngine,以幫助簡(jiǎn)化兩個(gè)按鈕 API 的交互,因?yàn)樗鼈儾恢庇^。我假設(shè)亞馬遜會(huì)在某個(gè)時(shí)候發(fā)布這樣的按鈕 API 實(shí)用程序類;現(xiàn)在,我為使用我所構(gòu)建的東西感到自豪和高興。

總而言之,使用這些很棒的工具,將AMAZON.HelpIntent處理程序添加到您的狀態(tài)之一就像下面這樣簡(jiǎn)單:

import { HelpIntentHandler } from "../classes/HelpIntentHandler.class";import { STATES } from "../../data/states";export class RollCallHelpHandler extends HelpIntentHandler { constructor() { super(STATES.RollCall);    }}

。

?

?

?

?


下載該資料的人也在下載 下載該資料的人還在閱讀
更多 >

評(píng)論

查看更多

下載排行

本周

  1. 1山景DSP芯片AP8248A2數(shù)據(jù)手冊(cè)
  2. 1.06 MB  |  532次下載  |  免費(fèi)
  3. 2RK3399完整板原理圖(支持平板,盒子VR)
  4. 3.28 MB  |  339次下載  |  免費(fèi)
  5. 3TC358743XBG評(píng)估板參考手冊(cè)
  6. 1.36 MB  |  330次下載  |  免費(fèi)
  7. 4DFM軟件使用教程
  8. 0.84 MB  |  295次下載  |  免費(fèi)
  9. 5元宇宙深度解析—未來的未來-風(fēng)口還是泡沫
  10. 6.40 MB  |  227次下載  |  免費(fèi)
  11. 6迪文DGUS開發(fā)指南
  12. 31.67 MB  |  194次下載  |  免費(fèi)
  13. 7元宇宙底層硬件系列報(bào)告
  14. 13.42 MB  |  182次下載  |  免費(fèi)
  15. 8FP5207XR-G1中文應(yīng)用手冊(cè)
  16. 1.09 MB  |  178次下載  |  免費(fèi)

本月

  1. 1OrCAD10.5下載OrCAD10.5中文版軟件
  2. 0.00 MB  |  234315次下載  |  免費(fèi)
  3. 2555集成電路應(yīng)用800例(新編版)
  4. 0.00 MB  |  33566次下載  |  免費(fèi)
  5. 3接口電路圖大全
  6. 未知  |  30323次下載  |  免費(fèi)
  7. 4開關(guān)電源設(shè)計(jì)實(shí)例指南
  8. 未知  |  21549次下載  |  免費(fèi)
  9. 5電氣工程師手冊(cè)免費(fèi)下載(新編第二版pdf電子書)
  10. 0.00 MB  |  15349次下載  |  免費(fèi)
  11. 6數(shù)字電路基礎(chǔ)pdf(下載)
  12. 未知  |  13750次下載  |  免費(fèi)
  13. 7電子制作實(shí)例集錦 下載
  14. 未知  |  8113次下載  |  免費(fèi)
  15. 8《LED驅(qū)動(dòng)電路設(shè)計(jì)》 溫德爾著
  16. 0.00 MB  |  6656次下載  |  免費(fèi)

總榜

  1. 1matlab軟件下載入口
  2. 未知  |  935054次下載  |  免費(fèi)
  3. 2protel99se軟件下載(可英文版轉(zhuǎn)中文版)
  4. 78.1 MB  |  537798次下載  |  免費(fèi)
  5. 3MATLAB 7.1 下載 (含軟件介紹)
  6. 未知  |  420027次下載  |  免費(fèi)
  7. 4OrCAD10.5下載OrCAD10.5中文版軟件
  8. 0.00 MB  |  234315次下載  |  免費(fèi)
  9. 5Altium DXP2002下載入口
  10. 未知  |  233046次下載  |  免費(fèi)
  11. 6電路仿真軟件multisim 10.0免費(fèi)下載
  12. 340992  |  191187次下載  |  免費(fèi)
  13. 7十天學(xué)會(huì)AVR單片機(jī)與C語言視頻教程 下載
  14. 158M  |  183279次下載  |  免費(fèi)
  15. 8proe5.0野火版下載(中文版免費(fèi)下載)
  16. 未知  |  138040次下載  |  免費(fèi)