forked from sagnik/Project_Velocity
Merge Conflicts (#41)
Co-authored-by: Sayan Datta <sayan@Sayans-MacBook-Air.local> Reviewed-on: sagnik/Project_Velocity#41
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import Foundation
|
||||
|
||||
enum InventoryModeAvailability {
|
||||
static let dollhouseAssetCandidates: [(name: String, ext: String)] = [
|
||||
("Building", "usdz"),
|
||||
("Building", "scn"),
|
||||
]
|
||||
|
||||
static func hasShippedDollhouseAsset(in bundle: Bundle = .main) -> Bool {
|
||||
dollhouseAssetCandidates.contains { candidate in
|
||||
bundle.url(forResource: candidate.name, withExtension: candidate.ext) != nil
|
||||
}
|
||||
}
|
||||
|
||||
static func productionVisibleModes(hasDollhouseAsset: Bool) -> [InventoryStore.Mode] {
|
||||
var modes: [InventoryStore.Mode] = [.sunseeker, .dreamWeaver]
|
||||
if hasDollhouseAsset {
|
||||
modes.append(.dollhouse)
|
||||
}
|
||||
return modes
|
||||
}
|
||||
|
||||
static func sanitizedProductionSelection(
|
||||
_ candidate: InventoryStore.Mode,
|
||||
hasDollhouseAsset: Bool
|
||||
) -> InventoryStore.Mode {
|
||||
productionVisibleModes(hasDollhouseAsset: hasDollhouseAsset).contains(candidate) ? candidate : .sunseeker
|
||||
}
|
||||
|
||||
static func modeSummaryText(hasDollhouseAsset: Bool) -> String {
|
||||
productionVisibleModes(hasDollhouseAsset: hasDollhouseAsset)
|
||||
.map(\.rawValue)
|
||||
.joined(separator: " · ")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user