update
This commit is contained in:
@@ -123,20 +123,22 @@ export class EmotionAIService {
|
||||
// 发送情绪初始化完成事件
|
||||
Utils.sendInnerMsg(InnerMsgCode.Chat_EmotionInitialized, {
|
||||
roleId: roleId,
|
||||
emotion: emotionalState
|
||||
emotion: emotionalState,
|
||||
});
|
||||
|
||||
console.log(`Emotion initialization completed for role ${roleId}: ${VideoEmotion[emotionalState]}`);
|
||||
console.log(
|
||||
`Emotion initialization completed for role ${roleId}: ${VideoEmotion[emotionalState]}`
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Failed to initialize emotion analysis for role ${roleId}:`,
|
||||
error
|
||||
);
|
||||
|
||||
|
||||
// 即使发生错误,也发送默认情绪状态
|
||||
Utils.sendInnerMsg(InnerMsgCode.Chat_EmotionInitialized, {
|
||||
roleId: roleId,
|
||||
emotion: VideoEmotion.calm_down
|
||||
emotion: VideoEmotion.calm_down,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -382,7 +384,7 @@ export class EmotionAIService {
|
||||
// 发送情绪更新完成事件
|
||||
Utils.sendInnerMsg(InnerMsgCode.Chat_EmotionUpdated, {
|
||||
roleId: roleId,
|
||||
emotion: newEmotion
|
||||
emotion: newEmotion,
|
||||
});
|
||||
|
||||
return newEmotion;
|
||||
@@ -411,12 +413,12 @@ export class EmotionAIService {
|
||||
aiResponse: string,
|
||||
currentEmotion: VideoEmotion
|
||||
): string {
|
||||
const roleName = this.getRoleEnglishName(roleId);
|
||||
//const roleName = this.getRoleEnglishName(roleId);
|
||||
|
||||
let analysisText = `当前情绪状态: ${VideoEmotion[currentEmotion]}\n\n`;
|
||||
analysisText += `请分析以下最新对话的情绪变化,返回对应的VideoEmotion枚举值:\n\n`;
|
||||
analysisText += `用户: ${userMessage}\n`;
|
||||
analysisText += `${roleName}: ${aiResponse}\n\n`;
|
||||
analysisText += `user: ${userMessage}\n`;
|
||||
analysisText += `model: ${aiResponse}\n\n`;
|
||||
analysisText += `请基于对话内容和当前情绪状态,返回以下枚举值之一:calm_down, arousal, desire, passion, orgasm`;
|
||||
|
||||
return analysisText;
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
import LanguageUtils from "../../Main/Common/LanguageUtils";
|
||||
import Utils from "../../Main/Common/Utils";
|
||||
import { InnerEventCode } from "../../Main/Config/InnerMsgCode";
|
||||
|
||||
export class CommercialData {
|
||||
private static _instance: CommercialData;
|
||||
public static get Instance(): CommercialData {
|
||||
if (!CommercialData._instance) {
|
||||
CommercialData._instance = new CommercialData();
|
||||
}
|
||||
return CommercialData._instance;
|
||||
}
|
||||
|
||||
private _diamondCount: number = 0;
|
||||
private _isVip: boolean = false;
|
||||
private _vipEndTime: number = 0;
|
||||
|
||||
public get diamondCount(): number {
|
||||
return this._diamondCount;
|
||||
}
|
||||
|
||||
public set diamondCount(value: number) {
|
||||
if (this._diamondCount !== value) {
|
||||
this._diamondCount = Math.max(0, value);
|
||||
Utils.sendInnerMsg(InnerEventCode.DiamondCountChanged, {
|
||||
count: this._diamondCount,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public get isVip(): boolean {
|
||||
return this._isVip;
|
||||
}
|
||||
|
||||
public set isVip(value: boolean) {
|
||||
if (this._isVip !== value) {
|
||||
this._isVip = value;
|
||||
Utils.sendInnerMsg(InnerEventCode.IsVipChanged, { isVip: this._isVip });
|
||||
}
|
||||
}
|
||||
|
||||
public get vipEndTime(): number {
|
||||
return this._vipEndTime;
|
||||
}
|
||||
|
||||
public set vipEndTime(value: number) {
|
||||
if (this._vipEndTime !== value) {
|
||||
this._vipEndTime = Math.max(0, value);
|
||||
Utils.sendInnerMsg(InnerEventCode.VipEndDayChange, {
|
||||
vipEndTime: this._vipEndTime,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private constructor() {
|
||||
this.loadData();
|
||||
}
|
||||
|
||||
public addDiamonds(amount: number): void {
|
||||
if (amount > 0) {
|
||||
this.diamondCount += amount;
|
||||
}
|
||||
}
|
||||
|
||||
public spendDiamonds(amount: number): boolean {
|
||||
if (amount > 0 && this._diamondCount >= amount) {
|
||||
this.diamondCount -= amount;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public setVipTime(timeInSeconds: number): void {
|
||||
this._vipEndTime = timeInSeconds;
|
||||
if (timeInSeconds > 0) {
|
||||
this.isVip = true;
|
||||
}
|
||||
}
|
||||
public getVipLeftTime(): string {
|
||||
const dateNow = new Date();
|
||||
const timeDiff = Math.abs(this._vipEndTime - dateNow.getTime());
|
||||
const hours = Math.floor(timeDiff / (1000 * 60 * 60));
|
||||
|
||||
if (hours >= 24) {
|
||||
return (
|
||||
(hours % 24).toString() + LanguageUtils.getText("purchasepanel.day")
|
||||
);
|
||||
}
|
||||
const minutes = Math.floor((timeDiff / (1000 * 60)) % 60);
|
||||
//const seconds = Math.floor((timeDiff / 1000) % 60);
|
||||
return `${hours}${LanguageUtils.getText(
|
||||
"purchasepanel.hour"
|
||||
)}:${minutes}${LanguageUtils.getText("purchasepanel.minute")}`;
|
||||
}
|
||||
|
||||
private loadData(): void {
|
||||
//假数据
|
||||
this._diamondCount = 18556;
|
||||
this._isVip = true;
|
||||
|
||||
//const dateNow = new Date();
|
||||
const dateEndTime = new Date("2025-08-30T12:00:00Z");
|
||||
|
||||
this._vipEndTime = dateEndTime.getTime();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b63bfbf7-eac0-4713-84ca-dbb1d0ea1c5c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -21,6 +21,9 @@ import LanguageUtils, {
|
||||
} from "../../../Main/Common/LanguageUtils";
|
||||
import AudioManager from "../../../Main/Manager/AudioManager";
|
||||
import { NavigationManager } from "../../manager/NavigationManager";
|
||||
import { PlayerDataService } from "../../network/services/PlayerDataService";
|
||||
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("PersonalPanel")
|
||||
@@ -82,14 +85,25 @@ export class PersonalPanel extends li_BaseView {
|
||||
}
|
||||
}
|
||||
|
||||
private refresh(): void {
|
||||
private async refresh() {
|
||||
const reqData = {};
|
||||
let res = await PlayerDataService.I.reqMyInfo(reqData);
|
||||
console.log("个人信息响应数据:", res);
|
||||
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||
const resData = res.data;
|
||||
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
||||
walletData.balance = Number(resData.balance);
|
||||
walletData.vipExpire = Number(resData.vipExpire);
|
||||
}
|
||||
|
||||
this.updateUserInfo();
|
||||
this.updateBalance();
|
||||
this.updateVipStatus();
|
||||
}
|
||||
|
||||
private updateUserInfo(): void {
|
||||
private updateUserInfo() {
|
||||
// 更新用户名
|
||||
|
||||
if (this.userNameLabel && this.playerData) {
|
||||
const userName = this.playerData.name || "未设置";
|
||||
this.userNameLabel.string = userName;
|
||||
|
||||
@@ -346,11 +346,16 @@ export class ThemePanel extends li_BaseView {
|
||||
// 刷新 vip失效时间戳
|
||||
private refreshVipExpire() {
|
||||
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
||||
|
||||
const vipExpire = walletData.vipExpire;
|
||||
const leftTime = Utils.formatVipLeftTime(vipExpire);
|
||||
this.vipLeftTime.string = LanguageUtils.getText(
|
||||
"purchasepanel.vip_left"
|
||||
).replace("${leftTime}", leftTime);
|
||||
if (Date.now() > vipExpire) {
|
||||
this.vipLeftTime.string = LanguageUtils.getText("purchasePanel.notVip");
|
||||
} else {
|
||||
const leftTime = Utils.formatVipLeftTime(vipExpire);
|
||||
this.vipLeftTime.string = LanguageUtils.getText(
|
||||
"purchasepanel.vip_left"
|
||||
).replace("${leftTime}", leftTime);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取商品列表
|
||||
|
||||
@@ -47,6 +47,9 @@ export class ThemeItem extends Component {
|
||||
this.updateTitle();
|
||||
});
|
||||
}
|
||||
protected onEnable(): void {
|
||||
this.updateTitle();
|
||||
}
|
||||
|
||||
updateTitle() {
|
||||
this.titleName.string = LanguageUtils.getText(this.key);
|
||||
|
||||
Reference in New Issue
Block a user