Commit e8fdfb42 authored by Edwise's avatar Edwise 🍷

bug解除

parent a8158c57
......@@ -21,6 +21,7 @@ export default class SceneCtrl {
change(cls: any, data?: any) {
//如果是同一个场景,考虑是替换还是return
// if (this._currentScene && this._currentScene instanceof cls) return;//new一个得了,playScene维护太蛋疼,到时看性能吧
console.log("加载场景",cls)
let scene: Scene = new cls(data);
scene.visible = false;
showWaiting();
......
......@@ -24,18 +24,18 @@ const initToast = () => {
}
}
export const showToast = (msg="网络异常,请稍后重试~") => {
initToast();
_toast.show(msg)
_parent.addChild(_toast);
FYGE.Tween.removeTweens(_toast);
FYGE.Tween.get(_toast)//动画看需求
.set({ y: startY, alpha: 1 })
.to({ y: endY }, 500, FYGE.Ease.quartOut)
.wait(800)
.to({ alpha: 0 }, 300)
.call(() => {
_parent.removeChild(_toast);
})
// initToast();
// _toast.show(msg)
// _parent.addChild(_toast);
// FYGE.Tween.removeTweens(_toast);
// FYGE.Tween.get(_toast)//动画看需求
// .set({ y: startY, alpha: 1 })
// .to({ y: endY }, 500, FYGE.Ease.quartOut)
// .wait(800)
// .to({ alpha: 0 }, 300)
// .call(() => {
// _parent.removeChild(_toast);
// })
}
/**
......@@ -81,19 +81,20 @@ class Toast extends FYGE.Container {
this.msg.textHeight = toastBgTexture?toastBgTexture.height:200;
this.msg.textAlign = FYGE.TEXT_ALIGN.CENTER;
this.addChild(this.msg)
this.visible = false;
}
/**
* 显示时调用
* @param msg
*/
show(msg: string) {
this.msg.text = msg;
//文本居中适配
this.msg.x = (layers.stageWidth - this.msg.textWidth) / 2;//( (this.bg?this.bg.width:0) - this.msg.textWidth) / 2
// // 是否需要根据文本宽度缩放背景
this.bg.width = Math.min(this.msg.textWidth + this.PADDING * 2, 523);
// 背景居中适配,由于上面一行注释,那这行就构造函数里只执行一次吧
this.bg.x = (Ins.stageW - this.bg.width) / 2
// this.msg.text = msg;
// //文本居中适配
// this.msg.x = (layers.stageWidth - this.msg.textWidth) / 2;//( (this.bg?this.bg.width:0) - this.msg.textWidth) / 2
// // // 是否需要根据文本宽度缩放背景
// this.bg.width = Math.min(this.msg.textWidth + this.PADDING * 2, 523);
// // 背景居中适配,由于上面一行注释,那这行就构造函数里只执行一次吧
// this.bg.x = (Ins.stageW - this.bg.width) / 2
// console.log(Ins.stageW,this.bg.width)
}
......
......@@ -614,6 +614,7 @@ var SceneCtrl = (function () {
};
SceneCtrl.prototype.change = function (cls, data) {
var _this = this;
console.log("加载场景", cls);
var scene = new cls(data);
scene.visible = false;
waitingCtrl_1.showWaiting();
......@@ -682,7 +683,6 @@ exports.destroyToast = exports.showToast = void 0;
var layers_1 = __webpack_require__(/*! ../views/layers */ "./module/views/layers.ts");
var RES_1 = __webpack_require__(/*! ../RES */ "./module/RES.ts");
var resCanvasList_js_1 = __webpack_require__(/*! ../../resCanvasList.js */ "./resCanvasList.js");
var Ins_1 = __webpack_require__(/*! ../../src/Ins */ "./src/Ins.ts");
var inited = false;
var _toast;
var _parent;
......@@ -703,18 +703,6 @@ var initToast = function () {
};
exports.showToast = function (msg) {
if (msg === void 0) { msg = "网络异常,请稍后重试~"; }
initToast();
_toast.show(msg);
_parent.addChild(_toast);
FYGE.Tween.removeTweens(_toast);
FYGE.Tween.get(_toast)
.set({ y: startY, alpha: 1 })
.to({ y: endY }, 500, FYGE.Ease.quartOut)
.wait(800)
.to({ alpha: 0 }, 300)
.call(function () {
_parent.removeChild(_toast);
});
};
exports.destroyToast = function () {
if (inited && _toast && !_toast.destroyed) {
......@@ -745,13 +733,10 @@ var Toast = (function (_super) {
_this.msg.textHeight = toastBgTexture ? toastBgTexture.height : 200;
_this.msg.textAlign = FYGE.TEXT_ALIGN.CENTER;
_this.addChild(_this.msg);
_this.visible = false;
return _this;
}
Toast.prototype.show = function (msg) {
this.msg.text = msg;
this.msg.x = (layers_1.layers.stageWidth - this.msg.textWidth) / 2;
this.bg.width = Math.min(this.msg.textWidth + this.PADDING * 2, 523);
this.bg.x = (Ins_1.Ins.stageW - this.bg.width) / 2;
};
Toast.prototype.destroy = function () {
_super.prototype.destroy.call(this);
......@@ -46869,10 +46854,20 @@ var LoadingScene = (function (_super) {
}
});
FYGE.GDispatcher.addEventListener("loadEnd", function () {
that.isEnd = true;
if (that.tweenEnd) {
FYGE.Tween.get(that.loading, { onChange: function () { that.zhuazi.x = (that.loading.x + that.loading.width - 30); }, onChangeObj: that }).to({ x: 9 }, 600).call(function () { ctrls_1.changeScene(StartScene_1.StartScene); });
}
that.changeStartScene();
}, that);
};
LoadingScene.prototype.changeStartScene = function () {
var that = this;
that.isEnd = true;
if (that.tweenEnd) {
FYGE.Tween.get(that.loading, { onChange: function () { that.zhuazi.x = (that.loading.x + that.loading.width - 30); }, onChangeObj: that }).to({ x: 9 }, 600).call(function () { ctrls_1.changeScene(StartScene_1.StartScene); });
}
};
LoadingScene.prototype.removeEvents = function () {
var that = this;
FYGE.GDispatcher.removeEventListener("loadEnd", function () {
that.changeStartScene();
}, that);
};
return LoadingScene;
......@@ -46937,6 +46932,7 @@ var MainScene = (function (_super) {
console.log(that.y);
that.mouseChildren = true;
Ins_1.Ins.curScene = Ins_1.Ins.senceInfo.sence;
console.log("当前场景", Ins_1.Ins.curScene);
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
that.sceneBg = Ins_1.Ins.initSprite(that.bgUUID[Ins_1.Ins.curScene == 4 ? 2 : Ins_1.Ins.curScene - 1]);
that.addChild(that.sceneBg);
......@@ -46965,6 +46961,7 @@ var MainScene = (function (_super) {
that.initCat();
that.initEnergy();
that.energyUp1();
console.log("初始化结束");
};
MainScene.prototype.initCat = function () {
var that = this;
......@@ -46974,6 +46971,7 @@ var MainScene = (function (_super) {
that.addChild(that.letter);
that.letter.play();
that.letter.visible = false;
console.log("初始化猫咪和信封结束");
if (Ins_1.Ins.catIsOut) {
that.cat.visible = false;
that.letter.visible = true;
......@@ -46983,6 +46981,7 @@ var MainScene = (function (_super) {
MainScene.prototype.initRecallCatTimer = function () {
var that = this;
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.recallInfo, {}, function (s, r) {
console.log("猫咪出走拉");
if (s) {
if (that.recallTimer)
clearTimeout(that.recallTimer);
......@@ -47071,6 +47070,7 @@ var MainScene = (function (_super) {
mask.y = 9;
that.energyGroup.addChild(mask);
that.energyImg.mask = mask;
console.log("初始化精力组结束");
that.setEnergy();
};
MainScene.prototype.setEnergy = function () {
......@@ -47081,6 +47081,7 @@ var MainScene = (function (_super) {
that.energyDeco.x = that.energyImgW * that.energyImg.scaleX - that.energyDeco.width * 0.2;
that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy;
that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2;
console.log("设置精力组数据结束");
};
MainScene.prototype.energyUp1 = function () {
var that = this;
......@@ -47092,6 +47093,9 @@ var MainScene = (function (_super) {
if (time <= Ins_1.Ins.recoverEnergy) {
that.recoverEnergyTime = Ins_1.Ins.recoverEnergy - time;
}
else {
that.recoverEnergyTime = Ins_1.Ins.recoverEnergy;
}
that.recoverEnergyHandler = setInterval(function () {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.recoverEnergy, {}, function (s, r) {
if (s) {
......@@ -47105,6 +47109,7 @@ var MainScene = (function (_super) {
}
});
}, that.recoverEnergyTime);
console.log("登录时间恢复精力设置结束");
};
MainScene.prototype.energyUp2 = function () {
var that = this;
......@@ -47235,7 +47240,9 @@ var MainScene = (function (_super) {
Ins_1.Ins.senceInfo = r.data;
if (r.data.sence < 4) {
Ins_1.Ins.catIsOut = false;
clearTimeout(that.recallTimer);
if (that.recallTimer) {
clearTimeout(that.recallTimer);
}
console.log("删除召回倒计时", that.recallTimer);
that.letter.visible = false;
if (r.data.sence == 3) {
......@@ -47286,8 +47293,8 @@ var MainScene = (function (_super) {
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that);
Main_1.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that);
Main_1.GDispatcher.removeEventListener(Enum_1.MSG.RECALL_CAT, that.recallCat, that);
Main_1.GDispatcher.addEventListener("onShow", that.onShow, that);
Main_1.GDispatcher.addEventListener("onHide", that.onHide, that);
Main_1.GDispatcher.removeEventListener("onShow", that.onShow, that);
Main_1.GDispatcher.removeEventListener("onHide", that.onHide, that);
};
return MainScene;
}(Scene_1.Scene));
......@@ -47369,6 +47376,7 @@ var StartScene = (function (_super) {
console.log("aaa");
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getSence, {}, function (s, r) {
if (s) {
console.log("获取场景成功", r);
Ins_1.Ins.senceInfo = r.data;
if (r.data.sence == 4) {
Ins_1.Ins.catIsOut = true;
......@@ -47380,6 +47388,7 @@ var StartScene = (function (_super) {
ctrls_1.changeScene(MainScene_1.MainScene);
}
else {
console.log("获取场景失败");
Ins_1.Ins.showToast(r.message);
}
});
......@@ -47583,8 +47592,8 @@ var MainSceneBtnUi = (function (_super) {
mask.y = 0;
that.catExperienceBg.addChild(mask);
that.catExperience.mask = mask;
that.experience = Ins_1.Ins.initLabel({ size: 18 });
that.experience.position.set(144, 53);
that.experience = Ins_1.Ins.initLabel({ size: 16 });
that.experience.position.set(144, 55);
that.experience.textWidth = 110;
that.experience.bold = true;
that.experience.textAlign = FYGE.TEXT_ALIGN.CENTER;
This diff is collapsed.
......@@ -616,6 +616,7 @@ var SceneCtrl = (function () {
};
SceneCtrl.prototype.change = function (cls, data) {
var _this = this;
console.log("加载场景", cls);
var scene = new cls(data);
scene.visible = false;
waitingCtrl_1.showWaiting();
......@@ -684,7 +685,6 @@ exports.destroyToast = exports.showToast = void 0;
var layers_1 = __webpack_require__(/*! ../views/layers */ "./module/views/layers.ts");
var RES_1 = __webpack_require__(/*! ../RES */ "./module/RES.ts");
var resCanvasList_js_1 = __webpack_require__(/*! ../../resCanvasList.js */ "./resCanvasList.js");
var Ins_1 = __webpack_require__(/*! ../../src/Ins */ "./src/Ins.ts");
var inited = false;
var _toast;
var _parent;
......@@ -705,18 +705,6 @@ var initToast = function () {
};
exports.showToast = function (msg) {
if (msg === void 0) { msg = "网络异常,请稍后重试~"; }
initToast();
_toast.show(msg);
_parent.addChild(_toast);
FYGE.Tween.removeTweens(_toast);
FYGE.Tween.get(_toast)
.set({ y: startY, alpha: 1 })
.to({ y: endY }, 500, FYGE.Ease.quartOut)
.wait(800)
.to({ alpha: 0 }, 300)
.call(function () {
_parent.removeChild(_toast);
});
};
exports.destroyToast = function () {
if (inited && _toast && !_toast.destroyed) {
......@@ -747,13 +735,10 @@ var Toast = (function (_super) {
_this.msg.textHeight = toastBgTexture ? toastBgTexture.height : 200;
_this.msg.textAlign = FYGE.TEXT_ALIGN.CENTER;
_this.addChild(_this.msg);
_this.visible = false;
return _this;
}
Toast.prototype.show = function (msg) {
this.msg.text = msg;
this.msg.x = (layers_1.layers.stageWidth - this.msg.textWidth) / 2;
this.bg.width = Math.min(this.msg.textWidth + this.PADDING * 2, 523);
this.bg.x = (Ins_1.Ins.stageW - this.bg.width) / 2;
};
Toast.prototype.destroy = function () {
_super.prototype.destroy.call(this);
......@@ -46871,10 +46856,20 @@ var LoadingScene = (function (_super) {
}
});
FYGE.GDispatcher.addEventListener("loadEnd", function () {
that.isEnd = true;
if (that.tweenEnd) {
FYGE.Tween.get(that.loading, { onChange: function () { that.zhuazi.x = (that.loading.x + that.loading.width - 30); }, onChangeObj: that }).to({ x: 9 }, 600).call(function () { ctrls_1.changeScene(StartScene_1.StartScene); });
}
that.changeStartScene();
}, that);
};
LoadingScene.prototype.changeStartScene = function () {
var that = this;
that.isEnd = true;
if (that.tweenEnd) {
FYGE.Tween.get(that.loading, { onChange: function () { that.zhuazi.x = (that.loading.x + that.loading.width - 30); }, onChangeObj: that }).to({ x: 9 }, 600).call(function () { ctrls_1.changeScene(StartScene_1.StartScene); });
}
};
LoadingScene.prototype.removeEvents = function () {
var that = this;
FYGE.GDispatcher.removeEventListener("loadEnd", function () {
that.changeStartScene();
}, that);
};
return LoadingScene;
......@@ -46939,6 +46934,7 @@ var MainScene = (function (_super) {
console.log(that.y);
that.mouseChildren = true;
Ins_1.Ins.curScene = Ins_1.Ins.senceInfo.sence;
console.log("当前场景", Ins_1.Ins.curScene);
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
that.sceneBg = Ins_1.Ins.initSprite(that.bgUUID[Ins_1.Ins.curScene == 4 ? 2 : Ins_1.Ins.curScene - 1]);
that.addChild(that.sceneBg);
......@@ -46967,6 +46963,7 @@ var MainScene = (function (_super) {
that.initCat();
that.initEnergy();
that.energyUp1();
console.log("初始化结束");
};
MainScene.prototype.initCat = function () {
var that = this;
......@@ -46976,6 +46973,7 @@ var MainScene = (function (_super) {
that.addChild(that.letter);
that.letter.play();
that.letter.visible = false;
console.log("初始化猫咪和信封结束");
if (Ins_1.Ins.catIsOut) {
that.cat.visible = false;
that.letter.visible = true;
......@@ -46985,6 +46983,7 @@ var MainScene = (function (_super) {
MainScene.prototype.initRecallCatTimer = function () {
var that = this;
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.recallInfo, {}, function (s, r) {
console.log("猫咪出走拉");
if (s) {
if (that.recallTimer)
clearTimeout(that.recallTimer);
......@@ -47073,6 +47072,7 @@ var MainScene = (function (_super) {
mask.y = 9;
that.energyGroup.addChild(mask);
that.energyImg.mask = mask;
console.log("初始化精力组结束");
that.setEnergy();
};
MainScene.prototype.setEnergy = function () {
......@@ -47083,6 +47083,7 @@ var MainScene = (function (_super) {
that.energyDeco.x = that.energyImgW * that.energyImg.scaleX - that.energyDeco.width * 0.2;
that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy;
that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2;
console.log("设置精力组数据结束");
};
MainScene.prototype.energyUp1 = function () {
var that = this;
......@@ -47094,6 +47095,9 @@ var MainScene = (function (_super) {
if (time <= Ins_1.Ins.recoverEnergy) {
that.recoverEnergyTime = Ins_1.Ins.recoverEnergy - time;
}
else {
that.recoverEnergyTime = Ins_1.Ins.recoverEnergy;
}
that.recoverEnergyHandler = setInterval(function () {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.recoverEnergy, {}, function (s, r) {
if (s) {
......@@ -47107,6 +47111,7 @@ var MainScene = (function (_super) {
}
});
}, that.recoverEnergyTime);
console.log("登录时间恢复精力设置结束");
};
MainScene.prototype.energyUp2 = function () {
var that = this;
......@@ -47237,7 +47242,9 @@ var MainScene = (function (_super) {
Ins_1.Ins.senceInfo = r.data;
if (r.data.sence < 4) {
Ins_1.Ins.catIsOut = false;
clearTimeout(that.recallTimer);
if (that.recallTimer) {
clearTimeout(that.recallTimer);
}
console.log("删除召回倒计时", that.recallTimer);
that.letter.visible = false;
if (r.data.sence == 3) {
......@@ -47288,8 +47295,8 @@ var MainScene = (function (_super) {
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that);
Main_1.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that);
Main_1.GDispatcher.removeEventListener(Enum_1.MSG.RECALL_CAT, that.recallCat, that);
Main_1.GDispatcher.addEventListener("onShow", that.onShow, that);
Main_1.GDispatcher.addEventListener("onHide", that.onHide, that);
Main_1.GDispatcher.removeEventListener("onShow", that.onShow, that);
Main_1.GDispatcher.removeEventListener("onHide", that.onHide, that);
};
return MainScene;
}(Scene_1.Scene));
......@@ -47371,6 +47378,7 @@ var StartScene = (function (_super) {
console.log("aaa");
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getSence, {}, function (s, r) {
if (s) {
console.log("获取场景成功", r);
Ins_1.Ins.senceInfo = r.data;
if (r.data.sence == 4) {
Ins_1.Ins.catIsOut = true;
......@@ -47382,6 +47390,7 @@ var StartScene = (function (_super) {
ctrls_1.changeScene(MainScene_1.MainScene);
}
else {
console.log("获取场景失败");
Ins_1.Ins.showToast(r.message);
}
});
......@@ -47585,8 +47594,8 @@ var MainSceneBtnUi = (function (_super) {
mask.y = 0;
that.catExperienceBg.addChild(mask);
that.catExperience.mask = mask;
that.experience = Ins_1.Ins.initLabel({ size: 18 });
that.experience.position.set(144, 53);
that.experience = Ins_1.Ins.initLabel({ size: 16 });
that.experience.position.set(144, 55);
that.experience.textWidth = 110;
that.experience.bold = true;
that.experience.textAlign = FYGE.TEXT_ALIGN.CENTER;
......@@ -52,7 +52,7 @@ export class SelectCatPanel extends Panel {
selectSure() {
//弹出取名弹窗
closeCurrentPanel();
changeScene(MainScene);
// changeScene(MainScene);
}
initEvents() {
......
......@@ -79,10 +79,22 @@ export class LoadingScene extends Scene{
})
FYGE.GDispatcher.addEventListener("loadEnd",()=>{
that.isEnd = true;
that.changeStartScene();
},that)
}
changeStartScene(){
var that = this;
that.isEnd = true;
if(that.tweenEnd){
FYGE.Tween.get(that.loading,{onChange:()=>{that.zhuazi.x = (that.loading.x+that.loading.width-30)},onChangeObj:that}).to({x:9},600).call(()=>{changeScene(StartScene)});
}
}
removeEvents(){
var that = this;
FYGE.GDispatcher.removeEventListener("loadEnd",()=>{
that.changeStartScene();
},that)
}
}
\ No newline at end of file
......@@ -72,6 +72,7 @@ export class MainScene extends Scene {
console.log(that.y);
that.mouseChildren = true;
Ins.curScene = Ins.senceInfo.sence;
console.log("当前场景",Ins.curScene);
//0:教室,1:操场,2:寝室
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
//生成默认场景,后面要改成根据接口值判断
......@@ -106,6 +107,7 @@ export class MainScene extends Scene {
that.initCat();
that.initEnergy();
that.energyUp1();
console.log("初始化结束")
// that.initGuide(Ins.curScene > 3 ? 3 : Ins.curScene);
// var a = Ins.initLabel({text:"ergergergergerg",x:300,y:800});
// this.addChildAt(a,999);
......@@ -120,6 +122,7 @@ export class MainScene extends Scene {
that.addChild(that.letter);
that.letter.play();
that.letter.visible = false;
console.log("初始化猫咪和信封结束")
if (Ins.catIsOut) {
that.cat.visible = false;
//当猫出走的时候,隐藏猫咪,创建信封
......@@ -133,6 +136,7 @@ export class MainScene extends Scene {
initRecallCatTimer(){
var that = this;
sendTbNet(TbNetName.recallInfo,{},(s,r)=>{
console.log("猫咪出走拉")
if(s){
if(that.recallTimer) clearTimeout(that.recallTimer)
that.recallTimer = setTimeout(()=>{
......@@ -233,6 +237,7 @@ export class MainScene extends Scene {
mask.y = 9;
that.energyGroup.addChild(mask);
that.energyImg.mask = mask;
console.log("初始化精力组结束")
that.setEnergy();
}
......@@ -245,6 +250,7 @@ export class MainScene extends Scene {
that.energyDeco.x = that.energyImgW * that.energyImg.scaleX - that.energyDeco.width * 0.2;
that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy;
that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2
console.log("设置精力组数据结束")
}
/**按照首次登录时间恢复精力 */
......@@ -256,6 +262,8 @@ export class MainScene extends Scene {
console.log("相差的时间",Math.floor(time % 3600 / 60))
if(time<=Ins.recoverEnergy){
that.recoverEnergyTime = Ins.recoverEnergy - time;
}else{
that.recoverEnergyTime = Ins.recoverEnergy;
}
that.recoverEnergyHandler = setInterval(() => {
sendTbNet(TbNetName.recoverEnergy, {}, (s, r) => {
......@@ -269,6 +277,7 @@ export class MainScene extends Scene {
}
});
}, that.recoverEnergyTime)
console.log("登录时间恢复精力设置结束")
}
/**按照固定时间恢复精力 */
......@@ -412,7 +421,9 @@ export class MainScene extends Scene {
Ins.senceInfo = r.data;
if (r.data.sence < 4) {
Ins.catIsOut = false;
clearTimeout(that.recallTimer)
if(that.recallTimer){
clearTimeout(that.recallTimer)
}
console.log("删除召回倒计时",that.recallTimer)
that.letter.visible = false;
if (r.data.sence == 3) {
......@@ -467,7 +478,7 @@ export class MainScene extends Scene {
FYGE.GDispatcher.removeEventListener(MSG.CHANGE_SCENE, () => { that.changeMainScene(SCENETYPE.BEADROOM) }, that);
GDispatcher.removeEventListener(MSG.UPDATE_USERINFO, that.updateUserInfo, that);
GDispatcher.removeEventListener(MSG.RECALL_CAT, that.recallCat, that);
GDispatcher.addEventListener("onShow",that.onShow,that);
GDispatcher.addEventListener("onHide",that.onHide,that);
GDispatcher.removeEventListener("onShow",that.onShow,that);
GDispatcher.removeEventListener("onHide",that.onHide,that);
}
}
\ No newline at end of file
......@@ -55,6 +55,7 @@ export class StartScene extends Scene {
console.log("aaa")
sendTbNet(TbNetName.getSence,{},(s,r)=>{
if(s){
console.log("获取场景成功",r)
Ins.senceInfo = r.data;
if (r.data.sence == 4) {
Ins.catIsOut = true;
......@@ -65,6 +66,7 @@ export class StartScene extends Scene {
changeScene(MainScene)
}else{
// Ins.hideLoading();
console.log("获取场景失败")
Ins.showToast(r.message);
}
})
......
......@@ -148,8 +148,8 @@ export class MainSceneBtnUi extends Module {
that.catExperienceBg.addChild(mask);
that.catExperience.mask = mask;
that.experience = Ins.initLabel({size:18});
that.experience.position.set(144,53)
that.experience = Ins.initLabel({size:16});
that.experience.position.set(144,55)
that.experience.textWidth = 110;
that.experience.bold = true;
that.experience.textAlign = FYGE.TEXT_ALIGN.CENTER
......
......@@ -8,7 +8,7 @@
<image class="catnameNo" a:if="{{!btnV}}" src={{resList['3fe9ac60-f1aa-4da3-93da-c67e5a9dc3a6'].url}} />
<view class="catnameinput">
<image class="catnameinputbg" src={{resList['947d970f-52bf-4319-82f0-a3e65620ed75'].url}} />
<input class="catnameinputlabel" maxlength="6" onInput="getCatName" controlled="true" value="{{catNameText}}" placeholder="输入名字" name="" ></input>
<input class="catnameinputlabel" maxlength="6" onInput="getCatName" controlled="true" value="{{catNameText}}" placeholder="请输入不超过3个中文或6个英文" name="" ></input>
<text class="catnameinputrandom" onTap="randomName" >随机名字</text>
</view>
</view>
import * as FYGE from "fyge-tbmini";
import * as SvgaParser from "svga-parser";
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
......@@ -616,6 +615,7 @@ var SceneCtrl = (function () {
};
SceneCtrl.prototype.change = function (cls, data) {
var _this = this;
console.log("加载场景", cls);
var scene = new cls(data);
scene.visible = false;
waitingCtrl_1.showWaiting();
......@@ -684,7 +684,6 @@ exports.destroyToast = exports.showToast = void 0;
var layers_1 = __webpack_require__(/*! ../views/layers */ "./module/views/layers.ts");
var RES_1 = __webpack_require__(/*! ../RES */ "./module/RES.ts");
var resCanvasList_js_1 = __webpack_require__(/*! ../../resCanvasList.js */ "./resCanvasList.js");
var Ins_1 = __webpack_require__(/*! ../../src/Ins */ "./src/Ins.ts");
var inited = false;
var _toast;
var _parent;
......@@ -705,18 +704,6 @@ var initToast = function () {
};
exports.showToast = function (msg) {
if (msg === void 0) { msg = "网络异常,请稍后重试~"; }
initToast();
_toast.show(msg);
_parent.addChild(_toast);
FYGE.Tween.removeTweens(_toast);
FYGE.Tween.get(_toast)
.set({ y: startY, alpha: 1 })
.to({ y: endY }, 500, FYGE.Ease.quartOut)
.wait(800)
.to({ alpha: 0 }, 300)
.call(function () {
_parent.removeChild(_toast);
});
};
exports.destroyToast = function () {
if (inited && _toast && !_toast.destroyed) {
......@@ -747,13 +734,10 @@ var Toast = (function (_super) {
_this.msg.textHeight = toastBgTexture ? toastBgTexture.height : 200;
_this.msg.textAlign = FYGE.TEXT_ALIGN.CENTER;
_this.addChild(_this.msg);
_this.visible = false;
return _this;
}
Toast.prototype.show = function (msg) {
this.msg.text = msg;
this.msg.x = (layers_1.layers.stageWidth - this.msg.textWidth) / 2;
this.bg.width = Math.min(this.msg.textWidth + this.PADDING * 2, 523);
this.bg.x = (Ins_1.Ins.stageW - this.bg.width) / 2;
};
Toast.prototype.destroy = function () {
_super.prototype.destroy.call(this);
......@@ -46871,10 +46855,20 @@ var LoadingScene = (function (_super) {
}
});
FYGE.GDispatcher.addEventListener("loadEnd", function () {
that.isEnd = true;
if (that.tweenEnd) {
FYGE.Tween.get(that.loading, { onChange: function () { that.zhuazi.x = (that.loading.x + that.loading.width - 30); }, onChangeObj: that }).to({ x: 9 }, 600).call(function () { ctrls_1.changeScene(StartScene_1.StartScene); });
}
that.changeStartScene();
}, that);
};
LoadingScene.prototype.changeStartScene = function () {
var that = this;
that.isEnd = true;
if (that.tweenEnd) {
FYGE.Tween.get(that.loading, { onChange: function () { that.zhuazi.x = (that.loading.x + that.loading.width - 30); }, onChangeObj: that }).to({ x: 9 }, 600).call(function () { ctrls_1.changeScene(StartScene_1.StartScene); });
}
};
LoadingScene.prototype.removeEvents = function () {
var that = this;
FYGE.GDispatcher.removeEventListener("loadEnd", function () {
that.changeStartScene();
}, that);
};
return LoadingScene;
......@@ -46939,6 +46933,7 @@ var MainScene = (function (_super) {
console.log(that.y);
that.mouseChildren = true;
Ins_1.Ins.curScene = Ins_1.Ins.senceInfo.sence;
console.log("当前场景", Ins_1.Ins.curScene);
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
that.sceneBg = Ins_1.Ins.initSprite(that.bgUUID[Ins_1.Ins.curScene == 4 ? 2 : Ins_1.Ins.curScene - 1]);
that.addChild(that.sceneBg);
......@@ -46967,6 +46962,7 @@ var MainScene = (function (_super) {
that.initCat();
that.initEnergy();
that.energyUp1();
console.log("初始化结束");
};
MainScene.prototype.initCat = function () {
var that = this;
......@@ -46976,6 +46972,7 @@ var MainScene = (function (_super) {
that.addChild(that.letter);
that.letter.play();
that.letter.visible = false;
console.log("初始化猫咪和信封结束");
if (Ins_1.Ins.catIsOut) {
that.cat.visible = false;
that.letter.visible = true;
......@@ -46985,6 +46982,7 @@ var MainScene = (function (_super) {
MainScene.prototype.initRecallCatTimer = function () {
var that = this;
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.recallInfo, {}, function (s, r) {
console.log("猫咪出走拉");
if (s) {
if (that.recallTimer)
clearTimeout(that.recallTimer);
......@@ -47073,6 +47071,7 @@ var MainScene = (function (_super) {
mask.y = 9;
that.energyGroup.addChild(mask);
that.energyImg.mask = mask;
console.log("初始化精力组结束");
that.setEnergy();
};
MainScene.prototype.setEnergy = function () {
......@@ -47083,6 +47082,7 @@ var MainScene = (function (_super) {
that.energyDeco.x = that.energyImgW * that.energyImg.scaleX - that.energyDeco.width * 0.2;
that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy;
that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2;
console.log("设置精力组数据结束");
};
MainScene.prototype.energyUp1 = function () {
var that = this;
......@@ -47094,6 +47094,9 @@ var MainScene = (function (_super) {
if (time <= Ins_1.Ins.recoverEnergy) {
that.recoverEnergyTime = Ins_1.Ins.recoverEnergy - time;
}
else {
that.recoverEnergyTime = Ins_1.Ins.recoverEnergy;
}
that.recoverEnergyHandler = setInterval(function () {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.recoverEnergy, {}, function (s, r) {
if (s) {
......@@ -47107,6 +47110,7 @@ var MainScene = (function (_super) {
}
});
}, that.recoverEnergyTime);
console.log("登录时间恢复精力设置结束");
};
MainScene.prototype.energyUp2 = function () {
var that = this;
......@@ -47237,7 +47241,9 @@ var MainScene = (function (_super) {
Ins_1.Ins.senceInfo = r.data;
if (r.data.sence < 4) {
Ins_1.Ins.catIsOut = false;
clearTimeout(that.recallTimer);
if (that.recallTimer) {
clearTimeout(that.recallTimer);
}
console.log("删除召回倒计时", that.recallTimer);
that.letter.visible = false;
if (r.data.sence == 3) {
......@@ -47288,8 +47294,8 @@ var MainScene = (function (_super) {
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that);
Main_1.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that);
Main_1.GDispatcher.removeEventListener(Enum_1.MSG.RECALL_CAT, that.recallCat, that);
Main_1.GDispatcher.addEventListener("onShow", that.onShow, that);
Main_1.GDispatcher.addEventListener("onHide", that.onHide, that);
Main_1.GDispatcher.removeEventListener("onShow", that.onShow, that);
Main_1.GDispatcher.removeEventListener("onHide", that.onHide, that);
};
return MainScene;
}(Scene_1.Scene));
......@@ -47371,6 +47377,7 @@ var StartScene = (function (_super) {
console.log("aaa");
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getSence, {}, function (s, r) {
if (s) {
console.log("获取场景成功", r);
Ins_1.Ins.senceInfo = r.data;
if (r.data.sence == 4) {
Ins_1.Ins.catIsOut = true;
......@@ -47382,6 +47389,7 @@ var StartScene = (function (_super) {
ctrls_1.changeScene(MainScene_1.MainScene);
}
else {
console.log("获取场景失败");
Ins_1.Ins.showToast(r.message);
}
});
......@@ -47585,8 +47593,8 @@ var MainSceneBtnUi = (function (_super) {
mask.y = 0;
that.catExperienceBg.addChild(mask);
that.catExperience.mask = mask;
that.experience = Ins_1.Ins.initLabel({ size: 18 });
that.experience.position.set(144, 53);
that.experience = Ins_1.Ins.initLabel({ size: 16 });
that.experience.position.set(144, 55);
that.experience.textWidth = 110;
that.experience.bold = true;
that.experience.textAlign = FYGE.TEXT_ALIGN.CENTER;
This diff is collapsed.
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