28 lines
638 B
TypeScript
28 lines
638 B
TypeScript
import { ChipColorConfig } from "../config/chip-color-config";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export class Chip extends cc.Component
|
|
{
|
|
|
|
@property(cc.Label)
|
|
private labelChipValue: cc.Label = null;
|
|
@property(cc.Node)
|
|
private nodeChipColor: cc.Node = null;
|
|
@property(cc.Integer)
|
|
private value: number = 1;
|
|
|
|
public setChipValue(value: number): void
|
|
{
|
|
this.value = value;
|
|
this.labelChipValue.string = value.toString();
|
|
this.nodeChipColor.color = ChipColorConfig.GetColor(value);
|
|
}
|
|
|
|
public getChipValue(): number
|
|
{
|
|
return this.value;
|
|
}
|
|
}
|