JisolGame/JisolGameCocos/assets/script/ui/Map/MapSelectShowItem.ts

50 lines
1.2 KiB
TypeScript
Raw Normal View History

import { _decorator, Component, Node } from 'cc';
import JNScrollViewItem from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
import { TB } from '../../../resources/config/data/schema';
import { Label } from 'cc';
import { Sprite } from 'cc';
import TbResource from '../../tools/TbResource';
const { ccclass, property } = _decorator;
@ccclass('MapSelectShowItem')
export class MapSelectShowItem extends JNScrollViewItem<TB.TbGOnHookMaps> {
@property({type:Sprite,displayName:"地图预览图"})
mapImage:Sprite;
@property({type:Label,displayName:"地图名称"})
mapName:Label;
@property({type:Label,displayName:"地图介绍"})
mapText:Label;
2023-12-03 03:31:19 +08:00
@property({type:Node,displayName:"选中图片"})
selectNode:Node;
//是否选择
isSelect:boolean = false;
onInit(data: TB.TbGOnHookMaps): void {
this.onUpdateView();
}
//刷新页面
onUpdateView(){
this.mapName.string = this.data.name;
this.mapText.string = this.data.introduce;
2023-12-03 03:31:19 +08:00
this.selectNode.active = !!this.isSelect;
//加载预览图
TbResource.loadSpriteFrame(this.data.mapImage,this.mapImage,this);
2023-12-03 03:31:19 +08:00
}
}