新ui入版
This commit is contained in:
@@ -36,7 +36,7 @@ import MachineInfoService from "db://assets/Scripts/chat18x/foundation/identity/
|
||||
import { AuthService } from "db://assets/Scripts/chat18x/network/services/AuthService";
|
||||
import { PlayerDataService } from "db://assets/Scripts/chat18x/network/services/PlayerDataService";
|
||||
import { ApiCode } from "db://assets/Scripts/chat18x/network/client/types";
|
||||
import proto from 'db://assets/Scripts/proto/proto.pb.js';
|
||||
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -48,7 +48,7 @@ export class PreloadUI extends Component {
|
||||
|
||||
private jinduBar: Node = null;
|
||||
private jinduFilled: Sprite = null;
|
||||
private LabProgress: Label = null;
|
||||
//private LabProgress: Label = null;
|
||||
private loginNode: Node = null;
|
||||
private btnLogin: Node = null; //登录按钮
|
||||
|
||||
@@ -59,9 +59,9 @@ export class PreloadUI extends Component {
|
||||
this.jinduFilled = this.jinduBar
|
||||
.getChildByName("jinduFilled")
|
||||
.getComponent(Sprite);
|
||||
this.LabProgress = this.node
|
||||
.getChildByName("LabProgress")
|
||||
.getComponent(Label);
|
||||
// this.LabProgress = this.node
|
||||
// .getChildByName("LabProgress")
|
||||
// .getComponent(Label);
|
||||
this.loginNode = this.node.getChildByName("loginNode");
|
||||
this.btnLogin = this.loginNode.getChildByName("btnLogin");
|
||||
|
||||
@@ -75,7 +75,7 @@ export class PreloadUI extends Component {
|
||||
|
||||
// 初始化配置
|
||||
ConfigManager.I.init();
|
||||
//console.log(ConfigManager.tables.TbGlobalConfig.GameName);
|
||||
//console.log(ConfigManager.tables.TbGlobalConfig.GameName);
|
||||
// 初始化环境配置
|
||||
AppConfig.I;
|
||||
// 初始化数据层
|
||||
@@ -208,7 +208,7 @@ export class PreloadUI extends Component {
|
||||
|
||||
// 进入登录模块
|
||||
private enterLoginModule() {
|
||||
this.LabProgress.node.active = false;
|
||||
//this.LabProgress.node.active = false;
|
||||
this.jinduBar.active = false;
|
||||
this.loginNode.active = true;
|
||||
}
|
||||
@@ -257,10 +257,10 @@ export class PreloadUI extends Component {
|
||||
// })
|
||||
|
||||
// 游客登录
|
||||
const deviceId = DeviceIdService.I.id;
|
||||
const deviceId = DeviceIdService.I.id;
|
||||
const machineIdentifier = MachineInfoService.I.getMachineIdentifier();
|
||||
const reqData = {
|
||||
platType: 'guset',
|
||||
platType: "guset",
|
||||
userId: deviceId,
|
||||
device: deviceId,
|
||||
os: 3,
|
||||
@@ -277,18 +277,16 @@ export class PreloadUI extends Component {
|
||||
loginData.expire = resData.expire;
|
||||
const playerData = DataManager.I.getDataById<PlayerData>(DataId.Player);
|
||||
playerData.name = resData.name;
|
||||
|
||||
|
||||
this.loginFinish = true;
|
||||
|
||||
// this.reqMyInfo();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 请求个人信息
|
||||
private async reqMyInfo() {
|
||||
const reqData = {
|
||||
|
||||
};
|
||||
const reqData = {};
|
||||
console.log("个人信息请求数据:", reqData);
|
||||
let res = await PlayerDataService.I.reqMyInfo(reqData);
|
||||
console.log("个人信息响应数据:", res);
|
||||
@@ -297,7 +295,7 @@ export class PreloadUI extends Component {
|
||||
// 保存数据
|
||||
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
||||
walletData.diamond = resData.diamond;
|
||||
walletData.vipExpire = resData.vipExpire;
|
||||
walletData.vipExpire = resData.vipExpire;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +303,7 @@ export class PreloadUI extends Component {
|
||||
//let islogin = HttpUnit.IsLogin();
|
||||
//console.log("进入游戏,登录状态:", islogin);
|
||||
this.jinduBar.active = false;
|
||||
this.LabProgress.node.active = false;
|
||||
//this.LabProgress.node.active = false;
|
||||
//this.btnLogin.node.active = false
|
||||
// if (islogin) {
|
||||
// } else {
|
||||
@@ -318,5 +316,5 @@ export class PreloadUI extends Component {
|
||||
|
||||
private registerListener() {
|
||||
GButton.BandClick(this.btnLogin, this.onLogin, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,170 +1,185 @@
|
||||
import { ViewManager } from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||
import { UITransitionHelper } from "../utils/UITransitionHelper";
|
||||
import GameRootUI from "../../Main/Common/GameRootUI";
|
||||
|
||||
/**
|
||||
* 导航管理器
|
||||
*
|
||||
*
|
||||
* 负责管理游戏中的页面导航和路由,将导航逻辑从业务逻辑中分离出来
|
||||
*
|
||||
* @author AI Chat System
|
||||
*
|
||||
* @author AI Chat System
|
||||
* @version 1.0.0
|
||||
*/
|
||||
export class NavigationManager {
|
||||
private static _instance: NavigationManager;
|
||||
private static _instance: NavigationManager;
|
||||
|
||||
/**
|
||||
* 获取NavigationManager的单例实例
|
||||
*
|
||||
* @returns {NavigationManager} 导航管理器实例
|
||||
* @static
|
||||
*/
|
||||
public static get Instance(): NavigationManager {
|
||||
if (!this._instance) {
|
||||
this._instance = new NavigationManager();
|
||||
}
|
||||
return this._instance;
|
||||
/**
|
||||
* 获取NavigationManager的单例实例
|
||||
*
|
||||
* @returns {NavigationManager} 导航管理器实例
|
||||
* @static
|
||||
*/
|
||||
public static get Instance(): NavigationManager {
|
||||
if (!this._instance) {
|
||||
this._instance = new NavigationManager();
|
||||
}
|
||||
return this._instance;
|
||||
}
|
||||
|
||||
private constructor() {}
|
||||
|
||||
/**
|
||||
* 进入角色列表页面
|
||||
*
|
||||
* @param {number} themeId - 主题ID,用于筛选角色
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* NavigationManager.Instance.navigateToGirlList(1);
|
||||
* ```
|
||||
*/
|
||||
public navigateToGirlList(themeId: number): void {
|
||||
if (themeId == null || themeId < 0) {
|
||||
console.warn("Invalid theme ID for girl list navigation:", themeId);
|
||||
return;
|
||||
}
|
||||
GameRootUI.I.hideDefaultView();
|
||||
|
||||
console.log(`Navigating to girl list with theme ID: ${themeId}`);
|
||||
ViewManager.I.openBundlesView("GirlListPanel", themeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入聊天页面
|
||||
*
|
||||
* @param {number} roleId - 角色ID
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* NavigationManager.Instance.navigateToChat(10001);
|
||||
* ```
|
||||
*/
|
||||
public navigateToChat(roleId: number): void {
|
||||
if (roleId == null || roleId <= 0) {
|
||||
console.warn("Invalid role ID for chat navigation:", roleId);
|
||||
return;
|
||||
}
|
||||
|
||||
private constructor() {}
|
||||
console.log(`Navigating to chat with role ID: ${roleId}`);
|
||||
ViewManager.I.openBundlesView("ChatPanel", roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入角色列表页面
|
||||
*
|
||||
* @param {number} themeId - 主题ID,用于筛选角色
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* NavigationManager.Instance.navigateToGirlList(1);
|
||||
* ```
|
||||
*/
|
||||
public navigateToGirlList(themeId: number): void {
|
||||
if (themeId == null || themeId < 0) {
|
||||
console.warn("Invalid theme ID for girl list navigation:", themeId);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Navigating to girl list with theme ID: ${themeId}`);
|
||||
ViewManager.I.openBundlesView("GirlListPanel", themeId);
|
||||
/**
|
||||
* 带过渡动画进入聊天页面
|
||||
* 从GirlDetailPanel平滑过渡到ChatPanel
|
||||
*
|
||||
* @param {number} roleId - 角色ID
|
||||
* @param {any} currentPanel - 当前面板实例(GirlDetailPanel)
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* NavigationManager.Instance.navigateToChatWithTransition(10001, this);
|
||||
* ```
|
||||
*/
|
||||
public navigateToChatWithTransition(
|
||||
roleId: number,
|
||||
currentPanel?: any
|
||||
): void {
|
||||
if (roleId == null || roleId <= 0) {
|
||||
console.warn(
|
||||
"Invalid role ID for chat navigation with transition:",
|
||||
roleId
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入聊天页面
|
||||
*
|
||||
* @param {number} roleId - 角色ID
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* NavigationManager.Instance.navigateToChat(10001);
|
||||
* ```
|
||||
*/
|
||||
public navigateToChat(roleId: number): void {
|
||||
if (roleId == null || roleId <= 0) {
|
||||
console.warn("Invalid role ID for chat navigation:", roleId);
|
||||
return;
|
||||
}
|
||||
console.log(`Navigating to chat with transition, role ID: ${roleId}`);
|
||||
|
||||
console.log(`Navigating to chat with role ID: ${roleId}`);
|
||||
ViewManager.I.openBundlesView("ChatPanel", roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带过渡动画进入聊天页面
|
||||
* 从GirlDetailPanel平滑过渡到ChatPanel
|
||||
*
|
||||
* @param {number} roleId - 角色ID
|
||||
* @param {any} currentPanel - 当前面板实例(GirlDetailPanel)
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* NavigationManager.Instance.navigateToChatWithTransition(10001, this);
|
||||
* ```
|
||||
*/
|
||||
public navigateToChatWithTransition(roleId: number, currentPanel?: any): void {
|
||||
if (roleId == null || roleId <= 0) {
|
||||
console.warn("Invalid role ID for chat navigation with transition:", roleId);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Navigating to chat with transition, role ID: ${roleId}`);
|
||||
|
||||
// 打开ChatPanel,同时标记需要执行滑入动画
|
||||
ViewManager.I.openBundlesView("ChatPanel", {
|
||||
roleId: roleId,
|
||||
withSlideTransition: true
|
||||
}, (chatNode) => {
|
||||
// ChatPanel打开后,如果有当前面板,执行滑出动画
|
||||
if (currentPanel && currentPanel.node && currentPanel.node.isValid) {
|
||||
UITransitionHelper.slideOutToLeft(currentPanel.node, 0.3, () => {
|
||||
// 滑出动画完成后关闭原面板
|
||||
if (currentPanel.onClose && typeof currentPanel.onClose === 'function') {
|
||||
currentPanel.onClose();
|
||||
}
|
||||
});
|
||||
// 打开ChatPanel,同时标记需要执行滑入动画
|
||||
ViewManager.I.openBundlesView(
|
||||
"ChatPanel",
|
||||
{
|
||||
roleId: roleId,
|
||||
withSlideTransition: true,
|
||||
},
|
||||
(chatNode) => {
|
||||
// ChatPanel打开后,如果有当前面板,执行滑出动画
|
||||
if (currentPanel && currentPanel.node && currentPanel.node.isValid) {
|
||||
UITransitionHelper.slideOutToLeft(currentPanel.node, 0.3, () => {
|
||||
// 滑出动画完成后关闭原面板
|
||||
if (
|
||||
currentPanel.onClose &&
|
||||
typeof currentPanel.onClose === "function"
|
||||
) {
|
||||
currentPanel.onClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入角色详情页面
|
||||
*
|
||||
* @param {number} roleId - 角色ID
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* NavigationManager.Instance.navigateToGirlDetail(10001);
|
||||
* ```
|
||||
*/
|
||||
public navigateToGirlDetail(roleId: number): void {
|
||||
if (roleId == null || roleId <= 0) {
|
||||
console.warn("Invalid role ID for detail navigation:", roleId);
|
||||
return;
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
console.log(`Navigating to girl detail with role ID: ${roleId}`);
|
||||
ViewManager.I.openBundlesView("GirlDetailPanel", roleId);
|
||||
/**
|
||||
* 进入角色详情页面
|
||||
*
|
||||
* @param {number} roleId - 角色ID
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* NavigationManager.Instance.navigateToGirlDetail(10001);
|
||||
* ```
|
||||
*/
|
||||
public navigateToGirlDetail(roleId: number): void {
|
||||
if (roleId == null || roleId <= 0) {
|
||||
console.warn("Invalid role ID for detail navigation:", roleId);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回主界面
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* NavigationManager.Instance.navigateToMainMenu();
|
||||
* ```
|
||||
*/
|
||||
public navigateToMainMenu(): void {
|
||||
console.log("Navigating to main menu");
|
||||
// TODO: 实现返回主界面的逻辑
|
||||
// ViewManager.I.openBundlesView("MainMenu");
|
||||
}
|
||||
console.log(`Navigating to girl detail with role ID: ${roleId}`);
|
||||
ViewManager.I.openBundlesView("GirlDetailPanel", roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否可以导航到指定页面
|
||||
*
|
||||
* @param {string} pageName - 页面名称
|
||||
* @returns {boolean} 是否可以导航
|
||||
*/
|
||||
public canNavigateTo(pageName: string): boolean {
|
||||
const allowedPages = ["GirlListPanel", "ChatPanel", "GirlDetailPanel"];
|
||||
return allowedPages.indexOf(pageName)>=0;
|
||||
}
|
||||
/**
|
||||
* 返回主界面
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* NavigationManager.Instance.navigateToMainMenu();
|
||||
* ```
|
||||
*/
|
||||
public navigateToMainMenu(): void {
|
||||
console.log("Navigating to main menu");
|
||||
// TODO: 实现返回主界面的逻辑
|
||||
// ViewManager.I.openBundlesView("MainMenu");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前页面的导航历史(预留功能)
|
||||
*
|
||||
* @returns {string[]} 导航历史数组
|
||||
*/
|
||||
public getNavigationHistory(): string[] {
|
||||
// TODO: 实现导航历史记录功能
|
||||
console.log("Navigation history feature not implemented yet");
|
||||
return [];
|
||||
}
|
||||
/**
|
||||
* 检查是否可以导航到指定页面
|
||||
*
|
||||
* @param {string} pageName - 页面名称
|
||||
* @returns {boolean} 是否可以导航
|
||||
*/
|
||||
public canNavigateTo(pageName: string): boolean {
|
||||
const allowedPages = ["GirlListPanel", "ChatPanel", "GirlDetailPanel"];
|
||||
return allowedPages.indexOf(pageName) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回上一页(预留功能)
|
||||
*/
|
||||
public goBack(): void {
|
||||
// TODO: 实现返回上一页功能
|
||||
console.log("Go back feature not implemented yet");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取当前页面的导航历史(预留功能)
|
||||
*
|
||||
* @returns {string[]} 导航历史数组
|
||||
*/
|
||||
public getNavigationHistory(): string[] {
|
||||
// TODO: 实现导航历史记录功能
|
||||
console.log("Navigation history feature not implemented yet");
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回上一页(预留功能)
|
||||
*/
|
||||
public goBack(): void {
|
||||
// TODO: 实现返回上一页功能
|
||||
console.log("Go back feature not implemented yet");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ export class SimpleToggle extends Component {
|
||||
}
|
||||
|
||||
init(isSelected: boolean, callBack: () => {}) {
|
||||
this.selectedSprite.enabled = isSelected;
|
||||
this.unSelectedSprite.enabled = !isSelected;
|
||||
this.selectedSprite.node.active = isSelected;
|
||||
this.unSelectedSprite.node.active = !isSelected;
|
||||
if (this.callback) {
|
||||
this.onDestroy();
|
||||
}
|
||||
@@ -30,8 +30,8 @@ export class SimpleToggle extends Component {
|
||||
}
|
||||
|
||||
refresh(isSelected: boolean) {
|
||||
this.selectedSprite.enabled = isSelected;
|
||||
this.unSelectedSprite.enabled = !isSelected;
|
||||
this.selectedSprite.node.active = isSelected;
|
||||
this.unSelectedSprite.node.active = !isSelected;
|
||||
}
|
||||
|
||||
onClickThis() {
|
||||
|
||||
@@ -6,9 +6,6 @@ const { ccclass, property } = _decorator;
|
||||
export class SimpleToggleGroup extends Component {
|
||||
toggles: SimpleToggle[];
|
||||
|
||||
@property(Node)
|
||||
slider: Node;
|
||||
|
||||
protected onLoad(): void {
|
||||
this.toggles = this.getComponentsInChildren(SimpleToggle);
|
||||
|
||||
@@ -19,12 +16,6 @@ export class SimpleToggleGroup extends Component {
|
||||
}
|
||||
|
||||
toggleSelected(selectedNode: Node) {
|
||||
const pos = this.slider.getPosition();
|
||||
const targetPos = new Vec3(selectedNode.getPosition().x, pos.y, pos.z);
|
||||
tween(this.slider)
|
||||
.to(0.3, { position: targetPos }, { easing: "sineInOut" })
|
||||
.start();
|
||||
|
||||
for (let i = 0; i < this.toggles.length; i++) {
|
||||
const element = this.toggles[i];
|
||||
if (element.node === selectedNode) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||
import { ViewManager } from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
|
||||
import { GirlDetailPanel } from "../ui/panels/GirlDetailPanel";
|
||||
import proto from 'db://assets/Scripts/proto/proto.pb.js';
|
||||
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
import { DataManager, DataId } from "../data/DataManager";
|
||||
import { GirlData } from "../data/GirlData";
|
||||
|
||||
@@ -15,11 +15,12 @@ export class DetailImageItem extends Component {
|
||||
@property(Sprite)
|
||||
img: Sprite;
|
||||
|
||||
@property(Node)
|
||||
lock: Node;
|
||||
@property(Node)
|
||||
question: Node;
|
||||
|
||||
@property(Sprite)
|
||||
video: Sprite;
|
||||
|
||||
base: GirlDetailPanel;
|
||||
url: string;
|
||||
isImage: boolean;
|
||||
@@ -27,7 +28,7 @@ export class DetailImageItem extends Component {
|
||||
category: number;
|
||||
id: number;
|
||||
index: number;
|
||||
type : number;
|
||||
type: number;
|
||||
|
||||
onLoad() {
|
||||
GButton.BandClick(this.node, this.onClickThis, this);
|
||||
@@ -99,21 +100,33 @@ export class DetailImageItem extends Component {
|
||||
this.category = category;
|
||||
this.id = id;
|
||||
this.index = index;
|
||||
this.lock.active = false;
|
||||
this.question.active = true; // 显示问号,表示加载中
|
||||
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
let imgPath = "";
|
||||
this.video.enabled = type === 2;
|
||||
if (type === 1) {
|
||||
// 图片
|
||||
this.url = girlData.getGrilPhotoPic(this.category.toString(), this.id, this.index);
|
||||
this.url = girlData.getGrilPhotoPic(
|
||||
this.category.toString(),
|
||||
this.id,
|
||||
this.index
|
||||
);
|
||||
imgPath = this.url;
|
||||
this.isImage = true;
|
||||
} else if (type === 2) {
|
||||
// 视频
|
||||
this.isImage = false;
|
||||
this.url = girlData.getGrilVideoPath(this.category.toString(), this.id, this.index);
|
||||
let videoPrice = girlData.getGrilVideoPrice(this.category.toString(), this.id, this.index);
|
||||
this.url = girlData.getGrilVideoPath(
|
||||
this.category.toString(),
|
||||
this.id,
|
||||
this.index
|
||||
);
|
||||
let videoPrice = girlData.getGrilVideoPrice(
|
||||
this.category.toString(),
|
||||
this.id,
|
||||
this.index
|
||||
);
|
||||
if (videoPrice > 0) {
|
||||
imgPath = this.url + "_thumbnail_blur";
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
import { _decorator, Component, Label, Node, Sprite, UITransform } from "cc";
|
||||
import {
|
||||
_decorator,
|
||||
AssetManager,
|
||||
Component,
|
||||
Label,
|
||||
Node,
|
||||
randomRangeInt,
|
||||
Sprite,
|
||||
UITransform,
|
||||
} from "cc";
|
||||
import { Config18x } from "db://assets/Scripts/Main/Config/Config18x";
|
||||
import { ViewManager } from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||
@@ -24,13 +33,15 @@ export class GirlListItem extends Component {
|
||||
price: Label;
|
||||
@property(Node)
|
||||
freeNode: Node;
|
||||
|
||||
@property(Node)
|
||||
tryNode: Node;
|
||||
@property(Node)
|
||||
chatBtn: Node;
|
||||
chatIcon: Node;
|
||||
|
||||
@property(Node)
|
||||
starParent: Node;
|
||||
|
||||
stars: Sprite[];
|
||||
|
||||
id: number = -1;
|
||||
|
||||
nameKey: string;
|
||||
@@ -68,6 +79,10 @@ export class GirlListItem extends Component {
|
||||
|
||||
baseNode: Node;
|
||||
refreshData(category: number, girlId: number, baseNode: Node) {
|
||||
if (!this.stars) {
|
||||
this.stars = this.starParent.getComponentsInChildren(Sprite);
|
||||
}
|
||||
|
||||
this.category = category;
|
||||
this.baseNode = baseNode;
|
||||
this.id = girlId;
|
||||
@@ -83,11 +98,17 @@ export class GirlListItem extends Component {
|
||||
desc += tags[i];
|
||||
}
|
||||
this.tags.string = desc;
|
||||
let priceType = girlData.getGrilPriceType(this.category.toString(), this.id);
|
||||
let priceType = girlData.getGrilPriceType(
|
||||
this.category.toString(),
|
||||
this.id
|
||||
);
|
||||
this.price.node.active = priceType == PriceType.pay;
|
||||
this.freeNode.active = priceType == PriceType.free;
|
||||
this.tryNode.active = priceType == PriceType.first_time_free;
|
||||
let listAvatarPath = girlData.getGrilListAvatar(this.category.toString(), this.id);
|
||||
//this.tryNode.active = priceType == PriceType.first_time_free;
|
||||
let listAvatarPath = girlData.getGrilListAvatar(
|
||||
this.category.toString(),
|
||||
this.id
|
||||
);
|
||||
ResManager.I.changeBundleSpriteFrame(
|
||||
this.avatar,
|
||||
listAvatarPath,
|
||||
@@ -102,9 +123,22 @@ export class GirlListItem extends Component {
|
||||
}
|
||||
);
|
||||
|
||||
// for (let i = 0; i < 5; i++) {
|
||||
// this.starParent.children[i].active = i < data.;
|
||||
// }
|
||||
//虚假好感度
|
||||
const ratio = randomRangeInt(0, 5);
|
||||
this.starParent.active = ratio != 0;
|
||||
this.chatIcon.active = ratio != 0;
|
||||
this.price.node.active = ratio == 0;
|
||||
for (let i = 0; i < this.stars.length; i++) {
|
||||
const element = this.stars[i];
|
||||
if (ratio > i) {
|
||||
ResManager.I.changeResourceSpriteFrame(element, "ui/common/heart");
|
||||
} else {
|
||||
ResManager.I.changeResourceSpriteFrame(
|
||||
element,
|
||||
"ui/common/heart_empty"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onClickDetail() {
|
||||
|
||||
Reference in New Issue
Block a user