feat: group 1.0.0

This commit is contained in:
zzc
2026-05-12 06:46:31 +08:00
parent 493b4709bc
commit 2fc90c1219
55 changed files with 23561 additions and 1767 deletions

View File

@@ -14,6 +14,7 @@ import {
Prefab,
instantiate,
director,
Color,
} from "cc";
import { NoteControl } from "./NoteControl";
import { BombEffect } from "../effects/BombEffectControl";
@@ -43,6 +44,8 @@ export class DinoControl extends Component {
lineNode: Node = null;
onLoad() {
// 设置小恐龙颜色
this.setDinoColor();
// 监听继续游戏事件
EventDispatcher.getTarget().on(
EventDispatcher.GAME_RESUME,
@@ -130,6 +133,10 @@ export class DinoControl extends Component {
// 设置这个空节点的父节点
neckChild.parent = this.node.getChildByName("dino_neck_box");
// 设置脖子的颜色
neckChild.getComponent(Sprite).color = new Color(
GlobalData.currentDinoInfo.dinoColor,
);
// 获取小恐龙身体
const bodyNode = this.node.getChildByName("dino_body");
@@ -216,5 +223,19 @@ export class DinoControl extends Component {
}
}
// 设置小恐龙颜色
setDinoColor() {
// 获取当前小恐龙信息
const dinoInfo = GlobalData.currentDinoInfo;
// 获取小恐龙颜色
const dinoColor = new Color(dinoInfo.dinoColor);
// 设置小恐龙身体颜色
this.node.getChildByName("dino_body").getComponent(Sprite).color =
dinoColor;
// 设置小恐龙头部颜色
this.node.getChildByName("dino_head").getComponent(Sprite).color =
dinoColor;
}
update(deltaTime: number) {}
}

View File

@@ -21,6 +21,8 @@ export class NoteControl extends Component {
// 是否开始下落
private isEnableFall: boolean = false;
start() {
// 设置小恐龙脖子颜色
this.setDinoNeckColor();
// 监听清除可视区域音符事件
EventDispatcher.getTarget().on(
EventDispatcher.CLEAR_SCREEN_NOTE,
@@ -59,6 +61,7 @@ export class NoteControl extends Component {
const noteHitSprite = this.node
.getChildByName("note_img")
.getComponent(Sprite);
// 4. 获取音符的颜色
const noteColor = new Color("ffffff");
// 5. 操作音符闪烁
@@ -70,7 +73,7 @@ export class NoteControl extends Component {
color: new Color(noteColor.r, noteColor.g, noteColor.b, 0),
})
.to(0.2, {
color: noteColor,
color: new Color(GlobalData.currentDinoInfo.dinoColor),
}),
)
.call(() => {
@@ -144,6 +147,18 @@ export class NoteControl extends Component {
return false;
}
// 设置小恐龙脖子颜色
private setDinoNeckColor() {
// 获取当前小恐龙信息
const dinoInfo = GlobalData.currentDinoInfo;
// 获取小恐龙脖子节点
const dinoNeckNode = this.node.getChildByName("note_img");
// 获取小恐龙脖子节点下的 Sprite 组件
const dinoNeckSprite = dinoNeckNode.getComponent(Sprite);
// 设置小恐龙脖子颜色
dinoNeckSprite.color = new Color(dinoInfo.dinoColor);
}
update(deltaTime: number) {
// 游戏未开始,不更新音符位置
if (!this.isEnableFall || GlobalData.gameState != GameState.PLAYING) {