From 1f73aee3c191bb426da6a990ac39709644150470 Mon Sep 17 00:00:00 2001 From: Natsu Date: Mon, 1 Jul 2024 13:26:27 +0700 Subject: [PATCH] chore(update.yml): remove update.yml workflow file chore(.gitmodules): remove .gitmodules file chore(about_contributors_zh_cn.json): remove about_contributors_zh_cn.json file fix(Hook.cpp): change parameter name from TMP_Text_this to TMP_Textself in UpdateFont function fix(MainActivity.kt): remove unused import statement for FilesChecker chore(ProgramConfig.kt): update default values for transRemoteZipUrl, useRemoteAssets, and delRemoteAfterUpdate in ProgramConfig class chore(HomePage.kt): remove unused GakuSwitch for replace_font feat(Color.kt): add Color.kt file feat(Type.kt): add Type.kt file feat(colors.xml): add colors.xml file fix(strings.xml): fix typo in basic_settings string --- .github/workflows/update.yml | 40 ------------------- .gitmodules | 3 -- .../main/assets/about_contributors_zh_cn.json | 29 -------------- app/src/main/cpp/GakumasLocalify/Hook.cpp | 4 +- .../chinosk/gakumas/localify/MainActivity.kt | 4 +- .../localify/hookUtils/FilesChecker.kt | 4 -- .../gakumas/localify/models/ProgramConfig.kt | 6 +-- .../localify/ui/pages/subPages/HomePage.kt | 4 -- .../gakumas/localify/ui/theme/Color.kt | 11 +++++ .../chinosk/gakumas/localify/ui/theme/Type.kt | 34 ++++++++++++++++ app/src/main/res/values/colors.xml | 10 +++++ app/src/main/res/values/strings.xml | 4 +- 12 files changed, 63 insertions(+), 90 deletions(-) delete mode 100644 .github/workflows/update.yml delete mode 100644 .gitmodules delete mode 100644 app/src/main/assets/about_contributors_zh_cn.json create mode 100644 app/src/main/java/io/github/chinosk/gakumas/localify/ui/theme/Color.kt create mode 100644 app/src/main/java/io/github/chinosk/gakumas/localify/ui/theme/Type.kt create mode 100644 app/src/main/res/values/colors.xml diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml deleted file mode 100644 index 62c3690..0000000 --- a/.github/workflows/update.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Update Submodule - -on: - repository_dispatch: - types: - - update-submodule - -jobs: - update-submodule: - - runs-on: ubuntu-latest - - permissions: - contents: write - pull-requests: write - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - with: - token: ${{ secrets.PAT }} - submodules: recursive - - - name: Authorize Git - run: | - git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" - git config --global user.name "$GITHUB_ACTOR" - - - name: Update Submodule - run: | - git submodule update --init --recursive --remote -f - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - - - name: Commit Changes - run: | - git commit -am "chore(submodule): Update Translation Data" - git push origin main - env: - GITHUB_TOKEN: ${{ secrets.PAT }} diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index ccffdc2..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "app/src/main/assets/gakumas-local"] - path = app/src/main/assets/gakumas-local - url = https://github.com/NatsumeLS/Gakumas-Translation-Data-EN.git diff --git a/app/src/main/assets/about_contributors_zh_cn.json b/app/src/main/assets/about_contributors_zh_cn.json deleted file mode 100644 index d825d11..0000000 --- a/app/src/main/assets/about_contributors_zh_cn.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "plugin_repo": "https://github.com/chinosk6/gakuen-imas-localify", - "main_contributors": [ - { - "name": "chinosk(插件本体)", - "links": [ - {"name": "Github", "link": "https://github.com/chinosk6"}, - {"name": "Bilibili", "link": "https://space.bilibili.com/287061163"} - ] - }, - { - "name": "DarwinTree(译文工作流)", - "links": [ - {"name": "Github", "link": "https://github.com/darwintree"}, - {"name": "Bilibili", "link": "https://space.bilibili.com/6069705"} - ] - }, - { - "name": "以及其他所有翻译贡献者", - "links": [ - {"name": "Github", "link": "https://github.com/chinosk6/GakumasTranslationData/graphs/contributors"} - ] - } - ], - "contrib_img": { - "plugin": "https://contrib.rocks/image?repo=chinosk6/gakuen-imas-localify", - "translation": "https://contrib.rocks/image?repo=chinosk6/GakumasTranslationData" - } -} \ No newline at end of file diff --git a/app/src/main/cpp/GakumasLocalify/Hook.cpp b/app/src/main/cpp/GakumasLocalify/Hook.cpp index cc29b4f..6e714a4 100644 --- a/app/src/main/cpp/GakumasLocalify/Hook.cpp +++ b/app/src/main/cpp/GakumasLocalify/Hook.cpp @@ -298,7 +298,7 @@ namespace GakumasLocal::HookMain { } std::unordered_set updatedFontPtrs{}; - void UpdateFont(void* TMP_Text_this) { + void UpdateFont(void* TMP_Textself) { static auto get_font = Il2cppUtils::GetMethod("Unity.TextMeshPro.dll", "TMPro", "TMP_Text", "get_font"); static auto set_font = Il2cppUtils::GetMethod("Unity.TextMeshPro.dll", @@ -309,7 +309,7 @@ namespace GakumasLocal::HookMain { static auto UpdateFontAssetData = Il2cppUtils::GetMethod("Unity.TextMeshPro.dll", "TMPro", "TMP_FontAsset", "UpdateFontAssetData"); - auto fontAsset = get_font->Invoke(TMP_Text_this); + auto fontAsset = get_font->Invoke(TMP_Textself); if (!updatedFontPtrs.contains(fontAsset)) { updatedFontPtrs.emplace(fontAsset); diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/MainActivity.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/MainActivity.kt index fc363c2..1bc5d54 100644 --- a/app/src/main/java/io/github/chinosk/gakumas/localify/MainActivity.kt +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/MainActivity.kt @@ -14,7 +14,6 @@ import androidx.compose.runtime.State import androidx.compose.runtime.collectAsState import androidx.lifecycle.ViewModelProvider import io.github.chinosk.gakumas.localify.hookUtils.FileHotUpdater -import io.github.chinosk.gakumas.localify.hookUtils.FilesChecker import io.github.chinosk.gakumas.localify.hookUtils.MainKeyEventDispatcher import io.github.chinosk.gakumas.localify.mainUtils.json import io.github.chinosk.gakumas.localify.models.GakumasConfig @@ -73,8 +72,7 @@ class MainActivity : ComponentActivity(), ConfigUpdateListener, IConfigurableAct var resVersionText = "unknown" try { - val stream = assets.open("${FilesChecker.localizationFilesDir}/version.txt") - resVersionText = FilesChecker.convertToString(stream) + resVersionText = programConfigViewModel.localResourceVersion.value val packInfo = packageManager.getPackageInfo(packageName, 0) val version = packInfo.versionName diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/hookUtils/FilesChecker.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/hookUtils/FilesChecker.kt index 61d72e7..a77e7c7 100644 --- a/app/src/main/java/io/github/chinosk/gakumas/localify/hookUtils/FilesChecker.kt +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/hookUtils/FilesChecker.kt @@ -141,15 +141,11 @@ object FilesChecker { val pluginBasePath = File(filesDir, localizationFilesDir) val localFilesDir = File(pluginBasePath, "local-files") - val fontFile = File(localFilesDir, "gkamsZHFontMIX.otf") val resourceDir = File(localFilesDir, "resource") val genericTransDir = File(localFilesDir, "genericTrans") val genericTransFile = File(localFilesDir, "generic.json") val i18nFile = File(localFilesDir, "localization.json") - if (fontFile.exists()) { - fontFile.delete() - } if (deleteRecursively(resourceDir)) { resourceDir.mkdirs() } diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/models/ProgramConfig.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/models/ProgramConfig.kt index ea68ab1..7c70eed 100644 --- a/app/src/main/java/io/github/chinosk/gakumas/localify/models/ProgramConfig.kt +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/models/ProgramConfig.kt @@ -14,9 +14,9 @@ import kotlinx.serialization.json.jsonObject @Serializable data class ProgramConfig( var checkBuiltInAssets: Boolean = true, - var transRemoteZipUrl: String = "", - var useRemoteAssets: Boolean = false, - var delRemoteAfterUpdate: Boolean = true, + var transRemoteZipUrl: String = "https://github.com/NatsumeLS/Gakumas-Translation-Data-EN.git", + var useRemoteAssets: Boolean = true, + var delRemoteAfterUpdate: Boolean = false, var cleanLocalAssets: Boolean = false, var p: Boolean = false ) diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/ui/pages/subPages/HomePage.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/ui/pages/subPages/HomePage.kt index 8abde41..a823686 100644 --- a/app/src/main/java/io/github/chinosk/gakumas/localify/ui/pages/subPages/HomePage.kt +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/ui/pages/subPages/HomePage.kt @@ -140,10 +140,6 @@ fun HomePage(modifier: Modifier = Modifier, GakuSwitch(modifier, stringResource(R.string.enable_plugin), checked = config.value.enabled) { v -> context?.onEnabledChanged(v) } - - GakuSwitch(modifier, stringResource(R.string.replace_font), checked = config.value.replaceFont) { - v -> context?.onReplaceFontChanged(v) - } } } Spacer(Modifier.height(6.dp)) diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/ui/theme/Color.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/ui/theme/Color.kt new file mode 100644 index 0000000..5bf3fb0 --- /dev/null +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package io.github.chinosk.gakumas.localify.ui.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/ui/theme/Type.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/ui/theme/Type.kt new file mode 100644 index 0000000..ac2fd74 --- /dev/null +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package io.github.chinosk.gakumas.localify.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ +) \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 12cd362..6f54b0e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -11,7 +11,7 @@ Live Custom Dress ID (eg. hski-cstm-0002) Use Custom Graphic Settings Render Scale (0.5-1.0) - Text Hook Test Mode (For Testing Only) + Text Hook Test Mode Export Text (For Collecting Strings) Force Update Resource Max @@ -43,7 +43,7 @@ axisX.y axisY.y axisZ.y - Basic Ssettings + Basic Settings Graphic Settings Camera Settings Test Mode - LIVE