Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-libs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-libs
Commits
81e5868b
Commit
81e5868b
authored
Jul 02, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab2.dui88.com/laoqifeng/zeroing-libs
into dev
parents
ec05804f
e87cb514
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
3860 additions
and
1 deletion
+3860
-1
answer-game.json
dist/customs/answer-game.json
+273
-0
jiugong-turntable.json
dist/customs/jiugong-turntable.json
+97
-0
app.js
src/custom/answer-game/debug/app.js
+84
-0
index.html
src/custom/answer-game/debug/index.html
+49
-0
load-assets.js
src/custom/answer-game/debug/load-assets.js
+10
-0
main.js
src/custom/answer-game/debug/main.js
+908
-0
main.js.map
src/custom/answer-game/debug/main.js.map
+1
-0
props.js
src/custom/answer-game/debug/props.js
+7
-0
meta.json
src/custom/answer-game/meta.json
+283
-0
AnswerArea.ts
src/custom/answer-game/src/game/AnswerArea.ts
+461
-0
Background.ts
src/custom/answer-game/src/game/Background.ts
+90
-0
GameView.ts
src/custom/answer-game/src/game/GameView.ts
+64
-0
GameWrapper.ts
src/custom/answer-game/src/game/GameWrapper.ts
+60
-0
GuideLayer.ts
src/custom/answer-game/src/game/GuideLayer.ts
+109
-0
SubjectManager.ts
src/custom/answer-game/src/game/SubjectManager.ts
+69
-0
SubjectTitle.ts
src/custom/answer-game/src/game/SubjectTitle.ts
+347
-0
SvgaManager.ts
src/custom/answer-game/src/game/SvgaManager.ts
+38
-0
utils.ts
src/custom/answer-game/src/game/utils.ts
+31
-0
index.ts
src/custom/answer-game/src/index.ts
+14
-0
props.ts
src/custom/answer-game/src/props.ts
+15
-0
app.js
src/custom/jiugong-turntable/debug/app.js
+102
-0
index.html
src/custom/jiugong-turntable/debug/index.html
+49
-0
load-assets.js
src/custom/jiugong-turntable/debug/load-assets.js
+10
-0
main.js
src/custom/jiugong-turntable/debug/main.js
+261
-0
main.js.map
src/custom/jiugong-turntable/debug/main.js.map
+1
-0
props.js
src/custom/jiugong-turntable/debug/props.js
+7
-0
meta.json
src/custom/jiugong-turntable/meta.json
+103
-0
GameView.ts
src/custom/jiugong-turntable/src/game/GameView.ts
+39
-0
GameWrapper.ts
src/custom/jiugong-turntable/src/game/GameWrapper.ts
+53
-0
Turntable.ts
src/custom/jiugong-turntable/src/game/Turntable.ts
+176
-0
utils.ts
src/custom/jiugong-turntable/src/game/utils.ts
+19
-0
index.ts
src/custom/jiugong-turntable/src/index.ts
+14
-0
props.ts
src/custom/jiugong-turntable/src/props.ts
+15
-0
main.js
src/custom/jump-high-2/debug/main.js
+1
-1
No files found.
dist/customs/answer-game.json
0 → 100644
View file @
81e5868b
{
"name"
:
"墨迹天气答题"
,
"desc"
:
"墨迹天气答题模块"
,
"props"
:
{
"guideText1"
:
{
"alias"
:
"引导1的文本"
,
"type"
:
"string"
,
"default"
:
"长按屏幕
\n
杆子变长即可通过"
},
"subjectBox_Y"
:
{
"alias"
:
"题目栏的高度"
,
"type"
:
"number"
,
"default"
:
250
},
"countDown"
:
{
"alias"
:
"倒计时时长"
,
"type"
:
"number"
,
"default"
:
8
},
"answerArea_Y"
:
{
"alias"
:
"答案选项的高度"
,
"type"
:
"number"
,
"default"
:
770
},
"option_spaceX"
:
{
"alias"
:
"答案横向间距"
,
"type"
:
"number"
,
"default"
:
30
},
"option_spaceY"
:
{
"alias"
:
"答案纵向间距"
,
"type"
:
"number"
,
"default"
:
60
},
"people_X"
:
{
"alias"
:
"人物横轴坐标"
,
"type"
:
"number"
,
"default"
:
200
},
"people_Y"
:
{
"alias"
:
"人物横轴坐标"
,
"type"
:
"number"
,
"default"
:
460
},
"fontName"
:
{
"alias"
:
"字体名"
,
"type"
:
"string"
,
"default"
:
"countDown"
,
"desc"
:
"倒计时位图文字"
},
"answerCountText_Y"
:
{
"alias"
:
"初始化答对题目数字高度偏移"
,
"type"
:
"number"
,
"default"
:
10
},
"titleText_Y"
:
{
"alias"
:
"初始化题目纵向偏移量"
,
"type"
:
"number"
,
"default"
:
80
},
"titleText_X"
:
{
"alias"
:
"初始化题目横向偏移量"
,
"type"
:
"number"
,
"default"
:
0
},
"titleText_width"
:
{
"alias"
:
"初始化题目宽度偏移量"
,
"type"
:
"number"
,
"default"
:
80
},
"titleText_height"
:
{
"alias"
:
"初始化题目高度偏移量"
,
"type"
:
"number"
,
"default"
:
80
}
},
"assets"
:
[
{
"name"
:
"gameBg"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/3408205d00345c5ff4750d00848ec0a6f3d27a09.jpg"
,
"uuid"
:
"0f8d72a1-df66-4d1c-8d40-b550a89c5765"
,
"ext"
:
".jpg"
},
{
"name"
:
"前景云上"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/d13af0da7595aaecad75ae996bcb5ebee15aee29.png"
,
"uuid"
:
"c13aa22d-d946-463a-b619-b8d07420c532"
,
"ext"
:
".png"
},
{
"name"
:
"前景云下"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fad2f7f1df80eed162e804729cb8ca04d7ba74b2.png"
,
"uuid"
:
"9b3bc2ce-db1b-4362-a1eb-b821afffafee"
,
"ext"
:
".png"
},
{
"name"
:
"答案区"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/41b14735589a7c5ec118aeec2d63ed2e5cae6c2a.png"
,
"uuid"
:
"5e112c5d-e249-4d18-ac9f-1c75fba344f0"
,
"ext"
:
".png"
},
{
"name"
:
"答对题数"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/88c26c93c86b214afdd4265880ec5f684e44d26e.png"
,
"uuid"
:
"4f543cda-3600-41aa-b48c-d31a0cc2731b"
,
"ext"
:
".png"
},
{
"name"
:
"倒计时"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/722c4eacb1b4ee4f32048777827232496fcd13cc.png"
,
"uuid"
:
"5f7d9f3d-a73e-4576-af26-c0b60152416d"
,
"ext"
:
".png"
},
{
"name"
:
"题目栏"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/1f2138cefb4ee17dd97d54572bc4861391b8ed2b.png"
,
"uuid"
:
"fc29acd6-1468-4b3c-b022-bc29b85b661c"
,
"ext"
:
".png"
},
{
"name"
:
"进度条"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/e64ca0c0a0e1ee996aa3a81c9526bd4434fd0f76.png"
,
"uuid"
:
"8573cec9-a33d-4d9c-9bed-e8e35875a257"
,
"ext"
:
".png"
},
{
"name"
:
"选区"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5de49902aa2f2a214549c87a607e0198b5df8f1f.png"
,
"uuid"
:
"0597817b-adaa-4e95-9655-717869747613"
,
"ext"
:
".png"
},
{
"name"
:
"people"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b15b5859041564a13ef017949fe7adb5c52f26a1.png"
,
"uuid"
:
"3c28c565-9d43-4224-8753-b62341374ebc"
,
"ext"
:
".png"
},
{
"name"
:
"选错"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/0cf72d75829887eadf9619a1c69a6b81aabbe282.png"
,
"uuid"
:
"4b5de144-2a2c-47af-a52f-3d26b62bf3da"
,
"ext"
:
".png"
},
{
"name"
:
"选对"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fd817526a698076a227616c6830af3047b57d568.png"
,
"uuid"
:
"dfc6ed1a-bda1-4409-95c8-6402d3dbf434"
,
"ext"
:
".png"
},
{
"name"
:
"选中"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/bd55f089632280a3a88f24bd2b7f628ebe8be7ef.png"
,
"uuid"
:
"71a65180-c0d5-43e7-a4c5-226dd73cfcb5"
,
"ext"
:
".png"
},
{
"name"
:
"ready_go"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/79aa337faaf7370e099962deab32faad19e050bc.svga"
,
"uuid"
:
"eddacfce-898f-4373-8a6c-2b405943459b"
,
"ext"
:
".svga"
},
{
"name"
:
"question_enter"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a22af34bdb9a07f94ce091c049f0526b7bb70401.svga"
,
"uuid"
:
"1a03ff4b-5b95-4eda-bdd6-b168265ef99a"
,
"ext"
:
".svga"
},
{
"name"
:
"mona_walk"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/dc04372610bf9280913f90fc29752c3f86f71e19.svga"
,
"uuid"
:
"08356014-69ad-4f13-8516-1ca7cb8b3ba9"
,
"ext"
:
".svga"
},
{
"name"
:
"countdown_321"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/c95c03d4ab92f27d23facd24414aa7e25dc90f19.svga"
,
"uuid"
:
"c5e2e6e1-b281-46a9-8fc1-1c5e6b40f9a6"
,
"ext"
:
".svga"
},
{
"name"
:
"right_mona"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/dd714c036c549a6708ca1da8059afb098349f320.svga"
,
"uuid"
:
"5015efe5-d4ea-4a30-8cfb-34d264672e96"
,
"ext"
:
".svga"
},
{
"name"
:
"rian_mona"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/135a5e4e454ede9ad9a8257bf38c2cd75f6b526e.svga"
,
"uuid"
:
"d33fa677-3c78-4814-94a5-2ee0bde27d35"
,
"ext"
:
".svga"
},
{
"name"
:
"rian_weather"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/87d422f1ef4260ec68d712774c5846cd440c8896.svga"
,
"uuid"
:
"25ae7480-bcae-4472-8d2c-9bf0c2930160"
,
"ext"
:
".svga"
},
{
"name"
:
"snow_mona"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8f0342a9fc7a25fd638b38432df4a3fa153438eb.svga"
,
"uuid"
:
"b7cfa0b9-356b-42dc-8822-be0fb9587d3f"
,
"ext"
:
".svga"
},
{
"name"
:
"snow_weather"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/586d926dd66b9d893297f5ec32f4229a0d30cb0e.svga"
,
"uuid"
:
"8632eb42-f43e-44a7-be18-c3688a60f09b"
,
"ext"
:
".svga"
},
{
"name"
:
"thunder_mona"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/57d05bf3268b7f2b1972dfe848fb2739105a05de.svga"
,
"uuid"
:
"59011678-c782-4e24-9fe6-89013d391a5e"
,
"ext"
:
".svga"
},
{
"name"
:
"thunder_weather"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/3a10f54df8b2dbb31b579b221efc322831dfffb2.svga"
,
"uuid"
:
"924a2a1e-28fb-41d5-8447-3cb6eefdd213"
,
"ext"
:
".svga"
},
{
"name"
:
"wind_mona"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/d574675633444a9cd5024babdf3afb2461092805.svga"
,
"uuid"
:
"314771ba-f5d3-482d-b3d8-5dbb311b0b94"
,
"ext"
:
".svga"
},
{
"name"
:
"wind_weather"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/42892471c92f91830fc37262a262079bd82b3e06.svga"
,
"uuid"
:
"fb7009e0-7d07-4811-ace3-162a210d4f1e"
,
"ext"
:
".svga"
},
{
"name"
:
"mona_confuse"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/543b9faf2cd1584b63bcad41ba6759dbd3ccd1db.svga"
,
"uuid"
:
"b8035737-9913-45ce-8e40-833ce0777c34"
,
"ext"
:
".svga"
}
],
"events"
:
{
"in"
:
{
"answer-game-start"
:
{
"alias"
:
"开始"
,
"data"
:
{}
},
"answer-game-subject"
:
{
"alias"
:
"题目数据"
,
"data"
:
{}
},
"answer-game-result"
:
{
"alias"
:
"答案结果"
,
"data"
:
{}
}
},
"out"
:
{
"answer-game-select"
:
{
"alias"
:
"选择的答案"
,
"data"
:
{}
},
"answer-game-over"
:
{
"alias"
:
"结束答题"
,
"data"
:
{}
},
"answer-game-visibilitychange"
:
{
"alias"
:
"当前界面是否被放置后台"
,
"data"
:
{}
}
}
},
"id"
:
"answer-game"
,
"code"
:
"(function (global, factory) {
\n\t
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :
\n\t
typeof define === 'function' && define.amd ? define(['tslib'], factory) :
\n\t
(global = global || self, global['answer-game'] = factory(global.tslib));
\n
}(this, (function (tslib) { 'use strict';
\n\n\t
var props = {};
\r\n\t
function prepareProps() {
\r\n\t
var metaProps = getProps();
\r\n\t
engine.injectProp(props, metaProps);
\r\n\t
}
\r\n\t
function injectProps(p) {
\r\n\t
engine.injectProp(props, p);
\r\n\t
}
\r\n\t
//# sourceMappingURL=props.js.map
\n\n\t
var SubjectManager = (function () {
\r\n\t
function SubjectManager() {
\r\n\t
this._curSubJect = 0;
\r\n\t
}
\r\n\t
SubjectManager.prototype.init = function () {
\r\n\t
this.insideAddEventListener();
\r\n\t
};
\r\n\t
SubjectManager.prototype.insideAddEventListener = function () {
\r\n\t
engine.globalEvent.addEventListener('handleOption', this.handleSubject, this);
\r\n\t
engine.globalEvent.addEventListener('updateSubject', this.updateSubject, this);
\r\n\t
engine.globalEvent.addEventListener('handleResult', this.handleResult, this);
\r\n\t
engine.globalEvent.addEventListener('sendAnswerResult', this.sendAnswerResult, this);
\r\n\t
};
\r\n\t
SubjectManager.prototype.handleSubject = function (subject) {
\r\n\t
this._curSubJect = 0;
\r\n\t
this._loactionCache = subject.data;
\r\n\t
this.updateSubject();
\r\n\t
engine.globalEvent.dispatchEvent('updateAnswerCount', { count: 0 });
\r\n\t
};
\r\n\t
SubjectManager.prototype.updateSubject = function () {
\r\n\t
if (this._curSubJect >= this._loactionCache.length) {
\r\n\t
console.log('没有题目');
\r\n\t
engine.globalEvent.dispatchEvent('answer-game-over');
\r\n\t
return;
\r\n\t
}
\r\n\t
this._curTmpSubject = this._loactionCache[this._curSubJect];
\r\n\t
var title = this._loactionCache[this._curSubJect].question;
\r\n\t
var options = this._loactionCache[this._curSubJect].options;
\r\n\t
var tmpIndex = this._loactionCache[this._curSubJect].index;
\r\n\t
this.updateTitle(title, tmpIndex);
\r\n\t
this.updateOption(options);
\r\n\t
this._curSubJect++;
\r\n\t
};
\r\n\t
SubjectManager.prototype.updateTitle = function (title, tmpIndex) {
\r\n\t
engine.globalEvent.dispatchEvent('updateSubjectTitle', { title: title, curSubJect: tmpIndex });
\r\n\t
};
\r\n\t
SubjectManager.prototype.updateOption = function (options) {
\r\n\t
engine.globalEvent.dispatchEvent('updateOption', { options: options });
\r\n\t
};
\r\n\t
SubjectManager.prototype.handleResult = function (result) {
\r\n\t
var tmp = result.data.result;
\r\n\t
engine.globalEvent.dispatchEvent('updateAnswerCount', { count: tmp.count });
\r\n\t
engine.globalEvent.dispatchEvent('handleAnswerOption', { state: tmp.state });
\r\n\t
};
\r\n\t
SubjectManager.prototype.sendAnswerResult = function (resultData) {
\r\n\t
var tmpAnswer = resultData.data.answer;
\r\n\t
engine.globalEvent.dispatchEvent('answer-game-select', { curSubJect: this._curTmpSubject.index, answer: tmpAnswer });
\r\n\t
};
\r\n\t
return SubjectManager;
\r\n\t
}());
\r\n\t
//# sourceMappingURL=SubjectManager.js.map
\n\n\t
function getTexture(uuid) {
\r\n\t
return engine.Texture.from(getAssetByUUID(uuid).uuid);
\r\n\t
}
\r\n\t
function getTextureByName(name) {
\r\n\t
return getTexture(engine.getAssetByName(name).uuid);
\r\n\t
}
\r\n\t
function getStage() {
\r\n\t
return engine.gameStage.stage;
\r\n\t
}
\r\n\t
var OptionState;
\r\n\t
(function (OptionState) {
\r\n\t
OptionState[OptionState[
\"
CHOICE_RIGHT
\"
] = 0] =
\"
CHOICE_RIGHT
\"
;
\r\n\t
OptionState[OptionState[
\"
CHOICE_WRONG
\"
] = 1] =
\"
CHOICE_WRONG
\"
;
\r\n\t
OptionState[OptionState[
\"
CHOICE_SELECT
\"
] = 2] =
\"
CHOICE_SELECT
\"
;
\r\n\t
})(OptionState || (OptionState = {}));
\r\n\t
var GameState;
\r\n\t
(function (GameState) {
\r\n\t
GameState[GameState[
\"
STATE_START
\"
] = 0] =
\"
STATE_START
\"
;
\r\n\t
GameState[GameState[
\"
STATE_END
\"
] = 1] =
\"
STATE_END
\"
;
\r\n\t
})(GameState || (GameState = {}));
\r\n\t
//# sourceMappingURL=utils.js.map
\n\n\t
var Background = (function (_super) {
\r\n\t
tslib.__extends(Background, _super);
\r\n\t
function Background() {
\r\n\t
return _super !== null && _super.apply(this, arguments) || this;
\r\n\t
}
\r\n\t
Background.prototype.init = function () {
\r\n\t
this.showSubjectBox();
\r\n\t
this.insideAddEventListener();
\r\n\t
};
\r\n\t
Background.prototype.insideAddEventListener = function () {
\r\n\t
engine.globalEvent.addEventListener('changeCount', this.changeCount, this);
\r\n\t
};
\r\n\t
Background.prototype.showSubjectBox = function () {
\r\n\t
var tmpContainer = new engine.Container();
\r\n\t
tmpContainer.x = 0;
\r\n\t
tmpContainer.y = props.subjectBox_Y;
\r\n\t
this.addChild(tmpContainer);
\r\n\t
var subjectBox = this._subjectBox = new engine.Image(getTextureByName('题目栏'));
\r\n\t
subjectBox.x = (750 - subjectBox.width) / 2;
\r\n\t
subjectBox.y = 0;
\r\n\t
tmpContainer.addChild(subjectBox);
\r\n\t
var countDownBg = this._countDownBg = new engine.Image(getTextureByName('倒计时'));
\r\n\t
countDownBg.x = (750 - countDownBg.width) / 2;
\r\n\t
countDownBg.y = -countDownBg.height / 2 + 10;
\r\n\t
tmpContainer.addChild(countDownBg);
\r\n\t
var answerCountBg = this._answerCountBg = new engine.Image(getTextureByName('答对题数'));
\r\n\t
answerCountBg.x = (750 - answerCountBg.width) / 2;
\r\n\t
answerCountBg.y = subjectBox.y + subjectBox.height - answerCountBg.height - 10;
\r\n\t
tmpContainer.addChild(answerCountBg);
\r\n\t
var answerCountText = this._answerCountText = new engine.Label();
\r\n\t
answerCountText.fillColor = 0x2b3134;
\r\n\t
answerCountText.size = 30;
\r\n\t
answerCountText.width = answerCountBg.width;
\r\n\t
answerCountText.height = answerCountBg.height;
\r\n\t
answerCountText.verticalAlign = engine.VERTICAL_ALIGN.MIDDLE;
\r\n\t
answerCountText.x = 160;
\r\n\t
answerCountText.y = 3;
\r\n\t
answerCountText.text = '0';
\r\n\t
answerCountBg.addChild(answerCountText);
\r\n\t
};
\r\n\t
Background.prototype.changeCount = function (data) {
\r\n\t
this._answerCountText.text = data.data.count + '';
\r\n\t
};
\r\n\t
return Background;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=Background.js.map
\n\n\t
var SvgaManager = (function () {
\r\n\t
function SvgaManager() {
\r\n\t
}
\r\n\t
SvgaManager.createSvga = function (name) {
\r\n\t
var inst = new svga.Svga();
\r\n\t
inst.source = engine.getAssetByName(name).uuid;
\r\n\t
return inst;
\r\n\t
};
\r\n\t
SvgaManager.play = function (svga, callBack) {
\r\n\t
if (!svga) {
\r\n\t
console.log('svga节点出错');
\r\n\t
return;
\r\n\t
}
\r\n\t
svga.gotoAndStop(0);
\r\n\t
svga.play();
\r\n\t
if (callBack) {
\r\n\t
svga.addEventListener(engine.Event.END_FRAME, function () {
\r\n\t
svga.stop();
\r\n\t
callBack();
\r\n\t
svga.removeAllEventListener();
\r\n\t
}, this);
\r\n\t
}
\r\n\t
};
\r\n\t
SvgaManager.stop = function (svga) {
\r\n\t
if (!svga) {
\r\n\t
console.log('svga节点出错');
\r\n\t
return;
\r\n\t
}
\r\n\t
svga.stop();
\r\n\t
};
\r\n\t
return SvgaManager;
\r\n\t
}());
\r\n\t
//# sourceMappingURL=SvgaManager.js.map
\n\n\t
var SubjectTitle = (function (_super) {
\r\n\t
tslib.__extends(SubjectTitle, _super);
\r\n\t
function SubjectTitle() {
\r\n\t
var _this = _super !== null && _super.apply(this, arguments) || this;
\r\n\t
_this._frameCurrAngle = 0;
\r\n\t
_this._frameCount = 0;
\r\n\t
_this._countDownTmp = 0;
\r\n\t
_this._square = new engine.Graphics();
\r\n\t
return _this;
\r\n\t
}
\r\n\t
SubjectTitle.prototype.init = function () {
\r\n\t
this.showSubjectBox();
\r\n\t
this.insideAddEventListener();
\r\n\t
};
\r\n\t
SubjectTitle.prototype.initCountDownSvga = function (tmpNode) {
\r\n\t
var countDownSvga = this._countDownSvga = SvgaManager.createSvga('countdown_321');
\r\n\t
countDownSvga.x = (getStage().width - 120) / 2;
\r\n\t
countDownSvga.y = (getStage().height - 120) / 2;
\r\n\t
countDownSvga.visible = false;
\r\n\t
tmpNode.addChild(countDownSvga);
\r\n\t
};
\r\n\t
SubjectTitle.prototype.insideAddEventListener = function () {
\r\n\t
engine.globalEvent.addEventListener('updateSubjectTitle', this.updateSubjectTitle, this);
\r\n\t
engine.globalEvent.addEventListener('updateAnswerCount', this.updateAnswerCount, this);
\r\n\t
engine.globalEvent.addEventListener('resetTitle', this.reset, this);
\r\n\t
engine.globalEvent.addEventListener('outRest', this.outRest, this);
\r\n\t
};
\r\n\t
SubjectTitle.prototype.showSubjectBox = function () {
\r\n\t
var tmpContainer = new engine.Container();
\r\n\t
tmpContainer.x = 0;
\r\n\t
tmpContainer.y = props.subjectBox_Y;
\r\n\t
this.addChild(tmpContainer);
\r\n\t
var subjectBox = this._subjectTitleBox = new engine.Image(getTextureByName('题目栏'));
\r\n\t
subjectBox.x = (750 - subjectBox.width) / 2;
\r\n\t
subjectBox.y = 0;
\r\n\t
tmpContainer.addChild(subjectBox);
\r\n\t
var countDownBg = this._countDownBg = new engine.Image(getTextureByName('倒计时'));
\r\n\t
countDownBg.x = (750 - countDownBg.width) / 2;
\r\n\t
countDownBg.y = -countDownBg.height / 2 + 10;
\r\n\t
tmpContainer.addChild(countDownBg);
\r\n\t
var bar = this._bar = new engine.Image(getTextureByName('进度条'));
\r\n\t
bar.x = 0;
\r\n\t
bar.y = 0;
\r\n\t
countDownBg.addChild(bar);
\r\n\t
bar.anchorX = bar.width / 2;
\r\n\t
bar.anchorY = bar.height / 2;
\r\n\t
bar.rotation = -90;
\r\n\t
bar.addChild(this._square);
\r\n\t
bar.mask = this._square;
\r\n\t
var answerCountBg = this._answerCountBg = new engine.Image(getTextureByName('答对题数'));
\r\n\t
answerCountBg.x = (750 - answerCountBg.width) / 2;
\r\n\t
answerCountBg.y = subjectBox.y + subjectBox.height - answerCountBg.height - 10;
\r\n\t
tmpContainer.addChild(answerCountBg);
\r\n\t
this.initCountDownBar(0);
\r\n\t
this.initAnswerCountText();
\r\n\t
this.initCountDownText();
\r\n\t
this.initTitleText();
\r\n\t
this.initSvga();
\r\n\t
};
\r\n\t
SubjectTitle.prototype.initCountDownText = function () {
\r\n\t
var countDownText = this._countDownText = new engine.BitmapText();
\r\n\t
countDownText.font = props.fontName;
\r\n\t
countDownText.text = props.countDown;
\r\n\t
this.handleAlign();
\r\n\t
this._countDownBg.addChild(countDownText);
\r\n\t
this._countDownTmp = props.countDown;
\r\n\t
};
\r\n\t
SubjectTitle.prototype.handleAlign = function () {
\r\n\t
this._countDownText.x = (this._countDownBg.width - this._countDownText.width) / 2;
\r\n\t
this._countDownText.y = (this._countDownBg.height - this._countDownText.height) / 2;
\r\n\t
};
\r\n\t
SubjectTitle.prototype.countDownBitmapText = function () {
\r\n\t
};
\r\n\t
SubjectTitle.prototype.initAnswerCountText = function () {
\r\n\t
var answerCountText = this._answerCountText = new engine.Label();
\r\n\t
answerCountText.fillColor = 0x2b3134;
\r\n\t
answerCountText.size = 30;
\r\n\t
answerCountText.width = this._answerCountBg.width;
\r\n\t
answerCountText.height = this._answerCountBg.height;
\r\n\t
answerCountText.verticalAlign = engine.VERTICAL_ALIGN.MIDDLE;
\r\n\t
answerCountText.x = 160;
\r\n\t
answerCountText.y = props.answerCountText_Y;
\r\n\t
answerCountText.text = '0';
\r\n\t
this._answerCountBg.addChild(answerCountText);
\r\n\t
};
\r\n\t
SubjectTitle.prototype.initTitleText = function () {
\r\n\t
var titleLabel = this._titleLabel = new engine.Label();
\r\n\t
titleLabel.fillColor = 0xfffcc6;
\r\n\t
titleLabel.size = 36;
\r\n\t
titleLabel.width = this._subjectTitleBox.width - props.titleText_width;
\r\n\t
titleLabel.height = this._subjectTitleBox.height - props.titleText_height;
\r\n\t
titleLabel.lineType = engine.TEXT_lINETYPE.MULTI;
\r\n\t
titleLabel.verticalAlign = engine.VERTICAL_ALIGN.MIDDLE;
\r\n\t
titleLabel.textAlign = engine.TEXT_ALIGN.CENTER;
\r\n\t
titleLabel.x = props.titleText_X;
\r\n\t
titleLabel.y = props.titleText_Y;
\r\n\t
titleLabel.text = '';
\r\n\t
titleLabel.alpha = 0;
\r\n\t
this._subjectTitleBox.addChild(titleLabel);
\r\n\t
};
\r\n\t
SubjectTitle.prototype.initTitleNumText = function (tmpContainer) {
\r\n\t
var titleNumLabel = this._titleNumLabel = new engine.Label();
\r\n\t
titleNumLabel.fillColor = 0xfffcc6;
\r\n\t
titleNumLabel.size = 48;
\r\n\t
titleNumLabel.width = tmpContainer.width;
\r\n\t
titleNumLabel.height = tmpContainer.heigth;
\r\n\t
titleNumLabel.verticalAlign = engine.VERTICAL_ALIGN.MIDDLE;
\r\n\t
titleNumLabel.textAlign = engine.TEXT_ALIGN.CENTER;
\r\n\t
titleNumLabel.text = '';
\r\n\t
titleNumLabel.visible = false;
\r\n\t
tmpContainer.addChild(titleNumLabel);
\r\n\t
};
\r\n\t
SubjectTitle.prototype.updateTitleNumText = function (curSubJect) {
\r\n\t
this.rest();
\r\n\t
this._titleNumLabel.text =
\"\\
u7B2C
\"
+ curSubJect +
\"\\
u9898
\"
;
\r\n\t
};
\r\n\t
SubjectTitle.prototype.reset = function () {
\r\n\t
this._titleLabel.text = '';
\r\n\t
};
\r\n\t
SubjectTitle.prototype.updateSubjectTitle = function (tmpData) {
\r\n\t
this._titleLabel.alpha = 0;
\r\n\t
this._titleLabel.text = tmpData.data.title;
\r\n\t
this.lastTime = 0;
\r\n\t
this.updateTitleNumText(tmpData.data.curSubJect + 1);
\r\n\t
if (tmpData.data.curSubJect == 0) {
\r\n\t
this.fristAnswer();
\r\n\t
}
\r\n\t
else {
\r\n\t
this.playQuestion_enter();
\r\n\t
}
\r\n\t
};
\r\n\t
SubjectTitle.prototype.updateAnswerCount = function (data) {
\r\n\t
this._answerCountText.text = data.data.count + '';
\r\n\t
};
\r\n\t
SubjectTitle.prototype.updateCountDownText = function (count) {
\r\n\t
this._countDownText.text = count + '';
\r\n\t
this.handleAlign();
\r\n\t
};
\r\n\t
SubjectTitle.prototype.openCountDownBar = function () {
\r\n\t
this.rest();
\r\n\t
engine.gameStage.addEventListener(engine.Event.ENTER_FRAME, this.countDownBar, this);
\r\n\t
};
\r\n\t
SubjectTitle.prototype.initCountDownBar = function (currAngle) {
\r\n\t
var ax = this._bar.width / 2;
\r\n\t
var ay = this._bar.height / 2;
\r\n\t
this._square.clear();
\r\n\t
this._square.beginFill(0);
\r\n\t
this._square.moveTo(ax, ay);
\r\n\t
this._square.arc(ax, ay, this._bar.width / 2, 0, (currAngle * Math.PI / 180));
\r\n\t
this._square.lineTo(ax, ay);
\r\n\t
this._square.endFill();
\r\n\t
};
\r\n\t
SubjectTitle.prototype.countDownBar = function () {
\r\n\t
var now = Date.now();
\r\n\t
var deltaTime = this.lastTime ? now - this.lastTime : 16.7;
\r\n\t
this.lastTime = now;
\r\n\t
this._frameCurrAngle += 360 / (props.countDown * 1000) * deltaTime;
\r\n\t
this._frameCurrAngle = Math.min(360, this._frameCurrAngle);
\r\n\t
this.initCountDownBar(this._frameCurrAngle);
\r\n\t
this._frameCount += deltaTime;
\r\n\t
if (this._frameCount >= 1000) {
\r\n\t
var tmpTime = this._countDownTmp - 1 > 0 ? this._countDownTmp -= 1 : 0;
\r\n\t
if (tmpTime == 3) {
\r\n\t
this.playCountDownSvga();
\r\n\t
}
\r\n\t
this.updateCountDownText(tmpTime);
\r\n\t
this._frameCount = 0;
\r\n\t
if (this._frameCurrAngle >= 360) {
\r\n\t
engine.gameStage.removeEventListener(engine.Event.ENTER_FRAME, this.countDownBar, this);
\r\n\t
engine.globalEvent.dispatchEvent('upDateGameState', { gameState: GameState.STATE_END });
\r\n\t
engine.globalEvent.dispatchEvent('sendAnswer');
\r\n\t
}
\r\n\t
}
\r\n\t
};
\r\n\t
SubjectTitle.prototype.rest = function () {
\r\n\t
this._frameCurrAngle = 0;
\r\n\t
this._frameCount = 0;
\r\n\t
this._square.clear();
\r\n\t
this._countDownTmp = props.countDown;
\r\n\t
this._countDownText.text = props.countDown + '';
\r\n\t
this.handleAlign();
\r\n\t
};
\r\n\t
SubjectTitle.prototype.outRest = function () {
\r\n\t
this._frameCurrAngle = 0;
\r\n\t
this._frameCount = 0;
\r\n\t
this._square.clear();
\r\n\t
this._countDownTmp = props.countDown;
\r\n\t
this._countDownText.text = props.countDown + '';
\r\n\t
this.handleAlign();
\r\n\t
this._readyGo.visible = false;
\r\n\t
this._countDownSvga.visible = false;
\r\n\t
this._questionEnter.visible = false;
\r\n\t
engine.gameStage.removeEventListener(engine.Event.ENTER_FRAME, this.countDownBar, this);
\r\n\t
};
\r\n\t
SubjectTitle.prototype.initSvga = function () {
\r\n\t
var readyGo = this._readyGo = SvgaManager.createSvga('ready_go');
\r\n\t
readyGo.x = 50;
\r\n\t
readyGo.y = 45;
\r\n\t
readyGo.visible = false;
\r\n\t
this._subjectTitleBox.addChild(readyGo);
\r\n\t
var tmpRect = new engine.Rect();
\r\n\t
tmpRect.x = 50;
\r\n\t
tmpRect.y = 45;
\r\n\t
tmpRect.width = 520;
\r\n\t
tmpRect.height = 200;
\r\n\t
this._subjectTitleBox.addChild(tmpRect);
\r\n\t
readyGo.mask = tmpRect;
\r\n\t
var tmpContainer = new engine.Container();
\r\n\t
tmpContainer.width = 400;
\r\n\t
tmpContainer.height = 100;
\r\n\t
tmpContainer.x = (this._subjectTitleBox.width - 400) / 2;
\r\n\t
tmpContainer.y = 115;
\r\n\t
this._subjectTitleBox.addChild(tmpContainer);
\r\n\t
var questionEnter = this._questionEnter = SvgaManager.createSvga('question_enter');
\r\n\t
questionEnter.x = 0;
\r\n\t
questionEnter.y = 0;
\r\n\t
questionEnter.visible = false;
\r\n\t
tmpContainer.addChild(questionEnter);
\r\n\t
this.initTitleNumText(tmpContainer);
\r\n\t
};
\r\n\t
SubjectTitle.prototype.fristAnswer = function () {
\r\n\t
this.playReadyGo();
\r\n\t
};
\r\n\t
SubjectTitle.prototype.playReadyGo = function () {
\r\n\t
var _this = this;
\r\n\t
this._readyGo.visible = true;
\r\n\t
SvgaManager.play(this._readyGo, function () {
\r\n\t
_this._readyGo.visible = false;
\r\n\t
_this.playQuestion_enter();
\r\n\t
});
\r\n\t
};
\r\n\t
SubjectTitle.prototype.playQuestion_enter = function () {
\r\n\t
var _this = this;
\r\n\t
this._questionEnter.visible = true;
\r\n\t
this._titleNumLabel.visible = true;
\r\n\t
SvgaManager.play(this._questionEnter, function () {
\r\n\t
_this._questionEnter.visible = false;
\r\n\t
_this.playTweenTitle();
\r\n\t
_this._titleNumLabel.visible = false;
\r\n\t
_this.openCountDownBar();
\r\n\t
if (_this._countDownTmp == 3) {
\r\n\t
_this.playCountDownSvga();
\r\n\t
}
\r\n\t
engine.globalEvent.dispatchEvent('start');
\r\n\t
});
\r\n\t
};
\r\n\t
SubjectTitle.prototype.playTweenTitle = function () {
\r\n\t
var _this = this;
\r\n\t
engine.Tween.get(this._titleLabel, { loop: false })
\r\n\t
.set({ alpha: 0 })
\r\n\t
.to({ alpha: 1 }, 500, engine.Ease.cubicIn)
\r\n\t
.call(function () {
\r\n\t
engine.Tween.removeTweens(_this._titleLabel);
\r\n\t
});
\r\n\t
};
\r\n\t
SubjectTitle.prototype.playCountDownSvga = function () {
\r\n\t
var _this = this;
\r\n\t
console.log('测试次数');
\r\n\t
this._countDownSvga.visible = true;
\r\n\t
this._countDownSvga.lockStep = true;
\r\n\t
SvgaManager.play(this._countDownSvga, function () {
\r\n\t
_this._countDownSvga.visible = false;
\r\n\t
});
\r\n\t
};
\r\n\t
return SubjectTitle;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=SubjectTitle.js.map
\n\n\t
var AnswerArea = (function (_super) {
\r\n\t
tslib.__extends(AnswerArea, _super);
\r\n\t
function AnswerArea() {
\r\n\t
var _this = _super !== null && _super.apply(this, arguments) || this;
\r\n\t
_this._optionArray = [];
\r\n\t
_this._choiceWrong = [];
\r\n\t
_this._choiceRight = [];
\r\n\t
_this._choiceSelect = [];
\r\n\t
_this._answerArray = ['A', 'B', 'C', 'D'];
\r\n\t
_this._answer = -1;
\r\n\t
_this._svgaArrayName = [];
\r\n\t
return _this;
\r\n\t
}
\r\n\t
AnswerArea.prototype.init = function () {
\r\n\t
var area = this._area = new engine.Container();
\r\n\t
area.x = 0;
\r\n\t
area.y = 0;
\r\n\t
this._gameState = GameState.STATE_END;
\r\n\t
this.addChild(area);
\r\n\t
this.initSvgaArray();
\r\n\t
this.initAnswerOption();
\r\n\t
this.initPeople();
\r\n\t
this.insideAddEventListener();
\r\n\t
};
\r\n\t
AnswerArea.prototype.initSvgaArray = function () {
\r\n\t
this.setSvgaName('rian_mona', 'rian_weather');
\r\n\t
this.setSvgaName('snow_mona', 'snow_weather');
\r\n\t
this.setSvgaName('thunder_mona', 'thunder_weather');
\r\n\t
this.setSvgaName('wind_mona', 'wind_weather');
\r\n\t
};
\r\n\t
AnswerArea.prototype.setSvgaName = function (peopleName, scene) {
\r\n\t
var tmpSvgaName = {};
\r\n\t
tmpSvgaName.people = peopleName;
\r\n\t
tmpSvgaName.scene = scene;
\r\n\t
this._svgaArrayName.push(tmpSvgaName);
\r\n\t
};
\r\n\t
AnswerArea.prototype.insideAddEventListener = function () {
\r\n\t
engine.globalEvent.addEventListener('updateOption', this.updateOption, this);
\r\n\t
engine.globalEvent.addEventListener('handleAnswerOption', this.handleAnswerOption, this);
\r\n\t
engine.globalEvent.addEventListener('upDateGameState', this.upDateGameState, this);
\r\n\t
engine.globalEvent.addEventListener('start', this.start, this);
\r\n\t
engine.globalEvent.addEventListener('sendAnswer', this.sendAnswer, this);
\r\n\t
engine.globalEvent.addEventListener('outRest', this.rest, this);
\r\n\t
};
\r\n\t
AnswerArea.prototype.initPeople = function () {
\r\n\t
var people = this._people = SvgaManager.createSvga('mona_walk');
\r\n\t
people.x = props.people_X;
\r\n\t
people.y = props.people_Y;
\r\n\t
this._area.addChild(people);
\r\n\t
SvgaManager.play(people);
\r\n\t
var mona_confuse = this._mona_confuse = SvgaManager.createSvga('mona_confuse');
\r\n\t
mona_confuse.x = props.people_X;
\r\n\t
mona_confuse.y = props.people_Y;
\r\n\t
mona_confuse.visible = false;
\r\n\t
this._area.addChild(mona_confuse);
\r\n\t
};
\r\n\t
AnswerArea.prototype.getArea = function () {
\r\n\t
return this._area;
\r\n\t
};
\r\n\t
AnswerArea.prototype.initAnswerOption = function () {
\r\n\t
var optionA = this._optionA = new engine.Image(getTextureByName('选区'));
\r\n\t
optionA.x = (750 - (optionA.width * 2 + 30)) / 2;
\r\n\t
optionA.y = props.answerArea_Y;
\r\n\t
optionA.name = 'A';
\r\n\t
optionA.alpha = 0;
\r\n\t
this._area.addChild(optionA);
\r\n\t
this._optionArray.push(optionA);
\r\n\t
var optionB = this._optionB = new engine.Image(getTextureByName('选区'));
\r\n\t
optionB.x = optionA.x + optionA.width + 30;
\r\n\t
optionB.y = optionA.y;
\r\n\t
optionB.name = 'B';
\r\n\t
optionB.alpha = 0;
\r\n\t
this._area.addChild(optionB);
\r\n\t
this._optionArray.push(optionB);
\r\n\t
var optionC = this._optionC = new engine.Image(getTextureByName('选区'));
\r\n\t
optionC.x = optionA.x;
\r\n\t
optionC.y = optionA.y + optionA.height + props.option_spaceY;
\r\n\t
optionC.name = 'C';
\r\n\t
optionC.alpha = 0;
\r\n\t
this._area.addChild(optionC);
\r\n\t
this._optionArray.push(optionC);
\r\n\t
var optionD = this._optionD = new engine.Image(getTextureByName('选区'));
\r\n\t
optionD.x = optionB.x;
\r\n\t
optionD.y = optionC.y;
\r\n\t
optionD.name = 'D';
\r\n\t
optionD.alpha = 0;
\r\n\t
this._area.addChild(optionD);
\r\n\t
this._optionArray.push(optionD);
\r\n\t
this.initOptionState();
\r\n\t
this.initAddEventListener();
\r\n\t
this.initSvga(optionA);
\r\n\t
this.initSvga(optionB);
\r\n\t
this.initSvga(optionC);
\r\n\t
this.initSvga(optionD);
\r\n\t
};
\r\n\t
AnswerArea.prototype.initSvga = function (tmpNode) {
\r\n\t
this.initSvgaNode('right_mona', tmpNode);
\r\n\t
for (var index = 0; index < this._svgaArrayName.length; index++) {
\r\n\t
var element = this._svgaArrayName[index];
\r\n\t
this.initSvgaNode(element.people, tmpNode);
\r\n\t
this.initSvgaNode(element.scene, tmpNode);
\r\n\t
}
\r\n\t
};
\r\n\t
AnswerArea.prototype.initSvgaNode = function (svgaName, tmpNode) {
\r\n\t
var tmpSvga = SvgaManager.createSvga(svgaName);
\r\n\t
tmpSvga.x = -30;
\r\n\t
tmpSvga.y = -105;
\r\n\t
tmpSvga.visible = false;
\r\n\t
tmpSvga.name = svgaName;
\r\n\t
tmpNode.addChild(tmpSvga);
\r\n\t
};
\r\n\t
AnswerArea.prototype.initAddEventListener = function () {
\r\n\t
for (var index = 0; index < this._optionArray.length; index++) {
\r\n\t
var element = this._optionArray[index];
\r\n\t
element.addEventListener(engine.MouseEvent.CLICK, this.selectOption, this);
\r\n\t
}
\r\n\t
};
\r\n\t
AnswerArea.prototype.optionLabel = function (parent) {
\r\n\t
var answerText = new engine.Label();
\r\n\t
answerText.fillColor = 0x164b81;
\r\n\t
answerText.bold = true;
\r\n\t
answerText.size = 30;
\r\n\t
answerText.width = parent.width;
\r\n\t
answerText.height = parent.height;
\r\n\t
answerText.textAlign = engine.TEXT_ALIGN.CENTER;
\r\n\t
answerText.x = 0;
\r\n\t
answerText.y = 0.75 * answerText.height;
\r\n\t
answerText.text = '';
\r\n\t
answerText.name = 'answerText';
\r\n\t
return answerText;
\r\n\t
};
\r\n\t
AnswerArea.prototype.initOptionState = function () {
\r\n\t
for (var i = 0; i < this._optionArray.length; i++) {
\r\n\t
var tmpNode = this._optionArray[i];
\r\n\t
tmpNode.addChild(this.getChoiceStateImg('选中', OptionState.CHOICE_SELECT, tmpNode.name));
\r\n\t
tmpNode.addChild(this.getChoiceStateImg('选错', OptionState.CHOICE_WRONG, tmpNode.name));
\r\n\t
tmpNode.addChild(this.getChoiceStateImg('选对', OptionState.CHOICE_RIGHT, tmpNode.name));
\r\n\t
tmpNode.addChild(this.optionLabel(tmpNode));
\r\n\t
}
\r\n\t
};
\r\n\t
AnswerArea.prototype.getChoiceStateImg = function (imgName, imgType, imgAnswer) {
\r\n\t
var choiceImage = new engine.Image(getTextureByName(imgName));
\r\n\t
choiceImage.x = 0;
\r\n\t
choiceImage.y = 0;
\r\n\t
choiceImage['type'] = imgType;
\r\n\t
choiceImage['imgAnswer'] = imgAnswer;
\r\n\t
choiceImage.visible = false;
\r\n\t
switch (imgType) {
\r\n\t
case OptionState.CHOICE_WRONG:
\r\n\t
this._choiceWrong.push(choiceImage);
\r\n\t
break;
\r\n\t
case OptionState.CHOICE_RIGHT:
\r\n\t
this._choiceRight.push(choiceImage);
\r\n\t
break;
\r\n\t
case OptionState.CHOICE_SELECT:
\r\n\t
this._choiceSelect.push(choiceImage);
\r\n\t
break;
\r\n\t
}
\r\n\t
return choiceImage;
\r\n\t
};
\r\n\t
AnswerArea.prototype.selectOption = function (event) {
\r\n\t
if (this._gameState != GameState.STATE_START || this._svgaPlayState == GameState.STATE_START) {
\r\n\t
console.log('暂时不能答题');
\r\n\t
return;
\r\n\t
}
\r\n\t
this._gameState = GameState.STATE_END;
\r\n\t
this.handleSelect(event.target.name);
\r\n\t
this.peopleMove(event.target.x - 30, event.target.y - 110, false);
\r\n\t
this._answer = this._answerArray.indexOf(event.target.name);
\r\n\t
console.log('点击选择选项', event.target.name, this._answer);
\r\n\t
};
\r\n\t
AnswerArea.prototype.peopleMove = function (moveX, moveY, isPlaySVGA) {
\r\n\t
var _this = this;
\r\n\t
var tmpX = moveX;
\r\n\t
var tmpY = moveY;
\r\n\t
engine.Tween.get(this._people, { loop: false })
\r\n\t
.to({ x: tmpX, y: tmpY }, 500, engine.Ease.cubicInOut)
\r\n\t
.call(function () {
\r\n\t
_this._gameState = GameState.STATE_START;
\r\n\t
if (isPlaySVGA) {
\r\n\t
SvgaManager.play(_this._people);
\r\n\t
engine.globalEvent.dispatchEvent('updateSubject');
\r\n\t
}
\r\n\t
});
\r\n\t
};
\r\n\t
AnswerArea.prototype.rest = function () {
\r\n\t
this._answer = -1;
\r\n\t
if (this._right_mona) {
\r\n\t
SvgaManager.stop(this._right_mona);
\r\n\t
this._right_mona.visible = false;
\r\n\t
}
\r\n\t
this._people.visible = true;
\r\n\t
this._mona_confuse.visible = false;
\r\n\t
this.peopleMove(props.people_X, props.people_Y, true);
\r\n\t
this.handleRight();
\r\n\t
this.handleWrong();
\r\n\t
this.handleSelect();
\r\n\t
this.optionsShow(false);
\r\n\t
engine.globalEvent.dispatchEvent('resetTitle');
\r\n\t
};
\r\n\t
AnswerArea.prototype.optionsShow = function (isShow) {
\r\n\t
for (var index = 0; index < this._optionArray.length; index++) {
\r\n\t
var element = this._optionArray[index];
\r\n\t
var tmpAlpha = isShow ? 1 : 0;
\r\n\t
this.optionIsShowTween(element, tmpAlpha);
\r\n\t
}
\r\n\t
};
\r\n\t
AnswerArea.prototype.optionIsShowTween = function (tweenNode, tmpAlpha) {
\r\n\t
engine.Tween.get(tweenNode, { loop: false })
\r\n\t
.to({ alpha: tmpAlpha }, 500);
\r\n\t
};
\r\n\t
AnswerArea.prototype.handleSelect = function (select) {
\r\n\t
for (var index = 0; index < this._choiceSelect.length; index++) {
\r\n\t
var element = this._choiceSelect[index];
\r\n\t
if (!select) {
\r\n\t
element.visible = false;
\r\n\t
continue;
\r\n\t
}
\r\n\t
if (element['imgAnswer'] === select) {
\r\n\t
element.visible = true;
\r\n\t
continue;
\r\n\t
}
\r\n\t
element.visible = false;
\r\n\t
}
\r\n\t
};
\r\n\t
AnswerArea.prototype.handleRight = function (select) {
\r\n\t
if (select === void 0) { select = ''; }
\r\n\t
for (var index = 0; index < this._choiceRight.length; index++) {
\r\n\t
var element = this._choiceRight[index];
\r\n\t
if (select == '') {
\r\n\t
element.visible = false;
\r\n\t
continue;
\r\n\t
}
\r\n\t
if (element['imgAnswer'] === select) {
\r\n\t
element.visible = true;
\r\n\t
continue;
\r\n\t
}
\r\n\t
element.visible = false;
\r\n\t
}
\r\n\t
};
\r\n\t
AnswerArea.prototype.handleWrong = function (select) {
\r\n\t
var count = 0;
\r\n\t
for (var index = 0; index < this._choiceWrong.length; index++) {
\r\n\t
var element = this._choiceWrong[index];
\r\n\t
if (!select) {
\r\n\t
element.visible = false;
\r\n\t
this.hideSvga(element);
\r\n\t
continue;
\r\n\t
}
\r\n\t
if (element['imgAnswer'] == select) {
\r\n\t
element.visible = false;
\r\n\t
continue;
\r\n\t
}
\r\n\t
count++;
\r\n\t
element.visible = true;
\r\n\t
this.playWrongTween(element, (count == this._choiceWrong.length - 1));
\r\n\t
}
\r\n\t
};
\r\n\t
AnswerArea.prototype.hideSvga = function (svgaNode) {
\r\n\t
svgaNode.parent.children.forEach(function (element) {
\r\n\t
if (element._instanceType == 'MovieClip') {
\r\n\t
element.visible = false;
\r\n\t
}
\r\n\t
});
\r\n\t
};
\r\n\t
AnswerArea.prototype.playWrongTween = function (tweenNode, isLast) {
\r\n\t
var _this = this;
\r\n\t
engine.Tween.get(tweenNode, { loop: false })
\r\n\t
.wait(460)
\r\n\t
.to({ alpha: 0.3 }, 160, engine.Ease.circInOut)
\r\n\t
.to({ alpha: 1 }, 160, engine.Ease.circInOut)
\r\n\t
.to({ alpha: 0.3 }, 160, engine.Ease.circInOut)
\r\n\t
.to({ alpha: 1 }, 160, engine.Ease.circInOut)
\r\n\t
.call(function () {
\r\n\t
engine.Tween.removeTweens(tweenNode);
\r\n\t
if (isLast) {
\r\n\t
if (_this._answer >= 0) {
\r\n\t
_this._people.visible = false;
\r\n\t
_this.handleSeceltRight();
\r\n\t
_this.handleSeceltError();
\r\n\t
}
\r\n\t
else {
\r\n\t
_this._people.visible = false;
\r\n\t
_this._mona_confuse.visible = true;
\r\n\t
SvgaManager.play(_this._mona_confuse, function () {
\r\n\t
_this.rest();
\r\n\t
});
\r\n\t
}
\r\n\t
}
\r\n\t
});
\r\n\t
};
\r\n\t
AnswerArea.prototype.playResultSvga = function (svgaNode, isLast, isShowPeople) {
\r\n\t
var _this = this;
\r\n\t
var svgaData = this._svgaArrayName[this._randomSvga - 1];
\r\n\t
if (isShowPeople) {
\r\n\t
var peopleNode = this.getSvgaNode(svgaNode, svgaData.people);
\r\n\t
this.playSvga(peopleNode);
\r\n\t
}
\r\n\t
var sceneNode = this.getSvgaNode(svgaNode, svgaData.scene);
\r\n\t
this.playSvga(sceneNode, function () {
\r\n\t
if (isLast)
\r\n\t
_this.rest();
\r\n\t
});
\r\n\t
};
\r\n\t
AnswerArea.prototype.getSvgaNode = function (svgaNode, svgaName) {
\r\n\t
var tmp = svgaNode.getChildByName(svgaName);
\r\n\t
if (!tmp) {
\r\n\t
console.log('svga节点未找到');
\r\n\t
return;
\r\n\t
}
\r\n\t
return tmp;
\r\n\t
};
\r\n\t
AnswerArea.prototype.playSvga = function (svgaNode, callBack) {
\r\n\t
svgaNode.visible = true;
\r\n\t
SvgaManager.play(svgaNode, function () {
\r\n\t
svgaNode.visible = false;
\r\n\t
if (callBack)
\r\n\t
callBack();
\r\n\t
});
\r\n\t
};
\r\n\t
AnswerArea.prototype.updateOption = function (optionData) {
\r\n\t
this._randomSvga = Math.floor(Math.random() * (this._svgaArrayName.length) + 1);
\r\n\t
var tmpOptionData = optionData.data.options;
\r\n\t
for (var index = 0; index < tmpOptionData.length; index++) {
\r\n\t
var element = tmpOptionData[index];
\r\n\t
this._optionArray[index].getChildByName('answerText').text = element;
\r\n\t
}
\r\n\t
};
\r\n\t
AnswerArea.prototype.handleAnswerOption = function (result) {
\r\n\t
this._people.gotoAndStop(1);
\r\n\t
var trueAnswer = this._trueAnswer = result.data.state;
\r\n\t
this.handleRight(this._answerArray[trueAnswer]);
\r\n\t
this.handleWrong(this._answerArray[trueAnswer]);
\r\n\t
this.handleSelect();
\r\n\t
this._svgaPlayState = GameState.STATE_START;
\r\n\t
};
\r\n\t
AnswerArea.prototype.handleSeceltRight = function () {
\r\n\t
for (var index = 0; index < this._optionArray.length; index++) {
\r\n\t
var element = this._optionArray[index];
\r\n\t
if (element.name == this._answerArray[this._answer] && this._trueAnswer == this._answer) {
\r\n\t
this._right_mona = this.getSvgaNode(element, 'right_mona');
\r\n\t
if (this._right_mona) {
\r\n\t
this._right_mona.visible = true;
\r\n\t
SvgaManager.play(this._right_mona);
\r\n\t
}
\r\n\t
}
\r\n\t
}
\r\n\t
};
\r\n\t
AnswerArea.prototype.handleSeceltError = function () {
\r\n\t
var tmpNum = 0;
\r\n\t
for (var index = 0; index < this._optionArray.length; index++) {
\r\n\t
var element = this._optionArray[index];
\r\n\t
if (element.name != this._answerArray[this._trueAnswer]) {
\r\n\t
tmpNum++;
\r\n\t
var isShowPeople = false;
\r\n\t
if (element.name == this._answerArray[this._answer]) {
\r\n\t
isShowPeople = true;
\r\n\t
}
\r\n\t
this.playResultSvga(element, (tmpNum == 3), isShowPeople);
\r\n\t
}
\r\n\t
}
\r\n\t
};
\r\n\t
AnswerArea.prototype.upDateGameState = function (gameState) {
\r\n\t
this._gameState = gameState.data.gameState;
\r\n\t
};
\r\n\t
AnswerArea.prototype.start = function () {
\r\n\t
this.optionsShow(true);
\r\n\t
this._gameState = GameState.STATE_START;
\r\n\t
this._svgaPlayState = GameState.STATE_END;
\r\n\t
};
\r\n\t
AnswerArea.prototype.sendAnswer = function () {
\r\n\t
engine.globalEvent.dispatchEvent('sendAnswerResult', { answer: this._answer });
\r\n\t
};
\r\n\t
return AnswerArea;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=answerArea.js.map
\n\n\t
var GameView = (function (_super) {
\r\n\t
tslib.__extends(GameView, _super);
\r\n\t
function GameView() {
\r\n\t
return _super.call(this) || this;
\r\n\t
}
\r\n\t
GameView.prototype.setup = function () {
\r\n\t
if (this._hasSetup) {
\r\n\t
return;
\r\n\t
}
\r\n\t
this._hasSetup = true;
\r\n\t
var backgroud = this._backgroud = new Background();
\r\n\t
this.addChild(backgroud);
\r\n\t
backgroud.init();
\r\n\t
var subject = this._subject = new SubjectTitle();
\r\n\t
this.addChild(subject);
\r\n\t
subject.init();
\r\n\t
var answerArea = this._answerArea = new AnswerArea();
\r\n\t
this.addChild(answerArea);
\r\n\t
answerArea.init();
\r\n\t
var tmpContainer = new engine.Container();
\r\n\t
this.addChildAt(tmpContainer, 50);
\r\n\t
subject.initCountDownSvga(tmpContainer);
\r\n\t
var subjectManager = this._subjectManager = new SubjectManager();
\r\n\t
subjectManager.init();
\r\n\t
};
\r\n\t
GameView.prototype.start = function () {
\r\n\t
return tslib.__awaiter(this, void 0, void 0, function () {
\r\n\t
return tslib.__generator(this, function (_a) {
\r\n\t
this.setup();
\r\n\t
return [2];
\r\n\t
});
\r\n\t
});
\r\n\t
};
\r\n\t
return GameView;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=GameView.js.map
\n\n\t
var GameWrapper = (function (_super) {
\r\n\t
tslib.__extends(GameWrapper, _super);
\r\n\t
function GameWrapper() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
engine.globalEvent.addEventListener('answer-game-start', _this.start, _this);
\r\n\t
engine.globalEvent.addEventListener('answer-game-subject', _this.initSubject, _this);
\r\n\t
engine.globalEvent.addEventListener('answer-game-result', _this.result, _this);
\r\n\t
_this.visibilitychange();
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameWrapper.prototype.start = function (event) {
\r\n\t
if (event.data.countDown) {
\r\n\t
props.countDown = event.data.countDown;
\r\n\t
}
\r\n\t
if (!this._gameView) {
\r\n\t
var gameView = this._gameView = new GameView();
\r\n\t
this.addChild(gameView);
\r\n\t
this._gameView.start();
\r\n\t
}
\r\n\t
engine.globalEvent.dispatchEvent('reset');
\r\n\t
};
\r\n\t
GameWrapper.prototype.initSubject = function (event) {
\r\n\t
var subjectData = event.data.subjectData;
\r\n\t
engine.globalEvent.dispatchEvent('handleOption', subjectData);
\r\n\t
};
\r\n\t
GameWrapper.prototype.result = function (event) {
\r\n\t
var result = event.data.result;
\r\n\t
engine.globalEvent.dispatchEvent('handleResult', { result: result });
\r\n\t
};
\r\n\t
GameWrapper.prototype.visibilitychange = function () {
\r\n\t
document.addEventListener('visibilitychange', function () {
\r\n\t
if (document.visibilityState === 'hidden') {
\r\n\t
console.log('放置后台');
\r\n\t
engine.globalEvent.dispatchEvent('outRest');
\r\n\t
engine.globalEvent.dispatchEvent('answer-game-visibilitychange', { hidden: true });
\r\n\t
}
\r\n\t
});
\r\n\t
};
\r\n\t
return GameWrapper;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=GameWrapper.js.map
\n\n\t
function index (props) {
\r\n\t
prepareProps();
\r\n\t
injectProps(props);
\r\n\t
var instance = new GameWrapper();
\r\n\t
return instance;
\r\n\t
}
\r\n\t
//# sourceMappingURL=index.js.map
\n\n\t
return index;
\n\n
})));
\n
"
}
dist/customs/jiugong-turntable.json
0 → 100644
View file @
81e5868b
{
"name"
:
"九宫格抽奖"
,
"desc"
:
"九宫格抽奖模块"
,
"props"
:
{
"horizontal"
:
{
"alias"
:
"横向间距"
,
"type"
:
"number"
,
"default"
:
1
},
"vertical"
:
{
"alias"
:
"纵向间距"
,
"type"
:
"number"
,
"default"
:
1
},
"circleNumber"
:
{
"alias"
:
"至少转的圈数"
,
"type"
:
"number"
,
"default"
:
3
},
"tweenTime"
:
{
"alias"
:
"单个奖品节点动画时间(毫秒)"
,
"type"
:
"number"
,
"default"
:
200
},
"slowTweenTime"
:
{
"alias"
:
"中奖后缓速递增时长"
,
"type"
:
"number"
,
"default"
:
200
},
"icon_width"
:
{
"alias"
:
"奖品图宽度"
,
"type"
:
"number"
,
"default"
:
110
},
"icon_height"
:
{
"alias"
:
"奖品图高度"
,
"type"
:
"number"
,
"default"
:
110
},
"icon_X"
:
{
"alias"
:
"奖品X轴偏移量(底框背景有透明)"
,
"type"
:
"number"
,
"default"
:
0
},
"icon_Y"
:
{
"alias"
:
"奖品Y轴偏移量(底框背景有透明)"
,
"type"
:
"number"
,
"default"
:
-20
}
},
"assets"
:
[
{
"name"
:
"unchecked"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/3351a20f982fea1fbcbbb3b85bc03f6b547c8bbc.png"
,
"uuid"
:
"48dc9c00-92c3-4926-8d6b-9eb3e0d0668d"
,
"ext"
:
".png"
},
{
"name"
:
"checked"
,
"url"
:
" //yun.duiba.com.cn/aurora/assets/2a9f9ecc43eb912db553fa4685c1987a937f0198.png"
,
"uuid"
:
"1d7bc84d-689d-4a6a-a023-e4a7b9659083"
,
"ext"
:
".png"
}
],
"events"
:
{
"in"
:
{
"jiugong-turntable-init"
:
{
"alias"
:
"初始化"
,
"data"
:
{}
},
"jiugong-turntable-start"
:
{
"alias"
:
"开始"
,
"data"
:
{}
},
"jiugong-turntable-winPrize"
:
{
"alias"
:
"中奖"
,
"data"
:
{}
},
"jiugong-turntable-abnormal"
:
{
"alias"
:
"异常"
,
"data"
:
{}
},
"jiugong-turntable-reset"
:
{
"alias"
:
"重置"
,
"data"
:
{}
}
},
"out"
:
{
"jiugong-turntable-over"
:
{
"alias"
:
"结束"
,
"data"
:
{}
}
}
},
"id"
:
"jiugong-turntable"
,
"code"
:
"(function (global, factory) {
\n\t
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :
\n\t
typeof define === 'function' && define.amd ? define(['tslib'], factory) :
\n\t
(global = global || self, global['jiugong-turntable'] = factory(global.tslib));
\n
}(this, (function (tslib) { 'use strict';
\n\n\t
function getTexture(uuid) {
\r\n\t
return engine.Texture.from(getAssetByUUID(uuid).uuid);
\r\n\t
}
\r\n\t
function getTextureByName(name) {
\r\n\t
return getTexture(engine.getAssetByName(name).uuid);
\r\n\t
}
\r\n\t
//# sourceMappingURL=utils.js.map
\n\n\t
var props = {};
\r\n\t
function prepareProps() {
\r\n\t
var metaProps = getProps();
\r\n\t
engine.injectProp(props, metaProps);
\r\n\t
}
\r\n\t
function injectProps(p) {
\r\n\t
engine.injectProp(props, p);
\r\n\t
}
\r\n\t
//# sourceMappingURL=props.js.map
\n\n\t
var Turntable = (function (_super) {
\r\n\t
tslib.__extends(Turntable, _super);
\r\n\t
function Turntable(res) {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this._vertical_Y = props.vertical || 20;
\r\n\t
_this._horizontal_X = props.horizontal || 20;
\r\n\t
_this._prizeIndex = 0;
\r\n\t
_this._boxArray = [];
\r\n\t
_this._boxIndex = 0;
\r\n\t
_this.tweenTime = props.tweenTime || 200;
\r\n\t
_this.slowTweenTime = props.slowTweenTime || 200;
\r\n\t
_this.circleNumber = 0;
\r\n\t
_this.turntableOrder = [1, 2, 3, 5, 8, 7, 6, 4];
\r\n\t
_this.recordID = -1;
\r\n\t
_this.boxPrizeIndex = -1;
\r\n\t
_this.slowDown = false;
\r\n\t
_this.isStop = false;
\r\n\t
_this.initTurntable(res);
\r\n\t
_this.setNodeOrder();
\r\n\t
return _this;
\r\n\t
}
\r\n\t
Turntable.prototype.initTurntable = function (res) {
\r\n\t
var turnTableNode = this._turnTableNode = new engine.Container();
\r\n\t
this.addChild(turnTableNode);
\r\n\t
for (var index_Y = 0; index_Y < 3; index_Y++) {
\r\n\t
var _loop_1 = function (index_X) {
\r\n\t
if (index_X == 1 && index_Y == 1)
\r\n\t
return
\"
continue
\"
;
\r\n\t
var tmpNode = new engine.Container();
\r\n\t
var unchecked = this_1.getImage('unchecked', 1);
\r\n\t
var checked = this_1.getImage('checked', 0);
\r\n\t
tmpNode.width = Math.max(unchecked.width, checked.width);
\r\n\t
this_1._singleNodeWidth = this_1._singleNodeWidth ? this_1._singleNodeWidth : tmpNode.width;
\r\n\t
tmpNode.height = Math.max(unchecked.height, checked.height);
\r\n\t
tmpNode.x = index_X * (tmpNode.width + this_1._horizontal_X);
\r\n\t
tmpNode.y = index_Y * (tmpNode.height + this_1._vertical_Y);
\r\n\t
tmpNode.addChild(unchecked);
\r\n\t
tmpNode.addChild(checked);
\r\n\t
turnTableNode.addChild(tmpNode);
\r\n\t
var tmpTexture = engine.Texture.fromImage(res[this_1._prizeIndex].img, undefined);
\r\n\t
var prizeID = res[this_1._prizeIndex].id;
\r\n\t
tmpTexture.addEventListener('loaded', function () {
\r\n\t
var prize = new engine.Sprite(tmpTexture);
\r\n\t
prize.width = props.icon_width;
\r\n\t
prize.height = props.icon_height;
\r\n\t
prize.x = (tmpNode.width - prize.width) / 2 + props.icon_X;
\r\n\t
prize.y = (tmpNode.height - prize.height) / 2 + props.icon_Y;
\r\n\t
tmpNode.prizeID = prizeID;
\r\n\t
tmpNode.addChild(prize);
\r\n\t
}, this_1);
\r\n\t
this_1._prizeIndex++;
\r\n\t
this_1._boxArray.push(tmpNode);
\r\n\t
};
\r\n\t
var this_1 = this;
\r\n\t
for (var index_X = 0; index_X < 3; index_X++) {
\r\n\t
_loop_1(index_X);
\r\n\t
}
\r\n\t
}
\r\n\t
turnTableNode.x = (750 - (this._singleNodeWidth * 3 + this._horizontal_X * 2)) / 2;
\r\n\t
};
\r\n\t
Turntable.prototype.setNodeOrder = function () {
\r\n\t
var tmpNodeArray = [];
\r\n\t
for (var index = 0; index < this.turntableOrder.length; index++) {
\r\n\t
var order = this.turntableOrder[index];
\r\n\t
tmpNodeArray.push(this._boxArray[order - 1]);
\r\n\t
}
\r\n\t
this._boxArray = tmpNodeArray;
\r\n\t
};
\r\n\t
Turntable.prototype.getImage = function (resName, alpha) {
\r\n\t
var tmpImage = new engine.Sprite(getTextureByName(resName));
\r\n\t
tmpImage.x = 0;
\r\n\t
tmpImage.y = 0;
\r\n\t
tmpImage.alpha = alpha;
\r\n\t
tmpImage.name = resName;
\r\n\t
return tmpImage;
\r\n\t
};
\r\n\t
Turntable.prototype.startDraw = function () {
\r\n\t
var _this = this;
\r\n\t
var tmpCheckNode = this._boxArray[this._boxIndex].getChildByName('checked');
\r\n\t
if (this.isStop) {
\r\n\t
engine.Tween.removeTweens(tmpCheckNode);
\r\n\t
return;
\r\n\t
}
\r\n\t
if (this.slowDown) {
\r\n\t
if (this._boxIndex != this.getNodeIndexOFprize()) {
\r\n\t
this.tweenTime += this.slowTweenTime;
\r\n\t
}
\r\n\t
else {
\r\n\t
this.isStop = true;
\r\n\t
this.twinkle(tmpCheckNode);
\r\n\t
}
\r\n\t
}
\r\n\t
engine.Tween.get(tmpCheckNode)
\r\n\t
.to({ alpha: 1 }, this.tweenTime / 2)
\r\n\t
.to({ alpha: 0 }, this.tweenTime / 2)
\r\n\t
.call(function () {
\r\n\t
if (_this.circleNumber >= props.circleNumber && _this.getSlowStart() == _this._boxIndex) {
\r\n\t
_this.slowDown = true;
\r\n\t
}
\r\n\t
_this._boxIndex++;
\r\n\t
if (_this._boxIndex >= _this._boxArray.length) {
\r\n\t
_this._boxIndex = 0;
\r\n\t
_this.circleNumber++;
\r\n\t
}
\r\n\t
_this.startDraw();
\r\n\t
});
\r\n\t
};
\r\n\t
Turntable.prototype.getSlowStart = function () {
\r\n\t
if (this.recordID < 0)
\r\n\t
return -1;
\r\n\t
var tmpIndex = this.getNodeIndexOFprize();
\r\n\t
if (tmpIndex < 4) {
\r\n\t
return tmpIndex + 4;
\r\n\t
}
\r\n\t
else {
\r\n\t
return tmpIndex - 4;
\r\n\t
}
\r\n\t
};
\r\n\t
Turntable.prototype.getNodeIndexOFprize = function () {
\r\n\t
if (this.recordID < 0)
\r\n\t
return -1;
\r\n\t
for (var index = 0; index < this._boxArray.length; index++) {
\r\n\t
var element = this._boxArray[index];
\r\n\t
if (element.prizeID === this.recordID) {
\r\n\t
return index;
\r\n\t
}
\r\n\t
}
\r\n\t
return -1;
\r\n\t
};
\r\n\t
Turntable.prototype.twinkle = function (tmpNode) {
\r\n\t
engine.Tween.removeTweens(tmpNode);
\r\n\t
var twinkleTime = 1;
\r\n\t
engine.Tween.get(tmpNode, { loop: true })
\r\n\t
.to({ alpha: 0 }, 30)
\r\n\t
.to({ alpha: 1 }, 30)
\r\n\t
.call(function () {
\r\n\t
if (twinkleTime > 5) {
\r\n\t
engine.Tween.removeTweens(tmpNode);
\r\n\t
engine.globalEvent.dispatchEvent('jiugong-turntable-over');
\r\n\t
return;
\r\n\t
}
\r\n\t
else {
\r\n\t
twinkleTime++;
\r\n\t
}
\r\n\t
});
\r\n\t
};
\r\n\t
Turntable.prototype.setRecordID = function (prizeID) {
\r\n\t
this.recordID = prizeID;
\r\n\t
};
\r\n\t
Turntable.prototype.reset = function () {
\r\n\t
engine.Tween.removeAllTweens();
\r\n\t
this._boxIndex = 0;
\r\n\t
this.tweenTime = props.tweenTime || 200;
\r\n\t
this.slowTweenTime = props.slowTweenTime || 200;
\r\n\t
this.circleNumber = 0;
\r\n\t
this.recordID = -1;
\r\n\t
this.boxPrizeIndex = -1;
\r\n\t
this.slowDown = false;
\r\n\t
this.isStop = false;
\r\n\t
for (var index = 0; index < this._boxArray.length; index++) {
\r\n\t
var element = this._boxArray[index];
\r\n\t
element.getChildByName('checked').alpha = 0;
\r\n\t
}
\r\n\t
};
\r\n\t
return Turntable;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=turntable.js.map
\n\n\t
var GameView = (function (_super) {
\r\n\t
tslib.__extends(GameView, _super);
\r\n\t
function GameView() {
\r\n\t
return _super.call(this) || this;
\r\n\t
}
\r\n\t
GameView.prototype.setup = function (res) {
\r\n\t
if (this._hasSetup) {
\r\n\t
return;
\r\n\t
}
\r\n\t
this._hasSetup = true;
\r\n\t
var turntable = this._turntable = new Turntable(res);
\r\n\t
this.addChild(turntable);
\r\n\t
};
\r\n\t
GameView.prototype.startDraw = function () {
\r\n\t
this._turntable.startDraw();
\r\n\t
};
\r\n\t
GameView.prototype.setRecordID = function (prizeID) {
\r\n\t
this._turntable.setRecordID(prizeID);
\r\n\t
};
\r\n\t
GameView.prototype.reset = function () {
\r\n\t
this._turntable.reset();
\r\n\t
};
\r\n\t
return GameView;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=GameView.js.map
\n\n\t
var GameWrapper = (function (_super) {
\r\n\t
tslib.__extends(GameWrapper, _super);
\r\n\t
function GameWrapper() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-init', _this.init, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-start', _this.start, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-winPrize', _this.winPrize, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-reset', _this.reset, _this);
\r\n\t
engine.globalEvent.addEventListener('jiugong-turntable-abnormal', _this.reset, _this);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameWrapper.prototype.init = function (event) {
\r\n\t
var gameView = this._gameView = new GameView();
\r\n\t
this.addChild(gameView);
\r\n\t
console.log('奖品图', event.data.resources);
\r\n\t
this._gameView.setup(event.data.resources);
\r\n\t
};
\r\n\t
GameWrapper.prototype.start = function (event) {
\r\n\t
this._gameView.startDraw();
\r\n\t
};
\r\n\t
GameWrapper.prototype.winPrize = function (event) {
\r\n\t
this._gameView.setRecordID(event.data.prizeID);
\r\n\t
};
\r\n\t
GameWrapper.prototype.reset = function () {
\r\n\t
this._gameView.reset();
\r\n\t
};
\r\n\t
return GameWrapper;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=GameWrapper.js.map
\n\n\t
function index (props) {
\r\n\t
prepareProps();
\r\n\t
injectProps(props);
\r\n\t
var instance = new GameWrapper();
\r\n\t
return instance;
\r\n\t
}
\r\n\t
//# sourceMappingURL=index.js.map
\n\n\t
return index;
\n\n
})));
\n
"
}
src/custom/answer-game/debug/app.js
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2019-12-16.
*/
const
customId
=
'answer-game'
;
(
async
function
()
{
let
customModule
=
await
fetch
(
`../meta.json`
);
customModule
=
await
customModule
.
json
();
console
.
log
(
customModule
);
await
loadAssets
(
customModule
.
assets
);
launchWithCustomModule
(
customModule
);
})();
function
launchWithCustomModule
(
customModule
)
{
//engine.registerCustomCodeModule(customModule);
engine
.
registerCustomModule
(
customId
,
window
[
customId
]);
const
{
props
:
propsOption
,
assets
}
=
customModule
;
let
props
=
engine
.
computeProps
(
customModuleProps
,
propsOption
);
const
customModuleIns
=
{
id
:
customId
,
props
,
assets
,
};
engine
.
registerCustomModules
([
customModuleIns
]);
engine
.
launchWithConfig
({
options
:
{
entrySceneView
:
'entry'
,
},
assets
:
[],
views
:
[{
name
:
'entry'
,
type
:
'node'
,
properties
:
{
x
:
0
,
y
:
0
,
}
}],
},
null
,
function
()
{
setTimeout
(()
=>
{
engine
.
addCustomModule
(
customId
,
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
));
},
100
);
setTimeout
(()
=>
{
let
questionList
=
[
{
"question"
:
"这是第一题"
,
"index"
:
0
,
"options"
:[
"第一题答案A"
,
"第一题答案B"
,
"第一题答案C"
,
"第一题答案D"
]
},
{
"question"
:
"这是第二题"
,
"index"
:
2
,
"options"
:[
"第二题答案A"
,
"第二题答案B"
,
"第二题答案C"
,
"第二题答案D"
]
}
]
engine
.
globalEvent
.
dispatchEvent
(
'answer-game-start'
,
{
countDown
:
10
});
engine
.
globalEvent
.
dispatchEvent
(
'answer-game-subject'
,
{
subjectData
:
questionList
});
},
500
);
});
}
function
getAssetByUUID
(
uuid
)
{
return
engine
.
resolveCustomAsset
(
customId
,
uuid
);
}
function
getProps
()
{
return
engine
.
getProps
(
customId
);
}
src/custom/answer-game/debug/index.html
0 → 100644
View file @
81e5868b
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
墨迹天气答题
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
/>
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
/>
<meta
name=
"full-screen"
content=
"true"
/>
<meta
name=
"screen-orientation"
content=
"portrait"
/>
<meta
name=
"x5-fullscreen"
content=
"true"
/>
<meta
name=
"360-fullscreen"
content=
"true"
/>
<style>
html
,
body
{
padding
:
0
;
margin
:
0
;
border
:
0
;
width
:
100%
;
height
:
100%
;
overflow
:
hidden
;
position
:
absolute
;
background-color
:
transparent
;
}
</style>
</head>
<body>
<div
id=
"game-container"
style=
"line-height:0;font-size:0"
></div>
<script
src=
"//yun.duiba.com.cn/editor/zeroing/libs/engine.ebc906f6b50b8da0a669f77027981d5f3cb560ce.js"
></script>
<!--<script src="http://localhost:4002/debug/engine.js"></script>
<script src="http://localhost:4003/debug/engine-svga.js"></script>-->
<!--//yun.duiba.com.cn/aurora/assets/6a63b68a1fd87eaf60a515968f91a0b1014fe640.ttf-->
<script
src=
"//yun.duiba.com.cn/editor/zeroing/libs/svga.fd3923ae6e664251ca7981801a65809cc5f36bc3.js"
>
</script>
<!--<script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.9a9dbfda4cb2dd5508ecddfe3d95dfd88063f7b5.js"></script>-->
<script
src=
"app.js"
></script>
<script
src=
"props.js"
></script>
<script
src=
"load-assets.js"
></script>
<script
src=
"main.js"
></script>
<script>
</script>
</body>
\ No newline at end of file
src/custom/answer-game/debug/load-assets.js
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2020-01-21.
*/
const
assets
=
[
];
function
loadAssets
(
customModuleAssets
,
onProgress
,
onComplete
){
return
engine
.
loadAssets
(
assets
.
concat
(...
customModuleAssets
),
onProgress
,
onComplete
);
}
src/custom/answer-game/debug/main.js
0 → 100644
View file @
81e5868b
(
function
(
global
,
factory
)
{
typeof
exports
===
'object'
&&
typeof
module
!==
'undefined'
?
module
.
exports
=
factory
(
require
(
'tslib'
))
:
typeof
define
===
'function'
&&
define
.
amd
?
define
([
'tslib'
],
factory
)
:
(
global
=
global
||
self
,
global
[
'answer-game'
]
=
factory
(
global
.
tslib
));
}(
this
,
(
function
(
tslib
)
{
'use strict'
;
var
props
=
{};
function
prepareProps
()
{
var
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
//# sourceMappingURL=props.js.map
var
SubjectManager
=
(
function
()
{
function
SubjectManager
()
{
this
.
_curSubJect
=
0
;
}
SubjectManager
.
prototype
.
init
=
function
()
{
this
.
insideAddEventListener
();
};
SubjectManager
.
prototype
.
insideAddEventListener
=
function
()
{
engine
.
globalEvent
.
addEventListener
(
'handleOption'
,
this
.
handleSubject
,
this
);
engine
.
globalEvent
.
addEventListener
(
'updateSubject'
,
this
.
updateSubject
,
this
);
engine
.
globalEvent
.
addEventListener
(
'handleResult'
,
this
.
handleResult
,
this
);
engine
.
globalEvent
.
addEventListener
(
'sendAnswerResult'
,
this
.
sendAnswerResult
,
this
);
};
SubjectManager
.
prototype
.
handleSubject
=
function
(
subject
)
{
this
.
_curSubJect
=
0
;
this
.
_loactionCache
=
subject
.
data
;
this
.
updateSubject
();
engine
.
globalEvent
.
dispatchEvent
(
'updateAnswerCount'
,
{
count
:
0
});
};
SubjectManager
.
prototype
.
updateSubject
=
function
()
{
if
(
this
.
_curSubJect
>=
this
.
_loactionCache
.
length
)
{
console
.
log
(
'没有题目'
);
engine
.
globalEvent
.
dispatchEvent
(
'answer-game-over'
);
return
;
}
this
.
_curTmpSubject
=
this
.
_loactionCache
[
this
.
_curSubJect
];
var
title
=
this
.
_loactionCache
[
this
.
_curSubJect
].
question
;
var
options
=
this
.
_loactionCache
[
this
.
_curSubJect
].
options
;
var
tmpIndex
=
this
.
_loactionCache
[
this
.
_curSubJect
].
index
;
this
.
updateTitle
(
title
,
tmpIndex
);
this
.
updateOption
(
options
);
this
.
_curSubJect
++
;
};
SubjectManager
.
prototype
.
updateTitle
=
function
(
title
,
tmpIndex
)
{
engine
.
globalEvent
.
dispatchEvent
(
'updateSubjectTitle'
,
{
title
:
title
,
curSubJect
:
tmpIndex
});
};
SubjectManager
.
prototype
.
updateOption
=
function
(
options
)
{
engine
.
globalEvent
.
dispatchEvent
(
'updateOption'
,
{
options
:
options
});
};
SubjectManager
.
prototype
.
handleResult
=
function
(
result
)
{
var
tmp
=
result
.
data
.
result
;
engine
.
globalEvent
.
dispatchEvent
(
'updateAnswerCount'
,
{
count
:
tmp
.
count
});
engine
.
globalEvent
.
dispatchEvent
(
'handleAnswerOption'
,
{
state
:
tmp
.
state
});
};
SubjectManager
.
prototype
.
sendAnswerResult
=
function
(
resultData
)
{
var
tmpAnswer
=
resultData
.
data
.
answer
;
engine
.
globalEvent
.
dispatchEvent
(
'answer-game-select'
,
{
curSubJect
:
this
.
_curTmpSubject
.
index
,
answer
:
tmpAnswer
});
};
return
SubjectManager
;
}());
//# sourceMappingURL=SubjectManager.js.map
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
function
getStage
()
{
return
engine
.
gameStage
.
stage
;
}
var
OptionState
;
(
function
(
OptionState
)
{
OptionState
[
OptionState
[
"CHOICE_RIGHT"
]
=
0
]
=
"CHOICE_RIGHT"
;
OptionState
[
OptionState
[
"CHOICE_WRONG"
]
=
1
]
=
"CHOICE_WRONG"
;
OptionState
[
OptionState
[
"CHOICE_SELECT"
]
=
2
]
=
"CHOICE_SELECT"
;
})(
OptionState
||
(
OptionState
=
{}));
var
GameState
;
(
function
(
GameState
)
{
GameState
[
GameState
[
"STATE_START"
]
=
0
]
=
"STATE_START"
;
GameState
[
GameState
[
"STATE_END"
]
=
1
]
=
"STATE_END"
;
})(
GameState
||
(
GameState
=
{}));
//# sourceMappingURL=utils.js.map
var
Background
=
(
function
(
_super
)
{
tslib
.
__extends
(
Background
,
_super
);
function
Background
()
{
return
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
}
Background
.
prototype
.
init
=
function
()
{
this
.
showSubjectBox
();
this
.
insideAddEventListener
();
};
Background
.
prototype
.
insideAddEventListener
=
function
()
{
engine
.
globalEvent
.
addEventListener
(
'changeCount'
,
this
.
changeCount
,
this
);
};
Background
.
prototype
.
showSubjectBox
=
function
()
{
var
tmpContainer
=
new
engine
.
Container
();
tmpContainer
.
x
=
0
;
tmpContainer
.
y
=
props
.
subjectBox_Y
;
this
.
addChild
(
tmpContainer
);
var
subjectBox
=
this
.
_subjectBox
=
new
engine
.
Image
(
getTextureByName
(
'题目栏'
));
subjectBox
.
x
=
(
750
-
subjectBox
.
width
)
/
2
;
subjectBox
.
y
=
0
;
tmpContainer
.
addChild
(
subjectBox
);
var
countDownBg
=
this
.
_countDownBg
=
new
engine
.
Image
(
getTextureByName
(
'倒计时'
));
countDownBg
.
x
=
(
750
-
countDownBg
.
width
)
/
2
;
countDownBg
.
y
=
-
countDownBg
.
height
/
2
+
10
;
tmpContainer
.
addChild
(
countDownBg
);
var
answerCountBg
=
this
.
_answerCountBg
=
new
engine
.
Image
(
getTextureByName
(
'答对题数'
));
answerCountBg
.
x
=
(
750
-
answerCountBg
.
width
)
/
2
;
answerCountBg
.
y
=
subjectBox
.
y
+
subjectBox
.
height
-
answerCountBg
.
height
-
10
;
tmpContainer
.
addChild
(
answerCountBg
);
var
answerCountText
=
this
.
_answerCountText
=
new
engine
.
Label
();
answerCountText
.
fillColor
=
0x2b3134
;
answerCountText
.
size
=
30
;
answerCountText
.
width
=
answerCountBg
.
width
;
answerCountText
.
height
=
answerCountBg
.
height
;
answerCountText
.
verticalAlign
=
engine
.
VERTICAL_ALIGN
.
MIDDLE
;
answerCountText
.
x
=
160
;
answerCountText
.
y
=
3
;
answerCountText
.
text
=
'0'
;
answerCountBg
.
addChild
(
answerCountText
);
};
Background
.
prototype
.
changeCount
=
function
(
data
)
{
this
.
_answerCountText
.
text
=
data
.
data
.
count
+
''
;
};
return
Background
;
}(
engine
.
Container
));
//# sourceMappingURL=Background.js.map
var
SvgaManager
=
(
function
()
{
function
SvgaManager
()
{
}
SvgaManager
.
createSvga
=
function
(
name
)
{
var
inst
=
new
svga
.
Svga
();
inst
.
source
=
engine
.
getAssetByName
(
name
).
uuid
;
return
inst
;
};
SvgaManager
.
play
=
function
(
svga
,
callBack
)
{
if
(
!
svga
)
{
console
.
log
(
'svga节点出错'
);
return
;
}
svga
.
gotoAndStop
(
0
);
svga
.
play
();
if
(
callBack
)
{
svga
.
addEventListener
(
engine
.
Event
.
END_FRAME
,
function
()
{
svga
.
stop
();
callBack
();
svga
.
removeAllEventListener
();
},
this
);
}
};
SvgaManager
.
stop
=
function
(
svga
)
{
if
(
!
svga
)
{
console
.
log
(
'svga节点出错'
);
return
;
}
svga
.
stop
();
};
return
SvgaManager
;
}());
//# sourceMappingURL=SvgaManager.js.map
var
SubjectTitle
=
(
function
(
_super
)
{
tslib
.
__extends
(
SubjectTitle
,
_super
);
function
SubjectTitle
()
{
var
_this
=
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
_this
.
_frameCurrAngle
=
0
;
_this
.
_frameCount
=
0
;
_this
.
_countDownTmp
=
0
;
_this
.
_square
=
new
engine
.
Graphics
();
return
_this
;
}
SubjectTitle
.
prototype
.
init
=
function
()
{
this
.
showSubjectBox
();
this
.
insideAddEventListener
();
};
SubjectTitle
.
prototype
.
initCountDownSvga
=
function
(
tmpNode
)
{
var
countDownSvga
=
this
.
_countDownSvga
=
SvgaManager
.
createSvga
(
'countdown_321'
);
countDownSvga
.
x
=
(
getStage
().
width
-
120
)
/
2
;
countDownSvga
.
y
=
(
getStage
().
height
-
120
)
/
2
;
countDownSvga
.
visible
=
false
;
tmpNode
.
addChild
(
countDownSvga
);
};
SubjectTitle
.
prototype
.
insideAddEventListener
=
function
()
{
engine
.
globalEvent
.
addEventListener
(
'updateSubjectTitle'
,
this
.
updateSubjectTitle
,
this
);
engine
.
globalEvent
.
addEventListener
(
'updateAnswerCount'
,
this
.
updateAnswerCount
,
this
);
engine
.
globalEvent
.
addEventListener
(
'resetTitle'
,
this
.
reset
,
this
);
engine
.
globalEvent
.
addEventListener
(
'outRest'
,
this
.
outRest
,
this
);
};
SubjectTitle
.
prototype
.
showSubjectBox
=
function
()
{
var
tmpContainer
=
new
engine
.
Container
();
tmpContainer
.
x
=
0
;
tmpContainer
.
y
=
props
.
subjectBox_Y
;
this
.
addChild
(
tmpContainer
);
var
subjectBox
=
this
.
_subjectTitleBox
=
new
engine
.
Image
(
getTextureByName
(
'题目栏'
));
subjectBox
.
x
=
(
750
-
subjectBox
.
width
)
/
2
;
subjectBox
.
y
=
0
;
tmpContainer
.
addChild
(
subjectBox
);
var
countDownBg
=
this
.
_countDownBg
=
new
engine
.
Image
(
getTextureByName
(
'倒计时'
));
countDownBg
.
x
=
(
750
-
countDownBg
.
width
)
/
2
;
countDownBg
.
y
=
-
countDownBg
.
height
/
2
+
10
;
tmpContainer
.
addChild
(
countDownBg
);
var
bar
=
this
.
_bar
=
new
engine
.
Image
(
getTextureByName
(
'进度条'
));
bar
.
x
=
0
;
bar
.
y
=
0
;
countDownBg
.
addChild
(
bar
);
bar
.
anchorX
=
bar
.
width
/
2
;
bar
.
anchorY
=
bar
.
height
/
2
;
bar
.
rotation
=
-
90
;
bar
.
addChild
(
this
.
_square
);
bar
.
mask
=
this
.
_square
;
var
answerCountBg
=
this
.
_answerCountBg
=
new
engine
.
Image
(
getTextureByName
(
'答对题数'
));
answerCountBg
.
x
=
(
750
-
answerCountBg
.
width
)
/
2
;
answerCountBg
.
y
=
subjectBox
.
y
+
subjectBox
.
height
-
answerCountBg
.
height
-
10
;
tmpContainer
.
addChild
(
answerCountBg
);
this
.
initCountDownBar
(
0
);
this
.
initAnswerCountText
();
this
.
initCountDownText
();
this
.
initTitleText
();
this
.
initSvga
();
};
SubjectTitle
.
prototype
.
initCountDownText
=
function
()
{
var
countDownText
=
this
.
_countDownText
=
new
engine
.
BitmapText
();
countDownText
.
font
=
props
.
fontName
;
countDownText
.
text
=
props
.
countDown
;
this
.
handleAlign
();
this
.
_countDownBg
.
addChild
(
countDownText
);
this
.
_countDownTmp
=
props
.
countDown
;
};
SubjectTitle
.
prototype
.
handleAlign
=
function
()
{
this
.
_countDownText
.
x
=
(
this
.
_countDownBg
.
width
-
this
.
_countDownText
.
width
)
/
2
;
this
.
_countDownText
.
y
=
(
this
.
_countDownBg
.
height
-
this
.
_countDownText
.
height
)
/
2
;
};
SubjectTitle
.
prototype
.
countDownBitmapText
=
function
()
{
};
SubjectTitle
.
prototype
.
initAnswerCountText
=
function
()
{
var
answerCountText
=
this
.
_answerCountText
=
new
engine
.
Label
();
answerCountText
.
fillColor
=
0x2b3134
;
answerCountText
.
size
=
30
;
answerCountText
.
width
=
this
.
_answerCountBg
.
width
;
answerCountText
.
height
=
this
.
_answerCountBg
.
height
;
answerCountText
.
verticalAlign
=
engine
.
VERTICAL_ALIGN
.
MIDDLE
;
answerCountText
.
x
=
160
;
answerCountText
.
y
=
props
.
answerCountText_Y
;
answerCountText
.
text
=
'0'
;
this
.
_answerCountBg
.
addChild
(
answerCountText
);
};
SubjectTitle
.
prototype
.
initTitleText
=
function
()
{
var
titleLabel
=
this
.
_titleLabel
=
new
engine
.
Label
();
titleLabel
.
fillColor
=
0xfffcc6
;
titleLabel
.
size
=
36
;
titleLabel
.
width
=
this
.
_subjectTitleBox
.
width
-
props
.
titleText_width
;
titleLabel
.
height
=
this
.
_subjectTitleBox
.
height
-
props
.
titleText_height
;
titleLabel
.
lineType
=
engine
.
TEXT_lINETYPE
.
MULTI
;
titleLabel
.
verticalAlign
=
engine
.
VERTICAL_ALIGN
.
MIDDLE
;
titleLabel
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
titleLabel
.
x
=
props
.
titleText_X
;
titleLabel
.
y
=
props
.
titleText_Y
;
titleLabel
.
text
=
''
;
titleLabel
.
alpha
=
0
;
this
.
_subjectTitleBox
.
addChild
(
titleLabel
);
};
SubjectTitle
.
prototype
.
initTitleNumText
=
function
(
tmpContainer
)
{
var
titleNumLabel
=
this
.
_titleNumLabel
=
new
engine
.
Label
();
titleNumLabel
.
fillColor
=
0xfffcc6
;
titleNumLabel
.
size
=
48
;
titleNumLabel
.
width
=
tmpContainer
.
width
;
titleNumLabel
.
height
=
tmpContainer
.
heigth
;
titleNumLabel
.
verticalAlign
=
engine
.
VERTICAL_ALIGN
.
MIDDLE
;
titleNumLabel
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
titleNumLabel
.
text
=
''
;
titleNumLabel
.
visible
=
false
;
tmpContainer
.
addChild
(
titleNumLabel
);
};
SubjectTitle
.
prototype
.
updateTitleNumText
=
function
(
curSubJect
)
{
this
.
rest
();
this
.
_titleNumLabel
.
text
=
"
\
u7B2C"
+
curSubJect
+
"
\
u9898"
;
};
SubjectTitle
.
prototype
.
reset
=
function
()
{
this
.
_titleLabel
.
text
=
''
;
};
SubjectTitle
.
prototype
.
updateSubjectTitle
=
function
(
tmpData
)
{
this
.
_titleLabel
.
alpha
=
0
;
this
.
_titleLabel
.
text
=
tmpData
.
data
.
title
;
this
.
lastTime
=
0
;
this
.
updateTitleNumText
(
tmpData
.
data
.
curSubJect
+
1
);
if
(
tmpData
.
data
.
curSubJect
==
0
)
{
this
.
fristAnswer
();
}
else
{
this
.
playQuestion_enter
();
}
};
SubjectTitle
.
prototype
.
updateAnswerCount
=
function
(
data
)
{
this
.
_answerCountText
.
text
=
data
.
data
.
count
+
''
;
};
SubjectTitle
.
prototype
.
updateCountDownText
=
function
(
count
)
{
this
.
_countDownText
.
text
=
count
+
''
;
this
.
handleAlign
();
};
SubjectTitle
.
prototype
.
openCountDownBar
=
function
()
{
this
.
rest
();
engine
.
gameStage
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
countDownBar
,
this
);
};
SubjectTitle
.
prototype
.
initCountDownBar
=
function
(
currAngle
)
{
var
ax
=
this
.
_bar
.
width
/
2
;
var
ay
=
this
.
_bar
.
height
/
2
;
this
.
_square
.
clear
();
this
.
_square
.
beginFill
(
0
);
this
.
_square
.
moveTo
(
ax
,
ay
);
this
.
_square
.
arc
(
ax
,
ay
,
this
.
_bar
.
width
/
2
,
0
,
(
currAngle
*
Math
.
PI
/
180
));
this
.
_square
.
lineTo
(
ax
,
ay
);
this
.
_square
.
endFill
();
};
SubjectTitle
.
prototype
.
countDownBar
=
function
()
{
var
now
=
Date
.
now
();
var
deltaTime
=
this
.
lastTime
?
now
-
this
.
lastTime
:
16.7
;
this
.
lastTime
=
now
;
this
.
_frameCurrAngle
+=
360
/
(
props
.
countDown
*
1000
)
*
deltaTime
;
this
.
_frameCurrAngle
=
Math
.
min
(
360
,
this
.
_frameCurrAngle
);
this
.
initCountDownBar
(
this
.
_frameCurrAngle
);
this
.
_frameCount
+=
deltaTime
;
if
(
this
.
_frameCount
>=
1000
)
{
var
tmpTime
=
this
.
_countDownTmp
-
1
>
0
?
this
.
_countDownTmp
-=
1
:
0
;
if
(
tmpTime
==
3
)
{
this
.
playCountDownSvga
();
}
this
.
updateCountDownText
(
tmpTime
);
this
.
_frameCount
=
0
;
if
(
this
.
_frameCurrAngle
>=
360
)
{
engine
.
gameStage
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
countDownBar
,
this
);
engine
.
globalEvent
.
dispatchEvent
(
'upDateGameState'
,
{
gameState
:
GameState
.
STATE_END
});
engine
.
globalEvent
.
dispatchEvent
(
'sendAnswer'
);
}
}
};
SubjectTitle
.
prototype
.
rest
=
function
()
{
this
.
_frameCurrAngle
=
0
;
this
.
_frameCount
=
0
;
this
.
_square
.
clear
();
this
.
_countDownTmp
=
props
.
countDown
;
this
.
_countDownText
.
text
=
props
.
countDown
+
''
;
this
.
handleAlign
();
};
SubjectTitle
.
prototype
.
outRest
=
function
()
{
this
.
_frameCurrAngle
=
0
;
this
.
_frameCount
=
0
;
this
.
_square
.
clear
();
this
.
_countDownTmp
=
props
.
countDown
;
this
.
_countDownText
.
text
=
props
.
countDown
+
''
;
this
.
handleAlign
();
this
.
_readyGo
.
visible
=
false
;
this
.
_countDownSvga
.
visible
=
false
;
this
.
_questionEnter
.
visible
=
false
;
engine
.
gameStage
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
countDownBar
,
this
);
};
SubjectTitle
.
prototype
.
initSvga
=
function
()
{
var
readyGo
=
this
.
_readyGo
=
SvgaManager
.
createSvga
(
'ready_go'
);
readyGo
.
x
=
50
;
readyGo
.
y
=
45
;
readyGo
.
visible
=
false
;
this
.
_subjectTitleBox
.
addChild
(
readyGo
);
var
tmpRect
=
new
engine
.
Rect
();
tmpRect
.
x
=
50
;
tmpRect
.
y
=
45
;
tmpRect
.
width
=
520
;
tmpRect
.
height
=
200
;
this
.
_subjectTitleBox
.
addChild
(
tmpRect
);
readyGo
.
mask
=
tmpRect
;
var
tmpContainer
=
new
engine
.
Container
();
tmpContainer
.
width
=
400
;
tmpContainer
.
height
=
100
;
tmpContainer
.
x
=
(
this
.
_subjectTitleBox
.
width
-
400
)
/
2
;
tmpContainer
.
y
=
115
;
this
.
_subjectTitleBox
.
addChild
(
tmpContainer
);
var
questionEnter
=
this
.
_questionEnter
=
SvgaManager
.
createSvga
(
'question_enter'
);
questionEnter
.
x
=
0
;
questionEnter
.
y
=
0
;
questionEnter
.
visible
=
false
;
tmpContainer
.
addChild
(
questionEnter
);
this
.
initTitleNumText
(
tmpContainer
);
};
SubjectTitle
.
prototype
.
fristAnswer
=
function
()
{
this
.
playReadyGo
();
};
SubjectTitle
.
prototype
.
playReadyGo
=
function
()
{
var
_this
=
this
;
this
.
_readyGo
.
visible
=
true
;
SvgaManager
.
play
(
this
.
_readyGo
,
function
()
{
_this
.
_readyGo
.
visible
=
false
;
_this
.
playQuestion_enter
();
});
};
SubjectTitle
.
prototype
.
playQuestion_enter
=
function
()
{
var
_this
=
this
;
this
.
_questionEnter
.
visible
=
true
;
this
.
_titleNumLabel
.
visible
=
true
;
SvgaManager
.
play
(
this
.
_questionEnter
,
function
()
{
_this
.
_questionEnter
.
visible
=
false
;
_this
.
playTweenTitle
();
_this
.
_titleNumLabel
.
visible
=
false
;
_this
.
openCountDownBar
();
if
(
_this
.
_countDownTmp
==
3
)
{
_this
.
playCountDownSvga
();
}
engine
.
globalEvent
.
dispatchEvent
(
'start'
);
});
};
SubjectTitle
.
prototype
.
playTweenTitle
=
function
()
{
var
_this
=
this
;
engine
.
Tween
.
get
(
this
.
_titleLabel
,
{
loop
:
false
})
.
set
({
alpha
:
0
})
.
to
({
alpha
:
1
},
500
,
engine
.
Ease
.
cubicIn
)
.
call
(
function
()
{
engine
.
Tween
.
removeTweens
(
_this
.
_titleLabel
);
});
};
SubjectTitle
.
prototype
.
playCountDownSvga
=
function
()
{
var
_this
=
this
;
console
.
log
(
'测试次数'
);
this
.
_countDownSvga
.
visible
=
true
;
this
.
_countDownSvga
.
lockStep
=
true
;
SvgaManager
.
play
(
this
.
_countDownSvga
,
function
()
{
_this
.
_countDownSvga
.
visible
=
false
;
});
};
return
SubjectTitle
;
}(
engine
.
Container
));
//# sourceMappingURL=SubjectTitle.js.map
var
AnswerArea
=
(
function
(
_super
)
{
tslib
.
__extends
(
AnswerArea
,
_super
);
function
AnswerArea
()
{
var
_this
=
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
_this
.
_optionArray
=
[];
_this
.
_choiceWrong
=
[];
_this
.
_choiceRight
=
[];
_this
.
_choiceSelect
=
[];
_this
.
_answerArray
=
[
'A'
,
'B'
,
'C'
,
'D'
];
_this
.
_answer
=
-
1
;
_this
.
_svgaArrayName
=
[];
return
_this
;
}
AnswerArea
.
prototype
.
init
=
function
()
{
var
area
=
this
.
_area
=
new
engine
.
Container
();
area
.
x
=
0
;
area
.
y
=
0
;
this
.
_gameState
=
GameState
.
STATE_END
;
this
.
addChild
(
area
);
this
.
initSvgaArray
();
this
.
initAnswerOption
();
this
.
initPeople
();
this
.
insideAddEventListener
();
};
AnswerArea
.
prototype
.
initSvgaArray
=
function
()
{
this
.
setSvgaName
(
'rian_mona'
,
'rian_weather'
);
this
.
setSvgaName
(
'snow_mona'
,
'snow_weather'
);
this
.
setSvgaName
(
'thunder_mona'
,
'thunder_weather'
);
this
.
setSvgaName
(
'wind_mona'
,
'wind_weather'
);
};
AnswerArea
.
prototype
.
setSvgaName
=
function
(
peopleName
,
scene
)
{
var
tmpSvgaName
=
{};
tmpSvgaName
.
people
=
peopleName
;
tmpSvgaName
.
scene
=
scene
;
this
.
_svgaArrayName
.
push
(
tmpSvgaName
);
};
AnswerArea
.
prototype
.
insideAddEventListener
=
function
()
{
engine
.
globalEvent
.
addEventListener
(
'updateOption'
,
this
.
updateOption
,
this
);
engine
.
globalEvent
.
addEventListener
(
'handleAnswerOption'
,
this
.
handleAnswerOption
,
this
);
engine
.
globalEvent
.
addEventListener
(
'upDateGameState'
,
this
.
upDateGameState
,
this
);
engine
.
globalEvent
.
addEventListener
(
'start'
,
this
.
start
,
this
);
engine
.
globalEvent
.
addEventListener
(
'sendAnswer'
,
this
.
sendAnswer
,
this
);
engine
.
globalEvent
.
addEventListener
(
'outRest'
,
this
.
rest
,
this
);
};
AnswerArea
.
prototype
.
initPeople
=
function
()
{
var
people
=
this
.
_people
=
SvgaManager
.
createSvga
(
'mona_walk'
);
people
.
x
=
props
.
people_X
;
people
.
y
=
props
.
people_Y
;
this
.
_area
.
addChild
(
people
);
SvgaManager
.
play
(
people
);
var
mona_confuse
=
this
.
_mona_confuse
=
SvgaManager
.
createSvga
(
'mona_confuse'
);
mona_confuse
.
x
=
props
.
people_X
;
mona_confuse
.
y
=
props
.
people_Y
;
mona_confuse
.
visible
=
false
;
this
.
_area
.
addChild
(
mona_confuse
);
};
AnswerArea
.
prototype
.
getArea
=
function
()
{
return
this
.
_area
;
};
AnswerArea
.
prototype
.
initAnswerOption
=
function
()
{
var
optionA
=
this
.
_optionA
=
new
engine
.
Image
(
getTextureByName
(
'选区'
));
optionA
.
x
=
(
750
-
(
optionA
.
width
*
2
+
30
))
/
2
;
optionA
.
y
=
props
.
answerArea_Y
;
optionA
.
name
=
'A'
;
optionA
.
alpha
=
0
;
this
.
_area
.
addChild
(
optionA
);
this
.
_optionArray
.
push
(
optionA
);
var
optionB
=
this
.
_optionB
=
new
engine
.
Image
(
getTextureByName
(
'选区'
));
optionB
.
x
=
optionA
.
x
+
optionA
.
width
+
30
;
optionB
.
y
=
optionA
.
y
;
optionB
.
name
=
'B'
;
optionB
.
alpha
=
0
;
this
.
_area
.
addChild
(
optionB
);
this
.
_optionArray
.
push
(
optionB
);
var
optionC
=
this
.
_optionC
=
new
engine
.
Image
(
getTextureByName
(
'选区'
));
optionC
.
x
=
optionA
.
x
;
optionC
.
y
=
optionA
.
y
+
optionA
.
height
+
props
.
option_spaceY
;
optionC
.
name
=
'C'
;
optionC
.
alpha
=
0
;
this
.
_area
.
addChild
(
optionC
);
this
.
_optionArray
.
push
(
optionC
);
var
optionD
=
this
.
_optionD
=
new
engine
.
Image
(
getTextureByName
(
'选区'
));
optionD
.
x
=
optionB
.
x
;
optionD
.
y
=
optionC
.
y
;
optionD
.
name
=
'D'
;
optionD
.
alpha
=
0
;
this
.
_area
.
addChild
(
optionD
);
this
.
_optionArray
.
push
(
optionD
);
this
.
initOptionState
();
this
.
initAddEventListener
();
this
.
initSvga
(
optionA
);
this
.
initSvga
(
optionB
);
this
.
initSvga
(
optionC
);
this
.
initSvga
(
optionD
);
};
AnswerArea
.
prototype
.
initSvga
=
function
(
tmpNode
)
{
this
.
initSvgaNode
(
'right_mona'
,
tmpNode
);
for
(
var
index
=
0
;
index
<
this
.
_svgaArrayName
.
length
;
index
++
)
{
var
element
=
this
.
_svgaArrayName
[
index
];
this
.
initSvgaNode
(
element
.
people
,
tmpNode
);
this
.
initSvgaNode
(
element
.
scene
,
tmpNode
);
}
};
AnswerArea
.
prototype
.
initSvgaNode
=
function
(
svgaName
,
tmpNode
)
{
var
tmpSvga
=
SvgaManager
.
createSvga
(
svgaName
);
tmpSvga
.
x
=
-
30
;
tmpSvga
.
y
=
-
105
;
tmpSvga
.
visible
=
false
;
tmpSvga
.
name
=
svgaName
;
tmpNode
.
addChild
(
tmpSvga
);
};
AnswerArea
.
prototype
.
initAddEventListener
=
function
()
{
for
(
var
index
=
0
;
index
<
this
.
_optionArray
.
length
;
index
++
)
{
var
element
=
this
.
_optionArray
[
index
];
element
.
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
selectOption
,
this
);
}
};
AnswerArea
.
prototype
.
optionLabel
=
function
(
parent
)
{
var
answerText
=
new
engine
.
Label
();
answerText
.
fillColor
=
0x164b81
;
answerText
.
bold
=
true
;
answerText
.
size
=
30
;
answerText
.
width
=
parent
.
width
;
answerText
.
height
=
parent
.
height
;
answerText
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
answerText
.
x
=
0
;
answerText
.
y
=
0.75
*
answerText
.
height
;
answerText
.
text
=
''
;
answerText
.
name
=
'answerText'
;
return
answerText
;
};
AnswerArea
.
prototype
.
initOptionState
=
function
()
{
for
(
var
i
=
0
;
i
<
this
.
_optionArray
.
length
;
i
++
)
{
var
tmpNode
=
this
.
_optionArray
[
i
];
tmpNode
.
addChild
(
this
.
getChoiceStateImg
(
'选中'
,
OptionState
.
CHOICE_SELECT
,
tmpNode
.
name
));
tmpNode
.
addChild
(
this
.
getChoiceStateImg
(
'选错'
,
OptionState
.
CHOICE_WRONG
,
tmpNode
.
name
));
tmpNode
.
addChild
(
this
.
getChoiceStateImg
(
'选对'
,
OptionState
.
CHOICE_RIGHT
,
tmpNode
.
name
));
tmpNode
.
addChild
(
this
.
optionLabel
(
tmpNode
));
}
};
AnswerArea
.
prototype
.
getChoiceStateImg
=
function
(
imgName
,
imgType
,
imgAnswer
)
{
var
choiceImage
=
new
engine
.
Image
(
getTextureByName
(
imgName
));
choiceImage
.
x
=
0
;
choiceImage
.
y
=
0
;
choiceImage
[
'type'
]
=
imgType
;
choiceImage
[
'imgAnswer'
]
=
imgAnswer
;
choiceImage
.
visible
=
false
;
switch
(
imgType
)
{
case
OptionState
.
CHOICE_WRONG
:
this
.
_choiceWrong
.
push
(
choiceImage
);
break
;
case
OptionState
.
CHOICE_RIGHT
:
this
.
_choiceRight
.
push
(
choiceImage
);
break
;
case
OptionState
.
CHOICE_SELECT
:
this
.
_choiceSelect
.
push
(
choiceImage
);
break
;
}
return
choiceImage
;
};
AnswerArea
.
prototype
.
selectOption
=
function
(
event
)
{
if
(
this
.
_gameState
!=
GameState
.
STATE_START
||
this
.
_svgaPlayState
==
GameState
.
STATE_START
)
{
console
.
log
(
'暂时不能答题'
);
return
;
}
this
.
_gameState
=
GameState
.
STATE_END
;
this
.
handleSelect
(
event
.
target
.
name
);
this
.
peopleMove
(
event
.
target
.
x
-
30
,
event
.
target
.
y
-
110
,
false
);
this
.
_answer
=
this
.
_answerArray
.
indexOf
(
event
.
target
.
name
);
console
.
log
(
'点击选择选项'
,
event
.
target
.
name
,
this
.
_answer
);
};
AnswerArea
.
prototype
.
peopleMove
=
function
(
moveX
,
moveY
,
isPlaySVGA
)
{
var
_this
=
this
;
var
tmpX
=
moveX
;
var
tmpY
=
moveY
;
engine
.
Tween
.
get
(
this
.
_people
,
{
loop
:
false
})
.
to
({
x
:
tmpX
,
y
:
tmpY
},
500
,
engine
.
Ease
.
cubicInOut
)
.
call
(
function
()
{
_this
.
_gameState
=
GameState
.
STATE_START
;
if
(
isPlaySVGA
)
{
SvgaManager
.
play
(
_this
.
_people
);
engine
.
globalEvent
.
dispatchEvent
(
'updateSubject'
);
}
});
};
AnswerArea
.
prototype
.
rest
=
function
()
{
this
.
_answer
=
-
1
;
if
(
this
.
_right_mona
)
{
SvgaManager
.
stop
(
this
.
_right_mona
);
this
.
_right_mona
.
visible
=
false
;
}
this
.
_people
.
visible
=
true
;
this
.
_mona_confuse
.
visible
=
false
;
this
.
peopleMove
(
props
.
people_X
,
props
.
people_Y
,
true
);
this
.
handleRight
();
this
.
handleWrong
();
this
.
handleSelect
();
this
.
optionsShow
(
false
);
engine
.
globalEvent
.
dispatchEvent
(
'resetTitle'
);
};
AnswerArea
.
prototype
.
optionsShow
=
function
(
isShow
)
{
for
(
var
index
=
0
;
index
<
this
.
_optionArray
.
length
;
index
++
)
{
var
element
=
this
.
_optionArray
[
index
];
var
tmpAlpha
=
isShow
?
1
:
0
;
this
.
optionIsShowTween
(
element
,
tmpAlpha
);
}
};
AnswerArea
.
prototype
.
optionIsShowTween
=
function
(
tweenNode
,
tmpAlpha
)
{
engine
.
Tween
.
get
(
tweenNode
,
{
loop
:
false
})
.
to
({
alpha
:
tmpAlpha
},
500
);
};
AnswerArea
.
prototype
.
handleSelect
=
function
(
select
)
{
for
(
var
index
=
0
;
index
<
this
.
_choiceSelect
.
length
;
index
++
)
{
var
element
=
this
.
_choiceSelect
[
index
];
if
(
!
select
)
{
element
.
visible
=
false
;
continue
;
}
if
(
element
[
'imgAnswer'
]
===
select
)
{
element
.
visible
=
true
;
continue
;
}
element
.
visible
=
false
;
}
};
AnswerArea
.
prototype
.
handleRight
=
function
(
select
)
{
if
(
select
===
void
0
)
{
select
=
''
;
}
for
(
var
index
=
0
;
index
<
this
.
_choiceRight
.
length
;
index
++
)
{
var
element
=
this
.
_choiceRight
[
index
];
if
(
select
==
''
)
{
element
.
visible
=
false
;
continue
;
}
if
(
element
[
'imgAnswer'
]
===
select
)
{
element
.
visible
=
true
;
continue
;
}
element
.
visible
=
false
;
}
};
AnswerArea
.
prototype
.
handleWrong
=
function
(
select
)
{
var
count
=
0
;
for
(
var
index
=
0
;
index
<
this
.
_choiceWrong
.
length
;
index
++
)
{
var
element
=
this
.
_choiceWrong
[
index
];
if
(
!
select
)
{
element
.
visible
=
false
;
this
.
hideSvga
(
element
);
continue
;
}
if
(
element
[
'imgAnswer'
]
==
select
)
{
element
.
visible
=
false
;
continue
;
}
count
++
;
element
.
visible
=
true
;
this
.
playWrongTween
(
element
,
(
count
==
this
.
_choiceWrong
.
length
-
1
));
}
};
AnswerArea
.
prototype
.
hideSvga
=
function
(
svgaNode
)
{
svgaNode
.
parent
.
children
.
forEach
(
function
(
element
)
{
if
(
element
.
_instanceType
==
'MovieClip'
)
{
element
.
visible
=
false
;
}
});
};
AnswerArea
.
prototype
.
playWrongTween
=
function
(
tweenNode
,
isLast
)
{
var
_this
=
this
;
engine
.
Tween
.
get
(
tweenNode
,
{
loop
:
false
})
.
wait
(
460
)
.
to
({
alpha
:
0.3
},
160
,
engine
.
Ease
.
circInOut
)
.
to
({
alpha
:
1
},
160
,
engine
.
Ease
.
circInOut
)
.
to
({
alpha
:
0.3
},
160
,
engine
.
Ease
.
circInOut
)
.
to
({
alpha
:
1
},
160
,
engine
.
Ease
.
circInOut
)
.
call
(
function
()
{
engine
.
Tween
.
removeTweens
(
tweenNode
);
if
(
isLast
)
{
if
(
_this
.
_answer
>=
0
)
{
_this
.
_people
.
visible
=
false
;
_this
.
handleSeceltRight
();
_this
.
handleSeceltError
();
}
else
{
_this
.
_people
.
visible
=
false
;
_this
.
_mona_confuse
.
visible
=
true
;
SvgaManager
.
play
(
_this
.
_mona_confuse
,
function
()
{
_this
.
rest
();
});
}
}
});
};
AnswerArea
.
prototype
.
playResultSvga
=
function
(
svgaNode
,
isLast
,
isShowPeople
)
{
var
_this
=
this
;
var
svgaData
=
this
.
_svgaArrayName
[
this
.
_randomSvga
-
1
];
if
(
isShowPeople
)
{
var
peopleNode
=
this
.
getSvgaNode
(
svgaNode
,
svgaData
.
people
);
this
.
playSvga
(
peopleNode
);
}
var
sceneNode
=
this
.
getSvgaNode
(
svgaNode
,
svgaData
.
scene
);
this
.
playSvga
(
sceneNode
,
function
()
{
if
(
isLast
)
_this
.
rest
();
});
};
AnswerArea
.
prototype
.
getSvgaNode
=
function
(
svgaNode
,
svgaName
)
{
var
tmp
=
svgaNode
.
getChildByName
(
svgaName
);
if
(
!
tmp
)
{
console
.
log
(
'svga节点未找到'
);
return
;
}
return
tmp
;
};
AnswerArea
.
prototype
.
playSvga
=
function
(
svgaNode
,
callBack
)
{
svgaNode
.
visible
=
true
;
SvgaManager
.
play
(
svgaNode
,
function
()
{
svgaNode
.
visible
=
false
;
if
(
callBack
)
callBack
();
});
};
AnswerArea
.
prototype
.
updateOption
=
function
(
optionData
)
{
this
.
_randomSvga
=
Math
.
floor
(
Math
.
random
()
*
(
this
.
_svgaArrayName
.
length
)
+
1
);
var
tmpOptionData
=
optionData
.
data
.
options
;
for
(
var
index
=
0
;
index
<
tmpOptionData
.
length
;
index
++
)
{
var
element
=
tmpOptionData
[
index
];
this
.
_optionArray
[
index
].
getChildByName
(
'answerText'
).
text
=
element
;
}
};
AnswerArea
.
prototype
.
handleAnswerOption
=
function
(
result
)
{
this
.
_people
.
gotoAndStop
(
1
);
var
trueAnswer
=
this
.
_trueAnswer
=
result
.
data
.
state
;
this
.
handleRight
(
this
.
_answerArray
[
trueAnswer
]);
this
.
handleWrong
(
this
.
_answerArray
[
trueAnswer
]);
this
.
handleSelect
();
this
.
_svgaPlayState
=
GameState
.
STATE_START
;
};
AnswerArea
.
prototype
.
handleSeceltRight
=
function
()
{
for
(
var
index
=
0
;
index
<
this
.
_optionArray
.
length
;
index
++
)
{
var
element
=
this
.
_optionArray
[
index
];
if
(
element
.
name
==
this
.
_answerArray
[
this
.
_answer
]
&&
this
.
_trueAnswer
==
this
.
_answer
)
{
this
.
_right_mona
=
this
.
getSvgaNode
(
element
,
'right_mona'
);
if
(
this
.
_right_mona
)
{
this
.
_right_mona
.
visible
=
true
;
SvgaManager
.
play
(
this
.
_right_mona
);
}
}
}
};
AnswerArea
.
prototype
.
handleSeceltError
=
function
()
{
var
tmpNum
=
0
;
for
(
var
index
=
0
;
index
<
this
.
_optionArray
.
length
;
index
++
)
{
var
element
=
this
.
_optionArray
[
index
];
if
(
element
.
name
!=
this
.
_answerArray
[
this
.
_trueAnswer
])
{
tmpNum
++
;
var
isShowPeople
=
false
;
if
(
element
.
name
==
this
.
_answerArray
[
this
.
_answer
])
{
isShowPeople
=
true
;
}
this
.
playResultSvga
(
element
,
(
tmpNum
==
3
),
isShowPeople
);
}
}
};
AnswerArea
.
prototype
.
upDateGameState
=
function
(
gameState
)
{
this
.
_gameState
=
gameState
.
data
.
gameState
;
};
AnswerArea
.
prototype
.
start
=
function
()
{
this
.
optionsShow
(
true
);
this
.
_gameState
=
GameState
.
STATE_START
;
this
.
_svgaPlayState
=
GameState
.
STATE_END
;
};
AnswerArea
.
prototype
.
sendAnswer
=
function
()
{
engine
.
globalEvent
.
dispatchEvent
(
'sendAnswerResult'
,
{
answer
:
this
.
_answer
});
};
return
AnswerArea
;
}(
engine
.
Container
));
//# sourceMappingURL=answerArea.js.map
var
GameView
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameView
,
_super
);
function
GameView
()
{
return
_super
.
call
(
this
)
||
this
;
}
GameView
.
prototype
.
setup
=
function
()
{
if
(
this
.
_hasSetup
)
{
return
;
}
this
.
_hasSetup
=
true
;
var
backgroud
=
this
.
_backgroud
=
new
Background
();
this
.
addChild
(
backgroud
);
backgroud
.
init
();
var
subject
=
this
.
_subject
=
new
SubjectTitle
();
this
.
addChild
(
subject
);
subject
.
init
();
var
answerArea
=
this
.
_answerArea
=
new
AnswerArea
();
this
.
addChild
(
answerArea
);
answerArea
.
init
();
var
tmpContainer
=
new
engine
.
Container
();
this
.
addChildAt
(
tmpContainer
,
50
);
subject
.
initCountDownSvga
(
tmpContainer
);
var
subjectManager
=
this
.
_subjectManager
=
new
SubjectManager
();
subjectManager
.
init
();
};
GameView
.
prototype
.
start
=
function
()
{
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
return
tslib
.
__generator
(
this
,
function
(
_a
)
{
this
.
setup
();
return
[
2
];
});
});
};
return
GameView
;
}(
engine
.
Container
));
//# sourceMappingURL=GameView.js.map
var
GameWrapper
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameWrapper
,
_super
);
function
GameWrapper
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
'answer-game-start'
,
_this
.
start
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'answer-game-subject'
,
_this
.
initSubject
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'answer-game-result'
,
_this
.
result
,
_this
);
_this
.
visibilitychange
();
return
_this
;
}
GameWrapper
.
prototype
.
start
=
function
(
event
)
{
if
(
event
.
data
.
countDown
)
{
props
.
countDown
=
event
.
data
.
countDown
;
}
if
(
!
this
.
_gameView
)
{
var
gameView
=
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
gameView
);
this
.
_gameView
.
start
();
}
engine
.
globalEvent
.
dispatchEvent
(
'reset'
);
};
GameWrapper
.
prototype
.
initSubject
=
function
(
event
)
{
var
subjectData
=
event
.
data
.
subjectData
;
engine
.
globalEvent
.
dispatchEvent
(
'handleOption'
,
subjectData
);
};
GameWrapper
.
prototype
.
result
=
function
(
event
)
{
var
result
=
event
.
data
.
result
;
engine
.
globalEvent
.
dispatchEvent
(
'handleResult'
,
{
result
:
result
});
};
GameWrapper
.
prototype
.
visibilitychange
=
function
()
{
document
.
addEventListener
(
'visibilitychange'
,
function
()
{
if
(
document
.
visibilityState
===
'hidden'
)
{
console
.
log
(
'放置后台'
);
engine
.
globalEvent
.
dispatchEvent
(
'outRest'
);
engine
.
globalEvent
.
dispatchEvent
(
'answer-game-visibilitychange'
,
{
hidden
:
true
});
}
});
};
return
GameWrapper
;
}(
engine
.
Container
));
//# sourceMappingURL=GameWrapper.js.map
function
index
(
props
)
{
prepareProps
();
injectProps
(
props
);
var
instance
=
new
GameWrapper
();
return
instance
;
}
//# sourceMappingURL=index.js.map
return
index
;
})));
//# sourceMappingURL=main.js.map
\ No newline at end of file
src/custom/answer-game/debug/main.js.map
0 → 100644
View file @
81e5868b
{"version":3,"file":"index.js","sources":["src/custom/answer-game/src/props.ts","src/custom/answer-game/src/game/SubjectManager.ts","src/custom/answer-game/src/game/utils.ts","src/custom/answer-game/src/game/Background.ts","src/custom/answer-game/src/game/SvgaManager.ts","src/custom/answer-game/src/game/SubjectTitle.ts","src/custom/answer-game/src/game/answerArea.ts","src/custom/answer-game/src/game/GameView.ts","src/custom/answer-game/src/game/GameWrapper.ts","src/custom/answer-game/src/index.ts"],"sourcesContent":["/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport let props: any = {};\r\n\r\nexport function prepareProps() {\r\n\tlet metaProps = getProps();\r\n\r\n\tengine.injectProp(props, metaProps);\r\n}\r\n\r\nexport function injectProps(p) {\r\n\tengine.injectProp(props, p);\r\n}\r\n","import { GameState } from \"./utils\";\r\n\r\nexport class SubjectManager {\r\n private _curSubJect = 0;//当前第几题\r\n private _loactionCache;//所有题目\r\n private _curTmpSubject;//当前题目数据\r\n\r\n init(){\r\n \r\n this.insideAddEventListener();\r\n }\r\n private insideAddEventListener(){\r\n //初始化题目数据\r\n engine.globalEvent.addEventListener('handleOption',this.handleSubject,this)\r\n //更新题目\r\n engine.globalEvent.addEventListener('updateSubject',this.updateSubject,this)\r\n\r\n engine.globalEvent.addEventListener('handleResult',this.handleResult,this)\r\n\r\n engine.globalEvent.addEventListener('sendAnswerResult',this.sendAnswerResult,this)\r\n\r\n \r\n }\r\n\r\n private handleSubject(subject){\r\n this._curSubJect = 0;\r\n this._loactionCache = subject.data;\r\n this.updateSubject();\r\n engine.globalEvent.dispatchEvent('updateAnswerCount',{count:0})\r\n }\r\n\r\n private updateSubject(){\r\n if(this._curSubJect >= this._loactionCache.length){\r\n console.log('没有题目');\r\n engine.globalEvent.dispatchEvent('answer-game-over');\r\n return;\r\n }\r\n this._curTmpSubject = this._loactionCache[this._curSubJect];\r\n let title = this._loactionCache[this._curSubJect].question;\r\n let options = this._loactionCache[this._curSubJect].options;\r\n let tmpIndex = this._loactionCache[this._curSubJect].index;\r\n this.updateTitle(title,tmpIndex)\r\n this.updateOption(options);\r\n this._curSubJect++;\r\n }\r\n //更新题目\r\n private updateTitle(title,tmpIndex){\r\n engine.globalEvent.dispatchEvent('updateSubjectTitle',{title:title,curSubJect:tmpIndex}); \r\n }\r\n //更新选项\r\n private updateOption(options){\r\n engine.globalEvent.dispatchEvent('updateOption',{options:options}); \r\n }\r\n \r\n //处理正确答案及其答对的题数\r\n private handleResult(result){\r\n let tmp = result.data.result;\r\n //更新答对题数值\r\n engine.globalEvent.dispatchEvent('updateAnswerCount',{count:tmp.count})\r\n //更新答题结果\r\n engine.globalEvent.dispatchEvent('handleAnswerOption',{state:tmp.state})\r\n }\r\n //发送用户选择的答案\r\n sendAnswerResult(resultData){\r\n let tmpAnswer = resultData.data.answer;\r\n engine.globalEvent.dispatchEvent('answer-game-select',{curSubJect:this._curTmpSubject.index,answer:tmpAnswer});\r\n }\r\n\r\n}","\r\n/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport function getTexture(uuid) {\r\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n}\r\n\r\nexport function getTextureByName(name) {\r\n\treturn getTexture(engine.getAssetByName(name).uuid);\r\n}\r\n\r\nexport function playSound(name) {\r\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\r\n}\r\nexport function getStage(){\r\n\treturn engine.gameStage.stage;\r\n}\r\n\r\n\r\nexport enum OptionState{\r\n\tCHOICE_RIGHT,//选对\r\n\tCHOICE_WRONG,//选错\r\n\tCHOICE_SELECT,//选中\r\n}\r\n\r\nexport enum GameState{\r\n\tSTATE_START,//开始 选择中\r\n\tSTATE_END,//倒计时结束\r\n}","\r\n\r\nimport {getTextureByName} from \"./utils\";\r\nimport {getStage} from \"./utils\";\r\n\r\nimport { props } from './../props';\r\n\r\nexport class Background extends engine.Container{\r\n\r\n private _bg;\r\n private _cloudUp;//上云\r\n private _cloudDown;//下云\r\n private _answerBg;//答案背景\r\n private _subjectBox;//题目框\r\n private _countDownBg;//倒计时\r\n private _answerCountBg;//答对题数背景\r\n private _answerCountText;//答对题数\r\n init(){ \r\n \r\n // let bg = this._bg = new engine.Image(getTextureByName('gameBg'));\r\n // bg.x = 0;\r\n // bg.y = 0;\r\n // this.addChild(bg);\r\n\r\n // let answerBg = this._answerBg = new engine.Image(getTextureByName('答案区'))\r\n // answerBg.x = 0;\r\n // answerBg.y = bg.height - answerBg.height;\r\n // this.addChild(answerBg);\r\n // //上云\r\n // let cloudUp = this._cloudUp = new engine.Image(getTextureByName('前景云上'))\r\n // cloudUp.x = 0;\r\n // cloudUp.y = 0;\r\n // this.addChild(cloudUp);\r\n\r\n // //下云\r\n // let cloudDown = this._cloudDown = new engine.Image(getTextureByName('前景云下'))\r\n // cloudDown.x = 0;\r\n // cloudDown.y = bg.height - cloudDown.height;\r\n // this.addChild(cloudDown);\r\n\r\n this.showSubjectBox();\r\n\r\n this.insideAddEventListener();\r\n }\r\n\r\n private insideAddEventListener(){\r\n engine.globalEvent.addEventListener('changeCount', this.changeCount, this);\r\n }\r\n\r\n\r\n private showSubjectBox(){\r\n let tmpContainer = new engine.Container();\r\n tmpContainer.x = 0;\r\n tmpContainer.y = props.subjectBox_Y;\r\n this.addChild(tmpContainer);\r\n\r\n //题目栏\r\n let subjectBox = this._subjectBox = new engine.Image(getTextureByName('题目栏'))\r\n subjectBox.x = (750 - subjectBox.width)/2;\r\n subjectBox.y = 0;\r\n tmpContainer.addChild(subjectBox);\r\n\r\n //倒计时\r\n let countDownBg = this._countDownBg = new engine.Image(getTextureByName('倒计时'))\r\n countDownBg.x = (750-countDownBg.width) / 2;\r\n countDownBg.y = - countDownBg.height/2 + 10;\r\n tmpContainer.addChild(countDownBg);\r\n\r\n let answerCountBg = this._answerCountBg = new engine.Image(getTextureByName('答对题数'))\r\n answerCountBg.x = (750-answerCountBg.width)/2;\r\n answerCountBg.y = subjectBox.y + subjectBox.height - answerCountBg.height -10\r\n tmpContainer.addChild(answerCountBg);\r\n\r\n let answerCountText = this._answerCountText = new engine.Label();\r\n answerCountText.fillColor = 0x2b3134;\r\n\t\tanswerCountText.size = 30;\r\n\t\tanswerCountText.width = answerCountBg.width;\r\n\t\tanswerCountText.height = answerCountBg.height;\r\n\t\tanswerCountText.verticalAlign = engine.VERTICAL_ALIGN.MIDDLE;\r\n\t\tanswerCountText.x = 160;\r\n answerCountText.y = 3;\r\n answerCountText.text = '0';\r\n answerCountBg.addChild(answerCountText);\r\n }\r\n //更新答对题数\r\n private changeCount(data){\r\n this._answerCountText.text = data.data.count+'';\r\n }\r\n\r\n}","\r\nimport { props } from '../props';\r\nimport {getTextureByName} from \"./utils\";\r\n\r\nexport class SvgaManager {\r\n\r\n public static createSvga(name) {\r\n let inst = new svga.Svga();\r\n inst.source = engine.getAssetByName(name).uuid;\r\n // let anchor = props[(anchorName)];\r\n // if (anchor) {\r\n // \tinst.x = -anchor.x;\r\n // \tinst.y = -anchor.y;\r\n \r\n // \tinst.anchorX = anchor.x;\r\n // \tinst.anchorY = anchor.y;\r\n // }\r\n return inst;\r\n }\r\n \r\n public static play(svga,callBack?){\r\n if(!svga){console.log('svga节点出错');return;}\r\n svga.gotoAndStop(0);\r\n svga.play();\r\n if(callBack){\r\n svga.addEventListener(engine.Event.END_FRAME,()=>{\r\n svga.stop();\r\n callBack();\r\n svga.removeAllEventListener();\r\n },this) \r\n }\r\n }\r\n\r\n public static stop(svga){\r\n if(!svga){console.log('svga节点出错');return;}\r\n svga.stop();\r\n }\r\n}","\r\n\r\n\r\nimport { props } from '../props';\r\n\r\n\r\nimport { getTextureByName, GameState, getStage } from \"./utils\";\r\nimport { SvgaManager } from './SvgaManager';\r\n\r\n\r\nexport class SubjectTitle extends engine.Container {\r\n\r\n private _subjectTitleBox;//题目框\r\n private _titleLabel;//题目文字\r\n private _titleNumLabel;//当前题数文字\r\n private _countDownBg;//倒计时\r\n private _countDownText;//倒计时数字\r\n private _answerCountBg;//答对题数背景\r\n private _answerCountText;//答对题数\r\n private _bar;//倒计时进度条\r\n private _frameCurrAngle = 0;//累加\r\n private _frameCount = 0;//帧数记录\r\n private _countDownTmp = 0;//倒计时处理\r\n\r\n\r\n private _readyGo;//svga节点\r\n private _questionEnter;//svga节点\r\n private _square = new engine.Graphics();\r\n\r\n private _countDownSvga;\r\n init() {\r\n this.showSubjectBox();\r\n this.insideAddEventListener();\r\n\r\n }\r\n initCountDownSvga(tmpNode) {\r\n let countDownSvga = this._countDownSvga = SvgaManager.createSvga('countdown_321');\r\n countDownSvga.x = (getStage().width - 120) / 2;\r\n countDownSvga.y = (getStage().height - 120) / 2;\r\n countDownSvga.visible = false;\r\n tmpNode.addChild(countDownSvga);\r\n }\r\n\r\n private insideAddEventListener() {\r\n //更新题目\r\n engine.globalEvent.addEventListener('updateSubjectTitle', this.updateSubjectTitle, this)\r\n //更新答对题数\r\n engine.globalEvent.addEventListener('updateAnswerCount', this.updateAnswerCount, this);\r\n\r\n engine.globalEvent.addEventListener('resetTitle', this.reset, this);\r\n engine.globalEvent.addEventListener('outRest',this.outRest,this);\r\n }\r\n //初始化答题区域\r\n private showSubjectBox() {\r\n let tmpContainer = new engine.Container();\r\n tmpContainer.x = 0;\r\n tmpContainer.y = props.subjectBox_Y;\r\n this.addChild(tmpContainer);\r\n\r\n //题目栏\r\n let subjectBox = this._subjectTitleBox = new engine.Image(getTextureByName('题目栏'))\r\n subjectBox.x = (750 - subjectBox.width) / 2;\r\n subjectBox.y = 0;\r\n tmpContainer.addChild(subjectBox);\r\n\r\n\r\n //倒计时\r\n let countDownBg = this._countDownBg = new engine.Image(getTextureByName('倒计时'))\r\n countDownBg.x = (750 - countDownBg.width) / 2;\r\n countDownBg.y = - countDownBg.height / 2 + 10;\r\n tmpContainer.addChild(countDownBg);\r\n\r\n let bar = this._bar = new engine.Image(getTextureByName('进度条'))\r\n bar.x = 0;\r\n bar.y = 0;\r\n countDownBg.addChild(bar);\r\n bar.anchorX = bar.width / 2;\r\n bar.anchorY = bar.height / 2;\r\n bar.rotation = -90;\r\n bar.addChild(this._square);\r\n\r\n bar.mask = this._square;\r\n\r\n let answerCountBg = this._answerCountBg = new engine.Image(getTextureByName('答对题数'))\r\n answerCountBg.x = (750 - answerCountBg.width) / 2;\r\n answerCountBg.y = subjectBox.y + subjectBox.height - answerCountBg.height - 10\r\n tmpContainer.addChild(answerCountBg);\r\n\r\n this.initCountDownBar(0);\r\n this.initAnswerCountText();\r\n this.initCountDownText();\r\n this.initTitleText();\r\n this.initSvga();\r\n }\r\n //初始化倒计时数字\r\n private initCountDownText() {\r\n // let countDownText = this._countDownText = new engine.Label();\r\n // countDownText.fillColor = 0xfffcc6;\r\n // countDownText.size = 58;\r\n // countDownText.width = this._countDownBg.width;\r\n // countDownText.height = this._countDownBg.height;\r\n // countDownText.verticalAlign = engine.VERTICAL_ALIGN.MIDDLE;\r\n // countDownText.textAlign = engine.TEXT_ALIGN.CENTER;\r\n // countDownText.x = 0;\r\n // countDownText.y = 0;\r\n // countDownText.text = props.countDown;\r\n // this._countDownBg.addChild(countDownText);\r\n // this._countDownTmp = props.countDown;\r\n\r\n let countDownText = this._countDownText = new engine.BitmapText();\r\n countDownText.font = props.fontName;\r\n countDownText.text = props.countDown;\r\n this.handleAlign();\r\n this._countDownBg.addChild(countDownText);\r\n this._countDownTmp = props.countDown;\r\n\r\n }\r\n private handleAlign() {\r\n this._countDownText.x = (this._countDownBg.width - this._countDownText.width) / 2;\r\n this._countDownText.y = (this._countDownBg.height - this._countDownText.height) / 2;;\r\n }\r\n private countDownBitmapText() {\r\n let countDownString = props.countDown + '';\r\n for (let index = 0; index < countDownString.length; index++) {\r\n const element = countDownString[index];\r\n\r\n }\r\n }\r\n //初始化答对题目数字\r\n private initAnswerCountText() {\r\n let answerCountText = this._answerCountText = new engine.Label();\r\n answerCountText.fillColor = 0x2b3134;\r\n answerCountText.size = 30;\r\n answerCountText.width = this._answerCountBg.width;\r\n answerCountText.height = this._answerCountBg.height;\r\n answerCountText.verticalAlign = engine.VERTICAL_ALIGN.MIDDLE;\r\n answerCountText.x = 160;\r\n answerCountText.y = props.answerCountText_Y;\r\n answerCountText.text = '0';\r\n this._answerCountBg.addChild(answerCountText);\r\n }\r\n\r\n //初始化题目\r\n private initTitleText() {\r\n let titleLabel = this._titleLabel = new engine.Label();\r\n titleLabel.fillColor = 0xfffcc6;\r\n titleLabel.size = 36;\r\n titleLabel.width = this._subjectTitleBox.width - props.titleText_width;\r\n titleLabel.height = this._subjectTitleBox.height - props.titleText_height;\r\n titleLabel.lineType = engine.TEXT_lINETYPE.MULTI;\r\n titleLabel.verticalAlign = engine.VERTICAL_ALIGN.MIDDLE;\r\n titleLabel.textAlign = engine.TEXT_ALIGN.CENTER;\r\n titleLabel.x = props.titleText_X;\r\n titleLabel.y = props.titleText_Y;\r\n titleLabel.text = '';\r\n titleLabel.alpha = 0;\r\n this._subjectTitleBox.addChild(titleLabel);\r\n }\r\n //初始化 题数标识\r\n private initTitleNumText(tmpContainer) {\r\n let titleNumLabel = this._titleNumLabel = new engine.Label();\r\n titleNumLabel.fillColor = 0xfffcc6;\r\n titleNumLabel.size = 48;\r\n titleNumLabel.width = tmpContainer.width;\r\n titleNumLabel.height = tmpContainer.heigth;\r\n titleNumLabel.verticalAlign = engine.VERTICAL_ALIGN.MIDDLE;\r\n titleNumLabel.textAlign = engine.TEXT_ALIGN.CENTER;\r\n // titleNumLabel.x = 90;\r\n // titleNumLabel.y = 85;\r\n titleNumLabel.text = '';\r\n titleNumLabel.visible = false;\r\n tmpContainer.addChild(titleNumLabel);\r\n }\r\n //更新当前题数\r\n private updateTitleNumText(curSubJect) {\r\n this.rest();\r\n this._titleNumLabel.text = `第${curSubJect}题`;\r\n }\r\n private reset() {\r\n this._titleLabel.text = '';\r\n }\r\n //更新题目\r\n private updateSubjectTitle(tmpData) {\r\n this._titleLabel.alpha = 0;\r\n this._titleLabel.text = tmpData.data.title;\r\n this.lastTime = 0;\r\n this.updateTitleNumText(tmpData.data.curSubJect + 1);\r\n if (tmpData.data.curSubJect == 0) {\r\n this.fristAnswer();\r\n } else {\r\n this.playQuestion_enter();\r\n }\r\n }\r\n //更新答对题数\r\n private updateAnswerCount(data) {\r\n this._answerCountText.text = data.data.count + '';\r\n }\r\n //更新倒计时\r\n private updateCountDownText(count) {\r\n this._countDownText.text = count + '';\r\n this.handleAlign();\r\n }\r\n //开启倒计时进度条\r\n private openCountDownBar() {\r\n this.rest();\r\n engine.gameStage.addEventListener(engine.Event.ENTER_FRAME, this.countDownBar, this)\r\n }\r\n //更新进度条\r\n private initCountDownBar(currAngle) {\r\n\r\n let ax = this._bar.width / 2;\r\n let ay = this._bar.height / 2;\r\n\r\n this._square.clear();\r\n this._square.beginFill(0);\r\n this._square.moveTo(ax, ay);\r\n this._square.arc(ax, ay, this._bar.width / 2, 0, (currAngle * Math.PI / 180))\r\n this._square.lineTo(ax, ay);\r\n this._square.endFill();\r\n }\r\n //帧处理 \r\n private lastTime;\r\n private countDownBar() {\r\n var now = Date.now();\r\n var deltaTime = this.lastTime ? now - this.lastTime : 16.7;\r\n this.lastTime = now;\r\n\r\n this._frameCurrAngle += 360 / (props.countDown * 1000) * deltaTime;\r\n this._frameCurrAngle = Math.min(360, this._frameCurrAngle);\r\n this.initCountDownBar(this._frameCurrAngle);\r\n\r\n this._frameCount += deltaTime;\r\n if (this._frameCount >= 1000) {\r\n let tmpTime = this._countDownTmp - 1 > 0 ? this._countDownTmp -= 1 : 0;\r\n if (tmpTime == 3) {\r\n this.playCountDownSvga();\r\n }\r\n this.updateCountDownText(tmpTime);\r\n this._frameCount = 0;\r\n\r\n if (this._frameCurrAngle >= 360) {\r\n engine.gameStage.removeEventListener(engine.Event.ENTER_FRAME, this.countDownBar, this)\r\n engine.globalEvent.dispatchEvent('upDateGameState', { gameState: GameState.STATE_END });\r\n engine.globalEvent.dispatchEvent('sendAnswer')\r\n }\r\n }\r\n }\r\n private rest() {\r\n this._frameCurrAngle = 0;\r\n this._frameCount = 0;\r\n this._square.clear();\r\n this._countDownTmp = props.countDown;\r\n this._countDownText.text = props.countDown + '';\r\n this.handleAlign();\r\n //this._readyGo.visible = false;\r\n //this._countDownSvga.visible = false;\r\n //this._questionEnter.visible = false;\r\n //engine.gameStage.removeEventListener(engine.Event.ENTER_FRAME, this.countDownBar, this)\r\n }\r\n outRest(){\r\n this._frameCurrAngle = 0;\r\n this._frameCount = 0;\r\n this._square.clear();\r\n this._countDownTmp = props.countDown;\r\n this._countDownText.text = props.countDown + '';\r\n this.handleAlign();\r\n this._readyGo.visible = false;\r\n this._countDownSvga.visible = false;\r\n this._questionEnter.visible = false;\r\n engine.gameStage.removeEventListener(engine.Event.ENTER_FRAME, this.countDownBar, this)\r\n }\r\n initSvga() {\r\n let readyGo = this._readyGo = SvgaManager.createSvga('ready_go');\r\n readyGo.x = 50;\r\n readyGo.y = 45;\r\n readyGo.visible = false;\r\n this._subjectTitleBox.addChild(readyGo);\r\n\r\n let tmpRect = new engine.Rect();\r\n tmpRect.x = 50\r\n tmpRect.y = 45;\r\n tmpRect.width = 520;\r\n tmpRect.height = 200;\r\n this._subjectTitleBox.addChild(tmpRect);\r\n readyGo.mask = tmpRect;\r\n\r\n let tmpContainer = new engine.Container();\r\n tmpContainer.width = 400;\r\n tmpContainer.height = 100;\r\n tmpContainer.x = (this._subjectTitleBox.width - 400) / 2;\r\n tmpContainer.y = 115;\r\n this._subjectTitleBox.addChild(tmpContainer);\r\n\r\n let questionEnter = this._questionEnter = SvgaManager.createSvga('question_enter');\r\n questionEnter.x = 0;\r\n questionEnter.y = 0;\r\n questionEnter.visible = false;\r\n tmpContainer.addChild(questionEnter);\r\n\r\n this.initTitleNumText(tmpContainer);\r\n\r\n\r\n }\r\n fristAnswer() {\r\n this.playReadyGo();\r\n }\r\n playReadyGo() {\r\n this._readyGo.visible = true;\r\n SvgaManager.play(this._readyGo, () => {\r\n this._readyGo.visible = false;\r\n this.playQuestion_enter();\r\n });\r\n }\r\n playQuestion_enter() {\r\n this._questionEnter.visible = true;\r\n this._titleNumLabel.visible = true;\r\n // return;\r\n SvgaManager.play(this._questionEnter, () => {\r\n this._questionEnter.visible = false;\r\n //this._titleLabel.visible = true;\r\n this.playTweenTitle();\r\n this._titleNumLabel.visible = false;\r\n this.openCountDownBar();\r\n //如果初始倒计时为3秒\r\n if (this._countDownTmp == 3) {\r\n this.playCountDownSvga();\r\n }\r\n engine.globalEvent.dispatchEvent('start');\r\n });\r\n }\r\n playTweenTitle() {\r\n engine.Tween.get(this._titleLabel, { loop: false })\r\n .set({ alpha: 0 })\r\n .to({ alpha: 1 }, 500, engine.Ease.cubicIn)\r\n .call(() => {\r\n engine.Tween.removeTweens(this._titleLabel);\r\n })\r\n }\r\n playCountDownSvga() {\r\n console.log('测试次数');\r\n this._countDownSvga.visible = true;\r\n this._countDownSvga.lockStep = true;\r\n SvgaManager.play(this._countDownSvga, () => {\r\n this._countDownSvga.visible = false;\r\n });\r\n }\r\n}","\r\nimport { props } from '../props';\r\nimport {getTextureByName, OptionState, GameState} from \"./utils\";\r\nimport { SvgaManager } from './SvgaManager';\r\n\r\nexport class AnswerArea extends engine.Container{\r\n private _area;//答题区域\r\n private _optionA;//选项A\r\n private _optionB;//选项A\r\n private _optionC;//选项A\r\n private _optionD;//选项A\r\n\r\n private _optionArray=[];//选项节点\r\n\r\n //懒得按选项节点查询处理 故在创建的时候 用对应的数组处理\r\n private _choiceWrong = [];//选错状态的节点数组\r\n private _choiceRight = [];//选对状态的节点数组\r\n private _choiceSelect = [];//选中状态的数组\r\n\r\n private _answerArray=['A','B','C','D'];\r\n private _answer = -1;//用户选择的选项\r\n\r\n private _gameState;\r\n private _people;//人物svga\r\n\r\n private _svgaArrayName = [];//答题后的动效\r\n private _randomSvga;//随机播放对应的svga动效\r\n private _right_mona;//回答正确的节点\r\n \r\n private _trueAnswer;//正确答案\r\n private _mona_confuse;//未选择答案 问号svga\r\n\r\n private _svgaPlayState;\r\n init(){\r\n let area = this._area = new engine.Container();\r\n area.x = 0;\r\n area.y = 0;\r\n this._gameState = GameState.STATE_END;\r\n\r\n this.addChild(area);\r\n this.initSvgaArray();\r\n this.initAnswerOption();\r\n this.initPeople();\r\n this.insideAddEventListener();\r\n }\r\n private initSvgaArray(){\r\n this.setSvgaName('rian_mona','rian_weather');\r\n this.setSvgaName('snow_mona','snow_weather');\r\n this.setSvgaName('thunder_mona','thunder_weather');\r\n this.setSvgaName('wind_mona','wind_weather');\r\n }\r\n\r\n private setSvgaName(peopleName,scene){\r\n let tmpSvgaName:any = {};\r\n tmpSvgaName.people = peopleName;\r\n tmpSvgaName.scene = scene;\r\n this._svgaArrayName.push(tmpSvgaName);\r\n }\r\n\r\n\r\n private insideAddEventListener(){\r\n //更新答案选项\r\n engine.globalEvent.addEventListener('updateOption',this.updateOption,this)\r\n //答题结果\r\n engine.globalEvent.addEventListener('handleAnswerOption',this.handleAnswerOption,this);\r\n //更新游戏状态\r\n engine.globalEvent.addEventListener('upDateGameState',this.upDateGameState,this);\r\n //开始答题 可选\r\n engine.globalEvent.addEventListener('start',this.start,this);\r\n //提交答案\r\n engine.globalEvent.addEventListener('sendAnswer',this.sendAnswer,this);\r\n engine.globalEvent.addEventListener('outRest',this.rest,this);\r\n //开始答题\r\n //engine.globalEvent.addEventListener('startAnswer',this.startAnswer,this)\r\n\r\n }\r\n \r\n private initPeople(){\r\n let people = this._people = SvgaManager.createSvga('mona_walk');\r\n people.x = props.people_X;\r\n people.y = props.people_Y;\r\n this._area.addChild(people);\r\n SvgaManager.play(people);\r\n\r\n let mona_confuse = this._mona_confuse = SvgaManager.createSvga('mona_confuse');\r\n mona_confuse.x = props.people_X;\r\n mona_confuse.y = props.people_Y;\r\n mona_confuse.visible = false;\r\n this._area.addChild(mona_confuse);\r\n\r\n //people.gotoAndStop(1);\r\n }\r\n public getArea(){\r\n return this._area;\r\n }\r\n\r\n //初始化选项\r\n private initAnswerOption(){\r\n let optionA = this._optionA = new engine.Image(getTextureByName('选区'))\r\n optionA.x = (750 - (optionA.width*2 + 30)) / 2;\r\n optionA.y = props.answerArea_Y;\r\n optionA.name = 'A';\r\n optionA.alpha = 0;\r\n this._area.addChild(optionA);\r\n this._optionArray.push(optionA);\r\n\r\n let optionB = this._optionB = new engine.Image(getTextureByName('选区'))\r\n optionB.x = optionA.x + optionA.width + 30;\r\n optionB.y = optionA.y;\r\n optionB.name = 'B';\r\n optionB.alpha = 0;\r\n this._area.addChild(optionB);\r\n this._optionArray.push(optionB);\r\n\r\n let optionC = this._optionC = new engine.Image(getTextureByName('选区'))\r\n optionC.x = optionA.x;\r\n optionC.y = optionA.y + optionA.height + props.option_spaceY;\r\n optionC.name = 'C';\r\n optionC.alpha = 0;\r\n this._area.addChild(optionC);\r\n this._optionArray.push(optionC);\r\n\r\n let optionD = this._optionD = new engine.Image(getTextureByName('选区'))\r\n optionD.x = optionB.x;\r\n optionD.y = optionC.y;\r\n optionD.name = 'D';\r\n optionD.alpha = 0;\r\n this._area.addChild(optionD);\r\n this._optionArray.push(optionD);\r\n \r\n\r\n this.initOptionState();\r\n this.initAddEventListener();\r\n this.initSvga(optionA);\r\n this.initSvga(optionB);\r\n this.initSvga(optionC);\r\n this.initSvga(optionD);\r\n\r\n // setTimeout(() => {\r\n // this.handleWrong();\r\n // }, 1000);\r\n }\r\n //初始化svga节点\r\n private initSvga(tmpNode){\r\n this.initSvgaNode('right_mona',tmpNode);\r\n for (let index = 0; index < this._svgaArrayName.length; index++) {\r\n let element = this._svgaArrayName[index];\r\n this.initSvgaNode(element.people,tmpNode);\r\n this.initSvgaNode(element.scene,tmpNode);\r\n }\r\n }\r\n private initSvgaNode(svgaName,tmpNode){\r\n let tmpSvga = SvgaManager.createSvga(svgaName);\r\n tmpSvga.x = -30;\r\n tmpSvga.y = -105;\r\n tmpSvga.visible = false;\r\n tmpSvga.name = svgaName;\r\n tmpNode.addChild(tmpSvga);\r\n }\r\n\r\n private initAddEventListener(){\r\n for (let index = 0; index < this._optionArray.length; index++) {\r\n const element = this._optionArray[index];\r\n element.addEventListener(engine.MouseEvent.CLICK,this.selectOption,this);\r\n }\r\n }\r\n //初始化 答案字体\r\n private optionLabel(parent){\r\n let answerText = new engine.Label();\r\n //answerText.font = 'OPPOSans_J';\r\n answerText.fillColor = 0x164b81;\r\n answerText.bold = true;\r\n //answerText.strokeColor = '#164b81';\r\n //answerText.stroke = 4;\r\n\t\tanswerText.size = 30;\r\n\t\tanswerText.width = parent.width;\r\n\t\tanswerText.height = parent.height;\r\n\t\tanswerText.textAlign = engine.TEXT_ALIGN.CENTER;\r\n\t\tanswerText.x = 0;\r\n answerText.y = 0.75*answerText.height;\r\n answerText.text = '';\r\n answerText.name = 'answerText';\r\n \r\n return answerText;\r\n }\r\n\r\n\r\n //初始化选项 选中-选错-选对 状态\r\n private initOptionState(){\r\n for(let i=0; i<this._optionArray.length;i++){\r\n let tmpNode = this._optionArray[i];\r\n tmpNode.addChild(this.getChoiceStateImg('选中',OptionState.CHOICE_SELECT,tmpNode.name));\r\n tmpNode.addChild(this.getChoiceStateImg('选错',OptionState.CHOICE_WRONG,tmpNode.name));\r\n tmpNode.addChild(this.getChoiceStateImg('选对',OptionState.CHOICE_RIGHT,tmpNode.name));\r\n tmpNode.addChild(this.optionLabel(tmpNode))\r\n \r\n }\r\n }\r\n //获取图片资源\r\n private getChoiceStateImg(imgName,imgType,imgAnswer){\r\n let choiceImage = new engine.Image(getTextureByName(imgName));\r\n choiceImage.x = 0;\r\n choiceImage.y = 0;\r\n choiceImage['type'] = imgType;\r\n choiceImage['imgAnswer'] = imgAnswer;\r\n choiceImage.visible = false;\r\n switch (imgType) {\r\n case OptionState.CHOICE_WRONG:\r\n this._choiceWrong.push(choiceImage);\r\n break;\r\n case OptionState.CHOICE_RIGHT:\r\n this._choiceRight.push(choiceImage);\r\n break;\r\n case OptionState.CHOICE_SELECT:\r\n this._choiceSelect.push(choiceImage);\r\n break; \r\n default:\r\n break;\r\n }\r\n return choiceImage;\r\n }\r\n //选中答案\r\n private selectOption(event: engine.Event){\r\n if(this._gameState != GameState.STATE_START || this._svgaPlayState == GameState.STATE_START){\r\n console.log('暂时不能答题');\r\n return;\r\n }\r\n this._gameState = GameState.STATE_END;\r\n this.handleSelect(event.target.name);\r\n this.peopleMove(event.target.x-30,event.target.y-110,false);\r\n\r\n this._answer = this._answerArray.indexOf(event.target.name);\r\n console.log('点击选择选项',event.target.name,this._answer);\r\n }\r\n //人物移动\r\n peopleMove(moveX,moveY,isPlaySVGA){\r\n let tmpX = moveX;\r\n let tmpY = moveY;\r\n engine.Tween.get(this._people,{loop:false})\r\n .to({x:tmpX,y:tmpY},500,engine.Ease.cubicInOut)\r\n .call(()=>{\r\n this._gameState = GameState.STATE_START;\r\n if(isPlaySVGA){\r\n SvgaManager.play(this._people);\r\n engine.globalEvent.dispatchEvent('updateSubject');\r\n }\r\n })\r\n }\r\n\r\n //重置人物位置\r\n rest(){\r\n this._answer = -1;\r\n if(this._right_mona){\r\n SvgaManager.stop(this._right_mona);\r\n this._right_mona.visible = false;\r\n }\r\n this._people.visible = true;\r\n this._mona_confuse.visible = false;\r\n \r\n this.peopleMove(props.people_X,props.people_Y,true);\r\n\r\n this.handleRight();\r\n this.handleWrong();\r\n this.handleSelect();\r\n this.optionsShow(false);\r\n engine.globalEvent.dispatchEvent('resetTitle');\r\n\r\n }\r\n\r\n private optionsShow(isShow){\r\n for (let index = 0; index < this._optionArray.length; index++) {\r\n const element = this._optionArray[index];\r\n let tmpAlpha = isShow?1:0;\r\n this.optionIsShowTween(element,tmpAlpha);\r\n }\r\n }\r\n //选项渐入渐出效果\r\n private optionIsShowTween(tweenNode,tmpAlpha){\r\n engine.Tween.get(tweenNode,{loop:false})\r\n .to({alpha:tmpAlpha},500)\r\n }\r\n //处理选中状态\r\n private handleSelect(select?){\r\n for (let index = 0; index < this._choiceSelect.length; index++) {\r\n let element = this._choiceSelect[index];\r\n if(!select){\r\n element.visible = false;\r\n continue;\r\n }\r\n if(element['imgAnswer'] === select){\r\n element.visible = true;\r\n continue;\r\n }\r\n element.visible = false;\r\n }\r\n }\r\n //正确答案展示\r\n private handleRight(select = ''){\r\n for (let index = 0; index < this._choiceRight.length; index++) {\r\n let element = this._choiceRight[index];\r\n if(select == ''){\r\n element.visible = false;\r\n continue;\r\n }\r\n if(element['imgAnswer'] === select){\r\n element.visible = true;\r\n continue;\r\n }\r\n element.visible = false;\r\n \r\n }\r\n }\r\n //错误答案展示\r\n private handleWrong(select?){\r\n let count = 0;\r\n for (let index = 0; index < this._choiceWrong.length; index++) {\r\n let element = this._choiceWrong[index];\r\n if(!select){\r\n element.visible = false;\r\n this.hideSvga(element);\r\n continue;\r\n }\r\n if(element['imgAnswer'] == select){\r\n element.visible = false;\r\n continue;\r\n }\r\n count++;\r\n element.visible = true;\r\n this.playWrongTween(element,(count == this._choiceWrong.length-1));\r\n }\r\n }\r\n private hideSvga(svgaNode){\r\n svgaNode.parent.children.forEach(element => {\r\n if(element._instanceType == 'MovieClip')\r\n {\r\n element.visible = false;\r\n }\r\n });\r\n }\r\n playWrongTween(tweenNode,isLast){\r\n engine.Tween.get(tweenNode,{loop:false})\r\n .wait(460)\r\n .to({alpha:0.3},160,engine.Ease.circInOut)\r\n .to({alpha:1},160,engine.Ease.circInOut)\r\n .to({alpha:0.3},160,engine.Ease.circInOut)\r\n .to({alpha:1},160,engine.Ease.circInOut)\r\n .call(()=>{\r\n engine.Tween.removeTweens(tweenNode);\r\n if(isLast){\r\n if(this._answer >= 0){\r\n this._people.visible = false;\r\n this.handleSeceltRight();\r\n this.handleSeceltError();\r\n }else{\r\n this._people.visible = false;\r\n this._mona_confuse.visible = true;\r\n SvgaManager.play(this._mona_confuse,()=>{\r\n this.rest();\r\n });\r\n }\r\n\r\n }\r\n })\r\n }\r\n\r\n //播放对应的人物动效\r\n playResultSvga(svgaNode,isLast,isShowPeople){\r\n let svgaData =this._svgaArrayName[this._randomSvga-1]; \r\n if(isShowPeople){\r\n let peopleNode = this.getSvgaNode(svgaNode,svgaData.people);\r\n this.playSvga(peopleNode);\r\n }\r\n let sceneNode = this.getSvgaNode(svgaNode,svgaData.scene);\r\n this.playSvga(sceneNode,()=>{\r\n if(isLast)this.rest();\r\n });\r\n }\r\n private getSvgaNode(svgaNode,svgaName){\r\n let tmp = svgaNode.getChildByName(svgaName);\r\n if(!tmp){console.log('svga节点未找到');return}\r\n return tmp\r\n }\r\n //播放svga\r\n playSvga(svgaNode,callBack?){\r\n svgaNode.visible = true;\r\n SvgaManager.play(svgaNode,()=>{\r\n svgaNode.visible = false;\r\n if(callBack)callBack();\r\n });\r\n }\r\n\r\n //更新选项\r\n private updateOption(optionData){\r\n this._randomSvga = Math.floor(Math.random()*(this._svgaArrayName.length)+1);\r\n\r\n let tmpOptionData = optionData.data.options;\r\n for (let index = 0; index < tmpOptionData.length; index++) {\r\n let element = tmpOptionData[index];\r\n this._optionArray[index].getChildByName('answerText').text = element;\r\n }\r\n }\r\n //答案\r\n private handleAnswerOption(result){\r\n //SvgaManager.stop(this._people);\r\n this._people.gotoAndStop(1)\r\n\r\n let trueAnswer = this._trueAnswer = result.data.state;\r\n\r\n this.handleRight(this._answerArray[trueAnswer]);\r\n this.handleWrong(this._answerArray[trueAnswer]);\r\n this.handleSelect();\r\n this._svgaPlayState = GameState.STATE_START;\r\n //处理动效\r\n }\r\n\r\n private handleSeceltRight(){\r\n //if(this._gameState == GameState.STATE_START)return;\r\n\r\n for (let index = 0; index < this._optionArray.length; index++) {\r\n let element = this._optionArray[index];\r\n if(element.name == this._answerArray[this._answer] && this._trueAnswer == this._answer){\r\n this._right_mona = this.getSvgaNode(element,'right_mona')\r\n if(this._right_mona){\r\n this._right_mona.visible = true;\r\n SvgaManager.play(this._right_mona);\r\n }\r\n }\r\n }\r\n }\r\n private handleSeceltError(){\r\n //if(this._gameState == GameState.STATE_START)return;\r\n \r\n let tmpNum = 0;\r\n for (let index = 0; index < this._optionArray.length; index++) {\r\n let element = this._optionArray[index];\r\n if(element.name != this._answerArray[this._trueAnswer]){\r\n tmpNum++;\r\n let isShowPeople = false;\r\n if(element.name == this._answerArray[this._answer]){\r\n isShowPeople = true;\r\n }\r\n this.playResultSvga(element,(tmpNum==3),isShowPeople);\r\n }\r\n }\r\n }\r\n\r\n //更新答题状态\r\n private upDateGameState(gameState){\r\n this._gameState = gameState.data.gameState;\r\n }\r\n\r\n private start(){\r\n this.optionsShow(true);\r\n this._gameState = GameState.STATE_START;\r\n this._svgaPlayState = GameState.STATE_END;\r\n }\r\n\r\n sendAnswer(){\r\n engine.globalEvent.dispatchEvent('sendAnswerResult',{answer:this._answer});\r\n }\r\n}","import { SubjectManager } from './SubjectManager';\r\n\r\n\r\n/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport {props} from \"../props\";\r\n\r\nimport { Background } from \"./Background\";\r\n\r\nimport { SubjectTitle } from \"./SubjectTitle\";\r\nimport { AnswerArea } from \"./answerArea\";\r\n\r\n\r\n\r\nexport default class GameView extends engine.Container {\r\n\r\n\t\r\n\tprivate _hasSetup;\r\n\tprivate _backgroud:Background;\r\n\tprivate _subject:SubjectTitle;\r\n\tprivate _answerArea:AnswerArea;\r\n\r\n\tprivate _subjectManager:SubjectManager;\r\n\tconstructor() {\r\n\t\tsuper();\t\r\n\t\t//this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\r\n\t}\r\n\tsetup(){\r\n\t\tif (this._hasSetup) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._hasSetup = true;\r\n\t\t\r\n\t\tlet backgroud = this._backgroud = new Background();\r\n\t\tthis.addChild(backgroud);\r\n\t\tbackgroud.init();\r\n\r\n\t\tlet subject = this._subject = new SubjectTitle();\r\n\t\tthis.addChild(subject);\r\n\t\tsubject.init();\r\n\r\n\t\tlet answerArea = this._answerArea = new AnswerArea();\r\n\t\tthis.addChild(answerArea);\r\n\t\tanswerArea.init();\r\n\r\n\t\tlet tmpContainer = new engine.Container();\r\n\t\tthis.addChildAt(tmpContainer,50);\r\n\t\tsubject.initCountDownSvga(tmpContainer);\r\n\r\n\t\t// let svgaManager = this._svgaManager = new SvgaManager();\r\n\t\t// this.addChild(svgaManager);\r\n\t\t// svgaManager.init(answerArea.getArea())\r\n\r\n\t\tlet subjectManager = this._subjectManager = new SubjectManager();\r\n\t\tsubjectManager.init();\t\r\n\t}\r\n\r\n\tasync start() {\r\n\t\tthis.setup();\r\n\t} \r\n\t\r\n}\r\n","\r\n\r\nimport { props } from './../props';\r\n\r\n\r\n/**\r\n * Created by rockyl on 2020-01-09.\r\n */\r\n\r\nimport GameView from \"./GameView\";\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\tprivate _gameView: GameView;\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tengine.globalEvent.addEventListener('answer-game-start', this.start, this);\r\n\r\n\t\tengine.globalEvent.addEventListener('answer-game-subject', this.initSubject, this);\r\n\r\n\t\tengine.globalEvent.addEventListener('answer-game-result', this.result, this);\r\n\t\tthis.visibilitychange();\r\n\r\n\t}\r\n\r\n\tstart(event: engine.Event) {\r\n\t\t//初始化传入的倒计时\r\n\t\tif(event.data.countDown){\r\n\t\t\tprops.countDown = event.data.countDown;\r\n\t\t}\r\n\t\t//未消除自定义模块节点 但执行了多次start事件处理\r\n\t\tif(!this._gameView){\r\n\t\t\tlet gameView = this._gameView = new GameView();\r\n\t\t\tthis.addChild(gameView);\r\n\t\t\tthis._gameView.start();\r\n\t\t}\r\n\t\tengine.globalEvent.dispatchEvent('reset')\r\n\t}\r\n\r\n\tinitSubject(event:engine.Event){\r\n\t\tlet subjectData = event.data.subjectData;\r\n\t\tengine.globalEvent.dispatchEvent('handleOption',subjectData);\r\n\t}\r\n\tresult(event:engine.Event){\r\n\t\tlet result = event.data.result;\r\n\t\tengine.globalEvent.dispatchEvent('handleResult',{result:result});\r\n\t}\r\n\r\n\tprivate visibilitychange(){\r\n\t\tdocument.addEventListener('visibilitychange', function () {\r\n if (document.visibilityState === 'hidden') {\r\n\t\t\t\tconsole.log('放置后台');\r\n\t\t\t\tengine.globalEvent.dispatchEvent('outRest')\r\n\t\t\t\tengine.globalEvent.dispatchEvent('answer-game-visibilitychange',{hidden:true});\r\n\r\n }\r\n });\r\n\t}\r\n}\r\n","/**\r\n * Created by rockyl on 2019-11-20.\r\n */\r\n\r\nimport {GameWrapper} from \"./game/GameWrapper\";\r\nimport {injectProps, prepareProps} from \"./props\";\r\n\r\nexport default function (props) {\r\n\tprepareProps();\r\n\tinjectProps(props);\r\n\r\n\tlet instance = new GameWrapper();\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;AAE3B,UAAgB,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;AAED,UAAgB,WAAW,CAAC,CAAC;KAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B,CAAC;;;CCZD;KAAA;SACa,gBAAW,GAAG,CAAC,CAAC;MAiE5B;KA7DG,6BAAI,GAAJ;SAEI,IAAI,CAAC,sBAAsB,EAAE,CAAC;MACjC;KACO,+CAAsB,GAA9B;SAEI,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,cAAc,EAAC,IAAI,CAAC,aAAa,EAAC,IAAI,CAAC,CAAA;SAE3E,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,eAAe,EAAC,IAAI,CAAC,aAAa,EAAC,IAAI,CAAC,CAAA;SAE5E,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,cAAc,EAAC,IAAI,CAAC,YAAY,EAAC,IAAI,CAAC,CAAA;SAE1E,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,kBAAkB,EAAC,IAAI,CAAC,gBAAgB,EAAC,IAAI,CAAC,CAAA;MAGrF;KAEO,sCAAa,GAArB,UAAsB,OAAO;SACzB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;SACrB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;SACnC,IAAI,CAAC,aAAa,EAAE,CAAC;SACrB,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,mBAAmB,EAAC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,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KACjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"}
\ No newline at end of file
src/custom/answer-game/debug/props.js
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2020-01-21.
*/
let
customModuleProps
=
{
};
src/custom/answer-game/meta.json
0 → 100644
View file @
81e5868b
{
"name"
:
"墨迹天气答题"
,
"desc"
:
"墨迹天气答题模块"
,
"props"
:
{
"guideText1"
:
{
"alias"
:
"引导1的文本"
,
"type"
:
"string"
,
"default"
:
"长按屏幕
\n
杆子变长即可通过"
},
"subjectBox_Y"
:{
"alias"
:
"题目栏的高度"
,
"type"
:
"number"
,
"default"
:
250
},
"countDown"
:{
"alias"
:
"倒计时时长"
,
"type"
:
"number"
,
"default"
:
8
},
"answerArea_Y"
:{
"alias"
:
"答案选项的高度"
,
"type"
:
"number"
,
"default"
:
770
},
"option_spaceX"
:{
"alias"
:
"答案横向间距"
,
"type"
:
"number"
,
"default"
:
30
},
"option_spaceY"
:{
"alias"
:
"答案纵向间距"
,
"type"
:
"number"
,
"default"
:
60
},
"people_X"
:{
"alias"
:
"人物横轴坐标"
,
"type"
:
"number"
,
"default"
:
200
},
"people_Y"
:{
"alias"
:
"人物横轴坐标"
,
"type"
:
"number"
,
"default"
:
460
},
"fontName"
:
{
"alias"
:
"字体名"
,
"type"
:
"string"
,
"default"
:
"countDown"
,
"desc"
:
"倒计时位图文字"
},
"answerCountText_Y"
:
{
"alias"
:
"初始化答对题目数字高度偏移"
,
"type"
:
"number"
,
"default"
:
10
},
"titleText_Y"
:
{
"alias"
:
"初始化题目纵向偏移量"
,
"type"
:
"number"
,
"default"
:
80
},
"titleText_X"
:
{
"alias"
:
"初始化题目横向偏移量"
,
"type"
:
"number"
,
"default"
:
0
},
"titleText_width"
:
{
"alias"
:
"初始化题目宽度偏移量"
,
"type"
:
"number"
,
"default"
:
80
},
"titleText_height"
:
{
"alias"
:
"初始化题目高度偏移量"
,
"type"
:
"number"
,
"default"
:
80
}
},
"assets"
:
[
{
"name"
:
"gameBg"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/3408205d00345c5ff4750d00848ec0a6f3d27a09.jpg"
,
"uuid"
:
"0f8d72a1-df66-4d1c-8d40-b550a89c5765"
,
"ext"
:
".jpg"
},
{
"name"
:
"前景云上"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/d13af0da7595aaecad75ae996bcb5ebee15aee29.png"
,
"uuid"
:
"c13aa22d-d946-463a-b619-b8d07420c532"
,
"ext"
:
".png"
},
{
"name"
:
"前景云下"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fad2f7f1df80eed162e804729cb8ca04d7ba74b2.png"
,
"uuid"
:
"9b3bc2ce-db1b-4362-a1eb-b821afffafee"
,
"ext"
:
".png"
},
{
"name"
:
"答案区"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/41b14735589a7c5ec118aeec2d63ed2e5cae6c2a.png"
,
"uuid"
:
"5e112c5d-e249-4d18-ac9f-1c75fba344f0"
,
"ext"
:
".png"
},
{
"name"
:
"答对题数"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/88c26c93c86b214afdd4265880ec5f684e44d26e.png"
,
"uuid"
:
"4f543cda-3600-41aa-b48c-d31a0cc2731b"
,
"ext"
:
".png"
},
{
"name"
:
"倒计时"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/722c4eacb1b4ee4f32048777827232496fcd13cc.png"
,
"uuid"
:
"5f7d9f3d-a73e-4576-af26-c0b60152416d"
,
"ext"
:
".png"
},
{
"name"
:
"题目栏"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/1f2138cefb4ee17dd97d54572bc4861391b8ed2b.png"
,
"uuid"
:
"fc29acd6-1468-4b3c-b022-bc29b85b661c"
,
"ext"
:
".png"
},
{
"name"
:
"进度条"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/e64ca0c0a0e1ee996aa3a81c9526bd4434fd0f76.png"
,
"uuid"
:
"8573cec9-a33d-4d9c-9bed-e8e35875a257"
,
"ext"
:
".png"
},
{
"name"
:
"选区"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5de49902aa2f2a214549c87a607e0198b5df8f1f.png"
,
"uuid"
:
"0597817b-adaa-4e95-9655-717869747613"
,
"ext"
:
".png"
},
{
"name"
:
"people"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b15b5859041564a13ef017949fe7adb5c52f26a1.png"
,
"uuid"
:
"3c28c565-9d43-4224-8753-b62341374ebc"
,
"ext"
:
".png"
},
{
"name"
:
"选错"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/0cf72d75829887eadf9619a1c69a6b81aabbe282.png"
,
"uuid"
:
"4b5de144-2a2c-47af-a52f-3d26b62bf3da"
,
"ext"
:
".png"
},
{
"name"
:
"选对"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fd817526a698076a227616c6830af3047b57d568.png"
,
"uuid"
:
"dfc6ed1a-bda1-4409-95c8-6402d3dbf434"
,
"ext"
:
".png"
},
{
"name"
:
"选中"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/bd55f089632280a3a88f24bd2b7f628ebe8be7ef.png"
,
"uuid"
:
"71a65180-c0d5-43e7-a4c5-226dd73cfcb5"
,
"ext"
:
".png"
},
{
"name"
:
"ready_go"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/79aa337faaf7370e099962deab32faad19e050bc.svga"
,
"uuid"
:
"eddacfce-898f-4373-8a6c-2b405943459b"
,
"ext"
:
".svga"
},
{
"name"
:
"question_enter"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a22af34bdb9a07f94ce091c049f0526b7bb70401.svga"
,
"uuid"
:
"1a03ff4b-5b95-4eda-bdd6-b168265ef99a"
,
"ext"
:
".svga"
},
{
"name"
:
"mona_walk"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/dc04372610bf9280913f90fc29752c3f86f71e19.svga"
,
"uuid"
:
"08356014-69ad-4f13-8516-1ca7cb8b3ba9"
,
"ext"
:
".svga"
},
{
"name"
:
"countdown_321"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/c95c03d4ab92f27d23facd24414aa7e25dc90f19.svga"
,
"uuid"
:
"c5e2e6e1-b281-46a9-8fc1-1c5e6b40f9a6"
,
"ext"
:
".svga"
},
{
"name"
:
"right_mona"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/dd714c036c549a6708ca1da8059afb098349f320.svga"
,
"uuid"
:
"5015efe5-d4ea-4a30-8cfb-34d264672e96"
,
"ext"
:
".svga"
},
{
"name"
:
"rian_mona"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/135a5e4e454ede9ad9a8257bf38c2cd75f6b526e.svga"
,
"uuid"
:
"d33fa677-3c78-4814-94a5-2ee0bde27d35"
,
"ext"
:
".svga"
},
{
"name"
:
"rian_weather"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/87d422f1ef4260ec68d712774c5846cd440c8896.svga"
,
"uuid"
:
"25ae7480-bcae-4472-8d2c-9bf0c2930160"
,
"ext"
:
".svga"
},
{
"name"
:
"snow_mona"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8f0342a9fc7a25fd638b38432df4a3fa153438eb.svga"
,
"uuid"
:
"b7cfa0b9-356b-42dc-8822-be0fb9587d3f"
,
"ext"
:
".svga"
},
{
"name"
:
"snow_weather"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/586d926dd66b9d893297f5ec32f4229a0d30cb0e.svga"
,
"uuid"
:
"8632eb42-f43e-44a7-be18-c3688a60f09b"
,
"ext"
:
".svga"
},
{
"name"
:
"thunder_mona"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/57d05bf3268b7f2b1972dfe848fb2739105a05de.svga"
,
"uuid"
:
"59011678-c782-4e24-9fe6-89013d391a5e"
,
"ext"
:
".svga"
},
{
"name"
:
"thunder_weather"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/3a10f54df8b2dbb31b579b221efc322831dfffb2.svga"
,
"uuid"
:
"924a2a1e-28fb-41d5-8447-3cb6eefdd213"
,
"ext"
:
".svga"
},
{
"name"
:
"wind_mona"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/d574675633444a9cd5024babdf3afb2461092805.svga"
,
"uuid"
:
"314771ba-f5d3-482d-b3d8-5dbb311b0b94"
,
"ext"
:
".svga"
},
{
"name"
:
"wind_weather"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/42892471c92f91830fc37262a262079bd82b3e06.svga"
,
"uuid"
:
"fb7009e0-7d07-4811-ace3-162a210d4f1e"
,
"ext"
:
".svga"
},
{
"name"
:
"mona_confuse"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/543b9faf2cd1584b63bcad41ba6759dbd3ccd1db.svga"
,
"uuid"
:
"b8035737-9913-45ce-8e40-833ce0777c34"
,
"ext"
:
".svga"
}
],
"events"
:
{
"in"
:
{
"answer-game-start"
:
{
"alias"
:
"开始"
,
"data"
:
{
}
},
"answer-game-subject"
:
{
"alias"
:
"题目数据"
,
"data"
:
{
}
},
"answer-game-result"
:
{
"alias"
:
"答案结果"
,
"data"
:
{
}
}
},
"out"
:
{
"answer-game-select"
:
{
"alias"
:
"选择的答案"
,
"data"
:
{
}
},
"answer-game-over"
:
{
"alias"
:
"结束答题"
,
"data"
:
{
}
},
"answer-game-visibilitychange"
:
{
"alias"
:
"当前界面是否被放置后台"
,
"data"
:
{
}
}
}
}
}
\ No newline at end of file
src/custom/answer-game/src/game/AnswerArea.ts
0 → 100644
View file @
81e5868b
import
{
props
}
from
'../props'
;
import
{
getTextureByName
,
OptionState
,
GameState
}
from
"./utils"
;
import
{
SvgaManager
}
from
'./SvgaManager'
;
export
class
AnswerArea
extends
engine
.
Container
{
private
_area
;
//答题区域
private
_optionA
;
//选项A
private
_optionB
;
//选项A
private
_optionC
;
//选项A
private
_optionD
;
//选项A
private
_optionArray
=
[];
//选项节点
//懒得按选项节点查询处理 故在创建的时候 用对应的数组处理
private
_choiceWrong
=
[];
//选错状态的节点数组
private
_choiceRight
=
[];
//选对状态的节点数组
private
_choiceSelect
=
[];
//选中状态的数组
private
_answerArray
=
[
'A'
,
'B'
,
'C'
,
'D'
];
private
_answer
=
-
1
;
//用户选择的选项
private
_gameState
;
private
_people
;
//人物svga
private
_svgaArrayName
=
[];
//答题后的动效
private
_randomSvga
;
//随机播放对应的svga动效
private
_right_mona
;
//回答正确的节点
private
_trueAnswer
;
//正确答案
private
_mona_confuse
;
//未选择答案 问号svga
private
_svgaPlayState
;
init
(){
let
area
=
this
.
_area
=
new
engine
.
Container
();
area
.
x
=
0
;
area
.
y
=
0
;
this
.
_gameState
=
GameState
.
STATE_END
;
this
.
addChild
(
area
);
this
.
initSvgaArray
();
this
.
initAnswerOption
();
this
.
initPeople
();
this
.
insideAddEventListener
();
}
private
initSvgaArray
(){
this
.
setSvgaName
(
'rian_mona'
,
'rian_weather'
);
this
.
setSvgaName
(
'snow_mona'
,
'snow_weather'
);
this
.
setSvgaName
(
'thunder_mona'
,
'thunder_weather'
);
this
.
setSvgaName
(
'wind_mona'
,
'wind_weather'
);
}
private
setSvgaName
(
peopleName
,
scene
){
let
tmpSvgaName
:
any
=
{};
tmpSvgaName
.
people
=
peopleName
;
tmpSvgaName
.
scene
=
scene
;
this
.
_svgaArrayName
.
push
(
tmpSvgaName
);
}
private
insideAddEventListener
(){
//更新答案选项
engine
.
globalEvent
.
addEventListener
(
'updateOption'
,
this
.
updateOption
,
this
)
//答题结果
engine
.
globalEvent
.
addEventListener
(
'handleAnswerOption'
,
this
.
handleAnswerOption
,
this
);
//更新游戏状态
engine
.
globalEvent
.
addEventListener
(
'upDateGameState'
,
this
.
upDateGameState
,
this
);
//开始答题 可选
engine
.
globalEvent
.
addEventListener
(
'start'
,
this
.
start
,
this
);
//提交答案
engine
.
globalEvent
.
addEventListener
(
'sendAnswer'
,
this
.
sendAnswer
,
this
);
engine
.
globalEvent
.
addEventListener
(
'outRest'
,
this
.
rest
,
this
);
//开始答题
//engine.globalEvent.addEventListener('startAnswer',this.startAnswer,this)
}
private
initPeople
(){
let
people
=
this
.
_people
=
SvgaManager
.
createSvga
(
'mona_walk'
);
people
.
x
=
props
.
people_X
;
people
.
y
=
props
.
people_Y
;
this
.
_area
.
addChild
(
people
);
SvgaManager
.
play
(
people
);
let
mona_confuse
=
this
.
_mona_confuse
=
SvgaManager
.
createSvga
(
'mona_confuse'
);
mona_confuse
.
x
=
props
.
people_X
;
mona_confuse
.
y
=
props
.
people_Y
;
mona_confuse
.
visible
=
false
;
this
.
_area
.
addChild
(
mona_confuse
);
//people.gotoAndStop(1);
}
public
getArea
(){
return
this
.
_area
;
}
//初始化选项
private
initAnswerOption
(){
let
optionA
=
this
.
_optionA
=
new
engine
.
Image
(
getTextureByName
(
'选区'
))
optionA
.
x
=
(
750
-
(
optionA
.
width
*
2
+
30
))
/
2
;
optionA
.
y
=
props
.
answerArea_Y
;
optionA
.
name
=
'A'
;
optionA
.
alpha
=
0
;
this
.
_area
.
addChild
(
optionA
);
this
.
_optionArray
.
push
(
optionA
);
let
optionB
=
this
.
_optionB
=
new
engine
.
Image
(
getTextureByName
(
'选区'
))
optionB
.
x
=
optionA
.
x
+
optionA
.
width
+
30
;
optionB
.
y
=
optionA
.
y
;
optionB
.
name
=
'B'
;
optionB
.
alpha
=
0
;
this
.
_area
.
addChild
(
optionB
);
this
.
_optionArray
.
push
(
optionB
);
let
optionC
=
this
.
_optionC
=
new
engine
.
Image
(
getTextureByName
(
'选区'
))
optionC
.
x
=
optionA
.
x
;
optionC
.
y
=
optionA
.
y
+
optionA
.
height
+
props
.
option_spaceY
;
optionC
.
name
=
'C'
;
optionC
.
alpha
=
0
;
this
.
_area
.
addChild
(
optionC
);
this
.
_optionArray
.
push
(
optionC
);
let
optionD
=
this
.
_optionD
=
new
engine
.
Image
(
getTextureByName
(
'选区'
))
optionD
.
x
=
optionB
.
x
;
optionD
.
y
=
optionC
.
y
;
optionD
.
name
=
'D'
;
optionD
.
alpha
=
0
;
this
.
_area
.
addChild
(
optionD
);
this
.
_optionArray
.
push
(
optionD
);
this
.
initOptionState
();
this
.
initAddEventListener
();
this
.
initSvga
(
optionA
);
this
.
initSvga
(
optionB
);
this
.
initSvga
(
optionC
);
this
.
initSvga
(
optionD
);
// setTimeout(() => {
// this.handleWrong();
// }, 1000);
}
//初始化svga节点
private
initSvga
(
tmpNode
){
this
.
initSvgaNode
(
'right_mona'
,
tmpNode
);
for
(
let
index
=
0
;
index
<
this
.
_svgaArrayName
.
length
;
index
++
)
{
let
element
=
this
.
_svgaArrayName
[
index
];
this
.
initSvgaNode
(
element
.
people
,
tmpNode
);
this
.
initSvgaNode
(
element
.
scene
,
tmpNode
);
}
}
private
initSvgaNode
(
svgaName
,
tmpNode
){
let
tmpSvga
=
SvgaManager
.
createSvga
(
svgaName
);
tmpSvga
.
x
=
-
30
;
tmpSvga
.
y
=
-
105
;
tmpSvga
.
visible
=
false
;
tmpSvga
.
name
=
svgaName
;
tmpNode
.
addChild
(
tmpSvga
);
}
private
initAddEventListener
(){
for
(
let
index
=
0
;
index
<
this
.
_optionArray
.
length
;
index
++
)
{
const
element
=
this
.
_optionArray
[
index
];
element
.
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
selectOption
,
this
);
}
}
//初始化 答案字体
private
optionLabel
(
parent
){
let
answerText
=
new
engine
.
Label
();
//answerText.font = 'OPPOSans_J';
answerText
.
fillColor
=
0x164b81
;
answerText
.
bold
=
true
;
//answerText.strokeColor = '#164b81';
//answerText.stroke = 4;
answerText
.
size
=
30
;
answerText
.
width
=
parent
.
width
;
answerText
.
height
=
parent
.
height
;
answerText
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
answerText
.
x
=
0
;
answerText
.
y
=
0.75
*
answerText
.
height
;
answerText
.
text
=
''
;
answerText
.
name
=
'answerText'
;
return
answerText
;
}
//初始化选项 选中-选错-选对 状态
private
initOptionState
(){
for
(
let
i
=
0
;
i
<
this
.
_optionArray
.
length
;
i
++
){
let
tmpNode
=
this
.
_optionArray
[
i
];
tmpNode
.
addChild
(
this
.
getChoiceStateImg
(
'选中'
,
OptionState
.
CHOICE_SELECT
,
tmpNode
.
name
));
tmpNode
.
addChild
(
this
.
getChoiceStateImg
(
'选错'
,
OptionState
.
CHOICE_WRONG
,
tmpNode
.
name
));
tmpNode
.
addChild
(
this
.
getChoiceStateImg
(
'选对'
,
OptionState
.
CHOICE_RIGHT
,
tmpNode
.
name
));
tmpNode
.
addChild
(
this
.
optionLabel
(
tmpNode
))
}
}
//获取图片资源
private
getChoiceStateImg
(
imgName
,
imgType
,
imgAnswer
){
let
choiceImage
=
new
engine
.
Image
(
getTextureByName
(
imgName
));
choiceImage
.
x
=
0
;
choiceImage
.
y
=
0
;
choiceImage
[
'type'
]
=
imgType
;
choiceImage
[
'imgAnswer'
]
=
imgAnswer
;
choiceImage
.
visible
=
false
;
switch
(
imgType
)
{
case
OptionState
.
CHOICE_WRONG
:
this
.
_choiceWrong
.
push
(
choiceImage
);
break
;
case
OptionState
.
CHOICE_RIGHT
:
this
.
_choiceRight
.
push
(
choiceImage
);
break
;
case
OptionState
.
CHOICE_SELECT
:
this
.
_choiceSelect
.
push
(
choiceImage
);
break
;
default
:
break
;
}
return
choiceImage
;
}
//选中答案
private
selectOption
(
event
:
engine
.
Event
){
if
(
this
.
_gameState
!=
GameState
.
STATE_START
||
this
.
_svgaPlayState
==
GameState
.
STATE_START
){
console
.
log
(
'暂时不能答题'
);
return
;
}
this
.
_gameState
=
GameState
.
STATE_END
;
this
.
handleSelect
(
event
.
target
.
name
);
this
.
peopleMove
(
event
.
target
.
x
-
30
,
event
.
target
.
y
-
110
,
false
);
this
.
_answer
=
this
.
_answerArray
.
indexOf
(
event
.
target
.
name
);
console
.
log
(
'点击选择选项'
,
event
.
target
.
name
,
this
.
_answer
);
}
//人物移动
peopleMove
(
moveX
,
moveY
,
isPlaySVGA
){
let
tmpX
=
moveX
;
let
tmpY
=
moveY
;
engine
.
Tween
.
get
(
this
.
_people
,{
loop
:
false
})
.
to
({
x
:
tmpX
,
y
:
tmpY
},
500
,
engine
.
Ease
.
cubicInOut
)
.
call
(()
=>
{
this
.
_gameState
=
GameState
.
STATE_START
;
if
(
isPlaySVGA
){
SvgaManager
.
play
(
this
.
_people
);
engine
.
globalEvent
.
dispatchEvent
(
'updateSubject'
);
}
})
}
//重置人物位置
rest
(){
this
.
_answer
=
-
1
;
if
(
this
.
_right_mona
){
SvgaManager
.
stop
(
this
.
_right_mona
);
this
.
_right_mona
.
visible
=
false
;
}
this
.
_people
.
visible
=
true
;
this
.
_mona_confuse
.
visible
=
false
;
this
.
peopleMove
(
props
.
people_X
,
props
.
people_Y
,
true
);
this
.
handleRight
();
this
.
handleWrong
();
this
.
handleSelect
();
this
.
optionsShow
(
false
);
engine
.
globalEvent
.
dispatchEvent
(
'resetTitle'
);
}
private
optionsShow
(
isShow
){
for
(
let
index
=
0
;
index
<
this
.
_optionArray
.
length
;
index
++
)
{
const
element
=
this
.
_optionArray
[
index
];
let
tmpAlpha
=
isShow
?
1
:
0
;
this
.
optionIsShowTween
(
element
,
tmpAlpha
);
}
}
//选项渐入渐出效果
private
optionIsShowTween
(
tweenNode
,
tmpAlpha
){
engine
.
Tween
.
get
(
tweenNode
,{
loop
:
false
})
.
to
({
alpha
:
tmpAlpha
},
500
)
}
//处理选中状态
private
handleSelect
(
select
?){
for
(
let
index
=
0
;
index
<
this
.
_choiceSelect
.
length
;
index
++
)
{
let
element
=
this
.
_choiceSelect
[
index
];
if
(
!
select
){
element
.
visible
=
false
;
continue
;
}
if
(
element
[
'imgAnswer'
]
===
select
){
element
.
visible
=
true
;
continue
;
}
element
.
visible
=
false
;
}
}
//正确答案展示
private
handleRight
(
select
=
''
){
for
(
let
index
=
0
;
index
<
this
.
_choiceRight
.
length
;
index
++
)
{
let
element
=
this
.
_choiceRight
[
index
];
if
(
select
==
''
){
element
.
visible
=
false
;
continue
;
}
if
(
element
[
'imgAnswer'
]
===
select
){
element
.
visible
=
true
;
continue
;
}
element
.
visible
=
false
;
}
}
//错误答案展示
private
handleWrong
(
select
?){
let
count
=
0
;
for
(
let
index
=
0
;
index
<
this
.
_choiceWrong
.
length
;
index
++
)
{
let
element
=
this
.
_choiceWrong
[
index
];
if
(
!
select
){
element
.
visible
=
false
;
this
.
hideSvga
(
element
);
continue
;
}
if
(
element
[
'imgAnswer'
]
==
select
){
element
.
visible
=
false
;
continue
;
}
count
++
;
element
.
visible
=
true
;
this
.
playWrongTween
(
element
,(
count
==
this
.
_choiceWrong
.
length
-
1
));
}
}
private
hideSvga
(
svgaNode
){
svgaNode
.
parent
.
children
.
forEach
(
element
=>
{
if
(
element
.
_instanceType
==
'MovieClip'
)
{
element
.
visible
=
false
;
}
});
}
playWrongTween
(
tweenNode
,
isLast
){
engine
.
Tween
.
get
(
tweenNode
,{
loop
:
false
})
.
wait
(
460
)
.
to
({
alpha
:
0.3
},
160
,
engine
.
Ease
.
circInOut
)
.
to
({
alpha
:
1
},
160
,
engine
.
Ease
.
circInOut
)
.
to
({
alpha
:
0.3
},
160
,
engine
.
Ease
.
circInOut
)
.
to
({
alpha
:
1
},
160
,
engine
.
Ease
.
circInOut
)
.
call
(()
=>
{
engine
.
Tween
.
removeTweens
(
tweenNode
);
if
(
isLast
){
if
(
this
.
_answer
>=
0
){
this
.
_people
.
visible
=
false
;
this
.
handleSeceltRight
();
this
.
handleSeceltError
();
}
else
{
this
.
_people
.
visible
=
false
;
this
.
_mona_confuse
.
visible
=
true
;
SvgaManager
.
play
(
this
.
_mona_confuse
,()
=>
{
this
.
rest
();
});
}
}
})
}
//播放对应的人物动效
playResultSvga
(
svgaNode
,
isLast
,
isShowPeople
){
let
svgaData
=
this
.
_svgaArrayName
[
this
.
_randomSvga
-
1
];
if
(
isShowPeople
){
let
peopleNode
=
this
.
getSvgaNode
(
svgaNode
,
svgaData
.
people
);
this
.
playSvga
(
peopleNode
);
}
let
sceneNode
=
this
.
getSvgaNode
(
svgaNode
,
svgaData
.
scene
);
this
.
playSvga
(
sceneNode
,()
=>
{
if
(
isLast
)
this
.
rest
();
});
}
private
getSvgaNode
(
svgaNode
,
svgaName
){
let
tmp
=
svgaNode
.
getChildByName
(
svgaName
);
if
(
!
tmp
){
console
.
log
(
'svga节点未找到'
);
return
}
return
tmp
}
//播放svga
playSvga
(
svgaNode
,
callBack
?){
svgaNode
.
visible
=
true
;
SvgaManager
.
play
(
svgaNode
,()
=>
{
svgaNode
.
visible
=
false
;
if
(
callBack
)
callBack
();
});
}
//更新选项
private
updateOption
(
optionData
){
this
.
_randomSvga
=
Math
.
floor
(
Math
.
random
()
*
(
this
.
_svgaArrayName
.
length
)
+
1
);
let
tmpOptionData
=
optionData
.
data
.
options
;
for
(
let
index
=
0
;
index
<
tmpOptionData
.
length
;
index
++
)
{
let
element
=
tmpOptionData
[
index
];
this
.
_optionArray
[
index
].
getChildByName
(
'answerText'
).
text
=
element
;
}
}
//答案
private
handleAnswerOption
(
result
){
//SvgaManager.stop(this._people);
this
.
_people
.
gotoAndStop
(
1
)
let
trueAnswer
=
this
.
_trueAnswer
=
result
.
data
.
state
;
this
.
handleRight
(
this
.
_answerArray
[
trueAnswer
]);
this
.
handleWrong
(
this
.
_answerArray
[
trueAnswer
]);
this
.
handleSelect
();
this
.
_svgaPlayState
=
GameState
.
STATE_START
;
//处理动效
}
private
handleSeceltRight
(){
//if(this._gameState == GameState.STATE_START)return;
for
(
let
index
=
0
;
index
<
this
.
_optionArray
.
length
;
index
++
)
{
let
element
=
this
.
_optionArray
[
index
];
if
(
element
.
name
==
this
.
_answerArray
[
this
.
_answer
]
&&
this
.
_trueAnswer
==
this
.
_answer
){
this
.
_right_mona
=
this
.
getSvgaNode
(
element
,
'right_mona'
)
if
(
this
.
_right_mona
){
this
.
_right_mona
.
visible
=
true
;
SvgaManager
.
play
(
this
.
_right_mona
);
}
}
}
}
private
handleSeceltError
(){
//if(this._gameState == GameState.STATE_START)return;
let
tmpNum
=
0
;
for
(
let
index
=
0
;
index
<
this
.
_optionArray
.
length
;
index
++
)
{
let
element
=
this
.
_optionArray
[
index
];
if
(
element
.
name
!=
this
.
_answerArray
[
this
.
_trueAnswer
]){
tmpNum
++
;
let
isShowPeople
=
false
;
if
(
element
.
name
==
this
.
_answerArray
[
this
.
_answer
]){
isShowPeople
=
true
;
}
this
.
playResultSvga
(
element
,(
tmpNum
==
3
),
isShowPeople
);
}
}
}
//更新答题状态
private
upDateGameState
(
gameState
){
this
.
_gameState
=
gameState
.
data
.
gameState
;
}
private
start
(){
this
.
optionsShow
(
true
);
this
.
_gameState
=
GameState
.
STATE_START
;
this
.
_svgaPlayState
=
GameState
.
STATE_END
;
}
sendAnswer
(){
engine
.
globalEvent
.
dispatchEvent
(
'sendAnswerResult'
,{
answer
:
this
.
_answer
});
}
}
\ No newline at end of file
src/custom/answer-game/src/game/Background.ts
0 → 100644
View file @
81e5868b
import
{
getTextureByName
}
from
"./utils"
;
import
{
getStage
}
from
"./utils"
;
import
{
props
}
from
'./../props'
;
export
class
Background
extends
engine
.
Container
{
private
_bg
;
private
_cloudUp
;
//上云
private
_cloudDown
;
//下云
private
_answerBg
;
//答案背景
private
_subjectBox
;
//题目框
private
_countDownBg
;
//倒计时
private
_answerCountBg
;
//答对题数背景
private
_answerCountText
;
//答对题数
init
(){
// let bg = this._bg = new engine.Image(getTextureByName('gameBg'));
// bg.x = 0;
// bg.y = 0;
// this.addChild(bg);
// let answerBg = this._answerBg = new engine.Image(getTextureByName('答案区'))
// answerBg.x = 0;
// answerBg.y = bg.height - answerBg.height;
// this.addChild(answerBg);
// //上云
// let cloudUp = this._cloudUp = new engine.Image(getTextureByName('前景云上'))
// cloudUp.x = 0;
// cloudUp.y = 0;
// this.addChild(cloudUp);
// //下云
// let cloudDown = this._cloudDown = new engine.Image(getTextureByName('前景云下'))
// cloudDown.x = 0;
// cloudDown.y = bg.height - cloudDown.height;
// this.addChild(cloudDown);
this
.
showSubjectBox
();
this
.
insideAddEventListener
();
}
private
insideAddEventListener
(){
engine
.
globalEvent
.
addEventListener
(
'changeCount'
,
this
.
changeCount
,
this
);
}
private
showSubjectBox
(){
let
tmpContainer
=
new
engine
.
Container
();
tmpContainer
.
x
=
0
;
tmpContainer
.
y
=
props
.
subjectBox_Y
;
this
.
addChild
(
tmpContainer
);
//题目栏
let
subjectBox
=
this
.
_subjectBox
=
new
engine
.
Image
(
getTextureByName
(
'题目栏'
))
subjectBox
.
x
=
(
750
-
subjectBox
.
width
)
/
2
;
subjectBox
.
y
=
0
;
tmpContainer
.
addChild
(
subjectBox
);
//倒计时
let
countDownBg
=
this
.
_countDownBg
=
new
engine
.
Image
(
getTextureByName
(
'倒计时'
))
countDownBg
.
x
=
(
750
-
countDownBg
.
width
)
/
2
;
countDownBg
.
y
=
-
countDownBg
.
height
/
2
+
10
;
tmpContainer
.
addChild
(
countDownBg
);
let
answerCountBg
=
this
.
_answerCountBg
=
new
engine
.
Image
(
getTextureByName
(
'答对题数'
))
answerCountBg
.
x
=
(
750
-
answerCountBg
.
width
)
/
2
;
answerCountBg
.
y
=
subjectBox
.
y
+
subjectBox
.
height
-
answerCountBg
.
height
-
10
tmpContainer
.
addChild
(
answerCountBg
);
let
answerCountText
=
this
.
_answerCountText
=
new
engine
.
Label
();
answerCountText
.
fillColor
=
0x2b3134
;
answerCountText
.
size
=
30
;
answerCountText
.
width
=
answerCountBg
.
width
;
answerCountText
.
height
=
answerCountBg
.
height
;
answerCountText
.
verticalAlign
=
engine
.
VERTICAL_ALIGN
.
MIDDLE
;
answerCountText
.
x
=
160
;
answerCountText
.
y
=
3
;
answerCountText
.
text
=
'0'
;
answerCountBg
.
addChild
(
answerCountText
);
}
//更新答对题数
private
changeCount
(
data
){
this
.
_answerCountText
.
text
=
data
.
data
.
count
+
''
;
}
}
\ No newline at end of file
src/custom/answer-game/src/game/GameView.ts
0 → 100644
View file @
81e5868b
import
{
SubjectManager
}
from
'./SubjectManager'
;
/**
* Created by rockyl on 2018/8/16.
*/
import
{
props
}
from
"../props"
;
import
{
Background
}
from
"./Background"
;
import
{
SubjectTitle
}
from
"./SubjectTitle"
;
import
{
AnswerArea
}
from
"./answerArea"
;
export
default
class
GameView
extends
engine
.
Container
{
private
_hasSetup
;
private
_backgroud
:
Background
;
private
_subject
:
SubjectTitle
;
private
_answerArea
:
AnswerArea
;
private
_subjectManager
:
SubjectManager
;
constructor
()
{
super
();
//this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);
}
setup
(){
if
(
this
.
_hasSetup
)
{
return
;
}
this
.
_hasSetup
=
true
;
let
backgroud
=
this
.
_backgroud
=
new
Background
();
this
.
addChild
(
backgroud
);
backgroud
.
init
();
let
subject
=
this
.
_subject
=
new
SubjectTitle
();
this
.
addChild
(
subject
);
subject
.
init
();
let
answerArea
=
this
.
_answerArea
=
new
AnswerArea
();
this
.
addChild
(
answerArea
);
answerArea
.
init
();
let
tmpContainer
=
new
engine
.
Container
();
this
.
addChildAt
(
tmpContainer
,
50
);
subject
.
initCountDownSvga
(
tmpContainer
);
// let svgaManager = this._svgaManager = new SvgaManager();
// this.addChild(svgaManager);
// svgaManager.init(answerArea.getArea())
let
subjectManager
=
this
.
_subjectManager
=
new
SubjectManager
();
subjectManager
.
init
();
}
async
start
()
{
this
.
setup
();
}
}
src/custom/answer-game/src/game/GameWrapper.ts
0 → 100644
View file @
81e5868b
import
{
props
}
from
'./../props'
;
/**
* Created by rockyl on 2020-01-09.
*/
import
GameView
from
"./GameView"
;
export
class
GameWrapper
extends
engine
.
Container
{
private
_gameView
:
GameView
;
constructor
()
{
super
();
engine
.
globalEvent
.
addEventListener
(
'answer-game-start'
,
this
.
start
,
this
);
engine
.
globalEvent
.
addEventListener
(
'answer-game-subject'
,
this
.
initSubject
,
this
);
engine
.
globalEvent
.
addEventListener
(
'answer-game-result'
,
this
.
result
,
this
);
this
.
visibilitychange
();
}
start
(
event
:
engine
.
Event
)
{
//初始化传入的倒计时
if
(
event
.
data
.
countDown
){
props
.
countDown
=
event
.
data
.
countDown
;
}
//未消除自定义模块节点 但执行了多次start事件处理
if
(
!
this
.
_gameView
){
let
gameView
=
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
gameView
);
this
.
_gameView
.
start
();
}
engine
.
globalEvent
.
dispatchEvent
(
'reset'
)
}
initSubject
(
event
:
engine
.
Event
){
let
subjectData
=
event
.
data
.
subjectData
;
engine
.
globalEvent
.
dispatchEvent
(
'handleOption'
,
subjectData
);
}
result
(
event
:
engine
.
Event
){
let
result
=
event
.
data
.
result
;
engine
.
globalEvent
.
dispatchEvent
(
'handleResult'
,{
result
:
result
});
}
private
visibilitychange
(){
document
.
addEventListener
(
'visibilitychange'
,
function
()
{
if
(
document
.
visibilityState
===
'hidden'
)
{
console
.
log
(
'放置后台'
);
engine
.
globalEvent
.
dispatchEvent
(
'outRest'
)
engine
.
globalEvent
.
dispatchEvent
(
'answer-game-visibilitychange'
,{
hidden
:
true
});
}
});
}
}
src/custom/answer-game/src/game/GuideLayer.ts
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2020-01-30.
*/
import
{
props
}
from
"../props"
;
import
{
getTextureByName
}
from
"./utils"
;
export
class
GuideLayer
extends
engine
.
Container
{
private
guideMask
:
engine
.
Container
;
private
_options
;
_guideHole
;
_canClear
:
any
=
[];
_callBack
;
private
label
:
engine
.
Label
;
constructor
()
{
super
();
this
.
setup
();
}
private
setup
()
{
}
show
(
id
,
options
,
callback
?)
{
this
.
visible
=
true
;
this
.
_callBack
=
callback
?
callback
:
null
;
if
(
!
this
.
guideMask
)
{
this
.
_options
=
options
;
const
{
width
,
height
}
=
this
.
stage
;
let
guideMask
=
this
.
guideMask
=
new
engine
.
Container
();
let
guideHole
=
this
.
_guideHole
=
new
engine
.
Image
(
getTextureByName
(
'guide'
));
guideHole
.
x
=
options
.
x
;
guideHole
.
y
=
options
.
y
;
guideHole
.
width
=
250
;
guideHole
.
height
=
250
;
guideHole
.
name
=
'guideHole'
;
guideMask
.
addChild
(
guideHole
);
this
.
createRect
(
guideMask
,
0
,
0
,
width
,
guideHole
.
y
);
this
.
createRect
(
guideMask
,
0
,
guideHole
.
y
,
guideHole
.
x
,
guideHole
.
height
);
this
.
createRect
(
guideMask
,
guideHole
.
x
+
guideHole
.
width
,
guideHole
.
y
,
width
-
guideHole
.
x
-
guideHole
.
width
,
guideHole
.
height
);
this
.
createRect
(
guideMask
,
0
,
guideHole
.
y
+
guideHole
.
height
,
width
,
height
-
guideHole
.
y
-
guideHole
.
height
);
this
.
guideStep
(
id
);
let
label
=
this
.
label
=
new
engine
.
Label
();
label
.
fillColor
=
'white'
;
label
.
size
=
30
;
label
.
text
=
options
.
guideText
;
label
.
x
=
(
width
-
label
.
width
)
/
2
;
label
.
y
=
guideHole
.
y
+
guideHole
.
height
+
50
;
label
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
label
.
name
=
'labHint'
;
guideMask
.
addChild
(
label
);
this
.
addChild
(
guideMask
);
}
this
.
once
(
engine
.
MouseEvent
.
CLICK
,
function
(){
this
.
removeChild
(
this
.
guideMask
);
this
.
guideMask
=
null
;
if
(
this
.
_callBack
){
this
.
_callBack
();
}
},
this
);
}
createRect
(
container
,
x
,
y
,
width
,
height
)
{
let
rect
=
new
engine
.
Rect
();
rect
.
x
=
x
;
rect
.
y
=
y
;
rect
.
width
=
width
;
rect
.
height
=
height
;
rect
.
fillColor
=
'black'
;
rect
.
alpha
=
0.7
;
container
.
addChild
(
rect
);
}
guideStep
(
id
){
if
(
id
==
1
){
let
guideHand
=
new
engine
.
Image
(
getTextureByName
(
'guideHand'
));
guideHand
.
x
=
this
.
_options
.
x
+
300
;
guideHand
.
y
=
this
.
_options
.
y
+
100
;
this
.
guideMask
.
addChild
(
guideHand
);
let
rect
=
new
engine
.
Rect
();
rect
.
x
=
this
.
_options
.
x
+
200
;
rect
.
y
=
this
.
_options
.
y
-
15
;
rect
.
width
=
props
.
strutWidth
;
rect
.
height
=
200
;
rect
.
fillColor
=
props
.
strutColor
;
this
.
guideMask
.
addChild
(
rect
);
this
.
_canClear
.
push
(
guideHand
);
this
.
_canClear
.
push
(
rect
);
}
if
(
id
==
2
){
let
know
=
new
engine
.
Image
(
getTextureByName
(
'know'
));
know
.
x
=
(
this
.
stage
.
width
-
know
.
width
)
/
2
;
know
.
y
=
this
.
_options
.
y
+
400
;
this
.
guideMask
.
addChild
(
know
);
this
.
_canClear
.
push
(
know
);
}
}
}
src/custom/answer-game/src/game/SubjectManager.ts
0 → 100644
View file @
81e5868b
import
{
GameState
}
from
"./utils"
;
export
class
SubjectManager
{
private
_curSubJect
=
0
;
//当前第几题
private
_loactionCache
;
//所有题目
private
_curTmpSubject
;
//当前题目数据
init
(){
this
.
insideAddEventListener
();
}
private
insideAddEventListener
(){
//初始化题目数据
engine
.
globalEvent
.
addEventListener
(
'handleOption'
,
this
.
handleSubject
,
this
)
//更新题目
engine
.
globalEvent
.
addEventListener
(
'updateSubject'
,
this
.
updateSubject
,
this
)
engine
.
globalEvent
.
addEventListener
(
'handleResult'
,
this
.
handleResult
,
this
)
engine
.
globalEvent
.
addEventListener
(
'sendAnswerResult'
,
this
.
sendAnswerResult
,
this
)
}
private
handleSubject
(
subject
){
this
.
_curSubJect
=
0
;
this
.
_loactionCache
=
subject
.
data
;
this
.
updateSubject
();
engine
.
globalEvent
.
dispatchEvent
(
'updateAnswerCount'
,{
count
:
0
})
}
private
updateSubject
(){
if
(
this
.
_curSubJect
>=
this
.
_loactionCache
.
length
){
console
.
log
(
'没有题目'
);
engine
.
globalEvent
.
dispatchEvent
(
'answer-game-over'
);
return
;
}
this
.
_curTmpSubject
=
this
.
_loactionCache
[
this
.
_curSubJect
];
let
title
=
this
.
_loactionCache
[
this
.
_curSubJect
].
question
;
let
options
=
this
.
_loactionCache
[
this
.
_curSubJect
].
options
;
let
tmpIndex
=
this
.
_loactionCache
[
this
.
_curSubJect
].
index
;
this
.
updateTitle
(
title
,
tmpIndex
)
this
.
updateOption
(
options
);
this
.
_curSubJect
++
;
}
//更新题目
private
updateTitle
(
title
,
tmpIndex
){
engine
.
globalEvent
.
dispatchEvent
(
'updateSubjectTitle'
,{
title
:
title
,
curSubJect
:
tmpIndex
});
}
//更新选项
private
updateOption
(
options
){
engine
.
globalEvent
.
dispatchEvent
(
'updateOption'
,{
options
:
options
});
}
//处理正确答案及其答对的题数
private
handleResult
(
result
){
let
tmp
=
result
.
data
.
result
;
//更新答对题数值
engine
.
globalEvent
.
dispatchEvent
(
'updateAnswerCount'
,{
count
:
tmp
.
count
})
//更新答题结果
engine
.
globalEvent
.
dispatchEvent
(
'handleAnswerOption'
,{
state
:
tmp
.
state
})
}
//发送用户选择的答案
sendAnswerResult
(
resultData
){
let
tmpAnswer
=
resultData
.
data
.
answer
;
engine
.
globalEvent
.
dispatchEvent
(
'answer-game-select'
,{
curSubJect
:
this
.
_curTmpSubject
.
index
,
answer
:
tmpAnswer
});
}
}
\ No newline at end of file
src/custom/answer-game/src/game/SubjectTitle.ts
0 → 100644
View file @
81e5868b
import
{
props
}
from
'../props'
;
import
{
getTextureByName
,
GameState
,
getStage
}
from
"./utils"
;
import
{
SvgaManager
}
from
'./SvgaManager'
;
export
class
SubjectTitle
extends
engine
.
Container
{
private
_subjectTitleBox
;
//题目框
private
_titleLabel
;
//题目文字
private
_titleNumLabel
;
//当前题数文字
private
_countDownBg
;
//倒计时
private
_countDownText
;
//倒计时数字
private
_answerCountBg
;
//答对题数背景
private
_answerCountText
;
//答对题数
private
_bar
;
//倒计时进度条
private
_frameCurrAngle
=
0
;
//累加
private
_frameCount
=
0
;
//帧数记录
private
_countDownTmp
=
0
;
//倒计时处理
private
_readyGo
;
//svga节点
private
_questionEnter
;
//svga节点
private
_square
=
new
engine
.
Graphics
();
private
_countDownSvga
;
init
()
{
this
.
showSubjectBox
();
this
.
insideAddEventListener
();
}
initCountDownSvga
(
tmpNode
)
{
let
countDownSvga
=
this
.
_countDownSvga
=
SvgaManager
.
createSvga
(
'countdown_321'
);
countDownSvga
.
x
=
(
getStage
().
width
-
120
)
/
2
;
countDownSvga
.
y
=
(
getStage
().
height
-
120
)
/
2
;
countDownSvga
.
visible
=
false
;
tmpNode
.
addChild
(
countDownSvga
);
}
private
insideAddEventListener
()
{
//更新题目
engine
.
globalEvent
.
addEventListener
(
'updateSubjectTitle'
,
this
.
updateSubjectTitle
,
this
)
//更新答对题数
engine
.
globalEvent
.
addEventListener
(
'updateAnswerCount'
,
this
.
updateAnswerCount
,
this
);
engine
.
globalEvent
.
addEventListener
(
'resetTitle'
,
this
.
reset
,
this
);
engine
.
globalEvent
.
addEventListener
(
'outRest'
,
this
.
outRest
,
this
);
}
//初始化答题区域
private
showSubjectBox
()
{
let
tmpContainer
=
new
engine
.
Container
();
tmpContainer
.
x
=
0
;
tmpContainer
.
y
=
props
.
subjectBox_Y
;
this
.
addChild
(
tmpContainer
);
//题目栏
let
subjectBox
=
this
.
_subjectTitleBox
=
new
engine
.
Image
(
getTextureByName
(
'题目栏'
))
subjectBox
.
x
=
(
750
-
subjectBox
.
width
)
/
2
;
subjectBox
.
y
=
0
;
tmpContainer
.
addChild
(
subjectBox
);
//倒计时
let
countDownBg
=
this
.
_countDownBg
=
new
engine
.
Image
(
getTextureByName
(
'倒计时'
))
countDownBg
.
x
=
(
750
-
countDownBg
.
width
)
/
2
;
countDownBg
.
y
=
-
countDownBg
.
height
/
2
+
10
;
tmpContainer
.
addChild
(
countDownBg
);
let
bar
=
this
.
_bar
=
new
engine
.
Image
(
getTextureByName
(
'进度条'
))
bar
.
x
=
0
;
bar
.
y
=
0
;
countDownBg
.
addChild
(
bar
);
bar
.
anchorX
=
bar
.
width
/
2
;
bar
.
anchorY
=
bar
.
height
/
2
;
bar
.
rotation
=
-
90
;
bar
.
addChild
(
this
.
_square
);
bar
.
mask
=
this
.
_square
;
let
answerCountBg
=
this
.
_answerCountBg
=
new
engine
.
Image
(
getTextureByName
(
'答对题数'
))
answerCountBg
.
x
=
(
750
-
answerCountBg
.
width
)
/
2
;
answerCountBg
.
y
=
subjectBox
.
y
+
subjectBox
.
height
-
answerCountBg
.
height
-
10
tmpContainer
.
addChild
(
answerCountBg
);
this
.
initCountDownBar
(
0
);
this
.
initAnswerCountText
();
this
.
initCountDownText
();
this
.
initTitleText
();
this
.
initSvga
();
}
//初始化倒计时数字
private
initCountDownText
()
{
// let countDownText = this._countDownText = new engine.Label();
// countDownText.fillColor = 0xfffcc6;
// countDownText.size = 58;
// countDownText.width = this._countDownBg.width;
// countDownText.height = this._countDownBg.height;
// countDownText.verticalAlign = engine.VERTICAL_ALIGN.MIDDLE;
// countDownText.textAlign = engine.TEXT_ALIGN.CENTER;
// countDownText.x = 0;
// countDownText.y = 0;
// countDownText.text = props.countDown;
// this._countDownBg.addChild(countDownText);
// this._countDownTmp = props.countDown;
let
countDownText
=
this
.
_countDownText
=
new
engine
.
BitmapText
();
countDownText
.
font
=
props
.
fontName
;
countDownText
.
text
=
props
.
countDown
;
this
.
handleAlign
();
this
.
_countDownBg
.
addChild
(
countDownText
);
this
.
_countDownTmp
=
props
.
countDown
;
}
private
handleAlign
()
{
this
.
_countDownText
.
x
=
(
this
.
_countDownBg
.
width
-
this
.
_countDownText
.
width
)
/
2
;
this
.
_countDownText
.
y
=
(
this
.
_countDownBg
.
height
-
this
.
_countDownText
.
height
)
/
2
;;
}
private
countDownBitmapText
()
{
let
countDownString
=
props
.
countDown
+
''
;
for
(
let
index
=
0
;
index
<
countDownString
.
length
;
index
++
)
{
const
element
=
countDownString
[
index
];
}
}
//初始化答对题目数字
private
initAnswerCountText
()
{
let
answerCountText
=
this
.
_answerCountText
=
new
engine
.
Label
();
answerCountText
.
fillColor
=
0x2b3134
;
answerCountText
.
size
=
30
;
answerCountText
.
width
=
this
.
_answerCountBg
.
width
;
answerCountText
.
height
=
this
.
_answerCountBg
.
height
;
answerCountText
.
verticalAlign
=
engine
.
VERTICAL_ALIGN
.
MIDDLE
;
answerCountText
.
x
=
160
;
answerCountText
.
y
=
props
.
answerCountText_Y
;
answerCountText
.
text
=
'0'
;
this
.
_answerCountBg
.
addChild
(
answerCountText
);
}
//初始化题目
private
initTitleText
()
{
let
titleLabel
=
this
.
_titleLabel
=
new
engine
.
Label
();
titleLabel
.
fillColor
=
0xfffcc6
;
titleLabel
.
size
=
36
;
titleLabel
.
width
=
this
.
_subjectTitleBox
.
width
-
props
.
titleText_width
;
titleLabel
.
height
=
this
.
_subjectTitleBox
.
height
-
props
.
titleText_height
;
titleLabel
.
lineType
=
engine
.
TEXT_lINETYPE
.
MULTI
;
titleLabel
.
verticalAlign
=
engine
.
VERTICAL_ALIGN
.
MIDDLE
;
titleLabel
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
titleLabel
.
x
=
props
.
titleText_X
;
titleLabel
.
y
=
props
.
titleText_Y
;
titleLabel
.
text
=
''
;
titleLabel
.
alpha
=
0
;
this
.
_subjectTitleBox
.
addChild
(
titleLabel
);
}
//初始化 题数标识
private
initTitleNumText
(
tmpContainer
)
{
let
titleNumLabel
=
this
.
_titleNumLabel
=
new
engine
.
Label
();
titleNumLabel
.
fillColor
=
0xfffcc6
;
titleNumLabel
.
size
=
48
;
titleNumLabel
.
width
=
tmpContainer
.
width
;
titleNumLabel
.
height
=
tmpContainer
.
heigth
;
titleNumLabel
.
verticalAlign
=
engine
.
VERTICAL_ALIGN
.
MIDDLE
;
titleNumLabel
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
// titleNumLabel.x = 90;
// titleNumLabel.y = 85;
titleNumLabel
.
text
=
''
;
titleNumLabel
.
visible
=
false
;
tmpContainer
.
addChild
(
titleNumLabel
);
}
//更新当前题数
private
updateTitleNumText
(
curSubJect
)
{
this
.
rest
();
this
.
_titleNumLabel
.
text
=
`第
${
curSubJect
}
题`
;
}
private
reset
()
{
this
.
_titleLabel
.
text
=
''
;
}
//更新题目
private
updateSubjectTitle
(
tmpData
)
{
this
.
_titleLabel
.
alpha
=
0
;
this
.
_titleLabel
.
text
=
tmpData
.
data
.
title
;
this
.
lastTime
=
0
;
this
.
updateTitleNumText
(
tmpData
.
data
.
curSubJect
+
1
);
if
(
tmpData
.
data
.
curSubJect
==
0
)
{
this
.
fristAnswer
();
}
else
{
this
.
playQuestion_enter
();
}
}
//更新答对题数
private
updateAnswerCount
(
data
)
{
this
.
_answerCountText
.
text
=
data
.
data
.
count
+
''
;
}
//更新倒计时
private
updateCountDownText
(
count
)
{
this
.
_countDownText
.
text
=
count
+
''
;
this
.
handleAlign
();
}
//开启倒计时进度条
private
openCountDownBar
()
{
this
.
rest
();
engine
.
gameStage
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
countDownBar
,
this
)
}
//更新进度条
private
initCountDownBar
(
currAngle
)
{
let
ax
=
this
.
_bar
.
width
/
2
;
let
ay
=
this
.
_bar
.
height
/
2
;
this
.
_square
.
clear
();
this
.
_square
.
beginFill
(
0
);
this
.
_square
.
moveTo
(
ax
,
ay
);
this
.
_square
.
arc
(
ax
,
ay
,
this
.
_bar
.
width
/
2
,
0
,
(
currAngle
*
Math
.
PI
/
180
))
this
.
_square
.
lineTo
(
ax
,
ay
);
this
.
_square
.
endFill
();
}
//帧处理
private
lastTime
;
private
countDownBar
()
{
var
now
=
Date
.
now
();
var
deltaTime
=
this
.
lastTime
?
now
-
this
.
lastTime
:
16.7
;
this
.
lastTime
=
now
;
this
.
_frameCurrAngle
+=
360
/
(
props
.
countDown
*
1000
)
*
deltaTime
;
this
.
_frameCurrAngle
=
Math
.
min
(
360
,
this
.
_frameCurrAngle
);
this
.
initCountDownBar
(
this
.
_frameCurrAngle
);
this
.
_frameCount
+=
deltaTime
;
if
(
this
.
_frameCount
>=
1000
)
{
let
tmpTime
=
this
.
_countDownTmp
-
1
>
0
?
this
.
_countDownTmp
-=
1
:
0
;
if
(
tmpTime
==
3
)
{
this
.
playCountDownSvga
();
}
this
.
updateCountDownText
(
tmpTime
);
this
.
_frameCount
=
0
;
if
(
this
.
_frameCurrAngle
>=
360
)
{
engine
.
gameStage
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
countDownBar
,
this
)
engine
.
globalEvent
.
dispatchEvent
(
'upDateGameState'
,
{
gameState
:
GameState
.
STATE_END
});
engine
.
globalEvent
.
dispatchEvent
(
'sendAnswer'
)
}
}
}
private
rest
()
{
this
.
_frameCurrAngle
=
0
;
this
.
_frameCount
=
0
;
this
.
_square
.
clear
();
this
.
_countDownTmp
=
props
.
countDown
;
this
.
_countDownText
.
text
=
props
.
countDown
+
''
;
this
.
handleAlign
();
//this._readyGo.visible = false;
//this._countDownSvga.visible = false;
//this._questionEnter.visible = false;
//engine.gameStage.removeEventListener(engine.Event.ENTER_FRAME, this.countDownBar, this)
}
outRest
(){
this
.
_frameCurrAngle
=
0
;
this
.
_frameCount
=
0
;
this
.
_square
.
clear
();
this
.
_countDownTmp
=
props
.
countDown
;
this
.
_countDownText
.
text
=
props
.
countDown
+
''
;
this
.
handleAlign
();
this
.
_readyGo
.
visible
=
false
;
this
.
_countDownSvga
.
visible
=
false
;
this
.
_questionEnter
.
visible
=
false
;
engine
.
gameStage
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
countDownBar
,
this
)
}
initSvga
()
{
let
readyGo
=
this
.
_readyGo
=
SvgaManager
.
createSvga
(
'ready_go'
);
readyGo
.
x
=
50
;
readyGo
.
y
=
45
;
readyGo
.
visible
=
false
;
this
.
_subjectTitleBox
.
addChild
(
readyGo
);
let
tmpRect
=
new
engine
.
Rect
();
tmpRect
.
x
=
50
tmpRect
.
y
=
45
;
tmpRect
.
width
=
520
;
tmpRect
.
height
=
200
;
this
.
_subjectTitleBox
.
addChild
(
tmpRect
);
readyGo
.
mask
=
tmpRect
;
let
tmpContainer
=
new
engine
.
Container
();
tmpContainer
.
width
=
400
;
tmpContainer
.
height
=
100
;
tmpContainer
.
x
=
(
this
.
_subjectTitleBox
.
width
-
400
)
/
2
;
tmpContainer
.
y
=
115
;
this
.
_subjectTitleBox
.
addChild
(
tmpContainer
);
let
questionEnter
=
this
.
_questionEnter
=
SvgaManager
.
createSvga
(
'question_enter'
);
questionEnter
.
x
=
0
;
questionEnter
.
y
=
0
;
questionEnter
.
visible
=
false
;
tmpContainer
.
addChild
(
questionEnter
);
this
.
initTitleNumText
(
tmpContainer
);
}
fristAnswer
()
{
this
.
playReadyGo
();
}
playReadyGo
()
{
this
.
_readyGo
.
visible
=
true
;
SvgaManager
.
play
(
this
.
_readyGo
,
()
=>
{
this
.
_readyGo
.
visible
=
false
;
this
.
playQuestion_enter
();
});
}
playQuestion_enter
()
{
this
.
_questionEnter
.
visible
=
true
;
this
.
_titleNumLabel
.
visible
=
true
;
// return;
SvgaManager
.
play
(
this
.
_questionEnter
,
()
=>
{
this
.
_questionEnter
.
visible
=
false
;
//this._titleLabel.visible = true;
this
.
playTweenTitle
();
this
.
_titleNumLabel
.
visible
=
false
;
this
.
openCountDownBar
();
//如果初始倒计时为3秒
if
(
this
.
_countDownTmp
==
3
)
{
this
.
playCountDownSvga
();
}
engine
.
globalEvent
.
dispatchEvent
(
'start'
);
});
}
playTweenTitle
()
{
engine
.
Tween
.
get
(
this
.
_titleLabel
,
{
loop
:
false
})
.
set
({
alpha
:
0
})
.
to
({
alpha
:
1
},
500
,
engine
.
Ease
.
cubicIn
)
.
call
(()
=>
{
engine
.
Tween
.
removeTweens
(
this
.
_titleLabel
);
})
}
playCountDownSvga
()
{
console
.
log
(
'测试次数'
);
this
.
_countDownSvga
.
visible
=
true
;
this
.
_countDownSvga
.
lockStep
=
true
;
SvgaManager
.
play
(
this
.
_countDownSvga
,
()
=>
{
this
.
_countDownSvga
.
visible
=
false
;
});
}
}
\ No newline at end of file
src/custom/answer-game/src/game/SvgaManager.ts
0 → 100644
View file @
81e5868b
import
{
props
}
from
'../props'
;
import
{
getTextureByName
}
from
"./utils"
;
export
class
SvgaManager
{
public
static
createSvga
(
name
)
{
let
inst
=
new
svga
.
Svga
();
inst
.
source
=
engine
.
getAssetByName
(
name
).
uuid
;
// let anchor = props[(anchorName)];
// if (anchor) {
// inst.x = -anchor.x;
// inst.y = -anchor.y;
// inst.anchorX = anchor.x;
// inst.anchorY = anchor.y;
// }
return
inst
;
}
public
static
play
(
svga
,
callBack
?){
if
(
!
svga
){
console
.
log
(
'svga节点出错'
);
return
;}
svga
.
gotoAndStop
(
0
);
svga
.
play
();
if
(
callBack
){
svga
.
addEventListener
(
engine
.
Event
.
END_FRAME
,()
=>
{
svga
.
stop
();
callBack
();
svga
.
removeAllEventListener
();
},
this
)
}
}
public
static
stop
(
svga
){
if
(
!
svga
){
console
.
log
(
'svga节点出错'
);
return
;}
svga
.
stop
();
}
}
\ No newline at end of file
src/custom/answer-game/src/game/utils.ts
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2020-01-21.
*/
export
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
export
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
export
function
playSound
(
name
)
{
engine
.
playSound
(
engine
.
getAssetByName
(
name
).
uuid
,
{
keep
:
true
});
}
export
function
getStage
(){
return
engine
.
gameStage
.
stage
;
}
export
enum
OptionState
{
CHOICE_RIGHT
,
//选对
CHOICE_WRONG
,
//选错
CHOICE_SELECT
,
//选中
}
export
enum
GameState
{
STATE_START
,
//开始 选择中
STATE_END
,
//倒计时结束
}
\ No newline at end of file
src/custom/answer-game/src/index.ts
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2019-11-20.
*/
import
{
GameWrapper
}
from
"./game/GameWrapper"
;
import
{
injectProps
,
prepareProps
}
from
"./props"
;
export
default
function
(
props
)
{
prepareProps
();
injectProps
(
props
);
let
instance
=
new
GameWrapper
();
return
instance
;
}
src/custom/answer-game/src/props.ts
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2020-01-21.
*/
export
let
props
:
any
=
{};
export
function
prepareProps
()
{
let
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
export
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
src/custom/jiugong-turntable/debug/app.js
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2019-12-16.
*/
const
customId
=
'jiugong-turntable'
;
(
async
function
()
{
let
customModule
=
await
fetch
(
`../meta.json`
);
customModule
=
await
customModule
.
json
();
console
.
log
(
customModule
);
await
loadAssets
(
customModule
.
assets
);
launchWithCustomModule
(
customModule
);
})();
function
launchWithCustomModule
(
customModule
)
{
//engine.registerCustomCodeModule(customModule);
engine
.
registerCustomModule
(
customId
,
window
[
customId
]);
const
{
props
:
propsOption
,
assets
}
=
customModule
;
let
props
=
engine
.
computeProps
(
customModuleProps
,
propsOption
);
const
customModuleIns
=
{
id
:
customId
,
props
,
assets
,
};
engine
.
registerCustomModules
([
customModuleIns
]);
engine
.
launchWithConfig
({
options
:
{
entrySceneView
:
'entry'
,
},
assets
:
[],
views
:
[{
name
:
'entry'
,
type
:
'node'
,
properties
:
{
x
:
0
,
y
:
0
,
}
}],
},
null
,
function
()
{
setTimeout
(()
=>
{
engine
.
addCustomModule
(
customId
,
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
));
},
100
);
let
pram
=
[
{
id
:
1
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
2
,
img
:
'//yun.dui88.com/images/201907/xsit2cvmyl.jpeg'
},
{
id
:
3
,
img
:
'//yun.dui88.com/projectxh5/phonebill-250-250.png'
},
{
id
:
4
,
img
:
'//yun.dui88.com/images/201907/xsit2cvmyl.jpeg'
},
{
id
:
5
,
img
:
'//yun.dui88.com/projectxh5/alipay-250-250.png'
},
{
id
:
6
,
img
:
'//yun.dui88.com/projectxh5/phonebill-250-250.png'
},
{
id
:
7
,
img
:
'//yun.dui88.com/images/201907/xsit2cvmyl.jpeg'
},
{
id
:
8
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
}
]
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'jiugong-turntable-init'
,{
resources
:
pram
})
},
2000
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'jiugong-turntable-start'
)
},
4000
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'jiugong-turntable-winPrize'
,{
prizeID
:
4
})
},
6000
);
});
}
function
getAssetByUUID
(
uuid
)
{
return
engine
.
resolveCustomAsset
(
customId
,
uuid
);
}
function
getProps
()
{
return
engine
.
getProps
(
customId
);
}
src/custom/jiugong-turntable/debug/index.html
0 → 100644
View file @
81e5868b
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
九宫格答题
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
/>
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
/>
<meta
name=
"full-screen"
content=
"true"
/>
<meta
name=
"screen-orientation"
content=
"portrait"
/>
<meta
name=
"x5-fullscreen"
content=
"true"
/>
<meta
name=
"360-fullscreen"
content=
"true"
/>
<style>
html
,
body
{
padding
:
0
;
margin
:
0
;
border
:
0
;
width
:
100%
;
height
:
100%
;
overflow
:
hidden
;
position
:
absolute
;
background-color
:
#000000
;
}
</style>
</head>
<body>
<div
id=
"game-container"
style=
"line-height:0;font-size:0"
></div>
<script
src=
"//yun.duiba.com.cn/editor/zeroing/libs/engine.ebc906f6b50b8da0a669f77027981d5f3cb560ce.js"
></script>
<!--<script src="http://localhost:4002/debug/engine.js"></script>
<script src="http://localhost:4003/debug/engine-svga.js"></script>-->
<!--//yun.duiba.com.cn/aurora/assets/6a63b68a1fd87eaf60a515968f91a0b1014fe640.ttf-->
<script
src=
"//yun.duiba.com.cn/editor/zeroing/libs/svga.fd3923ae6e664251ca7981801a65809cc5f36bc3.js"
>
</script>
<!--<script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.9a9dbfda4cb2dd5508ecddfe3d95dfd88063f7b5.js"></script>-->
<script
src=
"app.js"
></script>
<script
src=
"props.js"
></script>
<script
src=
"load-assets.js"
></script>
<script
src=
"main.js"
></script>
<script>
</script>
</body>
\ No newline at end of file
src/custom/jiugong-turntable/debug/load-assets.js
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2020-01-21.
*/
const
assets
=
[
];
function
loadAssets
(
customModuleAssets
,
onProgress
,
onComplete
){
return
engine
.
loadAssets
(
assets
.
concat
(...
customModuleAssets
),
onProgress
,
onComplete
);
}
src/custom/jiugong-turntable/debug/main.js
0 → 100644
View file @
81e5868b
(
function
(
global
,
factory
)
{
typeof
exports
===
'object'
&&
typeof
module
!==
'undefined'
?
module
.
exports
=
factory
(
require
(
'tslib'
))
:
typeof
define
===
'function'
&&
define
.
amd
?
define
([
'tslib'
],
factory
)
:
(
global
=
global
||
self
,
global
[
'jiugong-turntable'
]
=
factory
(
global
.
tslib
));
}(
this
,
(
function
(
tslib
)
{
'use strict'
;
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
//# sourceMappingURL=utils.js.map
var
props
=
{};
function
prepareProps
()
{
var
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
//# sourceMappingURL=props.js.map
var
Turntable
=
(
function
(
_super
)
{
tslib
.
__extends
(
Turntable
,
_super
);
function
Turntable
(
res
)
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
_vertical_Y
=
props
.
vertical
||
20
;
_this
.
_horizontal_X
=
props
.
horizontal
||
20
;
_this
.
_prizeIndex
=
0
;
_this
.
_boxArray
=
[];
_this
.
_boxIndex
=
0
;
_this
.
tweenTime
=
props
.
tweenTime
||
200
;
_this
.
slowTweenTime
=
props
.
slowTweenTime
||
200
;
_this
.
circleNumber
=
0
;
_this
.
turntableOrder
=
[
1
,
2
,
3
,
5
,
8
,
7
,
6
,
4
];
_this
.
recordID
=
-
1
;
_this
.
boxPrizeIndex
=
-
1
;
_this
.
slowDown
=
false
;
_this
.
isStop
=
false
;
_this
.
initTurntable
(
res
);
_this
.
setNodeOrder
();
return
_this
;
}
Turntable
.
prototype
.
initTurntable
=
function
(
res
)
{
var
turnTableNode
=
this
.
_turnTableNode
=
new
engine
.
Container
();
this
.
addChild
(
turnTableNode
);
for
(
var
index_Y
=
0
;
index_Y
<
3
;
index_Y
++
)
{
var
_loop_1
=
function
(
index_X
)
{
if
(
index_X
==
1
&&
index_Y
==
1
)
return
"continue"
;
var
tmpNode
=
new
engine
.
Container
();
var
unchecked
=
this_1
.
getImage
(
'unchecked'
,
1
);
var
checked
=
this_1
.
getImage
(
'checked'
,
0
);
tmpNode
.
width
=
Math
.
max
(
unchecked
.
width
,
checked
.
width
);
this_1
.
_singleNodeWidth
=
this_1
.
_singleNodeWidth
?
this_1
.
_singleNodeWidth
:
tmpNode
.
width
;
tmpNode
.
height
=
Math
.
max
(
unchecked
.
height
,
checked
.
height
);
tmpNode
.
x
=
index_X
*
(
tmpNode
.
width
+
this_1
.
_horizontal_X
);
tmpNode
.
y
=
index_Y
*
(
tmpNode
.
height
+
this_1
.
_vertical_Y
);
tmpNode
.
addChild
(
unchecked
);
tmpNode
.
addChild
(
checked
);
turnTableNode
.
addChild
(
tmpNode
);
var
tmpTexture
=
engine
.
Texture
.
fromImage
(
res
[
this_1
.
_prizeIndex
].
img
,
undefined
);
var
prizeID
=
res
[
this_1
.
_prizeIndex
].
id
;
tmpTexture
.
addEventListener
(
'loaded'
,
function
()
{
var
prize
=
new
engine
.
Sprite
(
tmpTexture
);
prize
.
width
=
props
.
icon_width
;
prize
.
height
=
props
.
icon_height
;
prize
.
x
=
(
tmpNode
.
width
-
prize
.
width
)
/
2
+
props
.
icon_X
;
prize
.
y
=
(
tmpNode
.
height
-
prize
.
height
)
/
2
+
props
.
icon_Y
;
tmpNode
.
prizeID
=
prizeID
;
tmpNode
.
addChild
(
prize
);
},
this_1
);
this_1
.
_prizeIndex
++
;
this_1
.
_boxArray
.
push
(
tmpNode
);
};
var
this_1
=
this
;
for
(
var
index_X
=
0
;
index_X
<
3
;
index_X
++
)
{
_loop_1
(
index_X
);
}
}
turnTableNode
.
x
=
(
750
-
(
this
.
_singleNodeWidth
*
3
+
this
.
_horizontal_X
*
2
))
/
2
;
};
Turntable
.
prototype
.
setNodeOrder
=
function
()
{
var
tmpNodeArray
=
[];
for
(
var
index
=
0
;
index
<
this
.
turntableOrder
.
length
;
index
++
)
{
var
order
=
this
.
turntableOrder
[
index
];
tmpNodeArray
.
push
(
this
.
_boxArray
[
order
-
1
]);
}
this
.
_boxArray
=
tmpNodeArray
;
};
Turntable
.
prototype
.
getImage
=
function
(
resName
,
alpha
)
{
var
tmpImage
=
new
engine
.
Sprite
(
getTextureByName
(
resName
));
tmpImage
.
x
=
0
;
tmpImage
.
y
=
0
;
tmpImage
.
alpha
=
alpha
;
tmpImage
.
name
=
resName
;
return
tmpImage
;
};
Turntable
.
prototype
.
startDraw
=
function
()
{
var
_this
=
this
;
var
tmpCheckNode
=
this
.
_boxArray
[
this
.
_boxIndex
].
getChildByName
(
'checked'
);
if
(
this
.
isStop
)
{
engine
.
Tween
.
removeTweens
(
tmpCheckNode
);
return
;
}
if
(
this
.
slowDown
)
{
if
(
this
.
_boxIndex
!=
this
.
getNodeIndexOFprize
())
{
this
.
tweenTime
+=
this
.
slowTweenTime
;
}
else
{
this
.
isStop
=
true
;
this
.
twinkle
(
tmpCheckNode
);
}
}
engine
.
Tween
.
get
(
tmpCheckNode
)
.
to
({
alpha
:
1
},
this
.
tweenTime
/
2
)
.
to
({
alpha
:
0
},
this
.
tweenTime
/
2
)
.
call
(
function
()
{
if
(
_this
.
circleNumber
>=
props
.
circleNumber
&&
_this
.
getSlowStart
()
==
_this
.
_boxIndex
)
{
_this
.
slowDown
=
true
;
}
_this
.
_boxIndex
++
;
if
(
_this
.
_boxIndex
>=
_this
.
_boxArray
.
length
)
{
_this
.
_boxIndex
=
0
;
_this
.
circleNumber
++
;
}
_this
.
startDraw
();
});
};
Turntable
.
prototype
.
getSlowStart
=
function
()
{
if
(
this
.
recordID
<
0
)
return
-
1
;
var
tmpIndex
=
this
.
getNodeIndexOFprize
();
if
(
tmpIndex
<
4
)
{
return
tmpIndex
+
4
;
}
else
{
return
tmpIndex
-
4
;
}
};
Turntable
.
prototype
.
getNodeIndexOFprize
=
function
()
{
if
(
this
.
recordID
<
0
)
return
-
1
;
for
(
var
index
=
0
;
index
<
this
.
_boxArray
.
length
;
index
++
)
{
var
element
=
this
.
_boxArray
[
index
];
if
(
element
.
prizeID
===
this
.
recordID
)
{
return
index
;
}
}
return
-
1
;
};
Turntable
.
prototype
.
twinkle
=
function
(
tmpNode
)
{
engine
.
Tween
.
removeTweens
(
tmpNode
);
var
twinkleTime
=
1
;
engine
.
Tween
.
get
(
tmpNode
,
{
loop
:
true
})
.
to
({
alpha
:
0
},
30
)
.
to
({
alpha
:
1
},
30
)
.
call
(
function
()
{
if
(
twinkleTime
>
5
)
{
engine
.
Tween
.
removeTweens
(
tmpNode
);
engine
.
globalEvent
.
dispatchEvent
(
'jiugong-turntable-over'
);
return
;
}
else
{
twinkleTime
++
;
}
});
};
Turntable
.
prototype
.
setRecordID
=
function
(
prizeID
)
{
this
.
recordID
=
prizeID
;
};
Turntable
.
prototype
.
reset
=
function
()
{
engine
.
Tween
.
removeAllTweens
();
this
.
_boxIndex
=
0
;
this
.
tweenTime
=
props
.
tweenTime
||
200
;
this
.
slowTweenTime
=
props
.
slowTweenTime
||
200
;
this
.
circleNumber
=
0
;
this
.
recordID
=
-
1
;
this
.
boxPrizeIndex
=
-
1
;
this
.
slowDown
=
false
;
this
.
isStop
=
false
;
for
(
var
index
=
0
;
index
<
this
.
_boxArray
.
length
;
index
++
)
{
var
element
=
this
.
_boxArray
[
index
];
element
.
getChildByName
(
'checked'
).
alpha
=
0
;
}
};
return
Turntable
;
}(
engine
.
Container
));
//# sourceMappingURL=turntable.js.map
var
GameView
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameView
,
_super
);
function
GameView
()
{
return
_super
.
call
(
this
)
||
this
;
}
GameView
.
prototype
.
setup
=
function
(
res
)
{
if
(
this
.
_hasSetup
)
{
return
;
}
this
.
_hasSetup
=
true
;
var
turntable
=
this
.
_turntable
=
new
Turntable
(
res
);
this
.
addChild
(
turntable
);
};
GameView
.
prototype
.
startDraw
=
function
()
{
this
.
_turntable
.
startDraw
();
};
GameView
.
prototype
.
setRecordID
=
function
(
prizeID
)
{
this
.
_turntable
.
setRecordID
(
prizeID
);
};
GameView
.
prototype
.
reset
=
function
()
{
this
.
_turntable
.
reset
();
};
return
GameView
;
}(
engine
.
Container
));
//# sourceMappingURL=GameView.js.map
var
GameWrapper
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameWrapper
,
_super
);
function
GameWrapper
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-init'
,
_this
.
init
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-start'
,
_this
.
start
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-winPrize'
,
_this
.
winPrize
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-reset'
,
_this
.
reset
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-abnormal'
,
_this
.
reset
,
_this
);
return
_this
;
}
GameWrapper
.
prototype
.
init
=
function
(
event
)
{
var
gameView
=
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
gameView
);
console
.
log
(
'奖品图'
,
event
.
data
.
resources
);
this
.
_gameView
.
setup
(
event
.
data
.
resources
);
};
GameWrapper
.
prototype
.
start
=
function
(
event
)
{
this
.
_gameView
.
startDraw
();
};
GameWrapper
.
prototype
.
winPrize
=
function
(
event
)
{
this
.
_gameView
.
setRecordID
(
event
.
data
.
prizeID
);
};
GameWrapper
.
prototype
.
reset
=
function
()
{
this
.
_gameView
.
reset
();
};
return
GameWrapper
;
}(
engine
.
Container
));
//# sourceMappingURL=GameWrapper.js.map
function
index
(
props
)
{
prepareProps
();
injectProps
(
props
);
var
instance
=
new
GameWrapper
();
return
instance
;
}
//# sourceMappingURL=index.js.map
return
index
;
})));
//# sourceMappingURL=main.js.map
\ No newline at end of file
src/custom/jiugong-turntable/debug/main.js.map
0 → 100644
View file @
81e5868b
{"version":3,"file":"index.js","sources":["src/custom/jiugong-turntable/src/game/utils.ts","src/custom/jiugong-turntable/src/props.ts","src/custom/jiugong-turntable/src/game/turntable.ts","src/custom/jiugong-turntable/src/game/GameView.ts","src/custom/jiugong-turntable/src/game/GameWrapper.ts","src/custom/jiugong-turntable/src/index.ts"],"sourcesContent":["\r\n/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport function getTexture(uuid) {\r\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n}\r\n\r\nexport function getTextureByName(name) {\r\n\treturn getTexture(engine.getAssetByName(name).uuid);\r\n}\r\n\r\nexport function playSound(name) {\r\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\r\n}\r\nexport function getStage(){\r\n\treturn engine.gameStage.stage;\r\n}","/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport let props: any = {};\r\n\r\nexport function prepareProps() {\r\n\tlet metaProps = getProps();\r\n\r\n\tengine.injectProp(props, metaProps);\r\n}\r\n\r\nexport function injectProps(p) {\r\n\tengine.injectProp(props, p);\r\n}\r\n","\r\nimport {getTextureByName} from \"./utils\";\r\nimport {getStage} from \"./utils\";\r\n\r\nimport { props } from '../props';\r\n\r\nexport class Turntable extends engine.Container{\r\n private _turnTableNode;\r\n private _vertical_Y = props.vertical || 20;//纵向间距\r\n private _horizontal_X = props.horizontal || 20;//横向间距\r\n private _prizeIndex = 0;\r\n\r\n private _boxArray = [];\r\n private _boxIndex = 0;//当前下标\r\n\r\n private tweenTime = props.tweenTime || 200;//单个动画时间(毫秒)\r\n private slowTweenTime = props.slowTweenTime || 200;\r\n private circleNumber = 0;//圈数\r\n\r\n private turntableOrder = [1,2,3,5,8,7,6,4]; \r\n private recordID = -1;//中奖奖品ID\r\n private boxPrizeIndex = -1;//中奖奖品节点下标 \r\n private slowDown = false;//是否开始缓速\r\n private isStop = false;\r\n\r\n private _singleNodeWidth;//单个节点宽度\r\n constructor(res){\r\n super()\r\n this.initTurntable(res);\r\n this.setNodeOrder();\r\n }\r\n initTurntable(res){\r\n let turnTableNode = this._turnTableNode = new engine.Container();\r\n //turnTableNode.y = 50;\r\n this.addChild(turnTableNode);\r\n for (let index_Y = 0; index_Y < 3; index_Y++) {\r\n for (let index_X = 0; index_X < 3; index_X++) { \r\n if(index_X == 1 && index_Y == 1)continue;\r\n let tmpNode:any = new engine.Container()\r\n\r\n let unchecked = this.getImage('unchecked',1);\r\n let checked = this.getImage('checked',0);\r\n\r\n tmpNode.width = Math.max(unchecked.width,checked.width);\r\n this._singleNodeWidth = this._singleNodeWidth ? this._singleNodeWidth : tmpNode.width;\r\n tmpNode.height = Math.max(unchecked.height,checked.height);\r\n tmpNode.x = index_X*(tmpNode.width + this._horizontal_X);\r\n tmpNode.y = index_Y*(tmpNode.height + this._vertical_Y);\r\n tmpNode.addChild(unchecked);\r\n tmpNode.addChild(checked);\r\n turnTableNode.addChild(tmpNode);\r\n\r\n let tmpTexture:engine.Texture = engine.Texture.fromImage(res[this._prizeIndex].img,undefined);\r\n let prizeID = res[this._prizeIndex].id;\r\n tmpTexture.addEventListener('loaded',()=>{\r\n let prize = new engine.Sprite(tmpTexture);\r\n prize.width = props.icon_width;\r\n prize.height = props.icon_height;\r\n prize.x = (tmpNode.width - prize.width)/2 + props.icon_X;\r\n prize.y = (tmpNode.height - prize.height)/2 + props.icon_Y;\r\n tmpNode.prizeID = prizeID;\r\n tmpNode.addChild(prize);\r\n },this)\r\n this._prizeIndex ++ ;\r\n this._boxArray.push(tmpNode); \r\n }\r\n }\r\n turnTableNode.x = (750 - (this._singleNodeWidth*3 + this._horizontal_X*2))/2;\r\n }\r\n\r\n setNodeOrder(){\r\n let tmpNodeArray = [];\r\n for (let index = 0; index < this.turntableOrder.length; index++) {\r\n let order = this.turntableOrder[index];\r\n tmpNodeArray.push(this._boxArray[order-1]);\r\n }\r\n this._boxArray = tmpNodeArray;\r\n }\r\n\r\n getImage(resName,alpha){\r\n let tmpImage = new engine.Sprite(getTextureByName(resName));\r\n tmpImage.x = 0\r\n tmpImage.y = 0\r\n tmpImage.alpha = alpha;\r\n tmpImage.name = resName;\r\n return tmpImage;\r\n }\r\n startDraw(){\r\n let tmpCheckNode = this._boxArray[this._boxIndex].getChildByName('checked');\r\n if(this.isStop){engine.Tween.removeTweens(tmpCheckNode);return}\r\n if(this.slowDown)\r\n {\r\n if(this._boxIndex != this.getNodeIndexOFprize()){\r\n this.tweenTime += this.slowTweenTime;\r\n }else{\r\n this.isStop = true;\r\n this.twinkle(tmpCheckNode);\r\n }\r\n }\r\n engine.Tween.get(tmpCheckNode)\r\n .to({alpha:1},this.tweenTime/2)\r\n .to({alpha:0},this.tweenTime/2)\r\n .call(()=>{\r\n if(this.circleNumber >= props.circleNumber && this.getSlowStart() == this._boxIndex){\r\n this.slowDown = true;\r\n }\r\n this._boxIndex ++;\r\n if(this._boxIndex >= this._boxArray.length){\r\n this._boxIndex = 0;\r\n this.circleNumber++;\r\n }\r\n \r\n this.startDraw();\r\n \r\n \r\n })\r\n }\r\n //获取开始减速的下标\r\n private getSlowStart(){\r\n if(this.recordID < 0)return -1;\r\n let tmpIndex = this.getNodeIndexOFprize();\r\n if(tmpIndex < 4){\r\n return tmpIndex + 4;\r\n }else{\r\n return tmpIndex - 4\r\n }\r\n }\r\n //获取奖品节点下标\r\n getNodeIndexOFprize(){\r\n if(this.recordID < 0)return -1;\r\n for (let index = 0; index < this._boxArray.length; index++) {\r\n let element = this._boxArray[index];\r\n if(element.prizeID === this.recordID){\r\n return index;\r\n } \r\n }\r\n return -1;\r\n }\r\n //中奖节点闪烁\r\n twinkle(tmpNode){\r\n engine.Tween.removeTweens(tmpNode)\r\n let twinkleTime = 1;\r\n engine.Tween.get(tmpNode, {loop:true})\r\n .to({alpha:0}, 30)\r\n .to({alpha:1}, 30)\r\n .call(()=>{\r\n if(twinkleTime > 5){\r\n engine.Tween.removeTweens(tmpNode);\r\n engine.globalEvent.dispatchEvent('jiugong-turntable-over')\r\n return;\r\n }else{\r\n twinkleTime++;\r\n }\r\n })\r\n }\r\n setRecordID(prizeID){\r\n this.recordID = prizeID;\r\n }\r\n reset(){\r\n engine.Tween.removeAllTweens();\r\n this._boxIndex = 0;//当前下标\r\n this.tweenTime = props.tweenTime || 200;//单个动画时间(毫秒)\r\n this.slowTweenTime = props.slowTweenTime || 200;\r\n this.circleNumber = 0;//圈数\r\n this.recordID = -1;//中奖奖品ID\r\n this.boxPrizeIndex = -1;//中奖奖品节点下标 \r\n this.slowDown = false;//是否开始缓速\r\n this.isStop = false;\r\n for (let index = 0; index < this._boxArray.length; index++) {\r\n let element = this._boxArray[index];\r\n element.getChildByName('checked').alpha = 0;\r\n }\r\n \r\n }\r\n\r\n}","\r\n/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport {props} from \"../props\";\r\nimport { Turntable } from \"./turntable\";\r\n\r\n\r\n\r\n\r\n\r\nexport default class GameView extends engine.Container {\r\n\r\n\t\r\n\tprivate _hasSetup;\r\n\tprivate _turntable:Turntable;\r\n\tconstructor() {\r\n\t\tsuper();\t\r\n\t}\r\n\t setup(res){\r\n\t\tif (this._hasSetup) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._hasSetup = true;\r\n\t\t\r\n\t\tlet turntable = this._turntable = new Turntable(res);\r\n\t\tthis.addChild(turntable);\r\n\t}\r\n\tstartDraw(){\r\n\t\tthis._turntable.startDraw();\r\n\t}\r\n\tsetRecordID(prizeID){\r\n\t\tthis._turntable.setRecordID(prizeID)\r\n\t}\r\n\treset(){\r\n\t\tthis._turntable.reset();\r\n\t}\r\n}\r\n","\r\n\r\nimport { props } from './../props';\r\n\r\n\r\n/**\r\n * Created by rockyl on 2020-01-09.\r\n */\r\n\r\nimport GameView from \"./GameView\";\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\tprivate _gameView: GameView;\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-init', this.init, this);\r\n\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-start', this.start, this);\r\n\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-winPrize', this.winPrize, this);\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-reset', this.reset, this);\r\n\t\tengine.globalEvent.addEventListener('jiugong-turntable-abnormal', this.reset, this);\r\n\t}\r\n\r\n\tinit(event: engine.Event) {\r\n\t\t//初始化场景\r\n\t\tlet gameView = this._gameView = new GameView();\r\n\t\tthis.addChild(gameView);\r\n\t\tconsole.log('奖品图',event.data.resources); \r\n\t\tthis._gameView.setup(event.data.resources);\r\n\t}\r\n\r\n\t//开始抽奖\r\n\tstart(event: engine.Event){\r\n\t\tthis._gameView.startDraw();\r\n\t}\r\n\twinPrize(event: engine.Event){\r\n\t\tthis._gameView.setRecordID(event.data.prizeID)\r\n\t}\r\n\treset(){\r\n\t\tthis._gameView.reset();\r\n\t}\r\n\t// private visibilitychange(){\r\n\t// \tdocument.addEventListener('visibilitychange', function () {\r\n // if (document.visibilityState === 'hidden') {\r\n\t// \t\t\tconsole.log('放置后台');\r\n\t// \t\t\tengine.globalEvent.dispatchEvent('answer-game-visibilitychange',{hidden:true});\r\n // }\r\n // });\r\n\t// }\r\n}\r\n","/**\r\n * Created by rockyl on 2019-11-20.\r\n */\r\n\r\nimport {GameWrapper} from \"./game/GameWrapper\";\r\nimport {injectProps, prepareProps} from \"./props\";\r\n\r\nexport default function (props) {\r\n\tprepareProps();\r\n\tinjectProps(props);\r\n\r\n\tlet instance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iugong-turntable/debug/props.js
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2020-01-21.
*/
let
customModuleProps
=
{
};
src/custom/jiugong-turntable/meta.json
0 → 100644
View file @
81e5868b
{
"name"
:
"九宫格抽奖"
,
"desc"
:
"九宫格抽奖模块"
,
"props"
:
{
"horizontal"
:
{
"alias"
:
"横向间距"
,
"type"
:
"number"
,
"default"
:
1
},
"vertical"
:
{
"alias"
:
"纵向间距"
,
"type"
:
"number"
,
"default"
:
1
},
"circleNumber"
:
{
"alias"
:
"至少转的圈数"
,
"type"
:
"number"
,
"default"
:
3
},
"tweenTime"
:
{
"alias"
:
"单个奖品节点动画时间(毫秒)"
,
"type"
:
"number"
,
"default"
:
200
},
"slowTweenTime"
:
{
"alias"
:
"中奖后缓速递增时长"
,
"type"
:
"number"
,
"default"
:
200
},
"icon_width"
:
{
"alias"
:
"奖品图宽度"
,
"type"
:
"number"
,
"default"
:
110
},
"icon_height"
:
{
"alias"
:
"奖品图高度"
,
"type"
:
"number"
,
"default"
:
110
},
"icon_X"
:
{
"alias"
:
"奖品X轴偏移量(底框背景有透明)"
,
"type"
:
"number"
,
"default"
:
0
},
"icon_Y"
:
{
"alias"
:
"奖品Y轴偏移量(底框背景有透明)"
,
"type"
:
"number"
,
"default"
:
-20
}
},
"assets"
:
[
{
"name"
:
"unchecked"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/3351a20f982fea1fbcbbb3b85bc03f6b547c8bbc.png"
,
"uuid"
:
"48dc9c00-92c3-4926-8d6b-9eb3e0d0668d"
,
"ext"
:
".png"
},
{
"name"
:
"checked"
,
"url"
:
" //yun.duiba.com.cn/aurora/assets/2a9f9ecc43eb912db553fa4685c1987a937f0198.png"
,
"uuid"
:
"1d7bc84d-689d-4a6a-a023-e4a7b9659083"
,
"ext"
:
".png"
}
],
"events"
:
{
"in"
:
{
"jiugong-turntable-init"
:
{
"alias"
:
"初始化"
,
"data"
:
{
}
},
"jiugong-turntable-start"
:
{
"alias"
:
"开始"
,
"data"
:
{
}
},
"jiugong-turntable-winPrize"
:
{
"alias"
:
"中奖"
,
"data"
:
{
}
},
"jiugong-turntable-abnormal"
:
{
"alias"
:
"异常"
,
"data"
:
{
}
},
"jiugong-turntable-reset"
:
{
"alias"
:
"重置"
,
"data"
:
{
}
}
},
"out"
:
{
"jiugong-turntable-over"
:
{
"alias"
:
"结束"
,
"data"
:
{
}
}
}
}
}
\ No newline at end of file
src/custom/jiugong-turntable/src/game/GameView.ts
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2018/8/16.
*/
import
{
props
}
from
"../props"
;
import
{
Turntable
}
from
"./turntable"
;
export
default
class
GameView
extends
engine
.
Container
{
private
_hasSetup
;
private
_turntable
:
Turntable
;
constructor
()
{
super
();
}
setup
(
res
){
if
(
this
.
_hasSetup
)
{
return
;
}
this
.
_hasSetup
=
true
;
let
turntable
=
this
.
_turntable
=
new
Turntable
(
res
);
this
.
addChild
(
turntable
);
}
startDraw
(){
this
.
_turntable
.
startDraw
();
}
setRecordID
(
prizeID
){
this
.
_turntable
.
setRecordID
(
prizeID
)
}
reset
(){
this
.
_turntable
.
reset
();
}
}
src/custom/jiugong-turntable/src/game/GameWrapper.ts
0 → 100644
View file @
81e5868b
import
{
props
}
from
'./../props'
;
/**
* Created by rockyl on 2020-01-09.
*/
import
GameView
from
"./GameView"
;
export
class
GameWrapper
extends
engine
.
Container
{
private
_gameView
:
GameView
;
constructor
()
{
super
();
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-init'
,
this
.
init
,
this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-start'
,
this
.
start
,
this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-winPrize'
,
this
.
winPrize
,
this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-reset'
,
this
.
reset
,
this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-abnormal'
,
this
.
reset
,
this
);
}
init
(
event
:
engine
.
Event
)
{
//初始化场景
let
gameView
=
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
gameView
);
console
.
log
(
'奖品图'
,
event
.
data
.
resources
);
this
.
_gameView
.
setup
(
event
.
data
.
resources
);
}
//开始抽奖
start
(
event
:
engine
.
Event
){
this
.
_gameView
.
startDraw
();
}
winPrize
(
event
:
engine
.
Event
){
this
.
_gameView
.
setRecordID
(
event
.
data
.
prizeID
)
}
reset
(){
this
.
_gameView
.
reset
();
}
// private visibilitychange(){
// document.addEventListener('visibilitychange', function () {
// if (document.visibilityState === 'hidden') {
// console.log('放置后台');
// engine.globalEvent.dispatchEvent('answer-game-visibilitychange',{hidden:true});
// }
// });
// }
}
src/custom/jiugong-turntable/src/game/Turntable.ts
0 → 100644
View file @
81e5868b
import
{
getTextureByName
}
from
"./utils"
;
import
{
getStage
}
from
"./utils"
;
import
{
props
}
from
'../props'
;
export
class
Turntable
extends
engine
.
Container
{
private
_turnTableNode
;
private
_vertical_Y
=
props
.
vertical
||
20
;
//纵向间距
private
_horizontal_X
=
props
.
horizontal
||
20
;
//横向间距
private
_prizeIndex
=
0
;
private
_boxArray
=
[];
private
_boxIndex
=
0
;
//当前下标
private
tweenTime
=
props
.
tweenTime
||
200
;
//单个动画时间(毫秒)
private
slowTweenTime
=
props
.
slowTweenTime
||
200
;
private
circleNumber
=
0
;
//圈数
private
turntableOrder
=
[
1
,
2
,
3
,
5
,
8
,
7
,
6
,
4
];
private
recordID
=
-
1
;
//中奖奖品ID
private
boxPrizeIndex
=
-
1
;
//中奖奖品节点下标
private
slowDown
=
false
;
//是否开始缓速
private
isStop
=
false
;
private
_singleNodeWidth
;
//单个节点宽度
constructor
(
res
){
super
()
this
.
initTurntable
(
res
);
this
.
setNodeOrder
();
}
initTurntable
(
res
){
let
turnTableNode
=
this
.
_turnTableNode
=
new
engine
.
Container
();
//turnTableNode.y = 50;
this
.
addChild
(
turnTableNode
);
for
(
let
index_Y
=
0
;
index_Y
<
3
;
index_Y
++
)
{
for
(
let
index_X
=
0
;
index_X
<
3
;
index_X
++
)
{
if
(
index_X
==
1
&&
index_Y
==
1
)
continue
;
let
tmpNode
:
any
=
new
engine
.
Container
()
let
unchecked
=
this
.
getImage
(
'unchecked'
,
1
);
let
checked
=
this
.
getImage
(
'checked'
,
0
);
tmpNode
.
width
=
Math
.
max
(
unchecked
.
width
,
checked
.
width
);
this
.
_singleNodeWidth
=
this
.
_singleNodeWidth
?
this
.
_singleNodeWidth
:
tmpNode
.
width
;
tmpNode
.
height
=
Math
.
max
(
unchecked
.
height
,
checked
.
height
);
tmpNode
.
x
=
index_X
*
(
tmpNode
.
width
+
this
.
_horizontal_X
);
tmpNode
.
y
=
index_Y
*
(
tmpNode
.
height
+
this
.
_vertical_Y
);
tmpNode
.
addChild
(
unchecked
);
tmpNode
.
addChild
(
checked
);
turnTableNode
.
addChild
(
tmpNode
);
let
tmpTexture
:
engine
.
Texture
=
engine
.
Texture
.
fromImage
(
res
[
this
.
_prizeIndex
].
img
,
undefined
);
let
prizeID
=
res
[
this
.
_prizeIndex
].
id
;
tmpTexture
.
addEventListener
(
'loaded'
,()
=>
{
let
prize
=
new
engine
.
Sprite
(
tmpTexture
);
prize
.
width
=
props
.
icon_width
;
prize
.
height
=
props
.
icon_height
;
prize
.
x
=
(
tmpNode
.
width
-
prize
.
width
)
/
2
+
props
.
icon_X
;
prize
.
y
=
(
tmpNode
.
height
-
prize
.
height
)
/
2
+
props
.
icon_Y
;
tmpNode
.
prizeID
=
prizeID
;
tmpNode
.
addChild
(
prize
);
},
this
)
this
.
_prizeIndex
++
;
this
.
_boxArray
.
push
(
tmpNode
);
}
}
turnTableNode
.
x
=
(
750
-
(
this
.
_singleNodeWidth
*
3
+
this
.
_horizontal_X
*
2
))
/
2
;
}
setNodeOrder
(){
let
tmpNodeArray
=
[];
for
(
let
index
=
0
;
index
<
this
.
turntableOrder
.
length
;
index
++
)
{
let
order
=
this
.
turntableOrder
[
index
];
tmpNodeArray
.
push
(
this
.
_boxArray
[
order
-
1
]);
}
this
.
_boxArray
=
tmpNodeArray
;
}
getImage
(
resName
,
alpha
){
let
tmpImage
=
new
engine
.
Sprite
(
getTextureByName
(
resName
));
tmpImage
.
x
=
0
tmpImage
.
y
=
0
tmpImage
.
alpha
=
alpha
;
tmpImage
.
name
=
resName
;
return
tmpImage
;
}
startDraw
(){
let
tmpCheckNode
=
this
.
_boxArray
[
this
.
_boxIndex
].
getChildByName
(
'checked'
);
if
(
this
.
isStop
){
engine
.
Tween
.
removeTweens
(
tmpCheckNode
);
return
}
if
(
this
.
slowDown
)
{
if
(
this
.
_boxIndex
!=
this
.
getNodeIndexOFprize
()){
this
.
tweenTime
+=
this
.
slowTweenTime
;
}
else
{
this
.
isStop
=
true
;
this
.
twinkle
(
tmpCheckNode
);
}
}
engine
.
Tween
.
get
(
tmpCheckNode
)
.
to
({
alpha
:
1
},
this
.
tweenTime
/
2
)
.
to
({
alpha
:
0
},
this
.
tweenTime
/
2
)
.
call
(()
=>
{
if
(
this
.
circleNumber
>=
props
.
circleNumber
&&
this
.
getSlowStart
()
==
this
.
_boxIndex
){
this
.
slowDown
=
true
;
}
this
.
_boxIndex
++
;
if
(
this
.
_boxIndex
>=
this
.
_boxArray
.
length
){
this
.
_boxIndex
=
0
;
this
.
circleNumber
++
;
}
this
.
startDraw
();
})
}
//获取开始减速的下标
private
getSlowStart
(){
if
(
this
.
recordID
<
0
)
return
-
1
;
let
tmpIndex
=
this
.
getNodeIndexOFprize
();
if
(
tmpIndex
<
4
){
return
tmpIndex
+
4
;
}
else
{
return
tmpIndex
-
4
}
}
//获取奖品节点下标
getNodeIndexOFprize
(){
if
(
this
.
recordID
<
0
)
return
-
1
;
for
(
let
index
=
0
;
index
<
this
.
_boxArray
.
length
;
index
++
)
{
let
element
=
this
.
_boxArray
[
index
];
if
(
element
.
prizeID
===
this
.
recordID
){
return
index
;
}
}
return
-
1
;
}
//中奖节点闪烁
twinkle
(
tmpNode
){
engine
.
Tween
.
removeTweens
(
tmpNode
)
let
twinkleTime
=
1
;
engine
.
Tween
.
get
(
tmpNode
,
{
loop
:
true
})
.
to
({
alpha
:
0
},
30
)
.
to
({
alpha
:
1
},
30
)
.
call
(()
=>
{
if
(
twinkleTime
>
5
){
engine
.
Tween
.
removeTweens
(
tmpNode
);
engine
.
globalEvent
.
dispatchEvent
(
'jiugong-turntable-over'
)
return
;
}
else
{
twinkleTime
++
;
}
})
}
setRecordID
(
prizeID
){
this
.
recordID
=
prizeID
;
}
reset
(){
engine
.
Tween
.
removeAllTweens
();
this
.
_boxIndex
=
0
;
//当前下标
this
.
tweenTime
=
props
.
tweenTime
||
200
;
//单个动画时间(毫秒)
this
.
slowTweenTime
=
props
.
slowTweenTime
||
200
;
this
.
circleNumber
=
0
;
//圈数
this
.
recordID
=
-
1
;
//中奖奖品ID
this
.
boxPrizeIndex
=
-
1
;
//中奖奖品节点下标
this
.
slowDown
=
false
;
//是否开始缓速
this
.
isStop
=
false
;
for
(
let
index
=
0
;
index
<
this
.
_boxArray
.
length
;
index
++
)
{
let
element
=
this
.
_boxArray
[
index
];
element
.
getChildByName
(
'checked'
).
alpha
=
0
;
}
}
}
\ No newline at end of file
src/custom/jiugong-turntable/src/game/utils.ts
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2020-01-21.
*/
export
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
export
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
export
function
playSound
(
name
)
{
engine
.
playSound
(
engine
.
getAssetByName
(
name
).
uuid
,
{
keep
:
true
});
}
export
function
getStage
(){
return
engine
.
gameStage
.
stage
;
}
\ No newline at end of file
src/custom/jiugong-turntable/src/index.ts
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2019-11-20.
*/
import
{
GameWrapper
}
from
"./game/GameWrapper"
;
import
{
injectProps
,
prepareProps
}
from
"./props"
;
export
default
function
(
props
)
{
prepareProps
();
injectProps
(
props
);
let
instance
=
new
GameWrapper
();
return
instance
;
}
src/custom/jiugong-turntable/src/props.ts
0 → 100644
View file @
81e5868b
/**
* Created by rockyl on 2020-01-21.
*/
export
let
props
:
any
=
{};
export
function
prepareProps
()
{
let
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
export
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
src/custom/jump-high-2/debug/main.js
View file @
81e5868b
...
...
@@ -28,7 +28,7 @@
return
engine
.
getAssetByName
(
props
.
blockHitAssets
[
type
]);
}
function
createSvga
(
name
,
anchorName
)
{
var
inst
=
new
svga
.
Svga
();
var
inst
=
new
svga
.
Svga
();
inst
.
source
=
'asset://'
+
engine
.
getAssetByName
(
name
).
uuid
;
var
anchor
=
props
[(
anchorName
)];
if
(
anchor
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment