Commit 9ba48513 authored by wildfirecode's avatar wildfirecode

1

parent 59bc156e
......@@ -24,3 +24,4 @@
node_modules
bin-release
.DS_Store
egret/.DS_Store
No preview for this file type
......@@ -42,18 +42,18 @@
<!-- <script src="default.thm.js"></script> -->
<script src="output.js"></script>
<script>
var debug = 1;
var moneyHandSize = 50;
var boxmap = {
coin: { award: 0, skin: 'http://localhost:8080/egret/resource/assets/startScene/coin.png' },
gift: { award: 0, skin: 'http://localhost:8080/egret/resource/assets/startScene/gift.png' },
gift2: { award: 0, skin: 'http://localhost:8080/egret/resource/assets/startScene/gift2.png' },
woodbox: { award: 1, skin: 'http://localhost:8080/egret/resource/assets/startScene/woodbox.json', offset: [128, 79] }, //木宝箱
silverbox: { award: 3, skin: 'http://localhost:8080/egret/resource/assets/startScene/silverbox.png' },//银宝箱
goldenbox: { award: 5, skin: 'http://localhost:8080/egret/resource/assets/startScene/goldenbox.png' },//金宝箱
var __debug__ = 0;
var __monkeyHandSize__ = 50;
var __boxMoveSpeed__ = 1.5;
var __boxmap__ = {
coin: { award: 0, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/coin.png' },
gift: { award: 0, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/gift.png' },
gift2: { award: 0, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/gift2.png' },
woodbox: { award: 1, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/woodbox.json', offset: [128, 79] }, //木宝箱
silverbox: { award: 3, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/silverbox.png' },//银宝箱
goldenbox: { award: 5, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/goldenbox.png' },//金宝箱
};
var __bgUrl__ = 'http://localhost:8080/egret/resource/assets/startScene/bg.jpg';
var __bgUrl__ = 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/bg.jpg';
var gameId = 1;
var CFG = {
......@@ -80,6 +80,7 @@
}
}
var recordUrl = 'record/';
var resPath = '';
function resolve(a) {
var b = eval(a);
return b;
......
declare var resPath:string;
declare var requirelogin:Function;
declare var CFG;
declare var __debug__:string;
declare interface IBoxItem {
award: number;
skin: string;
offset: number[];
}
declare var __boxmap__: { [key: string]: IBoxItem };
declare var __bgUrl__:string;
declare var __monkeyHandSize__:number;
declare var __boxMoveSpeed__:number;
\ No newline at end of file
declare class StartSkin extends eui.Skin{
}
{
"initial": [
"libs/modules/egret/egret.js",
"libs/modules/egret/egret.web.js",
"libs/modules/eui/eui.js",
"libs/modules/assetsmanager/assetsmanager.js",
"libs/modules/tween/tween.js",
"libs/modules/game/game.js",
"libs/modules/promise/promise.js"
],
"game": [
"bin-debug/libs/tw/data/pet/IToyItemData.js",
"bin-debug/libs/tc/index.js",
"bin-debug/libs/tc/enum/ModuleType.js",
"bin-debug/libs/tc/interface/IModuleData.js",
"bin-debug/libs/tc/interface/IDestroy.js",
"bin-debug/libs/tc/component/ABModule.js",
"bin-debug/libs/tc/enum/LayoutType.js",
"bin-debug/libs/tc/enum/TimeFormat.js",
"bin-debug/libs/tc/interface/IData.js",
"bin-debug/libs/tc/interface/INetData.js",
"bin-debug/libs/tc/manager/ABAnimationManager.js",
"bin-debug/libs/tc/manager/ABAudioManager.js",
"bin-debug/libs/tc/manager/ABDataManager.js",
"bin-debug/libs/tc/manager/ABModuleManager.js",
"bin-debug/libs/tc/util/GTime.js",
"bin-debug/libs/tc/util/GConsole.js",
"bin-debug/libs/tc/manager/ABNetManager.js",
"bin-debug/libs/tc/manager/ABPanelManager.js",
"bin-debug/libs/tc/manager/ABResManager.js",
"bin-debug/libs/tc/manager/ABSceneManager.js",
"bin-debug/libs/tc/manager/ABStageManager.js",
"bin-debug/libs/tc/manager/ABVideoManager.js",
"bin-debug/libs/tc/util/GMath.js",
"bin-debug/libs/tc/util/GFun.js",
"bin-debug/libs/tc/util/GCache.js",
"bin-debug/libs/tc/util/GDispatcher.js",
"bin-debug/libs/tc/util/GLang.js",
"bin-debug/libs/tc/util/GPool.js",
"bin-debug/types/sceneTypes.js",
"bin-debug/utils.js",
"bin-debug/components/ComponentBase.js",
"bin-debug/views/Panel.js",
"bin-debug/ctrls/panelCtrl.js",
"bin-debug/views/Scene.js",
"bin-debug/ctrls/sceneCtrl.js",
"bin-debug/loading/Loading.js",
"bin-debug/views/layers.js",
"bin-debug/libs/tw/data/pets/IPetMsgData.js",
"bin-debug/libs/tw/data/Data.js",
"bin-debug/libs/tw/data/pets/GetVisitInfoData.js",
"bin-debug/libs/tw/data/game/getInfo/IStatusData.js",
"bin-debug/libs/tw/data/game/getInfo/GetSummerInfoData.js",
"bin-debug/libs/tw/data/game/doRevive/GetReviveCardNumData.js",
"bin-debug/libs/tw/data/game/doRevive/DoReviveData.js",
"bin-debug/libs/tw/data/plug/doJoinPlugDraw/DoJoinPlugDrawData.js",
"bin-debug/libs/tw/enum/NetName.js",
"bin-debug/libs/tw/data/custom/questionSbumit/QuestionSubmitData.js",
"bin-debug/libs/tw/data/common/getCollectRule/ICollectGoodData.js",
"bin-debug/libs/tw/data/common/getCollectRule/ICollectRuleData.js",
"bin-debug/libs/tw/data/common/getCollectRule/GetCollectRuleData.js",
"bin-debug/libs/tw/data/game/datapash/DatapashData.js",
"bin-debug/libs/tw/data/common/openCollectGoodsPrize/openCollectGoodsPrizeData.js",
"bin-debug/libs/tw/util/TwLang.js",
"bin-debug/libs/tw/data/game/doStart/ExtraData.js",
"bin-debug/libs/tw/data/game/doStart/DoStartData.js",
"bin-debug/libs/tw/data/game/doStart/GetStartStatusData.js",
"bin-debug/libs/tw/data/game/getInfo/GetInfoData.js",
"bin-debug/libs/tw/data/game/getOptions/IGameOptionData.js",
"bin-debug/libs/tw/data/game/getOptions/GetOptionsData.js",
"bin-debug/libs/tw/data/game/getRule/GetRuleData.js",
"bin-debug/libs/tw/data/game/getUserTotalScore/GetUserTotalScoreData.js",
"bin-debug/libs/tw/data/game/guessPoker/GuessPokerData.js",
"bin-debug/libs/tw/data/game/submit/GameSubmitData.js",
"bin-debug/libs/tw/data/game/common/IUserData.js",
"bin-debug/libs/tw/data/game/realtimerank/RealTimeRankData.js",
"bin-debug/libs/tw/data/game/winranks/IConsumerData.js",
"bin-debug/libs/tw/data/game/winranks/IRankData.js",
"bin-debug/libs/tw/data/game/winranks/WinRanksData.js",
"bin-debug/libs/tw/data/custom/ajaxElement/ICustomOptionData.js",
"bin-debug/libs/tw/data/custom/ajaxElement/IElementData.js",
"bin-debug/libs/tw/data/custom/ajaxElement/AjaxElementData.js",
"bin-debug/libs/tw/data/custom/doJoin/DoJoinData.js",
"bin-debug/libs/tw/data/custom/ajaxThroughInfo/IThroughInfoData.js",
"bin-debug/libs/tw/data/custom/ajaxThroughInfo/AjaxThroughInfoData.js",
"bin-debug/libs/tw/data/custom/getOrderInfo/GetOrderInfoData.js",
"bin-debug/libs/tw/enum/LotteryType.js",
"bin-debug/libs/tw/data/common/IExposureData.js",
"bin-debug/libs/tw/data/common/lottery/LotteryData.js",
"bin-debug/libs/tw/data/custom/doJoin/GetCustomOrderStatusData.js",
"bin-debug/libs/tw/data/common/getRole/GetRoleData.js",
"bin-debug/libs/tw/data/common/getCredits/GetCreditsData.js",
"bin-debug/libs/tw/data/common/addTimesForActivity/AddTimesForActivityData.js",
"bin-debug/libs/tw/data/common/setRole/SetRoleData.js",
"bin-debug/libs/tw/data/game/submit/GameGetSubmitResultData.js",
"bin-debug/libs/tw/data/custom/throughSubmit/ThroughSubmitData.js",
"bin-debug/libs/tw/data/custom/beforSubmit/BeforSubmitData.js",
"bin-debug/libs/tw/data/pet/PetAdopteData.js",
"bin-debug/libs/tw/data/pet/PetFeedData.js",
"bin-debug/libs/tw/data/pet/PetStatusData.js",
"bin-debug/libs/tw/data/pet/SignInfoVo.js",
"bin-debug/libs/tw/data/pet/SignInfoData.js",
"bin-debug/libs/tw/data/pet/IPetToyData.js",
"bin-debug/libs/tw/data/pet/PetHomeInfoData.js",
"bin-debug/libs/tc/enum/ResPriority.js",
"bin-debug/libs/tw/data/pet/GetToysData.js",
"bin-debug/libs/tw/data/pet/ToyExchangeData.js",
"bin-debug/libs/tw/data/pet/ToyUseData.js",
"bin-debug/libs/tw/data/pet/CollectData.js",
"bin-debug/libs/tw/data/plug/doJoinPlugDraw/GetPlugOrderStatusData.js",
"bin-debug/libs/tw/data/plug/optionInfo/IPlugOptionData.js",
"bin-debug/libs/tw/data/plug/optionInfo/IPlugData.js",
"bin-debug/libs/tw/data/plug/optionInfo/OptionInfoData.js",
"bin-debug/libs/tw/data/plug/unblocking/UnblockingData.js",
"bin-debug/libs/tw/data/plug/getPrizeInfo/IPrizeData.js",
"bin-debug/libs/tw/data/plug/getPrizeInfo/GetPrizeInfoData.js",
"bin-debug/libs/tw/data/pet/PetIndexData.js",
"bin-debug/libs/tw/data/game/cfg/IAppData.js",
"bin-debug/libs/tw/data/game/cfg/IDefenseStrategyData.js",
"bin-debug/libs/tw/data/game/cfg/IExtraCfgData.js",
"bin-debug/libs/tw/data/game/cfg/IRecommendData.js",
"bin-debug/libs/tw/data/game/cfg/IGameData.js",
"bin-debug/libs/tw/data/game/cfg/IGameCfgData.js",
"bin-debug/libs/tw/data/pet/GetRankItemData.js",
"bin-debug/libs/tw/data/pet/GetRankListData.js",
"bin-debug/libs/tw/data/pet/GetFoodPilesData.js",
"bin-debug/libs/tw/data/common/record/RecordData.js",
"bin-debug/libs/tw/data/common/GetRecordData.js",
"bin-debug/libs/tw/data/pets/UseToyData.js",
"bin-debug/libs/tw/data/pets/GetActToysItemData.js",
"bin-debug/libs/tw/data/pets/GetActToysListData.js",
"bin-debug/libs/tw/data/pets/ToyExchangesData.js",
"bin-debug/libs/tw/data/pets/GetUserToysItemData.js",
"bin-debug/libs/tw/data/pets/GetUserToysListData.js",
"bin-debug/libs/tw/data/pets/IUsingPetToysData.js",
"bin-debug/libs/tw/data/pets/IWanderPetData.js",
"bin-debug/libs/tw/data/pets/GetHomeInfoData.js",
"bin-debug/libs/tw/data/pets/PetsIndexData.js",
"bin-debug/libs/tw/data/pets/IVisitPetData.js",
"bin-debug/libs/tw/data/pets/VisitStatisticsData.js",
"bin-debug/libs/tw/data/pets/IPlayToyDetailData.js",
"bin-debug/libs/tw/data/pets/VisitDetailData.js",
"bin-debug/libs/tw/data/custom/cfg/ICustomCfgData.js",
"bin-debug/libs/tw/manager/DataManager.js",
"bin-debug/libs/tw/manager/NetManager.js",
"bin-debug/libs/tl/adapter/AssetAdapter.js",
"bin-debug/libs/tl/adapter/ThemeAdapter.js",
"bin-debug/libs/tl/MainBase.js",
"bin-debug/libs/tw/data/common/IShareData.js",
"bin-debug/libs/tw/data/common/winners/IWinnerData.js",
"bin-debug/libs/tw/data/common/winners/WinnersData.js",
"bin-debug/libs/tw/data/game/datapash/IDynamicData.js",
"bin-debug/libs/tw/model/Model.js",
"bin-debug/libs/tw/model/common/ActivityModel.js",
"bin-debug/libs/tw/model/common/CustomModel.js",
"bin-debug/libs/tw/model/common/GameModel.js",
"bin-debug/libs/tw/model/common/RuleModel.js",
"bin-debug/libs/tw/model/common/SignModel.js",
"bin-debug/libs/tw/model/custom/CustomOptionInfoModel.js",
"bin-debug/libs/tw/model/custom/CustomPlayModel.js",
"bin-debug/libs/tw/model/custom/CustomPlayBeforModel.js",
"bin-debug/libs/tw/model/custom/CustomPlayThroughModel.js",
"bin-debug/libs/tw/model/custom/CustomWinModel.js",
"bin-debug/libs/tw/model/game/GameEndModel.js",
"bin-debug/libs/tw/model/game/GameEndRankModel.js",
"bin-debug/libs/tw/model/game/GameLoseModel.js",
"bin-debug/libs/tw/model/game/GameOptionModel.js",
"bin-debug/libs/tw/model/game/GamePlayModel.js",
"bin-debug/libs/tw/model/game/GameRealTimeRankModel.js",
"bin-debug/libs/tw/model/game/GameStartModel.js",
"bin-debug/libs/tw/model/game/GameWinModel.js",
"bin-debug/libs/tw/model/game/GameWinnerModel.js",
"bin-debug/libs/tw/model/plug/PlugWinModel.js",
"bin-debug/libs/tw/model/sign/SignAdopteModel.js",
"bin-debug/libs/tw/model/sign/SignPlayModel.js",
"bin-debug/libs/tw/util/Buried.js",
"bin-debug/libs/tw/util/Share.js",
"bin-debug/libs/tw/util/TwFun.js",
"bin-debug/scripts/ExmlPlugin2.js",
"bin-debug/scripts/MyExmlPlugin.js",
"bin-debug/scripts/PublishExmlOnly.js",
"bin-debug/scripts/config.js",
"bin-debug/alert/Msg.js",
"bin-debug/rulePanel/RulePanel.js",
"bin-debug/components/SheetAnimation.js",
"bin-debug/startScene/Box.js",
"bin-debug/startScene/BoxListCtrl.js",
"bin-debug/startScene/Monkey.js",
"bin-debug/startScene/Net.js",
"bin-debug/startScene/StartScene.js",
"bin-debug/Main.js",
"bin-debug/alert/Alert.js",
"bin-debug/ctrls/showAlertPanel.js",
"bin-debug/ctrls/net/doStart.js",
"bin-debug/ctrls/net/getRule.js",
"bin-debug/ctrls/net/realtimerank.js",
"bin-debug/startScene/data/getBoxList.js"
]
}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"alert_2","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_1","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":"rule_3","version":5,"files":["../assets/rule/ruleBg.png","../assets/rule/X.png"]}
\ No newline at end of file
......@@ -2,10 +2,6 @@
"skins": {},
"autoGenerateExmlsList": true,
"exmls": [
"resource/skins/AlertSkin.exml",
"resource/skins/LoadingSkin.exml",
"resource/skins/MsgSkin.exml",
"resource/skins/RuleSkin.exml",
"resource/skins/StartSkin.exml"
],
"path": "resource/default.thm.json"
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="AlertSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="Bitmap-1_png" y="175" horizontalCenter="0"/>
<e:Button id="confirmBtn" label="{data.btnTxt}" y="361" horizontalCenter="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="Bitmap-2_png" source.down="Bitmap-2_png" source.disabled="Bitmap-2_png" horizontalCenter.down="0" verticalCenter.down="0"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="closeBtn" label="" x="586.18" y="143">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="Bitmap-4_png" source.down="Bitmap-4_png" source.disabled="Bitmap-4_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Label text="{data.message}" y="239" textColor="0x000000" horizontalCenter="0"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="loadingSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing" xmlns:tween="egret.tween.*">
<w:Declarations>
</w:Declarations>
<e:Image y="288" source="bg_png" horizontalCenter="0"/>
<e:Image id="waitImg" source="progress_png" y="380" anchorOffsetX="28" anchorOffsetY="28" horizontalCenter="0" rotation="{data.speed}"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="MsgSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Rect id="dark" width="750" height="1624" x="0" y="0" fillAlpha="0.5"/>
<e:Image id="bg" y="160" x="105.5" source="msgBg_png"/>
<e:Button id="confirmBtn" label="{data.btnTxt}" y="610" x="209.5">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="sureBtn_png" source.down="sureBtn_png" source.disabled="sureBtn_png"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="closeBtn" label="" x="562.83" y="398.51">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="x_png" source.down="x_png" source.disabled="x_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Label id="msgTxt" text="{data.message}" y="469.51" textColor="0xeeeeee" anchorOffsetX="0" width="380.66" anchorOffsetY="0" height="113.34" size="34" textAlign="center" horizontalCenter="0"/>
<e:Button id="creditsOutBtn" label="" x="209.33" y="610">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="sureBtn_png" source.down="sureBtn_png" source.disabled="sureBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="RuleSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Rect id="dark" width="750" height="1624" x="0" y="0" fillAlpha="0.5"/>
<e:Image id="ruleBg" source="ruleBg_png" horizontalCenter="0.5" verticalCenter="-231"/>
<e:Button id="closeBtn" label="" horizontalCenter="296.5" verticalCenter="-561">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="X_png" source.down="X_png" source.disabled="X_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Skin>
\ No newline at end of file
......@@ -15,7 +15,7 @@ export class MyExmlPlugin extends ExmlPlugin2 implements plugins.Command {
'silverbox.png',
'woodbox.png',
'monkey.png',
'net.png',
'net.png'
];
if (excludes.indexOf(file.basename) != -1) {
return file;
......
......@@ -34,7 +34,7 @@ const config: ResourceManagerConfig = {
return {
outputDir,
commands: [
new MyExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new TextureMergerPlugin({ textureMergerRoot: ['resource'] }),
new ConvertResConfigFilePlugin({
resourceConfigFiles: [{ filename: "resource/default.res.json", root: "resource/" }],
......
......@@ -19,8 +19,8 @@ const getStartOrderStatus = (callback: Function, customizedType?: number) => {
*/
export default
(isAgain = false, credits?: number, customizedType?: number) => new Promise((resolve) => {
if (window['requirelogin']) {
window['requirelogin']();
if (requirelogin) {
requirelogin();
return;
}
const callback = (data) => {
......
......@@ -24,7 +24,6 @@ export default class PanelCtrl {
private add(panel: Panel) {
this._parent.addChild(panel);
panel.addEventListener('onDestroy', this.onPanelHide, this);
panel.addEventListener('onCreditsOut', this.onCreditsOut, this);
}
private remove(panel: Panel) {
......@@ -34,22 +33,16 @@ export default class PanelCtrl {
private onPanelHide(e: egret.Event) {
const panel = e.target as Panel;
panel.removeEventListener('onDestroy', this.onPanelHide, this);
panel.removeEventListener('onCreditsOut', this.onCreditsOut, this);
this.remove(panel);
}
private onCreditsOut(e: egret.Event){
if(!window['CFG'] || !window['CFG'].appInfo) return;
window.location.href = window['CFG'].appInfo.earnCreditsUrl;
}
private _panelClassMap: any;
registerPanelClass(name, definition) {
this._panelClassMap = this._panelClassMap || {};
this._panelClassMap[name] = definition;
}
private _current: Panel;
closeCurrent() {
......
import SheetAnimation from "../components/SheetAnimation";
import IBoxItem from "./IBoxItem";
export default class Box extends egret.Sprite {
private _pic: SheetAnimation;
private _type: string;
private _moveSpeed = 3;
private START_SCALE = 0.5;
private START_X = 395;
private START_Y = 350;
private END_Y = 1100;
private MIDDLE_Y = 700;
constructor(type) {
super();
this._type = type;
......@@ -12,14 +14,21 @@ export default class Box extends egret.Sprite {
this.addChild(this._pic);
}
start() {
this.x = 750 / 2 + 20;
this.y = 400;
// this.scaleX=this.scaleY=0.5;
this.move();
onEnterFrame() {
this.y += __boxMoveSpeed__;
let distance = this.y - this.START_Y;
const totalDistance = (this.MIDDLE_Y - this.START_Y);
if (distance > totalDistance)
distance = totalDistance;
const scale = this.START_SCALE + (1 - this.START_SCALE) * (distance / totalDistance);
this.scaleX = this.scaleY = scale;
if (this.y > this.END_Y && !this._onDisappear) {
this.disappear();
}
}
move() {
this._pic.play();
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
}
......@@ -39,23 +48,16 @@ export default class Box extends egret.Sprite {
}
onEnterFrame() {
this.y += this._moveSpeed;
if (this.y > 1106 && !this._onDisappear) {
this.disappear();
}
}
async createBg() {
let url = this.boxData.skin;
return new Promise((resolve) => {
RES.getResByUrl(url, (sheet: egret.SpriteSheet) => {
this.start();
this._pic.sheet = sheet;
this._pic.fps = 10;
this._pic.play();
this.alpha = 0;
egret.Tween.get(this).to({ alpha: 1 }, 500);
egret.Tween.get(this)
.set({ alpha: 0, scaleX: 0, scaleY: 0, x: this.START_X, y: this.START_Y })
.to({ alpha: 1, scaleX: this.START_SCALE, scaleY: this.START_SCALE }, 1500, egret.Ease.getBackInOut(2))
.call(this.move, this);
this.anchorOffsetX = this.boxData.offset[0];
this.anchorOffsetY = this.boxData.offset[1];
resolve(this);
......@@ -64,15 +66,5 @@ export default class Box extends egret.Sprite {
}
get type() { return this._type }
get boxData(): IBoxItem { return window['boxmap'][this._type]; }
static getBoxList() {
const list = [];
for (const key in window['boxmap']) {
if (window['boxmap'].hasOwnProperty(key)) {
const element = window['boxmap'][key];
list.push(key);
}
}
return list;
}
get boxData() { return __boxmap__[this._type] }
}
\ No newline at end of file
import Box from "./Box";
export default class BoxList {
private _parent: egret.Sprite;
constructor(parent: egret.Sprite) {
this._parent = parent;
this.init();
}
init() {
}
createFirstBox() {
return new Promise(async (resolve) => {
const box = new Box('woodbox')
this._parent.addChild(box);
await box.createBg();
resolve();
})
}
}
\ No newline at end of file
import Box from "./Box";
export default class BoxListCtrl {
private _parent: egret.Sprite;
private _boxKeys: string[];
constructor(parent: egret.Sprite) {
this._parent = parent;
this.init();
}
init() {
this._boxKeys = ['woodbox', 'woodbox', 'woodbox'];
}
private BOX_CREATE_INTERVAL = 5000;
private _timer: number;
private _currentBoxIndex = 0;
/** 创建其他的boxs */
createBoxs() {
setInterval(() => {
this.createBox();
}, this.BOX_CREATE_INTERVAL);
}
createBox() {
if (this._currentBoxIndex >= this._boxKeys.length)
this._currentBoxIndex = this._boxKeys.length - 1;
const box = new Box(this._boxKeys[this._currentBoxIndex]);
this._parent.addChild(box);
box.createBg();
}
reset() {
clearInterval(this._timer);
this._timer = 0;
this._currentBoxIndex = 0;
}
createFirstBox() {
return new Promise(async (resolve) => {
const box = new Box(this._boxKeys[this._currentBoxIndex]);
this._parent.addChild(box);
await box.createBg();
this._currentBoxIndex++;
resolve();
})
}
}
\ No newline at end of file
export default interface IBoxItem {
award: number;
skin: string;
offset:number[];
}
\ No newline at end of file
......@@ -11,10 +11,10 @@ export default class Monkey extends egret.Sprite {
private len;
private targetY = 70;
private targetX = 369;
private static RANGE = 60;
private _shakeSpeed = .5;
constructor() {
super();
this.x = 750;
this.y = - this.h;
this.anchorOffsetX = 113;
this.anchorOffsetY = 8;
const a = this.w0 - this.w1;
......@@ -26,7 +26,11 @@ export default class Monkey extends egret.Sprite {
private async start() {
await this.createBg();
egret.Tween.get(this).to({y:this.targetY,x:this.targetX},1000,egret.Ease.getBackInOut(.7))
egret.Tween.get(this)
.set({ scaleX: 0.1, scaleY: 0.1, alpha: .5, rotation: Monkey.RANGE / 2, x: 750 + 100 })
.to({ y: this.targetY, x: this.targetX, scaleX: 1, scaleY: 1, alpha: 1 }, 1000, egret.Ease.getBackInOut(.9))
.wait(500)
.call(this.startShaking, this);
}
startShaking() {
......@@ -42,8 +46,6 @@ export default class Monkey extends egret.Sprite {
this._dir = 1;
}
private static RANGE = 30;
private _shakeSpeed = .5;
private _dir = 1;
onEnterFrame() {
this.rotation += this._shakeSpeed * this._dir;
......
import { NetManager } from "../../libs/tw/manager/NetManager";
import { GamePlayModel } from "../../libs/tw/model/game/GamePlayModel";
import PanelCtrl from "../ctrls/panelCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import Scene from "../views/Scene";
import Box from "./Box";
import BoxListCtrl from "./BoxListCtrl";
import Monkey from "./Monkey";
import Net from "./Net";
import BoxList from "./BoxList";
const { TouchEvent } = egret;
export default class StartScene extends Scene {
private _net: Net;
private _monkey: Monkey;
private _shape: egret.Shape;
private _boxList: BoxList;
private _boxList: BoxListCtrl;
async start(data?) {
const picData: any = await this.getBg();
const pic = new egret.Bitmap(picData);
this.getLayer(LayerTypes.bg).addChild(pic);
this._boxList = new BoxList(this.getLayer(LayerTypes.box));
this._boxList = new BoxListCtrl(this.getLayer(LayerTypes.box));
await this._boxList.createFirstBox();
this._boxList.createBoxs();
const monkey = new Monkey();
this.getLayer(LayerTypes.monkey).addChild(monkey);
monkey.startShaking();
monkey.addEventListener('pointUpdate', this.onPointUpdate, this)
this._monkey = monkey;
......@@ -32,7 +28,7 @@ export default class StartScene extends Scene {
this.getLayer(LayerTypes.net).addChild(net);
if (window['debug']) {
if (__debug__) {
this._shape = new egret.Shape();
this.addChild(this._shape);
}
......@@ -55,10 +51,10 @@ export default class StartScene extends Scene {
onPointUpdate(e: egret.Event) {
const point = e.data as egret.Point;
if (window['debug']) {
if (__debug__) {
this._shape.graphics.clear();
this._shape.graphics.beginFill(0xff0000);
const size = window['moneyHandSize'];
const size = __monkeyHandSize__;
const x = point.x + this._monkey.x;
const y = point.y + this._monkey.y;
this._shape.graphics.drawRect(x - size / 2, y - size / 2, size, size);
......@@ -66,7 +62,7 @@ export default class StartScene extends Scene {
}
}
async getBg() {
let url = window['__bgUrl__']
let url =__bgUrl__
return new Promise((resolve) => {
RES.getResByUrl(url, (picData) => {
resolve(picData)
......
export const getBoxList = () => {
const list = [];
for (const key in __boxmap__) {
if (__boxmap__.hasOwnProperty(key)) {
list.push(key);
}
}
return list;
}
\ No newline at end of file
export const getResPath = () => window['resPath'] || '';
export const getSkinPath = (key)=>`resource/skins/${key}Skin.exml`
\ No newline at end of file
export const getResPath = () => resPath || '';
export const getSkinPath = (key) => `resource/skins/${key}Skin.exml`
\ No newline at end of file
......@@ -13,7 +13,8 @@
},
"include": [
"src",
"libs"
"libs",
],
"exclude": [
"node_modules"
......
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