fix
This commit is contained in:
@@ -4,6 +4,7 @@ import Utils from "db://assets/Scripts/Main/Common/Utils";
|
||||
import {
|
||||
NavigationManager,
|
||||
PageTransitionType,
|
||||
PanelType,
|
||||
} from "../manager/NavigationManager";
|
||||
import LanguageUtils from "../../Main/Common/LanguageUtils";
|
||||
import { InnerMsgCode } from "../../Main/Config/InnerMsgCode";
|
||||
@@ -11,6 +12,8 @@ import { DataManager, DataId } from "../data/DataManager";
|
||||
import { GirlData } from "../data/GirlData";
|
||||
import { EnvData } from "../data/EnvData";
|
||||
import { ThemeData } from "../data/ThemeData";
|
||||
import { GButton } from "../../Main/Common/GButton";
|
||||
import { logger } from "../../Main/Common/Logger";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -28,6 +31,11 @@ export class PastGirlListItem extends Component {
|
||||
@property(Node)
|
||||
starParent: Node;
|
||||
|
||||
@property(Node)
|
||||
chatBtn: Node;
|
||||
@property(Node)
|
||||
detailBtn: Node;
|
||||
|
||||
stars: Sprite[];
|
||||
|
||||
id: number = -1;
|
||||
@@ -55,6 +63,9 @@ export class PastGirlListItem extends Component {
|
||||
this,
|
||||
this.onLanguageChangeCallback
|
||||
);
|
||||
|
||||
GButton.BandClick(this.chatBtn, this.onClickChat, this);
|
||||
GButton.BandClick(this.detailBtn, this.onClickDetail, this);
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
@@ -120,7 +131,7 @@ export class PastGirlListItem extends Component {
|
||||
let newPath = envData.cdn + "/" + "Girls/" + avatarPath + ".png";
|
||||
ResManager.I.changeRemoteSpriteFrame(this.avatar, newPath, () => {
|
||||
let sizeTran = this.avatar.node.parent.getComponent(UITransform);
|
||||
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.avatar.node, 2);
|
||||
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.avatar.node, 1);
|
||||
});
|
||||
|
||||
// 显示星级(好感度)
|
||||
@@ -194,20 +205,48 @@ export class PastGirlListItem extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
onClickGirl() {
|
||||
// 由于都是已解锁的女孩,直接打开聊天面板作为子面板
|
||||
// 先设置选中的角色ID
|
||||
NavigationManager.Instance.setSelectedGirlId(this.id);
|
||||
onClickDetail() {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
// 是否已经解锁
|
||||
|
||||
// 通过openSubPanel打开ChatPanel作为子面板
|
||||
const chatData = { base: this.baseNode };
|
||||
NavigationManager.Instance.openSubPanel(
|
||||
"ChatPanel",
|
||||
this.baseNode,
|
||||
chatData,
|
||||
{
|
||||
openAnimation: PageTransitionType.SLIDE_LEFT,
|
||||
closeAnimation: PageTransitionType.SLIDE_RIGHT,
|
||||
NavigationManager.Instance.setSelectedGirlId(this.id);
|
||||
NavigationManager.Instance.setSelectedCategoryId(this.category);
|
||||
|
||||
// 以subpanel方式打开GirlDetailPanel
|
||||
const currentPanel = NavigationManager.Instance.getCurrentActivePanelNode();
|
||||
if (currentPanel) {
|
||||
NavigationManager.Instance.openSubPanel(
|
||||
"GirlDetailPanel",
|
||||
currentPanel,
|
||||
this.id,
|
||||
{
|
||||
openAnimation: PageTransitionType.SLIDE_LEFT,
|
||||
closeAnimation: PageTransitionType.SLIDE_RIGHT,
|
||||
hideBasePanel: true, // 隐藏底层panel,实现全屏显示
|
||||
}
|
||||
);
|
||||
} else {
|
||||
logger.warn("[GirlListItem] 无法获取当前激活的主页面");
|
||||
}
|
||||
}
|
||||
|
||||
onClickChat() {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
|
||||
NavigationManager.Instance.setSelectedGirlId(this.id);
|
||||
NavigationManager.Instance.setSelectedCategoryId(
|
||||
girlData.getGrilCategoryById(this.id)
|
||||
);
|
||||
|
||||
NavigationManager.Instance.switchToPanel(
|
||||
PanelType.PAST_GIRL_LIST,
|
||||
false,
|
||||
(base) => {
|
||||
const chatData = { girlId: this.id, base: base };
|
||||
NavigationManager.Instance.openSubPanel("ChatPanel", base, chatData, {
|
||||
openAnimation: PageTransitionType.SLIDE_LEFT,
|
||||
closeAnimation: PageTransitionType.SLIDE_RIGHT,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user