Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SSIWB2504
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
SSIWB2504
Commits
e8ab8931
Commit
e8ab8931
authored
Aug 04, 2025
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(play): 实现钓鱼游戏的初始化和猫咪角色创建
parent
8e21a80f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
115 additions
and
1 deletion
+115
-1
play.component.ts
src/app/play/play.component.ts
+115
-1
No files found.
src/app/play/play.component.ts
View file @
e8ab8931
...
@@ -265,6 +265,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -265,6 +265,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
initBackground
()
this
.
initBackground
()
this
.
initListPage
();
this
.
initListPage
();
this
.
initFishGame
();
// 初始化退出按钮
// 初始化退出按钮
// this.initBtnBack();
// this.initBtnBack();
// // 初始化标题
// // 初始化标题
...
@@ -679,7 +681,119 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -679,7 +681,119 @@ export class PlayComponent implements OnInit, OnDestroy {
* 初始化鱼游戏
* 初始化鱼游戏
*/
*/
initFishGame
()
{
initFishGame
()
{
this
.
layoutPage
.
ref
.
visible
=
false
;
this
.
checkBtnElement
.
ref
.
visible
=
false
;
this
.
listItem
.
ref
.
visible
=
false
;
// this.initVsView();
this
.
initCat
();
}
initVsView
()
{
// 左侧节点:hong_se_jian_bian、ju_mao_tou、v
const
leftNodes
=
[,
'
ju_mao_tou
'
,
'
v
'
];
// 右侧节点:lan_se_jian_bian、s、hui_mao_tou
const
rightNodes
=
[
'
lan_se_jian_bian
'
,
'
s
'
,
'
hui_mao_tou
'
];
const
hong_se_jian_bian
=
this
.
g_cartoon
.
createCartoonElement
(
'
hong_se_jian_bian
'
,
'
MySprite
'
);
hong_se_jian_bian
.
ref
.
init
(
this
.
g_cartoon
.
images
.
get
(
'
hong_se_jian_bian
'
));
hong_se_jian_bian
.
ref
.
scaleX
=
this
.
g_mapScale
;
hong_se_jian_bian
.
ref
.
scaleY
=
this
.
g_mapScale
;
hong_se_jian_bian
.
ref
.
x
=
0
;
hong_se_jian_bian
.
ref
.
y
=
this
.
g_canvasHeight
/
2
;
this
.
render
(
hong_se_jian_bian
.
ref
,
zIndexMap
.
card
);
const
lan_se_jian_bian
=
this
.
g_cartoon
.
createCartoonElement
(
'
lan_se_jian_bian
'
,
'
MySprite
'
);
lan_se_jian_bian
.
ref
.
init
(
this
.
g_cartoon
.
images
.
get
(
'
lan_se_jian_bian
'
));
lan_se_jian_bian
.
ref
.
scaleX
=
this
.
g_mapScale
;
lan_se_jian_bian
.
ref
.
scaleY
=
this
.
g_mapScale
;
lan_se_jian_bian
.
ref
.
x
=
0
;
lan_se_jian_bian
.
ref
.
y
=
0
;
this
.
render
(
lan_se_jian_bian
.
ref
,
zIndexMap
.
card
);
// // 创建右侧节点
// rightNodes.forEach((nodeName, index) => {
// const element = this.g_cartoon.createCartoonElement(nodeName, 'MySprite');
// element.ref.init(this.g_cartoon.images.get(nodeName));
// // 应用屏幕适配缩放
// element.ref.scaleX = this.g_mapScale;
// element.ref.scaleY = this.g_mapScale;
// // 设置右侧位置(画布右侧3/4处)
// element.ref.x = this.g_canvasWidth * 0.75;
// element.ref.y = this.g_canvasHeight * 0.3 + (index * 150 * this.g_mapScale);
// // 渲染元素
// this.render(element.ref, zIndexMap.card);
// });
}
initCat
()
{
// 创建cat根节点
const
cat
=
new
MySprite
(
this
.
g_ctx
);
cat
.
x
=
this
.
g_canvasWidth
/
2
;
cat
.
y
=
this
.
g_canvasHeight
;
cat
.
width
=
100
*
this
.
g_mapScale
;
cat
.
height
=
100
*
this
.
g_mapScale
;
// 创建船节点 - 作为钓鱼台,放在最下方
const
chuan
=
new
MySprite
(
this
.
g_ctx
);
chuan
.
init
(
this
.
g_cartoon
.
images
.
get
(
'
chuan
'
));
chuan
.
scaleX
=
this
.
g_mapScale
;
chuan
.
scaleY
=
this
.
g_mapScale
;
chuan
.
x
=
0
chuan
.
y
=
-
38
cat
.
addChild
(
chuan
);
// 创建橘猫坐着节点 - 放在船顶部中间
const
ju_mao_zuo_zhao
=
new
MySprite
(
this
.
g_ctx
);
ju_mao_zuo_zhao
.
init
(
this
.
g_cartoon
.
images
.
get
(
'
ju_mao_zuo_zhao
'
));
ju_mao_zuo_zhao
.
scaleX
=
this
.
g_mapScale
;
ju_mao_zuo_zhao
.
scaleY
=
this
.
g_mapScale
;
ju_mao_zuo_zhao
.
x
=
50
*
this
.
g_mapScale
;
ju_mao_zuo_zhao
.
y
=
-
60
*
this
.
g_mapScale
;
cat
.
addChild
(
ju_mao_zuo_zhao
);
// 创建鱼竿节点 - 放在猫手上
const
yu_gan
=
new
MySprite
(
this
.
g_ctx
);
yu_gan
.
init
(
this
.
g_cartoon
.
images
.
get
(
'
yu_gan
'
));
yu_gan
.
scaleX
=
this
.
g_mapScale
;
yu_gan
.
scaleY
=
this
.
g_mapScale
;
yu_gan
.
x
=
65
*
this
.
g_mapScale
;
yu_gan
.
y
=
35
*
this
.
g_mapScale
;
cat
.
addChild
(
yu_gan
);
// 创建鱼箱子节点 - 放在猫的左边
const
yu_xiang_zi
=
new
MySprite
(
this
.
g_ctx
);
yu_xiang_zi
.
init
(
this
.
g_cartoon
.
images
.
get
(
'
yu_xiang_zi
'
));
yu_xiang_zi
.
scaleX
=
this
.
g_mapScale
;
yu_xiang_zi
.
scaleY
=
this
.
g_mapScale
;
yu_xiang_zi
.
x
=
15
*
this
.
g_mapScale
;
yu_xiang_zi
.
y
=
60
*
this
.
g_mapScale
;
cat
.
addChild
(
yu_xiang_zi
);
// 创建红水桶节点 - 放在猫的右边
const
hong_shui_tong
=
new
MySprite
(
this
.
g_ctx
);
hong_shui_tong
.
init
(
this
.
g_cartoon
.
images
.
get
(
'
hong_shui_tong
'
));
hong_shui_tong
.
scaleX
=
this
.
g_mapScale
;
hong_shui_tong
.
scaleY
=
this
.
g_mapScale
;
hong_shui_tong
.
x
=
85
*
this
.
g_mapScale
;
hong_shui_tong
.
y
=
60
*
this
.
g_mapScale
;
cat
.
addChild
(
hong_shui_tong
);
// 创建橘猫爬爪节点 - 与ju_mao_zuo_zhao相同坐标
const
ju_mao_pa_zhao
=
new
MySprite
(
this
.
g_ctx
);
ju_mao_pa_zhao
.
init
(
this
.
g_cartoon
.
images
.
get
(
'
ju_mao_pa_zhao
'
));
ju_mao_pa_zhao
.
scaleX
=
this
.
g_mapScale
;
ju_mao_pa_zhao
.
scaleY
=
this
.
g_mapScale
;
ju_mao_pa_zhao
.
x
=
50
*
this
.
g_mapScale
;
ju_mao_pa_zhao
.
y
=
20
*
this
.
g_mapScale
;
cat
.
addChild
(
ju_mao_pa_zhao
);
this
.
render
(
cat
,
zIndexMap
.
card
);
}
}
...
...
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