Commit 839b1d1e authored by wildfirecode's avatar wildfirecode

1

parent fee0effd
No preview for this file type
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<body> <body>
<div style="margin: auto;width: 100%;height: 100%;" class="egret-player" data-entry-class="Main" data-orientation="auto" <div style="margin: auto;width: 100%;height: 100%;" class="egret-player" data-entry-class="Main" data-orientation="auto"
data-scale-mode="showAll" data-frame-rate="60" data-content-width="750" data-content-height="1624" data-scale-mode="showAll" data-frame-rate="60" data-content-width="750" data-content-height="1624"
data-multi-fingered="2" data-show-fps="true" data-show-log="false" data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9"> data-multi-fingered="2" data-show-fps="false" data-show-log="false" data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
</div> </div>
<script src="libs/modules/egret/egret.js"></script> <script src="libs/modules/egret/egret.js"></script>
...@@ -42,21 +42,23 @@ ...@@ -42,21 +42,23 @@
<script src="output.js"></script> <script src="output.js"></script>
<script> <script>
// localStorage.clear(); // localStorage.clear();
var __t0__ = Date.now(); var __t0__ = Date.now();
var __debug__ = 1; var __debug__ = 1;
var __monkeyHandSize__ = 30; var __mode__ = 2;
var __boxMoveSpeed__ = 3; var __award_thanks_score__ = 0;
var __BOX_CREATE_INTERVAL__ = 60*4; var __monkeyHandSize__ = 30;
var __boxOpenState__ = 'resource/assets/startScene/openstate.json'; var __boxMoveSpeed__ = 3;
var __boxmap__ = { var __BOX_CREATE_INTERVAL__ = 60 * 4;
coin:{ award: 0, skin: 'resource/assets/startScene/coin.json', offset: [117, 68] }, var __boxOpenState__ = 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/openstate.json';
gift:{ award: 0, skin: 'resource/assets/startScene/gift.json', offset: [119, 103] }, var __boxmap__ = {
gift2: { award: 1, skin: 'resource/assets/startScene/gift2.json', offset: [122, 87] }, coin: { award: 0, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/coin.json', offset: [117, 68] },
woodbox: { award: 1, skin: 'resource/assets/startScene/woodbox.json', offset: [115, 80] }, gift: { award: 0, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/gift.json', offset: [119, 103] },
silverbox: { award: 3, skin: 'resource/assets/startScene/silverbox.json', offset: [147, 77] }, gift2: { award: 1, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/gift2.json', offset: [122, 87] },
goldenbox: { award: 5, skin: 'resource/assets/startScene/goldenbox.json', offset: [130, 88] } woodbox: { award: 1, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/woodbox.json', offset: [115, 80] },
}; silverbox: { award: 3, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/silverbox.json', offset: [147, 77] },
var __bgUrl__ = 'resource/assets/startScene/bg.jpg'; goldenbox: { award: 5, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/goldenbox.json', offset: [130, 88] }
};
var __bgUrl__ = 'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/bg.jpg';
var gameId = 1; var gameId = 1;
var CFG = { var CFG = {
......
...@@ -11,6 +11,11 @@ declare interface IBoxItem { ...@@ -11,6 +11,11 @@ declare interface IBoxItem {
} }
/**
* 1.捞一次扣一次积分,不管捞没捞到宝箱,不管宝箱是否被猴子抢走;2.只有捞到宝箱,参与了一次抽奖才扣积分
*/
declare var __mode__:number;
declare var __award_thanks_score__:number;
declare var __boxmap__: { [key: string]: IBoxItem }; declare var __boxmap__: { [key: string]: IBoxItem };
declare var __bgUrl__:string; declare var __bgUrl__:string;
declare var __monkeyHandSize__:number; declare var __monkeyHandSize__:number;
......
import Loading from "../../loading/Loading";
import { NetManager } from "../../../libs/tw/manager/NetManager"; import { NetManager } from "../../../libs/tw/manager/NetManager";
import { DataManager } from "../../../libs/tw/manager/DataManager"; import { DataManager } from "../../../libs/tw/manager/DataManager";
const getStartOrderStatus = (callback: Function, customizedType?: number) => {
NetManager.ins.getStartStatus(
callback,
DataManager.ins.doStartData.ticketId,
() => { return DataManager.ins.getStartStatusData.code != 1; },
5,
customizedType);
}
/** /**
* 开始游戏 * 开始游戏
* @param {string} isAgain 是否是再来一次 * @param callback
* @param {number} credits 主动要求花费多少积分玩游戏 * @param isAgain
* @param {number} customizedType xx类型 * @param credits
*/ * @param customizedType
export default */
(isAgain = false, credits?: number, customizedType?: number) => new Promise((resolve) => { const doStart = (callback: Function, isAgain = false, credits?: number, customizedType?: number) => {
if (requirelogin) { if (window['requirelogin']) {
requirelogin(); window['requirelogin']();
return; return;
} }
const callback = (data) => {
Loading.instace.hide();
resolve(data);
}
Loading.instace.show();
NetManager.ins.doStart((success: boolean) => { NetManager.ins.doStart((success: boolean) => {
if (success) { if (success) {
getStartOrderStatus(callback, customizedType); getStartOrderStatus(callback, customizedType);
...@@ -38,4 +23,20 @@ export default ...@@ -38,4 +23,20 @@ export default
isAgain, isAgain,
credits, credits,
customizedType); customizedType);
}); }
\ No newline at end of file
/**
* 查询订单结果
* @param callback
* @param ticketId
* @param customizedType
*/
const getStartOrderStatus = (callback: Function, customizedType?: number) => {
NetManager.ins.getStartStatus(
callback,
DataManager.ins.doStartData.ticketId,
() => { return DataManager.ins.getStartStatusData.code != 1; },
5,
customizedType);
}
export default doStart;
\ No newline at end of file
import { IDynamicData } from "../../tw/data/game/datapash/IDynamicData";
import { NetManager } from "../../tw/manager/NetManager";
import { DataManager } from "../../tw/manager/DataManager";
/**
* 提交游戏成绩
* @param callback
* @param score 得分
* @param checkScore 是否校验得分
* @param customizedType 定制类型 1推币机
*/
const submit = (callback: Function, score: number, checkScore?: boolean, customizedType?: number) => {
const allDynamics = [];
gameSubmitData(callback, score, allDynamics, checkScore, customizedType);
}
/**
* 提交游戏成绩
* @param callback
* @param score 得分
* @param allDynamics 防作弊数据
* @param checkScore 是否校验得分
* @param customizedType 定制类型 1推币机
*/
const gameSubmitData = (callback: Function, score: number, allDynamics: IDynamicData[][], checkScore?: boolean, customizedType?: number) => {
NetManager.ins.gameSubmit(
(success: boolean) => {
if (success) {
getSubmitResult(callback, DataManager.ins.gameSubmitData.orderId);
} else {
callback(success);
}
},
DataManager.ins.doStartData.ticketId,
score,
'[]',
DataManager.ins.doStartData.submitToken,
JSON.stringify(allDynamics),
checkScore,
customizedType);
}
/**
* 查询提交结果
* @param callback
* @param orderId
*/
const getSubmitResult = (callback: Function, orderId: number) => {
NetManager.ins.getSubmitResult(callback, orderId, () => {
return DataManager.ins.gameGetSubmitResultData.flag;
});
}
export default submit;
\ No newline at end of file
import doStart from "./doStart";
import submit from "./submit";
const submitAfterDostart = (cb, score) => {
doStart(
() => submit(cb, score)
)
}
export default submitAfterDostart
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
*Created by cuiliqiang on 2018/3/8 *Created by cuiliqiang on 2018/3/8
* 数据管理 * 数据管理
*/ */
export abstract class ABDataManager { export abstract class ABDataManager extends egret.EventDispatcher {
/** /**
* 更新数据 * 更新数据
* @param {number} name 接口名字 * @param {number} name 接口名字
......
...@@ -79,11 +79,16 @@ export default class MainBase extends eui.UILayer { ...@@ -79,11 +79,16 @@ export default class MainBase extends eui.UILayer {
this.registerModules(); this.registerModules();
this.getData();
this.runGame().catch(e => { this.runGame().catch(e => {
console.log(e); console.log(e);
}) })
} }
protected getData() {
}
protected registerModules() { } protected registerModules() { }
private async runGame() { private async runGame() {
...@@ -120,17 +125,6 @@ export default class MainBase extends eui.UILayer { ...@@ -120,17 +125,6 @@ export default class MainBase extends eui.UILayer {
* Create scene interface * Create scene interface
*/ */
protected createGameScene() { 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
...@@ -155,21 +155,21 @@ export class DataManager extends ABDataManager { ...@@ -155,21 +155,21 @@ export class DataManager extends ABDataManager {
public petsIndexData: PetsIndexData = new PetsIndexData();//外来宠物活动主页 public petsIndexData: PetsIndexData = new PetsIndexData();//外来宠物活动主页
private _getHomeInfoData: GetHomeInfoData;//活动主信息接口 private _getHomeInfoData: GetHomeInfoData;//活动主信息接口
private _getActToysListData: any = [];//商店道具接口 private _getActToysListData: any = [];//商店道具接口
private _toyExchangesData:ToyExchangesData;//道具兑换 private _toyExchangesData: ToyExchangesData;//道具兑换
private _useToyData:UseToyData;//道具使用 private _useToyData: UseToyData;//道具使用
private _getUserToysListData:GetUserToysListData;//已购买的道具 private _getUserToysListData: GetUserToysListData;//已购买的道具
private _batchollectFoodData:Data;//粮食收取返回 private _batchollectFoodData: Data;//粮食收取返回
private _visitStatisticsData: VisitStatisticsData;//来访统计 private _visitStatisticsData: VisitStatisticsData;//来访统计
private _getVisitInfoData:GetVisitInfoData;//来访统计 private _getVisitInfoData: GetVisitInfoData;//来访统计
private _visitDetailData: VisitDetailData;//到访记录详情 private _visitDetailData: VisitDetailData;//到访记录详情
private _collectGiftRecord:Data;//礼物收取 private _collectGiftRecord: Data;//礼物收取
/** /**
* 插件信息列表 * 插件信息列表
*/ */
private _getPrizeInfoList: any = {}; private _getPrizeInfoList: any = {};
private _getRecordData:GetRecordData; private _getRecordData: GetRecordData;
/** /**
* 更新数据 * 更新数据
...@@ -510,7 +510,7 @@ export class DataManager extends ABDataManager { ...@@ -510,7 +510,7 @@ export class DataManager extends ABDataManager {
data.update(result); data.update(result);
break; break;
case NetName.PETS_GET_HOME_INFO://外来宠物养成---活动主信息接口 case NetName.PETS_GET_HOME_INFO://外来宠物养成---活动主信息接口
if(!this._getHomeInfoData) { if (!this._getHomeInfoData) {
this._getHomeInfoData = new GetHomeInfoData(); this._getHomeInfoData = new GetHomeInfoData();
} }
this._getHomeInfoData.update(result); this._getHomeInfoData.update(result);
...@@ -518,35 +518,35 @@ export class DataManager extends ABDataManager { ...@@ -518,35 +518,35 @@ export class DataManager extends ABDataManager {
break; break;
case NetName.PETS_GET_ACT_TOYS://外来宠物养成---商店道具接口 case NetName.PETS_GET_ACT_TOYS://外来宠物养成---商店道具接口
const toyType = param.toyType; const toyType = param.toyType;
if(!this._getActToysListData[toyType]) { if (!this._getActToysListData[toyType]) {
this._getActToysListData[toyType] = new GetActToysListData(); this._getActToysListData[toyType] = new GetActToysListData();
} }
this._getActToysListData[toyType].update(result); this._getActToysListData[toyType].update(result);
data = this._getActToysListData[toyType]; data = this._getActToysListData[toyType];
break; break;
case NetName.PETS_TOY_EXCHANGE://外来宠物养成---道具兑换 case NetName.PETS_TOY_EXCHANGE://外来宠物养成---道具兑换
if(!this._toyExchangesData) { if (!this._toyExchangesData) {
this._toyExchangesData = new ToyExchangesData(); this._toyExchangesData = new ToyExchangesData();
} }
this._toyExchangesData.update(result); this._toyExchangesData.update(result);
data = this._toyExchangesData; data = this._toyExchangesData;
break; break;
case NetName.PETS_USE_TOYS://外来宠物养成---道具使用 case NetName.PETS_USE_TOYS://外来宠物养成---道具使用
if(!this._useToyData) { if (!this._useToyData) {
this._useToyData = new UseToyData(); this._useToyData = new UseToyData();
} }
this._useToyData.update(result); this._useToyData.update(result);
data = this._useToyData; data = this._useToyData;
break; break;
case NetName.PETS_GET_USER_TOYS://外来宠物养成---已购买的道具 case NetName.PETS_GET_USER_TOYS://外来宠物养成---已购买的道具
if(!this._getUserToysListData) { if (!this._getUserToysListData) {
this._getUserToysListData = new GetUserToysListData(); this._getUserToysListData = new GetUserToysListData();
} }
this._getUserToysListData.update(result); this._getUserToysListData.update(result);
data = this._getUserToysListData; data = this._getUserToysListData;
break; break;
case NetName.PETS_BATCHOLLECT_FOOD://外来宠物养成---收取猫草 case NetName.PETS_BATCHOLLECT_FOOD://外来宠物养成---收取猫草
if(!this._batchollectFoodData){ if (!this._batchollectFoodData) {
this._batchollectFoodData = new Data(); this._batchollectFoodData = new Data();
} }
...@@ -554,14 +554,14 @@ export class DataManager extends ABDataManager { ...@@ -554,14 +554,14 @@ export class DataManager extends ABDataManager {
data = this._batchollectFoodData; data = this._batchollectFoodData;
break; break;
case NetName.PETS_VISI_STATISTICS://外来宠物养成---来访统计 case NetName.PETS_VISI_STATISTICS://外来宠物养成---来访统计
if(!this._visitStatisticsData) { if (!this._visitStatisticsData) {
this._visitStatisticsData = new VisitStatisticsData(); this._visitStatisticsData = new VisitStatisticsData();
} }
this._visitStatisticsData.update(result); this._visitStatisticsData.update(result);
data = this._visitStatisticsData; data = this._visitStatisticsData;
break; break;
case NetName.PETS_GET_VISIT_INFO://未来宠物养成---动态信息列表 case NetName.PETS_GET_VISIT_INFO://未来宠物养成---动态信息列表
if(!this._getVisitInfoData){ if (!this._getVisitInfoData) {
this._getVisitInfoData = new GetVisitInfoData(); this._getVisitInfoData = new GetVisitInfoData();
} }
...@@ -569,14 +569,14 @@ export class DataManager extends ABDataManager { ...@@ -569,14 +569,14 @@ export class DataManager extends ABDataManager {
data = this._getVisitInfoData; data = this._getVisitInfoData;
break; break;
case NetName.PETS_VISIT_DETAIL://外来宠物养成---到访记录详情 case NetName.PETS_VISIT_DETAIL://外来宠物养成---到访记录详情
if(!this._visitDetailData) { if (!this._visitDetailData) {
this._visitDetailData = new VisitDetailData(); this._visitDetailData = new VisitDetailData();
} }
this._visitDetailData.update(result); this._visitDetailData.update(result);
data = this._visitDetailData; data = this._visitDetailData;
break; break;
case NetName.PETS_COLLECT_GIFT_RECORD: case NetName.PETS_COLLECT_GIFT_RECORD:
if(!this._collectGiftRecord) { if (!this._collectGiftRecord) {
this._collectGiftRecord = new Data(); this._collectGiftRecord = new Data();
} }
this._collectGiftRecord.update(result); this._collectGiftRecord.update(result);
...@@ -609,22 +609,23 @@ export class DataManager extends ABDataManager { ...@@ -609,22 +609,23 @@ export class DataManager extends ABDataManager {
data = result; data = result;
break; break;
case NetName.GET_RECORD://查询我的奖品记录 case NetName.GET_RECORD://查询我的奖品记录
if(!this._getRecordData){ if (!this._getRecordData) {
this._getRecordData = new GetRecordData(); this._getRecordData = new GetRecordData();
} }
this._getRecordData.update(result); this._getRecordData.update(result);
data = this._getRecordData; data = this._getRecordData;
default: default:
this[this.getKey(name)]=result; this[this.getKey(name)] = result;
} }
this.dispatchEvent(new egret.Event('dataUpdate', false, false, name));
return data || result; return data || result;
} }
getData(name){ getData(name) {
return this[this.getKey(name)] return this[this.getKey(name)]
} }
private getKey(name){ private getKey(name) {
return `_tw_data_${name}_` return `_tw_data_${name}_`
} }
...@@ -915,24 +916,24 @@ export class DataManager extends ABDataManager { ...@@ -915,24 +916,24 @@ export class DataManager extends ABDataManager {
/** /**
* 查询我的奖品记录 * 查询我的奖品记录
*/ */
public get getRecordData():GetRecordData{ public get getRecordData(): GetRecordData {
return this._getRecordData; return this._getRecordData;
} }
/** /**
* 外来宠物养成--活动主信息接口 * 外来宠物养成--活动主信息接口
*/ */
public get getHomeInfoData():GetHomeInfoData{ public get getHomeInfoData(): GetHomeInfoData {
return this._getHomeInfoData; return this._getHomeInfoData;
} }
public set getHomeInfoData(d:GetHomeInfoData){ public set getHomeInfoData(d: GetHomeInfoData) {
this._getHomeInfoData = d; this._getHomeInfoData = d;
} }
/** /**
* 收取猫草回调数据 * 收取猫草回调数据
*/ */
public get gtBatchollectFoodData():Data{ public get gtBatchollectFoodData(): Data {
return this._batchollectFoodData; return this._batchollectFoodData;
} }
...@@ -940,50 +941,50 @@ export class DataManager extends ABDataManager { ...@@ -940,50 +941,50 @@ export class DataManager extends ABDataManager {
/** /**
* 外来宠物养成--商店道具接口 * 外来宠物养成--商店道具接口
*/ */
public get getActToysListData():GetActToysListData[]{ public get getActToysListData(): GetActToysListData[] {
return this._getActToysListData; return this._getActToysListData;
} }
public set getActToysListData(d:GetActToysListData[]){ public set getActToysListData(d: GetActToysListData[]) {
this._getActToysListData = d; this._getActToysListData = d;
} }
/** /**
* 外来宠物养成--商店道具接口 * 外来宠物养成--商店道具接口
*/ */
public get getUserToysListData():GetUserToysListData{ public get getUserToysListData(): GetUserToysListData {
return this._getUserToysListData; return this._getUserToysListData;
} }
public set getUserToysListData(d:GetUserToysListData){ public set getUserToysListData(d: GetUserToysListData) {
this._getUserToysListData = d; this._getUserToysListData = d;
} }
/** /**
* 外来宠物养成--来访统计 * 外来宠物养成--来访统计
*/ */
public get visitStatisticsData():VisitStatisticsData{ public get visitStatisticsData(): VisitStatisticsData {
return this._visitStatisticsData; return this._visitStatisticsData;
} }
/** /**
* 外来宠物养成--动态信息列表 * 外来宠物养成--动态信息列表
*/ */
public get getVisitInfoData():GetVisitInfoData{ public get getVisitInfoData(): GetVisitInfoData {
return this._getVisitInfoData; return this._getVisitInfoData;
} }
/** /**
* 外来宠物养成--到访记录详情 * 外来宠物养成--到访记录详情
*/ */
public get visitDetailData():VisitDetailData{ public get visitDetailData(): VisitDetailData {
return this._visitDetailData; return this._visitDetailData;
} }
/** /**
* 外来宠物养成--礼物收取 * 外来宠物养成--礼物收取
*/ */
public get collectGiftRecord():Data{ public get collectGiftRecord(): Data {
return this._collectGiftRecord; return this._collectGiftRecord;
} }
......
...@@ -171,7 +171,7 @@ export class NetManager extends ABNetManager { ...@@ -171,7 +171,7 @@ export class NetManager extends ABNetManager {
/** /**
* 游戏基础信息 * 游戏基础信息
*/ */
public getInfo(callback: Function): void { public getInfo(callback?: Function): void {
const net: INetData = { const net: INetData = {
name: NetName.GAME_INFO, name: NetName.GAME_INFO,
uri: '/ngame/new/getInfo', uri: '/ngame/new/getInfo',
......
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"preload_5","version":5,"files":["../assets/ProgressBar/thumb_pb.png","../assets/ProgressBar/track_pb.png"]}
\ No newline at end of file
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
{ {
"keys": "guide_tips_png,guide_hand_png,guide_dialog_png", "keys": "guide_tips_png,guide_hand_png,guide_dialog_png",
"name": "guide" "name": "guide"
},
{
"name": "preload",
"keys": "thumb_pb_png,track_pb_png"
} }
], ],
"resources": [ "resources": [
...@@ -133,6 +137,16 @@ ...@@ -133,6 +137,16 @@
"url": "assets/startScene/guide/guide_dialog.png", "url": "assets/startScene/guide/guide_dialog.png",
"type": "image", "type": "image",
"name": "guide_dialog_png" "name": "guide_dialog_png"
},
{
"name": "thumb_pb_png",
"type": "image",
"url": "assets/ProgressBar/thumb_pb.png"
},
{
"name": "track_pb_png",
"type": "image",
"url": "assets/ProgressBar/track_pb.png"
} }
] ]
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e:Skin class="StartSkin" width="400" height="300" xmlns:e="http://ns.egret.com/eui"> <e:Skin class="StartSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui">
</e:Skin> </e:Skin>
\ No newline at end of file
...@@ -3,8 +3,9 @@ import Msg from "./alert/Msg"; ...@@ -3,8 +3,9 @@ import Msg from "./alert/Msg";
import PanelCtrl from "./ctrls/panelCtrl"; import PanelCtrl from "./ctrls/panelCtrl";
import SceneCtrl from "./ctrls/sceneCtrl"; import SceneCtrl from "./ctrls/sceneCtrl";
import RulePanel from "./rulePanel/RulePanel"; import RulePanel from "./rulePanel/RulePanel";
import { ModuleTypes } from "./types/sceneTypes";
import StartScene from "./startScene/StartScene"; import StartScene from "./startScene/StartScene";
import { ModuleTypes } from "./types/sceneTypes";
import { NetManager } from "../libs/tw/manager/NetManager";
class Main extends MainBase { class Main extends MainBase {
protected registerModules() { protected registerModules() {
...@@ -13,6 +14,10 @@ class Main extends MainBase { ...@@ -13,6 +14,10 @@ class Main extends MainBase {
SceneCtrl.instance.registerSceneClass(ModuleTypes.START_SCENE, StartScene); SceneCtrl.instance.registerSceneClass(ModuleTypes.START_SCENE, StartScene);
} }
protected getData() {
super.getData();
NetManager.ins.getInfo();
}
protected async createGameScene() { protected async createGameScene() {
SceneCtrl.instance.change(ModuleTypes.START_SCENE); SceneCtrl.instance.change(ModuleTypes.START_SCENE);
} }
......
...@@ -8,8 +8,11 @@ export default class Box extends egret.Sprite { ...@@ -8,8 +8,11 @@ export default class Box extends egret.Sprite {
private END_Y = 1100; private END_Y = 1100;
static MIDDLE_Y = 800; static MIDDLE_Y = 800;
speed = 0; speed = 0;
static hashCounter = 0
hash;
constructor(type) { constructor(type) {
super(); super();
this.hash = Box.hashCounter++;
this._type = type; this._type = type;
this._pic = new SheetAnimation(); this._pic = new SheetAnimation();
this.addChild(this._pic); this.addChild(this._pic);
...@@ -73,7 +76,7 @@ export default class Box extends egret.Sprite { ...@@ -73,7 +76,7 @@ export default class Box extends egret.Sprite {
this._pic.fps = 10; this._pic.fps = 10;
egret.Tween.get(this) egret.Tween.get(this)
.set({ alpha: 0, scaleX: 0, scaleY: 0, x: this.START_X, y: this.START_Y }) .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)) .to({ alpha: 1, scaleX: this.START_SCALE, scaleY: this.START_SCALE }, 500, egret.Ease.getBackInOut(2))
.call(this.move, this); .call(this.move, this);
this.anchorOffsetX = this.boxData.offset[0]; this.anchorOffsetX = this.boxData.offset[0];
this.anchorOffsetY = this.boxData.offset[1]; this.anchorOffsetY = this.boxData.offset[1];
...@@ -87,14 +90,14 @@ export default class Box extends egret.Sprite { ...@@ -87,14 +90,14 @@ export default class Box extends egret.Sprite {
private _gy: number; private _gy: number;
private _throwStartVY: number; private _throwStartVY: number;
private _scaleMax = 2; private _scaleMax = 2;
onThrowTick(): any { onThrowTick() {
this._vy += this._gy; this._vy += this._gy;
this.y += this._vy; this.y += this._vy;
const scale = (this._vyStart * this._scaleMax - Math.abs(this._vy)) / this._vyStart; const scale = (this._vyStart * this._scaleMax - Math.abs(this._vy)) / this._vyStart;
this.scaleX = this.scaleY = scale; this.scaleX = this.scaleY = scale;
} }
doThrow(): any { doThrow() {
this._pic.stopAtIdleFrame(); this._pic.stopAtIdleFrame();
this._throwStartVY = this._vy; this._throwStartVY = this._vy;
this._vy = -this._vyStart; this._vy = -this._vyStart;
......
...@@ -37,7 +37,7 @@ export default class GuideCtrl { ...@@ -37,7 +37,7 @@ export default class GuideCtrl {
await this.showtipsAni(tips); await this.showtipsAni(tips);
await this.showhandAni(hand); await this.showhandAni(hand);
await this.showguideAni(guide_dialog); await this.showguideAni(guide_dialog);
this._main.once(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this); this._main.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this);
} }
async showtipsAni(texture) { async showtipsAni(texture) {
...@@ -47,7 +47,7 @@ export default class GuideCtrl { ...@@ -47,7 +47,7 @@ export default class GuideCtrl {
this._guideTop.addChild(pic); this._guideTop.addChild(pic);
return new Promise((r) => { return new Promise((r) => {
egret.Tween.get(pic).set({ x: 0, y: 700 + 10 }) egret.Tween.get(pic).set({ x: 0, y: 700 + 10 })
.to({ x: 750 / 2 }, 200, egret.Ease.getBackOut(3)) .to({ x: 750 / 2 }, 200, egret.Ease.getBackOut(3)).wait(200)
.call(() => r(pic)); .call(() => r(pic));
}); });
} }
...@@ -59,7 +59,7 @@ export default class GuideCtrl { ...@@ -59,7 +59,7 @@ export default class GuideCtrl {
this._guideTop.addChild(pic); this._guideTop.addChild(pic);
return new Promise((r) => { return new Promise((r) => {
egret.Tween.get(pic).set({ x: 750, y: 700 + 230 }).to({ x: 750 / 2 }, 200, egret.Ease.getBackOut(3)) egret.Tween.get(pic).set({ x: 750, y: 700 + 230 }).to({ x: 750 / 2 }, 200, egret.Ease.getBackOut(3))
.call(() => r(pic)); .wait(200).call(() => r(pic));
}); });
} }
...@@ -70,12 +70,14 @@ export default class GuideCtrl { ...@@ -70,12 +70,14 @@ export default class GuideCtrl {
this._guideTop.addChild(pic); this._guideTop.addChild(pic);
return new Promise((r) => { return new Promise((r) => {
egret.Tween.get(pic).set({ x: 750, y: 200 }).to({ x: 200 }, 200, egret.Ease.getBackOut(3)) egret.Tween.get(pic).set({ x: 750, y: 200 }).to({ x: 200 }, 200, egret.Ease.getBackOut(3))
.call(() => r(pic)); .wait(200).call(() => r(pic));
}); });
} }
onTouch() { onTouch() {
if (!this._main.checkCanDoAtion()) return;
this._main.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this);
this._main.boxListCtrl.updateSpeed(__boxMoveSpeed__); this._main.boxListCtrl.updateSpeed(__boxMoveSpeed__);
this.setTag(); this.setTag();
this._main.guideView.destroy(); this._main.guideView.destroy();
...@@ -83,7 +85,7 @@ export default class GuideCtrl { ...@@ -83,7 +85,7 @@ export default class GuideCtrl {
this._main.topLay.removeChild(this._guideTop); this._main.topLay.removeChild(this._guideTop);
this._guideTop = null; this._guideTop = null;
}, this); }, this);
this._main.onTouch(); this._main.doAction();
this._main.addTouchEvent(); this._main.addTouchEvent();
} }
......
...@@ -9,6 +9,9 @@ import GuideCtrl from "./GuideCtrl"; ...@@ -9,6 +9,9 @@ import GuideCtrl from "./GuideCtrl";
import Monkey from "./Monkey"; import Monkey from "./Monkey";
import Net from "./Net"; import Net from "./Net";
import BoxOpenState from "./view/BoxOpenState"; import BoxOpenState from "./view/BoxOpenState";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { DataManager } from "../../libs/tw/manager/DataManager";
import submitAfterDostart from "../../libs/new_tw/ctrls/submitAfterDostart";
const { TouchEvent } = egret; const { TouchEvent } = egret;
export default class StartScene extends Scene { export default class StartScene extends Scene {
...@@ -52,20 +55,6 @@ export default class StartScene extends Scene { ...@@ -52,20 +55,6 @@ export default class StartScene extends Scene {
if (__debug__) { if (__debug__) {
this._debug = new debug(this.getLayer(LayerTypes.top)); this._debug = new debug(this.getLayer(LayerTypes.top));
} }
const model = new GamePlayModel();
model.update();
// box.touchEnabled = true;
// box.addEventListener(egret.TouchEvent.TOUCH_BEGIN, () => {
// NetManager.ins.getInfo(() => {
// model.doStart(() => {
// model.submit(() => { }, box.boxData.award)
// }, false);
// });
// PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
// }, this);
} }
addTouchEvent() { addTouchEvent() {
...@@ -78,7 +67,13 @@ export default class StartScene extends Scene { ...@@ -78,7 +67,13 @@ export default class StartScene extends Scene {
private _catchedBox: Box; private _catchedBox: Box;
private _cathchedBoxOpenState: BoxOpenState; private _cathchedBoxOpenState: BoxOpenState;
async onTouch() { onTouch() {
if (!this.checkCanDoAtion()) return;
this.doAction();
}
_isBoxFlying: boolean;
doAction() {
this._net.doAction(); this._net.doAction();
const catchedBoxs = this._boxListCtrl.boxs.filter( const catchedBoxs = this._boxListCtrl.boxs.filter(
box => Math.abs(box.y - Box.MIDDLE_Y) < StartScene.NET_RANGE); box => Math.abs(box.y - Box.MIDDLE_Y) < StartScene.NET_RANGE);
...@@ -89,10 +84,50 @@ export default class StartScene extends Scene { ...@@ -89,10 +84,50 @@ export default class StartScene extends Scene {
this._boxListCtrl.removeBoxFromList(catchedBox); this._boxListCtrl.removeBoxFromList(catchedBox);
this._catchedBox = catchedBox; this._catchedBox = catchedBox;
catchedBox.doThrow(); catchedBox.doThrow();
this._isBoxFlying = true;
this.addThrowTick(); this.addThrowTick();
} else {//没有抓住,不需要处理,如果过网了就会自动消失。如果没有过网,下次还能抓。 } else {//没有抓住,不需要处理,如果过网了就会自动消失。如果没有过网,下次还能抓。
this.checkmode1();
}
}
private _mode1DostartTag = true;
private checkmode1() {
if (__mode__ == 1) { //发一个空的
this._mode1DostartTag = false;
submitAfterDostart(() => {
NetManager.ins.getInfo(() => { this._mode1DostartTag = true; console.log('小孩儿休息完毕.') });
}, __award_thanks_score__);
}
}
openBoxMode() {
submitAfterDostart(() => {
this._cathchedBoxOpenState.destroy();
this._cathchedBoxOpenState = null;
this._isBoxFlying = false;
setTimeout(() => {
this.boxListCtrl.resume();
this._monkey.startShaking();
}, 2000);
NetManager.ins.getInfo(() => { this._mode1DostartTag = true; console.log('小孩儿休息完毕.') });
}, this._cathchedBoxOpenState.boxData.award);
}
checkCanDoAtion() {
if (!DataManager.ins.getInfoData) {
console.log('getinfo接口没有返回');
return false;
}
if (this._isBoxFlying) {
console.log('box还在飞呢');
return false;
} }
if (!this._mode1DostartTag && __mode__ == 1) {
console.log('mode1,submitAfterDostart没有执行完成');
return false;
}
return true;
} }
addThrowTick() { addThrowTick() {
...@@ -120,6 +155,9 @@ export default class StartScene extends Scene { ...@@ -120,6 +155,9 @@ export default class StartScene extends Scene {
this.removeThrowTick(); this.removeThrowTick();
this._catchedBoxByMoneky = this._catchedBox; this._catchedBoxByMoneky = this._catchedBox;
this._catchedBox = null; this._catchedBox = null;
this.checkmode1();
this._isBoxFlying = false;
egret.Tween.get(this._catchedBoxByMoneky) egret.Tween.get(this._catchedBoxByMoneky)
.to({ scaleX: 1, scaleY: 1 }, 500) .to({ scaleX: 1, scaleY: 1 }, 500)
.wait(500) .wait(500)
...@@ -127,6 +165,7 @@ export default class StartScene extends Scene { ...@@ -127,6 +165,7 @@ export default class StartScene extends Scene {
this._catchedBoxByMoneky.destroy(); this._catchedBoxByMoneky.destroy();
this._catchedBoxByMoneky = null; this._catchedBoxByMoneky = null;
this.boxListCtrl.resume(); this.boxListCtrl.resume();
}, this); }, this);
} }
...@@ -136,17 +175,10 @@ export default class StartScene extends Scene { ...@@ -136,17 +175,10 @@ export default class StartScene extends Scene {
this._cathchedBoxOpenState.x = this._catchedBox.x; this._cathchedBoxOpenState.x = this._catchedBox.x;
this._cathchedBoxOpenState.y = this._catchedBox.y; this._cathchedBoxOpenState.y = this._catchedBox.y;
this.topLay.addChild(this._cathchedBoxOpenState); this.topLay.addChild(this._cathchedBoxOpenState);
this._cathchedBoxOpenState.onReady = () => {
egret.Tween.get(this._catchedBox).to({ alpha: 0 }, 500); egret.Tween.get(this._catchedBox).to({ alpha: 0 }, 500);
this._catchedBox = null; this._catchedBox = null;
}
this._cathchedBoxOpenState.start(); this._cathchedBoxOpenState.start();
this.openBoxMode();
setTimeout(() => {
this._cathchedBoxOpenState.destroy();
this._cathchedBoxOpenState = null;
this.boxListCtrl.resume();
}, 1000);
} }
private _handX: number; private _handX: number;
......
...@@ -17,12 +17,14 @@ export default class BoxOpenState extends egret.Bitmap { ...@@ -17,12 +17,14 @@ export default class BoxOpenState extends egret.Bitmap {
.set({ alpha: 0 }) .set({ alpha: 0 })
.to({ alpha: 1 }, 200) .to({ alpha: 1 }, 200)
.call(() => { .call(() => {
this.onReady(); // this.onReady();
this.shake(); this.shake();
}) })
}, this, RES.ResourceItem.TYPE_SHEET); }, this, RES.ResourceItem.TYPE_SHEET);
} }
get boxData() { return __boxmap__[this._type] }
destroy() { destroy() {
egret.Tween.removeTweens(this); egret.Tween.removeTweens(this);
egret.Tween.get(this).to({alpha:0},500).call(()=>{ egret.Tween.get(this).to({alpha:0},500).call(()=>{
......
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