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

增加随机主页预设 #5432

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

增加随机主页预设 #5432

wants to merge 2 commits into from

Conversation

myunco
Copy link

@myunco myunco commented Jan 17, 2025

昨天提了个issue #5425 希望增加随机主页预设,今天被关闭了,不知道是因为作者没有精力还是其他原因拒绝了。
如果是作者精力不足,我想着提个PR把功能实现了,如果是因为其他原因不想添加,那就忽略这个吧。

(虽然有人说随机刷新浪费预设托管服务器流量... 但我觉得选择随机预设的人应该不多吧,再加上一个人一天也不会重复打开多少次启动器...)

@shimoranla
Copy link

shimoranla commented Jan 17, 2025

龙猫添加的是拒绝/放弃,代表龙猫不想做这个功能,如果只是因为精力有限无法制作,那么贴的应该是暂无计划

(虽然有人说随机刷新浪费预设托管服务器流量... 但我觉得选择随机预设的人应该不多吧,再加上一个人一天也不会重复打开多少次启动器...)

有些主页没有版本号文件,总有人会重复刷新,从而带来额外开销

@Deep-Dark-Forest Deep-Dark-Forest added · 新功能 等待确认 已经过社区确认,等待开发者确认 labels Jan 17, 2025
ElseIf RandomFlag = False Then '确保每次启动只生成一次随机数
Log("[Page] 主页预设:随机预设")
PresetIndex = New Random().Next(0, 12) '生成0-11的随机数
RandomFlag = True
Copy link

@shimoranla shimoranla Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

随机数注释部分,中文和数字之间需要加个空格

@myunco
Copy link
Author

myunco commented Jan 17, 2025

补充一下代码运行逻辑(已经过本地测试)

            ...
            Case 3 '选择使用预设主页
                '静态变量 在类的生存期内继续存在 不会重复初始化
                Static RandomFlag As Boolean
                Static PresetIndex As Integer
                '局部变量
                Dim Preset = Setup.Get("UiCustomPreset") '获取选择的预设索引
                If Preset <> 12 Then '非随机预设
                    PresetIndex = Preset '直接将选择的索引赋值到下面去处理
                ElseIf RandomFlag = False Then '确保只生成一次随机数 选择随机预设且flag未赋值的情况下这个if是成立的
                    Log("[Page] 主页预设:随机预设")
                    PresetIndex = New Random().Next(0, 12) '生成 0-11 的随机数
                    RandomFlag = True '生成随机数后设置flag,不然缓存未命中导致下载完主页后再次调用刷新 又会生成新的随机数 然后再下载 再刷新..
                End If
                '到这里 要么是自己选的主页预设 要么是随机出来的 直接按原逻辑去处理
                Select Case PresetIndex
                   ...

@MoYuan-CN MoYuan-CN requested a review from LTCatt January 17, 2025 15:43
@MoYuan-CN
Copy link
Collaborator

MoYuan-CN commented Jan 17, 2025

请求了龙猫对此代码进行审查,但根据

的结论,大概率是不会制作


Tip

在你的 PR 正文(最顶上一楼中)加入以下内容能够更方便让开发者的管理 PR 与其对应 Issue

Close #5425

@3gf8jv4dv
Copy link
Collaborator

@JingHai-Lingyun 是不是给错 issue 了?#5425

@MoYuan-CN
Copy link
Collaborator

诶,糟糕

@shimoranla
Copy link

补充一下代码运行逻辑(已经过本地测试)

抽象的 VB.NET(

明确 RandomFlag 的默认值
@LTCatt LTCatt added 暂无计划 短期内没有制作该项的计划 and removed 等待确认 已经过社区确认,等待开发者确认 labels Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
· 新功能 暂无计划 短期内没有制作该项的计划
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants