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
9fcc7d37
Commit
9fcc7d37
authored
Sep 22, 2020
by
wildfirecode13
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tianmaoxiaoyuan' of gitlab2.dui88.com:wanghongyuan/new_taobao into tianmaoxiaoyuan
parents
a7e61245
6c928df7
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
559 additions
and
116 deletions
+559
-116
tamllCat.interaction.json
...ect/src/canvas/game/mock/miniTb/tamllCat.interaction.json
+1
-1
tmallCat.getUserInfo.json
...ect/src/canvas/game/mock/miniTb/tmallCat.getUserInfo.json
+5
-5
resCanvasList.js
project/src/canvas/game/resCanvasList.js
+14
-2
resLottieList.js
project/src/canvas/game/resLottieList.js
+5
-0
Ins.ts
project/src/canvas/game/src/Ins.ts
+6
-3
Main.ts
project/src/canvas/game/src/Main.ts
+6
-6
Cat.ts
project/src/canvas/game/src/cat/Cat.ts
+3
-1
LetterTexture.json
...s/game/src/lottieSrc/lottieTextureJson/LetterTexture.json
+46
-0
letter.ts
project/src/canvas/game/src/lottieSrc/lottieTs/letter.ts
+232
-0
SelectCatPanel.ts
...c/canvas/game/src/panels/selectcatpanel/SelectCatPanel.ts
+1
-1
MainScene.ts
project/src/canvas/game/src/scenes/MainScene.ts
+130
-61
StartScene.ts
project/src/canvas/game/src/scenes/StartScene.ts
+8
-2
MainSceneBtnUi.ts
project/src/canvas/game/src/ui/MainSceneBtnUi.ts
+102
-34
No files found.
project/src/canvas/game/mock/miniTb/tamllCat.interaction.json
View file @
9fcc7d37
{
{
"success"
:
fals
e
,
"success"
:
tru
e
,
"message"
:
"请稍后重试"
,
"message"
:
"请稍后重试"
,
"data"
:
"aaaa"
,
"data"
:
"aaaa"
,
"code"
:
"000"
"code"
:
"000"
...
...
project/src/canvas/game/mock/miniTb/tmallCat.getUserInfo.json
View file @
9fcc7d37
...
@@ -4,12 +4,12 @@
...
@@ -4,12 +4,12 @@
"data"
:
{
"data"
:
{
"catType"
:
1
,
"catType"
:
1
,
"userNick"
:
"Edwise"
,
"userNick"
:
"Edwise"
,
"energy"
:
"100"
,
"energy"
:
1000
,
"happyCoin"
:
"1000"
,
"happyCoin"
:
1000
,
"experience"
:
"50"
,
"experience"
:
50
,
"level"
:
"1"
,
"level"
:
"1"
,
"avatar"
:
"https://yun.duiba.com.cn/spark/assets/
b1992c528b36c2d26942e9c83941242e59481475
.png"
,
"avatar"
:
"https://yun.duiba.com.cn/spark/assets/
a3ae99684afa9a1f8d94f4c95ee6f1ed81de9996
.png"
,
"sence"
:
1
,
"sence"
:
3
,
"catName"
:
"喵喵喵"
"catName"
:
"喵喵喵"
}
}
}
}
\ No newline at end of file
project/src/canvas/game/resCanvasList.js
View file @
9fcc7d37
...
@@ -632,14 +632,26 @@ const resCanvasList = {
...
@@ -632,14 +632,26 @@ const resCanvasList = {
'0cc64b0c-3ccc-4d88-b697-bb402319cef7'
:
{
'0cc64b0c-3ccc-4d88-b697-bb402319cef7'
:
{
name
:
'ToastBg'
,
name
:
'ToastBg'
,
ext
:
'.png'
,
ext
:
'.png'
,
url
:
'//yun.duiba.com.cn/spark/assets/ToastBg.81e208c0050ce46ac576ba881d02db07a02bffe2.png'
,
url
:
'
https:
//yun.duiba.com.cn/spark/assets/ToastBg.81e208c0050ce46ac576ba881d02db07a02bffe2.png'
,
uuid
:
'0cc64b0c-3ccc-4d88-b697-bb402319cef7'
uuid
:
'0cc64b0c-3ccc-4d88-b697-bb402319cef7'
},
},
'69009eb9-4593-4a43-a9d7-a6356ebd6d04'
:
{
'69009eb9-4593-4a43-a9d7-a6356ebd6d04'
:
{
name
:
'精力条对话框'
,
name
:
'精力条对话框'
,
ext
:
'.png'
,
ext
:
'.png'
,
url
:
'//yun.duiba.com.cn/spark/assets/精力条对话框.da8e059d18cf967026989e3c376b7364210c3d4e.png'
,
url
:
'
https:
//yun.duiba.com.cn/spark/assets/精力条对话框.da8e059d18cf967026989e3c376b7364210c3d4e.png'
,
uuid
:
'69009eb9-4593-4a43-a9d7-a6356ebd6d04'
uuid
:
'69009eb9-4593-4a43-a9d7-a6356ebd6d04'
},
'72345190-f95b-4152-bccf-393b8a5aa8d0'
:
{
name
:
'召回猫咪icon'
,
ext
:
'.png'
,
url
:
'https://yun.duiba.com.cn/spark/assets/召回猫咪icon.41d0b6bb23a7eccf0facb8918cfb679239b7f82f.png'
,
uuid
:
'72345190-f95b-4152-bccf-393b8a5aa8d0'
},
'3b12798d-d932-4f5b-a442-6e4877ba5c16'
:
{
name
:
'LetterTexture'
,
ext
:
'.png'
,
url
:
'https://yun.duiba.com.cn/spark/assets/LetterTexture.78192e79fa3b21a85b245038f23561eeb5141d4d.png'
,
uuid
:
'3b12798d-d932-4f5b-a442-6e4877ba5c16'
}
}
};
};
export
default
resCanvasList
;
export
default
resCanvasList
;
project/src/canvas/game/resLottieList.js
View file @
9fcc7d37
...
@@ -3,6 +3,7 @@ const BlueCatTexture = require("./src/lottieSrc/lottieTextureJson/BlueCatTexture
...
@@ -3,6 +3,7 @@ const BlueCatTexture = require("./src/lottieSrc/lottieTextureJson/BlueCatTexture
const
OrengeCatTexture
=
require
(
"./src/lottieSrc/lottieTextureJson/OrengeCatTexture.json"
)
const
OrengeCatTexture
=
require
(
"./src/lottieSrc/lottieTextureJson/OrengeCatTexture.json"
)
const
SanhuaCatTexture
=
require
(
"./src/lottieSrc/lottieTextureJson/SanhuaCatTexture.json"
)
const
SanhuaCatTexture
=
require
(
"./src/lottieSrc/lottieTextureJson/SanhuaCatTexture.json"
)
const
XianluoCatTexture
=
require
(
"./src/lottieSrc/lottieTextureJson/XianluoCatTexture.json"
)
const
XianluoCatTexture
=
require
(
"./src/lottieSrc/lottieTextureJson/XianluoCatTexture.json"
)
const
LetterTexture
=
require
(
"./src/lottieSrc/lottieTextureJson/LetterTexture.json"
)
const
resLottieList
=
{
const
resLottieList
=
{
"blueCat"
:{
"blueCat"
:{
imgUrl
:
resCanvasList
[
"a7dc39fa-5f6d-4e94-8979-81c4a4aa183f"
].
url
,
imgUrl
:
resCanvasList
[
"a7dc39fa-5f6d-4e94-8979-81c4a4aa183f"
].
url
,
...
@@ -19,6 +20,10 @@ const resLottieList = {
...
@@ -19,6 +20,10 @@ const resLottieList = {
"xianluoCat"
:{
"xianluoCat"
:{
imgUrl
:
resCanvasList
[
"de2d1dca-ed1c-4fe0-93ef-684f4b96c87e"
].
url
,
imgUrl
:
resCanvasList
[
"de2d1dca-ed1c-4fe0-93ef-684f4b96c87e"
].
url
,
json
:
XianluoCatTexture
json
:
XianluoCatTexture
},
"letter"
:{
imgUrl
:
resCanvasList
[
"3b12798d-d932-4f5b-a442-6e4877ba5c16"
].
url
,
json
:
LetterTexture
}
}
}
}
export
default
resLottieList
;
export
default
resLottieList
;
\ No newline at end of file
project/src/canvas/game/src/Ins.ts
View file @
9fcc7d37
...
@@ -7,13 +7,16 @@ export class Ins {
...
@@ -7,13 +7,16 @@ export class Ins {
public
static
stageW
:
number
;
public
static
stageW
:
number
;
public
static
stageH
:
number
;
public
static
stageH
:
number
;
/**猫咪是否出寝了 */
public
static
catIsOut
:
boolean
;
public
static
userInfo
:
{
public
static
userInfo
:
{
"catName"
:
string
,
//猫咪姓名
"catName"
:
string
,
//猫咪姓名
"catType"
:
string
,
//猫咪类型
"catType"
:
string
,
//猫咪类型
"userNick"
:
string
,
//用户昵称
"userNick"
:
string
,
//用户昵称
"energy"
:
string
,
//精力值
"energy"
:
number
,
//精力值
"happyCoin"
:
string
,
//欢乐币
"happyCoin"
:
number
,
//欢乐币
"experience"
:
string
,
//经验值
"experience"
:
number
,
//经验值
"level"
:
string
,
//等级
"level"
:
string
,
//等级
"avatar"
:
string
,
//头像
"avatar"
:
string
,
//头像
"sence"
:
number
,
//场景
"sence"
:
number
,
//场景
...
...
project/src/canvas/game/src/Main.ts
View file @
9fcc7d37
...
@@ -114,12 +114,12 @@ export class Main {
...
@@ -114,12 +114,12 @@ export class Main {
sendTbNet
(
TbNetName
.
getActivityBaseInfoById
,
{},
(
s
,
res
)
=>
{
sendTbNet
(
TbNetName
.
getActivityBaseInfoById
,
{},
(
s
,
res
)
=>
{
console
.
log
(
'getActivityBaseInfoById success,res'
,
s
,
res
)
console
.
log
(
'getActivityBaseInfoById success,res'
,
s
,
res
)
})
})
console
.
log
(
'准备打开弹窗'
)
//
console.log('准备打开弹窗')
setTimeout
(()
=>
{
//
setTimeout(() => {
sendTbNet
(
TbNetName
.
showModal
,
{
name
:
'ruleModal'
},
(
s
,
res
)
=>
{
//
sendTbNet(TbNetName.showModal, {name:'ruleModal'}, (s, res) => {
console
.
log
(
'showModal ruleModal, success,res'
,
s
,
res
)
//
console.log('showModal ruleModal, success,res',s,res)
})
//
})
},
3000
);
//
}, 3000);
// console.log('准备切换到兑换页面')
// console.log('准备切换到兑换页面')
// setTimeout(() => {
// setTimeout(() => {
// sendTbNet(TbNetName.navigateToPage, {name:'pageshop'}, (s, res) => {
// sendTbNet(TbNetName.navigateToPage, {name:'pageshop'}, (s, res) => {
...
...
project/src/canvas/game/src/cat/Cat.ts
View file @
9fcc7d37
...
@@ -150,6 +150,7 @@ export class Cat extends Module {
...
@@ -150,6 +150,7 @@ export class Cat extends Module {
console
.
log
(
actType
);
console
.
log
(
actType
);
sendTbNet
(
TbNetName
.
interaction
,
{},
(
s
,
r
)
=>
{
sendTbNet
(
TbNetName
.
interaction
,
{},
(
s
,
r
)
=>
{
if
(
s
)
{
if
(
s
)
{
FYGE
.
GDispatcher
.
dispatchEvent
(
MSG
.
UPDATE_USERINFO
);
that
.
actRunning
=
true
;
that
.
actRunning
=
true
;
switch
(
actType
)
{
switch
(
actType
)
{
case
CAT_ACTTYPEP
.
SLEEP
:
case
CAT_ACTTYPEP
.
SLEEP
:
...
@@ -160,7 +161,8 @@ export class Cat extends Module {
...
@@ -160,7 +161,8 @@ export class Cat extends Module {
}
}
}
else
}
else
{
{
FYGE
.
GDispatcher
.
dispatchEvent
(
"23"
,
r
.
message
)
// FYGE.GDispatcher.dispatchEvent("23",r.message)
showToast
(
r
.
message
)
}
}
})
})
...
...
project/src/canvas/game/src/lottieSrc/lottieTextureJson/LetterTexture.json
0 → 100644
View file @
9fcc7d37
{
"1085e1ca-a5a5-4e1c-9917-fb27efa359f7.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
299
,
"h"
:
175
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
299
,
"sh"
:
175
,
"ro"
:
false
},
"eafa36c0-16e3-4112-b56e-a492a4899a5f.png"
:
{
"x"
:
2
,
"y"
:
179
,
"w"
:
298
,
"h"
:
243
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
298
,
"sh"
:
243
,
"ro"
:
true
},
"6612ca2f-948b-49a3-982f-250e4cd9c635.png"
:
{
"x"
:
247
,
"y"
:
179
,
"w"
:
249
,
"h"
:
215
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
249
,
"sh"
:
215
,
"ro"
:
false
},
"798dbdf0-d769-4d22-baaf-b811eb29db30.png"
:
{
"x"
:
2
,
"y"
:
479
,
"w"
:
187
,
"h"
:
24
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
187
,
"sh"
:
24
,
"ro"
:
false
}
}
\ No newline at end of file
project/src/canvas/game/src/lottieSrc/lottieTs/letter.ts
0 → 100644
View file @
9fcc7d37
export
const
letter
=
{
"v"
:
"5.6.10"
,
"fr"
:
30
,
"ip"
:
0
,
"op"
:
17
,
"w"
:
750
,
"h"
:
1624
,
"nm"
:
"底"
,
"layers"
:
[
{
"ind"
:
1
,
"ty"
:
2
,
"nm"
:
"点击信封打开看看"
,
"refId"
:
"798dbdf0-d769-4d22-baaf-b811eb29db30"
,
"ks"
:
{
"o"
:
{
"a"
:
1
,
"k"
:
[
{
"t"
:
0
,
"s"
:
[
100
]
},
{
"t"
:
7
,
"s"
:
[
100
]
},
{
"t"
:
8
,
"s"
:
[
0
]
},
{
"t"
:
15
,
"s"
:
[
0
]
},
{
"t"
:
16
,
"s"
:
[
100
]
}
]
},
"r"
:
{
"a"
:
0
,
"k"
:
0
},
"p"
:
{
"a"
:
0
,
"k"
:
[
383.5
,
1003
,
0
]
},
"a"
:
{
"a"
:
0
,
"k"
:
[
93.5
,
12
,
0
]
},
"s"
:
{
"a"
:
0
,
"k"
:
[
100
,
100
,
100
]
}
},
"ip"
:
0
,
"op"
:
600
},
{
"ind"
:
3
,
"ty"
:
2
,
"nm"
:
"上"
,
"refId"
:
"1085e1ca-a5a5-4e1c-9917-fb27efa359f7"
,
"ks"
:
{
"o"
:
{
"a"
:
0
,
"k"
:
100
},
"r"
:
{
"a"
:
0
,
"k"
:
0
},
"p"
:
{
"a"
:
0
,
"k"
:
[
388.5
,
887.5
,
0
]
},
"a"
:
{
"a"
:
0
,
"k"
:
[
149.5
,
87.5
,
0
]
},
"s"
:
{
"a"
:
0
,
"k"
:
[
100
,
100
,
100
]
}
},
"ip"
:
0
,
"op"
:
600
},
{
"ind"
:
4
,
"ty"
:
2
,
"nm"
:
"字条"
,
"refId"
:
"6612ca2f-948b-49a3-982f-250e4cd9c635"
,
"ks"
:
{
"o"
:
{
"a"
:
0
,
"k"
:
100
},
"r"
:
{
"a"
:
0
,
"k"
:
0
},
"p"
:
{
"a"
:
1
,
"k"
:
[
{
"t"
:
0
,
"s"
:
[
388.5
,
866.5
,
0
]
},
{
"t"
:
8
,
"s"
:
[
388.5
,
859.5
,
0
]
},
{
"t"
:
16
,
"s"
:
[
388.5
,
866.5
,
0
]
}
]
},
"a"
:
{
"a"
:
0
,
"k"
:
[
124.5
,
107.5
,
0
]
},
"s"
:
{
"a"
:
0
,
"k"
:
[
100
,
100
,
100
]
}
},
"ip"
:
0
,
"op"
:
600
},
{
"ind"
:
5
,
"ty"
:
2
,
"nm"
:
"下"
,
"refId"
:
"eafa36c0-16e3-4112-b56e-a492a4899a5f"
,
"ks"
:
{
"o"
:
{
"a"
:
0
,
"k"
:
100
},
"r"
:
{
"a"
:
0
,
"k"
:
0
},
"p"
:
{
"a"
:
0
,
"k"
:
[
390
,
835.5
,
0
]
},
"a"
:
{
"a"
:
0
,
"k"
:
[
149
,
121.5
,
0
]
},
"s"
:
{
"a"
:
0
,
"k"
:
[
100
,
100
,
100
]
}
},
"ip"
:
0
,
"op"
:
600
}
],
"markers"
:
[]
}
\ No newline at end of file
project/src/canvas/game/src/panels/selectcatpanel/SelectCatPanel.ts
View file @
9fcc7d37
...
@@ -19,7 +19,7 @@ export class SelectCatPanel extends Panel {
...
@@ -19,7 +19,7 @@ export class SelectCatPanel extends Panel {
var
bg
=
Ins
.
initSprite
(
"db53267d-4141-4d3e-afda-9b523c89be3e"
);
var
bg
=
Ins
.
initSprite
(
"db53267d-4141-4d3e-afda-9b523c89be3e"
);
that
.
addChild
(
bg
);
that
.
addChild
(
bg
);
that
.
x
=
(
Ins
.
stageW
-
bg
.
width
)
>>
1
;
that
.
x
=
(
Ins
.
stageW
-
bg
.
width
)
>>
1
;
that
.
y
=
Ins
.
stageH
<
1624
?
(
Ins
.
stageH
-
bg
.
height
+
300
)
>>
1
:
(
Ins
.
stageH
-
bg
.
height
)
>>
1
;
that
.
y
=
(
Ins
.
stageH
-
bg
.
height
)
>>
1
;
that
.
selectSureBtn
=
Ins
.
initSprite
(
"628fc38b-7dc0-4c69-aac1-279d60c8f1ed"
,
185
,
804
);
that
.
selectSureBtn
=
Ins
.
initSprite
(
"628fc38b-7dc0-4c69-aac1-279d60c8f1ed"
,
185
,
804
);
that
.
addChild
(
that
.
selectSureBtn
);
that
.
addChild
(
that
.
selectSureBtn
);
...
...
project/src/canvas/game/src/scenes/MainScene.ts
View file @
9fcc7d37
...
@@ -7,65 +7,68 @@ import { MSG, SCENETYPE } from "../Enum";
...
@@ -7,65 +7,68 @@ import { MSG, SCENETYPE } from "../Enum";
import
{
showToast
}
from
"../../module/ctrls"
;
import
{
showToast
}
from
"../../module/ctrls"
;
import
{
GDispatcher
}
from
"../Main"
;
import
{
GDispatcher
}
from
"../Main"
;
import
{
Cat
}
from
"../cat/Cat"
;
import
{
Cat
}
from
"../cat/Cat"
;
import
{
sendTbNet
,
TbNetName
}
from
"../TaoBaoNet"
;
import
{
letter
}
from
"../lottieSrc/lottieTs/letter"
;
export
class
MainScene
extends
Scene
{
export
class
MainScene
extends
Scene
{
/**场景背景 */
/**场景背景 */
private
sceneBg
:
FYGE
.
Sprite
;
private
sceneBg
:
FYGE
.
Sprite
;
/**场景背景纹理 */
/**场景背景纹理 */
private
bgTexture
:
FYGE
.
Texture
;
private
bgTexture
:
FYGE
.
Texture
;
/**场景背景uuid组 */
/**场景背景uuid组 */
private
bgUUID
:
string
[]
=
[];
private
bgUUID
:
string
[]
=
[];
/**主页面UI */
/**主页面UI */
private
mainUi
:
MainSceneBtnUi
;
private
mainUi
:
MainSceneBtnUi
;
/**台历按钮,进入教室 */
/**台历按钮,进入教室 */
private
tlBtn
:
FYGE
.
Sprite
;
private
tlBtn
:
FYGE
.
Sprite
;
/**毛线球按钮,进入操场 */
/**毛线球按钮,进入操场 */
private
mxqBtn
:
FYGE
.
Sprite
;
private
mxqBtn
:
FYGE
.
Sprite
;
/**猫猫 */
/**猫猫 */
private
cat
:
Cat
;
private
cat
:
Cat
;
/**信封 */
/**信封 */
private
letter
:
FYGE
.
Lottie
;
private
letter
:
FYGE
.
Lottie
;
/**精力条组 */
/**精力条组 */
private
energyGroup
:
FYGE
.
Sprite
;
//精力条组/背景
private
energyGroup
:
FYGE
.
Sprite
;
//精力条组/背景
private
energyImg
:
FYGE
.
Sprite
;
//精力条图片
private
energyImg
:
FYGE
.
Sprite
;
//精力条图片
private
energyDeco
:
FYGE
.
Sprite
;
//精力条装饰品,就是那个可爱的猫爪子
private
energyDeco
:
FYGE
.
Sprite
;
//精力条装饰品,就是那个可爱的猫爪子
private
energyLabel
:
FYGE
.
TextField
;
//精力条文本,精力条下方的文本x/xxx
private
energyLabel
:
FYGE
.
TextField
;
//精力条文本,精力条下方的文本x/xxx
private
energyDialog
:
FYGE
.
Sprite
;
//精力条上方的气泡
private
energyDialog
:
FYGE
.
Sprite
;
//精力条上方的气泡
private
energyDialogLabel
:
FYGE
.
TextField
;
//精力条上方气泡中的文字
private
energyDialogLabel
:
FYGE
.
TextField
;
//精力条上方气泡中的文字
private
energy
:
number
;
//当前精力值
private
energy
:
number
;
//当前精力值
private
energyImgW
:
number
;
//精力条宽度
private
energyImgW
:
number
;
//精力条宽度
private
maxEnergy
:
number
=
1500
;
//最大精力值
initUi
(){
initUi
()
{
var
that
=
this
;
var
that
=
this
;
that
.
initSceneEle
();
that
.
initSceneEle
();
}
}
/**初始化场景元素 */
/**初始化场景元素 */
initSceneEle
(){
initSceneEle
()
{
var
that
=
this
;
var
that
=
this
;
that
.
x
=
(
Ins
.
stageW
-
750
)
>>
1
;
that
.
x
=
(
Ins
.
stageW
-
750
)
>>
1
;
that
.
y
=
(
Ins
.
stageH
-
1624
)
>>
1
;
that
.
y
=
(
Ins
.
stageH
-
1624
)
>>
1
;
console
.
log
(
that
.
y
);
console
.
log
(
that
.
y
);
that
.
mouseChildren
=
true
;
that
.
mouseChildren
=
true
;
//0:教室,1:操场,2:寝室
//0:教室,1:操场,2:寝室
that
.
bgUUID
=
[
"c6d699b0-b276-4985-b3ea-47bcef13f2ea"
,
"efaf990e-5392-49ad-94d8-25c04f651ede"
,
"b3c8c187-e5c9-4968-9a00-a118d18ab2fc"
];
that
.
bgUUID
=
[
"c6d699b0-b276-4985-b3ea-47bcef13f2ea"
,
"efaf990e-5392-49ad-94d8-25c04f651ede"
,
"b3c8c187-e5c9-4968-9a00-a118d18ab2fc"
];
//生成默认场景,后面要改成根据接口值判断
//生成默认场景,后面要改成根据接口值判断
that
.
sceneBg
=
Ins
.
initSprite
(
"b3c8c187-e5c9-4968-9a00-a118d18ab2fc"
);
that
.
sceneBg
=
Ins
.
initSprite
(
"b3c8c187-e5c9-4968-9a00-a118d18ab2fc"
);
that
.
addChild
(
that
.
sceneBg
);
that
.
addChild
(
that
.
sceneBg
);
that
.
tlBtn
=
Ins
.
initSprite
(
"1f8b040d-2fbc-4ff8-92f9-159773364fae"
,
0
,
640
);
that
.
tlBtn
=
Ins
.
initSprite
(
"1f8b040d-2fbc-4ff8-92f9-159773364fae"
,
0
,
640
);
that
.
tlBtn
.
alpha
=
0.1
;
that
.
tlBtn
.
alpha
=
0.1
;
that
.
tlBtn
.
mouseEnable
=
true
;
that
.
tlBtn
.
mouseEnable
=
true
;
that
.
addChild
(
that
.
tlBtn
);
that
.
addChild
(
that
.
tlBtn
);
that
.
mxqBtn
=
Ins
.
initSprite
(
"1f8b040d-2fbc-4ff8-92f9-159773364fae"
,
50
,
940
);
that
.
mxqBtn
=
Ins
.
initSprite
(
"1f8b040d-2fbc-4ff8-92f9-159773364fae"
,
50
,
940
);
that
.
mxqBtn
.
width
=
80
;
that
.
mxqBtn
.
width
=
80
;
that
.
mxqBtn
.
height
=
80
;
that
.
mxqBtn
.
height
=
80
;
that
.
mxqBtn
.
alpha
=
0.1
;
that
.
mxqBtn
.
alpha
=
0.1
;
that
.
mxqBtn
.
mouseEnable
=
true
;
that
.
mxqBtn
.
mouseEnable
=
true
;
that
.
addChild
(
that
.
mxqBtn
);
that
.
addChild
(
that
.
mxqBtn
);
that
.
mainUi
=
new
MainSceneBtnUi
({
uiType
:
SCENETYPE
.
BEADROOM
});
that
.
mainUi
=
new
MainSceneBtnUi
({
uiType
:
SCENETYPE
.
BEADROOM
});
that
.
addChild
(
that
.
mainUi
);
that
.
addChild
(
that
.
mainUi
);
that
.
initCat
();
that
.
initCat
();
...
@@ -73,31 +76,58 @@ export class MainScene extends Scene{
...
@@ -73,31 +76,58 @@ export class MainScene extends Scene{
}
}
/**初始化猫咪 */
/**初始化猫咪 */
initCat
(){
initCat
()
{
var
that
=
this
;
var
that
=
this
;
that
.
cat
=
new
Cat
({
type
:
"xianluo"
});
that
.
cat
=
new
Cat
({
type
:
"xianluo"
});
that
.
addChild
(
that
.
cat
);
that
.
addChild
(
that
.
cat
);
if
(
Ins
.
catIsOut
)
{
that
.
cat
.
visible
=
false
;
//当猫出走的时候,隐藏猫咪,创建信封
that
.
letter
=
new
FYGE
.
Lottie
(
letter
);
that
.
addChild
(
that
.
letter
);
that
.
letter
.
play
();
}
}
/**打开信封 */
openLetter
()
{
console
.
log
(
"打开信封弹窗"
)
if
(
this
.
letter
&&
this
.
letter
.
visible
){
sendTbNet
(
TbNetName
.
showModal
,
{
name
:
'ruleModal'
},
(
s
,
res
)
=>
{
console
.
log
(
'showModal ruleModal, success,res'
,
s
,
res
)
})
}
}
/**删除信封 */
removeLetter
()
{
var
that
=
this
;
Ins
.
stopLottieAnim
(
that
.
letter
);
}
}
/**初始化精力组 */
/**初始化精力组 */
initEnergy
(){
initEnergy
()
{
var
that
=
this
;
var
that
=
this
;
that
.
energyGroup
=
Ins
.
initSprite
(
"fa59e617-f1d9-4065-85e1-6f6ebefb230f"
,
60
,
1119
);
that
.
energyGroup
=
Ins
.
initSprite
(
"fa59e617-f1d9-4065-85e1-6f6ebefb230f"
,
60
,
1119
);
that
.
energyGroup
.
mouseEnable
=
false
;
that
.
energyGroup
.
mouseChildren
=
false
;
that
.
addChild
(
that
.
energyGroup
);
that
.
addChild
(
that
.
energyGroup
);
that
.
energyImg
=
Ins
.
initSprite
(
"e00aee6d-2a90-4e92-b365-f031320d582c"
,
9
,
9
);
that
.
energyImg
=
Ins
.
initSprite
(
"e00aee6d-2a90-4e92-b365-f031320d582c"
,
9
,
9
);
that
.
energyImgW
=
that
.
energyImg
.
width
;
that
.
energyImgW
=
that
.
energyImg
.
width
;
that
.
energyGroup
.
addChild
(
that
.
energyImg
);
that
.
energyGroup
.
addChild
(
that
.
energyImg
);
that
.
energyDeco
=
Ins
.
initSprite
(
"0eb9c19f-248e-4bf1-bffb-ea694a94b16f"
,
541
,
-
9
);
that
.
energyDeco
=
Ins
.
initSprite
(
"0eb9c19f-248e-4bf1-bffb-ea694a94b16f"
,
541
,
-
9
);
that
.
energyGroup
.
addChild
(
that
.
energyDeco
);
that
.
energyGroup
.
addChild
(
that
.
energyDeco
);
that
.
energyDialog
=
Ins
.
initSprite
(
"69009eb9-4593-4a43-a9d7-a6356ebd6d04"
,
174
,
-
60
);
that
.
energyDialog
=
Ins
.
initSprite
(
"69009eb9-4593-4a43-a9d7-a6356ebd6d04"
,
174
,
-
60
);
that
.
energyGroup
.
addChild
(
that
.
energyDialog
);
that
.
energyGroup
.
addChild
(
that
.
energyDialog
);
that
.
energyDialogLabel
=
Ins
.
initLabel
({
size
:
26
,
text
:
"每5分钟恢复10点精力"
});
that
.
energyDialogLabel
=
Ins
.
initLabel
({
size
:
26
,
text
:
"每5分钟恢复10点精力"
});
that
.
energyDialog
.
addChild
(
that
.
energyDialogLabel
);
that
.
energyDialog
.
addChild
(
that
.
energyDialogLabel
);
that
.
energyDialogLabel
.
x
=
(
that
.
energyDialog
.
width
-
that
.
energyDialogLabel
.
textWidth
)
*
0.5
;
that
.
energyDialogLabel
.
x
=
(
that
.
energyDialog
.
width
-
that
.
energyDialogLabel
.
textWidth
)
*
0.5
;
that
.
energyDialogLabel
.
y
=
(
that
.
energyDialog
.
height
-
that
.
energyDialogLabel
.
textHeight
)
*
0.5
-
2
;
that
.
energyDialogLabel
.
y
=
(
that
.
energyDialog
.
height
-
that
.
energyDialogLabel
.
textHeight
)
*
0.5
-
2
;
that
.
energyLabel
=
Ins
.
initLabel
({
size
:
26
,
y
:
85
});
that
.
energyGroup
.
addChild
(
that
.
energyLabel
);
var
mask
=
new
FYGE
.
Shape
();
var
mask
=
new
FYGE
.
Shape
();
mask
.
beginFill
(
6
,
1
);
mask
.
beginFill
(
6
,
1
);
mask
.
drawRoundedRect
(
0
,
0
,
that
.
energyImg
.
width
,
that
.
energyImg
.
height
,
38
,
38
,
38
,
38
);
mask
.
drawRoundedRect
(
0
,
0
,
that
.
energyImg
.
width
,
that
.
energyImg
.
height
,
38
,
38
,
38
,
38
);
mask
.
endFill
();
mask
.
endFill
();
mask
.
x
=
9
;
mask
.
x
=
9
;
mask
.
y
=
9
;
mask
.
y
=
9
;
...
@@ -106,53 +136,92 @@ export class MainScene extends Scene{
...
@@ -106,53 +136,92 @@ export class MainScene extends Scene{
that
.
setEnergy
();
that
.
setEnergy
();
}
}
/**设置精力
条
*/
/**设置精力
组数据
*/
setEnergy
(){
setEnergy
()
{
var
that
=
this
;
var
that
=
this
;
that
.
energyImg
.
scaleX
=
0.5
;
that
.
energy
=
Ins
.
userInfo
.
energy
;
that
.
energyDeco
.
x
=
that
.
energyImgW
*
that
.
energyImg
.
scaleX
-
that
.
energyDeco
.
width
*
0.5
;
that
.
energyImg
.
scaleX
=
(
that
.
energy
/
that
.
maxEnergy
);
that
.
energyDeco
.
x
=
that
.
energyImgW
*
that
.
energyImg
.
scaleX
-
that
.
energyDeco
.
width
*
0.5
;
that
.
energyLabel
.
text
=
"精力"
+
that
.
energy
+
"/"
+
that
.
maxEnergy
;
that
.
energyLabel
.
x
=
(
that
.
energyGroup
.
width
-
that
.
energyLabel
.
textWidth
)
/
2
}
/**按照时间恢复精力 */
energyUp
()
{
}
}
/**切换场景 */
/**切换场景 */
changeMainScene
(
type
:
SCENETYPE
)
{
changeMainScene
(
type
:
SCENETYPE
)
{
console
.
log
(
"切换到"
+
type
)
console
.
log
(
"切换到"
+
type
)
var
that
=
this
;
var
that
=
this
;
that
.
sceneBg
.
texture
=
RES
.
getRes
(
resCanvasList
[
that
.
bgUUID
[
type
]].
url
)
that
.
sceneBg
.
texture
=
RES
.
getRes
(
resCanvasList
[
that
.
bgUUID
[
type
]].
url
)
//切换场景时判断猫在不在,后面要改成与接口值判断
//切换场景时判断猫在不在,后面要改成与接口值判断
if
(
type
==
2
){
if
(
Ins
.
catIsOut
)
{
that
.
cat
.
visible
=
false
;
}
else
{
if
((
type
+
1
)
==
Ins
.
userInfo
.
sence
)
{
that
.
cat
.
visible
=
true
;
that
.
cat
.
visible
=
true
;
}
else
{
}
else
{
that
.
cat
.
visible
=
false
;
that
.
cat
.
visible
=
false
;
that
.
cat
.
setCatAnimShow
(
0
);
that
.
cat
.
setCatAnimShow
(
0
);
}
}
switch
(
type
){
}
case
SCENETYPE
.
BEADROOM
:
switch
(
type
)
{
case
SCENETYPE
.
BEADROOM
:
//切换到寝室
that
.
mxqBtn
.
visible
=
that
.
tlBtn
.
visible
=
true
;
that
.
mxqBtn
.
visible
=
that
.
tlBtn
.
visible
=
true
;
if
(
that
.
letter
&&
Ins
.
catIsOut
)
{
that
.
letter
.
visible
=
true
;
}
break
;
break
;
case
SCENETYPE
.
CLASSROOM
:
case
SCENETYPE
.
CLASSROOM
:
//切换到教室
that
.
mxqBtn
.
visible
=
that
.
tlBtn
.
visible
=
false
;
that
.
mxqBtn
.
visible
=
that
.
tlBtn
.
visible
=
false
;
if
(
that
.
letter
)
{
that
.
letter
.
visible
=
false
;
}
break
;
break
;
case
SCENETYPE
.
PLAYGROUND
:
case
SCENETYPE
.
PLAYGROUND
:
//切换到操场
that
.
mxqBtn
.
visible
=
that
.
tlBtn
.
visible
=
false
;
that
.
mxqBtn
.
visible
=
that
.
tlBtn
.
visible
=
false
;
if
(
that
.
letter
)
{
that
.
letter
.
visible
=
false
;
}
break
;
break
;
}
}
that
.
mainUi
.
changeBtnByUiType
(
type
);
that
.
mainUi
.
changeBtnByUiType
(
type
);
}
}
/**更新用户相关信息 */
updateUserInfo
()
{
var
that
=
this
;
sendTbNet
(
TbNetName
.
getUserInfo
,
{},
(
s
,
r
)
=>
{
if
(
s
)
{
Ins
.
userInfo
=
r
.
data
;
that
.
setEnergy
();
that
.
mainUi
.
updateUserInfo
();
}
else
{
showToast
(
r
.
message
)
}
})
}
initEvents
(){
initEvents
()
{
var
that
=
this
;
var
that
=
this
;
console
.
log
(
"主场景添加事件"
)
console
.
log
(
"主场景添加事件"
)
that
.
tlBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,()
=>
{
that
.
changeMainScene
(
SCENETYPE
.
CLASSROOM
)},
that
);
that
.
tlBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
()
=>
{
that
.
changeMainScene
(
SCENETYPE
.
CLASSROOM
)
},
that
);
that
.
mxqBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,()
=>
{
that
.
changeMainScene
(
SCENETYPE
.
PLAYGROUND
)},
that
);
that
.
mxqBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
()
=>
{
that
.
changeMainScene
(
SCENETYPE
.
PLAYGROUND
)
},
that
);
FYGE
.
GDispatcher
.
addEventListener
(
MSG
.
CHANGE_SCENE
,()
=>
{
that
.
changeMainScene
(
SCENETYPE
.
BEADROOM
)},
that
);
that
.
letter
&&
that
.
letter
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
that
.
openLetter
,
that
);
FYGE
.
GDispatcher
.
addEventListener
(
MSG
.
CHANGE_SCENE
,
()
=>
{
that
.
changeMainScene
(
SCENETYPE
.
BEADROOM
)
},
that
);
FYGE
.
GDispatcher
.
addEventListener
(
MSG
.
UPDATE_USERINFO
,
that
.
updateUserInfo
,
that
);
}
}
removeEvents
(){
removeEvents
()
{
var
that
=
this
;
var
that
=
this
;
console
.
log
(
"主场景移除事件"
)
console
.
log
(
"主场景移除事件"
)
that
.
tlBtn
.
removeEventListener
(
FYGE
.
MouseEvent
.
CLICK
,()
=>
{
that
.
changeMainScene
(
SCENETYPE
.
CLASSROOM
)},
that
);
that
.
tlBtn
.
removeEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
()
=>
{
that
.
changeMainScene
(
SCENETYPE
.
CLASSROOM
)
},
that
);
that
.
mxqBtn
.
removeEventListener
(
FYGE
.
MouseEvent
.
CLICK
,()
=>
{
that
.
changeMainScene
(
SCENETYPE
.
PLAYGROUND
)},
that
);
that
.
mxqBtn
.
removeEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
()
=>
{
that
.
changeMainScene
(
SCENETYPE
.
PLAYGROUND
)
},
that
);
FYGE
.
GDispatcher
.
removeEventListener
(
MSG
.
CHANGE_SCENE
,()
=>
{
that
.
changeMainScene
(
SCENETYPE
.
BEADROOM
)},
that
);
that
.
letter
&&
that
.
letter
.
removeEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
that
.
openLetter
,
that
);
FYGE
.
GDispatcher
.
removeEventListener
(
MSG
.
CHANGE_SCENE
,
()
=>
{
that
.
changeMainScene
(
SCENETYPE
.
BEADROOM
)
},
that
);
FYGE
.
GDispatcher
.
removeEventListener
(
MSG
.
UPDATE_USERINFO
,
that
.
updateUserInfo
,
that
);
}
}
}
}
\ No newline at end of file
project/src/canvas/game/src/scenes/StartScene.ts
View file @
9fcc7d37
...
@@ -5,7 +5,7 @@ import Root from "./Root";
...
@@ -5,7 +5,7 @@ import Root from "./Root";
import
resCanvasList
from
"../../../game/resCanvasList"
import
resCanvasList
from
"../../../game/resCanvasList"
import
{
MainScene
}
from
"./MainScene"
;
import
{
MainScene
}
from
"./MainScene"
;
import
{
Ins
}
from
"../Ins"
;
import
{
Ins
}
from
"../Ins"
;
import
{
showPanel
,
showToast
}
from
"../../module/ctrls"
;
import
{
changeScene
,
showPanel
,
showToast
}
from
"../../module/ctrls"
;
import
{
SelectCatPanel
}
from
"../panels/selectcatpanel/SelectCatPanel"
;
import
{
SelectCatPanel
}
from
"../panels/selectcatpanel/SelectCatPanel"
;
import
{
sendTbNet
,
TbNetName
}
from
"../TaoBaoNet"
;
import
{
sendTbNet
,
TbNetName
}
from
"../TaoBaoNet"
;
export
class
StartScene
extends
Scene
{
export
class
StartScene
extends
Scene
{
...
@@ -20,7 +20,13 @@ export class StartScene extends Scene {
...
@@ -20,7 +20,13 @@ export class StartScene extends Scene {
if
(
s
){
if
(
s
){
if
(
r
.
data
){
if
(
r
.
data
){
Ins
.
userInfo
=
r
.
data
;
Ins
.
userInfo
=
r
.
data
;
this
.
addChild
(
new
MainScene
());
/**判断猫咪是否出寝,只在用户进入游戏时判断,后面要根据接口改写,现在先做测试 */
if
(
r
.
data
.
happyCoin
>
2000
){
Ins
.
catIsOut
=
true
;
}
else
{
Ins
.
catIsOut
=
false
;
}
changeScene
(
MainScene
)
}
else
}
else
{
{
showPanel
(
SelectCatPanel
);
showPanel
(
SelectCatPanel
);
...
...
project/src/canvas/game/src/ui/MainSceneBtnUi.ts
View file @
9fcc7d37
...
@@ -36,6 +36,8 @@ export class MainSceneBtnUi extends Module {
...
@@ -36,6 +36,8 @@ export class MainSceneBtnUi extends Module {
private
playBtn
:
FYGE
.
Sprite
;
private
playBtn
:
FYGE
.
Sprite
;
/**补充精力按钮 */
/**补充精力按钮 */
private
energyBtn
:
FYGE
.
Sprite
;
private
energyBtn
:
FYGE
.
Sprite
;
/**召回猫咪按钮 */
private
catRecall
:
FYGE
.
Sprite
;
/**猫猫信息组 */
/**猫猫信息组 */
private
catInfoGroup
:
FYGE
.
Sprite
;
private
catInfoGroup
:
FYGE
.
Sprite
;
private
catAvatar
:
FYGE
.
Sprite
;
//猫猫头像
private
catAvatar
:
FYGE
.
Sprite
;
//猫猫头像
...
@@ -45,6 +47,10 @@ export class MainSceneBtnUi extends Module {
...
@@ -45,6 +47,10 @@ export class MainSceneBtnUi extends Module {
private
fishPointGroup
:
FYGE
.
Sprite
;
private
fishPointGroup
:
FYGE
.
Sprite
;
private
fishPointLabel
:
FYGE
.
TextField
;
//鱼鱼积分文本
private
fishPointLabel
:
FYGE
.
TextField
;
//鱼鱼积分文本
/**按钮组,一个上方按钮组,一个下方按钮组,如果用于适配就改变这两个按钮组 */
private
topBtnGroup
:
FYGE
.
Sprite
;
private
bottomBtnGroup
:
FYGE
.
Sprite
;
/**互动进行中,当互动进行中时,无法点击互动按钮进行互动 */
/**互动进行中,当互动进行中时,无法点击互动按钮进行互动 */
private
actRunning
:
boolean
=
false
;
private
actRunning
:
boolean
=
false
;
initUi
()
{
initUi
()
{
...
@@ -58,30 +64,49 @@ export class MainSceneBtnUi extends Module {
...
@@ -58,30 +64,49 @@ export class MainSceneBtnUi extends Module {
that
.
mouseEnable
=
false
;
that
.
mouseEnable
=
false
;
that
.
mouseChildren
=
true
;
that
.
mouseChildren
=
true
;
that
.
strategyBtn
=
Ins
.
initSprite
(
"e636bd22-361f-442a-8684-ccfe1141485a"
,
579
,
332
);
that
.
topBtnGroup
=
new
FYGE
.
Sprite
();
that
.
addChild
(
that
.
strategyBtn
);
that
.
topBtnGroup
.
y
=
220
;
that
.
topBtnGroup
.
mouseEnable
=
that
.
topBtnGroup
.
mouseChildren
=
true
;
that
.
addChild
(
that
.
topBtnGroup
);
that
.
bottomBtnGroup
=
new
FYGE
.
Sprite
();
that
.
bottomBtnGroup
.
y
=
1240
;
that
.
bottomBtnGroup
.
mouseEnable
=
that
.
bottomBtnGroup
.
mouseChildren
=
true
;
that
.
addChild
(
that
.
bottomBtnGroup
);
that
.
prizeBtn
=
Ins
.
initSprite
(
"e8b083c7-307a-4446-9bc9-99f75c3573e5"
,
579
,
457
);
that
.
strategyBtn
=
Ins
.
initSprite
(
"e636bd22-361f-442a-8684-ccfe1141485a"
,
579
,
112
);
that
.
addChild
(
that
.
prize
Btn
);
that
.
topBtnGroup
.
addChild
(
that
.
strategy
Btn
);
that
.
energyBtn
=
Ins
.
initSprite
(
"cdb8e186-9872-442e-b71e-bba0a9ce5846"
,
539
,
1233
);
that
.
prizeBtn
=
Ins
.
initSprite
(
"e8b083c7-307a-4446-9bc9-99f75c3573e5"
,
579
,
237
);
that
.
addChild
(
that
.
energyBtn
);
that
.
topBtnGroup
.
addChild
(
that
.
prizeBtn
);
that
.
energyBtn
=
Ins
.
initSprite
(
"cdb8e186-9872-442e-b71e-bba0a9ce5846"
,
539
,
-
7
);
that
.
bottomBtnGroup
.
addChild
(
that
.
energyBtn
);
that
.
initCatInfoGroup
();
that
.
initCatInfoGroup
();
that
.
initFishPointGroup
();
that
.
initFishPointGroup
();
that
.
initActBtn
();
that
.
initActBtn
();
that
.
updateUserInfo
();
that
.
start
();
that
.
start
();
}
}
/**初始化猫猫信息 */
/**初始化猫猫信息 */
initCatInfoGroup
()
{
initCatInfoGroup
()
{
var
that
=
this
;
var
that
=
this
;
that
.
catInfoGroup
=
Ins
.
initSprite
(
"af4b699e-5152-4571-8c54-1c06eabf19e9"
,
69
,
220
),
that
.
catInfoGroup
=
Ins
.
initSprite
(
"af4b699e-5152-4571-8c54-1c06eabf19e9"
,
69
),
that
.
addChild
(
that
.
catInfoGroup
);
that
.
topBtnGroup
.
addChild
(
that
.
catInfoGroup
);
that
.
catAvatar
=
new
FYGE
.
Sprite
();
that
.
catAvatar
=
new
FYGE
.
Sprite
();
that
.
catInfoGroup
.
addChild
(
that
.
catAvatar
);
that
.
catInfoGroup
.
addChild
(
that
.
catAvatar
);
var
mask
=
new
FYGE
.
Shape
();
mask
.
beginFill
(
6
,
1
);
mask
.
drawCircle
(
0
,
0
,
24
)
// mask.drawRoundedRect(0, 0, 52, 52, 38, 38, 38, 38);
mask
.
endFill
();
mask
.
x
=
33
;
mask
.
y
=
33
;
that
.
catInfoGroup
.
addChild
(
mask
);
that
.
catAvatar
.
mask
=
mask
;
that
.
catNameLabel
=
Ins
.
initLabel
({
color
:
"black"
,
size
:
24
,
text
:
"喵喵喵"
,
x
:
(
95
-
19
),
y
:
(
167
-
145
)
})
that
.
catNameLabel
=
Ins
.
initLabel
({
color
:
"black"
,
size
:
24
,
text
:
"喵喵喵"
,
x
:
(
95
-
19
),
y
:
(
167
-
145
)
})
that
.
catInfoGroup
.
addChild
(
that
.
catNameLabel
);
that
.
catInfoGroup
.
addChild
(
that
.
catNameLabel
);
...
@@ -93,8 +118,8 @@ export class MainSceneBtnUi extends Module {
...
@@ -93,8 +118,8 @@ export class MainSceneBtnUi extends Module {
/**初始化鱼鱼积分组 */
/**初始化鱼鱼积分组 */
initFishPointGroup
()
{
initFishPointGroup
()
{
var
that
=
this
;
var
that
=
this
;
that
.
fishPointGroup
=
Ins
.
initSprite
(
"f0810375-c8f1-4939-9b11-1cbde6840e2a"
,
465
,
220
);
that
.
fishPointGroup
=
Ins
.
initSprite
(
"f0810375-c8f1-4939-9b11-1cbde6840e2a"
,
465
);
that
.
addChild
(
that
.
fishPointGroup
);
that
.
topBtnGroup
.
addChild
(
that
.
fishPointGroup
);
that
.
fishPointLabel
=
Ins
.
initLabel
({
color
:
"black"
,
size
:
24
,
text
:
"111111"
,
x
:
99
,
y
:
24
})
that
.
fishPointLabel
=
Ins
.
initLabel
({
color
:
"black"
,
size
:
24
,
text
:
"111111"
,
x
:
99
,
y
:
24
})
that
.
fishPointGroup
.
addChild
(
that
.
fishPointLabel
);
that
.
fishPointGroup
.
addChild
(
that
.
fishPointLabel
);
...
@@ -103,46 +128,71 @@ export class MainSceneBtnUi extends Module {
...
@@ -103,46 +128,71 @@ export class MainSceneBtnUi extends Module {
/**初始化互动按钮 */
/**初始化互动按钮 */
initActBtn
()
{
initActBtn
()
{
var
that
=
this
;
var
that
=
this
;
that
.
combingBtn
=
Ins
.
initSprite
(
"aa17cfa9-f1db-47eb-9eeb-f5947b7f47a8"
,
62
,
1240
);
that
.
combingBtn
=
Ins
.
initSprite
(
"aa17cfa9-f1db-47eb-9eeb-f5947b7f47a8"
,
62
);
that
.
addChild
(
that
.
combingBtn
);
that
.
bottomBtnGroup
.
addChild
(
that
.
combingBtn
);
that
.
catBtn
=
Ins
.
initSprite
(
"0b44efa9-1e8a-4c43-a2a5-93852d88918c"
,
210
,
1240
);
that
.
catBtn
=
Ins
.
initSprite
(
"0b44efa9-1e8a-4c43-a2a5-93852d88918c"
,
210
);
that
.
addChild
(
that
.
catBtn
);
that
.
bottomBtnGroup
.
addChild
(
that
.
catBtn
);
that
.
returnBtn
=
Ins
.
initSprite
(
"55f703cd-f0d2-4ec1-9430-6193c1cbc1cb"
,
62
,
1240
);
that
.
returnBtn
=
Ins
.
initSprite
(
"55f703cd-f0d2-4ec1-9430-6193c1cbc1cb"
,
62
);
that
.
addChild
(
that
.
returnBtn
);
that
.
bottomBtnGroup
.
addChild
(
that
.
returnBtn
);
that
.
touchHeadBtn
=
Ins
.
initSprite
(
"b7ec0f16-ea48-4e41-8def-7cc660fa93d7"
,
210
,
1240
);
that
.
touchHeadBtn
=
Ins
.
initSprite
(
"b7ec0f16-ea48-4e41-8def-7cc660fa93d7"
,
210
);
that
.
addChild
(
that
.
touchHeadBtn
);
that
.
bottomBtnGroup
.
addChild
(
that
.
touchHeadBtn
);
that
.
playBtn
=
Ins
.
initSprite
(
"922deced-62d2-4995-9dd6-82bc7913f362"
,
210
,
1240
);
that
.
playBtn
=
Ins
.
initSprite
(
"922deced-62d2-4995-9dd6-82bc7913f362"
,
210
);
that
.
addChild
(
that
.
playBtn
);
that
.
bottomBtnGroup
.
addChild
(
that
.
playBtn
);
that
.
catRecall
=
Ins
.
initSprite
(
"72345190-f95b-4152-bccf-393b8a5aa8d0"
,
62
)
that
.
bottomBtnGroup
.
addChild
(
that
.
catRecall
);
that
.
hideAllActBtn
();
that
.
changeBtnByUiType
(
that
.
uiType
)
}
/**更新用户数据,在初始化时调用一次,后续通过消息调用,调用用户信息接口的时候调用 */
updateUserInfo
()
{
var
that
=
this
;
const
{
catName
,
happyCoin
,
level
,
avatar
}
=
Ins
.
userInfo
;
that
.
catAvatar
.
texture
=
RES
.
getRes
(
avatar
);
that
.
catAvatar
.
width
=
52
;
that
.
catAvatar
.
height
=
52
;
that
.
catAvatar
.
x
=
that
.
catAvatar
.
y
=
5
that
.
catNameLabel
.
text
=
catName
;
that
.
catLevelLabel
.
text
=
"Lv."
+
level
;
that
.
fishPointLabel
.
text
=
""
+
happyCoin
;
}
/**隐藏所有互动按钮 */
hideAllActBtn
()
{
var
that
=
this
;
that
.
combingBtn
.
visible
=
false
;
that
.
combingBtn
.
visible
=
false
;
that
.
catBtn
.
visible
=
false
;
that
.
catBtn
.
visible
=
false
;
that
.
returnBtn
.
visible
=
false
;
that
.
returnBtn
.
visible
=
false
;
that
.
touchHeadBtn
.
visible
=
false
;
that
.
touchHeadBtn
.
visible
=
false
;
that
.
playBtn
.
visible
=
false
;
that
.
playBtn
.
visible
=
false
;
that
.
c
hangeBtnByUiType
(
that
.
uiType
)
that
.
c
atRecall
.
visible
=
false
;
}
}
/**改变按钮显示,根据uiType */
/**改变按钮显示,根据uiType */
changeBtnByUiType
(
type
:
any
)
{
changeBtnByUiType
(
type
:
any
)
{
var
that
=
this
;
var
that
=
this
;
that
.
combingBtn
.
visible
=
false
;
that
.
hideAllActBtn
();
that
.
catBtn
.
visible
=
false
;
that
.
returnBtn
.
visible
=
false
;
that
.
touchHeadBtn
.
visible
=
false
;
that
.
playBtn
.
visible
=
false
;
switch
(
type
)
{
switch
(
type
)
{
case
SCENETYPE
.
BEADROOM
:
case
SCENETYPE
.
BEADROOM
:
if
(
Ins
.
catIsOut
)
{
that
.
catRecall
.
visible
=
true
;
}
else
{
that
.
combingBtn
.
visible
=
true
;
that
.
combingBtn
.
visible
=
true
;
that
.
catBtn
.
visible
=
true
;
that
.
catBtn
.
visible
=
true
;
}
break
;
break
;
case
SCENETYPE
.
CLASSROOM
:
case
SCENETYPE
.
CLASSROOM
:
that
.
returnBtn
.
visible
=
true
;
that
.
returnBtn
.
visible
=
true
;
if
(
!
Ins
.
catIsOut
)
{
that
.
touchHeadBtn
.
visible
=
true
;
that
.
touchHeadBtn
.
visible
=
true
;
}
break
;
break
;
case
SCENETYPE
.
PLAYGROUND
:
case
SCENETYPE
.
PLAYGROUND
:
that
.
returnBtn
.
visible
=
true
;
that
.
returnBtn
.
visible
=
true
;
if
(
!
Ins
.
catIsOut
)
{
that
.
playBtn
.
visible
=
true
;
that
.
playBtn
.
visible
=
true
;
}
break
;
break
;
default
:
console
.
log
(
"改变场景ui时设置uiType错误"
);
default
:
console
.
log
(
"改变场景ui时设置uiType错误"
);
break
;
break
;
...
@@ -153,10 +203,10 @@ export class MainSceneBtnUi extends Module {
...
@@ -153,10 +203,10 @@ export class MainSceneBtnUi extends Module {
touchHandler
(
e
:
FYGE
.
MouseEvent
)
{
touchHandler
(
e
:
FYGE
.
MouseEvent
)
{
console
.
log
(
e
.
target
);
console
.
log
(
e
.
target
);
var
that
=
this
;
var
that
=
this
;
that
.
btnDelay
(
e
.
target
);
if
(
e
.
target
==
that
.
returnBtn
)
{
if
(
e
.
target
==
that
.
returnBtn
)
{
that
.
returnBedRoom
();
that
.
returnBedRoom
();
}
else
{
}
else
{
that
.
btnDelay
(
e
.
target
);
switch
(
e
.
target
)
{
switch
(
e
.
target
)
{
case
that
.
energyBtn
:
case
that
.
energyBtn
:
that
.
getEnergy
();
that
.
getEnergy
();
...
@@ -179,11 +229,22 @@ export class MainSceneBtnUi extends Module {
...
@@ -179,11 +229,22 @@ export class MainSceneBtnUi extends Module {
case
that
.
prizeBtn
:
case
that
.
prizeBtn
:
that
.
openPrizePage
();
that
.
openPrizePage
();
break
;
break
;
case
that
.
catRecall
:
that
.
catRecallHandler
();
break
;
default
:
console
.
log
(
"主页面按钮点击事件错误,请检查"
)
break
;
}
}
}
}
}
}
/**召回猫咪事件 */
catRecallHandler
(){
console
.
log
(
"召回猫咪"
);
}
/**补充精力 */
/**补充精力 */
getEnergy
()
{
getEnergy
()
{
console
.
log
(
"补充精力"
);
console
.
log
(
"补充精力"
);
...
@@ -243,6 +304,7 @@ export class MainSceneBtnUi extends Module {
...
@@ -243,6 +304,7 @@ export class MainSceneBtnUi extends Module {
that
.
addEvent
(
that
.
catBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
addEvent
(
that
.
catBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
addEvent
(
that
.
combingBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
addEvent
(
that
.
combingBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
addEvent
(
that
.
touchHeadBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
addEvent
(
that
.
touchHeadBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
addEvent
(
that
.
catRecall
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
}
}
/**添加事件,为了防止obj没有被创建封装 */
/**添加事件,为了防止obj没有被创建封装 */
...
@@ -265,7 +327,13 @@ export class MainSceneBtnUi extends Module {
...
@@ -265,7 +327,13 @@ export class MainSceneBtnUi extends Module {
that
.
removeEvent
(
that
.
energyBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
removeEvent
(
that
.
energyBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
removeEvent
(
that
.
returnBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
removeEvent
(
that
.
returnBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
removeEvent
(
that
.
strategyBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
removeEvent
(
that
.
strategyBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
removeEvent
(
that
.
prizeBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
)
that
.
removeEvent
(
that
.
prizeBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
removeEvent
(
that
.
playBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
removeEvent
(
that
.
catBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
removeEvent
(
that
.
combingBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
removeEvent
(
that
.
touchHeadBtn
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
that
.
removeEvent
(
that
.
catRecall
,
FYGE
.
MouseEvent
.
CLICK
,
that
.
touchHandler
);
}
}
start
()
{
start
()
{
...
...
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