新ui入版
This commit is contained in:
@@ -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