You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
|
3 years ago
|
import { CustomToggle } from "../external/CustomToggleItem";
|
||
|
|
|
||
|
|
const { ccclass, property } = cc._decorator;
|
||
|
|
|
||
|
|
@ccclass
|
||
|
|
export default class SingleDateItem extends CustomToggle {
|
||
|
|
|
||
|
|
@property(cc.Node)
|
||
|
|
checkNode: cc.Node = null
|
||
|
|
@property(cc.Node)
|
||
|
|
unCheckNode: cc.Node = null
|
||
|
|
@property(cc.Node)
|
||
|
|
dateLabelNode: cc.Node = null
|
||
|
|
|
||
|
|
protected _date: number
|
||
|
|
get date(): number {
|
||
|
|
return this._date
|
||
|
|
}
|
||
|
|
|
||
|
|
set date(d: number) {
|
||
|
|
this._date = d
|
||
|
|
}
|
||
|
|
|
||
|
|
reset() {
|
||
|
|
this.isChecked = false
|
||
|
|
this.checkNode.active = false
|
||
|
|
this.unCheckNode.active = true
|
||
|
|
this.dateLabelNode.active = true
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 要讓calander使用layout自動排列,所以會把自己元件上有顯示東西都關掉
|
||
|
|
*/
|
||
|
|
setBlank() {
|
||
|
|
this.isChecked = false
|
||
|
|
this.checkNode.active = false
|
||
|
|
this.unCheckNode.active = false
|
||
|
|
this.dateLabelNode.active = false
|
||
|
|
}
|
||
|
|
|
||
|
|
setDate(date: number) {
|
||
|
|
this.date = date
|
||
|
|
this.dateLabelNode.getComponent(cc.Label).string = `${date}`
|
||
|
|
}
|
||
|
|
}
|