Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
new_taobao
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wildfirecode13
new_taobao
Commits
a6ff0b94
Commit
a6ff0b94
authored
Sep 22, 2020
by
Edwise
🍷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1234
parent
63e996f8
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
434 additions
and
344 deletions
+434
-344
tamllCat.interaction.json
...ect/src/canvas/game/mock/miniTb/tamllCat.interaction.json
+6
-0
tmallCat.getUserInfo.json
...ect/src/canvas/game/mock/miniTb/tmallCat.getUserInfo.json
+15
-0
toastCtrl.ts
project/src/canvas/game/module/ctrls/toastCtrl.ts
+15
-8
output.js
project/src/canvas/game/output.js
+35
-11
output.js.map
project/src/canvas/game/output.js.map
+1
-1
output.js
project/src/canvas/game/released/output.js
+35
-11
common.png
project/src/canvas/game/released/resource/common/common.png
+0
-0
res.json
project/src/canvas/game/released/resource/res.json
+1
-46
map_bg1.jpg
.../src/canvas/game/released/resource/startScene/map_bg1.jpg
+0
-0
resCanvasList.js
project/src/canvas/game/resCanvasList.js
+12
-0
Enum.ts
project/src/canvas/game/src/Enum.ts
+3
-1
Ins.ts
project/src/canvas/game/src/Ins.ts
+2
-2
ResJson.ts
project/src/canvas/game/src/ResJson.ts
+2
-47
TaoBaoNet.ts
project/src/canvas/game/src/TaoBaoNet.ts
+11
-0
Cat.ts
project/src/canvas/game/src/cat/Cat.ts
+21
-25
MainScene.ts
project/src/canvas/game/src/scenes/MainScene.ts
+7
-0
StartScene.ts
project/src/canvas/game/src/scenes/StartScene.ts
+17
-2
MainSceneBtnUi.ts
project/src/canvas/game/src/ui/MainSceneBtnUi.ts
+1
-0
output.js
taobao_mini/client/pages/pagecanvas/output.js
+35
-11
pagecanvas.js
taobao_mini/client/pages/pagecanvas/pagecanvas.js
+215
-179
No files found.
project/src/canvas/game/mock/miniTb/tamllCat.interaction.json
0 → 100644
View file @
a6ff0b94
{
"success"
:
false
,
"message"
:
"请稍后重试"
,
"data"
:
"aaaa"
,
"code"
:
"000"
}
\ No newline at end of file
project/src/canvas/game/mock/miniTb/tmallCat.getUserInfo.json
0 → 100644
View file @
a6ff0b94
{
"success"
:
true
,
"message"
:
""
,
"data"
:
{
"catType"
:
1
,
"userNick"
:
"Edwise"
,
"energy"
:
"100"
,
"happyCoin"
:
"1000"
,
"experience"
:
"50"
,
"level"
:
"1"
,
"avatar"
:
"https://yun.duiba.com.cn/spark/assets/b1992c528b36c2d26942e9c83941242e59481475.png"
,
"sence"
:
1
,
"catName"
:
"喵喵喵"
}
}
\ No newline at end of file
project/src/canvas/game/module/ctrls/toastCtrl.ts
View file @
a6ff0b94
...
...
@@ -2,6 +2,8 @@
import
{
layers
}
from
"../views/layers"
;
import
{
RES
}
from
"../RES"
;
import
resCanvasList
from
"../../resCanvasList.js"
import
{
Ins
}
from
"../../src/Ins"
;
let
inited
=
false
;
let
_toast
:
Toast
;
...
...
@@ -14,14 +16,14 @@ const initToast = () => {
_toast
=
new
Toast
();
_parent
=
layers
.
toastLayer
;
_toast
.
alpha
=
0
;
_toast
.
x
=
layers
.
stageOffsetX
-
_parent
.
x
+
(
layers
.
stageWidth
-
_toast
.
width
)
/
2
;
_toast
.
x
=
(
layers
.
stageWidth
-
_toast
.
width
)
/
2
;
var
h
=
_toast
.
height
;
var
y
=
layers
.
stageOffsetY
-
_parent
.
y
;
startY
=
y
-
h
;
endY
=
y
+
(
layers
.
stageHeight
-
h
)
/
2
;
}
}
export
const
showToast
=
(
msg
:
string
)
=>
{
export
const
showToast
=
(
msg
=
"网络异常,请稍后重试~"
)
=>
{
initToast
();
_toast
.
show
(
msg
)
_parent
.
addChild
(
_toast
);
...
...
@@ -56,14 +58,18 @@ class Toast extends FYGE.Container {
msg
:
FYGE
.
TextField
;
bg
:
FYGE
.
Sprite
;
PADDING
=
40
;
bgw
:
number
;
constructor
()
{
super
();
this
.
mouseChildren
=
false
;
this
.
mouseEnable
=
false
;
var
toastBgTexture
:
FYGE
.
Texture
=
RES
.
getRes
(
"toastBg.png"
);
// var toastBgTexture: FYGE.Texture = RES.getRes("toastBg.png");
var
toastBgTexture
:
FYGE
.
Texture
=
RES
.
getRes
(
resCanvasList
[
"0cc64b0c-3ccc-4d88-b697-bb402319cef7"
].
url
);
if
(
toastBgTexture
)
{
this
.
bg
=
new
FYGE
.
Sprite
(
toastBgTexture
);
// this.bg.x = (750 - 460) / 2// (layers.stageWidth - this.bg.width) / 2
// this.bgw = this.bg.width
this
.
bg
.
x
=
(
layers
.
stageWidth
-
this
.
bg
.
width
)
/
2
this
.
addChild
(
this
.
bg
);
}
...
...
@@ -83,11 +89,12 @@ class Toast extends FYGE.Container {
show
(
msg
:
string
)
{
this
.
msg
.
text
=
msg
;
//文本居中适配
this
.
msg
.
x
=
(
(
this
.
bg
?
this
.
bg
.
width
:
0
)
-
this
.
msg
.
textWidth
)
/
2
//(layers.stageWidth - this.msg.textWidth) / 2;
//是否需要根据文本宽度缩放背景
// this.bg.width = Math.min(this.msg.textWidth + this.PADDING * 2, 523);
//背景居中适配,由于上面一行注释,那这行就构造函数里只执行一次吧
// this.bg.x = (layers.stageWidth - this.bg.width) / 2
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)
}
destroy
()
{
...
...
project/src/canvas/game/output.js
View file @
a6ff0b94
...
...
@@ -681,6 +681,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
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;
...
...
@@ -692,7 +694,7 @@ var initToast = function () {
_toast = new Toast();
_parent = layers_1.layers.toastLayer;
_toast.alpha = 0;
_toast.x =
layers_1.layers.stageOffsetX - _parent.x +
(layers_1.layers.stageWidth - _toast.width) / 2;
_toast.x = (layers_1.layers.stageWidth - _toast.width) / 2;
var h = _toast.height;
var y = layers_1.layers.stageOffsetY - _parent.y;
startY = y - h;
...
...
@@ -700,6 +702,7 @@ var initToast = function () {
}
};
exports.showToast = function (msg) {
if (msg === void 0) { msg = "网络异常,请稍后重试~"; }
initToast();
_toast.show(msg);
_parent.addChild(_toast);
...
...
@@ -728,9 +731,10 @@ var Toast = (function (_super) {
_this.PADDING = 40;
_this.mouseChildren = false;
_this.mouseEnable = false;
var toastBgTexture = RES_1.RES.getRes(
"toastBg.png"
);
var toastBgTexture = RES_1.RES.getRes(
resCanvasList_js_1.default["0cc64b0c-3ccc-4d88-b697-bb402319cef7"].url
);
if (toastBgTexture) {
_this.bg = new FYGE.Sprite(toastBgTexture);
_this.bg.x = (layers_1.layers.stageWidth - _this.bg.width) / 2;
_this.addChild(_this.bg);
}
_this.msg = new FYGE.TextField();
...
...
@@ -745,7 +749,9 @@ var Toast = (function (_super) {
}
Toast.prototype.show = function (msg) {
this.msg.text = msg;
this.msg.x = ((this.bg ? this.bg.width : 0) - this.msg.textWidth) / 2;
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);
...
...
@@ -1856,6 +1862,12 @@ const resCanvasList = {
ext: '.jpg',
url: 'https://yun.duiba.com.cn/spark/assets/寝室1.e9238ec5e71c328817026128dd0f41fdc65203f4.jpg',
uuid: 'b3c8c187-e5c9-4968-9a00-a118d18ab2fc'
},
'0cc64b0c-3ccc-4d88-b697-bb402319cef7': {
name: 'ToastBg',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/ToastBg.81e208c0050ce46ac576ba881d02db07a02bffe2.png',
uuid: '0cc64b0c-3ccc-4d88-b697-bb402319cef7'
}
};
/* harmony default export */ __webpack_exports__["default"] = (resCanvasList);
...
...
@@ -1973,6 +1985,7 @@ var MSG;
MSG["CHANGE_SCENE"] = "CHANGE_SCENE";
MSG["SELECT_CAT"] = "SELECT_CAT";
MSG["CAT_ACT"] = "CAT_ACT";
MSG["UPDATE_USERINFO"] = "UPDATE_USERINFO";
})(MSG = exports.MSG || (exports.MSG = {}));
var CATTYPE;
(function (CATTYPE) {
...
...
@@ -2262,6 +2275,8 @@ var TbNetName;
(function (TbNetName) {
TbNetName["navigateToPage"] = "mine.navigateToPage";
TbNetName["showModal"] = "mine.showModal";
TbNetName["getUserInfo"] = "tmallCat.getUserInfo";
TbNetName["interaction"] = "tamllCat.interaction";
TbNetName["trackingReport"] = "squirrelsAdoptRest2c.trackingReport";
TbNetName["getActivityBaseInfoById"] = "bubbleSurviva.getActivityBaseInfoById";
TbNetName["getGameInfo"] = "babycare.getGameInfo";
...
...
@@ -2442,6 +2457,7 @@ var xianluomao01_1 = __webpack_require__(/*! ../lottieSrc/lottieTs/xianluoCat/xi
var xianluoshuohua_1 = __webpack_require__(/*! ../lottieSrc/lottieTs/xianluoCat/xianluoshuohua */ "./src/lottieSrc/lottieTs/xianluoCat/xianluoshuohua.ts");
var Enum_1 = __webpack_require__(/*! ../Enum */ "./src/Enum.ts");
var Ins_1 = __webpack_require__(/*! ../Ins */ "./src/Ins.ts");
var TaoBaoNet_1 = __webpack_require__(/*! ../TaoBaoNet */ "./src/TaoBaoNet.ts");
var Cat = (function (_super) {
__extends(Cat, _super);
function Cat(data) {
...
...
@@ -2541,7 +2557,9 @@ var Cat = (function (_super) {
var that = this;
var actType = e.data;
console.log(actType);
this.actRunning = true;
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.interaction, {}, function (s, r) {
if (s) {
that.actRunning = true;
switch (actType) {
case Enum_1.CAT_ACTTYPEP.SLEEP:
break;
...
...
@@ -2549,6 +2567,11 @@ var Cat = (function (_super) {
that.setCatAnimShow(actType, function () { that.setCatAnimShow(0, null); });
break;
}
}
else {
FYGE.GDispatcher.dispatchEvent("23", r.message);
}
});
};
Cat.prototype.initEvents = function () {
FYGE.GDispatcher.addEventListener(Enum_1.MSG.CAT_ACT, this.catAct, this);
...
...
@@ -44746,6 +44769,7 @@ var MainSceneBtnUi = (function (_super) {
MainSceneBtnUi.prototype.touchHandler = function (e) {
console.log(e.target);
var that = this;
that.btnDelay(e.target);
if (e.target == that.returnBtn) {
that.returnBedRoom();
}
project/src/canvas/game/output.js.map
View file @
a6ff0b94
This source diff could not be displayed because it is too large. You can
view the blob
instead.
project/src/canvas/game/released/output.js
View file @
a6ff0b94
...
...
@@ -683,6 +683,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
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;
...
...
@@ -694,7 +696,7 @@ var initToast = function () {
_toast = new Toast();
_parent = layers_1.layers.toastLayer;
_toast.alpha = 0;
_toast.x =
layers_1.layers.stageOffsetX - _parent.x +
(layers_1.layers.stageWidth - _toast.width) / 2;
_toast.x = (layers_1.layers.stageWidth - _toast.width) / 2;
var h = _toast.height;
var y = layers_1.layers.stageOffsetY - _parent.y;
startY = y - h;
...
...
@@ -702,6 +704,7 @@ var initToast = function () {
}
};
exports.showToast = function (msg) {
if (msg === void 0) { msg = "网络异常,请稍后重试~"; }
initToast();
_toast.show(msg);
_parent.addChild(_toast);
...
...
@@ -730,9 +733,10 @@ var Toast = (function (_super) {
_this.PADDING = 40;
_this.mouseChildren = false;
_this.mouseEnable = false;
var toastBgTexture = RES_1.RES.getRes(
"toastBg.png"
);
var toastBgTexture = RES_1.RES.getRes(
resCanvasList_js_1.default["0cc64b0c-3ccc-4d88-b697-bb402319cef7"].url
);
if (toastBgTexture) {
_this.bg = new FYGE.Sprite(toastBgTexture);
_this.bg.x = (layers_1.layers.stageWidth - _this.bg.width) / 2;
_this.addChild(_this.bg);
}
_this.msg = new FYGE.TextField();
...
...
@@ -747,7 +751,9 @@ var Toast = (function (_super) {
}
Toast.prototype.show = function (msg) {
this.msg.text = msg;
this.msg.x = ((this.bg ? this.bg.width : 0) - this.msg.textWidth) / 2;
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);
...
...
@@ -1858,6 +1864,12 @@ const resCanvasList = {
ext: '.jpg',
url: 'https://yun.duiba.com.cn/spark/assets/寝室1.e9238ec5e71c328817026128dd0f41fdc65203f4.jpg',
uuid: 'b3c8c187-e5c9-4968-9a00-a118d18ab2fc'
},
'0cc64b0c-3ccc-4d88-b697-bb402319cef7': {
name: 'ToastBg',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/ToastBg.81e208c0050ce46ac576ba881d02db07a02bffe2.png',
uuid: '0cc64b0c-3ccc-4d88-b697-bb402319cef7'
}
};
/* harmony default export */ __webpack_exports__["default"] = (resCanvasList);
...
...
@@ -1975,6 +1987,7 @@ var MSG;
MSG["CHANGE_SCENE"] = "CHANGE_SCENE";
MSG["SELECT_CAT"] = "SELECT_CAT";
MSG["CAT_ACT"] = "CAT_ACT";
MSG["UPDATE_USERINFO"] = "UPDATE_USERINFO";
})(MSG = exports.MSG || (exports.MSG = {}));
var CATTYPE;
(function (CATTYPE) {
...
...
@@ -2264,6 +2277,8 @@ var TbNetName;
(function (TbNetName) {
TbNetName["navigateToPage"] = "mine.navigateToPage";
TbNetName["showModal"] = "mine.showModal";
TbNetName["getUserInfo"] = "tmallCat.getUserInfo";
TbNetName["interaction"] = "tamllCat.interaction";
TbNetName["trackingReport"] = "squirrelsAdoptRest2c.trackingReport";
TbNetName["getActivityBaseInfoById"] = "bubbleSurviva.getActivityBaseInfoById";
TbNetName["getGameInfo"] = "babycare.getGameInfo";
...
...
@@ -2444,6 +2459,7 @@ var xianluomao01_1 = __webpack_require__(/*! ../lottieSrc/lottieTs/xianluoCat/xi
var xianluoshuohua_1 = __webpack_require__(/*! ../lottieSrc/lottieTs/xianluoCat/xianluoshuohua */ "./src/lottieSrc/lottieTs/xianluoCat/xianluoshuohua.ts");
var Enum_1 = __webpack_require__(/*! ../Enum */ "./src/Enum.ts");
var Ins_1 = __webpack_require__(/*! ../Ins */ "./src/Ins.ts");
var TaoBaoNet_1 = __webpack_require__(/*! ../TaoBaoNet */ "./src/TaoBaoNet.ts");
var Cat = (function (_super) {
__extends(Cat, _super);
function Cat(data) {
...
...
@@ -2543,7 +2559,9 @@ var Cat = (function (_super) {
var that = this;
var actType = e.data;
console.log(actType);
this.actRunning = true;
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.interaction, {}, function (s, r) {
if (s) {
that.actRunning = true;
switch (actType) {
case Enum_1.CAT_ACTTYPEP.SLEEP:
break;
...
...
@@ -2551,6 +2569,11 @@ var Cat = (function (_super) {
that.setCatAnimShow(actType, function () { that.setCatAnimShow(0, null); });
break;
}
}
else {
FYGE.GDispatcher.dispatchEvent("23", r.message);
}
});
};
Cat.prototype.initEvents = function () {
FYGE.GDispatcher.addEventListener(Enum_1.MSG.CAT_ACT, this.catAct, this);
...
...
@@ -44748,6 +44771,7 @@ var MainSceneBtnUi = (function (_super) {
MainSceneBtnUi.prototype.touchHandler = function (e) {
console.log(e.target);
var that = this;
that.btnDelay(e.target);
if (e.target == that.returnBtn) {
that.returnBedRoom();
}
project/src/canvas/game/released/resource/common/common.png
deleted
100644 → 0
View file @
63e996f8
1.08 KB
project/src/canvas/game/released/resource/res.json
View file @
a6ff0b94
...
...
@@ -3,52 +3,7 @@
{
"keys"
:
"comCloseBtn.png,toastBg.png,waitingBg.png,waitingRot.png"
,
"name"
:
"common"
,
"atlas"
:
{
"comCloseBtn.png"
:
{
"x"
:
646
,
"y"
:
60
,
"w"
:
48
,
"h"
:
48
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
48
,
"sh"
:
48
,
"ro"
:
false
},
"toastBg.png"
:
{
"x"
:
184
,
"y"
:
2
,
"w"
:
460
,
"h"
:
130
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
460
,
"sh"
:
130
,
"ro"
:
false
},
"waitingBg.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
160
,
"h"
:
180
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
160
,
"sh"
:
180
,
"ro"
:
true
},
"waitingRot.png"
:
{
"x"
:
646
,
"y"
:
2
,
"w"
:
56
,
"h"
:
56
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
56
,
"sh"
:
56
,
"ro"
:
false
}
}
"atlas"
:
"common.json"
},
{
"keys"
:
"map_bg1.jpg"
,
...
...
project/src/canvas/game/released/resource/startScene/map_bg1.jpg
View replaced file @
63e996f8
View file @
a6ff0b94
75.5 KB
|
W:
|
H:
75.5 KB
|
W:
|
H:
2-up
Swipe
Onion skin
project/src/canvas/game/resCanvasList.js
View file @
a6ff0b94
...
...
@@ -628,6 +628,18 @@ const resCanvasList = {
ext
:
'.jpg'
,
url
:
'https://yun.duiba.com.cn/spark/assets/寝室1.e9238ec5e71c328817026128dd0f41fdc65203f4.jpg'
,
uuid
:
'b3c8c187-e5c9-4968-9a00-a118d18ab2fc'
},
'0cc64b0c-3ccc-4d88-b697-bb402319cef7'
:
{
name
:
'ToastBg'
,
ext
:
'.png'
,
url
:
'//yun.duiba.com.cn/spark/assets/ToastBg.81e208c0050ce46ac576ba881d02db07a02bffe2.png'
,
uuid
:
'0cc64b0c-3ccc-4d88-b697-bb402319cef7'
},
'69009eb9-4593-4a43-a9d7-a6356ebd6d04'
:
{
name
:
'精力条对话框'
,
ext
:
'.png'
,
url
:
'//yun.duiba.com.cn/spark/assets/精力条对话框.da8e059d18cf967026989e3c376b7364210c3d4e.png'
,
uuid
:
'69009eb9-4593-4a43-a9d7-a6356ebd6d04'
}
};
export
default
resCanvasList
;
project/src/canvas/game/src/Enum.ts
View file @
a6ff0b94
...
...
@@ -15,7 +15,9 @@ export enum MSG{
/**选择猫咪 */
SELECT_CAT
=
"SELECT_CAT"
,
/**猫咪互动 */
CAT_ACT
=
"CAT_ACT"
CAT_ACT
=
"CAT_ACT"
,
/**刷新用户领养信息 */
UPDATE_USERINFO
=
"UPDATE_USERINFO"
}
/**猫咪类型 */
...
...
project/src/canvas/game/src/Ins.ts
View file @
a6ff0b94
project/src/canvas/game/src/ResJson.ts
View file @
a6ff0b94
...
...
@@ -3,57 +3,12 @@ export const ResJson = {
{
"keys"
:
"comCloseBtn.png,toastBg.png,waitingBg.png,waitingRot.png"
,
"name"
:
"common"
,
"atlas"
:
{
"comCloseBtn.png"
:
{
"x"
:
646
,
"y"
:
60
,
"w"
:
48
,
"h"
:
48
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
48
,
"sh"
:
48
,
"ro"
:
false
},
"toastBg.png"
:
{
"x"
:
184
,
"y"
:
2
,
"w"
:
460
,
"h"
:
130
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
460
,
"sh"
:
130
,
"ro"
:
false
},
"waitingBg.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
160
,
"h"
:
180
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
160
,
"sh"
:
180
,
"ro"
:
true
},
"waitingRot.png"
:
{
"x"
:
646
,
"y"
:
2
,
"w"
:
56
,
"h"
:
56
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
56
,
"sh"
:
56
,
"ro"
:
false
}
}
"atlas"
:
"common.json"
},
{
"keys"
:
"map_bg1.jpg"
,
"name"
:
"startScene"
}
],
"path"
:
"https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1600
243346
/resource/"
"path"
:
"https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1600
743469
/resource/"
}
\ No newline at end of file
project/src/canvas/game/src/TaoBaoNet.ts
View file @
a6ff0b94
...
...
@@ -5,6 +5,17 @@ import { GDispatcher } from "./Main";
export
enum
TbNetName
{
navigateToPage
=
"mine.navigateToPage"
,
showModal
=
"mine.showModal"
,
/**
* 获取用户领养信息
*/
getUserInfo
=
"tmallCat.getUserInfo"
,
/**
* 猫咪互动
*/
interaction
=
"tamllCat.interaction"
,
/**
* 埋点统计 到时改名字
* activityId params elemType
...
...
project/src/canvas/game/src/cat/Cat.ts
View file @
a6ff0b94
...
...
@@ -25,6 +25,8 @@ import { xianluomao01 } from "../lottieSrc/lottieTs/xianluoCat/xianluomao01";
import
{
xianluoshuohua
}
from
"../lottieSrc/lottieTs/xianluoCat/xianluoshuohua"
;
import
{
CATTYPE
,
MSG
,
CAT_ACTTYPEP
}
from
"../Enum"
;
import
{
Ins
}
from
"../Ins"
;
import
{
sendTbNet
,
TbNetName
}
from
"../TaoBaoNet"
;
import
{
showToast
}
from
"../../module/ctrls"
;
export
class
Cat
extends
Module
{
constructor
(
data
?:
any
)
{
...
...
@@ -41,7 +43,7 @@ export class Cat extends Module {
cat_touch
:
FYGE
.
Lottie
;
//摸头
catAnimArr
:
FYGE
.
Lottie
[]
=
[];
//猫咪lottie实例组
catLottieArr
:
any
//猫咪lottie数据组
actRunning
:
boolean
=
false
;
//动效是否进行中,如果动效进行中,无法进行其他动效
actRunning
:
boolean
=
false
;
//动效是否进行中,如果动效进行中,无法进行其他动效
initUi
()
{
this
.
initCatLottieArr
();
...
...
@@ -122,7 +124,7 @@ export class Cat extends Module {
* 0:睡觉,1:说话,2:梳毛,3:撸猫,4:玩球,5:摸头
*/
setCatAnimShow
(
index
:
number
,
callback
?:
()
=>
void
)
{
if
(
index
==
0
||
index
==
1
)
{
if
(
index
==
0
||
index
==
1
)
{
this
.
actRunning
=
false
;
}
for
(
let
i
=
0
;
i
<
this
.
catAnimArr
.
length
;
i
++
)
{
...
...
@@ -142,25 +144,13 @@ export class Cat extends Module {
/**猫咪互动 */
catAct
(
e
)
{
if
(
this
.
actRunning
)
return
;
if
(
this
.
actRunning
)
return
;
var
that
=
this
;
let
actType
=
e
.
data
;
console
.
log
(
actType
);
// switch(actType){
// case CAT_ACTTYPEP.SLEEP:
// break;
// case CAT_ACTTYPEP.TALK:
// break;
// case CAT_ACTTYPEP.CLEAR:
// break;
// case CAT_ACTTYPEP.RUA:
// break;
// case CAT_ACTTYPEP.PLAY:
// break;
// case CAT_ACTTYPEP.TOUCH:
// break;
// }
this
.
actRunning
=
true
;
sendTbNet
(
TbNetName
.
interaction
,
{},
(
s
,
r
)
=>
{
if
(
s
)
{
that
.
actRunning
=
true
;
switch
(
actType
)
{
case
CAT_ACTTYPEP
.
SLEEP
:
break
;
...
...
@@ -168,6 +158,12 @@ export class Cat extends Module {
that
.
setCatAnimShow
(
actType
,
()
=>
{
that
.
setCatAnimShow
(
0
,
null
)
});
break
;
}
}
else
{
FYGE
.
GDispatcher
.
dispatchEvent
(
"23"
,
r
.
message
)
}
})
}
...
...
project/src/canvas/game/src/scenes/MainScene.ts
View file @
a6ff0b94
...
...
@@ -45,6 +45,7 @@ export class MainScene extends Scene{
var
that
=
this
;
that
.
x
=
(
Ins
.
stageW
-
750
)
>>
1
;
that
.
y
=
(
Ins
.
stageH
-
1624
)
>>
1
;
console
.
log
(
that
.
y
);
that
.
mouseChildren
=
true
;
//0:教室,1:操场,2:寝室
that
.
bgUUID
=
[
"c6d699b0-b276-4985-b3ea-47bcef13f2ea"
,
"efaf990e-5392-49ad-94d8-25c04f651ede"
,
"b3c8c187-e5c9-4968-9a00-a118d18ab2fc"
];
...
...
@@ -88,6 +89,12 @@ export class MainScene extends Scene{
that
.
energyGroup
.
addChild
(
that
.
energyImg
);
that
.
energyDeco
=
Ins
.
initSprite
(
"0eb9c19f-248e-4bf1-bffb-ea694a94b16f"
,
541
,
-
9
);
that
.
energyGroup
.
addChild
(
that
.
energyDeco
);
that
.
energyDialog
=
Ins
.
initSprite
(
"69009eb9-4593-4a43-a9d7-a6356ebd6d04"
,
174
,
-
60
);
that
.
energyGroup
.
addChild
(
that
.
energyDialog
);
that
.
energyDialogLabel
=
Ins
.
initLabel
({
size
:
26
,
text
:
"每5分钟恢复10点精力"
});
that
.
energyDialog
.
addChild
(
that
.
energyDialogLabel
);
that
.
energyDialogLabel
.
x
=
(
that
.
energyDialog
.
width
-
that
.
energyDialogLabel
.
textWidth
)
*
0.5
;
that
.
energyDialogLabel
.
y
=
(
that
.
energyDialog
.
height
-
that
.
energyDialogLabel
.
textHeight
)
*
0.5
-
2
;
var
mask
=
new
FYGE
.
Shape
();
mask
.
beginFill
(
6
,
1
);
mask
.
drawRoundedRect
(
0
,
0
,
that
.
energyImg
.
width
,
that
.
energyImg
.
height
,
38
,
38
,
38
,
38
);
...
...
project/src/canvas/game/src/scenes/StartScene.ts
View file @
a6ff0b94
...
...
@@ -5,8 +5,9 @@ import Root from "./Root";
import
resCanvasList
from
"../../../game/resCanvasList"
import
{
MainScene
}
from
"./MainScene"
;
import
{
Ins
}
from
"../Ins"
;
import
{
showPanel
}
from
"../../module/ctrls"
;
import
{
showPanel
,
showToast
}
from
"../../module/ctrls"
;
import
{
SelectCatPanel
}
from
"../panels/selectcatpanel/SelectCatPanel"
;
import
{
sendTbNet
,
TbNetName
}
from
"../TaoBaoNet"
;
export
class
StartScene
extends
Scene
{
initUi
()
{
super
.
initUi
();
...
...
@@ -15,7 +16,21 @@ export class StartScene extends Scene {
this
.
x
=
(
Ins
.
stageW
-
750
)
>>
1
;
this
.
y
=
(
Ins
.
stageH
-
1624
)
>>
1
;
sendTbNet
(
TbNetName
.
getUserInfo
,{},(
s
,
r
)
=>
{
if
(
s
){
if
(
r
.
data
){
Ins
.
userInfo
=
r
.
data
;
this
.
addChild
(
new
MainScene
());
}
else
{
showPanel
(
SelectCatPanel
);
}
}
else
{
showToast
(
r
.
message
)
}
})
// this.addChild(new MainScene());
}
...
...
project/src/canvas/game/src/ui/MainSceneBtnUi.ts
View file @
a6ff0b94
...
...
@@ -153,6 +153,7 @@ export class MainSceneBtnUi extends Module {
touchHandler
(
e
:
FYGE
.
MouseEvent
)
{
console
.
log
(
e
.
target
);
var
that
=
this
;
that
.
btnDelay
(
e
.
target
);
if
(
e
.
target
==
that
.
returnBtn
)
{
that
.
returnBedRoom
();
}
else
{
...
...
taobao_mini/client/pages/pagecanvas/output.js
View file @
a6ff0b94
...
...
@@ -683,6 +683,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
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;
...
...
@@ -694,7 +696,7 @@ var initToast = function () {
_toast = new Toast();
_parent = layers_1.layers.toastLayer;
_toast.alpha = 0;
_toast.x =
layers_1.layers.stageOffsetX - _parent.x +
(layers_1.layers.stageWidth - _toast.width) / 2;
_toast.x = (layers_1.layers.stageWidth - _toast.width) / 2;
var h = _toast.height;
var y = layers_1.layers.stageOffsetY - _parent.y;
startY = y - h;
...
...
@@ -702,6 +704,7 @@ var initToast = function () {
}
};
exports.showToast = function (msg) {
if (msg === void 0) { msg = "网络异常,请稍后重试~"; }
initToast();
_toast.show(msg);
_parent.addChild(_toast);
...
...
@@ -730,9 +733,10 @@ var Toast = (function (_super) {
_this.PADDING = 40;
_this.mouseChildren = false;
_this.mouseEnable = false;
var toastBgTexture = RES_1.RES.getRes(
"toastBg.png"
);
var toastBgTexture = RES_1.RES.getRes(
resCanvasList_js_1.default["0cc64b0c-3ccc-4d88-b697-bb402319cef7"].url
);
if (toastBgTexture) {
_this.bg = new FYGE.Sprite(toastBgTexture);
_this.bg.x = (layers_1.layers.stageWidth - _this.bg.width) / 2;
_this.addChild(_this.bg);
}
_this.msg = new FYGE.TextField();
...
...
@@ -747,7 +751,9 @@ var Toast = (function (_super) {
}
Toast.prototype.show = function (msg) {
this.msg.text = msg;
this.msg.x = ((this.bg ? this.bg.width : 0) - this.msg.textWidth) / 2;
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);
...
...
@@ -1858,6 +1864,12 @@ const resCanvasList = {
ext: '.jpg',
url: 'https://yun.duiba.com.cn/spark/assets/寝室1.e9238ec5e71c328817026128dd0f41fdc65203f4.jpg',
uuid: 'b3c8c187-e5c9-4968-9a00-a118d18ab2fc'
},
'0cc64b0c-3ccc-4d88-b697-bb402319cef7': {
name: 'ToastBg',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/ToastBg.81e208c0050ce46ac576ba881d02db07a02bffe2.png',
uuid: '0cc64b0c-3ccc-4d88-b697-bb402319cef7'
}
};
/* harmony default export */ __webpack_exports__["default"] = (resCanvasList);
...
...
@@ -1975,6 +1987,7 @@ var MSG;
MSG["CHANGE_SCENE"] = "CHANGE_SCENE";
MSG["SELECT_CAT"] = "SELECT_CAT";
MSG["CAT_ACT"] = "CAT_ACT";
MSG["UPDATE_USERINFO"] = "UPDATE_USERINFO";
})(MSG = exports.MSG || (exports.MSG = {}));
var CATTYPE;
(function (CATTYPE) {
...
...
@@ -2264,6 +2277,8 @@ var TbNetName;
(function (TbNetName) {
TbNetName["navigateToPage"] = "mine.navigateToPage";
TbNetName["showModal"] = "mine.showModal";
TbNetName["getUserInfo"] = "tmallCat.getUserInfo";
TbNetName["interaction"] = "tamllCat.interaction";
TbNetName["trackingReport"] = "squirrelsAdoptRest2c.trackingReport";
TbNetName["getActivityBaseInfoById"] = "bubbleSurviva.getActivityBaseInfoById";
TbNetName["getGameInfo"] = "babycare.getGameInfo";
...
...
@@ -2444,6 +2459,7 @@ var xianluomao01_1 = __webpack_require__(/*! ../lottieSrc/lottieTs/xianluoCat/xi
var xianluoshuohua_1 = __webpack_require__(/*! ../lottieSrc/lottieTs/xianluoCat/xianluoshuohua */ "./src/lottieSrc/lottieTs/xianluoCat/xianluoshuohua.ts");
var Enum_1 = __webpack_require__(/*! ../Enum */ "./src/Enum.ts");
var Ins_1 = __webpack_require__(/*! ../Ins */ "./src/Ins.ts");
var TaoBaoNet_1 = __webpack_require__(/*! ../TaoBaoNet */ "./src/TaoBaoNet.ts");
var Cat = (function (_super) {
__extends(Cat, _super);
function Cat(data) {
...
...
@@ -2543,7 +2559,9 @@ var Cat = (function (_super) {
var that = this;
var actType = e.data;
console.log(actType);
this.actRunning = true;
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.interaction, {}, function (s, r) {
if (s) {
that.actRunning = true;
switch (actType) {
case Enum_1.CAT_ACTTYPEP.SLEEP:
break;
...
...
@@ -2551,6 +2569,11 @@ var Cat = (function (_super) {
that.setCatAnimShow(actType, function () { that.setCatAnimShow(0, null); });
break;
}
}
else {
FYGE.GDispatcher.dispatchEvent("23", r.message);
}
});
};
Cat.prototype.initEvents = function () {
FYGE.GDispatcher.addEventListener(Enum_1.MSG.CAT_ACT, this.catAct, this);
...
...
@@ -44748,6 +44771,7 @@ var MainSceneBtnUi = (function (_super) {
MainSceneBtnUi.prototype.touchHandler = function (e) {
console.log(e.target);
var that = this;
that.btnDelay(e.target);
if (e.target == that.returnBtn) {
that.returnBedRoom();
}
taobao_mini/client/pages/pagecanvas/pagecanvas.js
View file @
a6ff0b94
'use strict'
;
import
{
Main
}
from
'./output'
;
import
{
Main
}
from
'./output'
;
import
API
from
'../../api'
;
const
app
=
getApp
();
const
{
tbcc
}
=
app
;
const
{
commonToast
,
getAuthUserInfo
,
navigateToOutside
,
getSystemInfo
}
=
tbcc
.
tb
;
const
{
tbcc
}
=
app
;
const
{
commonToast
,
getAuthUserInfo
,
navigateToOutside
,
getSystemInfo
}
=
tbcc
.
tb
;
const
checkSystem
=
async
()
=>
{
const
{
version
}
=
await
getSystemInfo
();
const
{
version
}
=
await
getSystemInfo
();
console
.
log
(
'version'
,
version
);
return
tbcc
.
utils
.
versionCompare
(
version
,
'9.8.0'
);
}
...
...
@@ -60,6 +71,7 @@ Page({
app
.
canvasMain
=
this
.
main
;
this
.
main
.
addGlobalEvent
(
"onMessage"
,
self
.
onMessage
,
self
);
this
.
main
.
addGlobalEvent
(
"showToast"
,
self
.
showToast
,
self
);
}
}
});
...
...
@@ -75,6 +87,13 @@ Page({
});
},
showToast
(
e
)
{
my
.
showToast
({
content
:
e
.
data
||
"网络异常,请稍后重试~"
,
duration
:
2000
});
},
postMessage
(
netName
,
data
)
{
this
.
main
.
dispatchGlobalEvent
({
type
:
netName
...
...
@@ -108,16 +127,22 @@ Page({
};
break
;
case
"mine.navigateToPage"
:
//切换page
data
=
{
success
:
true
,
data
:
{}
};
data
=
{
success
:
true
,
data
:
{}
};
my
.
navigateTo
({
url
:
`/pages/
${
parameter
.
name
}
/
${
parameter
.
name
}
`
});
break
;
case
"mine.showModal"
:
//切换page
data
=
{
success
:
true
,
data
:
{}
};
data
=
{
success
:
true
,
data
:
{}
};
const
key
=
`
${
parameter
.
name
}
Visible`
;
const
toSetData
=
{};
toSetData
[
key
]
=
true
;
toSetData
[
key
]
=
true
;
this
.
setData
(
toSetData
);
break
;
case
'test'
:
...
...
@@ -169,7 +194,10 @@ Page({
});
if
(
userInfo
)
{
console
.
log
(
'userInfo'
,
userInfo
);
const
{
nickName
,
avatar
}
=
userInfo
;
const
{
nickName
,
avatar
}
=
userInfo
;
app
.
nickName
=
nickName
;
app
.
avatar
=
avatar
;
this
.
login
();
...
...
@@ -179,8 +207,16 @@ Page({
* 登录接口
*/
async
login
()
{
const
{
nickName
,
avatar
}
=
app
;
const
{
success
}
=
await
API
.
login
({
userNick
:
nickName
,
avatar
}).
catch
(
res
=>
{
const
{
nickName
,
avatar
}
=
app
;
const
{
success
}
=
await
API
.
login
({
userNick
:
nickName
,
avatar
}).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
);
})
||
{};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment