This commit is contained in:
2025-07-25 15:20:02 +08:00
parent 2f6d583ebf
commit 1dba986ad7
26 changed files with 1989 additions and 759 deletions
+12 -1
View File
@@ -1,6 +1,7 @@
import { _decorator, Component, EditBox, Node } from "cc";
import { _decorator, Component, EditBox, Node,Label } from "cc";
import { DemoManager } from "./DemoManager";
import { ChatGPTService } from "./ChatGPTService";
import {characters} from "db://assets/Scripts/test/cfg/characters";
const { ccclass, property } = _decorator;
@ccclass("ChatPanel")
@@ -10,6 +11,16 @@ export class ChatPanel extends Component {
@property(EditBox)
editBox: EditBox = null;
@property(Label)
girlName: Label = null;
id:number
refresh(id:number) {
this.id = id;
const data = characters[id-1];
this.girlName.string = data.name;
}
protected onEnable(): void {
if (!this.manager) this.manager = DemoManager.getInstance();
}
+23 -4
View File
@@ -1,6 +1,9 @@
import { find } from "cc";
import { ChatContentsLayout } from "./ChatContentsLayout";
import { DemoData } from "./DemoData";
import {GirlDetailPanel} from "db://assets/Scripts/test/GirlDetailPanel";
import {ChatPanel} from "db://assets/Scripts/test/ChatPanel";
import {GirlListPanel} from "db://assets/Scripts/test/girlListPanel/GirlListPanel";
export class DemoManager {
private static _instance: DemoManager;
@@ -18,15 +21,31 @@ export class DemoManager {
demoData: DemoData;
public layoutout: ChatContentsLayout;
public detailPanel:GirlDetailPanel;
public chatPanel:ChatPanel;
public girlListPanel:GirlListPanel;
EnterChat(id: number) {
find("Canvas/ChatPanel").active = true;
find("Canvas/GirlDetailPanel").active = false;
if(this.chatPanel==null)
{
this.chatPanel = find("Canvas/ChatPanel").getComponent(ChatPanel);
}
this.chatPanel.node.active = true;
this.detailPanel.node.active = false;
}
EnterDetail(id: number) {
find("Canvas/GirlListPanel").active = false;
find("Canvas/GirlDetailPanel").active = true;
if(this.girlListPanel==null)
{
this.girlListPanel =find("Canvas/GirlListPanel").getComponent(GirlListPanel);
}
this.girlListPanel.node.active = false;
if(this.detailPanel==null)
{
this.detailPanel = find("Canvas/GirlDetailPanel").getComponent(GirlDetailPanel);
}
this.detailPanel.refresh(id);
this.detailPanel.node.active = true;
}
public updateDialog(isPlayer: boolean, str: string) {
+8 -2
View File
@@ -1,5 +1,6 @@
import { _decorator, Component, Label, Node, Sprite } from "cc";
import { DemoManager } from "./DemoManager";
import {Character, characters} from "db://assets/Scripts/test/cfg/characters";
const { ccclass, property } = _decorator;
@ccclass("GirlDetailPanel")
@@ -14,8 +15,13 @@ export class GirlDetailPanel extends Component {
@property(Node)
chatBtn: Node;
id = 0;
start() {
this.id = 1;
refresh(index:number)
{
const data = characters[index-1];
this.girlName.string = data.name;
this.desc.string = data.description;
this.id = data.id;
}
OnClickChatBtn() {
DemoManager.getInstance().EnterChat(this.id);
+9
View File
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "ad76166f-8498-40ba-95df-e36d36090bb9",
"files": [],
"subMetas": {},
"userData": {}
}
+25
View File
@@ -0,0 +1,25 @@
export interface Character {
id: number;
name: string;
age: number;
description: string;
}
export const characters: Character[] = [
{
id: 1,
name: "Anaya Kapoor",
age:24,
description: "🌸 Hi, I'm Anaya Kapoor, a 24-year-old dreamer from Mumbai. I blend tradition with trend — from vibrant saris to sleek streetwear, fashion is how I express my story.\n" +
"\n" +
"As a lifestyle influencer with over 1 million followers, I celebrate beauty in all its forms — skin, spirit, and self-love.\n" +
"\n" +
"I grew up watching Bollywood classics and dancing to every beat — now, I create my own rhythms with my camera, my words, and my smile.\n" +
"\n" +
"Coffee lover ☕ | Dancer 💃 | Proud Desi ✨\n" +
"\n" +
"Be your own kind of beautiful."
},
]
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "5a025fba-6622-4b6d-9706-b09123b7c2ce",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -8,6 +8,7 @@ import {
Sprite,
} from "cc";
import { DemoManager } from "../DemoManager";
import { Character, characters } from "db://assets/Scripts/test/cfg/characters";
const { ccclass, property } = _decorator;
@ccclass("GirlListItem")
@@ -24,19 +25,17 @@ export class GirlListItem extends Component {
chatBtn: Node;
id: number = -1;
start() {
// this.avatar = this.node
// .getChildByName("avatar/Avatar")
// .getComponent(Sprite);
// this.girlName = this.node.getChildByName("Desc/Name").getComponent(Label);
// this.desc = this.node.getChildByName("Desc/desc").getComponent(Label);
// this.price = this.node.getChildByName("purchase/price").getComponent(Label);
// this.chatBtn = this.node.getChildByName("purchase/Button");
this.id = 1;
protected onEnable(): void {
this.refreshData(1);
}
refreshData() {}
refreshData(index: number) {
const data = characters[index - 1];
this.id = data.id;
this.girlName.string = data.name;
//this.avatar.spriteFrame =
}
onClickDetail() {
DemoManager.getInstance().EnterDetail(this.id);
@@ -1,14 +1,17 @@
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('GirlListPanel')
export class GirlListPanel extends Component {
start() {
}
update(deltaTime: number) {
}
}
import { _decorator, Component, Node } from 'cc';
import {characters} from "db://assets/Scripts/test/cfg/characters";
const { ccclass, property } = _decorator;
@ccclass('GirlListPanel')
export class GirlListPanel extends Component {
onEnable()
{
const cfg = characters;
for (let i = 0; i < cfg.length; i++) {
const c = cfg[i];
}
}
}