Skip to content

Commit

Permalink
Fixed some config related bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
headassbtw committed Feb 20, 2021
1 parent 3b40e3a commit 5174065
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CustomMenuText/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ public static void setText(string[] lines)
public void reloadFile()
{
allEntries = readFromFile(FILE_PATH);
Configuration.PluginConfig.Instance.SelectionType = selection_type;
Configuration.PluginConfig.Instance.SelectedEntry = choice;
}

/// <summary>
Expand Down Expand Up @@ -550,6 +552,8 @@ public void restoreDefaultConfig()
[OnExit]
public void OnApplicationQuit()
{
Configuration.PluginConfig.Instance.SelectionType = selection_type;
Configuration.PluginConfig.Instance.SelectedEntry = choice;
SceneManager.activeSceneChanged -= SceneManagerOnActiveSceneChanged;
SceneManager.sceneLoaded -= SceneManager_sceneLoaded;
}
Expand Down
29 changes: 29 additions & 0 deletions CustomMenuText/Views/TextSelector/TextSelectorViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,35 @@ public void SetupList()

}
textListData.tableView.ReloadData();

switch (Configuration.PluginConfig.Instance.SelectionType)
{
case 0:
textListData.tableView.SelectCellWithIdx(0);
break;
case 1:
textListData.tableView.SelectCellWithIdx(1);
break;
case 2:
textListData.tableView.SelectCellWithIdx(Configuration.PluginConfig.Instance.SelectedEntry + 2);
break;
}
}

public void SelectCorrectCell(int selType, int choice)
{
switch (selType)
{
case 0:
textListData.tableView.SelectCellWithIdx(0);
break;
case 1:
textListData.tableView.SelectCellWithIdx(1);
break;
case 2:
textListData.tableView.SelectCellWithIdx(choice + 2);
break;
}
}
}
}
3 changes: 1 addition & 2 deletions CustomMenuText/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"gameVersion": "1.13.2",
"dependsOn": {
"BSIPA": "^4.0.5",
"BeatSaberMarkupLanguage": "^1.4.5",
"HMUI": "^0"
"BeatSaberMarkupLanguage": "^1.4.5"
},
"features": []
}

0 comments on commit 5174065

Please sign in to comment.