-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a2f940
commit 6ba09cc
Showing
1,401 changed files
with
3,378 additions
and
7,968 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// TypeChooseView.swift | ||
// BAGen | ||
// | ||
// Created by WindowsMEMZ on 2023/10/2. | ||
// | ||
|
||
import SwiftUI | ||
import DarockKit | ||
|
||
struct CharaImgsDownloadView: View { | ||
@State var downloadProgressTimer: Timer? | ||
@State var downloadProgress = Progress(totalUnitCount: 0) | ||
var body: some View { | ||
NavigationStack { | ||
NStack { | ||
ScrollView { | ||
VStack { | ||
NeuText("下载角色立绘/表情差分资源") | ||
NeuProgressView(value: Float(downloadProgress.completedUnitCount), total: Float(downloadProgress.totalUnitCount), width: UIScreen.main.bounds.width - 30) | ||
Text("\(String(format: "%.2f", Double(downloadProgress.completedUnitCount) / 1024 / 1024))MB / \(String(format: "%.2f", Double(downloadProgress.totalUnitCount) / 1024 / 1024))MB") | ||
} | ||
.padding() | ||
} | ||
.scrollIndicators(.never) | ||
} | ||
} | ||
.onAppear { | ||
UIApplication.shared.isIdleTimerDisabled = true | ||
|
||
let resourceRequest = NSBundleResourceRequest(tags: ["CharaImg0"]) | ||
resourceRequest.loadingPriority = NSBundleResourceRequestLoadingPriorityUrgent | ||
downloadProgressTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { _ in | ||
downloadProgress = resourceRequest.progress | ||
} | ||
resourceRequest.beginAccessingResources { error in | ||
downloadProgressTimer?.invalidate() | ||
downloadProgressTimer = nil | ||
if let error { | ||
print(error) | ||
DispatchQueue.main.async { | ||
AlertKitAPI.present(title: error.localizedDescription, style: .iOS17AppleMusic) | ||
} | ||
return | ||
} | ||
|
||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.