Skip to content

Commit

Permalink
Temp Switch From Grid
Browse files Browse the repository at this point in the history
  • Loading branch information
CADIndie committed Nov 12, 2024
1 parent d6dac97 commit c9b2ae2
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 38 deletions.
36 changes: 18 additions & 18 deletions Assets/Scenes/Main.unity
Original file line number Diff line number Diff line change
Expand Up @@ -4823,7 +4823,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -280, y: 55}
m_AnchoredPosition: {x: -280, y: 28.5}
m_SizeDelta: {x: 179, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &287783867
Expand Down Expand Up @@ -5413,9 +5413,9 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 314844451}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0}
m_LocalScale: {x: 0.21, y: 0.21, z: 0.21}
m_ConstrainProportionsScale: 1
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.2, y: 0.21, z: 0.21}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 788089989}
- {fileID: 1868512256}
Expand All @@ -5428,7 +5428,7 @@ 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: -402.71, y: -2.5}
m_AnchoredPosition: {x: -415, y: -2.5}
m_SizeDelta: {x: 1612.74, y: 307.7}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &314844453
Expand Down Expand Up @@ -15499,7 +15499,7 @@ RectTransform:
- {fileID: 1588127159}
- {fileID: 245000898}
m_Father: {fileID: 1895559466}
m_RootOrder: 7
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -15970,17 +15970,17 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 837581984}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.00001731515}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1895559466}
m_RootOrder: 6
m_Father: {fileID: 1197191642}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 1027, y: 501}
m_AnchoredPosition: {x: 1027, y: 1.0000305}
m_SizeDelta: {x: 350, y: 24}
m_Pivot: {x: 0, y: 0}
--- !u!114 &837581986
Expand Down Expand Up @@ -18604,7 +18604,7 @@ RectTransform:
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_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 1197191642}
m_RootOrder: 0
Expand Down Expand Up @@ -23617,7 +23617,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1146946155}
m_LocalRotation: {x: -0, y: 0.00006783008, z: -0, w: -1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: 0, z: -0}
m_LocalScale: {x: 1.7, y: 1.7, z: 1.7}
m_ConstrainProportionsScale: 1
m_Children:
Expand All @@ -23628,7 +23628,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -930, y: 55}
m_AnchoredPosition: {x: -281, y: 81}
m_SizeDelta: {x: 179, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1146946157
Expand Down Expand Up @@ -24796,6 +24796,7 @@ RectTransform:
- {fileID: 906261452}
- {fileID: 314844452}
- {fileID: 735380335}
- {fileID: 837581985}
m_Father: {fileID: 1033016412}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -32156,8 +32157,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3ea93c410c41422c888a29851fea80d4, type: 3}
m_Name:
m_EditorClassIdentifier:
instanceArrayIM: {fileID: 1678472274}
instancePrefabIM: {fileID: 9218785909460619114, guid: c42cbe4b191c6f24591c22231e8f3094,
instanceArray: {fileID: 1678472274}
instancePrefab: {fileID: 9218785909460619114, guid: c42cbe4b191c6f24591c22231e8f3094,
type: 3}
instanceVersion: {fileID: 356556488}
instanceTitle: {fileID: 1863752288}
Expand Down Expand Up @@ -40298,7 +40299,6 @@ RectTransform:
- {fileID: 787850200}
- {fileID: 1720838226}
- {fileID: 1996973845}
- {fileID: 837581985}
- {fileID: 821339274}
m_Father: {fileID: 1283467987}
m_RootOrder: 0
Expand Down Expand Up @@ -48633,7 +48633,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 225, y: 187}
m_AnchoredPosition: {x: 225, y: 55}
m_SizeDelta: {x: 350, y: 78}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &2094218897
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/ConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void LoadConfig()
JNIStorage.apiClass.SetStatic("memoryValue", config.customRAMValue);
}

// JNIStorage.instance.instancesDropdown.value = config.lastSelectedInstance;
JNIStorage.instance.instancesDropdown.value = config.lastSelectedInstance;
}
else
{
Expand Down
15 changes: 11 additions & 4 deletions Assets/Scripts/InstanceButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,24 @@ public class InstanceButton : MonoBehaviour
public string configPath;

public CanvasGroup ScreenFade;

public void Update()
{
if (Application.platform != RuntimePlatform.Android)
return;
currInstName = JNIStorage.instance.instancesDropdown.options[JNIStorage.instance.instancesDropdown.value].text;
}

public static void SelectInstance(string instanceName)
public void SelectInstance()
{
if (Application.platform != RuntimePlatform.Android) return;
currInstName = instanceName;
/*configPath = Application.persistentDataPath + "/launcher.conf";
currInstName = JNIStorage.instance.instancesDropdown.options[JNIStorage.instance.instancesDropdown.value].text;
configPath = Application.persistentDataPath + "/launcher.conf";
string configFile = File.ReadAllText(configPath);
config = JsonConvert.DeserializeObject<ConfigHandler.Config>(configFile);
config.lastSelectedInstance = JNIStorage.instance.instancesDropdown.value;
string JSON = JsonConvert.SerializeObject(config, Formatting.Indented);
File.WriteAllText(configPath, JSON);*/
File.WriteAllText(configPath, JSON);
}

private static void CreateDefaultInstance(string name)
Expand Down
19 changes: 9 additions & 10 deletions Assets/Scripts/InstanceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

public class InstanceManager : MonoBehaviour
{
[SerializeField] private GameObject instanceArrayIM;
[SerializeField] private GameObject instancePrefabIM;
[SerializeField] private GameObject instanceArray;
[SerializeField] private GameObject instancePrefab;
[SerializeField] private TextMeshProUGUI instanceVersion;
[SerializeField] private TextMeshProUGUI instanceTitle;
[SerializeField] private RawImage instanceImage;
Expand Down Expand Up @@ -41,7 +41,6 @@ public void Start()
};

loaderDropdown.AddOptions(modLoaders);
CreateInstanceArray();
}

