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

132 lines
2.4 KiB
TypeScript
Raw Normal View History

2022-05-07 02:54:33 +00:00
2022-05-02 13:04:23 +00:00
const { ccclass, property } = cc._decorator;
2022-05-05 11:19:28 +00:00
//#region Enum
/** AvatarColor */
export enum AvatarColor {
None,
Pink,
Yellow
}
//#endregion
2022-05-02 13:04:23 +00:00
//#region Class
/** 成員資料 */
export class MemberData {
public Name: string;
public AvatarId: number;
public Score: ScoreResult;
/**
* @param {string} name
*/
2022-05-07 02:54:33 +00:00
constructor(name: string, avatarId: number = 0) {
2022-05-02 13:04:23 +00:00
this.Name = name;
2022-05-07 02:54:33 +00:00
this.AvatarId = avatarId;
2022-05-02 13:04:23 +00:00
}
}
/** AvatarData */
2022-05-05 11:19:28 +00:00
@ccclass("AvatarData")
2022-05-02 13:04:23 +00:00
export class AvatarData {
2022-05-05 11:19:28 +00:00
@property()
public ID: number = 0;
2022-05-02 13:04:23 +00:00
2022-05-05 11:19:28 +00:00
@property()
public Model: number = 0;
2022-05-02 13:04:23 +00:00
2022-05-05 11:19:28 +00:00
@property()
public Name: string = "";
2022-05-02 13:04:23 +00:00
2022-05-05 11:19:28 +00:00
@property()
public Desc: string = "";
2022-05-02 13:04:23 +00:00
2022-05-05 11:19:28 +00:00
@property({ type: cc.SpriteFrame })
public Pic: cc.SpriteFrame = null;
2022-05-02 13:04:23 +00:00
2022-05-05 11:19:28 +00:00
@property({ type: cc.SpriteFrame })
public BigPic: cc.SpriteFrame = null;
2022-05-02 13:04:23 +00:00
2022-05-05 11:19:28 +00:00
@property({ type: cc.SpriteFrame })
public BG: cc.SpriteFrame = null;
2022-05-02 13:04:23 +00:00
2022-05-05 11:19:28 +00:00
@property({ type: cc.Enum(AvatarColor) })
public color: AvatarColor = AvatarColor.None;
2022-05-02 13:04:23 +00:00
}
2022-05-05 11:19:28 +00:00
// /** 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;
// }
2022-05-02 13:04:23 +00:00
/** 分數結果 */
export class ScoreResult {
public Win: number;
public Total: number;
2022-05-08 12:36:56 +00:00
constructor(win: number, total: number) {
this.Win = win;
this.Total = total;
}
2022-05-02 13:04:23 +00:00
}
/**
*
* {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