新ui入版
This commit is contained in:
@@ -402,7 +402,6 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
|
||||
protected onEnable(): void {
|
||||
if (!this.manager) this.manager = DialogManager.getInstance();
|
||||
|
||||
GameRootUI.I.hideDefaultView();
|
||||
}
|
||||
|
||||
public async OnClickSend() {
|
||||
|
||||
@@ -19,14 +19,12 @@ import { SimpleToggle } from "../components/SimpleToggle";
|
||||
import { DataManager, DataId } from "../../data/DataManager";
|
||||
import { GirlData } from "../../data/GirlData";
|
||||
import { GirlService } from "db://assets/Scripts/chat18x/network/services/GirlService";
|
||||
import proto from 'db://assets/Scripts/proto/proto.pb.js';
|
||||
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("GirlDetailPanel")
|
||||
export class GirlDetailPanel extends li_BaseView {
|
||||
@property(Sprite)
|
||||
avatar: Sprite;
|
||||
@property(VideoPlayer)
|
||||
avatarVideo: VideoPlayer;
|
||||
@property(Label)
|
||||
@@ -109,7 +107,7 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
const videoTransform = this.avatarVideo.node.getComponent(UITransform);
|
||||
|
||||
if (parentTransform && videoTransform && videoTransform.height > 0) {
|
||||
const scale = parentTransform.height / videoTransform.height;
|
||||
const scale = parentTransform.width / videoTransform.width;
|
||||
this.avatarVideo.node.setScale(scale, scale, 1);
|
||||
console.log(
|
||||
`Video scaled to: ${scale}, parent height: ${parentTransform.height}, video height: ${videoTransform.height}`
|
||||
@@ -148,8 +146,11 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
girlData.setGirlDetails(this.category.toString(), res.data);
|
||||
// 根据数据,刷新界面
|
||||
this.nameKey = girlData.getGrilName(this.category.toString(), this.id);
|
||||
this.girlName.string = LanguageUtils.getText(this.nameKey);
|
||||
this.desc.string = girlData.getGrilDesc(this.category.toString(), this.id);
|
||||
this.girlName.string = LanguageUtils.getText(this.nameKey);
|
||||
this.desc.string = girlData.getGrilDesc(
|
||||
this.category.toString(),
|
||||
this.id
|
||||
);
|
||||
|
||||
let desc = "";
|
||||
this.tagKey = girlData.getGrilTagKey(this.category.toString(), this.id);
|
||||
@@ -165,39 +166,43 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
let age = girlData.getGrilAge(this.category.toString(), this.id);
|
||||
this.descAge.string =
|
||||
LanguageUtils.getText("girldetailpanel.age") + age.toString();
|
||||
|
||||
const firstPath = girlData.getGrilVideoPath(this.category.toString(), this.id, 0);
|
||||
ResManager.I.changeBundleVideo(
|
||||
this.avatarVideo,
|
||||
firstPath,
|
||||
"Chat18x"
|
||||
);
|
||||
|
||||
let allPhotoDataCount = girlData.getAllGrilPhotoDataCount(this.category.toString(), this.id);
|
||||
const firstPath = girlData.getGrilVideoPath(
|
||||
this.category.toString(),
|
||||
this.id,
|
||||
0
|
||||
);
|
||||
ResManager.I.changeBundleVideo(this.avatarVideo, firstPath, "Chat18x");
|
||||
|
||||
let allPhotoDataCount = girlData.getAllGrilPhotoDataCount(
|
||||
this.category.toString(),
|
||||
this.id
|
||||
);
|
||||
// 也立即尝试调整(以防已经加载完成)
|
||||
this.adjustVideoScale();
|
||||
this.refreshImgs(1, this.category, this.id, allPhotoDataCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bindImgToggle() {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
let allPhotoDataCount = girlData.getAllGrilPhotoDataCount(this.category.toString(), this.id);
|
||||
let allPhotoDataCount = girlData.getAllGrilPhotoDataCount(
|
||||
this.category.toString(),
|
||||
this.id
|
||||
);
|
||||
this.refreshImgs(1, this.category, this.id, allPhotoDataCount);
|
||||
}
|
||||
|
||||
bindVideoToggle() {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
let allVideoDataCount = girlData.getAllGrilVideoDataCount(this.category.toString(), this.id);
|
||||
let allVideoDataCount = girlData.getAllGrilVideoDataCount(
|
||||
this.category.toString(),
|
||||
this.id
|
||||
);
|
||||
this.refreshImgs(2, this.category, this.id, allVideoDataCount);
|
||||
}
|
||||
|
||||
refreshImgs(
|
||||
type: number,
|
||||
category: number,
|
||||
id: number,
|
||||
count: number
|
||||
) {
|
||||
refreshImgs(type: number, category: number, id: number, count: number) {
|
||||
for (let i = this.imgsLayout.children.length - 1; i >= 0; i--) {
|
||||
this.imgsLayout.children[i].destroy();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ import { ConfigManager } from "../../manager/ConfigManager";
|
||||
import { GirlService } from "db://assets/Scripts/chat18x/network/services/GirlService";
|
||||
import { DataManager, DataId } from "../../data/DataManager";
|
||||
import { GirlData } from "../../data/GirlData";
|
||||
import proto from 'db://assets/Scripts/proto/proto.pb.js';
|
||||
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
import GameRootUI from "../../../Main/Common/GameRootUI";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -59,7 +60,7 @@ export class GirlListPanel extends li_BaseView {
|
||||
item.refreshData(category, id, this.node);
|
||||
newNode.active = true;
|
||||
this.cache.push(item);
|
||||
this.content.addChild(newNode);
|
||||
this.content.addChild(newNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,5 +70,6 @@ export class GirlListPanel extends li_BaseView {
|
||||
}
|
||||
Return() {
|
||||
this.onClose();
|
||||
GameRootUI.I.showDefaultView();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user