Commit efd335fc authored by wildfirecode's avatar wildfirecode

1

parent a5e05ff4
......@@ -22,4 +22,5 @@
# doc/*.txt
# 会忽略 doc/notes.txt 但不包括 doc/server/arch.txt
node_modules
bin-release
\ No newline at end of file
bin-release
.DS_Store
No preview for this file type
{
"version": "0.2.0",
"configurations": [
{
"name": "Wing 内置播放器调试",
"type": "chrome",
"request": "launch",
"file": "index.html",
//"url": "http://mysite.com/index.html",
"runtimeExecutable": "${execPath}",
"sourceMaps": true,
"webRoot": "${workspaceRoot}",
"preLaunchTask":"build",
"port":5826
},
{
"name": "使用本机 Chrome 调试",
"type": "chrome",
"request": "launch",
"file": "index.html",
//"url": "http://mysite.com/index.html",
"runtimeExecutable": "",
"sourceMaps": true,
"webRoot": "${workspaceRoot}",
"preLaunchTask":"build",
"userDataDir":"${tmpdir}",
"port":5826
}
]
}
\ No newline at end of file
{
"version": "0.1.0",
"command": "egret",
"isShellCommand": true,
"tasks": [
{
"taskName": "build",
"showOutput": "always",
"args": [
"build",
"-sourcemap"
],
"problemMatcher": "$tsc"
},
{
"taskName": "clean",
"showOutput": "always",
"args": [
"build",
"-e"
],
"problemMatcher": "$tsc"
},
{
"taskName": "publish",
"showOutput": "always",
"args": [
"publish"
],
"problemMatcher": "$tsc"
}
]
}
\ No newline at end of file
......@@ -87,9 +87,12 @@ const check_webp_feature = (callback) => {
img.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA";
}
export const getImgURL = (url: string, cb) => {
check_webp_feature((isSupport) => {
if (isSupport) url += '?x-oss-process=image/format,webp';
cb(url)
export const getImgURL = (url: string):any => {
return new Promise((resolve, reject) => {
check_webp_feature((isSupport) => {
if (isSupport) url += '?x-oss-process=image/format,webp';
resolve(url);
})
})
}
\ No newline at end of file
import PanelCtrl from "../../src/ctrls/panelCtrl";
import SceneCtrl from "../../src/ctrls/sceneCtrl";
import Loading from "../../src/loading/Loading";
import { getResPath } from "../../src/utils";
import layers from "../../src/views/layers";
import { DataManager } from "../tw/manager/DataManager";
import { NetManager } from "../tw/manager/NetManager";
import AssetAdapter from "./adapter/AssetAdapter";
import ThemeAdapter from "./adapter/ThemeAdapter";
export default class MainBase extends eui.UILayer {
protected createChildren(): void {
super.createChildren();
egret.lifecycle.addLifecycleListener((context) => {
// custom lifecycle plugin
})
egret.lifecycle.onPause = () => {
egret.ticker.pause();
}
egret.lifecycle.onResume = () => {
egret.ticker.resume();
}
//inject the custom material parser
//注入自定义的素材解析器
let assetAdapter = new AssetAdapter();
egret.registerImplementation("eui.IAssetAdapter", assetAdapter);
egret.registerImplementation("eui.IThemeAdapter", new ThemeAdapter());
egret.ImageLoader.crossOrigin = "anonymous";
DataManager.ins.gameCfgData = window['CFG'];
DataManager.ins.gameCfgData.gameInfo.gameId = window["gameId"];
layers.init(this);
Loading.init(layers.topLayer);
PanelCtrl.instance.init(layers.popupLayer);
SceneCtrl.instance.init(layers.sceneLayer);
this.stage.scaleMode = egret.StageScaleMode.FIXED_WIDTH;
this.registerModules();
this.runGame().catch(e => {
console.log(e);
})
}
protected registerModules() { }
private async runGame() {
await this.loadResource()
this.createGameScene();
}
private async loadResource() {
try {
await RES.loadConfig("default.res.json", getResPath() + "resource/");
await this.loadTheme();
}
catch (e) {
console.error(e);
}
}
private loadTheme() {
return new Promise((resolve, reject) => {
// load skin theme configuration file, you can manually modify the file. And replace the default skin.
//加载皮肤主题配置文件,可以手动修改这个文件。替换默认皮肤。
let theme = new eui.Theme("resource/default.thm.json", this.stage);
theme.addEventListener(eui.UIEvent.COMPLETE, () => {
resolve();
}, this);
})
}
/**
* 创建场景界面
* Create scene interface
*/
protected createGameScene() {
NetManager.ins.getInfo(() => {
// 等待开奖 ↓
if (DataManager.ins.getInfoData.status.code == 4) {
// 已开奖 ↓
} else if (DataManager.ins.getInfoData.status.code == 5) {
// 正常游戏 ↓
} else {
}
});
}
}
\ No newline at end of file
//////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014-present, Egret Technology.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Egret nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////////////
export default class AssetAdapter implements eui.IAssetAdapter {
/**
* @language zh_CN
......
//////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014-present, Egret Technology.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Egret nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////////////
export default class ThemeAdapter implements eui.IThemeAdapter {
/**
......
{
"type": "activity",
"name": "demo"
"name": "fishing"
}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"alert_3","version":5,"files":["../assets/alert/Bitmap-4.png","../assets/alert/Bitmap-2.png","../assets/alert/Bitmap-1.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"loading_2","version":5,"files":["../assets/loading/bg.png","../assets/loading/progress.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"msg_0","version":5,"files":["../assets/msg/msgBg.png","../assets/msg/x.png","../assets/msg/sureBtn.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"playScene_1","version":5,"files":["../assets/playScene/wheelBg2.png","../assets/playScene/wating.png","../assets/playScene/startBtnBg.png","../assets/playScene/sideLightL.png","../assets/playScene/sideLightD.png","../assets/playScene/ruleBtn.png","../assets/playScene/redPacket.png","../assets/playScene/outShell.png","../assets/playScene/myCreditsBg.png","../assets/playScene/multiple3.png","../assets/playScene/multiple.png","../assets/playScene/heartB.png","../assets/playScene/go.png","../assets/playScene/gift.png","../assets/playScene/finger.png","../assets/playScene/earnPanel.png","../assets/playScene/coinIcon.png","../assets/playScene/coinf8.png","../assets/playScene/coinf7.png","../assets/playScene/coinf6.png","../assets/playScene/coinf5.png","../assets/playScene/coinf4.png","../assets/playScene/coinf3.png","../assets/playScene/coinf2.png","../assets/playScene/coinf1.png","../assets/playScene/circleLight2.png","../assets/playScene/circleLight1.png","../assets/playScene/+.png","../assets/playScene/-_.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"rule_4","version":5,"files":["../assets/rule/ruleBg.png","../assets/rule/X.png"]}
\ No newline at end of file
{"mc":{
"coin":{
"frameRate":24,
"labels":[
{"name":"rotate","frame":1,"end":8}
],
"events":[
],
"frames":[
{
"res":"DB0A020",
"x":0,
"y":0
},
{
"res":"11118EED",
"x":0,
"y":0
},
{
"res":"3ED3A22C",
"x":8,
"y":0
},
{
"res":"EA81E94D",
"x":20,
"y":0
},
{
"res":"9D677726",
"x":37,
"y":0
},
{
"res":"7A80B82A",
"x":20,
"y":0
},
{
"res":"AA7CF946",
"x":8,
"y":0
},
{
"res":"2E51F51A",
"x":0,
"y":0
}
]
}},
"res":{
"AA7CF946":{"x":176,"y":97,"w":78,"h":94},
"11118EED":{"x":1,"y":1,"w":93,"h":94},
"EA81E94D":{"x":191,"y":1,"w":53,"h":94},
"2E51F51A":{"x":96,"y":1,"w":93,"h":94},
"7A80B82A":{"x":1,"y":193,"w":53,"h":94},
"3ED3A22C":{"x":96,"y":97,"w":78,"h":94},
"9D677726":{"x":56,"y":193,"w":20,"h":94},
"DB0A020":{"x":1,"y":97,"w":93,"h":94}
}}
\ No newline at end of file
{"mc":{
"go":{
"frameRate":20,
"labels":[
{"name":"light","frame":1,"end":30}
],
"events":[
],
"frames":[
{
"res":"A9D1D9F7",
"x":8,
"y":5
},
{
"res":"A9D1D9F7",
"x":8,
"y":5
},
{
"res":"165B8393",
"x":8,
"y":5
},
{
"res":"165B8393",
"x":8,
"y":5
},
{
"res":"C533ADB8",
"x":8,
"y":5
},
{
"res":"C533ADB8",
"x":8,
"y":5
},
{
"res":"7C56153B",
"x":6,
"y":5
},
{
"res":"C3226410",
"x":6,
"y":5
},
{
"res":"C3226410",
"x":6,
"y":5
},
{
"res":"8A450EA9",
"x":8,
"y":5
},
{
"res":"764FAFD2",
"x":8,
"y":5
},
{
"res":"A86D3DEA",
"x":8,
"y":5
},
{
"res":"F8A55074",
"x":8,
"y":4
},
{
"res":"6DDF7B77",
"x":8,
"y":4
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"10E93F01",
"x":8,
"y":5
}
]
}},
"res":{
"10E93F01":{"x":709,"y":1,"w":174,"h":176},
"C3226410":{"x":1,"y":1,"w":176,"h":176},
"764FAFD2":{"x":1,"y":179,"w":174,"h":176},
"C533ADB8":{"x":1,"y":357,"w":174,"h":176},
"6DDF7B77":{"x":533,"y":1,"w":174,"h":177},
"F8A55074":{"x":357,"y":1,"w":174,"h":177},
"A86D3DEA":{"x":177,"y":179,"w":174,"h":176},
"165B8393":{"x":709,"y":179,"w":174,"h":176},
"A9D1D9F7":{"x":353,"y":180,"w":174,"h":176},
"AF8A3362":{"x":529,"y":180,"w":174,"h":176},
"7C56153B":{"x":179,"y":1,"w":176,"h":176},
"8A450EA9":{"x":177,"y":357,"w":174,"h":176}
}}
\ No newline at end of file
......@@ -4,10 +4,6 @@
"keys": "msgBg_png,x_png,sureBtn_png",
"name": "msg"
},
{
"keys": "wheelBg2_png,wating_png,startBtnBg_png,sideLightL_png,sideLightD_png,ruleBtn_png,redPacket_png,outShell_png,myCreditsBg_png,multiple3_png,multiple_png,heartB_png,goBtn_png,goBtn_json,go_png,gift_png,finger_png,earnPanel_png,coinIcon_png,coinf8_png,coinf7_png,coinf6_png,coinf5_png,coinf4_png,coinf3_png,coinf2_png,coinf1_png,coin_png,coin_json,circleLight2_png,circleLight1_png,+_png,-__png,playSceneBg_jpg",
"name": "playScene"
},
{
"keys": "bg_png,progress_png",
"name": "loading"
......@@ -21,8 +17,8 @@
"name": "rule"
},
{
"keys": "playSceneBg_jpg",
"name": "preload"
"keys": "monkey_png",
"name": "start_monkey"
}
],
"resources": [
......@@ -56,161 +52,6 @@
"type": "image",
"name": "x_png"
},
{
"url": "assets/playScene/+.png",
"type": "image",
"name": "+_png"
},
{
"url": "assets/playScene/-_.png",
"type": "image",
"name": "-__png"
},
{
"url": "assets/playScene/circleLight1.png",
"type": "image",
"name": "circleLight1_png"
},
{
"url": "assets/playScene/circleLight2.png",
"type": "image",
"name": "circleLight2_png"
},
{
"url": "assets/playScene/coin.png",
"type": "image",
"name": "coin_png"
},
{
"url": "assets/playScene/coinIcon.png",
"type": "image",
"name": "coinIcon_png"
},
{
"url": "assets/playScene/coinf1.png",
"type": "image",
"name": "coinf1_png"
},
{
"url": "assets/playScene/coinf2.png",
"type": "image",
"name": "coinf2_png"
},
{
"url": "assets/playScene/coinf3.png",
"type": "image",
"name": "coinf3_png"
},
{
"url": "assets/playScene/coinf4.png",
"type": "image",
"name": "coinf4_png"
},
{
"url": "assets/playScene/coinf5.png",
"type": "image",
"name": "coinf5_png"
},
{
"url": "assets/playScene/coinf6.png",
"type": "image",
"name": "coinf6_png"
},
{
"url": "assets/playScene/coinf7.png",
"type": "image",
"name": "coinf7_png"
},
{
"url": "assets/playScene/coinf8.png",
"type": "image",
"name": "coinf8_png"
},
{
"url": "assets/playScene/earnPanel.png",
"type": "image",
"name": "earnPanel_png"
},
{
"url": "assets/playScene/finger.png",
"type": "image",
"name": "finger_png"
},
{
"url": "assets/playScene/gift.png",
"type": "image",
"name": "gift_png"
},
{
"url": "assets/playScene/go.png",
"type": "image",
"name": "go_png"
},
{
"url": "assets/playScene/goBtn.png",
"type": "image",
"name": "goBtn_png"
},
{
"url": "assets/playScene/heartB.png",
"type": "image",
"name": "heartB_png"
},
{
"url": "assets/playScene/multiple.png",
"type": "image",
"name": "multiple_png"
},
{
"url": "assets/playScene/multiple3.png",
"type": "image",
"name": "multiple3_png"
},
{
"url": "assets/playScene/myCreditsBg.png",
"type": "image",
"name": "myCreditsBg_png"
},
{
"url": "assets/playScene/outShell.png",
"type": "image",
"name": "outShell_png"
},
{
"url": "assets/playScene/redPacket.png",
"type": "image",
"name": "redPacket_png"
},
{
"url": "assets/playScene/ruleBtn.png",
"type": "image",
"name": "ruleBtn_png"
},
{
"url": "assets/playScene/sideLightD.png",
"type": "image",
"name": "sideLightD_png"
},
{
"url": "assets/playScene/sideLightL.png",
"type": "image",
"name": "sideLightL_png"
},
{
"url": "assets/playScene/startBtnBg.png",
"type": "image",
"name": "startBtnBg_png"
},
{
"url": "assets/playScene/wating.png",
"type": "image",
"name": "wating_png"
},
{
"url": "assets/playScene/wheelBg2.png",
"type": "image",
"name": "wheelBg2_png"
},
{
"url": "assets/loading/bg.png",
"type": "image",
......@@ -232,19 +73,14 @@
"name": "ruleBg_png"
},
{
"url": "assets/playScene/coin.json",
"type": "json",
"name": "coin_json"
},
{
"url": "assets/playScene/goBtn.json",
"type": "json",
"name": "goBtn_json"
"url": "assets/startScene/bg.jpg",
"type": "image",
"name": "bg_jpg"
},
{
"url": "assets/playScene/playSceneBg.jpg",
"url": "assets/startScene/monkey/monkey.png",
"type": "image",
"name": "playSceneBg_jpg"
"name": "monkey_png"
}
]
}
\ No newline at end of file
......@@ -5,14 +5,8 @@
"resource/skins/AlertSkin.exml",
"resource/skins/LoadingSkin.exml",
"resource/skins/MsgSkin.exml",
"resource/skins/PlaySkin.exml",
"resource/skins/RuleSkin.exml",
"resource/skins/component/ResultPanel.exml",
"resource/skins/component/WheelBg.exml",
"resource/skins/component/WheelGift.exml",
"resource/skins/ui/IconButtonSkin.exml",
"resource/skins/ui/ProgressBarSkin.exml",
"resource/skins/ui/StartButtonSkin.exml"
"resource/skins/StartSkin.exml"
],
"path": "resource/default.thm.json"
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="PlaySkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing" >
<e:Image id="gamebg" x="0" y="0" source="playSceneBg_jpg"/>
<e:Button id="ruleBtn" label="" skinName="ui.IconButtonSkin" icon="ruleBtn_png" name="ruleBtn" horizontalCenter="-340" verticalCenter="-522.5"/>
<e:Button id="addBtn" label="" icon="+_png" name="addBtn" skinName="ui.IconButtonSkin" horizontalCenter="129.5" verticalCenter="388"/>
<e:Button id="reduceBtn" label="" icon="-__png" name="reduceBtn" skinName="ui.IconButtonSkin" anchorOffsetX="0" anchorOffsetY="0" horizontalCenter="-61.5" verticalCenter="388"/>
<e:Component id="WheelBg" skinName="WheelBg" width="603" height="603" horizontalCenter="0" verticalCenter="-23.5"/>
<e:Image id="outShell" source="outShell_png" verticalCenter="-20.5" horizontalCenter="3.5"/>
<e:Button id="startBtn" label="" icon="startBtnBg_png" horizontalCenter="0.5" verticalCenter="-40" skinName="ui.StartButtonSkin"/>
<e:Label id="unitTxt" text="投入积分" x="201.61" y="960" anchorOffsetX="0" width="63.39" anchorOffsetY="0" height="63.97" textAlign="center" textColor="0xffc303" fontFamily="微软雅黑"/>
<e:Label id="costTxt" text="40" size="40" anchorOffsetX="0" width="132" x="343" y="974.24" textAlign="center"/>
<e:Image id="myCreditsBg" source="myCreditsBg_png" y="884" horizontalCenter="0"/>
<e:Image x="233.31" y="893" anchorOffsetX="0" width="36" anchorOffsetY="0" height="36" source="coinIcon_png"/>
<e:Label id="userCreditsUnitName" text="总积分积分" x="276.8" y="898.34" anchorOffsetX="0" width="156.03" size="22" textColor="0xf7de4c" fontFamily="微软雅黑" height="25.33" anchorOffsetY="0"/>
<e:Label id="userCreditsNum" text="2000" x="384.33" y="895" anchorOffsetX="0" width="129.87" size="30" textAlign="center" textColor="0xf7de4c" height="24"/>
<e:Image id="circleLight1" source="circleLight1_png" y="265" height="630" width="630" horizontalCenter="0"/>
<e:Image id="circleLight2" source="circleLight2_png" width="630" height="630" horizontalCenter="0" verticalCenter="-23"/>
<e:Image id="sideLightD" source="sideLightD_png" x="46" y="396"/>
<e:Image id="sideLightL" source="sideLightL_png" x="-10" y="361.67"/>
<e:Image id="finger" source="finger_png" horizontalCenter="87.5" verticalCenter="44"/>
<e:Panel id="resulePanel" width="374" height="159" skinName="component.ResultPanel" anchorOffsetX="187" anchorOffsetY="79.5" scaleX="0" scaleY="0" horizontalCenter="-1" verticalCenter="-23.5"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="StartSkin" width="400" height="300" xmlns:e="http://ns.egret.com/eui">
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="component.ResultPanel" width="378" height="164" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="bg" source="earnPanel_png" x="0" y="0"/>
<e:Label id="credits" text="0" x="41.5" y="65" size="64" anchorOffsetX="0" width="292" textAlign="center"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="WheelBg" width="603" height="603" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="wheelBg" source="wheelBg2_png" anchorOffsetX="301.5" anchorOffsetY="301.5" left="0" top="0"/>
<e:Image source="gift_png" x="176.5" y="76.5" rotation="-22.5"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="WheelGift" width="92" height="300" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="gift" source="gift_png" y="61" horizontalCenter="0"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="ui.IconButtonSkin" xmlns:e="http://ns.egret.com/eui" xmlns:ns1="*" states="up,down,disabled" >
<e:Image id="iconDisplay" source="" horizontalCenter="0" verticalCenter="0" scaleX.down="0.95" scaleY.down="0.95"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="ui.ProgressBarSkin" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="thumb" source="loading_progress_thumb" x="3" y="3"/>
<e:Image id="track" source="loading_progress_track" scale9Grid="16,13,2,2" width="404"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="ui.StartButtonSkin" xmlns:e="http://ns.egret.com/eui" xmlns:ns1="*" states="up,down,disabled,wating" >
<e:Image id="iconDisplay" source="" horizontalCenter="0" verticalCenter="0" scaleX.down="0.95" scaleY.down="0.95"/>
<e:Image source="startBtnBg_png" includeIn="wating" x="0" y="0"/>
<e:Image source="wating_png" includeIn="wating" horizontalCenter="0" verticalCenter="23.5"/>
<e:Image source="startBtnBg_png" includeIn="disabled" x="0" y="0"/>
<e:Image source="go_png" includeIn="disabled" x="62" y="143"/>
<e:Image source="startBtnBg_png" includeIn="down" x="0" y="0" scaleX="0.95" scaleY="0.95"/>
<e:Image source="go_png" includeIn="down" horizontalCenter="0.5" verticalCenter="25.5" scaleX="0.95" scaleY="0.95"/>
<e:Image source="startBtnBg_png" includeIn="up" horizontalCenter="0" verticalCenter="0"/>
<e:Image source="go_png" includeIn="up" horizontalCenter="0.5" verticalCenter="25.5"/>
</e:Skin>
\ No newline at end of file
/**
* 示例自定义插件,您可以查阅 http://developer.egret.com/cn/github/egret-docs/Engine2D/projectConfig/cmdExtensionPlugin/index.html
* 了解如何开发一个自定义插件
*/
export class CustomPlugin implements plugins.Command {
constructor() {
}
async onFile(file: plugins.File) {
// console.log(file.relative)
return file;
}
async onFinish(commandContext: plugins.CommandContext) {
// console.log(commandContext.projectRoot)
// const path = require('path');
// commandContext.createFile('test.txt', new Buffer('123'));
}
}
\ No newline at end of file
export default class LoadingUI extends egret.Sprite implements RES.PromiseTaskReporter {
public constructor() {
super();
this.createView();
}
private textField: egret.TextField;
private createView(): void {
this.textField = new egret.TextField();
this.addChild(this.textField);
this.textField.y = 300;
this.textField.width = 480;
this.textField.height = 100;
this.textField.textAlign = "center";
}
public onProgress(current: number, total: number): void {
this.textField.text = `Loading...${current}/${total}`;
}
}
import { DataManager } from "../libs/tw/manager/DataManager";
import { NetManager } from "../libs/tw/manager/NetManager";
import MainBase from "../libs/tl/MainBase";
import Msg from "./alert/Msg";
import AssetAdapter from "./AssetAdapter";
import PanelCtrl from "./ctrls/panelCtrl";
import SceneCtrl from "./ctrls/sceneCtrl";
import Loading from "./loading/Loading";
import PlayScene from "./playScene/PlayScene";
import RulePanel from "./rulePanel/RulePanel";
import ThemeAdapter from "./ThemeAdapter";
import { ModuleTypes } from "./types/sceneTypes";
import { getResPath } from "./utils";
import layers from "./views/layers";
class Main extends eui.UILayer {
protected createChildren(): void {
super.createChildren();
// alert(1)
egret.lifecycle.addLifecycleListener((context) => {
// custom lifecycle plugin
})
egret.lifecycle.onPause = () => {
egret.ticker.pause();
}
egret.lifecycle.onResume = () => {
egret.ticker.resume();
}
//inject the custom material parser
//注入自定义的素材解析器
let assetAdapter = new AssetAdapter();
egret.registerImplementation("eui.IAssetAdapter", assetAdapter);
egret.registerImplementation("eui.IThemeAdapter", new ThemeAdapter());
egret.ImageLoader.crossOrigin = "anonymous";
DataManager.ins.gameCfgData = window['CFG'];
DataManager.ins.gameCfgData.gameInfo.gameId = window["gameId"];
NetManager.ins.getCredits(()=>{});
layers.init(this);
Loading.init(layers.topLayer);
PanelCtrl.instance.init(layers.popupLayer);
SceneCtrl.instance.init(layers.sceneLayer);
this.stage.scaleMode = egret.StageScaleMode.FIXED_WIDTH;
import StartScene from "./startScene/StartScene";
class Main extends MainBase {
protected registerModules() {
PanelCtrl.instance.registerPanelClass(ModuleTypes.MSG_PANEL, Msg);
PanelCtrl.instance.registerPanelClass(ModuleTypes.RULE_PANEL, RulePanel);
SceneCtrl.instance.registerSceneClass(ModuleTypes.PALY_SCENE, PlayScene);
this.runGame().catch(e => {
console.log(e);
})
SceneCtrl.instance.registerSceneClass(ModuleTypes.START_SCENE, StartScene);
}
private async runGame() {
await this.loadResource()
this.createGameScene();
RES.loadGroup("msg", 10);
}
private async loadResource() {
try {
// const loadingView = new LoadingUI();
// this.stage.addChild(loadingView);
await RES.loadConfig("default.res.json", getResPath() + "resource/");
await this.loadTheme();
// await RES.loadGroup("msg", 10);
// this.stage.removeChild(loadingView);
}
catch (e) {
console.error(e);
}
}
private loadTheme() {
return new Promise((resolve, reject) => {
// load skin theme configuration file, you can manually modify the file. And replace the default skin.
//加载皮肤主题配置文件,可以手动修改这个文件。替换默认皮肤。
let theme = new eui.Theme("resource/default.thm.json", this.stage);
theme.addEventListener(eui.UIEvent.COMPLETE, () => {
resolve();
}, this);
})
}
private textfield: egret.TextField;
/**
* 创建场景界面
* Create scene interface
*/
protected createGameScene(): void {
NetManager.ins.getInfo(() => {
// 等待开奖 ↓
if (DataManager.ins.getInfoData.status.code == 4) {
// 已开奖 ↓
} else if (DataManager.ins.getInfoData.status.code == 5) {
// 正常游戏 ↓
} else {
SceneCtrl.instance.change(ModuleTypes.PALY_SCENE)
}
});
// setTimeout(() => {
// // panelCtrl.showAlertPanel('te111st');
// // Loading.instace.show()
// }, 3000);
protected async createGameScene() {
// await RES.getResAsync('bg_jpg');
SceneCtrl.instance.change(ModuleTypes.START_SCENE);
}
}
......
/**
* 平台数据接口。
* 由于每款游戏通常需要发布到多个平台上,所以提取出一个统一的接口用于开发者获取平台数据信息
* 推荐开发者通过这种方式封装平台逻辑,以保证整体结构的稳定
* 由于不同平台的接口形式各有不同,白鹭推荐开发者将所有接口封装为基于 Promise 的异步形式
*/
declare interface Platform {
getUserInfo(): Promise<any>;
login(): Promise<any>
}
export class DebugPlatform implements Platform {
async getUserInfo() {
return { nickName: "username" }
}
async login() {
}
}
export declare let platform: Platform;
export declare interface Window {
platform: Platform
}
......@@ -6,9 +6,10 @@ export default class ComponentBase extends eui.Component {
super();
this.data = {};
this.skinName = getSkinPath(this.skinKey);
this.addEventListener(egret.Event.COMPLETE, this.onSkinComplete, this);
if (this.skin) {
this.onSkinComplete();
} else {
this.addEventListener(egret.Event.COMPLETE, this.onSkinComplete, this);
}
}
......@@ -29,5 +30,5 @@ export default class ComponentBase extends eui.Component {
destroy() {
this.removeEvents();
}
}
\ No newline at end of file
This diff is collapsed.
import { getImgURL } from "../../libs/tc/util/GFun";
import Scene from "../views/Scene";
import { getResPath } from "../utils";
const { TouchEvent } = egret;
export default class StartScene extends Scene {
start(data?) {
this.createBg();
}
async createBg() {
let url = getResPath() + 'resource/assets/startScene/bg.jpg';
url = await getImgURL(url);
RES.getResByUrl(url, (picData) => {
const pic = new egret.Bitmap(picData);
this.addChild(pic);
}, this, RES.ResourceItem.TYPE_IMAGE);
}
protected get skinKey() { return 'Start' }
}
\ No newline at end of file
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