public void UpdateMenu()
Expand Down Expand Up @@ -94,9 +93,9 @@ public void CreateInstanceArray()
async Task SetInstanceData()
{
PojlibInstance instance = PojlibInstance.Parse(instanceObj);
GameObject instanceGameObject = Instantiate(instancePrefabIM, new Vector3(-10, -10, -10), Quaternion.identity);
GameObject instanceGameObject = Instantiate(instancePrefab, new Vector3(-10, -10, -10), Quaternion.identity);
instanceGameObject.transform.GetChild(1).GetComponent<TextMeshProUGUI>().text = instance.instanceName; instanceGameObject.transform.GetChild(2).GetComponent<TextMeshProUGUI>().text = instance.versionName + " - Fabric";
instanceGameObject.transform.SetParent(instanceArrayIM.transform, false);
instanceGameObject.transform.SetParent(instanceArray.transform, false);
instanceGameObject.name = instance.instanceName;

instanceGameObject.GetComponent<Button>().onClick.AddListener(delegate
Expand All @@ -114,14 +113,14 @@ async Task SetInstanceData()
SetInstanceData();
}

if (instanceArrayIM.transform.childCount == 0)
if (instanceArray.transform.childCount == 0)
{
GameObject instanceGameObject = Instantiate(instancePrefabIM, new Vector3(-10, -10, -10), Quaternion.identity);
GameObject instanceGameObject = Instantiate(instancePrefab, new Vector3(-10, -10, -10), Quaternion.identity);
instanceGameObject.GetComponentInChildren<RawImage>().texture = errorTexture;
instanceGameObject.GetComponentInChildren<RawImage>().color = Color.yellow;
instanceGameObject.transform.GetChild(1).GetComponent<TextMeshProUGUI>().text = "No instances could be found!";
instanceGameObject.transform.GetChild(2).GetComponent<TextMeshProUGUI>().text = "Make sure you have an instance downloaded.";
instanceGameObject.transform.SetParent(instanceArrayIM.transform, false);
instanceGameObject.transform.SetParent(instanceArray.transform, false);
instanceGameObject.name = "ERROR";
}
}
Expand Down Expand Up @@ -245,9 +244,9 @@ public void RemoveInstance()

private void ResetArray()
{
for (int i = instanceArrayIM.transform.childCount - 1; i >= 0; i--)
for (int i = instanceArray.transform.childCount - 1; i >= 0; i--)
{
Destroy(instanceArrayIM.transform.GetChild(i).gameObject);
Destroy(instanceArray.transform.GetChild(i).gameObject);
}
}
}
7 changes: 4 additions & 3 deletions Assets/Scripts/JNIStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ private void FillSupportedVersions(string[] supportedVersionsArray)

if (!supportedVersions.Contains(name))
{
GameObject instanceGameObject = Instantiate(instancePrefab, new Vector3(-10, -10, -10), Quaternion.identity);
supportedVersions.Add(name);

/*GameObject instanceGameObject = Instantiate(instancePrefab, new Vector3(-10, -10, -10), Quaternion.identity);
instanceGameObject.transform.SetParent(instanceArray.transform, false);
Debug.Log(name);
supportedVersions.Add(name);
instanceGameObject.transform.GetComponentInChildren<TextMeshProUGUI>().text = name;
instanceGameObject.GetComponent<Toggle>().group = instanceArray.GetComponent<ToggleGroup>();
instanceGameObject.name = name;
Expand All @@ -72,7 +73,7 @@ private void FillSupportedVersions(string[] supportedVersionsArray)
if (image != null)
{
apiHandler.DownloadImage(image, instanceGameObject.GetComponentInChildren<RawImage>());
}
}*/
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ PlayerSettings:
- {fileID: 0}
- {fileID: 0}
- {fileID: 11400000, guid: 1d87c4f70557acbdbb67d5fa81b6d8a7, type: 2}
- {fileID: 6154349898728414384, guid: d659781fbeb3ee24a850529d00b6529e, type: 2}
- {fileID: 4742369749144153844, guid: 7b5da002d83fb8f42ac49c354e6f6d31, type: 2}
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1
Expand Down

0 comments on commit c9b2ae2

Please sign in to comment.