Commit 81e5868b authored by zjz1994's avatar zjz1994

Merge branch 'dev' of http://gitlab2.dui88.com/laoqifeng/zeroing-libs into dev

parents ec05804f e87cb514
This diff is collapsed.
This diff is collapsed.
/**
* 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);
}
<!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
/**
* Created by rockyl on 2020-01-21.
*/
const assets = [
];
function loadAssets(customModuleAssets, onProgress, onComplete){
return engine.loadAssets(assets.concat(...customModuleAssets), onProgress, onComplete);
}
This diff is collapsed.
This diff is collapsed.
/**
* Created by rockyl on 2020-01-21.
*/
let customModuleProps = {
};
{
"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
This diff is collapsed.
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
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();
}
}
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});
}
});
}
}
/**
* 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);
}
}
}
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
This diff is collapsed.
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
/**
* 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
/**
* 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;
}
/**
* 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);
}
/**
* 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);
}
<!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
/**
* Created by rockyl on 2020-01-21.
*/
const assets = [
];
function loadAssets(customModuleAssets, onProgress, onComplete){
return engine.loadAssets(assets.concat(...customModuleAssets), onProgress, onComplete);
}
(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
This diff is collapsed.
/**
* Created by rockyl on 2020-01-21.
*/
let customModuleProps = {
};
{
"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
/**
* 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();
}
}
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});
// }
// });
// }
}
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
/**
* 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
/**
* 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;
}
/**
* 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);
}
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment