Skip to content

Commit

Permalink
Cleaning up UI. Launching SR works
Browse files Browse the repository at this point in the history
  • Loading branch information
bookdude13 committed Jan 15, 2023
1 parent 6b52e8d commit 3ed31ba
Show file tree
Hide file tree
Showing 12 changed files with 193 additions and 69 deletions.
166 changes: 151 additions & 15 deletions Assets/Scenes/MainScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1e332d4501ad787469e15b96f8a4a7fc, type: 3}
m_Name:
m_EditorClassIdentifier:
ResultText: {fileID: 1852618930}
displayManager: {fileID: 332003134}
--- !u!1 &383296243
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -713,8 +713,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -0.0000000018626, y: 0}
m_SizeDelta: {x: 5.3211, y: 2.9793}
m_AnchoredPosition: {x: -0.0000074804, y: 0}
m_SizeDelta: {x: 18.248, y: 2.9793}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &497729917
MonoBehaviour:
Expand All @@ -736,7 +736,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Play
m_text: Play Synth Riders
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
Expand Down Expand Up @@ -950,8 +950,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: -0.21802, y: 0.14237}
m_SizeDelta: {x: 0.43605, y: 0.1733}
m_AnchoredPosition: {x: 0.02015, y: 0.337}
m_SizeDelta: {x: 0.9124, y: 0.1733}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &867290210
MonoBehaviour:
Expand Down Expand Up @@ -1264,7 +1264,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1116074849
RectTransform:
m_ObjectHideFlags: 0
Expand All @@ -1278,7 +1278,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1396730355}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -1570,8 +1570,8 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 1.3
m_fontSizeBase: 1.3
m_fontSize: 1.6
m_fontSizeBase: 1.6
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 6
Expand Down Expand Up @@ -1648,6 +1648,7 @@ RectTransform:
m_LocalScale: {x: 0.05, y: 0.050000004, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1450649885}
- {fileID: 1116074849}
- {fileID: 1852618929}
m_Father: {fileID: 1562907173}
Expand Down Expand Up @@ -1772,7 +1773,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0.020152, y: 0.3548}
m_AnchoredPosition: {x: 0.020145, y: 0.554}
m_SizeDelta: {x: 0.91239, y: 0.1609}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1414726938
Expand Down Expand Up @@ -1948,6 +1949,141 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1416211313}
m_CullTransparentMesh: 1
--- !u!1 &1450649884
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1450649885}
- component: {fileID: 1450649887}
- component: {fileID: 1450649886}
m_Layer: 0
m_Name: txtTitle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1450649885
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1450649884}
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
m_Children: []
m_Father: {fileID: 1396730355}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.1513, y: 3.877}
m_SizeDelta: {x: 18.438, y: 4.4199}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1450649886
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1450649884}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: SR Quest Downloader
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 1.5
m_fontSizeBase: 1.5
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 6
m_fontSizeMax: 18
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: -0.055011746, y: 0.05731893, z: -0.0221262, w: -0.058979873}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &1450649887
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1450649884}
m_CullTransparentMesh: 1
--- !u!1 &1534894641
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2331,7 +2467,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1852618929
RectTransform:
m_ObjectHideFlags: 0
Expand All @@ -2345,7 +2481,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1396730355}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -2486,8 +2622,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0.2514, y: 0.14237}
m_SizeDelta: {x: 0.4499, y: 0.1733}
m_AnchoredPosition: {x: 0.020155996, y: 0.12}
m_SizeDelta: {x: 0.91239, y: 0.1733}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1879712639
MonoBehaviour:
Expand Down
20 changes: 0 additions & 20 deletions Assets/Scripts/DisplayManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,19 @@

public class DisplayManager : MonoBehaviour
{
public TextMeshProUGUI LastModifiedText;
public TextMeshProUGUI ResultText;
public TextMeshProUGUI DebugText;
public TextMeshProUGUI ErrorText;

private readonly string lastModifiedLabel = "Last Modified: ";
private readonly string resultLabel = "Result: ";

private List<string> debugBuffer = new List<string>();
private List<string> errorBuffer = new List<string>();


private void Awake()
{
LastModifiedText.SetText(lastModifiedLabel + Preferences.GetLastDownloadedTimeMs());
LastModifiedText.gameObject.SetActive(true);

ResultText.SetText(resultLabel);
ResultText.gameObject.SetActive(true);

DebugText.gameObject.SetActive(true);
ErrorText.gameObject.SetActive(true);
}

private void SetError(string message)
{
ResultText.SetText("Error: " + message);
ResultText.color = Color.red;
ResultText.gameObject.SetActive(true);

LastModifiedText.gameObject.SetActive(false);
}

public void ClearLogs() {
debugBuffer.Clear();
DebugText.SetText("");
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/DownloadManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private IEnumerator ExtractSynthriderzZip(string zipPath, string synthDirectory)
/// Move synth custom content from the Downloads folder to custom content directories.
/// Extracts zip files that look like they were downloaded from synthriderz.com
private IEnumerator MoveDownloadedFiles() {
displayManager.ResultText.SetText("Moving custom songs from Download folder...");
displayManager.DebugLog("Trying to move custom content from Download folder...");

if (isMovingFiles) {
displayManager.DebugLog("Already moving! Ignoring...");
Expand Down
15 changes: 0 additions & 15 deletions Assets/Scripts/Preferences.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Assets/Scripts/Preferences.cs.meta

This file was deleted.

38 changes: 36 additions & 2 deletions Assets/Scripts/SynthLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,46 @@

public class SynthLauncher : MonoBehaviour
{
public TextMeshProUGUI ResultText;
public DisplayManager displayManager;

public void LaunchSynthRiders()
{
ResultText.SetText("Launching Synth Riders...");
displayManager.DebugLog("Launching Synth Riders...");
SendLaunchIntent("com.kluge.SynthRiders");
}

/// Adapted from https://forum.unity.com/threads/android-ios-launch-from-within-a-unity-app-another-unity-app.222709/?_ga=2.89812563.95253068.1605723327-1322877492.1590351887#post-2308076
private void SendLaunchIntent(string bundleId) {
displayManager.DebugLog("Getting current package manager...");
AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject ca = up.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject packageManager = ca.Call<AndroidJavaObject>("getPackageManager");

bool didLaunch = false;
try
{
displayManager.DebugLog("Creating launch intent");
AndroidJavaObject launchIntent = packageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage", bundleId);

displayManager.DebugLog("Trying to start activity...");
ca.Call("startActivity",launchIntent);

didLaunch = true;
launchIntent.Dispose();
}
catch (System.Exception e)
{
displayManager.ErrorLog($"Failed to create or send launch intent for bundle {bundleId}: {e.Message}");
}
finally {
displayManager.DebugLog("Clean up...");
packageManager.Dispose();
ca.Dispose();
up.Dispose();
}

if (didLaunch) {
Application.Quit(0);
}
}
}
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: 353322661
CRC: 186336972
AssetBundleManifest:
AssetBundleInfos:
Info_0:
Expand Down
Binary file modified OVRAssetBundles/OVRMasterBundle/scene_mainscene
Binary file not shown.
Loading

0 comments on commit 3ed31ba

Please sign in to comment.