适配效果优化

This commit is contained in:
2025-08-13 16:17:44 +08:00
parent 8048584f38
commit 5300d68462
10 changed files with 1482 additions and 216 deletions
Binary file not shown.
+8
View File
@@ -63,6 +63,14 @@
"language_fr": "Écrivez ici...",
"language_de": "Nachricht eingeben"
},
{
"key": "settingpanel.title",
"language_en": "Select Language",
"language_cn": "选择语言",
"language_hi": "भाषा चुनें",
"language_fr": "Choisir la langue",
"language_de": "Sprache wählen"
},
{
"key": "category_1001",
"language_en": "Mature Lady",
+67 -13
View File
@@ -117,24 +117,78 @@ export class SceneBgVideoLayer extends li_BaseView {
playLocalLoopVideo(data:any) {
ResManager.I.changeBundleVideo(this.videoPlayer,data.path,"Chat18x",(res:VideoClip)=>{
this.videoPlayer.play();
let uiT:UITransform = this.videoPlayer.node.getComponent(UITransform);
const videoSize = uiT.contentSize;
const targetSize = data.size;
console.log('Video size:', videoSize, 'Target size:', targetSize);
// 计算宽度和高度的缩放比例
const scaleX = targetSize.width / videoSize.width;
const scaleY = targetSize.height / videoSize.height;
// 选择较大的缩放比例以填满整个区域(可能超出但不会有黑边)
const scale = Math.max(scaleX, scaleY);
// 移除之前的事件监听器,避免重复绑定
this.videoPlayer.node.off(VideoPlayer.EventType.READY_TO_PLAY, this.onVideoReadyToPlay, this);
console.log(`Video scaling: scaleX=${scaleX}, scaleY=${scaleY}, final scale=${scale}`);
this.videoPlayer.node.setScale(new Vec3(scale, scale, 1));
// 添加视频准备完成事件监听
this.videoPlayer.node.on(VideoPlayer.EventType.READY_TO_PLAY, this.onVideoReadyToPlay, this);
// 保存当前数据供回调使用
this.currentVideoData = data;
// 也立即尝试调整(以防已经准备好)
this.adjustVideoToFillFrame(data.size, data.bgFrameNode);
});
}
private currentVideoData: any = null;
private onVideoReadyToPlay = () => {
if (this.currentVideoData) {
this.adjustVideoToFillFrame(this.currentVideoData.size, this.currentVideoData.bgFrameNode);
}
}
adjustVideoToFillFrame(targetSize: any, bgFrameNode?: Node) {
if (!this.videoPlayer) return;
const tryAdjust = () => {
let uiT: UITransform = this.videoPlayer.node.getComponent(UITransform);
const videoSize = uiT.contentSize;
console.log('Video size:', videoSize, 'Target size:', targetSize);
if (videoSize.width > 0 && videoSize.height > 0) {
// 计算宽度和高度的缩放比例
const scaleX = targetSize.width / videoSize.width;
const scaleY = targetSize.height / videoSize.height;
// 选择较大的缩放比例以填满整个区域(可能超出但不会有黑边)
const scale = Math.max(scaleX, scaleY);
console.log(`Video scaling: scaleX=${scaleX}, scaleY=${scaleY}, final scale=${scale}`);
this.videoPlayer.node.setScale(new Vec3(scale, scale, 1));
// 只有传入bgFrameNode时才调整位置
if (bgFrameNode && isValid(bgFrameNode) && bgFrameNode.position) {
this.videoPlayer.node.setPosition(
bgFrameNode.position.x,
bgFrameNode.position.y,
bgFrameNode.position.z
);
console.log(`Video positioned to bgFrame center: ${bgFrameNode.position}`);
}
return true;
}
return false;
};
// 立即尝试一次
if (!tryAdjust()) {
// 如果失败,延迟尝试
this.scheduleOnce(() => {
if (!tryAdjust()) {
// 再次延迟尝试
this.scheduleOnce(() => {
tryAdjust();
}, 0.5);
}
}, 0.1);
}
}
/**播放循环视频 */
playLoopVideo(path: string, force = false) {
if (this.remoteLoopPath == path && !force) {
+9 -15
View File
@@ -12,6 +12,7 @@ import {
import li_BaseView from "../../Main/Common/li_BaseView";
import LanguageUtils, { LanguageType } from "../../Main/Common/LanguageUtils";
import AudioManager from "../../Main/Manager/AudioManager";
import ConfigManager from "../../chat18x/manager/ConfigManager";
const { ccclass, property } = _decorator;
@@ -28,6 +29,9 @@ export class SimpleLanguagePanel extends li_BaseView {
@property(Button)
private closeBtn: Button = null;
@property(Node)
private languageDrawdown: Node = null;
@property(Label)
private titleLabel: Label = null;
@@ -62,13 +66,14 @@ export class SimpleLanguagePanel extends li_BaseView {
onEnable() {
this.currentSelectedLang = LanguageUtils.CurrentLanguage;
this.updateSelection();
this.languageDrawdown.active = false;
}
public onClickLanguageSelect() {
this.languageDrawdown.active = true;
}
private initUI() {
if (this.titleLabel) {
this.titleLabel.string = this.getMultiLangTitle();
}
// 初始化语言按钮数组
this.initLanguageButton(this.btnEnglish, LanguageType.EN, "English");
this.initLanguageButton(this.btnChinese, LanguageType.CN, "中文");
@@ -77,17 +82,6 @@ export class SimpleLanguagePanel extends li_BaseView {
this.initLanguageButton(this.btnGerman, LanguageType.DE, "Deutsch");
}
private getMultiLangTitle(): string {
const titles = [
"Select Language",
"选择语言",
"भाषा चुनें",
"Choisir la langue",
"Sprache wählen",
];
return titles.join(" / ");
}
private initLanguageButton(
button: Button,
language: LanguageType,
@@ -105,6 +105,7 @@ export class ChatPanel extends li_BaseView {
Utils.sendInnerMsg(InnerMsgCode.SimplePlayVide, {
path: dataDetail.pics[0],
size: uiTransform.contentSize,
bgFrameNode: this._nodeTab.BgFrame,
});
}
onDialogUpdate() {
@@ -1,4 +1,4 @@
import { _decorator, Component, math, Node, Sprite } from "cc";
import { _decorator, Component, math, Node, Sprite, UITransform } from "cc";
import { Config18x } from "db://assets/Scripts/Main/Config/Config18x";
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
import { ViewManager } from "db://assets/Scripts/Main/Manager/ViewManager";
@@ -20,8 +20,11 @@ export class DetailImageItem extends Component {
base: GirlDetailPanel;
url: string;
uitransform: UITransform;
onLoad() {
GButton.BandClick(this.node, this.onClickThis, this);
this.uitransform = this.node.getComponent(UITransform);
}
onClickThis() {
@@ -36,6 +39,54 @@ export class DetailImageItem extends Component {
this.base.setVideEnable(false);
}
}
scaleToFillItem() {
if (!this.img || !this.img.spriteFrame) return;
// 延迟一帧确保UI布局完成
this.scheduleOnce(() => {
this.doScaleToFill();
}, 0);
}
doScaleToFill() {
if (!this.img || !this.img.spriteFrame) return;
const itemSize = this.uitransform.contentSize;
const imageSize = this.img.spriteFrame.originalSize;
console.log("DetailImageItem doScaleToFill:", {
itemSize,
imageSize,
url: this.url
});
if (
itemSize.width === 0 ||
itemSize.height === 0 ||
imageSize.width === 0 ||
imageSize.height === 0
) {
console.log("DetailImageItem: Invalid size, skipping scale");
return;
}
const scaleX = itemSize.width / imageSize.width;
const scaleY = itemSize.height / imageSize.height;
const scale = Math.max(scaleX, scaleY);
console.log("DetailImageItem scale values:", { scaleX, scaleY, finalScale: scale });
// 设置Sprite的sizeMode为CUSTOM,允许自定义大小
this.img.sizeMode = Sprite.SizeMode.CUSTOM;
// 获取图片节点的UITransform并设置大小
const imgTransform = this.img.node.getComponent(UITransform);
if (imgTransform) {
imgTransform.setContentSize(imageSize.width * scale, imageSize.height * scale);
console.log("DetailImageItem: Set image size to", imgTransform.contentSize);
}
}
refresh(path: string, base: GirlDetailPanel) {
this.base = base;
this.lock.active = false;
@@ -54,7 +105,14 @@ export class DetailImageItem extends Component {
// this.img.color = new math.Color(255, 255, 255, 255);
// }
ResManager.I.changeBundleSpriteFrame(this.img, this.url, "Chat18x");
ResManager.I.changeBundleSpriteFrame(
this.img,
this.url,
"Chat18x",
() => {
this.scaleToFillItem();
}
);
}
}
}
+15 -1
View File
@@ -598,6 +598,8 @@
"__id__": 0
},
"fileId": "72Zr8T/ixB7bYZRSWtwmd/",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
@@ -794,6 +796,8 @@
"__id__": 0
},
"fileId": "39EnTuibZGCr652I/KtAjK",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
@@ -1168,6 +1172,8 @@
"__id__": 0
},
"fileId": "57e5J7vh1M7p6trwHvaWGq",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
@@ -1341,6 +1347,8 @@
"__id__": 0
},
"fileId": "bfSWNeNClPV7y6vofKsuzM",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
@@ -1461,6 +1469,8 @@
"__id__": 0
},
"fileId": "bbti0yYsZHGpPCtqZ37P2r",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
@@ -3692,7 +3702,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -483.71500000000003,
"x": -505.45,
"y": 47,
"z": 0
},
@@ -4405,6 +4415,8 @@
"__id__": 0
},
"fileId": "63rx8crEFCYI2KnhlywsIA",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
@@ -4807,6 +4819,8 @@
"__id__": 0
},
"fileId": "81Uff7uwFDBpNbH8mEhRRb",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
+12 -12
View File
@@ -4001,7 +4001,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 345.76416015625,
"x": 341.76416015625,
"y": 443.8,
"z": 0
},
@@ -4139,7 +4139,7 @@
"_alignFlags": 33,
"_target": null,
"_left": 0,
"_right": 21,
"_right": 25,
"_top": 21,
"_bottom": 0,
"_horizontalCenter": 0,
@@ -4199,7 +4199,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 483.26416015625,
"x": 479.26416015625,
"y": 372.35699999999997,
"z": 0
},
@@ -4337,7 +4337,7 @@
"_alignFlags": 33,
"_target": null,
"_left": 0,
"_right": 21,
"_right": 25,
"_top": 82.3,
"_bottom": 0,
"_horizontalCenter": 0,
@@ -4441,7 +4441,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1167,
"width": 1117,
"height": 813.5
},
"_anchorPoint": {
@@ -4537,8 +4537,8 @@
},
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_left": 25,
"_right": 25,
"_top": 166.5,
"_bottom": 0,
"_horizontalCenter": 0,
@@ -4552,7 +4552,7 @@
"_originalWidth": 158.4716796875,
"_originalHeight": 70.686,
"_alignMode": 2,
"_lockFlags": 37,
"_lockFlags": 45,
"_id": ""
},
{
@@ -4660,7 +4660,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1167,
"width": 1117,
"height": 279.086
},
"_anchorPoint": {
@@ -4756,8 +4756,8 @@
},
"_alignFlags": 41,
"_target": null,
"_left": 0,
"_right": 0,
"_left": 25,
"_right": 25,
"_top": 221.2,
"_bottom": 0,
"_horizontalCenter": 0,
@@ -4771,7 +4771,7 @@
"_originalWidth": 158.4716796875,
"_originalHeight": 70.686,
"_alignMode": 2,
"_lockFlags": 37,
"_lockFlags": 45,
"_id": ""
},
{
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,6 +1,6 @@
themepanel.title Girls Online 在线选妃+ऑनलाइन लड़कियाँFilles en ligneMädchen Onlinethemepanel.recomandtextDaily Recomand 每日推荐%दैनिक सिफारिशRecommandation quotidienneTägliche Empfehlunggirllistpanel.title Girl List 技师列表,लड़कियों की सूचीListe des filles␍Mädchenlistegirldetailpanel.chatbtn
themepanel.title Girls Online 在线选妃+ऑनलाइन लड़कियाँFilles en ligneMädchen Onlinethemepanel.recomandtextDaily Recomand 每日推荐%दैनिक सिफारिशRecommandation quotidienneTägliche Empfehlunggirllistpanel.title Girl List 技师列表,लड़कियों की सूचीListe des filles␍Mädchenlistegirldetailpanel.chatbtn
Send Msgs! 发送消息संदेश भेजेंEnvoyer un messageNachricht sendengirldetailpanel.nameName:名字:
नाम:Nom:Name:girldetailpanel.ageAge:年龄:␍उम्र:Âge:Alter:girldetailpanel.desc Description:␍自我介绍:विवरण: Description:␍Beschreibung:chatpanel.inputplaceholder Messages! 请输入:संदेश लिखेंÉcrivez ici...Nachricht eingeben␍category_1001 Mature Lady熟女%परिपक्व महिला Femme mature
नाम:Nom:Name:girldetailpanel.ageAge:年龄:␍उम्र:Âge:Alter:girldetailpanel.desc Description:␍自我介绍:विवरण: Description:␍Beschreibung:chatpanel.inputplaceholder Messages! 请输入:संदेश लिखेंÉcrivez ici...Nachricht eingebensettingpanel.titleSelect Language 选择语言भाषा चुनेंChoisir la langueSprache wählen␍category_1001 Mature Lady熟女%परिपक्व महिला Femme mature
Reife Dame␍category_1002Eighteen18岁अठारह वर्ष Dix-huit ansAchtzehn␍category_1003 Hot Mommy辣妈सेक्सी माँ
Maman sexy Heiße Mama␍category_1004Binding捆绑 बंधनBondageFesseln␍category_1005 Public Fight 公众野战+सार्वजनिक संभोग Sexe publicÖffentlicher Sex␍category_1006Cartoon卡通कार्टून␍Dessin animé Zeichentrick␍category_1007 Up Coming Up Comingकार्टून␍Dessin animé Zeichentrickgirl_10001_name Anaya Kapoor 阿纳雅आन्या कपूर Anaya Kapoor Anaya Kapoorgirl_10002_name Meher Joshi梅尔मेहर जोशी Meher Joshi Meher Joshigirl_10003_name
Sana Reddy萨娜साना रेड्डी