2229 lines
86 KiB
JavaScript
2229 lines
86 KiB
JavaScript
// Original amusement park UI and mini-game runtime migration.
|
|
// The visual skins/resources are copied from farmer/resource/skins/panel/youle and assets/game/youle.
|
|
var __extends =
|
|
(this && this.__extends) ||
|
|
(function () {
|
|
var extendStatics = function (derived, base) {
|
|
extendStatics =
|
|
Object.setPrototypeOf ||
|
|
({ __proto__: [] } instanceof Array &&
|
|
function (derived, base) {
|
|
derived.__proto__ = base;
|
|
}) ||
|
|
function (derived, base) {
|
|
for (var property in base)
|
|
if (Object.prototype.hasOwnProperty.call(base, property)) derived[property] = base[property];
|
|
};
|
|
return extendStatics(derived, base);
|
|
};
|
|
return function (derived, base) {
|
|
extendStatics(derived, base);
|
|
function Intermediate() {
|
|
this.constructor = derived;
|
|
}
|
|
derived.prototype = base === null ? Object.create(base) : ((Intermediate.prototype = base.prototype), new Intermediate());
|
|
};
|
|
})();
|
|
|
|
(function () {
|
|
var notifyValues = {
|
|
OPEN_REWARD_TIPS: "OPEN_REWARD_TIPS",
|
|
CLOSE_REWARD_TIPS: "CLOSE_REWARD_TIPS",
|
|
OPEN_ZUMA: "OPEN_ZUMA",
|
|
CLOSE_ZUMA: "CLOSE_ZUMA",
|
|
OPEN_TIANBING: "OPEN_TIANBING",
|
|
CLOSE_TIANBING: "CLOSE_TIANBING",
|
|
TIANBING_NEXT_QUESTION: "TIANBING_NEXT_QUESTION",
|
|
OPEN_TIANBING_GAMEOVER: "OPEN_TIANBING_GAMEOVER",
|
|
CLOSE_TIANBING_GAMEOVER: "CLOSE_TIANBING_GAMEOVER",
|
|
OPEN_ZHUAWAWA: "OPEN_ZHUAWAWA",
|
|
CLOSE_ZHUAWAWA: "CLOSE_ZHUAWAWA"
|
|
};
|
|
Object.keys(notifyValues).forEach(function (name) {
|
|
PanelNotify[name] = PanelNotify[name] || notifyValues[name];
|
|
});
|
|
|
|
var proxyProto = game.GameProxy && game.GameProxy.prototype;
|
|
if (proxyProto) {
|
|
proxyProto.getCommonConfig =
|
|
proxyProto.getCommonConfig ||
|
|
function () {
|
|
var common = this.gameConfig.common || {};
|
|
common[19] = common[19] || {
|
|
id: 19,
|
|
namg: "游乐场进场扣除多少金币",
|
|
type: 2,
|
|
min: 100,
|
|
max: 100
|
|
};
|
|
return common;
|
|
};
|
|
proxyProto.getAsumentParkConfig =
|
|
proxyProto.getAsumentParkConfig ||
|
|
function () {
|
|
return this.gameConfig.playground || {};
|
|
};
|
|
proxyProto.getAsumentParConfigForID =
|
|
proxyProto.getAsumentParConfigForID ||
|
|
function (id) {
|
|
var config = this.getAsumentParkConfig();
|
|
return config[id] || null;
|
|
};
|
|
}
|
|
})();
|
|
|
|
var SceneBase =
|
|
typeof SceneBase !== "undefined"
|
|
? SceneBase
|
|
: (function (BaseClass) {
|
|
function SceneBase() {
|
|
var instance = BaseClass.call(this) || this;
|
|
instance.width = Const.WIN_W;
|
|
instance.height = Const.WIN_H;
|
|
instance.touchEnabled = true;
|
|
instance.addEventListener(egret.TouchEvent.TOUCH_TAP, instance.onTouchTap, instance);
|
|
instance.addEventListener(egret.Event.ADDED_TO_STAGE, instance.onAdded, instance);
|
|
instance.addEventListener(egret.Event.REMOVED_FROM_STAGE, instance.onRemoved, instance);
|
|
return instance;
|
|
}
|
|
__extends(SceneBase, BaseClass);
|
|
SceneBase.prototype.onAdded = function () {
|
|
this.removeEventListener(egret.Event.ADDED_TO_STAGE, this.onAdded, this);
|
|
};
|
|
SceneBase.prototype.onRemoved = function () {
|
|
this.removeEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemoved, this);
|
|
this.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this);
|
|
game.UIUtils.removeButtonScaleEffects(this);
|
|
this.destroy();
|
|
};
|
|
SceneBase.prototype.destroy = function () {
|
|
this.resGroup && RES.destroyRes(this.resGroup);
|
|
};
|
|
SceneBase.prototype.createChildren = function () {
|
|
BaseClass.prototype.createChildren.call(this);
|
|
game.UIUtils.addButtonScaleEffects(this);
|
|
};
|
|
SceneBase.prototype.onTouchTap = function () {};
|
|
return SceneBase;
|
|
})(eui.Panel || eui.Component);
|
|
__reflect(SceneBase.prototype, "SceneBase");
|
|
|
|
var BloodTips =
|
|
typeof BloodTips !== "undefined"
|
|
? BloodTips
|
|
: (function (BaseClass) {
|
|
function BloodTips() {
|
|
return BaseClass.call(this) || this;
|
|
}
|
|
__extends(BloodTips, BaseClass);
|
|
BloodTips.getInstance = function () {
|
|
return this._insatance || (this._insatance = new BloodTips()), this._insatance;
|
|
};
|
|
BloodTips.prototype.createTips = function (x, y, text, effectType, duration, fontName) {
|
|
if (effectType === void 0) effectType = 0;
|
|
if (fontName === void 0) fontName = "battle_pet_zi_fnt";
|
|
var label = new eui.BitmapLabel();
|
|
label.font = fontName;
|
|
label.text = text;
|
|
GameLayerManager.gameLayer().effectLayer.contains(label) || GameLayerManager.gameLayer().effectLayer.addChild(label);
|
|
label.x = x;
|
|
label.y = y;
|
|
label.anchorOffsetX = label.width / 2;
|
|
label.anchorOffsetY = label.height / 2;
|
|
var remove = function () {
|
|
GameLayerManager.gameLayer().effectLayer.contains(label) && GameLayerManager.gameLayer().effectLayer.removeChild(label);
|
|
};
|
|
if (effectType === 0) {
|
|
egret.Tween.get(label)
|
|
.to({ scaleX: 1.3, scaleY: 1.3 }, 200, egret.Ease.backIn)
|
|
.to({ scaleX: 1, scaleY: 1 }, 200, egret.Ease.backOut)
|
|
.to({ y: y - 200, alpha: 0 }, duration || 600)
|
|
.call(remove, this);
|
|
}
|
|
};
|
|
return BloodTips;
|
|
})(egret.EventDispatcher);
|
|
__reflect(BloodTips.prototype, "BloodTips");
|
|
|
|
|
|
var AsumentParkItem = function(t) {
|
|
function e() {
|
|
return t.call(this) || this
|
|
}
|
|
return __extends(e, t),
|
|
e.prototype.childrenCreated = function() {
|
|
t.prototype.childrenCreated.call(this)
|
|
},
|
|
e.prototype.showGroup = function(t) {
|
|
0 == t ? (this.label1.visible = !1, this.label2.visible = !0, this.icon2.visible = !0) : (this.label1.visible = !0, this.label2.visible = !1, this.icon2.visible = !1)
|
|
},
|
|
e
|
|
} (eui.RadioButton);
|
|
__reflect(AsumentParkItem.prototype, "AsumentParkItem");
|
|
var AsumentParkManager = function(t) {
|
|
function e() {
|
|
var e = t.call(this) || this;
|
|
return e.zhuawaArr = [10, 20, 30, 40, 50],
|
|
e.sucfaildType = 0,
|
|
e
|
|
}
|
|
return __extends(e, t),
|
|
e.getInstance = function() {
|
|
return this._instance || (this._instance = new e),
|
|
this._instance
|
|
},
|
|
e.prototype.sendNetStartGame = function(t) {
|
|
this.gameType = t,
|
|
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "comm/enter-pleasure-ground", {},
|
|
this.onSendNetStartGame.bind(this))
|
|
},
|
|
e.prototype.onSendNetStartGame = function(t) {
|
|
if (0 == t.status) {
|
|
switch (this.gameType) {
|
|
case 0:
|
|
game.AppFacade.instance.sendNotification(PanelNotify.OPEN_ZUMA);
|
|
break;
|
|
case 1:
|
|
game.AppFacade.instance.sendNotification(PanelNotify.OPEN_TIANBING);
|
|
break;
|
|
case 2:
|
|
game.AppFacade.instance.sendNotification(PanelNotify.OPEN_ZHUAWAWA)
|
|
}
|
|
this.uuid = t.data.uuid,
|
|
game.AppFacade.instance.sendNotification(PanelNotify.CLOSE_ASUMENT_PARK);
|
|
var e = Global.gameProxy.getCommonConfig(),
|
|
i = e[19].min;
|
|
Global.playerProxy.playerData.gold -= i,
|
|
game.EventManager.instance.dispatch(SysNotify.TOPLAYER_INFO_UPDATE)
|
|
} else TipsUtils.showTipsDownToUp(GameConfig.ServerCode[t.status])
|
|
},
|
|
e.prototype.sendNetEndtGame = function() {
|
|
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "comm/pleasure-ground", {
|
|
user_id: Global.playerProxy.playerData.id,
|
|
score: this.scroe,
|
|
uuid: this.uuid
|
|
},
|
|
this.onSendNetEndGame.bind(this))
|
|
},
|
|
e.prototype.onSendNetEndGame = function(t) {
|
|
if (0 == t.status) {
|
|
var e = Global.gameProxy.getAsumentParkConfig(),
|
|
i = e[1].integral;
|
|
this.scroe < i ? this.sucfaildType = 3 : (this.sucfaildType = 2, this.curdata = t.data),
|
|
game.AppFacade.instance.sendNotification(PanelNotify.OPEN_REWARD_TIPS)
|
|
} else TipsUtils.showTipsDownToUp(GameConfig.ServerCode[t.status])
|
|
},
|
|
e.prototype.alaysHasCount = function() {
|
|
var t = Global.playerProxy.playerData.vip;
|
|
if (0 == t) return 0;
|
|
var e = Global.gameProxy.getVipConfigForID(t),
|
|
i = e.playground_frequency;
|
|
return i - this.asumentCount
|
|
},
|
|
e
|
|
} (egret.EventDispatcher);
|
|
__reflect(AsumentParkManager.prototype, "AsumentParkManager");
|
|
|
|
var AsumentParkPanel = class AsumentParkPanel extends game.BasePanel {
|
|
constructor() {
|
|
super();
|
|
this.skinName = amusementParkPanel;
|
|
}
|
|
childrenCreated() {
|
|
super.childrenCreated && super.childrenCreated();
|
|
this.init();
|
|
}
|
|
init() {
|
|
this.radioGroup = new eui.RadioButtonGroup();
|
|
this.radio0.group = this.radioGroup;
|
|
this.radio0.value = 0;
|
|
this.radio1.group = this.radioGroup;
|
|
this.radio1.value = 1;
|
|
this.radio2.group = this.radioGroup;
|
|
this.radio2.value = 2;
|
|
this.radioGroup.addEventListener(egret.Event.CHANGE, this.onRadioGroupChange, this);
|
|
this.radio0.showGroup(1);
|
|
this.radio1.showGroup(0);
|
|
this.radio2.showGroup(0);
|
|
this.radio0.icons.source = "park_json.park_t8";
|
|
this.radio1.icons.source = "park_json.park_t3";
|
|
this.radio2.icons.source = "park_json.park_t7";
|
|
this.radio0.imgbg.source = "park_bg1_png";
|
|
this.radio1.imgbg.source = "park_bg0_png";
|
|
this.radio2.imgbg.source = "park_bg2_png";
|
|
this.updata();
|
|
}
|
|
onRadioGroupChange() {
|
|
AsumentParkManager.getInstance().sendNetStartGame(this.radioGroup.selectedValue);
|
|
}
|
|
createChildren() {
|
|
super.createChildren();
|
|
var panel = this.commonPanel;
|
|
panel.setPanelWidth(640);
|
|
panel.setPanelHeight(710);
|
|
panel.setTitleIcon("park_json.park_t5");
|
|
panel.setTitle("park_bg_logo_png");
|
|
}
|
|
btnCloseTouchEnded() {
|
|
game.AppFacade.getInstance().sendNotification(PanelNotify.CLOSE_ASUMENT_PARK);
|
|
}
|
|
updata() {
|
|
var count = AsumentParkManager.getInstance().alaysHasCount();
|
|
if (count > 0) {
|
|
this.radio0.showGroup(1);
|
|
this.radio1.showGroup(1);
|
|
this.radio2.showGroup(1);
|
|
this.radio0.label1.text = "免费次数" + count;
|
|
this.radio1.label1.text = "免费次数" + count;
|
|
this.radio2.label1.text = "免费次数" + count;
|
|
} else {
|
|
this.radio0.showGroup(0);
|
|
this.radio1.showGroup(0);
|
|
this.radio2.showGroup(0);
|
|
var common = Global.gameProxy.getCommonConfig();
|
|
this.radio0.label2.text = "" + common[19].min;
|
|
this.radio1.label2.text = "" + common[19].min;
|
|
this.radio2.label2.text = "" + common[19].min;
|
|
}
|
|
}
|
|
};
|
|
__reflect(AsumentParkPanel.prototype, "AsumentParkPanel");
|
|
|
|
var AsumentParkMediator = class AsumentParkMediator extends BaseMediator {
|
|
constructor() {
|
|
super("AsumentParkMediator");
|
|
}
|
|
listNotificationInterests() {
|
|
return [PanelNotify.OPEN_ASUMENT_PARK, PanelNotify.CLOSE_ASUMENT_PARK];
|
|
}
|
|
onRegister() {
|
|
super.onRegister && super.onRegister();
|
|
this.facade.registerMediator(new ZumaMediator());
|
|
this.facade.registerMediator(new game.TianbingMediator());
|
|
this.facade.registerMediator(new RewardTipsMediator());
|
|
this.facade.registerMediator(new ZhuawawaMediator());
|
|
}
|
|
showViewComponent(layer) {
|
|
if (layer === void 0) layer = 7;
|
|
this.viewComponent = new AsumentParkPanel();
|
|
this.showUI(this.viewComponent, true, 0, 0, layer);
|
|
}
|
|
handleNotification(notification) {
|
|
switch (notification.getName()) {
|
|
case PanelNotify.OPEN_ASUMENT_PARK:
|
|
this.sendNetGetCount();
|
|
break;
|
|
case PanelNotify.CLOSE_ASUMENT_PARK:
|
|
this.closeViewComponent();
|
|
this.viewComponent = null;
|
|
break;
|
|
}
|
|
}
|
|
sendNetGetCount() {
|
|
Global.netProxy.sendRequest(
|
|
GameConfig.SERVER_PATH + "comm/get-pleasure-ground",
|
|
{},
|
|
this.onSendNetGetCount.bind(this)
|
|
);
|
|
}
|
|
onSendNetGetCount(response) {
|
|
if (response.status == 0) {
|
|
AsumentParkManager.getInstance().asumentCount = response.data.count;
|
|
this.showViewComponent();
|
|
} else TipsUtils.showTipsDownToUp(GameConfig.ServerCode[response.status]);
|
|
}
|
|
static NAME = "AsumentParkMediator";
|
|
};
|
|
__reflect(AsumentParkMediator.prototype, "AsumentParkMediator");
|
|
|
|
|
|
var LoadingCompoment = function(t) {
|
|
function e() {
|
|
var e = t.call(this) || this;
|
|
return e.skinName = LoadingCompomentSkin,
|
|
e
|
|
}
|
|
return __extends(e, t),
|
|
e.prototype.chilrenCreated = function() {
|
|
t.prototype.childrenCreated.call(this)
|
|
},
|
|
e.getInstance = function() {
|
|
return this._instance || (this._instance = new e),
|
|
this._instance
|
|
},
|
|
e.prototype.show = function() {
|
|
PopUpManager.addPopUp(this, !1, 0, 0, 0)
|
|
},
|
|
e.prototype.hide = function() {
|
|
PopUpManager.removePopUpAsync(this, 0, null)
|
|
},
|
|
e
|
|
} (eui.Component);
|
|
__reflect(LoadingCompoment.prototype, "LoadingCompoment");
|
|
var RewardTips = function(t) {
|
|
function e() {
|
|
var e = t.call(this) || this;
|
|
return e.skinName = RewardTipsSkin,
|
|
e
|
|
}
|
|
return __extends(e, t),
|
|
e.prototype.childrenCreated = function() {
|
|
switch (t.prototype.childrenCreated.call(this), this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTab, this), this.petSucGroup.visible = !1, this.PetFailGroup.visible = !1, this.sucYouleGroup.visible = !1, this.failYouleGroup.visible = !1, AsumentParkManager.getInstance().sucfaildType) {
|
|
case 0:
|
|
this.petSucGroup.visible = !0;
|
|
var e = Global.gameProxy.getItemSFConfig(),
|
|
i = e[1],
|
|
n = i.outcome_id;
|
|
this.expLabel.text = "获得宠物经验" + i.experience_outcome,
|
|
this.goldLabel.text = "X" + n.split(":")[1];
|
|
break;
|
|
case 1:
|
|
this.PetFailGroup.visible = !0;
|
|
break;
|
|
case 2:
|
|
this.sucYouleGroup.visible = !0;
|
|
var a = Global.gameProxy.getItemImageId(AsumentParkManager.getInstance().curdata.item_id),
|
|
e = Global.gameProxy.getItemConfig(AsumentParkManager.getInstance().curdata.item_id);
|
|
this.boxImg.source = a + "_png",
|
|
this.boxLabel.text = e.name;
|
|
break;
|
|
case 3:
|
|
this.failYouleGroup.visible = !0
|
|
}
|
|
},
|
|
e.prototype.onTab = function(t) {
|
|
switch (game.AppFacade.instance.sendNotification(PanelNotify.CLOSE_REWARD_TIPS), AsumentParkManager.getInstance().sucfaildType) {
|
|
case 0:
|
|
0 == BattleFruitManager.getInstance().openType ? (game.AppFacade.getInstance().sendNotification(SceneNotify.OPEN_MINE_GAME), game.AppFacade.getInstance().sendNotification(PanelNotify.OPEN_SPORTS)) : (game.AppFacade.getInstance().sendNotification(SceneNotify.CLOSE_BATTLEPET), game.AppFacade.getInstance().sendNotification(ClientNotify.GO_OTHER_FARM, {
|
|
uid: BattleFruitManager.getInstance().friendData.user_id
|
|
}));
|
|
break;
|
|
case 1:
|
|
0 == BattleFruitManager.getInstance().openType ? (game.AppFacade.getInstance().sendNotification(SceneNotify.OPEN_MINE_GAME), game.AppFacade.getInstance().sendNotification(PanelNotify.OPEN_SPORTS)) : (game.AppFacade.getInstance().sendNotification(SceneNotify.CLOSE_BATTLEPET), game.AppFacade.getInstance().sendNotification(SceneNotify.OPEN_MINE_GAME), game.AppFacade.getInstance().sendNotification(PanelNotify.OPEN_FRIEND, {
|
|
uid: BattleFruitManager.getInstance().friendData.uid
|
|
}));
|
|
break;
|
|
case 2:
|
|
0 == AsumentParkManager.getInstance().gameType ? game.AppFacade.getInstance().sendNotification(PanelNotify.CLOSE_ZUMA) : 1 == AsumentParkManager.getInstance().gameType ? game.AppFacade.getInstance().sendNotification(PanelNotify.CLOSE_TIANBING) : game.AppFacade.getInstance().sendNotification(PanelNotify.CLOSE_ZHUAWAWA),
|
|
game.AppFacade.instance.sendNotification(PanelNotify.OPEN_ASUMENT_PARK);
|
|
break;
|
|
case 3:
|
|
0 == AsumentParkManager.getInstance().gameType ? game.AppFacade.getInstance().sendNotification(PanelNotify.CLOSE_ZUMA) : 1 == AsumentParkManager.getInstance().gameType ? game.AppFacade.getInstance().sendNotification(PanelNotify.CLOSE_TIANBING) : game.AppFacade.getInstance().sendNotification(PanelNotify.CLOSE_ZHUAWAWA),
|
|
game.AppFacade.instance.sendNotification(PanelNotify.OPEN_ASUMENT_PARK)
|
|
}
|
|
},
|
|
e
|
|
} (eui.Component);
|
|
__reflect(RewardTips.prototype, "RewardTips");
|
|
|
|
var RewardTipsMediator = class RewardTipsMediator extends BaseMediator {
|
|
constructor() {
|
|
super("RewardTipsMediator");
|
|
}
|
|
listNotificationInterests() {
|
|
return [PanelNotify.OPEN_REWARD_TIPS, PanelNotify.CLOSE_REWARD_TIPS];
|
|
}
|
|
onRegister() {
|
|
super.onRegister && super.onRegister();
|
|
}
|
|
showViewComponent(layer) {
|
|
if (layer === void 0) layer = 7;
|
|
this.viewComponent = new RewardTips();
|
|
this.showUI(this.viewComponent, true, 0, 0, layer);
|
|
}
|
|
handleNotification(notification) {
|
|
switch (notification.getName()) {
|
|
case PanelNotify.OPEN_REWARD_TIPS:
|
|
this.showViewComponent();
|
|
break;
|
|
case PanelNotify.CLOSE_REWARD_TIPS:
|
|
this.closeViewComponent();
|
|
this.viewComponent = null;
|
|
break;
|
|
}
|
|
}
|
|
static NAME = "RewardTipsMediator";
|
|
};
|
|
__reflect(RewardTipsMediator.prototype, "RewardTipsMediator");
|
|
|
|
|
|
var Globals; !
|
|
function(t) {
|
|
function e() {
|
|
return __awaiter(this, void 0, void 0,
|
|
function() {
|
|
var t;
|
|
return __generator(this,
|
|
function(e) {
|
|
return t = this,
|
|
[2, new Promise(function(e, i) {
|
|
for (var n = 0; 5 > n; n++) t.textures[n] = RES.getRes("gtype_" + n + "_png");
|
|
for (; t.checkLoadOver();) return void e()
|
|
})]
|
|
})
|
|
})
|
|
}
|
|
function i() {
|
|
for (var t in this.textures) if (!this.textures[t]) return ! 1;
|
|
return ! 0
|
|
}
|
|
t.myName = "dily",
|
|
t.GAME_ID = "10005",
|
|
t.textures = {},
|
|
t.textureNum = 5,
|
|
t.initTextures = e,
|
|
t.checkLoadOver = i
|
|
} (Globals || (Globals = {}));
|
|
var game; !
|
|
function(t) {
|
|
var e = function() {
|
|
function t() {}
|
|
return t.get = function(t) {
|
|
return this.map.get(t)
|
|
},
|
|
t.getOne = function(t, e) {
|
|
var i = this.map.get(t);
|
|
i || (i = [], this.map.put(t, i));
|
|
var n = null;
|
|
return n = i.length > 0 ? i.pop() : new e
|
|
},
|
|
t.recycle = function(t, e) {
|
|
var i = this.map.get(t);
|
|
i || (i = [], this.map.put(t, i)),
|
|
i.push(e)
|
|
},
|
|
t.destroyObjectPool = function() {
|
|
this.map.clear()
|
|
},
|
|
t.createObjectByCount = function(t, e, i) {
|
|
var n = this.map.get(t);
|
|
n || (n = [], this.map.put(t, n));
|
|
for (var a = 0; e > a; a++) {
|
|
var o = new i;
|
|
n.push(o)
|
|
}
|
|
},
|
|
t.map = new HashMap,
|
|
t
|
|
} ();
|
|
t.ObjectPool = e,
|
|
__reflect(e.prototype, "game.ObjectPool")
|
|
} (game || (game = {}));
|
|
|
|
var game;
|
|
!(function (game) {
|
|
const TianbingMediator = class TianbingMediator extends BaseMediator {
|
|
constructor(viewComponent) {
|
|
if (viewComponent === void 0) viewComponent = null;
|
|
super(TianbingMediator.NAME, viewComponent);
|
|
this.GroupName = "tianbing";
|
|
this.lv = 1;
|
|
}
|
|
listNotificationInterests() {
|
|
return [PanelNotify.OPEN_TIANBING, PanelNotify.CLOSE_TIANBING, PanelNotify.TIANBING_NEXT_QUESTION];
|
|
}
|
|
onRegister() {
|
|
super.onRegister && super.onRegister();
|
|
}
|
|
handleNotification(notification) {
|
|
var body = notification.getBody();
|
|
switch (notification.getName()) {
|
|
case PanelNotify.OPEN_TIANBING:
|
|
if (this.viewComponent && this.viewComponent.stage) return;
|
|
GameConfig.GAME_EXPORT && window.Mta && Mta.clickStar2 && Mta.clickStar2("play", { time: Date.now() });
|
|
RES.isGroupLoaded(this.GroupName)
|
|
? this.showViewComponent()
|
|
: (LoadingCompoment.getInstance().show(),
|
|
RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this),
|
|
RES.addEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadError, this),
|
|
RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this),
|
|
RES.loadGroup(this.GroupName));
|
|
break;
|
|
case PanelNotify.CLOSE_TIANBING:
|
|
game.UIUtils.removeSelf(this.viewComponent);
|
|
this.viewComponent = null;
|
|
break;
|
|
case PanelNotify.OPEN_TIANBING_GAMEOVER:
|
|
this.retuenMainScence(body);
|
|
break;
|
|
}
|
|
}
|
|
retuenMainScence() {
|
|
game.AppFacade.instance.sendNotification(PanelNotify.CLOSE_TIANBING);
|
|
game.AppFacade.instance.sendNotification(PanelNotify.OPEN_REWARD_TIPS);
|
|
}
|
|
onResourceLoadComplete(event) {
|
|
if (event.groupName == this.GroupName) {
|
|
RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
|
|
RES.removeEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadError, this);
|
|
RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
|
|
LoadingCompoment.getInstance().hide();
|
|
Globals.initTextures();
|
|
game.ObjectPool.createObjectByCount("xiaochu", 42, game.WidgetXiaoChu);
|
|
game.ObjectPool.createObjectByCount("xiaochudb", 42, game.WidgetXiaoChuDB);
|
|
this.showViewComponent();
|
|
}
|
|
}
|
|
onResourceLoadError(event) {
|
|
console.warn("Group:" + event.groupName + " has failed to load");
|
|
this.onResourceLoadComplete(event);
|
|
}
|
|
onResourceProgress(event) {
|
|
event.groupName == this.GroupName && LoadingCompoment.getInstance().prossBar.setPross(event.itemsLoaded, event.itemsTotal);
|
|
}
|
|
showViewComponent() {
|
|
this.viewComponent = new game.TianbingPanel();
|
|
GameLayerManager.gameLayer().sceneLayer.addChild(this.viewComponent);
|
|
egret.callLater(function () {
|
|
this.viewComponent &&
|
|
this.viewComponent.backButton &&
|
|
this.viewComponent.backButton.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
|
|
game.AppFacade.getInstance().sendNotification(PanelNotify.CLOSE_TIANBING);
|
|
game.AppFacade.getInstance().sendNotification(PanelNotify.OPEN_ASUMENT_PARK);
|
|
}, this);
|
|
}, this);
|
|
}
|
|
initUI() {}
|
|
initData() {}
|
|
static NAME = "TianbingMediator";
|
|
};
|
|
game.TianbingMediator = TianbingMediator;
|
|
__reflect(TianbingMediator.prototype, "game.TianbingMediator");
|
|
})(game || (game = {}));
|
|
|
|
|
|
var game; !
|
|
function(t) {
|
|
var e = function(e) {
|
|
function i() {
|
|
var t = e.call(this) || this;
|
|
return t.widgetXiaoChus = [],
|
|
t.canTouch = !1,
|
|
t.MAX_ROW = 7,
|
|
t.MAX_COL = 6,
|
|
t.hasFindNextCell = !1,
|
|
t.currentStatusXiaoChu = [],
|
|
t.timeCount = 15e4,
|
|
t.nowDateTime = 0,
|
|
t.score = 0,
|
|
t.skinName = new GameSceneSkinss,
|
|
t
|
|
}
|
|
return __extends(i, e),
|
|
i.prototype.createChildren = function() {
|
|
e.prototype.createChildren.call(this),
|
|
this.initMc(),
|
|
this.xiaochuGroup.mask = this.maskRect,
|
|
this.lessYNumber = GameConfig.curHeight() / 2 - 322,
|
|
this.initData(),
|
|
this.scaleY = GameConfig.curHeight() / Const.DESGIN_H
|
|
},
|
|
i.prototype.musicBtnTouchEnded = function() {},
|
|
i.prototype.timeEnterFrame = function() {
|
|
var t = Date.now(),
|
|
e = t - this.nowDateTime;
|
|
if (e > 100) {
|
|
if (this.nowDateTime = t, this.timeCount -= e, this.timeCount < 0) return this.canTouch = !1,
|
|
this.timeLabel.text = "0s",
|
|
this.checkIsPassByTime(),
|
|
void this.removeEventListener(egret.Event.ENTER_FRAME, this.timeEnterFrame, this);
|
|
this.timeLabel.text = Math.floor(this.timeCount / 1e3) + "s"
|
|
}
|
|
},
|
|
i.prototype.initMc = function() {
|
|
var t = RES.getRes("boom_png"),
|
|
e = RES.getRes("boom_json"),
|
|
i = new egret.MovieClipDataFactory(e, t);
|
|
this.boomMcData = i.generateMovieClipData("boom");
|
|
var n = RES.getRes("effect_png"),
|
|
a = RES.getRes("effect_json"),
|
|
o = new egret.MovieClipDataFactory(a, n);
|
|
this.hengMcData = o.generateMovieClipData("heng"),
|
|
this.shuMcData = o.generateMovieClipData("shu")
|
|
},
|
|
i.prototype.startGame = function() {
|
|
this.xiaochuGroup.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.xiaochuGroupTouchBegin, this),
|
|
this.xiaochuGroup.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.xiaochuGroupTouchMove, this),
|
|
this.nowDateTime = Date.now(),
|
|
this.addEventListener(egret.Event.ENTER_FRAME, this.timeEnterFrame, this),
|
|
this.canTouch = !0
|
|
},
|
|
i.prototype.xiaochuGroupTouchBegin = function(t) {
|
|
if (this.checkCanTouch() && this.canTouch) {
|
|
this.combo = 1;
|
|
var e = this.findCellByPos(t.stageX, t.stageY - this.lessYNumber);
|
|
e && (Global.audioProxy.playSound("click_mp3"), this.startCell = e, e.playCellSelect(), this.touchStartX = t.stageX, this.touchStartY = t.stageY - this.lessYNumber, this.hasFindNextCell = !1)
|
|
}
|
|
},
|
|
i.prototype.checkCanTouch = function() {
|
|
for (var t = 0; t < this.MAX_ROW; t++) for (var e = 0; e < this.MAX_COL; e++) {
|
|
var i = this.widgetXiaoChus[t][e];
|
|
if (!i) return ! 1
|
|
}
|
|
return ! 0
|
|
},
|
|
i.prototype.xiaochuGroupTouchMove = function(e) {
|
|
if (this.checkCanTouch() && this.canTouch && this.startCell && !this.hasFindNextCell) {
|
|
var i = t.WidgetXiaoChu.SIZE / 2,
|
|
n = -1,
|
|
a = -1,
|
|
o = e.stageX - this.touchStartX,
|
|
s = e.stageY - this.lessYNumber - this.touchStartY;
|
|
o > i && this.startCell.col < this.MAX_COL - 1 ? a = this.startCell.col + 1 : -i > o && this.startCell.col > 0 ? a = this.startCell.col - 1 : s > i && this.startCell.row < this.MAX_ROW - 1 ? n = this.startCell.row + 1 : -i > s && this.startCell.row > 0 && (n = this.startCell.row - 1);
|
|
var r = null;
|
|
n >= 0 ? r = this.widgetXiaoChus[n][this.startCell.col] : a >= 0 && (r = this.widgetXiaoChus[this.startCell.row][a]),
|
|
r && (Global.audioProxy.playSound("move_mp3"), this.hasFindNextCell = !0, this.changeTwoCell(this.startCell, r, !0))
|
|
}
|
|
},
|
|
i.prototype.playEffectAni = function(t) {
|
|
for (var e = 0; e < t.length; e++) {
|
|
var i = t[e],
|
|
n = i.getEffectType(),
|
|
a = {
|
|
x: i.x,
|
|
y: i.y
|
|
},
|
|
o = new egret.MovieClip(this[n + "McData"]),
|
|
s = new egret.MovieClip(this[n + "McData"]);
|
|
this.addChild(o),
|
|
this.addChild(s),
|
|
"heng" === n ? (s.scaleX = -1, o.x = a.x - 810 + 112, s.x = 810 + a.x + 58 - 6, o.y = a.y + this.lessYNumber + 6, s.y = a.y + this.lessYNumber + 6) : (s.scaleY = -1, o.x = a.x - 40 + 92, s.x = a.x - 40 + 92, o.y = a.y + this.lessYNumber + 6, s.y = a.y + this.lessYNumber + 58 + 6),
|
|
this.addMovieClipComplete(o),
|
|
this.addMovieClipComplete(s),
|
|
o.play(1),
|
|
s.play(1)
|
|
}
|
|
},
|
|
i.prototype.changeTwoCell = function(t, e, i) {
|
|
var n = this;
|
|
this.canTouch = !i;
|
|
var a = t.row,
|
|
o = t.col;
|
|
t.setRowAndCol(e.row, e.col),
|
|
e.setRowAndCol(a, o),
|
|
this.widgetXiaoChus[t.row][t.col] = t,
|
|
this.widgetXiaoChus[e.row][e.col] = e;
|
|
var s = t.startFlyToEnd(),
|
|
r = e.startFlyToEnd(),
|
|
h = Math.max(s, r);
|
|
if (t.statusType && e.statusType) return void egret.setTimeout(function() {
|
|
Global.audioProxy.playSound("heng_mp3");
|
|
var i = this.reCountXiaoChu(this.findHasStatusXiaoChu([t, e]), [t, e]);
|
|
i = this.filterSingleArr(i),
|
|
this.playEffectAni([t, e]),
|
|
this.playRemoveCellEffect(i)
|
|
},
|
|
this, h);
|
|
var l = "combo1_mp3";
|
|
if (i) {
|
|
var h = Math.max(s, r);
|
|
egret.setTimeout(function() {
|
|
var i = n.findHorizontalMatch(t),
|
|
a = n.findHorizontalMatch(e),
|
|
o = n.findVerticalMatch(t),
|
|
s = n.findVerticalMatch(e);
|
|
if (i.length >= 3 || a.length >= 3 || o.length >= 3 || s.length >= 3) {
|
|
var r = [],
|
|
h = i.length;
|
|
h >= 3 && (h > 3 && (n.checkCreateType78(t, i, 8), h = i.length), i = n.reCountXiaoChu(n.findHasStatusXiaoChu(i), i), i.length !== h && (l = "heng_mp3"), r.push.apply(r, i));
|
|
var c = a.length;
|
|
c >= 3 && (c > 3 && (n.checkCreateType78(e, a, 8), c = i.length), a = n.reCountXiaoChu(n.findHasStatusXiaoChu(a), a), a.length !== c && (l = "heng_mp3"), r.push.apply(r, a));
|
|
var p = o.length;
|
|
p >= 3 && (p > 3 && (n.checkCreateType78(t, o, 7), p = o.length), o = n.reCountXiaoChu(n.findHasStatusXiaoChu(o), o), o.length !== p && (l = "heng_mp3"), r.push.apply(r, o));
|
|
var u = s.length;
|
|
u >= 3 && (u > 3 && (n.checkCreateType78(e, s, 7), u = s.length), s = n.reCountXiaoChu(n.findHasStatusXiaoChu(s), s), s.length !== u && (l = "heng_mp3"), r.push.apply(r, s)),
|
|
r = n.filterSingleArr(r),
|
|
Global.audioProxy.playSound(l);
|
|
var d = n.findHasStatusXiaoChuInRemove(r);
|
|
n.playEffectAni(d),
|
|
n.playRemoveCellEffect(r)
|
|
} else n.changeTwoCell(t, e, !1)
|
|
},
|
|
this, h)
|
|
}
|
|
},
|
|
i.prototype.findHasStatusXiaoChuInRemove = function(t) {
|
|
var e = [];
|
|
return t.forEach(function(t) {
|
|
t.statusType && e.push(t)
|
|
}),
|
|
e
|
|
},
|
|
i.prototype.checkCreateType78 = function(e, i, n) {
|
|
i.length >= 4 && (e.changeStatusType(n), e.setLife(2), t.Utils.removeArrayItem(i, e))
|
|
},
|
|
i.prototype.filterSingleArr = function(t) {
|
|
var e = [];
|
|
return t.forEach(function(t) { - 1 == e.indexOf(t) && e.push(t)
|
|
}),
|
|
e
|
|
},
|
|
i.prototype.addMovieClipComplete = function(e) {
|
|
e.addEventListener(egret.Event.COMPLETE,
|
|
function(i) {
|
|
t.UIUtils.removeSelf(e),
|
|
e = null
|
|
},
|
|
this)
|
|
},
|
|
i.prototype.playBoomEffect = function(e, i) {
|
|
var n = new egret.MovieClip(this.boomMcData);
|
|
this.addChild(n),
|
|
n.addEventListener(egret.Event.COMPLETE,
|
|
function(e) {
|
|
t.UIUtils.removeSelf(n),
|
|
n = null
|
|
},
|
|
this),
|
|
n.x = e - 70,
|
|
n.y = i - 70,
|
|
n.play(1)
|
|
},
|
|
i.prototype.playRemoveCellEffect = function(t) {
|
|
for (var e = this,
|
|
i = 0; i < t.length; i++) {
|
|
var n = t[i];
|
|
n.eatRemove();
|
|
var a = n.localToGlobal();
|
|
this.playBoomEffect(a.x, a.y),
|
|
this.widgetXiaoChus[n.row][n.col] = null
|
|
}
|
|
egret.setTimeout(function() {
|
|
e.dropCell(),
|
|
e.countScore(t.length),
|
|
e.combo++
|
|
},
|
|
this, 600)
|
|
},
|
|
i.prototype.countScore = function(t) {
|
|
var e = 2 * t * Math.pow(1.5, this.combo);
|
|
this.score += Math.floor(e),
|
|
this.scoreLabel.text = "" + this.score,
|
|
this.checkIsPassByScore()
|
|
},
|
|
i.prototype.checkIsPassByTime = function() {
|
|
egret.setTimeout(function() {
|
|
AsumentParkManager.getInstance().scroe = this.score,
|
|
AsumentParkManager.getInstance().sendNetEndtGame()
|
|
},
|
|
this, 2e3)
|
|
},
|
|
i.prototype.checkIsPassByScore = function() {},
|
|
i.prototype.dropCell = function() {
|
|
var t = this;
|
|
this.setXiaoChuLife();
|
|
for (var e = 0,
|
|
i = {},
|
|
n = [], a = this.MAX_ROW - 1; a >= 0; a--) for (var o = 0; o < this.MAX_COL; o++) {
|
|
i[o] || (i[o] = {});
|
|
var s = this.widgetXiaoChus[a][o];
|
|
s || (s = this.findLastTopCell(a, o), s ? (this.widgetXiaoChus[s.row][s.col] = null, s.setRowAndCol(a, o), n.push(s)) : (s = this.makeNewCell(a, o), i[o][a] = s, this.resetListYIndex(_.values(i[o])), n.push(s)), this.widgetXiaoChus[a][o] = s)
|
|
}
|
|
var e = 0;
|
|
n.forEach(function(t) {
|
|
var i = t.startFlyToEnd();
|
|
i > e && (e = i)
|
|
}),
|
|
egret.setTimeout(function() {
|
|
t.checkAllMatch3()
|
|
},
|
|
this, e + 100)
|
|
},
|
|
i.prototype.resetListYIndex = function(e) {
|
|
for (var i = 0; i <= e.length - 1; i++) e[i].y = (e.length - i) * -t.WidgetXiaoChu.SIZE
|
|
},
|
|
i.prototype.findHasStatusXiaoChu = function(e) {
|
|
for (var i = [], n = 0; n < e.length; n++) e[n].statusType && 1 === e[n].life && !t.Utilss.arrayHasItem(this.currentStatusXiaoChu, e[n]) && i.push(e[n]);
|
|
return i
|
|
},
|
|
i.prototype.reCountXiaoChu = function(e, i) {
|
|
var n = this;
|
|
return e.forEach(function(e, a) {
|
|
var o = e.statusType;
|
|
if (7 === o && 1 === e.life) {
|
|
n.currentStatusXiaoChu.push(e);
|
|
var s = n.widgetXiaoChus[e.row];
|
|
s.forEach(function(e) {
|
|
t.Utilss.arrayHasItem(i, e) || i.push(e)
|
|
})
|
|
} else 8 === o && 1 === e.life && (n.currentStatusXiaoChu.push(e), n.widgetXiaoChus.forEach(function(n) {
|
|
n.forEach(function(n) {
|
|
n.col === e.col && (t.Utilss.arrayHasItem(i, n) || i.push(n))
|
|
})
|
|
}))
|
|
}),
|
|
this.findHasStatusXiaoChu(i).length < 1 ? (this.currentStatusXiaoChu = [], i) : this.reCountXiaoChu(this.findHasStatusXiaoChu(i), i)
|
|
},
|
|
i.prototype.checkAllMatch3 = function() {
|
|
if (! (this.timeCount <= 0)) {
|
|
for (var e = [], i = [], n = "combo" + this.combo + "_mp3", a = 0; a < this.MAX_ROW; a++) for (var o = 0; o < this.MAX_COL; o++) {
|
|
var s = this.widgetXiaoChus[a][o],
|
|
r = this.findHorizontalMatch(s);
|
|
r.length > 3 ? t.Utilss.arrayHasItem(e, s) || (s.changeStatusType(8), s.setLife(2), e = e.concat(r), i = i.concat(r), t.Utils.removeArrayItem(i, s)) : 3 === r.length && (i = i.concat(r));
|
|
var h = this.findVerticalMatch(s);
|
|
h.length > 3 ? t.Utilss.arrayHasItem(e, s) || (s.changeStatusType(7), s.setLife(2), e = e.concat(h), i = i.concat(h), t.Utils.removeArrayItem(i, s)) : 3 === h.length && (i = i.concat(h))
|
|
}
|
|
i = this.filterSingleArr(i);
|
|
var l = i.length;
|
|
if (i = this.reCountXiaoChu(this.findHasStatusXiaoChu(i), i), i.length !== l && (n = "heng_mp3"), i.length > 0) {
|
|
"heng_mp3" === n ? Global.audioProxy.playSound("heng_mp3") : this.playComboMusic();
|
|
var c = this.findHasStatusXiaoChuInRemove(i);
|
|
this.playEffectAni(c),
|
|
this.playRemoveCellEffect(i)
|
|
} else this.playComboResultMusic(),
|
|
this.combo = 1,
|
|
this.canTouch = !0;
|
|
this.setXiaoChuLife()
|
|
}
|
|
},
|
|
i.prototype.setXiaoChuLife = function() {
|
|
this.widgetXiaoChus.forEach(function(t) {
|
|
t.forEach(function(t) {
|
|
t && t.setLife(1)
|
|
})
|
|
})
|
|
},
|
|
i.prototype.playComboResultMusic = function() {
|
|
var t = this.combo - 1;
|
|
t >= 3 && 5 > t ? (Global.audioProxy.playSound("comboresult3_mp3"), this.widgetComboTips.showTipsImage(3)) : t >= 5 && 7 > t ? (Global.audioProxy.playSound("comboresult5_mp3"), this.widgetComboTips.showTipsImage(5)) : t >= 7 && 9 > t ? (Global.audioProxy.playSound("comboresult7_mp3"), this.widgetComboTips.showTipsImage(7)) : t >= 9 && 11 > t ? (Global.audioProxy.playSound("comboresult9_mp3"), this.widgetComboTips.showTipsImage(9)) : t >= 11 && (Global.audioProxy.playSound("comboresult11_mp3"), this.widgetComboTips.showTipsImage(11))
|
|
},
|
|
i.prototype.playComboMusic = function() {
|
|
this.combo > 8 && (this.combo = 8),
|
|
Global.audioProxy.playSound("combo" + this.combo + "_mp3")
|
|
},
|
|
i.prototype.findLastTopCell = function(t, e) {
|
|
for (var i = t - 1; i >= 0;) {
|
|
var n = this.widgetXiaoChus[i][e];
|
|
if (n) return n;
|
|
i--
|
|
}
|
|
return null
|
|
},
|
|
i.prototype.initData = function() {
|
|
this.createDb(),
|
|
this.initCells(),
|
|
egret.setTimeout(function() {
|
|
this.showCells()
|
|
},
|
|
this, 300),
|
|
egret.setTimeout(function() {
|
|
this.startGame()
|
|
},
|
|
this, 600)
|
|
},
|
|
i.prototype.showCells = function() {
|
|
this.widgetXiaoChus.forEach(function(t, e) {
|
|
t.forEach(function(t, e) {
|
|
t.showXiaoChuImage()
|
|
})
|
|
})
|
|
},
|
|
i.prototype.initCells = function() {
|
|
this.widgetXiaoChus = [];
|
|
for (var t = 0; t < this.MAX_ROW; t++) {
|
|
var e = [];
|
|
this.widgetXiaoChus.push(e);
|
|
for (var i = 0; i < this.MAX_COL; i++) {
|
|
var n = this.makeNewCell(t, i);
|
|
n.hideXiaoChuImage(),
|
|
e.push(n)
|
|
}
|
|
}
|
|
this.checkNoMatch()
|
|
},
|
|
i.prototype.makeNewCell = function(e, i, n) {
|
|
void 0 === n && (n = !1);
|
|
var a = t.ObjectPool.getOne("xiaochu", t.WidgetXiaoChu);
|
|
a.setRowAndCol(e, i);
|
|
var o = Math.floor(_.random(0, Globals.textureNum - 1));
|
|
return a.x = a.endX,
|
|
a.y = a.endY,
|
|
n && (a.y = -(e + 1) * t.WidgetXiaoChu.SIZE),
|
|
this.xiaochuGroup.addChild(a),
|
|
a.changeImage(Globals.textures[o], o),
|
|
a
|
|
},
|
|
i.prototype.checkNoMatch = function() {
|
|
for (var t = !1,
|
|
e = 0; e < this.MAX_ROW; e++) for (var i = 0; i < this.MAX_COL; i++) {
|
|
var n = this.widgetXiaoChus[e][i],
|
|
a = this.findHorizontalMatch(n);
|
|
if (a.length >= 3) {
|
|
var o = (n.type + 1) % Globals.textureNum;
|
|
n.changeImage(Globals.textures[o], o),
|
|
t = !0
|
|
}
|
|
var s = this.findVerticalMatch(n);
|
|
if (s.length >= 3) {
|
|
var o = (n.type + 1) % Globals.textureNum;
|
|
n.changeImage(Globals.textures[o], o),
|
|
t = !0
|
|
}
|
|
}
|
|
t && this.checkNoMatch()
|
|
},
|
|
i.prototype.testFunc = function() {},
|
|
i.prototype.findHorizontalMatch = function(t) {
|
|
var e = t.type,
|
|
i = (t.statusType, null);
|
|
i = [t];
|
|
for (var n = t.col + 1; n < this.MAX_COL;) {
|
|
var a = this.widgetXiaoChus[t.row][n];
|
|
if (!a || a.type != e) break;
|
|
i.push(a),
|
|
n++
|
|
}
|
|
for (var n = t.col - 1; n >= 0;) {
|
|
var a = this.widgetXiaoChus[t.row][n];
|
|
if (!a || a.type != e) break;
|
|
i.push(a),
|
|
n--
|
|
}
|
|
return i
|
|
},
|
|
i.prototype.findVerticalMatch = function(t) {
|
|
for (var e = t.type,
|
|
i = [t], n = t.row + 1; n < this.MAX_ROW;) {
|
|
var a = this.widgetXiaoChus[n][t.col];
|
|
if (!a || a.type != e) break;
|
|
i.push(a),
|
|
n++
|
|
}
|
|
for (var n = t.row - 1; n >= 0;) {
|
|
var a = this.widgetXiaoChus[n][t.col];
|
|
if (!a || a.type != e) break;
|
|
i.push(a),
|
|
n--
|
|
}
|
|
return i
|
|
},
|
|
i.prototype.createDb = function() {
|
|
for (var e = (t.ObjectPool.get("xiaochudb"), this), i = 0; i < this.MAX_ROW; i++) for (var n = 0; n < this.MAX_COL; n++) {
|
|
var a = t.ObjectPool.getOne("xiaochudb", t.WidgetXiaoChuDB);
|
|
a.changeDb(n, i),
|
|
e.xiaochuGroup.addChild(a),
|
|
a.x = 92 * n,
|
|
a.y = 92 * i
|
|
}
|
|
},
|
|
i.prototype.findCellByPos = function(e, i) {
|
|
e -= 46;
|
|
var n = Math.floor(i / t.WidgetXiaoChu.SIZE),
|
|
a = Math.floor(e / t.WidgetXiaoChu.SIZE);
|
|
return 0 > n ? null: n >= this.MAX_ROW ? null: 0 > a ? null: a >= this.MAX_COL ? null: this.widgetXiaoChus[n][a]
|
|
},
|
|
i
|
|
} (eui.Component);
|
|
t.TianbingPanel = e,
|
|
__reflect(e.prototype, "game.TianbingPanel")
|
|
} (game || (game = {}));
|
|
var game; !
|
|
function(t) {
|
|
var e = function() {
|
|
function e() {}
|
|
return e.rang = function(t, e) {
|
|
return Math.round(Math.random() * (e - t) + t)
|
|
},
|
|
e.isRang = function(t, e, i) {
|
|
return t >= e && i >= t
|
|
},
|
|
e.limit = function(t, e, i) {
|
|
return Math.max(e, Math.min(i, t))
|
|
},
|
|
e.ang2rad = function(t) {
|
|
return t / 180 * Math.PI
|
|
},
|
|
e.rad2ang = function(t) {
|
|
return t / Math.PI * 180
|
|
},
|
|
e.getBigNumberShow = function(t) {
|
|
return 1e4 > t ? t + "": (t /= 1e3, t.toFixed(1) + "K")
|
|
},
|
|
e.isElinArr = function(t, e) {
|
|
return e.indexOf(t) > -1
|
|
},
|
|
e.isArrCrossing = function(e, i) {
|
|
for (var n = 0; n < e.length; n++) if (t.Utils.isElinArr(e[n], i)) return ! 0;
|
|
return ! 1
|
|
},
|
|
e.getURLQueryString = function(t) {
|
|
if (egret.Capabilities.runtimeType == egret.RuntimeType.WEB) {
|
|
var e = decodeURIComponent(window.location.href);
|
|
e = e.replace(/"/g, '"');
|
|
var i;
|
|
return e.indexOf("#?") > 0 ? (e = e.replace("#?", "&"), i = e.match(new RegExp("(^|&)" + t + "=([^&]*)(&|$)"))) : i = window.location.search.substr(1).match(new RegExp("(^|&)" + t + "=([^&]*)(&|$)")),
|
|
i ? i[2] : null
|
|
}
|
|
},
|
|
e.getMaxStr = function(t) {
|
|
return t.length <= 5 ? t: t.substr(0, 5) + "..."
|
|
},
|
|
e.removeArrayItem = function(t, e) {
|
|
var i = t.indexOf(e);
|
|
i > -1 && t.splice(i, 1)
|
|
},
|
|
e.arrayHasItem = function(t, e) {
|
|
var i = t.indexOf(e);
|
|
return i > -1
|
|
},
|
|
e.mtaChainSdk = function(t) {
|
|
var e = window.MtaH5;
|
|
if (e && e.clickStat) {
|
|
var i = {};
|
|
i[t.toLocaleLowerCase()] = "true",
|
|
e.clickStat("yemianshendu", i)
|
|
}
|
|
},
|
|
e
|
|
} ();
|
|
t.Utilss = e,
|
|
__reflect(e.prototype, "game.Utilss")
|
|
} (game || (game = {}));
|
|
var game; !
|
|
function(t) {
|
|
var e = function(t) {
|
|
function e() {
|
|
var e = t.call(this) || this;
|
|
return e.skinName = new WidgetComboTipsSkin,
|
|
e
|
|
}
|
|
return __extends(e, t),
|
|
e.prototype.createChildren = function() {
|
|
t.prototype.createChildren.call(this)
|
|
},
|
|
e.prototype.showTipsImage = function(t) {
|
|
this.tipsImage.source = RES.getRes("combotips" + t + "_png"),
|
|
egret.Tween.get(this).to({
|
|
scaleX: 1,
|
|
scaleY: 1
|
|
},
|
|
250).wait(300).to({
|
|
scaleX: 3,
|
|
scaleY: 3,
|
|
alpha: 0
|
|
},
|
|
250).call(function() {
|
|
this.scaleX = 0,
|
|
this.scaleY = 0,
|
|
this.alpha = 1
|
|
},
|
|
this)
|
|
},
|
|
e
|
|
} (eui.Component);
|
|
t.WidgetComboTips = e,
|
|
__reflect(e.prototype, "game.WidgetComboTips")
|
|
} (game || (game = {}));
|
|
var game; !
|
|
function(t) {
|
|
var e = function(e) {
|
|
function i() {
|
|
var t = e.call(this) || this;
|
|
return t.needRemove = !0,
|
|
t.life = 1,
|
|
t.skinName = new WidgetXiaoChuSkin,
|
|
t
|
|
}
|
|
return __extends(i, e),
|
|
i.prototype.initMc = function() {
|
|
var t = RES.getRes("zhadan_png"),
|
|
e = RES.getRes("zhadan_json"),
|
|
i = new egret.MovieClipDataFactory(e, t);
|
|
this.hengMcData = i.generateMovieClipData("heng"),
|
|
this.shuMcData = i.generateMovieClipData("shu")
|
|
},
|
|
i.prototype.setLife = function(t) {
|
|
this.life = t
|
|
},
|
|
i.prototype.createChildren = function() {
|
|
e.prototype.createChildren.call(this),
|
|
this.initMc()
|
|
},
|
|
i.prototype.getEffectType = function() {
|
|
return 7 === this.statusType ? "heng": "shu"
|
|
},
|
|
i.prototype.eatRemove = function() {
|
|
return this.needRemove ? (this.parent.addChild(this), void egret.Tween.get(this).to({
|
|
alpha: 0
|
|
},
|
|
100).call(function() {
|
|
this.statusType = null,
|
|
t.UIUtils.removeSelf(this)
|
|
},
|
|
this, [this])) : void(this.needRemove = !0)
|
|
},
|
|
i.prototype.setRowAndCol = function(t, e) {
|
|
this.row = t,
|
|
this.col = e,
|
|
this.endX = this.col * i.SIZE + 6,
|
|
this.endY = this.row * i.SIZE + 6
|
|
},
|
|
i.prototype.startFlyToEnd = function() {
|
|
var t = 0;
|
|
if (this.endY != this.y) {
|
|
var e = 50 * Math.round((this.endY - this.y) / i.SIZE) + 150;
|
|
egret.Tween.get(this).to({
|
|
y: this.endY
|
|
},
|
|
e, egret.Ease.backOut),
|
|
e > t && (t = e)
|
|
}
|
|
if (this.endX != this.x) {
|
|
var e = 50 * Math.round((this.endX - this.x) / i.SIZE) + 150;
|
|
egret.Tween.get(this).to({
|
|
x: this.endX
|
|
},
|
|
e, egret.Ease.backOut),
|
|
e > t && (t = e)
|
|
}
|
|
return t
|
|
},
|
|
i.prototype.hideXiaoChuImage = function() {
|
|
this.xiaochuImage.visible = !1
|
|
},
|
|
i.prototype.showXiaoChuImage = function() {
|
|
this.xiaochuImage.visible = !0,
|
|
this.xiaochuImage.scaleX = 0,
|
|
this.xiaochuImage.scaleY = 0,
|
|
egret.Tween.get(this.xiaochuImage).to({
|
|
scaleX: 1,
|
|
scaleY: 1
|
|
},
|
|
200)
|
|
},
|
|
i.prototype.changeStatusType = function(t) {
|
|
var e;
|
|
e = 7 === t ? new egret.MovieClip(this.hengMcData) : new egret.MovieClip(this.shuMcData),
|
|
e.anchorOffsetX = e.width / 2,
|
|
e.anchorOffsetY = e.height / 2,
|
|
e.x = this.width / 2,
|
|
e.y = this.height / 2,
|
|
8 === t && (e.x -= 8),
|
|
e.play( - 1),
|
|
this.addChild(e),
|
|
this.statusType = t
|
|
},
|
|
i.prototype.changeImage = function(t, e) {
|
|
this.xiaochuImage.source = t,
|
|
this.xiaochuImage.anchorOffsetX = t.textureWidth / 2,
|
|
this.xiaochuImage.anchorOffsetY = t.textureHeight / 2,
|
|
this.xiaochuImage.x = this.xiaochuImage.anchorOffsetX,
|
|
this.xiaochuImage.y = this.xiaochuImage.anchorOffsetY,
|
|
this.statusType = null,
|
|
this.type = e
|
|
},
|
|
i.prototype.playCellSelect = function() {
|
|
egret.Tween.get(this).to({
|
|
scaleX: 1.1,
|
|
scaleY: 1.1
|
|
},
|
|
100).to({
|
|
scaleX: 1,
|
|
scaleY: 1
|
|
},
|
|
100)
|
|
},
|
|
i.SIZE = 92,
|
|
i
|
|
} (eui.Component);
|
|
t.WidgetXiaoChu = e,
|
|
__reflect(e.prototype, "game.WidgetXiaoChu")
|
|
} (game || (game = {}));
|
|
var game; !
|
|
function(t) {
|
|
var e = function(t) {
|
|
function e() {
|
|
var e = t.call(this) || this;
|
|
return e.skinName = new WidgetXiaoChuDBSkin,
|
|
e
|
|
}
|
|
return __extends(e, t),
|
|
e.prototype.createChildren = function() {
|
|
t.prototype.createChildren.call(this)
|
|
},
|
|
e.prototype.changeDb = function(t, e) {
|
|
t % 2 === 0 ? e % 2 !== 0 ? this.dibanImage.source = RES.getRes("game_db1_png") : this.dibanImage.source = RES.getRes("game_db2_png") : t % 2 !== 0 && (e % 2 === 0 ? this.dibanImage.source = RES.getRes("game_db1_png") : this.dibanImage.source = RES.getRes("game_db2_png"))
|
|
},
|
|
e
|
|
} (eui.Component);
|
|
t.WidgetXiaoChuDB = e,
|
|
__reflect(e.prototype, "game.WidgetXiaoChuDB")
|
|
} (game || (game = {}));
|
|
|
|
var ZhuawawaItem = function(t) {
|
|
function e() {
|
|
var e = t.call(this) || this;
|
|
return e.iszhua = !1,
|
|
e.skinName = ZhuaItemSkin,
|
|
e
|
|
}
|
|
return __extends(e, t),
|
|
e.prototype.childrenCreated = function() {
|
|
this.anchorOffsetX = this.width / 2,
|
|
this.anchorOffsetY = this.height
|
|
},
|
|
e.prototype.setType = function(t) {
|
|
this._t = t,
|
|
this.icons.source = "gameRes_json.wawa_" + (t + 1) + "_png",
|
|
this.scoreLabel.text = AsumentParkManager.getInstance().zhuawaArr[t].toString()
|
|
},
|
|
e
|
|
} (eui.Component);
|
|
__reflect(ZhuawawaItem.prototype, "ZhuawawaItem");
|
|
|
|
var ZhuawawaMediator = class ZhuawawaMediator extends BaseMediator {
|
|
constructor() {
|
|
super("ZhuawawaMediator");
|
|
this.GroupName = "zhuawawa";
|
|
}
|
|
listNotificationInterests() {
|
|
return [PanelNotify.OPEN_ZHUAWAWA, PanelNotify.CLOSE_ZHUAWAWA];
|
|
}
|
|
onRegister() {
|
|
super.onRegister && super.onRegister();
|
|
}
|
|
showViewComponent() {
|
|
this.viewComponent = new ZhuawawaPanel();
|
|
GameLayerManager.gameLayer().sceneLayer.addChild(this.viewComponent);
|
|
}
|
|
handleNotification(notification) {
|
|
switch (notification.getName()) {
|
|
case PanelNotify.OPEN_ZHUAWAWA:
|
|
RES.isGroupLoaded(this.GroupName)
|
|
? this.showViewComponent()
|
|
: (LoadingCompoment.getInstance().show(),
|
|
RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this),
|
|
RES.addEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadError, this),
|
|
RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this),
|
|
RES.loadGroup(this.GroupName));
|
|
break;
|
|
case PanelNotify.CLOSE_ZHUAWAWA:
|
|
game.UIUtils.removeSelf(this.viewComponent);
|
|
this.viewComponent = null;
|
|
break;
|
|
}
|
|
}
|
|
onResourceLoadComplete(event) {
|
|
if (event.groupName == this.GroupName) {
|
|
RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
|
|
RES.removeEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadError, this);
|
|
RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
|
|
LoadingCompoment.getInstance().hide();
|
|
this.showViewComponent();
|
|
}
|
|
}
|
|
onResourceLoadError(event) {
|
|
console.warn("Group:" + event.groupName + " has failed to load");
|
|
this.onResourceLoadComplete(event);
|
|
}
|
|
onResourceProgress(event) {
|
|
event.groupName == this.GroupName && LoadingCompoment.getInstance().prossBar.setPross(event.itemsLoaded, event.itemsTotal);
|
|
}
|
|
static NAME = "ZhuawawaMediator";
|
|
};
|
|
__reflect(ZhuawawaMediator.prototype, "ZhuawawaMediator");
|
|
|
|
|
|
var ZhuawawaPanel = function(t) {
|
|
function e() {
|
|
var e = t.call(this) || this;
|
|
return e.gArr = [],
|
|
e.gArrd = [],
|
|
e.gou_SPEED = 10,
|
|
e.per = 4,
|
|
e.state = 0,
|
|
e.isfirstJia = !1,
|
|
e.iszhua = !1,
|
|
e.isSuc = !1,
|
|
e.isEnd = !1,
|
|
e.times = 180,
|
|
e.score = 0,
|
|
e.skinName = ZhuawawaPanelSkin,
|
|
e.addEventListener(egret.Event.ADDED_TO_STAGE, e.onAdd, e),
|
|
e.addEventListener(egret.Event.REMOVED_FROM_STAGE, e.onRemove, e),
|
|
e
|
|
}
|
|
return __extends(e, t),
|
|
e.prototype.childrenCreated = function() {
|
|
t.prototype.childrenCreated.call(this),
|
|
this.jiaziMC = game.MCUtils1.getMc("jiazi"),
|
|
this.addChild(this.jiaziMC),
|
|
this.initJiazi(),
|
|
this.state = 2,
|
|
this.timeLabel.text = "倒计时:" + this.times + "s",
|
|
this.scoreLabel.text = "分数:" + this.score.toString(),
|
|
this.scaleY = GameConfig.curHeight() / Const.DESGIN_H
|
|
},
|
|
e.prototype.onAdd = function(t) {
|
|
core.TimerManager.instance.addTick(2e3, -1, this.onCreateItem, this),
|
|
core.TimerManager.instance.addTick(33, -1, this.update, this),
|
|
core.TimerManager.instance.addTick(1e3, 180, this.onTimer, this),
|
|
game.UIUtils.addButtonScaleEffects(this),
|
|
this.startButton.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onStart, this),
|
|
this.backButton.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onBack, this)
|
|
},
|
|
e.prototype.onRemove = function(t) {
|
|
this.removeEventListener(egret.Event.ADDED_TO_STAGE, this.onAdd, this),
|
|
this.removeEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemove, this),
|
|
core.TimerManager.instance.removeTick(this.onCreateItem, this),
|
|
core.TimerManager.instance.removeTick(this.update, this),
|
|
core.TimerManager.instance.removeTick(this.onTimer, this),
|
|
game.UIUtils.removeButtonScaleEffects(this),
|
|
this.startButton.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onStart, this),
|
|
this.backButton.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onBack, this)
|
|
},
|
|
e.prototype.onBack = function(t) {
|
|
game.AppFacade.instance.sendNotification(PanelNotify.CLOSE_ZHUAWAWA)
|
|
},
|
|
e.prototype.initJiazi = function() {
|
|
this.jiaziMC.gotoAndStop("Sprite"),
|
|
this.jiaziMC.x = GameConfig.curWidth() / 2,
|
|
this.jiaziMC.y = 180,
|
|
this.ganImg.y = -820
|
|
},
|
|
e.prototype.onStart = function(t) {
|
|
2 == this.state ? this.startJia() : TipsUtils.showTipsDownToUp("请下一次再抓")
|
|
},
|
|
e.prototype.startJia = function() {
|
|
this.state = 1,
|
|
this.isfirstJia = !1,
|
|
this.iszhua = !1,
|
|
this.isSuc = !1
|
|
},
|
|
e.prototype.updataJia = function() {
|
|
if (1 == this.state && (this.ganImg.y += this.gou_SPEED, this.jiaziMC.y += this.gou_SPEED, this.jiaziMC.y > 424 && 0 == this.isfirstJia && (this.isfirstJia = !0, this.jiaziMC.gotoAndPlay("Sprite", 1)), this.jiaziMC.y > 574 && 0 == this.iszhua && (this.state = 0, this.iszhua = !0, this.item = this.getInrectItem(), this.jiaziMC.gotoAndStop("Sprite"), this.item && (this.item.iszhua = !0), this.state = -1)), -1 == this.state) if (this.jiaziMC.y > 180) {
|
|
if (this.ganImg.y -= this.gou_SPEED, this.jiaziMC.y -= this.gou_SPEED, this.jiaziMC.y >= 221 && this.jiaziMC.y <= 230 && this.item) {
|
|
var t = game.Utils.rang(1, 10);
|
|
if (t <= this.per) this.isSuc = !0;
|
|
else {
|
|
this.isSuc = !1;
|
|
var e = this.item;
|
|
this.item = null;
|
|
var i = this;
|
|
egret.Tween.get(e).to({
|
|
y: 500,
|
|
alpha: 0
|
|
},
|
|
600).call(function() {
|
|
i.gs.removeChild(e)
|
|
},
|
|
this)
|
|
}
|
|
}
|
|
} else {
|
|
if (this.isSuc) {
|
|
var n = AsumentParkManager.getInstance().zhuawaArr[this.item._t];
|
|
this.score += n,
|
|
BloodTips.getInstance().createTips(GameConfig.curWidth() / 2, GameConfig.curHeight() / 2, n + "", 0, 1e3, "vipzi_fnt"),
|
|
egret.Tween.get(this.item).to({
|
|
alpha: 0
|
|
},
|
|
200),
|
|
this.scoreLabel.text = "分数:" + this.score.toString()
|
|
}
|
|
this.initJiazi(),
|
|
this.state = 2
|
|
}
|
|
},
|
|
e.prototype.update = function(t) { (1 == this.state || -1 == this.state) && this.updataJia(),
|
|
this.img1.x += 5,
|
|
this.img2.x += 5,
|
|
this.img1.x >= GameConfig.curWidth() && (this.img1.x = -this.img1.width),
|
|
this.img2.x >= GameConfig.curWidth() && (this.img2.x = -this.img2.width),
|
|
this.img3.x -= 5,
|
|
this.img4.x -= 5,
|
|
this.img3.x <= 0 && (this.img3.x = 2 * this.img3.width),
|
|
this.img4.x <= 0 && (this.img4.x = 2 * this.img4.width);
|
|
for (var e = 0; e < this.gArr.length; e++) {
|
|
var i = this.gArr.pop();
|
|
i.x < GameConfig.curWidth() + 100 ? 0 == i.iszhua && (this.gArr.unshift(i), i.x += 5) : this.gs.removeChild(i)
|
|
}
|
|
for (var e = 0; e < this.gArrd.length; e++) {
|
|
var i = this.gArrd.pop();
|
|
i.x > -100 ? (this.gArrd.unshift(i), i.x -= 5) : this.gsd.removeChild(i)
|
|
}
|
|
this.item && (this.item.y = this.jiaziMC.y + this.item.height)
|
|
},
|
|
e.prototype.createItem = function() {
|
|
var t = new ZhuawawaItem;
|
|
return this.gs.addChild(t),
|
|
t.setType(game.Utils.rang(0, 4)),
|
|
this.gArr.push(t),
|
|
t.y = 794,
|
|
t.x = -300,
|
|
t
|
|
},
|
|
e.prototype.createItemd = function() {
|
|
var t = new ZhuawawaItem;
|
|
return this.gsd.addChild(t),
|
|
t.setType(game.Utils.rang(0, 4)),
|
|
t.scaleX = .9,
|
|
t.scaleY = .9,
|
|
this.gArrd.push(t),
|
|
t.y = 674,
|
|
t.x = GameConfig.curWidth() + 100,
|
|
t
|
|
},
|
|
e.prototype.onCreateItem = function() {
|
|
this.createItem(),
|
|
this.createItemd()
|
|
},
|
|
e.prototype.getInrectItem = function() {
|
|
for (var t = 0; t < this.gArr.length; t++) {
|
|
var e = Math.abs(this.gArr[t].x - GameConfig.curWidth() / 2);
|
|
if (30 > e) return this.gArr[t]
|
|
}
|
|
},
|
|
e.prototype.onTimer = function() {
|
|
this.times > 0 && (this.times -= 1),
|
|
0 == this.times && (core.TimerManager.instance.removeTick(this.onCreateItem, this), core.TimerManager.instance.removeTick(this.update, this), core.TimerManager.instance.removeTick(this.onTimer, this), AsumentParkManager.getInstance().scroe = this.score, AsumentParkManager.getInstance().sendNetEndtGame()),
|
|
this.timeLabel.text = "倒计时:" + this.times + "s"
|
|
},
|
|
e
|
|
} (eui.Component);
|
|
__reflect(ZhuawawaPanel.prototype, "ZhuawawaPanel");
|
|
var GameState; !
|
|
function(t) {
|
|
t[t.READY = 0] = "READY",
|
|
t[t.PLAYING = 1] = "PLAYING",
|
|
t[t.PAUSE = 2] = "PAUSE",
|
|
t[t.OVER = 3] = "OVER"
|
|
} (GameState || (GameState = {}));
|
|
var Util = function() {
|
|
function t() {}
|
|
return t.rang = function(t, e) {
|
|
return Math.round(Math.random() * (e - t) + t)
|
|
},
|
|
t.isRang = function(t, e, i) {
|
|
return t >= e && i >= t
|
|
},
|
|
t.limit = function(t, e, i) {
|
|
return Math.max(e, Math.min(i, t))
|
|
},
|
|
t.ang2rad = function(t) {
|
|
return t / 180 * Math.PI
|
|
},
|
|
t.rad2ang = function(t) {
|
|
return t / Math.PI * 180
|
|
},
|
|
t.getBigNumberShow = function(t) {
|
|
return 1e4 > t ? t + "": (t /= 1e3, t.toFixed(1) + "K")
|
|
},
|
|
t.getBigTimeShow = function(t) {
|
|
var e = Math.round(t / 1e3);
|
|
if (e > 3600) {
|
|
var i = parseInt(e / 3600 + "");
|
|
e %= 3600;
|
|
var n = Math.round(e / 60);
|
|
return i + "H" + n + "M"
|
|
}
|
|
if (e > 60) {
|
|
var n = parseInt(e / 60 + "");
|
|
return e %= 60,
|
|
n + "M" + e + "S"
|
|
}
|
|
return e + "S"
|
|
},
|
|
t.isElinArr = function(t, e) {
|
|
return e.indexOf(t) > -1
|
|
},
|
|
t.isArrCrossing = function(e, i) {
|
|
for (var n = 0; n < e.length; n++) if (t.isElinArr(e[n], i)) return ! 0;
|
|
return ! 1
|
|
},
|
|
t.getURLQueryString = function(t) {
|
|
if (egret.Capabilities.runtimeType == egret.RuntimeType.WEB) {
|
|
var e, i = decodeURIComponent(window.location.href);
|
|
return i.indexOf("#?") > 0 ? (i = i.replace("#?", "&"), e = i.match(new RegExp("(^|&)" + t + "=([^&]*)(&|$)"))) : e = window.location.search.substr(1).match(new RegExp("(^|&)" + t + "=([^&]*)(&|$)")),
|
|
e ? e[2] : null
|
|
}
|
|
},
|
|
t
|
|
} ();
|
|
__reflect(Util.prototype, "Util");
|
|
|
|
var ZumaMediator = class ZumaMediator extends BaseMediator {
|
|
constructor() {
|
|
super("ZumaMediator");
|
|
this.GroupName = "zuma";
|
|
}
|
|
listNotificationInterests() {
|
|
return [PanelNotify.OPEN_ZUMA, PanelNotify.CLOSE_ZUMA];
|
|
}
|
|
onRegister() {
|
|
super.onRegister && super.onRegister();
|
|
}
|
|
showViewComponent(layer) {
|
|
if (layer === void 0) layer = 7;
|
|
this.viewComponent = new ZumaPanel();
|
|
this.showUI(this.viewComponent, true, 0, 0, layer);
|
|
}
|
|
handleNotification(notification) {
|
|
switch (notification.getName()) {
|
|
case PanelNotify.OPEN_ZUMA:
|
|
RES.isGroupLoaded(this.GroupName)
|
|
? this.showViewComponent()
|
|
: (LoadingCompoment.getInstance().show(),
|
|
RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this),
|
|
RES.addEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadError, this),
|
|
RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this),
|
|
RES.loadGroup(this.GroupName));
|
|
break;
|
|
case PanelNotify.CLOSE_ZUMA:
|
|
this.closeViewComponent();
|
|
this.viewComponent = null;
|
|
break;
|
|
}
|
|
}
|
|
onResourceLoadComplete(event) {
|
|
if (event.groupName == this.GroupName) {
|
|
RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
|
|
RES.removeEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadError, this);
|
|
RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
|
|
LoadingCompoment.getInstance().hide();
|
|
this.showViewComponent();
|
|
}
|
|
}
|
|
onResourceLoadError(event) {
|
|
console.warn("Group:" + event.groupName + " has failed to load");
|
|
this.onResourceLoadComplete(event);
|
|
}
|
|
onResourceProgress(event) {
|
|
event.groupName == this.GroupName && LoadingCompoment.getInstance().prossBar.setPross(event.itemsLoaded, event.itemsTotal);
|
|
}
|
|
static NAME = "ZumaMediator";
|
|
};
|
|
__reflect(ZumaMediator.prototype, "ZumaMediator");
|
|
|
|
|
|
var ZumaPanel = function(t) {
|
|
function e() {
|
|
var e = t.call(this) || this;
|
|
return e.pathPos = [],
|
|
e.allBall = [],
|
|
e.isGameStart = !1,
|
|
e.needRollbackNum = 0,
|
|
e.makeBallCount = 0,
|
|
e.validBulletCount = 0,
|
|
e.gameTime = 120,
|
|
e.frozenTime = 0,
|
|
e.comboCount = 0,
|
|
e.ballTypeQueue = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],
|
|
e.lastCreateBallType = 1,
|
|
e.lastCreateBallTypeCount = 1,
|
|
e.updateIndex = 0,
|
|
e.toNextCount = 0,
|
|
e.$checkBugIndex = 0,
|
|
e.gameTime = Consts.TOTAL_TIME,
|
|
e.skinName = MainSceneSkin1,
|
|
GameManager.instance.state = GameState.PLAYING,
|
|
GameManager.instance.score = 0,
|
|
e
|
|
}
|
|
return __extends(e, t),
|
|
e.prototype.createChildren = function() {
|
|
t.prototype.createChildren.call(this),
|
|
this.timeProGroup.mask = this.maskSp,
|
|
this.initPath(),
|
|
this.makeBall(),
|
|
this.makeBulletBall()
|
|
},
|
|
e.prototype.onAdded = function() {
|
|
t.prototype.onAdded.call(this),
|
|
manager.UpdateTickerManager.instance.add(this),
|
|
this.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.onTouchMoved, this)
|
|
},
|
|
e.prototype.onRemoved = function() {
|
|
t.prototype.onRemoved.call(this),
|
|
manager.UpdateTickerManager.instance.remove(this)
|
|
},
|
|
e.prototype.makeBall = function(t) {
|
|
void 0 === t && (t = 0);
|
|
var e = 1;
|
|
if (this.ballTypeQueue.length > 0) e = this.ballTypeQueue.shift();
|
|
else {
|
|
var i = 1 - .4 * this.lastCreateBallTypeCount;
|
|
if (Math.random() < i) e = this.lastCreateBallType;
|
|
else for (e = Util.rang(1, 5); e == this.lastCreateBallType;) e = Util.rang(1, 5)
|
|
}
|
|
if (e > 0) {
|
|
var n = new Ball(this.pathPos, e);
|
|
this.gameContainer.addChild(n),
|
|
this.allBall.push(n),
|
|
n.toNext(t)
|
|
} else this.allBall.push(null);
|
|
e == this.lastCreateBallType ? this.lastCreateBallTypeCount++:this.lastCreateBallTypeCount = 1,
|
|
this.lastCreateBallType = e,
|
|
this.makeBallCount++,
|
|
this.makeBallCount == Consts.MIN_SHOW_BALL_NUM && (this.isGameStart = !0)
|
|
},
|
|
e.prototype.makeBulletBall = function() {
|
|
var t = Util.rang(1, 5);
|
|
this.validBulletCount >= 12 && (t = Math.random() < .3 ? BallType.FIRE: BallType.ICE, this.validBulletCount = 0);
|
|
var e = new Ball(this.pathPos, t, !1);
|
|
this.centerContainer.addChild(e),
|
|
this.homeBullet = e,
|
|
(t == BallType.ICE || t == BallType.FIRE) && (egret.Tween.removeTweens(e), e.scaleX = e.scaleY = 1, egret.Tween.get(e, {
|
|
loop: !0
|
|
}).to({
|
|
scaleX: 1.2,
|
|
scaleY: 1.2
|
|
},
|
|
250).to({
|
|
scaleX: 1,
|
|
scaleY: 1
|
|
},
|
|
250))
|
|
},
|
|
e.prototype.updateAllBallPostion = function() {
|
|
for (var t = 0; t < this.allBall.length; t++) this.allBall[t] && this.allBall[t].update()
|
|
},
|
|
e.prototype.updateTimeShow = function() {
|
|
var t = this.gameTime / Consts.TOTAL_TIME;
|
|
this.proBar.x = 104 - 458 * (1 - t)
|
|
},
|
|
e.prototype.gameOver = function() {
|
|
var t = this;
|
|
GameManager.instance.state == GameState.PLAYING && (GameManager.instance.state = GameState.OVER, this.bullet && egret.Tween.get(this.bullet).to({
|
|
scaleX: 0,
|
|
scaleY: 0
|
|
},
|
|
250).call(function() {
|
|
game.UIUtils.removeSelf(t.bullet),
|
|
t.bullet = null
|
|
},
|
|
this), manager.UpdateTickerManager.instance.remove(this), AsumentParkManager.getInstance().scroe = GameManager.instance.score, AsumentParkManager.getInstance().sendNetEndtGame())
|
|
},
|
|
e.prototype.update = function(t) {
|
|
if (GameManager.instance.state == GameState.PLAYING) {
|
|
if (t /= 1e3, this.gameTime -= t, this.gameTime <= 0) return this.gameTime = 0,
|
|
this.updateTimeShow(),
|
|
void this.gameOver();
|
|
if (this.updateTimeShow(), this.updateAllBallPostion(), this.bullet && (this.bullet.bulletUpdate(t), this.checkBulletBounds(), this.bullet && this.checkBulletCollision()), this.frozenTime > 0) return this.frozenTime -= t,
|
|
void(this.frozenTime < 0 && (this.bullet ? this.frozenTime = .01 : this.rollbackAllNullBalls()));
|
|
if (this.needRollbackNum > 0 && this.needRollbackBallArr && this.needRollbackBallArr.length) return this.needRollbackNum--,
|
|
this.rollbackBalls(),
|
|
void this.checkBallRollbackOver();
|
|
this.updateIndex++;
|
|
var e = 2 + Math.round(this.gameTime / Consts.TOTAL_TIME * 2);
|
|
e > 1 && this.allBall.length < Consts.MIN_SHOW_BALL_NUM && (e = 1);
|
|
var i = 2;
|
|
if (this.makeBallCount < Consts.MIN_SHOW_BALL_NUM) {
|
|
e = 0;
|
|
var n = Consts.BALL_CELL_NUM / 2;
|
|
i = Util.limit(Math.round(n - this.makeBallCount / n), 2, n)
|
|
}
|
|
if (this.updateIndex >= e) {
|
|
this.updateIndex = 0;
|
|
for (var a = 0; a < this.allBall.length; a++) {
|
|
var o = this.allBall[a];
|
|
o && (o.toNext(i), o.isPathEnd && this.gameOver())
|
|
}
|
|
this.toNextCount += i,
|
|
this.toNextCount >= Consts.BALL_CELL_NUM && (this.toNextCount -= Consts.BALL_CELL_NUM, this.makeBall(this.toNextCount))
|
|
}
|
|
this.checkShowNullBug(),
|
|
t > .05 && this.update(0)
|
|
}
|
|
},
|
|
e.prototype.checkShowNullBug = function() {
|
|
if (this.isGameStart && !(this.frozenTime > 0 || (this.removeStartNullBall(), this.$checkBugIndex++, this.$checkBugIndex % 10 != 0 || this.checkHasNullBall()))) for (var t = this.allBall.length - 1; t > 0; t--) {
|
|
var e = this.allBall[t],
|
|
i = this.allBall[t - 1],
|
|
n = i.index - e.index - Consts.BALL_CELL_NUM;
|
|
0 != n && i.toNext(n)
|
|
}
|
|
},
|
|
e.prototype.rollbackAllNullBalls = function() {
|
|
for (var t = 0,
|
|
e = 0,
|
|
i = this.allBall.length - 1; i >= 0; i--) {
|
|
var n = this.allBall[i];
|
|
if (n && t > 0) {
|
|
e = i + 1;
|
|
break
|
|
}
|
|
n || t++
|
|
}
|
|
if (t > 0) {
|
|
this.setRollbackData(e, t),
|
|
this.needRollbackBallArr = [];
|
|
for (var i = 0; e > i; i++) this.needRollbackBallArr.push(this.allBall[i]);
|
|
0 == this.needRollbackBallArr.length && (this.needRollbackBallArr = null)
|
|
}
|
|
},
|
|
e.prototype.checkBallRollbackOver = function() {
|
|
if (this.needRollbackNum <= 0) {
|
|
if (this.needRollbackBallArr.length <= 0) return;
|
|
var t = this.needRollbackBallArr[this.needRollbackBallArr.length - 1],
|
|
e = this.allBall.indexOf(t);
|
|
this.needRollbackBallArr = null,
|
|
this.checkBulletCanRemove(e, !0) || this.rollbackAllNullBalls()
|
|
}
|
|
},
|
|
e.prototype.rollbackBalls = function() {
|
|
for (var t = 0; t < this.needRollbackBallArr.length; t++) {
|
|
var e = this.needRollbackBallArr[t];
|
|
e && e.toNext( - Consts.BALL_CELL_NUM / 3)
|
|
}
|
|
},
|
|
e.prototype.checkBulletBounds = function() { (this.bullet.x < 0 || this.bullet.x > Const.WIN_W || this.bullet.y < 0 || this.bullet.y > Const.WIN_H) && (game.UIUtils.removeSelf(this.bullet), this.bullet = null, this.comboCount = 0)
|
|
},
|
|
e.prototype.destroyIceAndFire = function() {
|
|
var t = this;
|
|
egret.Tween.get(this.bullet).to({
|
|
scaleX: 10,
|
|
scaleY: 10,
|
|
alpha: 0
|
|
},
|
|
250).call(function() {
|
|
game.UIUtils.removeSelf(t.bullet),
|
|
t.bullet = null
|
|
})
|
|
},
|
|
e.prototype.checkBulletCollision = function() {
|
|
var t = Consts.BALL_SIZE * Consts.BALL_SIZE;
|
|
this.isMatch3Mode = !1;
|
|
for (var e = 0; e < this.allBall.length; e++) {
|
|
var i = this.allBall[e];
|
|
if (i) {
|
|
var n = this.bullet.x - i.x,
|
|
a = this.bullet.y - i.y;
|
|
if (Math.abs(n) < Consts.BALL_SIZE || Math.abs(a) < Consts.BALL_SIZE) {
|
|
var o = n * n + a * a;
|
|
if (t >= o) {
|
|
if (this.bullet.type == BallType.ICE || this.bullet.type == BallType.FIRE) this.bullet.type == BallType.ICE ? this.frozenTime = Consts.FROZEN_TIME: (this.removeAllBallsByType(i.type), egret.setTimeout(this.rollbackAllNullBalls, this, 400)),
|
|
this.destroyIceAndFire();
|
|
else {
|
|
this.isMatch3Mode = !0;
|
|
var s = 0,
|
|
r = -1;
|
|
90 > s ? (this.bullet.moveToPathIndex(i.index + Consts.BALL_CELL_NUM), r = e) : (this.bullet.moveToPathIndex(i.index), r = e + 1),
|
|
this.allBall.splice(r, 0, this.bullet),
|
|
this.moveFrontBall(r),
|
|
this.checkBulletCanRemove(r)
|
|
}
|
|
return void(this.bullet = null)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
e.prototype.removeAllBallsByType = function(t) {
|
|
for (var e = 0; e < this.allBall.length; e++) {
|
|
var i = this.allBall[e];
|
|
i && i.type == t && (this.removeOneBall(i), this.allBall[e] = null)
|
|
}
|
|
},
|
|
e.prototype.removeOneBall = function(t) {
|
|
egret.Tween.get(t).to({
|
|
scaleX: 0,
|
|
scaleY: 0
|
|
},
|
|
250).call(game.UIUtils.removeSelf, this, [t]);
|
|
var e = RES.getRes("ball_effect_png"),
|
|
i = RES.getRes("ball_effect_json"),
|
|
n = new egret.MovieClipDataFactory(i, e),
|
|
a = new egret.MovieClip(n.generateMovieClipData());
|
|
this.addChild(a),
|
|
a.x = t.x,
|
|
a.y = t.y,
|
|
a.play(1),
|
|
a.once(egret.Event.COMPLETE,
|
|
function() {
|
|
game.UIUtils.removeSelf(a)
|
|
},
|
|
this)
|
|
},
|
|
e.prototype.checkBulletCanRemove = function(t, e) {
|
|
void 0 === e && (e = !1);
|
|
var i = this.allBall[t];
|
|
if (!i) return ! 1;
|
|
for (var n = [i], a = t, o = t, s = t - 1; s >= 0;) {
|
|
var r = this.allBall[s];
|
|
if (!r || r.type != i.type) break;
|
|
n.unshift(r),
|
|
a--,
|
|
s--
|
|
}
|
|
for (var h = !1,
|
|
s = t + 1; s < this.allBall.length;) {
|
|
var r = this.allBall[s];
|
|
if (!r || r.type != i.type) break;
|
|
n.push(r),
|
|
o++,
|
|
s++,
|
|
h = !0
|
|
}
|
|
var l = !1;
|
|
return l = n.length >= 3 ? e ? h: !0 : !1,
|
|
l && (this.destroyCanRemoveBall(a, o), this.destroyAfterRollbackBall(a - 1, o + 1, n.length), this.isMatch3Mode && (this.isMatch3Mode = !1, this.validBulletCount++), this.comboCount++, this.updateScore(n.length)),
|
|
l
|
|
},
|
|
e.prototype.updateScore = function(t) {
|
|
var e = 2 + 1 * (t - 3),
|
|
i = t * e,
|
|
n = i * this.comboCount;
|
|
GameManager.instance.score += n,
|
|
this.scoreTF.text = "" + GameManager.instance.score,
|
|
this.comboCount > 1 && Combo.show(this.comboCount)
|
|
},
|
|
e.prototype.destroyAfterRollbackBall = function(t, e, i) {
|
|
this.frozenTime > 0 || (t >= 0 ? this.rollbackAllNullBalls() : this.allBall.splice(t + 1, i))
|
|
},
|
|
e.prototype.setRollbackData = function(t, e) {
|
|
this.needRollbackNum = 3 * e,
|
|
this.allBall.splice(t, e)
|
|
},
|
|
e.prototype.findLeftNotNullBall = function(t) {
|
|
for (var e = [], i = t; i >= 0;) {
|
|
var n = this.allBall[i];
|
|
e.unshift(n),
|
|
i--
|
|
}
|
|
return e
|
|
},
|
|
e.prototype.destroyCanRemoveBall = function(t, e) {
|
|
for (var i = t; e >= i; i++) {
|
|
var n = this.allBall[i];
|
|
this.allBall[i] = null,
|
|
this.removeOneBall(n)
|
|
}
|
|
},
|
|
e.prototype.moveFrontBall = function(t) {
|
|
for (var e = t - 1; e >= 0; e--) {
|
|
var i = this.allBall[e];
|
|
if (!i) return void this.allBall.splice(e, 1);
|
|
i.toNext(Consts.BALL_CELL_NUM)
|
|
}
|
|
},
|
|
e.prototype.initPath = function() {
|
|
for (var t = [607, 759, 564, 815, 537, 840, 507, 863, 478, 881, 445, 900, 415, 907, 395, 913, 374, 918, 349, 918, 329, 915, 310, 913, 291, 908, 264, 899, 233, 882, 213, 870, 188, 851, 167, 835, 151, 813, 137, 793, 119, 767, 100, 735, 86, 695, 71, 650, 63, 615, 60, 584, 61, 540, 65, 505, 73, 466, 83, 429, 96, 385, 117, 351, 137, 321, 157, 298, 178, 274, 212, 247, 244, 230, 278, 221, 312, 212, 355, 212, 387, 214, 416, 225, 441, 237, 468, 253, 496, 272, 517, 295, 534, 321, 553, 350, 567, 392, 576, 425, 581, 457, 584, 488, 584, 523, 581, 552, 577, 585, 568, 631, 554, 676, 535, 711, 518, 738, 489, 762, 452, 785, 408, 804, 365, 812, 324, 804, 282, 788, 249, 766, 215, 736, 195, 708, 177, 676, 167, 645, 158, 605, 151, 549, 154, 508, 164, 445, 181, 413, 197, 383, 226, 359, 247, 336, 292, 321, 336, 319, 377, 319, 411, 334, 439, 361, 458, 381, 476, 419, 493, 467, 497, 512, 499, 565, 486, 608, 465, 648, 441, 674, 416, 688, 384, 701, 343, 702, 299, 688, 275, 663, 245, 627, 232, 584, 230, 537, 244, 487, 262, 453, 291, 430, 314, 412, 333, 404], e = 0; e < t.length - 4; e += 2) {
|
|
var i = t[e],
|
|
n = t[e + 1],
|
|
a = t[e + 2],
|
|
o = t[e + 3],
|
|
s = a - i,
|
|
r = o - n,
|
|
h = Math.sqrt(s * s + r * r),
|
|
l = Math.round(h / Consts.BALL_EVERY_CUT),
|
|
c = s / l,
|
|
p = r / l;
|
|
this.fillLineDot(i, n, l, c, p)
|
|
}
|
|
},
|
|
e.prototype.fillLineDot = function(t, e, i, n, a) {
|
|
for (var o = Const.WIN_H - Const.DESGIN_H,
|
|
s = 0; i > s; s++) {
|
|
var r = t + s * n,
|
|
h = e + s * a + o;
|
|
this.pathPos.push(new egret.Point(r, h))
|
|
}
|
|
},
|
|
e.prototype.onTouchTap = function(t) {
|
|
t.target;
|
|
if (this.isGameStart && !this.bullet && !this.checkHasNullBall() && !this.needRollbackBallArr) {
|
|
this.comboCount = 0;
|
|
var e = new egret.Point(t.stageX - this.centerContainer.x, t.stageY - this.centerContainer.y),
|
|
i = Util.rad2ang(Math.atan2(e.y, e.x));
|
|
this.centerContainer.rotation = i - 90;
|
|
var n = this.homeBullet.localToGlobal(Consts.BALL_SIZE / 2);
|
|
egret.Tween.removeTweens(this.homeBullet),
|
|
this.bullet = this.homeBullet,
|
|
this.bullet.x = n.x,
|
|
this.bullet.y = n.y,
|
|
this.gameContainer.addChild(this.bullet),
|
|
this.bullet.setSpeed(e),
|
|
this.makeBulletBall()
|
|
}
|
|
},
|
|
e.prototype.onTouchMoved = function(t) {
|
|
if (this.isGameStart) {
|
|
var e = new egret.Point(t.stageX - this.centerContainer.x, t.stageY - this.centerContainer.y),
|
|
i = Util.rad2ang(Math.atan2(e.y, e.x));
|
|
this.centerContainer.rotation = i - 90
|
|
}
|
|
},
|
|
e.prototype.checkHasNullBall = function() {
|
|
if (this.frozenTime <= 0) for (var t = 0; t < this.allBall.length; t++) if (!this.allBall[t]) return ! 0;
|
|
return ! 1
|
|
},
|
|
e.prototype.removeStartNullBall = function() {
|
|
for (; ! this.allBall[0] && this.allBall.length > 0;) this.allBall.splice(0, 1)
|
|
},
|
|
e
|
|
} (SceneBase);
|
|
__reflect(ZumaPanel.prototype, "ZumaPanel", ["IUpdate"]);
|
|
var Consts = function() {
|
|
function t() {}
|
|
return t.WIN_W = 640,
|
|
t.WIN_H = 960,
|
|
t.DESGIN_W = 640,
|
|
t.DESGIN_H = 960,
|
|
t.BALL_SIZE = 69,
|
|
t.BALL_EVERY_CUT = 5.75,
|
|
t.BALL_CELL_NUM = Math.round(t.BALL_SIZE / t.BALL_EVERY_CUT),
|
|
t.BULLET_SPEED = 1e3,
|
|
t.MIN_SHOW_BALL_NUM = 20,
|
|
t.FROZEN_TIME = 4,
|
|
t.TOTAL_TIME = 120,
|
|
t.CARE_URL = "http://mp.weixin.qq.com/s?__biz=MzA4NzQyNzQwMw==&mid=402641000&idx=1&sn=b22935e7e5ad77ed85e60bb3ee249f26&scene=1&srcid=02019ogTeECxzGexTnDQ1tD6&from=singlemessage&isappinstalled=0#wechat_redirect",
|
|
t.REWARD_LIST_URL = "http://www.huhugame.com/index.php?m=api&c=sqapi&a=paihang",
|
|
t.IS_ACTIVE_OVER = !1,
|
|
t.IS_REWARD_OPEN = !0,
|
|
t.ACTIVE_OVER_TIP_STR = "活动已经结束,请查看中奖信息。",
|
|
t.CONFIG_DATA_NAME = "zuma.db",
|
|
t.VERTIFY_KEY = "zuma.1024",
|
|
t.VERSION = "v.103",
|
|
t
|
|
} ();
|
|
__reflect(Consts.prototype, "Consts");
|
|
var GameEditorScene = function(t) {
|
|
function e() {
|
|
var e = t.call(this) || this;
|
|
return e.allPos = [],
|
|
e.skinName = new GameEditorSceneSkin,
|
|
e
|
|
}
|
|
return __extends(e, t),
|
|
e.prototype.createChildren = function() {
|
|
t.prototype.createChildren.call(this);
|
|
var e = new egret.Shape;
|
|
this.g = e.graphics,
|
|
this.gameContainer.addChild(e),
|
|
this.g.lineStyle(2, 16711680)
|
|
},
|
|
e.prototype.onTouchTap = function(t) {
|
|
var e = t.target;
|
|
if (e == this.outBtn) for (var i = "",
|
|
n = 0; n < this.allPos.length; n++) i += this.allPos[n].x + "," + this.allPos[n].y + ",";
|
|
else if (e == this.clearBtn) this.allPos = [],
|
|
this.g.clear();
|
|
else {
|
|
var a = t.stageX,
|
|
o = t.stageY;
|
|
this.allPos.push(new egret.Point(a, o)),
|
|
this.g.lineTo(a, o)
|
|
}
|
|
},
|
|
e
|
|
} (SceneBase);
|
|
__reflect(GameEditorScene.prototype, "GameEditorScene");
|
|
var GameManager = function() {
|
|
function t() {
|
|
this._isSound = !0,
|
|
this._isEff = !0,
|
|
this.hasPlayCG = !1,
|
|
this.isGuided = !1
|
|
}
|
|
return Object.defineProperty(t, "instance", {
|
|
get: function() {
|
|
return t._instance || (t._instance = new t),
|
|
t._instance
|
|
},
|
|
enumerable: !0,
|
|
configurable: !0
|
|
}),
|
|
t.prototype.init = function() {},
|
|
Object.defineProperty(t.prototype, "isSound", {
|
|
get: function() {
|
|
return this._isSound
|
|
},
|
|
enumerable: !0,
|
|
configurable: !0
|
|
}),
|
|
Object.defineProperty(t.prototype, "isEff", {
|
|
get: function() {
|
|
return this._isEff
|
|
},
|
|
set: function(t) {
|
|
this._isEff = t
|
|
},
|
|
enumerable: !0,
|
|
configurable: !0
|
|
}),
|
|
t.prototype.useInitFullData = function() {
|
|
this._score = 0,
|
|
this.isGuided = !1,
|
|
this.winLevelInfo = []
|
|
},
|
|
Object.defineProperty(t.prototype, "state", {
|
|
get: function() {
|
|
return this._state
|
|
},
|
|
set: function(t) {
|
|
this.state != t && (this.lastState = this.state, this._state = t)
|
|
},
|
|
enumerable: !0,
|
|
configurable: !0
|
|
}),
|
|
Object.defineProperty(t.prototype, "score", {
|
|
get: function() {
|
|
return this._score
|
|
},
|
|
set: function(t) {
|
|
this._score = t
|
|
},
|
|
enumerable: !0,
|
|
configurable: !0
|
|
}),
|
|
t.prototype.updateWinLevelStar = function(t, e) {
|
|
this.winLevelInfo[t - 1] = e
|
|
},
|
|
t.prototype.getStar = function(t) {
|
|
return this.winLevelInfo.length < t ? -1 : this.winLevelInfo[t - 1]
|
|
},
|
|
Object.defineProperty(t.prototype, "winLevelCount", {
|
|
get: function() {
|
|
return this.winLevelInfo.length
|
|
},
|
|
enumerable: !0,
|
|
configurable: !0
|
|
}),
|
|
Object.defineProperty(t.prototype, "starCount", {
|
|
get: function() {
|
|
for (var t = 0,
|
|
e = 0; e < this.winLevelInfo.length; e++) t += this.winLevelInfo[e];
|
|
return t
|
|
},
|
|
enumerable: !0,
|
|
configurable: !0
|
|
}),
|
|
t
|
|
} ();
|
|
__reflect(GameManager.prototype, "GameManager");
|
|
var game; !
|
|
function(t) {
|
|
var e = function() {
|
|
function t() {}
|
|
return t.to_command_id1 = "1",
|
|
t[0] = PanelNotify.OPEN_FRIEND_GIVE_LIST,
|
|
t[3] = ClientNotify.SHOW_CONFIRM_ALERT,
|
|
t[4] = ClientNotify.GIVE_SUCCESS,
|
|
t[6] = SysNotify.SHOW_MESSAGE,
|
|
t
|
|
} ();
|
|
t.SocketCommand = e,
|
|
__reflect(e.prototype, "game.SocketCommand")
|
|
} (game || (game = {}));
|
|
var Ball = function(t) {
|
|
function e(e, i, n) {
|
|
void 0 === n && (n = !0);
|
|
var a = t.call(this, RES.getRes("zuma_item_" + i + "_png")) || this;
|
|
return a.index = 0,
|
|
a.type = 1,
|
|
a.type = i,
|
|
a.path = e,
|
|
a.isPathBall = n,
|
|
a.anchorOffsetX = a.width / 2,
|
|
a.anchorOffsetY = a.height / 2,
|
|
a.beginShow(),
|
|
a
|
|
}
|
|
return __extends(e, t),
|
|
e.prototype.beginShow = function() {
|
|
if (this.isPathBall) {
|
|
this.index = 0;
|
|
var t = this.path[this.index];
|
|
this.x = t.x,
|
|
this.y = t.y
|
|
} else this.x = 0,
|
|
this.y = this.height / 2;
|
|
this.moveV = new egret.Point(0, -1),
|
|
this.scaleX = this.scaleY = 0,
|
|
egret.Tween.get(this).to({
|
|
scaleX: 1,
|
|
scaleY: 1
|
|
},
|
|
150)
|
|
},
|
|
e.prototype.toNext = function(t) {
|
|
void 0 === t && (t = 1),
|
|
this.index += t,
|
|
this.index = Util.limit(this.index, 0, this.path.length - 1);
|
|
var e = this.path[this.index];
|
|
Math.atan2(e.y - this.y, e.x - this.x);
|
|
this.moveV.x = e.x - this.x,
|
|
this.moveV.y = e.y - this.y
|
|
},
|
|
e.prototype.update = function() {
|
|
var t = this.path[this.index];
|
|
this.y += (t.y - this.y) / 3,
|
|
this.x += (t.x - this.x) / 3
|
|
},
|
|
Object.defineProperty(e.prototype, "isPathEnd", {
|
|
get: function() {
|
|
return this.index >= this.path.length - 1
|
|
},
|
|
enumerable: !0,
|
|
configurable: !0
|
|
}),
|
|
e.prototype.setSpeed = function(t) {
|
|
t.normalize(1),
|
|
this.speedX = t.x * Consts.BULLET_SPEED,
|
|
this.speedY = t.y * Consts.BULLET_SPEED
|
|
},
|
|
e.prototype.bulletUpdate = function(t) {
|
|
this.x += this.speedX * t,
|
|
this.y += this.speedY * t
|
|
},
|
|
e.prototype.moveToPathIndex = function(t) {
|
|
this.index = t,
|
|
this.toNext(0)
|
|
},
|
|
e
|
|
} (egret.Bitmap);
|
|
__reflect(Ball.prototype, "Ball");
|
|
var BallType; !
|
|
function(t) {
|
|
t[t.TYPE1 = 1] = "TYPE1",
|
|
t[t.TYPE2 = 2] = "TYPE2",
|
|
t[t.TYPE3 = 3] = "TYPE3",
|
|
t[t.TYPE4 = 4] = "TYPE4",
|
|
t[t.TYPE5 = 5] = "TYPE5",
|
|
t[t.ICE = 6] = "ICE",
|
|
t[t.FIRE = 7] = "FIRE"
|
|
} (BallType || (BallType = {}));
|
|
var Combo = function(t) {
|
|
function e(e) {
|
|
var i = t.call(this) || this;
|
|
return i.num = e,
|
|
i.skinName = new ComboSkin,
|
|
i
|
|
}
|
|
return __extends(e, t),
|
|
e.prototype.createChildren = function() {
|
|
t.prototype.createChildren.call(this),
|
|
this.numTF.text = this.num + ""
|
|
},
|
|
e.show = function(t) {
|
|
var i = new e(t);
|
|
i.anchorOffsetX = i.width / 2,
|
|
i.anchorOffsetY = i.height / 2,
|
|
i.x = Const.WIN_W / 2 + Util.rang( - 100, 100),
|
|
i.y = Const.WIN_H / 2 + Util.rang( - 100, 100),
|
|
GameLayerManager.instance.popLayer.addChild(i),
|
|
i.scaleX = i.scaleY = 0,
|
|
egret.Tween.get(i).to({
|
|
scaleX: 1,
|
|
scaleY: 1
|
|
},
|
|
250).wait(550).call(game.UIUtils.removeSelf, this, [i])
|
|
},
|
|
e
|
|
} (eui.Component);
|
|
__reflect(Combo.prototype, "Combo");
|
|
|
|
(function () {
|
|
if (typeof Globals !== "undefined") {
|
|
Globals.initTextures = function () {
|
|
return new Promise(function (resolve) {
|
|
for (var index = 0; index < 5; index++) Globals.textures[index] = RES.getRes("gtype_" + index + "_png");
|
|
resolve();
|
|
});
|
|
};
|
|
}
|
|
game.WorldParkPanel = AsumentParkPanel;
|
|
game.WorldParkMediator = AsumentParkMediator;
|
|
})();
|