This commit is contained in:
2025-09-21 14:28:17 +08:00
parent 11e8e516b7
commit d823fa9083
16 changed files with 635 additions and 701 deletions
+42 -56
View File
@@ -7,68 +7,54 @@ import { ConfirmDialog } from "./Item/ConfirmDialog";
import { CommAdDialog } from "./Item/CommAdDialog";
import Utils from "../Main/Common/Utils";
import { InnerMsgCode } from "../Main/Config/InnerMsgCode";
import { TipsPanel } from "../chat18x/ui/panels/TipsPanel";
const { ccclass, property } = _decorator;
//项目管理器
@ccclass('SubManager')
@ccclass("SubManager")
export default class SubManager {
private static _I: SubManager = null;
public static get I(): SubManager {
if (!SubManager._I) {
SubManager._I = new SubManager();
SubManager._I.init();
}
return SubManager._I;
private static _I: SubManager = null;
public static get I(): SubManager {
if (!SubManager._I) {
SubManager._I = new SubManager();
SubManager._I.init();
}
return SubManager._I;
}
private init(){
private init() {}
//飘字提示----------------------------------------------------------------------------
public static ShowPrompt(text: string) {
TipsPanel.show(text);
}
//显示确定框----------------------------------------------------------------------------
/**通用确认框 { content: string, strYes?: string, strNo?: string, yesCallback?: Function, noCallback?: Function, closeCallback?: Function } */
public static ShowConfirm(param: any) {
if (!GameRootUI.I) {
console.warn("GameRootUI还未初始化", param);
return;
}
//飘字提示----------------------------------------------------------------------------
public static ShowPrompt(text: string) {
if (!GameRootUI.I) {
console.warn("GameRootUI还未初始化", text);
Utils.sendInnerMsg(InnerMsgCode.UI_ShowPrompt, {text: text});
return
}
ResManager.I.loadSubpackagePrefab("item/promptItem", (n_node: Node)=>{
GameRootUI.I.AddUIToLayer(n_node, CommonConfig.UILayerGroup.Layer_tips)
let pItem = n_node.getComponent(promptItem)
pItem.setLabel(text)
})
ResManager.I.loadSubpackagePrefab("item/ConfirmDialog", (n_node: Node) => {
GameRootUI.I.AddUIToLayer(n_node, CommonConfig.UILayerGroup.Layer_tips);
let pItem = n_node.getComponent(ConfirmDialog);
pItem.setParam(param);
});
}
//显示通用广告框----------------------------------------------------------------------------
/**通用广告框 { content: string, strAd?: string, strLeft?: string, adCallback?: Function, leftCallback?: Function, closeCallback?: Function } */
public static ShowCommonAdDialog(param: any) {
if (!GameRootUI.I) {
console.warn("GameRootUI还未初始化", param);
return;
}
//显示确定框----------------------------------------------------------------------------
/**通用确认框 { content: string, strYes?: string, strNo?: string, yesCallback?: Function, noCallback?: Function, closeCallback?: Function } */
public static ShowConfirm(param:any) {
if (!GameRootUI.I) {
console.warn("GameRootUI还未初始化", param);
return
}
ResManager.I.loadSubpackagePrefab("item/ConfirmDialog", (n_node: Node)=>{
GameRootUI.I.AddUIToLayer(n_node, CommonConfig.UILayerGroup.Layer_tips)
let pItem = n_node.getComponent(ConfirmDialog)
pItem.setParam(param)
})
}
//显示通用广告框----------------------------------------------------------------------------
/**通用广告框 { content: string, strAd?: string, strLeft?: string, adCallback?: Function, leftCallback?: Function, closeCallback?: Function } */
public static ShowCommonAdDialog(param:any) {
if (!GameRootUI.I) {
console.warn("GameRootUI还未初始化", param);
return
}
ResManager.I.loadSubpackagePrefab("item/CommAdDialog", (n_node: Node)=>{
GameRootUI.I.AddUIToLayer(n_node, CommonConfig.UILayerGroup.Layer_tips)
let pItem = n_node.getComponent(CommAdDialog)
pItem.setParam(param)
})
}
}
ResManager.I.loadSubpackagePrefab("item/CommAdDialog", (n_node: Node) => {
GameRootUI.I.AddUIToLayer(n_node, CommonConfig.UILayerGroup.Layer_tips);
let pItem = n_node.getComponent(CommAdDialog);
pItem.setParam(param);
});
}
}
+1 -16
View File
@@ -106,11 +106,7 @@ export class PreloadUI extends Component {
}
protected onDestroy(): void {
Utils.removeInnerEL(
InnerMsgCode.UI_ShowPrompt,
this,
this.resiveShowPrompt
);
}
update(deltaTime: number) {
@@ -127,17 +123,6 @@ export class PreloadUI extends Component {
}
}
/**收到飘字消息 */
resiveShowPrompt(data: any) {
let msg = data.text;
let self = this;
ResManager.I.loadSubpackagePrefab("item/promptItem", (n_node: Node) => {
self.node.addChild(n_node);
let pItem = n_node.getComponent(promptItem);
pItem.setLabel(msg);
});
}
//预加载文件
preloadFiles() {
let preloadTab = [
@@ -127,14 +127,20 @@ export class NavigationManager {
* 统一的面板切换方法
* @param panelType 目标面板类型
*/
public switchToPanel(panelType: PanelType, force: boolean = false): Node {
public switchToPanel(
panelType: PanelType,
force: boolean = false,
callback: Function = null
): Node {
if (!panelType) {
console.error("[NavigationManager] switchToPanel: panelType is invalid");
return null;
}
if (this.currentActivePanelType === panelType && !force) {
console.log(`[NavigationManager] Already on ${panelType}, skipping switch`);
console.log(
`[NavigationManager] Already on ${panelType}, skipping switch`
);
return this.currentActivePanel;
}
@@ -161,10 +167,9 @@ export class NavigationManager {
const showDirection = isMovingRight ? "right" : "left";
// 隐藏当前面板(包括子页面)
if (!this.currentActivePanel || !this.currentActivePanel.isValid) {
return;
if (this.currentActivePanel && this.currentActivePanel.isValid) {
this.hidePanelWithAnimation(this.currentActivePanel, hideDirection);
}
this.hidePanelWithAnimation(this.currentActivePanel, hideDirection);
// 加载并显示目标面板
this.loadOrGetPanel(panelType, (panel: Node) => {
@@ -179,13 +184,15 @@ export class NavigationManager {
this.showPanelWithAnimation(panel, showDirection, () => {
this.currentActivePanel = panel;
this.navigationPanel.hideLoading?.();
if (callback instanceof Function) callback(panel);
});
});
}
private subPanelDic: Map<Node, Node[]> = new Map();
private subPanelMapping: Map<Node, PanelType> = new Map();
private subPanelAnimationConfigs: Map<Node, SubPanelAnimationConfig> = new Map();
private subPanelAnimationConfigs: Map<Node, SubPanelAnimationConfig> =
new Map();
// 弹窗管理相关属性
private popupPanels: Set<Node> = new Set(); // 管理所有打开的弹窗
@@ -193,6 +200,75 @@ export class NavigationManager {
// 动画锁,防止动画中重复操作
private isAnimating: boolean = false;
/**
* 带动画的子面板清理方法
* @param basePanel 主面板节点
* @param callback 所有动画完成后的回调
*/
private clearSubPanelsWithAnimation(
basePanel: Node,
callback?: Function
): void {
if (!basePanel || !basePanel.isValid) {
callback && callback();
return;
}
const subPanels = this.subPanelDic.get(basePanel);
if (!subPanels || subPanels.length === 0) {
callback && callback();
return;
}
let completedCount = 0;
const totalCount = subPanels.length;
// 完成动画的回调
const onAnimationComplete = () => {
completedCount++;
if (completedCount >= totalCount) {
// 清理subPanelDic
this.subPanelDic.delete(basePanel);
callback && callback();
}
};
// 同时播放所有子面板的关闭动画
for (let i = subPanels.length - 1; i >= 0; i--) {
const subPanel = subPanels[i];
if (subPanel && subPanel.isValid) {
// 获取动画配置
let config = this.subPanelAnimationConfigs.get(subPanel);
if (!config) {
config = {
openAnimation: PageTransitionType.SCALE,
closeAnimation: PageTransitionType.SCALE,
duration: 0.2,
};
}
// 播放关闭动画
this.playSubPanelCloseAnimation(subPanel, config, () => {
// 清理映射
this.subPanelMapping.delete(subPanel);
this.subPanelAnimationConfigs.delete(subPanel);
// 销毁节点
const baseView = subPanel.getComponent(li_BaseView);
if (baseView) {
baseView.close();
} else {
subPanel.destroy();
}
onAnimationComplete();
});
} else {
onAnimationComplete();
}
}
}
/**
* 统一的subPanel清理方法
* @param basePanel 主面板节点
@@ -252,13 +328,15 @@ export class NavigationManager {
const defaultConfig: SubPanelAnimationConfig = {
openAnimation: PageTransitionType.SCALE,
closeAnimation: PageTransitionType.SCALE,
duration: 0.3
duration: 0.3,
};
const config = animationConfig || defaultConfig;
const callback = (n: Node) => {
if (!n || !n.isValid) {
console.error("[NavigationManager] openSubPanel: created panel is invalid");
console.error(
"[NavigationManager] openSubPanel: created panel is invalid"
);
return;
}
@@ -273,10 +351,11 @@ export class NavigationManager {
if (basePanelType) {
this.subPanelMapping.set(n, basePanelType);
} else {
console.warn(`[NavigationManager] 无法确定basePanel类型: ${basePanel.name}`);
console.warn(
`[NavigationManager] 无法确定basePanel类型: ${basePanel.name}`
);
}
// 存储动画配置
this.subPanelAnimationConfigs.set(n, config);
@@ -299,12 +378,16 @@ export class NavigationManager {
force: boolean = false
): Node {
if (!panelType) {
console.error("[NavigationManager] switchToPanelWithTransition: panelType is invalid");
console.error(
"[NavigationManager] switchToPanelWithTransition: panelType is invalid"
);
return null;
}
if (this.currentActivePanelType === panelType && !force) {
console.log(`[NavigationManager] Already on ${panelType}, skipping switch`);
console.log(
`[NavigationManager] Already on ${panelType}, skipping switch`
);
return this.currentActivePanel;
}
@@ -322,8 +405,12 @@ export class NavigationManager {
this.navigationPanel.showLoading?.();
// 获取动画方向
const hideDirection = this.getDirectionFromTransitionType(transitionConfig.outgoingTransition);
const showDirection = this.getDirectionFromTransitionType(transitionConfig.incomingTransition);
const hideDirection = this.getDirectionFromTransitionType(
transitionConfig.outgoingTransition
);
const showDirection = this.getDirectionFromTransitionType(
transitionConfig.incomingTransition
);
// 隐藏当前面板(包括子页面)
if (this.currentActivePanel && this.currentActivePanel.isValid) {
@@ -350,7 +437,9 @@ export class NavigationManager {
/**
* 将过渡类型转换为方向字符串
*/
private getDirectionFromTransitionType(transitionType: PageTransitionType): "left" | "right" | "up" | "down" {
private getDirectionFromTransitionType(
transitionType: PageTransitionType
): "left" | "right" | "up" | "down" {
switch (transitionType) {
case PageTransitionType.SLIDE_LEFT:
return "left";
@@ -368,7 +457,10 @@ export class NavigationManager {
/**
* 执行子面板打开动画
*/
private playSubPanelOpenAnimation(panel: Node, config: SubPanelAnimationConfig): void {
private playSubPanelOpenAnimation(
panel: Node,
config: SubPanelAnimationConfig
): void {
if (!panel || !panel.isValid) {
return;
}
@@ -447,7 +539,11 @@ export class NavigationManager {
* @param data 传递的数据
* @param callback 可选的回调函数
*/
public openPopupPanel(panelName: string, data: any = null, callback?: Function): void {
public openPopupPanel(
panelName: string,
data: any = null,
callback?: Function
): void {
if (!panelName) {
console.error("[NavigationManager] openPopupPanel: panelName is empty");
return;
@@ -455,13 +551,17 @@ export class NavigationManager {
const popupCallback = (panel: Node) => {
if (!panel || !panel.isValid) {
console.error("[NavigationManager] openPopupPanel: created panel is invalid");
console.error(
"[NavigationManager] openPopupPanel: created panel is invalid"
);
return;
}
// 将弹窗添加到管理集合中
this.popupPanels.add(panel);
console.log(`[NavigationManager] Popup panel opened: ${panelName}, total popups: ${this.popupPanels.size}`);
console.log(
`[NavigationManager] Popup panel opened: ${panelName}, total popups: ${this.popupPanels.size}`
);
if (callback) {
callback(panel);
@@ -484,7 +584,9 @@ export class NavigationManager {
// 从弹窗管理集合中移除
if (this.popupPanels.has(panel)) {
this.popupPanels.delete(panel);
console.log(`[NavigationManager] Popup panel closed: ${panel.name}, total popups: ${this.popupPanels.size}`);
console.log(
`[NavigationManager] Popup panel closed: ${panel.name}, total popups: ${this.popupPanels.size}`
);
}
// 关闭面板
@@ -508,7 +610,9 @@ export class NavigationManager {
return;
}
console.log(`[NavigationManager] Closing all popups, count: ${this.popupPanels.size}`);
console.log(
`[NavigationManager] Closing all popups, count: ${this.popupPanels.size}`
);
// 复制Set以避免在迭代过程中修改
const popupPanelsToClose = Array.from(this.popupPanels);
@@ -522,9 +626,14 @@ export class NavigationManager {
// 确保清空集合
this.popupPanels.clear();
}
public closeSubPanel(panel: Node | li_BaseView, animationConfig?: SubPanelAnimationConfig) {
public closeSubPanel(
panel: Node | li_BaseView,
animationConfig?: SubPanelAnimationConfig
) {
if (!panel) {
console.warn("[NavigationManager] closeSubPanel: panel is null or undefined");
console.warn(
"[NavigationManager] closeSubPanel: panel is null or undefined"
);
return;
}
@@ -549,7 +658,7 @@ export class NavigationManager {
config = {
openAnimation: PageTransitionType.SCALE,
closeAnimation: PageTransitionType.SCALE,
duration: 0.3
duration: 0.3,
};
}
@@ -590,7 +699,9 @@ export class NavigationManager {
this.subPanelDic.delete(baseNode);
}
} else {
console.warn(`[NavigationManager] ${panelNode.name} 不在子页面列表中`);
console.warn(
`[NavigationManager] ${panelNode.name} 不在子页面列表中`
);
}
}
@@ -636,7 +747,9 @@ export class NavigationManager {
case "PersonalPanel":
return PanelType.PERSONAL;
default:
console.warn(`[NavigationManager] Unknown panel type for node: ${node.name}`);
console.warn(
`[NavigationManager] Unknown panel type for node: ${node.name}`
);
return null;
}
}
@@ -713,18 +826,22 @@ export class NavigationManager {
direction: "left" | "right" | "up" | "down",
callback?: Function
) {
if (!panel || !panel.isValid || !panel.active) {
if (!panel || !panel.isValid) {
callback && callback();
return;
}
// 同时开始子面板的关闭动画
this.clearSubPanelsWithAnimation(panel);
if (!panel.active) panel.active = true;
const animationCallback = () => {
panel.active = false;
// 使用统一的subPanel清理方法
this.clearSubPanels(panel, true);
callback && callback();
};
// 主面板动画
switch (direction) {
case "left":
UITransitionHelper.slideOutToLeft(panel, 0.3, animationCallback);
@@ -92,18 +92,6 @@ export class ChatContentsLayout extends Component {
playerBubble.node.active = true;
playerBubble.updateBubbleContent(dialog.content, true);
this.bubbles.push(playerBubble);
// 创建等待回复气泡(插入到首位,显示在玩家消息上面)
// this.waitingBubble = this.createOrGetBubble(false);
// this.waitingBubble.node.active = true;
// this.waitingBubble.updateBubbleContent("...", false, undefined, true);
// this.waitingBubble.node.setSiblingIndex(0);
// this.bubbles.push(this.waitingBubble);
this.node.position = Vec3.ZERO;
// 滚动到底部(等待下一帧Layout更新完成)
this.scheduleOnce(() => {
this.scrollView.scrollToBottom();
}, 0);
}
/**
* 更新AI回复的对话
@@ -120,6 +108,12 @@ export class ChatContentsLayout extends Component {
// 逐个添加AI对话,带延时
this.addAIDialogsWithDelay(dialogs, 0);
this.node.position = Vec3.ZERO;
// 滚动到底部(等待下一帧Layout更新完成)
this.scheduleOnce(() => {
this.scrollView.scrollToBottom();
}, 0);
}
/**
+12 -2
View File
@@ -84,6 +84,13 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
targetSize;
videoAreaPos;
base: Node;
openUIDataCT(data: any) {
this.base = data.base;
}
onLoadCT() {
Utils.parseNode(this.node, this._nodeTab);
@@ -395,8 +402,12 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
protected onEnable(): void {
if (!this.manager) this.manager = DialogManager.getInstance();
this.base.active = false;
this.refresh();
}
protected onDisable(): void {
this.base.active = true;
}
isWaiting: boolean = false;
public async OnClickSend() {
@@ -501,8 +512,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
}
returnBtn() {
// Navigate back to GirlDetailPanel with current girlId using smooth transition
NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL);
NavigationManager.Instance.closeSubPanel(this);
}
onClickRecord() {
NavigationManager.Instance.openPopupPanel("RecordPanel", this.id);
@@ -311,17 +311,15 @@ export class GirlDetailPanel extends li_BaseView {
OnClickChatBtn() {
// 使用带过渡动画的导航方法
NavigationManager.Instance.switchToPanel(PanelType.PAST_GIRL_LIST);
// 延迟打开 ChatPanel,确保 PastGirlListPanel 已经完全加载
this.scheduleOnce(() => {
// 获取当前活动的 PastGirlListPanel 节点
const baseNode = NavigationManager.Instance.getCurrentActivePanelNode();
if (baseNode) {
const chatData = { girlId: this.id };
NavigationManager.Instance.openSubPanel("ChatPanel", baseNode, chatData);
NavigationManager.Instance.switchToPanel(
PanelType.PAST_GIRL_LIST,
false,
(base) => {
const chatData = { girlId: this.id ,base:base};
NavigationManager.Instance.openSubPanel("ChatPanel", base, chatData);
}
}, 0.5); // 延迟 0.5 秒,确保动画完成
);
}
returnBtn() {
@@ -1,4 +1,4 @@
import { _decorator, Component, Node, instantiate } from "cc";
import { _decorator, Component, Node, instantiate, tween, Vec3 } from "cc";
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
import Utils from "db://assets/Scripts/Main/Common/Utils";
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
@@ -8,6 +8,7 @@ import { DataManager, DataId } from "../../data/DataManager";
import { GirlData } from "../../data/GirlData";
import proto from "db://assets/Scripts/proto/proto.pb.js";
import { NavigationManager, PanelType } from "../../manager/NavigationManager";
import { UITransitionHelper } from "../../utils/UITransitionHelper";
const { ccclass, property } = _decorator;
@@ -99,7 +100,8 @@ export class GirlListPanel extends li_BaseView {
girlData.setGirlList(category.toString(), res.data);
// 根据数据,刷新界面
const allId = girlData.getGirlIds(category.toString());
for (let id of allId) {
for (let i = 0; i < allId.length; i++) {
let id = allId[i];
let item = this.getItemFromPool();
item.refreshData(category, id, this.node);
item.node.active = true;
@@ -113,6 +115,28 @@ export class GirlListPanel extends li_BaseView {
}
}
private addSlideInAnimation(itemNode: Node, index: number) {
// 保存节点的目标位置
const targetPosition = itemNode.getPosition();
// 设置初始位置为屏幕右侧外(偏移300像素)
const startPosition = new Vec3(
targetPosition.x + 300,
targetPosition.y,
targetPosition.z
);
itemNode.setPosition(startPosition);
// 添加递进延时,每个item延迟0.05秒
const delay = index * 0.05;
// 执行滑入动画
tween(itemNode)
.delay(delay)
.to(0.4, { position: targetPosition }, { easing: "cubicOut" })
.start();
}
hide() {
this.node.active = false;
}
@@ -121,8 +145,7 @@ export class GirlListPanel extends li_BaseView {
GButton.BandClick(this._nodeTab.ReturnBtn, this.Return, this);
}
Return() {
// 直接关闭,不需要动画
this.node.active = false;
NavigationManager.Instance.closeSubPanel(this);
}
onDestroy() {
@@ -141,16 +164,5 @@ export class GirlListPanel extends li_BaseView {
}
}
this.cache = [];
// 清理 content 中所有的 GirlListItem 节点
for (let i = this.content.children.length - 1; i >= 0; i--) {
let child = this.content.children[i];
if (child !== this.itemInst.node) {
let item = child.getComponent(GirlListItem);
if (item) {
child.destroy();
}
}
}
}
}
@@ -36,7 +36,7 @@ export class NavigationPanel extends li_BaseView {
NavigationManager.Instance.registerNavigationPanel(this);
this.registerListener();
this.updateButtonStates(PanelType.PAST_GIRL_LIST);
this.updateButtonStates(PanelType.THEME);
// 初次打开时通过NavigationManager切换到主题面板
this.initializeFirstPanel();
@@ -101,13 +101,15 @@ export class NavigationPanel extends li_BaseView {
this.girlDetailBtn.setFocus(
this.currentActivePanel === PanelType.GIRL_DETAIL
);
this.pastGirlListBtn.setFocus(this.currentActivePanel === PanelType.PAST_GIRL_LIST);
this.pastGirlListBtn.setFocus(
this.currentActivePanel === PanelType.PAST_GIRL_LIST
);
this.settingBtn.setFocus(this.currentActivePanel === PanelType.PERSONAL);
}
private initializeFirstPanel() {
// 初次打开时通过NavigationManager切换到历史女孩列表面板
NavigationManager.Instance.switchToPanel(PanelType.PAST_GIRL_LIST, true);
NavigationManager.Instance.switchToPanel(PanelType.THEME, true);
}
public showPanel() {
@@ -5,6 +5,7 @@ import { GButton } from "db://assets/Scripts/Main/Common/GButton";
import { PastGirlListItem } from "../../uiitems/PastGirlListItem";
import { DataManager, DataId } from "../../data/DataManager";
import { GirlData } from "../../data/GirlData";
import { ChatHistoryManager } from "../../manager/ChatHistoryManager";
const { ccclass, property } = _decorator;
@@ -68,13 +69,9 @@ export class PastGirlListPanel extends li_BaseView {
// TODO: 实现获取已解锁女孩列表的逻辑
// 这个方法需要遍历所有分类,找出 isRelease === true 的女孩
private getUnlockedGirls(): number[] {
// TODO: 实现获取已解锁女孩列表逻辑
// 需要实现的逻辑:
// 1. 遍历 GirlData 中的所有分类
// 2. 对每个分类中的每个女孩检查 getIsRelease 状态
// 3. 返回所有已解锁女孩的 {category, id} 列表
console.log("TODO: 实现获取已解锁女孩列表逻辑");
return [10001, 10002];
const GirlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
const allids = GirlData.getAllReleaseGirlIds();
return allids;
}
refresh() {
@@ -90,10 +87,22 @@ export class PastGirlListPanel extends li_BaseView {
// 获取已解锁女孩列表
const ids = this.getUnlockedGirls();
// 根据数据,刷新界面
// 创建带时间戳的数组用于排序
const girlsWithTime: {id: number, lastTime: number}[] = [];
// 收集每个女孩的最后聊天时间
for (let id of ids) {
const lastTime = ChatHistoryManager.Instance.getLastChatTime(id) || 0;
girlsWithTime.push({id, lastTime});
}
// 按最后聊天时间降序排序(最近的在前)
girlsWithTime.sort((a, b) => b.lastTime - a.lastTime);
// 根据排序后的数据刷新界面
for (let girlData of girlsWithTime) {
let item = this.getItemFromPool();
item.refreshData(id, this.node);
item.refreshData(girlData.id, this.node);
item.node.active = true;
this.cache.push(item);
@@ -120,8 +120,7 @@ export class PurchasePanel extends li_BaseView {
GButton.BandClick(
this._nodeTab.ReturnBtn,
() => {
this.onClose();
// NavigationPanel 始终显示,不需要显示 DefaultView
NavigationManager.Instance.closeSubPanel(this);
},
this
);
@@ -17,6 +17,7 @@ import LanguageUtils, {
} from "../../../Main/Common/LanguageUtils";
import AudioManager from "../../../Main/Manager/AudioManager";
import PlayerDataManager from "../../../Main/Manager/PlayerDataManager";
import { NavigationManager } from "../../manager/NavigationManager";
const { ccclass, property } = _decorator;
interface LanguageButton {
@@ -58,8 +59,6 @@ export class SettingPanel extends li_BaseView {
this.currentSelectedLang = LanguageUtils.CurrentLanguage;
this.updateSelection();
this.updateAudioButtonStates();
this.playEnterAnimation();
}
private music_on: Node;
@@ -163,7 +162,7 @@ export class SettingPanel extends li_BaseView {
// GButton.BandClick(this._nodeTab.Language1, this.switchToEn, this);
// GButton.BandClick(this._nodeTab.Language2, this.swithcToHi, this);
GButton.BandClick(this._nodeTab.closeBtn, this.close, this);
GButton.BandClick(this._nodeTab.closeBtn, this.onClickClose, this);
this.languageButtons.forEach((langBtn) => {
if (langBtn.button) {
@@ -273,23 +272,7 @@ export class SettingPanel extends li_BaseView {
.start();
}
private playEnterAnimation() {
if (this.panelBg) {
this.panelBg.scale = new Vec3(0.8, 0.8, 1);
tween(this.panelBg)
.to(0.3, { scale: new Vec3(1, 1, 1) }, { easing: "backOut" })
.start();
}
}
private playExitAnimation(callback: () => void) {
if (this.panelBg) {
tween(this.panelBg)
.to(0.2, { scale: new Vec3(0.8, 0.8, 1) }, { easing: "backIn" })
.call(callback)
.start();
} else {
callback();
}
onClickClose() {
NavigationManager.Instance.closeSubPanel(this);
}
}
@@ -64,7 +64,7 @@ export class PastGirlListItem extends Component {
);
}
refreshData(girlId: number, baseNode: Node) {
refreshData(girlId: number, baseNode: Node):number {
if (!this.stars) {
this.stars = this.starParent.getComponentsInChildren(Sprite);
}
@@ -118,7 +118,7 @@ export class PastGirlListItem extends Component {
}
// 显示最近聊天时间
this.updateLastChatTime();
return this.updateLastChatTime();
}
private getLastChatTime(id: number): number | null {
@@ -126,9 +126,10 @@ export class PastGirlListItem extends Component {
}
// 更新最近聊天时间显示
private updateLastChatTime() {
private updateLastChatTime():number {
const lastTime = this.getLastChatTime(this.id);
this.lastChatTime.string = Utils.formatChatTime(lastTime);
return lastTime;
}
reset() {
@@ -449,14 +449,7 @@ export class UITransitionHelper {
// 执行缩放进入动画
tween(node)
.parallel(
tween().to(
duration,
{ scale: new Vec3(1, 1, 1) },
{ easing: "backOut" }
),
tween().to(duration * 0.8, { opacity: 255 }, { easing: "sineOut" })
)
.to(duration, { scale: new Vec3(1, 1, 1) }, { easing: "backOut" })
.call(() => {
if (callback) {
callback();
@@ -484,14 +477,7 @@ export class UITransitionHelper {
// 执行缩放退出动画
tween(node)
.parallel(
tween().to(
duration,
{ scale: new Vec3(0, 0, 1) },
{ easing: "backIn" }
),
tween().to(duration * 0.6, { opacity: 0 }, { easing: "sineOut" })
)
.to(duration, { scale: new Vec3(0, 0, 1) }, { easing: "backIn" })
.call(() => {
if (callback) {
callback();
File diff suppressed because it is too large Load Diff
+42 -58
View File
@@ -25,20 +25,20 @@
"_active": true,
"_components": [
{
"__id__": 258
"__id__": 257
},
{
"__id__": 260
"__id__": 259
},
{
"__id__": 262
"__id__": 261
},
{
"__id__": 264
"__id__": 263
}
],
"_prefab": {
"__id__": 266
"__id__": 265
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -88,17 +88,17 @@
"_active": true,
"_components": [
{
"__id__": 251
"__id__": 250
},
{
"__id__": 253
"__id__": 252
},
{
"__id__": 255
"__id__": 254
}
],
"_prefab": {
"__id__": 257
"__id__": 256
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -4952,23 +4952,23 @@
"__id__": 219
},
{
"__id__": 234
"__id__": 233
}
],
"_active": true,
"_components": [
{
"__id__": 244
"__id__": 243
},
{
"__id__": 246
"__id__": 245
},
{
"__id__": 248
"__id__": 247
}
],
"_prefab": {
"__id__": 250
"__id__": 249
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -5012,7 +5012,7 @@
"__id__": 220
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 226
@@ -5021,11 +5021,11 @@
"__id__": 228
},
{
"__id__": 231
"__id__": 230
}
],
"_prefab": {
"__id__": 233
"__id__": 232
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -5188,8 +5188,6 @@
"__id__": 0
},
"fileId": "9aCRghG1lBCa+25qEAugAS",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
@@ -5232,11 +5230,7 @@
"__prefab": {
"__id__": 229
},
"clickEvents": [
{
"__id__": 230
}
],
"clickEvents": [],
"_interactable": true,
"_transition": 1,
"_normalColor": {
@@ -5282,16 +5276,6 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "4baNYSNShFU444oyMjbAaV"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "ecf27717xFOIo8F0ultYqJq",
"handler": "Return",
"customEventData": ""
},
{
"__type__": "cc.Widget",
"_name": "",
@@ -5302,7 +5286,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 232
"__id__": 231
},
"_alignFlags": 10,
"_target": null,
@@ -5353,20 +5337,20 @@
"_active": true,
"_components": [
{
"__id__": 235
"__id__": 234
},
{
"__id__": 237
"__id__": 236
},
{
"__id__": 239
"__id__": 238
},
{
"__id__": 241
"__id__": 240
}
],
"_prefab": {
"__id__": 243
"__id__": 242
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -5403,11 +5387,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 234
"__id__": 233
},
"_enabled": true,
"__prefab": {
"__id__": 236
"__id__": 235
},
"_contentSize": {
"__type__": "cc.Size",
@@ -5431,11 +5415,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 234
"__id__": 233
},
"_enabled": true,
"__prefab": {
"__id__": 238
"__id__": 237
},
"_customMaterial": null,
"_srcBlendFactor": 2,
@@ -5502,11 +5486,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 234
"__id__": 233
},
"_enabled": true,
"__prefab": {
"__id__": 240
"__id__": 239
},
"_alignFlags": 18,
"_target": null,
@@ -5538,11 +5522,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 234
"__id__": 233
},
"_enabled": true,
"__prefab": {
"__id__": 242
"__id__": 241
},
"languageKey": "girllistpanel.title",
"defaultText": "",
@@ -5576,7 +5560,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 245
"__id__": 244
},
"_contentSize": {
"__type__": "cc.Size",
@@ -5604,7 +5588,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 247
"__id__": 246
},
"_customMaterial": null,
"_srcBlendFactor": 2,
@@ -5649,7 +5633,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 249
"__id__": 248
},
"_alignFlags": 41,
"_target": null,
@@ -5698,7 +5682,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 252
"__id__": 251
},
"_contentSize": {
"__type__": "cc.Size",
@@ -5726,7 +5710,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 254
"__id__": 253
},
"_customMaterial": null,
"_srcBlendFactor": 2,
@@ -5771,7 +5755,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 256
"__id__": 255
},
"_alignFlags": 45,
"_target": null,
@@ -5820,7 +5804,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 259
"__id__": 258
},
"_contentSize": {
"__type__": "cc.Size",
@@ -5848,7 +5832,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 261
"__id__": 260
},
"_alignFlags": 45,
"_target": null,
@@ -5884,7 +5868,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 263
"__id__": 262
},
"_id": ""
},
@@ -5902,7 +5886,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 265
"__id__": 264
},
"m_rootNode": null,
"_id": ""
+29 -69
View File
@@ -88,43 +88,37 @@
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -262.56298828125,
"value": -250,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -262.56298828125,
"value": -250,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -262.56298828125,
"value": -250,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
}
],
"preExtrapolation": 1,
@@ -154,9 +148,7 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
@@ -168,9 +160,7 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
@@ -182,9 +172,7 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
}
],
"preExtrapolation": 1,
@@ -213,9 +201,7 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
@@ -227,9 +213,7 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
}
],
"preExtrapolation": 1,
@@ -304,43 +288,37 @@
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -232.46299743652344,
"value": -220,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -232.56300354003906,
"value": -220,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -232.56300354003906,
"value": -220,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
}
],
"preExtrapolation": 1,
@@ -370,9 +348,7 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
@@ -384,9 +360,7 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
@@ -398,9 +372,7 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
}
],
"preExtrapolation": 1,
@@ -488,43 +460,37 @@
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -202.56300354003906,
"value": -190,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -202.56300354003906,
"value": -190,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -202.56300354003906,
"value": -190,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
}
],
"preExtrapolation": 1,
@@ -554,9 +520,7 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
@@ -568,9 +532,7 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
@@ -582,9 +544,7 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
}
],
"preExtrapolation": 1,