-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #239 by Adding Update from Web to Language Preference
WIP Add JSON Object Downloader Add test file for JSONRetrieverTests Rencode SimpleJson.json test file as UTF-8 (no BOM) WIP improve WebRequest API and simplify test Restructure folders to better group networking classes Remove networking from JsonRetriver tests I added a mock UnityWebRequestWrapper to act as a successful web request. Add WaitForResult method to AsyncOp This makes for a cleaner API, though it does push some dependencies into AsyncOp. Add test for Timeout, rework API for WaitForResult I needed to differentiate expected Timeout via the Request from timeout from waiting for the operation to return. AsynOp should have never set its own status, as the user / owner should be responsible for that. Add test for InvalidJson Improve MockWebRequest to act more like a standard WebRequest Add test for invalid URI Add test (and mock) for NetworkError WIP Add LanguageRetriever to fetch and update languages Add LanguageBookmarks file to locate langauges WIP Implement LanguageRetriever Rename Locale folder to Localization This makes more sense in English. Rename Localization files for better clarity in English Locale is more of a place, so Locale as translated text was confusing. Localized is synonymous with "translated" (for a region), which seems like a better fit. Add version number to Language JSON This will help us version their languages as we update Mulligan or its languages. Use feature branch link for Langauge Bookmarks for now This will just let me test stuff quickly in my feature branch until it's ready to move to develop. Add implementation to update and add new languages Disallow changing to invalid LanguageKey in LocalizationManager Add boilerplate and general comments Delete unneeded interface I've decided I don't really want to test LanguageRetrievers, because JSONRetriever's already test for common networking errors. Testing LanguageRetrievers would require lots of framework (it depends on LocalizationManager which is a singleton and concrete class), and in the end won't really help me that much except to vet the way the UI presents networking errors. I will just manually test these cases for now by supplying the test IWebRequest objects to the JSONRetrievers used by LanguageRetriever. Move Networking framework outside of ExtensionsAndUtilities folder This wasn't the right place for it, as ExtensionsAndUtilities is meant for Extension classes and UTILITY classes which is my name for "extensions" to static classes (this mirror's Unity's naming. I personally don't love it due to ambiguity.) Add Dialog to report language update info Add Display text for timeout and network error in LanguageUpdate Add translatable strings for Language Update dialog Add debug feature to allow updating languages from staging Fix JSONRetrieverWeb to properly report 404, fix tests
- Loading branch information
1 parent
3b6cb71
commit 0dfe884
Showing
69 changed files
with
3,406 additions
and
1,687 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
Assets/RedBlueGames/MulliganRenamer/Editor/ExtensionsAndUtilities/EditorCoroutineUtility.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Collections; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
public static class EditorCoroutineUtility | ||
{ | ||
/// <summary> | ||
/// Starts a Coroutine using Unity Editor's update loop. This is useful for EditorWindows | ||
/// which aren't MonoBehaviours and therefore can't use Coroutines. | ||
/// Utility function adapted from https://forum.unity.com/threads/using-unitywebrequest-in-editor-tools.397466/#post-4485181 | ||
/// </summary> | ||
/// <param name="update"></param> | ||
/// <param name="onEnd"></param> | ||
public static void StartBackgroundTask(IEnumerator update, Action onEnd = null) | ||
{ | ||
EditorApplication.CallbackFunction closureCallback = null; | ||
|
||
closureCallback = () => | ||
{ | ||
try | ||
{ | ||
if (update.MoveNext() == false) | ||
{ | ||
if (onEnd != null) | ||
{ | ||
onEnd(); | ||
} | ||
EditorApplication.update -= closureCallback; | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
if (onEnd != null) | ||
{ | ||
onEnd(); | ||
} | ||
Debug.LogException(ex); | ||
EditorApplication.update -= closureCallback; | ||
} | ||
}; | ||
|
||
EditorApplication.update += closureCallback; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...RedBlueGames/MulliganRenamer/Editor/ExtensionsAndUtilities/EditorCoroutineUtility.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.