mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交捕捉
This commit is contained in:
24
JisolGameCocos/assets/script/ui/Consts/Pet/PetIcon.ts
Normal file
24
JisolGameCocos/assets/script/ui/Consts/Pet/PetIcon.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { sp } from 'cc';
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { app } from '../../../App';
|
||||
import { UIPetAnim } from '../../../consts/GData';
|
||||
import { v3 } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PetIcon')
|
||||
export class PetIcon extends Component {
|
||||
|
||||
@property(sp.Skeleton)
|
||||
spine:sp.Skeleton;
|
||||
|
||||
//设置icon
|
||||
setIcon(petTbId:number){
|
||||
|
||||
this.spine.skeletonData = app.battleRes.roleSpine[petTbId];
|
||||
this.spine.setAnimation(0,UIPetAnim.std,true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b380916e-5ab8-41da-8bc4-08376a3133ac",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
62
JisolGameCocos/assets/script/ui/Consts/Pet/PetIconSelect.ts
Normal file
62
JisolGameCocos/assets/script/ui/Consts/Pet/PetIconSelect.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { PetIcon } from './PetIcon';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PetIconSelect')
|
||||
export class PetIconSelect extends Component {
|
||||
|
||||
@property(PetIcon)
|
||||
petIcon:PetIcon;
|
||||
|
||||
//选中节点
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
//设置icon
|
||||
setIcon(petTbId:number){
|
||||
|
||||
this.petIcon.setIcon(petTbId);
|
||||
|
||||
}
|
||||
|
||||
onUpdateSelect(){
|
||||
|
||||
this.select.active = this.isSelect;
|
||||
this.noselect.active = this.isNoSelect;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "7c6657dc-bcb4-460e-ace3-860bd4238a0d",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user