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