This commit is contained in:
2025-09-10 21:49:39 +08:00
parent 6a9e1ebe57
commit eb2e1857dc
6 changed files with 509 additions and 392 deletions
@@ -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 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;
@ccclass('ImagePopup')
@ccclass("ImagePopup")
export class ImagePopup extends Component {
@property(Sprite)
image:Sprite;
@property(Sprite)
image: Sprite;
start() {
this.node.setPosition(new Vec3(-1500, 493, 0));
GButton.BandClick(this.image.node, this.openImage, this);
}
start()
{
this.node.setPosition(new Vec3(-1500,493,0));
this.image.node.on(Node.EventType.TOUCH_START,this.openImage);
onDestroy() {
//this.image.node.off(Node.EventType.TOUCH_START,this.openImage);
}
categoryId: string;
girlId: number;
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);
Utils.adjustBgPixelRatioToSize(
sizeTran.contentSize,
this.image.node,
2
);
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,
});
}
onDestroy()
{
//this.image.node.off(Node.EventType.TOUCH_START,this.openImage);
}
refresh(path:string)
{
ResManager.I.changeBundleSpriteFrame(this.image,path,"Chat18x",()=>{
let sizeTran = this.image.node.parent.getComponent(UITransform);
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize,this.image.node,2);
this.popUp();
});
}
openImage()
{
let data = {url:"Image/Girls/10001/DetailImg/10001_3"};
ViewManager.I.openBundlesView('ShowPanel',data);
}
popUp()
{
tween(this.node).to(0.5,{position:new Vec3(-559.374,493,0)},{easing:"backOut"}).start();
this.scheduleOnce(()=>{
this.popDown();
},5);
}
popDown()
{
tween(this.node).to(0.5,{position:new Vec3(-1500,493,0)},{easing:"backIn"}).start();
}
//
}
popUp() {
tween(this.node)
.to(0.5, { position: new Vec3(-559.374, 493, 0) }, { easing: "backOut" })
.start();
this.scheduleOnce(() => {
this.popDown();
}, 5);
}
popDown() {
tween(this.node)
.to(0.5, { position: new Vec3(-1500, 493, 0) }, { easing: "backIn" })
.start();
}
}
+21 -4
View File
@@ -148,7 +148,14 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this,
this.onEmotionInitialized
);
Utils.addInnerEL(
InnerMsgCode.ChatTotalCountChange,
this,
this.onChatCountChange
);
}
onDestroy(): void {
Utils.removeInnerEL(
InnerMsgCode.Chat_DialogRefresh,
@@ -160,7 +167,11 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this,
this.onLanguageChangeCallback
);
Utils.removeInnerEL(
InnerMsgCode.ChatTotalCountChange,
this,
this.onChatCountChange
);
Utils.removeInnerEL(
InnerMsgCode.Chat_EmotionInitialized,
this,
@@ -193,8 +204,6 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
//const dataDetail = roleData.detail;
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
this.nameKey = girlData.getGrilName(this.categoryId, this.id);
this.girlName.string = LanguageUtils.getText(this.nameKey);
// ResManager.I.changeBundleSpriteFrame(
@@ -279,6 +288,14 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
}, 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) {
if (!this.girlVideo) return;
@@ -433,7 +450,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
}
onChatLimitReached(): void {
this.payToTalkPanel.show(this.categoryId,this.id);
this.payToTalkPanel.show(this.categoryId, this.id);
}
/**
* 情绪状态更新回调 (实现IChatPanelCallback接口)
@@ -9,6 +9,7 @@ import { GirlData } from "../../data/GirlData";
import { WalletData } from "../../data/WalletData";
import proto from "db://assets/Scripts/proto/proto.pb.js";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { ImagePopup } from "../components/ImagePopup";
const { ccclass, property } = _decorator;
@ccclass("PopupGirlDetailPanel")
@@ -19,7 +20,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
private girlId: number;
private resId: number;
private type: proto.cs.EnmResType;
private base: DetailImageItem;
private base: DetailImageItem | ImagePopup;
private desc: Label;
openUIDataCT(data) {
@@ -96,7 +97,11 @@ export class PopupGirlDetailPanel extends li_BaseView {
walletData.balance = Number(resData.balance);
walletData.vipExpire = Number(resData.vipExpire);
// 刷新界面
this.base.refreshVideoBuy(true);
if (this.base instanceof DetailImageItem) {
this.base.refreshVideoBuy(true);
} else {
this.base.refreshSelf();
}
this.close();
}
}