Badminton-Scoreboard/assets/Script/Badminton/MemberData.ts

132 lines
2.4 KiB
TypeScript

const { ccclass, property } = cc._decorator;
//#region Enum
/** AvatarColor */
export enum AvatarColor {
None,
Pink,
Yellow
}
//#endregion
//#region Class
/** 成員資料 */
export class MemberData {
public Name: string;
public AvatarId: number;
public Score: ScoreResult;
/**
* @param {string} name 名稱
*/
constructor(name: string, avatarId: number = 0) {
this.Name = name;
this.AvatarId = avatarId;
}
}
/** AvatarData */
@ccclass("AvatarData")
export class AvatarData {
@property()
public ID: number = 0;
@property()
public Model: number = 0;
@property()
public Name: string = "";
@property()
public Desc: string = "";
@property({ type: cc.SpriteFrame })
public Pic: cc.SpriteFrame = null;
@property({ type: cc.SpriteFrame })
public BigPic: cc.SpriteFrame = null;
@property({ type: cc.SpriteFrame })
public BG: cc.SpriteFrame = null;
@property({ type: cc.Enum(AvatarColor) })
public color: AvatarColor = AvatarColor.None;
}
// /** AvatarData */
// @ccclass
// export class AvatarData extends cc.Component {
// // @property()
// // public ID: number = 0;
// // @property()
// // public Model: number = 0;
// // @property()
// // public Name: string = "";
// // @property()
// // public Desc: string = "";
// // @property({ type: cc.SpriteFrame })
// // public Pic: cc.SpriteFrame = null;
// // @property({ type: cc.SpriteFrame })
// // public BigPic: cc.SpriteFrame = null;
// // @property({ type: cc.SpriteFrame })
// // public BG: cc.SpriteFrame = null;
// // @property({ type: cc.Enum(AvatarColor) })
// // public color: AvatarColor;
// }
/** 分數結果 */
export class ScoreResult {
public Win: number;
public Total: number;
constructor(win: number, total: number) {
this.Win = win;
this.Total = total;
}
}
/**
* 比賽記錄
* {time,team:[[name1,name2],[name3,name4]],type,score:[t1,t2] }
*/
export class GameRecord {
/** 場次 */
public Seq: number;
/** 記錄時間 */
public Time: number;
/** 遊戲類型(0:雙打,1:單打) */
public Type: number;
/** 玩家隊伍 [ [隊伍1成員], [隊伍2成員] ] */
public Team: string[][];
/** players */
public Players: string[];
/** 隊伍分數 [ [隊伍1分數], [隊伍2分數] ] */
public Score: number[];
}
//#endregion