File tree Expand file tree Collapse file tree
ZalithLauncher/src/main/java/com/movtery/zalithlauncher Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ import com.movtery.zalithlauncher.utils.festival.getTodayFestivals
6868import com.movtery.zalithlauncher.utils.file.shareFile
6969import com.movtery.zalithlauncher.utils.isChinese
7070import com.movtery.zalithlauncher.utils.logging.Logger.lInfo
71+ import com.movtery.zalithlauncher.utils.logging.Logger.lWarning
7172import com.movtery.zalithlauncher.utils.network.openLink
7273import com.movtery.zalithlauncher.utils.network.openLinkInternal
7374import com.movtery.zalithlauncher.utils.string.getMessageOrToString
@@ -481,7 +482,22 @@ class MainActivity : BaseAppCompatActivity() {
481482 // 检查启动器更新
482483 " check_update" -> checkUpdate()
483484 // 启动当前选中的游戏版本
484- " launch_game" -> launchGameViewModel.tryLaunch()
485+ " launch_game" -> {
486+ if (data != null ) {
487+ runCatching {
488+ val parms = data.split(" =" )
489+ if (parms.size == 2 && parms[0 ] == " server" ) {
490+ // 指定快速启动的服务器ip
491+ val serverIp = parms[1 ].trim()
492+ launchGameViewModel.tryLaunchServer(serverIp)
493+ return
494+ }
495+ }.onFailure { e ->
496+ lWarning(" Failed to parse quick join server parameters: $data " , e)
497+ }
498+ }
499+ launchGameViewModel.tryLaunch()
500+ }
485501 // 复制指定文本
486502 " copy" -> {
487503 if (data != null ) {
Original file line number Diff line number Diff line change @@ -61,6 +61,15 @@ class LaunchGameViewModel : ViewModel() {
6161 }
6262 }
6363
64+ /* *
65+ * 尝试启动游戏快速游玩服务器
66+ * @param address 服务器地址
67+ */
68+ fun tryLaunchServer (address : String ) {
69+ val version = VersionsManager .currentVersion.value ? : return
70+ quickPlayServer(version, address)
71+ }
72+
6473 /* *
6574 * 通过服务器列表快速游玩服务器
6675 * @param address 服务器地址
You can’t perform that action at this time.
0 commit comments