update
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
} from "cc";
|
||||
import { DemoManager } from "../DemoManager";
|
||||
import { Character, characters } from "db://assets/Scripts/test/cfg/characters";
|
||||
import {ViewManager} from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("GirlListItem")
|
||||
@@ -26,19 +27,17 @@ export class GirlListItem extends Component {
|
||||
|
||||
id: number = -1;
|
||||
|
||||
protected onEnable(): void {
|
||||
this.refreshData(1);
|
||||
}
|
||||
|
||||
refreshData(index: number) {
|
||||
const data = characters[index - 1];
|
||||
baseNode: Node;
|
||||
refreshData(data: Character,base:Node) {
|
||||
this.id = data.id;
|
||||
this.girlName.string = data.name;
|
||||
//this.avatar.spriteFrame =
|
||||
this.baseNode = base;
|
||||
}
|
||||
|
||||
onClickDetail() {
|
||||
DemoManager.getInstance().EnterDetail(this.id);
|
||||
//ViewManager.I.closeView(this.baseNode);
|
||||
}
|
||||
|
||||
update(deltaTime: number) {}
|
||||
|
||||
@@ -1,17 +1,52 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
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";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('GirlListPanel')
|
||||
export class GirlListPanel extends Component {
|
||||
onEnable()
|
||||
{
|
||||
const cfg = characters;
|
||||
for (let i = 0; i < cfg.length; i++) {
|
||||
const c = cfg[i];
|
||||
export class GirlListPanel extends li_BaseView {
|
||||
private _nodeTab: any = {};
|
||||
|
||||
itemInst:GirlListItem;
|
||||
content:Node;
|
||||
|
||||
cache:GirlListItem[] = [];
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
show()
|
||||
{
|
||||
if(this.cache)
|
||||
{
|
||||
for(let i = this.cache.length-1; i >=0; i--)
|
||||
{
|
||||
this.cache[i].node.destroy();
|
||||
}
|
||||
}
|
||||
const config = characters;
|
||||
for (let i = 0; i < config.length; i++) {
|
||||
const cfg = config[i];
|
||||
let newNode = instantiate(this.itemInst.node)
|
||||
let item = newNode.getComponent(GirlListItem);
|
||||
item.refreshData(cfg,this.node);
|
||||
newNode.active = true;
|
||||
this.cache.push(item);
|
||||
this.content.addChild(newNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private registerListener() {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { _decorator, Component, Node,Sprite ,UITransform} from 'cc';
|
||||
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
|
||||
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||
import Utils from "db://assets/Scripts/Main/Common/Utils";
|
||||
import {ViewManager} from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||
import {GButton} from "db://assets/Scripts/Main/Common/GButton";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('ShowPanel')
|
||||
export class ShowPanel extends li_BaseView {
|
||||
@property(Sprite)
|
||||
image:Sprite;
|
||||
@property(Sprite)
|
||||
splash:Sprite;
|
||||
|
||||
onLoadCT() {
|
||||
this.show("Image/1/naked_1");
|
||||
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
//this.splash.node.on(Node.EventType.TOUCH_START,this.onclickback);
|
||||
GButton.BandClick(this.splash.node,()=>{this.close()},this);
|
||||
}
|
||||
|
||||
|
||||
show(path:string)
|
||||
{
|
||||
ResManager.I.changeBundleSpriteFrame(this.image,path,"Chat18x",()=>{
|
||||
Utils.adjustBgPixelRatio(this.image.node,3);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b7645da0-3b81-454b-8956-068491ce4706",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user