update
This commit is contained in:
@@ -45,11 +45,13 @@ export class ChatHistoryManager {
|
|||||||
roleId: roleId,
|
roleId: roleId,
|
||||||
messages: messages,
|
messages: messages,
|
||||||
createdAt: Date.now(),
|
createdAt: Date.now(),
|
||||||
updatedAt: Date.now()
|
updatedAt: Date.now(),
|
||||||
};
|
};
|
||||||
|
|
||||||
sys.localStorage.setItem(key, JSON.stringify(history));
|
sys.localStorage.setItem(key, JSON.stringify(history));
|
||||||
console.log(`Saved chat history for role ${roleId}, ${messages.length} messages`);
|
console.log(
|
||||||
|
`Saved chat history for role ${roleId}, ${messages.length} messages`
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Failed to save chat history for role ${roleId}:`, error);
|
console.error(`Failed to save chat history for role ${roleId}:`, error);
|
||||||
}
|
}
|
||||||
@@ -66,7 +68,9 @@ export class ChatHistoryManager {
|
|||||||
const data = sys.localStorage.getItem(key);
|
const data = sys.localStorage.getItem(key);
|
||||||
if (data) {
|
if (data) {
|
||||||
const history: ChatHistory = JSON.parse(data);
|
const history: ChatHistory = JSON.parse(data);
|
||||||
console.log(`Loaded chat history for role ${roleId}: ${history.messages.length} messages`);
|
console.log(
|
||||||
|
`Loaded chat history for role ${roleId}: ${history.messages.length} messages`
|
||||||
|
);
|
||||||
return history.messages;
|
return history.messages;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -137,17 +141,19 @@ export class ChatHistoryManager {
|
|||||||
const keysToRemove: string[] = [];
|
const keysToRemove: string[] = [];
|
||||||
for (let i = 0; i < sys.localStorage.length; i++) {
|
for (let i = 0; i < sys.localStorage.length; i++) {
|
||||||
const key = sys.localStorage.key(i);
|
const key = sys.localStorage.key(i);
|
||||||
if (key && key.startsWith('chat_history_')) {
|
if (key && key.startsWith("chat_history_")) {
|
||||||
keysToRemove.push(key);
|
keysToRemove.push(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除找到的所有聊天历史
|
// 删除找到的所有聊天历史
|
||||||
keysToRemove.forEach(key => {
|
keysToRemove.forEach((key) => {
|
||||||
sys.localStorage.removeItem(key);
|
sys.localStorage.removeItem(key);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`Cleared all chat histories, ${keysToRemove.length} records removed`);
|
console.log(
|
||||||
|
`Cleared all chat histories, ${keysToRemove.length} records removed`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,8 +164,8 @@ export class ChatHistoryManager {
|
|||||||
const roleIds: number[] = [];
|
const roleIds: number[] = [];
|
||||||
for (let i = 0; i < sys.localStorage.length; i++) {
|
for (let i = 0; i < sys.localStorage.length; i++) {
|
||||||
const key = sys.localStorage.key(i);
|
const key = sys.localStorage.key(i);
|
||||||
if (key && key.startsWith('chat_history_')) {
|
if (key && key.startsWith("chat_history_")) {
|
||||||
const roleId = parseInt(key.replace('chat_history_', ''));
|
const roleId = parseInt(key.replace("chat_history_", ""));
|
||||||
if (!isNaN(roleId)) {
|
if (!isNaN(roleId)) {
|
||||||
roleIds.push(roleId);
|
roleIds.push(roleId);
|
||||||
}
|
}
|
||||||
@@ -186,7 +192,9 @@ export class ChatHistoryManager {
|
|||||||
// messages: history
|
// messages: history
|
||||||
// }, "POST");
|
// }, "POST");
|
||||||
|
|
||||||
console.log(`Ready to sync ${history.length} messages for role ${roleId} to remote server`);
|
console.log(
|
||||||
|
`Ready to sync ${history.length} messages for role ${roleId} to remote server`
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Failed to sync history for role ${roleId}:`, error);
|
console.error(`Failed to sync history for role ${roleId}:`, error);
|
||||||
}
|
}
|
||||||
@@ -208,7 +216,9 @@ export class ChatHistoryManager {
|
|||||||
// console.log(`Synced ${response.messages.length} messages from remote for role ${roleId}`);
|
// console.log(`Synced ${response.messages.length} messages from remote for role ${roleId}`);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
console.log(`Ready to sync history from remote server for role ${roleId}`);
|
console.log(
|
||||||
|
`Ready to sync history from remote server for role ${roleId}`
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Failed to sync from remote for role ${roleId}:`, error);
|
console.error(`Failed to sync from remote for role ${roleId}:`, error);
|
||||||
}
|
}
|
||||||
@@ -219,7 +229,9 @@ export class ChatHistoryManager {
|
|||||||
* @param serverMessages 服务端聊天消息数组
|
* @param serverMessages 服务端聊天消息数组
|
||||||
* @returns 本地格式的聊天消息数组
|
* @returns 本地格式的聊天消息数组
|
||||||
*/
|
*/
|
||||||
private convertServerDataToLocalFormat(serverMessages: proto.cs.IChatMsg[]): ChatMessage[] {
|
private convertServerDataToLocalFormat(
|
||||||
|
serverMessages: proto.cs.IChatMsg[]
|
||||||
|
): ChatMessage[] {
|
||||||
if (!serverMessages || serverMessages.length === 0) {
|
if (!serverMessages || serverMessages.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -230,7 +242,7 @@ export class ChatHistoryManager {
|
|||||||
const message: ChatMessage = {
|
const message: ChatMessage = {
|
||||||
role: serverMsg.isAi ? "model" : "user",
|
role: serverMsg.isAi ? "model" : "user",
|
||||||
parts: [{ text: serverMsg.msg }],
|
parts: [{ text: serverMsg.msg }],
|
||||||
timestamp: serverMsg.msgId || Date.now()
|
timestamp: serverMsg.msgId || Date.now(),
|
||||||
};
|
};
|
||||||
messages.push(message);
|
messages.push(message);
|
||||||
}
|
}
|
||||||
@@ -239,7 +251,9 @@ export class ChatHistoryManager {
|
|||||||
// 按时间戳排序,确保消息顺序正确
|
// 按时间戳排序,确保消息顺序正确
|
||||||
messages.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0));
|
messages.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0));
|
||||||
|
|
||||||
console.log(`Converted ${serverMessages.length} server messages to ${messages.length} local messages`);
|
console.log(
|
||||||
|
`Converted ${serverMessages.length} server messages to ${messages.length} local messages`
|
||||||
|
);
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +264,11 @@ export class ChatHistoryManager {
|
|||||||
* @param limit 每页数量
|
* @param limit 每页数量
|
||||||
* @returns 是否成功获取数据
|
* @returns 是否成功获取数据
|
||||||
*/
|
*/
|
||||||
private async fetchServerChatHistory(roleId: number, page: number = 1, limit: number = 20): Promise<boolean> {
|
private async fetchServerChatHistory(
|
||||||
|
roleId: number,
|
||||||
|
page: number = 1,
|
||||||
|
limit: number = 20
|
||||||
|
): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
const reqData = {
|
const reqData = {
|
||||||
GirlId: roleId,
|
GirlId: roleId,
|
||||||
@@ -267,13 +285,27 @@ export class ChatHistoryManager {
|
|||||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
const category = girlData.getGrilCategoryById(roleId);
|
const category = girlData.getGrilCategoryById(roleId);
|
||||||
girlData.setChatRecord(category.toString(), roleId, resData.msgs);
|
girlData.setChatRecord(category.toString(), roleId, resData.msgs);
|
||||||
girlData.setChatTotalCount(category.toString(), roleId, resData.chatTotalCount);
|
girlData.setChatTotalCount(
|
||||||
girlData.setChatRemainCount(category.toString(), roleId, resData.chatRemainCount);
|
category.toString(),
|
||||||
|
roleId,
|
||||||
|
resData.chatTotalCount
|
||||||
|
);
|
||||||
|
girlData.setChatRemainCount(
|
||||||
|
category.toString(),
|
||||||
|
roleId,
|
||||||
|
resData.chatRemainCount
|
||||||
|
);
|
||||||
|
|
||||||
console.log(`成功从服务端获取聊天记录,roleId: ${roleId}, 消息数: ${resData.msgs?.length || 0}`);
|
console.log(
|
||||||
|
`成功从服务端获取聊天记录,roleId: ${roleId}, 消息数: ${
|
||||||
|
resData.msgs?.length || 0
|
||||||
|
}`
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
console.warn(`从服务端获取聊天记录失败,roleId: ${roleId}, code: ${res?.code}`);
|
console.warn(
|
||||||
|
`从服务端获取聊天记录失败,roleId: ${roleId}, code: ${res?.code}`
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -288,7 +320,10 @@ export class ChatHistoryManager {
|
|||||||
* @param serverMessages 服务端消息
|
* @param serverMessages 服务端消息
|
||||||
* @returns 合并后的消息数组
|
* @returns 合并后的消息数组
|
||||||
*/
|
*/
|
||||||
private mergeHistories(localMessages: ChatMessage[], serverMessages: ChatMessage[]): ChatMessage[] {
|
private mergeHistories(
|
||||||
|
localMessages: ChatMessage[],
|
||||||
|
serverMessages: ChatMessage[]
|
||||||
|
): ChatMessage[] {
|
||||||
if (!localMessages || localMessages.length === 0) {
|
if (!localMessages || localMessages.length === 0) {
|
||||||
return serverMessages || [];
|
return serverMessages || [];
|
||||||
}
|
}
|
||||||
@@ -301,14 +336,14 @@ export class ChatHistoryManager {
|
|||||||
const messageMap = new Map<number, ChatMessage>();
|
const messageMap = new Map<number, ChatMessage>();
|
||||||
|
|
||||||
// 先添加本地消息(优先级更高)
|
// 先添加本地消息(优先级更高)
|
||||||
localMessages.forEach(msg => {
|
localMessages.forEach((msg) => {
|
||||||
if (msg.timestamp) {
|
if (msg.timestamp) {
|
||||||
messageMap.set(msg.timestamp, msg);
|
messageMap.set(msg.timestamp, msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 添加服务端消息(如果时间戳不冲突)
|
// 添加服务端消息(如果时间戳不冲突)
|
||||||
serverMessages.forEach(msg => {
|
serverMessages.forEach((msg) => {
|
||||||
if (msg.timestamp && !messageMap.has(msg.timestamp)) {
|
if (msg.timestamp && !messageMap.has(msg.timestamp)) {
|
||||||
messageMap.set(msg.timestamp, msg);
|
messageMap.set(msg.timestamp, msg);
|
||||||
}
|
}
|
||||||
@@ -318,7 +353,9 @@ export class ChatHistoryManager {
|
|||||||
const mergedMessages = Array.from(messageMap.values());
|
const mergedMessages = Array.from(messageMap.values());
|
||||||
mergedMessages.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0));
|
mergedMessages.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0));
|
||||||
|
|
||||||
console.log(`合并聊天记录: 本地 ${localMessages.length} 条, 服务端 ${serverMessages.length} 条, 合并后 ${mergedMessages.length} 条`);
|
console.log(
|
||||||
|
`合并聊天记录: 本地 ${localMessages.length} 条, 服务端 ${serverMessages.length} 条, 合并后 ${mergedMessages.length} 条`
|
||||||
|
);
|
||||||
return mergedMessages;
|
return mergedMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +370,9 @@ export class ChatHistoryManager {
|
|||||||
|
|
||||||
// 2. 如果本地有数据,直接返回
|
// 2. 如果本地有数据,直接返回
|
||||||
if (localHistory && localHistory.length > 0) {
|
if (localHistory && localHistory.length > 0) {
|
||||||
console.log(`使用本地聊天记录,roleId: ${roleId}, 消息数: ${localHistory.length}`);
|
console.log(
|
||||||
|
`使用本地聊天记录,roleId: ${roleId}, 消息数: ${localHistory.length}`
|
||||||
|
);
|
||||||
return localHistory;
|
return localHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,18 +398,21 @@ export class ChatHistoryManager {
|
|||||||
serverMessages.push({
|
serverMessages.push({
|
||||||
msgId: id,
|
msgId: id,
|
||||||
msg: msg,
|
msg: msg,
|
||||||
isAi: isAi
|
isAi: isAi,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. 转换服务端数据格式
|
// 5. 转换服务端数据格式
|
||||||
const convertedMessages = this.convertServerDataToLocalFormat(serverMessages);
|
const convertedMessages =
|
||||||
|
this.convertServerDataToLocalFormat(serverMessages);
|
||||||
|
|
||||||
// 6. 保存到本地存储
|
// 6. 保存到本地存储
|
||||||
if (convertedMessages.length > 0) {
|
if (convertedMessages.length > 0) {
|
||||||
this.saveHistory(roleId, convertedMessages);
|
this.saveHistory(roleId, convertedMessages);
|
||||||
console.log(`从服务端获取并保存聊天记录,roleId: ${roleId}, 消息数: ${convertedMessages.length}`);
|
console.log(
|
||||||
|
`从服务端获取并保存聊天记录,roleId: ${roleId}, 消息数: ${convertedMessages.length}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return convertedMessages;
|
return convertedMessages;
|
||||||
|
|||||||
@@ -1,52 +1,104 @@
|
|||||||
import { _decorator, Component, Node,Sprite,Vec3 ,tween, UITransform} from 'cc';
|
import {
|
||||||
|
_decorator,
|
||||||
|
Component,
|
||||||
|
Node,
|
||||||
|
Sprite,
|
||||||
|
Vec3,
|
||||||
|
tween,
|
||||||
|
UITransform,
|
||||||
|
path,
|
||||||
|
} from "cc";
|
||||||
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||||
import Utils from "db://assets/Scripts/Main/Common/Utils";
|
import Utils from "db://assets/Scripts/Main/Common/Utils";
|
||||||
import { ViewManager } from "db://assets/Scripts/Main/Manager/ViewManager";
|
import { ViewManager } from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||||
|
import { DataId, DataManager } from "../../data/DataManager";
|
||||||
|
import { GirlData } from "../../data/GirlData";
|
||||||
|
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||||
|
import { GButton } from "../../../Main/Common/GButton";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('ImagePopup')
|
@ccclass("ImagePopup")
|
||||||
export class ImagePopup extends Component {
|
export class ImagePopup extends Component {
|
||||||
@property(Sprite)
|
@property(Sprite)
|
||||||
image: Sprite;
|
image: Sprite;
|
||||||
|
|
||||||
|
start() {
|
||||||
start()
|
|
||||||
{
|
|
||||||
this.node.setPosition(new Vec3(-1500, 493, 0));
|
this.node.setPosition(new Vec3(-1500, 493, 0));
|
||||||
this.image.node.on(Node.EventType.TOUCH_START,this.openImage);
|
GButton.BandClick(this.image.node, this.openImage, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
onDestroy()
|
onDestroy() {
|
||||||
{
|
|
||||||
//this.image.node.off(Node.EventType.TOUCH_START,this.openImage);
|
//this.image.node.off(Node.EventType.TOUCH_START,this.openImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh(path:string)
|
categoryId: string;
|
||||||
{
|
girlId: number;
|
||||||
ResManager.I.changeBundleSpriteFrame(this.image,path,"Chat18x",()=>{
|
resId: number;
|
||||||
|
//url: string;
|
||||||
|
refresh(categoryId: string, girlId: number, resId: number, clear = false) {
|
||||||
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
|
this.categoryId = categoryId;
|
||||||
|
this.girlId = girlId;
|
||||||
|
this.resId = resId;
|
||||||
|
const url = girlData.getGrilPhotoPic(categoryId, girlId, resId);
|
||||||
|
//this.url = path;
|
||||||
|
ResManager.I.changeBundleSpriteFrame(
|
||||||
|
this.image,
|
||||||
|
url + (clear ? "" : "_thumbnail_blur"),
|
||||||
|
"Girls",
|
||||||
|
() => {
|
||||||
let sizeTran = this.image.node.parent.getComponent(UITransform);
|
let sizeTran = this.image.node.parent.getComponent(UITransform);
|
||||||
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize,this.image.node,2);
|
Utils.adjustBgPixelRatioToSize(
|
||||||
|
sizeTran.contentSize,
|
||||||
|
this.image.node,
|
||||||
|
2
|
||||||
|
);
|
||||||
this.popUp();
|
this.popUp();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshSelf() {
|
||||||
|
this.refresh(this.categoryId, this.girlId, this.resId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
openImage() {
|
||||||
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
|
const isUnlock = girlData.isImageUnlock(
|
||||||
|
this.categoryId,
|
||||||
|
this.girlId,
|
||||||
|
this.resId
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isUnlock) {
|
||||||
|
let data = {
|
||||||
|
url: girlData.getGrilPhotoPic(this.categoryId, this.girlId, this.resId),
|
||||||
|
isImg: true,
|
||||||
|
};
|
||||||
|
ViewManager.I.openBundlesView("ShowPanel", data);
|
||||||
|
} else {
|
||||||
|
ViewManager.I.openBundlesView("PopupGirlDetailPanel", {
|
||||||
|
category: this.categoryId,
|
||||||
|
resId: this.resId,
|
||||||
|
girlId: this.girlId,
|
||||||
|
base: this,
|
||||||
|
type: proto.cs.EnmResType.ERT_Image,
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
openImage()
|
//
|
||||||
{
|
|
||||||
let data = {url:"Image/Girls/10001/DetailImg/10001_3"};
|
|
||||||
ViewManager.I.openBundlesView('ShowPanel',data);
|
|
||||||
}
|
}
|
||||||
popUp()
|
popUp() {
|
||||||
{
|
tween(this.node)
|
||||||
tween(this.node).to(0.5,{position:new Vec3(-559.374,493,0)},{easing:"backOut"}).start();
|
.to(0.5, { position: new Vec3(-559.374, 493, 0) }, { easing: "backOut" })
|
||||||
|
.start();
|
||||||
this.scheduleOnce(() => {
|
this.scheduleOnce(() => {
|
||||||
this.popDown();
|
this.popDown();
|
||||||
}, 5);
|
}, 5);
|
||||||
}
|
}
|
||||||
popDown()
|
popDown() {
|
||||||
{
|
tween(this.node)
|
||||||
tween(this.node).to(0.5,{position:new Vec3(-1500,493,0)},{easing:"backIn"}).start();
|
.to(0.5, { position: new Vec3(-1500, 493, 0) }, { easing: "backIn" })
|
||||||
|
.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,14 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
|
|||||||
this,
|
this,
|
||||||
this.onEmotionInitialized
|
this.onEmotionInitialized
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Utils.addInnerEL(
|
||||||
|
InnerMsgCode.ChatTotalCountChange,
|
||||||
|
this,
|
||||||
|
this.onChatCountChange
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onDestroy(): void {
|
onDestroy(): void {
|
||||||
Utils.removeInnerEL(
|
Utils.removeInnerEL(
|
||||||
InnerMsgCode.Chat_DialogRefresh,
|
InnerMsgCode.Chat_DialogRefresh,
|
||||||
@@ -160,7 +167,11 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
|
|||||||
this,
|
this,
|
||||||
this.onLanguageChangeCallback
|
this.onLanguageChangeCallback
|
||||||
);
|
);
|
||||||
|
Utils.removeInnerEL(
|
||||||
|
InnerMsgCode.ChatTotalCountChange,
|
||||||
|
this,
|
||||||
|
this.onChatCountChange
|
||||||
|
);
|
||||||
Utils.removeInnerEL(
|
Utils.removeInnerEL(
|
||||||
InnerMsgCode.Chat_EmotionInitialized,
|
InnerMsgCode.Chat_EmotionInitialized,
|
||||||
this,
|
this,
|
||||||
@@ -193,8 +204,6 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
|
|||||||
//const dataDetail = roleData.detail;
|
//const dataDetail = roleData.detail;
|
||||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.nameKey = girlData.getGrilName(this.categoryId, this.id);
|
this.nameKey = girlData.getGrilName(this.categoryId, this.id);
|
||||||
this.girlName.string = LanguageUtils.getText(this.nameKey);
|
this.girlName.string = LanguageUtils.getText(this.nameKey);
|
||||||
// ResManager.I.changeBundleSpriteFrame(
|
// ResManager.I.changeBundleSpriteFrame(
|
||||||
@@ -279,6 +288,14 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
|
|||||||
}, 0.1);
|
}, 0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onChatCountChange() {
|
||||||
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
|
let triggerId = girlData.getTriggerGrilPhotoId(this.categoryId, this.id);
|
||||||
|
|
||||||
|
if (triggerId == 0) triggerId = 100040103;
|
||||||
|
|
||||||
|
this.popUpImage.refresh(this.categoryId, this.id, triggerId);
|
||||||
|
}
|
||||||
|
|
||||||
setVideoEnable(enable: boolean) {
|
setVideoEnable(enable: boolean) {
|
||||||
if (!this.girlVideo) return;
|
if (!this.girlVideo) return;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { GirlData } from "../../data/GirlData";
|
|||||||
import { WalletData } from "../../data/WalletData";
|
import { WalletData } from "../../data/WalletData";
|
||||||
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||||
import LanguageUtils from "../../../Main/Common/LanguageUtils";
|
import LanguageUtils from "../../../Main/Common/LanguageUtils";
|
||||||
|
import { ImagePopup } from "../components/ImagePopup";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass("PopupGirlDetailPanel")
|
@ccclass("PopupGirlDetailPanel")
|
||||||
@@ -19,7 +20,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
|||||||
private girlId: number;
|
private girlId: number;
|
||||||
private resId: number;
|
private resId: number;
|
||||||
private type: proto.cs.EnmResType;
|
private type: proto.cs.EnmResType;
|
||||||
private base: DetailImageItem;
|
private base: DetailImageItem | ImagePopup;
|
||||||
|
|
||||||
private desc: Label;
|
private desc: Label;
|
||||||
openUIDataCT(data) {
|
openUIDataCT(data) {
|
||||||
@@ -96,7 +97,11 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
|||||||
walletData.balance = Number(resData.balance);
|
walletData.balance = Number(resData.balance);
|
||||||
walletData.vipExpire = Number(resData.vipExpire);
|
walletData.vipExpire = Number(resData.vipExpire);
|
||||||
// 刷新界面
|
// 刷新界面
|
||||||
|
if (this.base instanceof DetailImageItem) {
|
||||||
this.base.refreshVideoBuy(true);
|
this.base.refreshVideoBuy(true);
|
||||||
|
} else {
|
||||||
|
this.base.refreshSelf();
|
||||||
|
}
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ export class DetailImageItem extends Component {
|
|||||||
onLoad() {
|
onLoad() {
|
||||||
GButton.BandClick(this.node, this.onClickThis, this);
|
GButton.BandClick(this.node, this.onClickThis, this);
|
||||||
this.uitransform = this.node.getComponent(UITransform);
|
this.uitransform = this.node.getComponent(UITransform);
|
||||||
|
this.test_resID.active = false;
|
||||||
}
|
}
|
||||||
isVisible: boolean;
|
isVisible: boolean;
|
||||||
onClickThis() {
|
onClickThis() {
|
||||||
|
|||||||
+1
-1
Submodule proto_cs updated: 02474af62a...f055100cf0
Reference in New Issue
Block a user