mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
@@ -2,7 +2,7 @@ import { Label } from 'cc';
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import ResourceData, { ResourceEvent, ResourceType } from '../../../data/ResourceData';
|
||||
import { Enum } from 'cc';
|
||||
import { app } from '../../../App';
|
||||
import { app, TD } from '../../../App';
|
||||
import NumberTools from '../../../tools/NumberTools';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -14,6 +14,10 @@ export class PlayerResourceShow extends Component {
|
||||
@property({type:Enum(ResourceType)})
|
||||
type:ResourceType = ResourceType.Gold;
|
||||
|
||||
//显示名称
|
||||
@property(Label)
|
||||
tig:Label;
|
||||
|
||||
//显示文本
|
||||
@property(Label)
|
||||
show:Label;
|
||||
@@ -34,6 +38,8 @@ export class PlayerResourceShow extends Component {
|
||||
//刷新
|
||||
onUpdateView(){
|
||||
|
||||
//更新名称
|
||||
this.tig && (this.tig.string = `${TD.TbGResource.get(this.type).name}:`);
|
||||
//更新资源数量
|
||||
this.show.string = `${NumberTools.NumberStr(ResourceData.getIns().getValue(this.type))}`;
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { ResourceIcon } from '../ResourceIcon';
|
||||
import ResourceData from '../../../../data/ResourceData';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PlayerResourceIcon')
|
||||
@@ -10,7 +11,7 @@ export class PlayerResourceIcon extends Component {
|
||||
|
||||
//设置 ( 资源Id )
|
||||
set(id:number){
|
||||
|
||||
this.icon.set(id,ResourceData.getIns().getValue(id))
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,20 @@
|
||||
import { _decorator } from 'cc';
|
||||
import JNScrollViewItem from '../../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
|
||||
import { PlayerResourceIcon } from './PlayerResourceIcon';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PlayerResourceIconScroll')
|
||||
export class PlayerResourceIconScroll extends JNScrollViewItem<number> {
|
||||
|
||||
@property(PlayerResourceIcon)
|
||||
icon:PlayerResourceIcon;
|
||||
|
||||
onInit(data:number){
|
||||
|
||||
this.icon.set(data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "fd24051f-603b-4413-bdc2-f88ea8cd3a3e",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { PlayerResourceIcon } from './PlayerResourceIcon';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PlayerResourceIconSelect')
|
||||
export class PlayerResourceIconSelect extends Component {
|
||||
|
||||
@property(PlayerResourceIcon)
|
||||
icon:PlayerResourceIcon;
|
||||
|
||||
//选中节点
|
||||
@property(Node)
|
||||
select:Node;
|
||||
|
||||
//不可选中节点
|
||||
@property(Node)
|
||||
noselect:Node;
|
||||
|
||||
//是否被选中
|
||||
_isSelect:boolean = false;
|
||||
get isSelect(){
|
||||
return this._isSelect;
|
||||
}
|
||||
set isSelect(data:boolean){
|
||||
this._isSelect = data;
|
||||
this.onUpdateSelect();
|
||||
}
|
||||
|
||||
//是否不可选中
|
||||
_isNoSelect:boolean = false;
|
||||
get isNoSelect(){
|
||||
return this._isNoSelect;
|
||||
}
|
||||
set isNoSelect(data:boolean){
|
||||
this._isNoSelect = data;
|
||||
this.onUpdateSelect();
|
||||
}
|
||||
|
||||
onLoad(){
|
||||
this.onUpdateSelect();
|
||||
this.noselect.active = false;
|
||||
this.select.active = false;
|
||||
}
|
||||
|
||||
|
||||
//设置
|
||||
set(id:number){
|
||||
|
||||
this.icon.set(id);
|
||||
|
||||
}
|
||||
|
||||
onUpdateSelect(){
|
||||
|
||||
this.select.active = this.isSelect;
|
||||
this.noselect.active = this.isNoSelect;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "c1ae1056-03c0-4291-b34e-7f9dcd04e8de",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import JNScrollViewItem from '../../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
|
||||
import { PlayerResourceIconSelect } from './PlayerResourceIconSelect';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PlayerResourceIconSelectScroll')
|
||||
export class PlayerResourceIconSelectScroll extends JNScrollViewItem<number> {
|
||||
|
||||
@property(PlayerResourceIconSelect)
|
||||
icon:PlayerResourceIconSelect;
|
||||
|
||||
onInit(data:number){
|
||||
|
||||
this.icon.set(data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "6ac191b2-7f6a-4990-80de-7111564e8c4f",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user