Last active
February 27, 2022 06:31
-
-
Save harry830622/69e3416ca09ccd834941e19211582c10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set 就是一個系列,裡面可以包含很多個精彩好球 play | |
pub struct SetData { | |
// 每個 Set 有一個獨特的 ID 表示 | |
pub let setID: UInt32 | |
// Set 名字,例如 "Cool Cats" 系列 | |
pub let name: String | |
// Set 所屬的世代,像現在已經到了世代 3, | |
// 也可以理解是季的意思, | |
// 畢竟目前 series 3 就是 NBA Top Shop 推出後的第三季 NBA | |
pub let series: UInt32 | |
// 創建 struct 時候的初始化 function | |
// 主要就是初始化上述提到的那些 variables | |
init(name: String) { | |
pre { | |
name.length > 0: "New Set name cannot be empty" | |
} | |
self.setID = TopShot.nextSetID | |
self.name = name | |
self.series = TopShot.currentSeries | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment