Skip to content

Commit

Permalink
Merge pull request #13 from bookdude13/dev
Browse files Browse the repository at this point in the history
UI improvements
  • Loading branch information
bookdude13 authored Jan 22, 2023
2 parents ccae94f + be86606 commit ca8e978
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 17 deletions.
13 changes: 10 additions & 3 deletions Assets/Scenes/MainScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,7 @@ MonoBehaviour:
Label: {fileID: 1003333793}
SiteFilterName: Master
downloadFilters: {fileID: 1416211317}
displayManager: {fileID: 332003134}
--- !u!222 &246596744
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1614,6 +1615,7 @@ MonoBehaviour:
ErrorText: {fileID: 383296245}
FetchMapsButton: {fileID: 809281757}
FetchMapsButtonText: {fileID: 1977747177}
DownloadFilters: {fileID: 1416211317}
FixTimestampsButton: {fileID: 1657167283}
MoveDownloadsButton: {fileID: 1414726938}
--- !u!4 &332003135
Expand Down Expand Up @@ -4328,6 +4330,7 @@ MonoBehaviour:
Label: {fileID: 232748594}
SiteFilterName: Easy
downloadFilters: {fileID: 1416211317}
displayManager: {fileID: 332003134}
--- !u!1 &1414726936
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -4488,7 +4491,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1416211313}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
Expand All @@ -4506,8 +4509,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.15442}
m_SizeDelta: {x: 0, y: -0.30885}
m_AnchoredPosition: {x: 0, y: -0.15441996}
m_SizeDelta: {x: 0, y: -0.3088498}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1416211315
MonoBehaviour:
Expand Down Expand Up @@ -5234,6 +5237,7 @@ MonoBehaviour:
Label: {fileID: 82042874}
SiteFilterName: Expert
downloadFilters: {fileID: 1416211317}
displayManager: {fileID: 332003134}
--- !u!222 &1613107734
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -5712,6 +5716,7 @@ MonoBehaviour:
Label: {fileID: 888255825}
SiteFilterName: Normal
downloadFilters: {fileID: 1416211317}
displayManager: {fileID: 332003134}
--- !u!222 &1679267653
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -6042,6 +6047,7 @@ MonoBehaviour:
Label: {fileID: 1187464013}
SiteFilterName: Hard
downloadFilters: {fileID: 1416211317}
displayManager: {fileID: 332003134}
--- !u!222 &1731186211
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -6296,6 +6302,7 @@ MonoBehaviour:
Label: {fileID: 177211773}
SiteFilterName: Custom
downloadFilters: {fileID: 1416211317}
displayManager: {fileID: 332003134}
--- !u!222 &1765915678
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/CustomFileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private IEnumerator MoveDownloadedFiles() {
isMovingFiles = true;

// Disable anything else while we do this
displayManager.DisableActions();
displayManager.DisableActions("Moving Downloads...");

var downloadDir = "/sdcard/Download/";

Expand Down
18 changes: 15 additions & 3 deletions Assets/Scripts/DisplayManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class DisplayManager : MonoBehaviour, ILogHandler
public TextMeshProUGUI ErrorText;
public Button FetchMapsButton;
public TextMeshProUGUI FetchMapsButtonText;
public DownloadFilters DownloadFilters;
public Button FixTimestampsButton;
public Button MoveDownloadsButton;

Expand Down Expand Up @@ -50,7 +51,7 @@ public void UpdateLastFetchTime() {
LastFetchText.SetText($"Last Fetch: {lastFetchTime:dd MMM yy H:mm:ss zzz}");
}

public void DisableActions(string fetchMapsText="Fetch Songs") {
public void DisableActions(string fetchMapsText) {
FixTimestampsButton.interactable = false;
MoveDownloadsButton.interactable = false;

Expand All @@ -59,13 +60,24 @@ public void DisableActions(string fetchMapsText="Fetch Songs") {
FetchMapsButtonText.SetText(fetchMapsText);
}

public void UpdateFilterText() {
if (FetchMapsButton.interactable) {
var isFiltered = DownloadFilters.GetDifficultiesEnabled().Count != DownloadFilters.GetAllDifficulties().Count;
FetchMapsButtonText.SetText("Fetch " + (isFiltered ? "Filtered" : "All"));
}
else {
// Not interactable; must be doing something else. Don't update text yet.
// Whatever is disabling this will call EnableActions afterwards to call this again.
}
}

public void EnableActions() {
FixTimestampsButton.interactable = true;
MoveDownloadsButton.interactable = true;

FetchMapsButton.interactable = true;
FetchMapsButtonText.SetText("Fetch Songs");
FetchMapsButton.interactable = true;
FetchMapsButtonText.fontStyle = FontStyles.Normal;
UpdateFilterText();
}

public void ClearDebugLogs() {
Expand Down
4 changes: 3 additions & 1 deletion Assets/Scripts/DownloadFilterDifficulty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public class DownloadFilterDifficulty : MonoBehaviour {
public TextMeshProUGUI Label;
public string SiteFilterName;
public DownloadFilters downloadFilters;
public DisplayManager displayManager;
public bool IsSelected { get; private set; } = true;
private Color ColorSelected = Color.white;
private Color ColorUnselected = Color.gray;
Expand All @@ -17,7 +18,7 @@ public void SetSelected(bool isSelected) {
IsSelected = isSelected;

if (IsSelected) {
Label.fontStyle = FontStyles.Underline & FontStyles.Bold;
Label.fontStyle = FontStyles.Underline;
Label.color = ColorSelected;
}
else {
Expand All @@ -26,5 +27,6 @@ public void SetSelected(bool isSelected) {
}

downloadFilters.SaveDifficultyFiltersToPrefs();
displayManager.UpdateFilterText();
}
}
10 changes: 9 additions & 1 deletion Assets/Scripts/DownloadFilters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,18 @@ public DateTime GetDateCutoffFromCurrentSelection(DateTime nowUtc) {
/// Gets difficulty filter names for Z site.
/// Easy, Normal, Hard, Expert, Master, Custom
public List<string> GetDifficultiesEnabled() {
return difficultyFilters
var enabledDifficulties = difficultyFilters
.Where(filter => filter.IsSelected)
.Select(filter => filter.SiteFilterName)
.ToList();

// No filters selected treated the same as all selected (not filtered)
if (enabledDifficulties.Count == 0) {
return GetAllDifficulties();
}
else {
return enabledDifficulties;
}
}

/// Gets all difficult filter names
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/DownloadManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public async void StartDownloading() {
public async void FixMapTimestamps() {
displayManager.DebugLog("Fixing map timestamp...");

displayManager.DisableActions();
displayManager.DisableActions("Fixing Timestamps...");

try {
var sinceTime = DateTime.UnixEpoch;
Expand Down
3 changes: 2 additions & 1 deletion Assets/Scripts/Preferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public static void SetDifficultiesEnabled(List<string> enabledDifficulties) {
}

public static HashSet<string> GetDifficultiesEnabled() {
var csvDifficulties = PlayerPrefs.GetString(KEY_SELECTED_DIFFICULTIES, "");
// Default to all difficulties
var csvDifficulties = PlayerPrefs.GetString(KEY_SELECTED_DIFFICULTIES, "Easy,Normal,Hard,Expert,Master,Custom");
return csvDifficulties.Split(",", StringSplitOptions.RemoveEmptyEntries).ToHashSet();
}
}
Binary file modified OVRAssetBundles/OVRMasterBundle/OVRMasterBundle
Binary file not shown.
2 changes: 1 addition & 1 deletion OVRAssetBundles/OVRMasterBundle/OVRMasterBundle.manifest
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ManifestFileVersion: 0
CRC: 2771904397
CRC: 824051965
AssetBundleManifest:
AssetBundleInfos:
Info_0:
Expand Down
Binary file modified OVRAssetBundles/OVRMasterBundle/scene_mainscene
Binary file not shown.
6 changes: 3 additions & 3 deletions OVRAssetBundles/OVRMasterBundle/scene_mainscene.manifest
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ManifestFileVersion: 0
CRC: 304213647
CRC: 366535923
Hashes:
AssetFileHash:
serializedVersion: 2
Hash: 8123ba356be3ce75a08f113b5e998a9d
Hash: 40db9955f4ee71035d73bfbe6ead2c9d
TypeTreeHash:
serializedVersion: 2
Hash: d6223479d9595ff1651ecf562ab78c4e
Hash: c33e7aa94068522f35a3b5cd27daf0a5
HashAppended: 0
ClassTypes:
- Class: 1
Expand Down
Binary file modified OVRAssetBundles/Temp/OVRMasterBundle
Binary file not shown.
2 changes: 1 addition & 1 deletion OVRAssetBundles/Temp/SceneLoadData.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1674249058
1674389677
MainScene
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 1.1.0
bundleVersion: 1.1.1
preloadedAssets:
- {fileID: 0}
- {fileID: 0}
Expand Down

0 comments on commit ca8e978

Please sign in to comment.