Merge branch 'main' of 47.107.44.202:xionglijia/18xchat
This commit is contained in:
@@ -38,7 +38,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;
|
||||
|
||||
@@ -50,7 +50,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; //登录按钮
|
||||
|
||||
@@ -61,9 +61,7 @@ export class PreloadUI extends Component {
|
||||
this.jinduFilled = this.jinduBar
|
||||
.getChildByName("jinduFilled")
|
||||
.getComponent(Sprite);
|
||||
this.LabProgress = this.node
|
||||
.getChildByName("LabProgress")
|
||||
.getComponent(Label);
|
||||
|
||||
this.loginNode = this.node.getChildByName("loginNode");
|
||||
this.btnLogin = this.loginNode.getChildByName("btnLogin");
|
||||
|
||||
@@ -77,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;
|
||||
// 初始化数据层
|
||||
@@ -210,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;
|
||||
}
|
||||
@@ -259,10 +257,10 @@ export class PreloadUI extends Component {
|
||||
// })
|
||||
|
||||
// 游客登录
|
||||
const deviceId = DeviceIdService.I.id;
|
||||
const deviceId = DeviceIdService.I.id;
|
||||
const os = MachineInfoService.I.getMachineOs();
|
||||
const reqData = {
|
||||
platType: 'guset',
|
||||
platType: "guset",
|
||||
userId: deviceId,
|
||||
device: deviceId,
|
||||
os,
|
||||
@@ -279,7 +277,9 @@ export class PreloadUI extends Component {
|
||||
loginData.expire = Number(resData.expire);
|
||||
const playerData = DataManager.I.getDataById<PlayerData>(DataId.Player);
|
||||
playerData.name = resData.name;
|
||||
const accountData = DataManager.I.getDataById<AccountData>(DataId.Account);
|
||||
const accountData = DataManager.I.getDataById<AccountData>(
|
||||
DataId.Account
|
||||
);
|
||||
accountData.accId = resData.accId;
|
||||
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
|
||||
envData.cdn = resData.cdn;
|
||||
@@ -287,14 +287,12 @@ export class PreloadUI extends Component {
|
||||
this.loginFinish = true;
|
||||
// 请求个人信息
|
||||
this.reqMyInfo();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 请求个人信息
|
||||
private async reqMyInfo() {
|
||||
const reqData = {
|
||||
|
||||
};
|
||||
const reqData = {};
|
||||
let res = await PlayerDataService.I.reqMyInfo(reqData);
|
||||
console.log("个人信息响应数据:", res);
|
||||
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||
@@ -302,7 +300,7 @@ export class PreloadUI extends Component {
|
||||
// 保存数据
|
||||
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
||||
walletData.balance = Number(resData.balance);
|
||||
walletData.vipExpire = Number(resData.vipExpire);
|
||||
walletData.vipExpire = Number(resData.vipExpire);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +308,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 {
|
||||
@@ -323,5 +321,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;
|
||||
}
|
||||
GameRootUI.I.hideDefaultView();
|
||||
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;
|
||||
}
|
||||
|
||||
private constructor() {}
|
||||
console.log(`Navigating to chat with transition, role ID: ${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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入聊天页面
|
||||
*
|
||||
* @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 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() {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
import { _decorator, Component, math, Node, Sprite, UITransform } from "cc";
|
||||
import {
|
||||
_decorator,
|
||||
Component,
|
||||
Label,
|
||||
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";
|
||||
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,19 +23,26 @@ export class DetailImageItem extends Component {
|
||||
@property(Sprite)
|
||||
img: Sprite;
|
||||
|
||||
@property(Node)
|
||||
lock: Node;
|
||||
@property(Node)
|
||||
question: Node;
|
||||
|
||||
@property(Sprite)
|
||||
video: Sprite;
|
||||
|
||||
@property(Node)
|
||||
priceFrame: Node;
|
||||
@property(Label)
|
||||
videoPrice: Label;
|
||||
|
||||
base: GirlDetailPanel;
|
||||
url: string;
|
||||
isImage: boolean;
|
||||
uitransform: UITransform;
|
||||
category: number;
|
||||
id: number;
|
||||
|
||||
girlId: number;
|
||||
resId: number;
|
||||
type : number;
|
||||
type: number;
|
||||
|
||||
onLoad() {
|
||||
GButton.BandClick(this.node, this.onClickThis, this);
|
||||
@@ -58,7 +73,8 @@ export class DetailImageItem extends Component {
|
||||
|
||||
doScaleToFill() {
|
||||
if (!this.img || !this.img.spriteFrame) return;
|
||||
|
||||
if (!this.uitransform)
|
||||
this.uitransform = this.node.getComponent(UITransform);
|
||||
const itemSize = this.uitransform.contentSize;
|
||||
const imageSize = this.img.spriteFrame.originalSize;
|
||||
|
||||
@@ -97,28 +113,51 @@ export class DetailImageItem extends Component {
|
||||
this.base = base;
|
||||
this.type = type;
|
||||
this.category = category;
|
||||
this.id = id;
|
||||
this.girlId = id;
|
||||
|
||||
this.resId = resId;
|
||||
this.lock.active = false;
|
||||
this.question.active = true; // 显示问号,表示加载中
|
||||
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
let imgPath = "";
|
||||
this.video.enabled = type === 2;
|
||||
this.priceFrame.active = type === 2;
|
||||
if (type === 1) {
|
||||
// 图片
|
||||
this.url = girlData.getGrilPhotoPic(this.category.toString(), this.id, this.resId);
|
||||
this.url = girlData.getGrilPhotoPic(
|
||||
this.category.toString(),
|
||||
this.girlId,
|
||||
this.resId
|
||||
);
|
||||
imgPath = this.url;
|
||||
this.isImage = true;
|
||||
} else if (type === 2) {
|
||||
// 视频
|
||||
this.isImage = false;
|
||||
this.url = girlData.getGrilVideoPath(this.category.toString(), this.id, this.resId);
|
||||
let videoPrice = girlData.getGrilVideoPrice(this.category.toString(), this.id, this.resId);
|
||||
this.url = girlData.getGrilVideoPath(
|
||||
this.category.toString(),
|
||||
this.girlId,
|
||||
this.resId
|
||||
);
|
||||
let videoPrice = girlData.getGrilVideoPrice(
|
||||
this.category.toString(),
|
||||
this.girlId,
|
||||
this.resId
|
||||
);
|
||||
this.url = girlData.getGrilVideoPath(
|
||||
this.category.toString(),
|
||||
this.girlId,
|
||||
this.resId
|
||||
);
|
||||
|
||||
if (videoPrice > 0) {
|
||||
imgPath = this.url + "_thumbnail_blur";
|
||||
} else {
|
||||
imgPath = this.url + "_thumbnail";
|
||||
}
|
||||
this.priceFrame.active = videoPrice > 0;
|
||||
|
||||
this.videoPrice.string = videoPrice.toString();
|
||||
}
|
||||
|
||||
ResManager.I.changeBundleSpriteFrame(this.img, imgPath, "Chat18x", () => {
|
||||
|
||||
@@ -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