Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift方法那一章的level调整为关卡是否会更好? #1400

Closed
WekyJay opened this issue Oct 23, 2024 · 3 comments
Closed

Swift方法那一章的level调整为关卡是否会更好? #1400

WekyJay opened this issue Oct 23, 2024 · 3 comments
Assignees

Comments

@WekyJay
Copy link

WekyJay commented Oct 23, 2024

只是自己本人的一点拙见,仅供参考:
在看这个章节的时候带着“等级”的理解,多少有点问题,例如下面这段代码:

    @discardableResult
    mutating func advance(to level: Int) -> Bool {
        if LevelTracker.isUnlocked(level) {
            currentLevel = level // 等级回调??
            return true
        } else {
            return false
        }
    }

其中的currentLevel = level告诉我们调整当前的等级,如果我尝试使用更低的等级来使用该方法,currentLevel是否会跟着回调,因此百思不得其解。
如果调整为关卡,可以以存档的方式来理解。当玩家解锁的最高的关卡等级highestUnlockedLevel为5,那么advance填入参数6则无法进入第六关,而小于等于5的关卡可以进入,那么则调整当前进入的存档关卡 **currentLevel(当前关卡)**为小于等于5的关卡。

@chenranj
Copy link
Collaborator

chenranj commented Dec 28, 2024

感谢反馈!
Assigning to @djroser . Could you please review this section from Methods.md?

@djroser
Copy link
Collaborator

djroser commented Dec 28, 2024

@WekyJay 感谢反馈!非常好的建议~

@chenranj
Copy link
Collaborator

@OneeMe It's ready to deploy:)

@github-project-automation github-project-automation bot moved this from In Progress to Completed in Swift 6 beta Translation Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Completed
Development

No branches or pull requests

4 participants