update
This commit is contained in:
@@ -1,15 +1,9 @@
|
||||
import {
|
||||
_decorator,
|
||||
Component,
|
||||
find,
|
||||
Label,
|
||||
Node,
|
||||
NodeEventType,
|
||||
Sprite,
|
||||
} from "cc";
|
||||
import { DemoManager } from "../DemoManager";
|
||||
import { Character, characters } from "db://assets/Scripts/test/cfg/characters";
|
||||
import {_decorator, Component, Label, Node, Sprite,} from "cc";
|
||||
import {DemoManager} from "../DemoManager";
|
||||
import {Config18x, GirlInfo} from "db://assets/Scripts/Main/Config/Config18x";
|
||||
import PriceType = Config18x.PriceType;
|
||||
import {ViewManager} from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("GirlListItem")
|
||||
@@ -19,25 +13,42 @@ export class GirlListItem extends Component {
|
||||
@property(Label)
|
||||
girlName: Label;
|
||||
@property(Label)
|
||||
desc: Label;
|
||||
tags: Label;
|
||||
@property(Label)
|
||||
price: Label;
|
||||
@property(Node)
|
||||
freeNode: Node;
|
||||
@property(Node)
|
||||
tryNode: Node;
|
||||
@property(Node)
|
||||
chatBtn: Node;
|
||||
@property(Node)
|
||||
starParent:Node;
|
||||
|
||||
id: number = -1;
|
||||
|
||||
baseNode: Node;
|
||||
refreshData(data: Character,base:Node) {
|
||||
refreshData(data: GirlInfo,baseNode:Node) {
|
||||
this.baseNode = baseNode;
|
||||
this.id = data.id;
|
||||
this.girlName.string = data.name;
|
||||
//this.avatar.spriteFrame =
|
||||
this.baseNode = base;
|
||||
let desc = '';
|
||||
for (let i = 0; i < data.tag.length; i++) {
|
||||
desc += data.tag[i]+"/";
|
||||
}
|
||||
this.tags.string = desc;
|
||||
this.price.node .active = data.priceType == PriceType.Coin;
|
||||
this.freeNode.active = data.priceType == PriceType.Free;
|
||||
this.tryNode.active = data.priceType == PriceType.Try;
|
||||
|
||||
for (let i = 0; i <5; i++) {
|
||||
this.starParent.children[i].active =(i<data.starCount);
|
||||
}
|
||||
}
|
||||
|
||||
onClickDetail() {
|
||||
DemoManager.getInstance().EnterDetail(this.id);
|
||||
//ViewManager.I.closeView(this.baseNode);
|
||||
ViewManager.I.closeView(this.baseNode);
|
||||
}
|
||||
|
||||
update(deltaTime: number) {}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { _decorator, Component, Node,instantiate } from 'cc';
|
||||
import {characters} from "db://assets/Scripts/test/cfg/characters";
|
||||
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
|
||||
import Utils from "db://assets/Scripts/Main/Common/Utils";
|
||||
import {GirlListItem} from "db://assets/Scripts/test/girlListPanel/GirlListItem";
|
||||
import {characters, GirlsData} from "db://assets/Scripts/Main/Config/cfg/characters";
|
||||
import {GButton} from "db://assets/Scripts/Main/Common/GButton";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('GirlListPanel')
|
||||
@@ -13,17 +14,24 @@ export class GirlListPanel extends li_BaseView {
|
||||
content:Node;
|
||||
|
||||
cache:GirlListItem[] = [];
|
||||
|
||||
id:number;
|
||||
openUIDataCT(data)
|
||||
{
|
||||
this.id = data;
|
||||
}
|
||||
onLoadCT() {
|
||||
Utils.parseNode(this.node,this._nodeTab);
|
||||
this.registerListener();
|
||||
this.itemInst = this._nodeTab.BubbleItem.getComponent(GirlListItem);
|
||||
this.itemInst.node.active = false;
|
||||
this.content = this._nodeTab.content;
|
||||
this.show();
|
||||
this.refresh(this.id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
show()
|
||||
refresh(index:number)
|
||||
{
|
||||
if(this.cache)
|
||||
{
|
||||
@@ -32,7 +40,7 @@ export class GirlListPanel extends li_BaseView {
|
||||
this.cache[i].node.destroy();
|
||||
}
|
||||
}
|
||||
const config = characters;
|
||||
const config = GirlsData.filter(value=>value.category == index);
|
||||
for (let i = 0; i < config.length; i++) {
|
||||
const cfg = config[i];
|
||||
let newNode = instantiate(this.itemInst.node)
|
||||
@@ -46,7 +54,14 @@ export class GirlListPanel extends li_BaseView {
|
||||
|
||||
|
||||
|
||||
private registerListener() {}
|
||||
private registerListener() {
|
||||
GButton.BandClick(this._nodeTab.ReturnBtn,this.Return,this);
|
||||
}
|
||||
Return()
|
||||
{
|
||||
this.onClose();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { _decorator, Component, Label, Node, Sprite } from 'cc';
|
||||
import {Theme} from "db://assets/Scripts/Main/Config/Config18x";
|
||||
import {GButton} from "db://assets/Scripts/Main/Common/GButton";
|
||||
import {DemoManager} from "db://assets/Scripts/test/DemoManager";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('ThemeItem')
|
||||
export class ThemeItem extends Component {
|
||||
@property(Sprite)
|
||||
lockImg: Sprite;
|
||||
@property(Label)
|
||||
titleName:Label;
|
||||
|
||||
private id:number;
|
||||
|
||||
start()
|
||||
{
|
||||
}
|
||||
refresh(themeData:Theme)
|
||||
{
|
||||
this.lockImg.node.active = !themeData.isRelease;
|
||||
this.titleName.string = themeData.name;
|
||||
this.id = themeData.themeId;
|
||||
GButton.RemoveAndBandClick(this.node,this.OnClickThis,this);
|
||||
|
||||
}
|
||||
|
||||
OnClickThis()
|
||||
{
|
||||
DemoManager.getInstance().EnterGirlList(this.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "98a1f01d-79ca-42c2-b775-53e7e539a124",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
import {_decorator, Component, Node, instantiate, Label, Sprite} from 'cc';
|
||||
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
|
||||
import Utils from "db://assets/Scripts/Main/Common/Utils";
|
||||
import {GirlListItem} from "db://assets/Scripts/test/girlListPanel/GirlListItem";
|
||||
import {characters, themes} from "db://assets/Scripts/Main/Config/cfg/characters";
|
||||
import {GButton} from "db://assets/Scripts/Main/Common/GButton";
|
||||
import {DemoManager} from "db://assets/Scripts/test/DemoManager";
|
||||
import {ThemeItem} from "db://assets/Scripts/test/girlListPanel/ThemeItem";
|
||||
|
||||
const {ccclass, property} = _decorator;
|
||||
|
||||
@ccclass('ThemePanel')
|
||||
export class ThemePanel extends li_BaseView {
|
||||
private _nodeTab: any = {};
|
||||
|
||||
coinNum: Label;
|
||||
itemInst: GirlListItem;
|
||||
content: Node;
|
||||
|
||||
recId: number;
|
||||
recName: Label;
|
||||
recSprite: Sprite;
|
||||
|
||||
cache: ThemeItem[] = [];
|
||||
|
||||
onLoadCT() {
|
||||
Utils.parseNode(this.node, this._nodeTab);
|
||||
|
||||
this.coinNum = this._nodeTab.coinNum.getComponent(Label);
|
||||
this.recName = this._nodeTab.characterNameText.getComponent(Label);
|
||||
this.recSprite = this._nodeTab.recPicSlot.getComponent(Sprite);
|
||||
|
||||
this.registerListener();
|
||||
this.itemInst = this._nodeTab.ThemeItem.getComponent(ThemeItem);
|
||||
this.itemInst.node.active = false;
|
||||
this.content = this._nodeTab.AllThemesLayout;
|
||||
this.Show();
|
||||
}
|
||||
|
||||
|
||||
Show() {
|
||||
//some temp data
|
||||
this.coinNum.string = 50.0.toString();
|
||||
this.recId = 1;
|
||||
|
||||
if (this.cache) {
|
||||
for (let i = this.cache.length - 1; i >= 0; i--) {
|
||||
this.cache[i].node.destroy();
|
||||
}
|
||||
}
|
||||
const config = themes;
|
||||
for (let i = 0; i < config.length; i++) {
|
||||
const cfg = config[i];
|
||||
let newNode = instantiate(this.itemInst.node)
|
||||
let item = newNode.getComponent(ThemeItem);
|
||||
item.refresh(cfg);
|
||||
newNode.active = true;
|
||||
this.cache.push(item);
|
||||
this.content.addChild(newNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private registerListener() {
|
||||
GButton.BandClick(this._nodeTab.settingBtn, this.openSetting, this);
|
||||
GButton.BandClick(this._nodeTab.msgBoxBtn, this.openMsgBox, this);
|
||||
|
||||
GButton.BandClick(this._nodeTab.ChatWithRecBtn, this.chatWithRec, this);
|
||||
}
|
||||
|
||||
chatWithRec() {
|
||||
DemoManager.getInstance().EnterChat(this.recId);
|
||||
|
||||
}
|
||||
|
||||
openSetting() {
|
||||
console.log("Setting");
|
||||
}
|
||||
|
||||
openMsgBox() {
|
||||
console.log("打开信箱");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"709fae8d-91d1-42a2-8cc6-a3c06e11ffcc","files":[],"subMetas":{},"userData":{}}
|
||||
Reference in New Issue
Block a user