我的Go+语言初体验——【三、spx案例测试_许式伟先生推荐补充(附-视频)】

2022-11-29 17:03:04 浏览数 (1)

本课程根据【许式伟】先生的指点说明,向大家推荐【tutorial】下的【Demo】,此类demo会对大家掌握【Go 的spx】会有很大的帮助。

目录

欢迎大家参与【我的Go 语言初体验】活动:

1、拉取【spx】测试内容

2、【tutorial】下的【Demo】运行

案例一、聊天气

3、编码分析

Jaime的对白编码:

kai的对白编码:

生成的【gop_autogen.go】文件分析

1、拉取【spx】测试内容

前置环境需要有【git】

代码语言:javascript复制
git clone https://github.com/goplus/spx.git

拉取完成后请关闭当前【cmd】,无法再这个【cmd】内执行测试。

可能偶尔出现拉取失败,重试即可。

2、【tutorial】下的【Demo】运行

案例一、聊天气

3、编码分析

这个调用的是网络包看着名字是【七牛】的,也就是B栈那个。

七牛云的B栈主页:【七牛云的个人空间_哔哩哔哩_Bilibili】 

Jaime的对白编码:

代码语言:javascript复制
onMsg "1", => {
	play recordingComeFrom
	say "I come from England.", 2
	broadcast "2"
}

onMsg "3", => {
	play recordingMild
	say "It's mild, but it's not always pleasant.", 4
	nextCostume
	play recordingEast
	say "The weather's often cold in the North and windy in the East.", 5.5
	play recordingSouth
	say "It's often wet in the West and sometimes warm in the South.", 5
	broadcast "4"
}

onMsg "5", => {
	nextCostume
	play recordingSummer
	say "I like spring and summer.", 2
	play recordingShort
	say "The days are long and the nights are short.", 3
	play recordingLate
	say "The sun rises early and sets late. ", 3
	nextCostume
	play recordingWinter
	say "I don't like autumn and winter.", 3
	play recordingLong
	say "The days are short and the nights are long.", 4
	play recordingEarly
	say "The sun rises late and sets early.", 4
	nextCostume
	play recordingInteresting
	say "Our climate is not very good, but it's certainly interesting.", 5
	play recordingConversation
	say "It's our favourite subject of conversation.", 4
	broadcast "6"
}

onMsg "7", => {
	play recordingBye
	say "Bye!", 2
	nextCostume
}

kai的对白编码:

代码语言:javascript复制
onStart => {
	setCostume "kai-a"
	play recordingWhere
	say "Where do you come from?", 2
	broadcast "1"
}

onMsg "2", => {
	play recordingCountry
	say "What's the climate like in your country?", 3
	broadcast "3"
}

onMsg "4", => {
	play recordingBest
	say "Which seasons do you like best?", 3
	broadcast "5"
}

onMsg "6", => {
	play recordingBye2
	say "Thanks. Bye!", 2
	nextCostume
	broadcast "7"
}

生成的【gop_autogen.go】文件分析

后面的对白就是写死的了:

应该是为了让咱们更好理解吧,很直接。不过我还找到开启多线程的文档。

声音是在线生成的,不知道里面怎么调用的。

0 人点赞