Compare commits
No commits in common. "master" and "Release" have entirely different histories.
|
@ -1,363 +0,0 @@
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
|
||||||
## files generated by popular Visual Studio add-ons.
|
|
||||||
##
|
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
|
||||||
|
|
||||||
# User-specific files
|
|
||||||
*.rsuser
|
|
||||||
*.suo
|
|
||||||
*.user
|
|
||||||
*.userosscache
|
|
||||||
*.sln.docstates
|
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
|
||||||
*.userprefs
|
|
||||||
|
|
||||||
# Mono auto generated files
|
|
||||||
mono_crash.*
|
|
||||||
|
|
||||||
# Build results
|
|
||||||
[Dd]ebug/
|
|
||||||
[Dd]ebugPublic/
|
|
||||||
[Rr]elease/
|
|
||||||
[Rr]eleases/
|
|
||||||
x64/
|
|
||||||
x86/
|
|
||||||
[Ww][Ii][Nn]32/
|
|
||||||
[Aa][Rr][Mm]/
|
|
||||||
[Aa][Rr][Mm]64/
|
|
||||||
bld/
|
|
||||||
[Bb]in/
|
|
||||||
[Oo]bj/
|
|
||||||
[Oo]ut/
|
|
||||||
[Ll]og/
|
|
||||||
[Ll]ogs/
|
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
|
||||||
.vs/
|
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
|
||||||
#wwwroot/
|
|
||||||
|
|
||||||
# Visual Studio 2017 auto generated files
|
|
||||||
Generated\ Files/
|
|
||||||
|
|
||||||
# MSTest test Results
|
|
||||||
[Tt]est[Rr]esult*/
|
|
||||||
[Bb]uild[Ll]og.*
|
|
||||||
|
|
||||||
# NUnit
|
|
||||||
*.VisualState.xml
|
|
||||||
TestResult.xml
|
|
||||||
nunit-*.xml
|
|
||||||
|
|
||||||
# Build Results of an ATL Project
|
|
||||||
[Dd]ebugPS/
|
|
||||||
[Rr]eleasePS/
|
|
||||||
dlldata.c
|
|
||||||
|
|
||||||
# Benchmark Results
|
|
||||||
BenchmarkDotNet.Artifacts/
|
|
||||||
|
|
||||||
# .NET Core
|
|
||||||
project.lock.json
|
|
||||||
project.fragment.lock.json
|
|
||||||
artifacts/
|
|
||||||
|
|
||||||
# ASP.NET Scaffolding
|
|
||||||
ScaffoldingReadMe.txt
|
|
||||||
|
|
||||||
# StyleCop
|
|
||||||
StyleCopReport.xml
|
|
||||||
|
|
||||||
# Files built by Visual Studio
|
|
||||||
*_i.c
|
|
||||||
*_p.c
|
|
||||||
*_h.h
|
|
||||||
*.ilk
|
|
||||||
*.meta
|
|
||||||
*.obj
|
|
||||||
*.iobj
|
|
||||||
*.pch
|
|
||||||
*.pdb
|
|
||||||
*.ipdb
|
|
||||||
*.pgc
|
|
||||||
*.pgd
|
|
||||||
*.rsp
|
|
||||||
*.sbr
|
|
||||||
*.tlb
|
|
||||||
*.tli
|
|
||||||
*.tlh
|
|
||||||
*.tmp
|
|
||||||
*.tmp_proj
|
|
||||||
*_wpftmp.csproj
|
|
||||||
*.log
|
|
||||||
*.vspscc
|
|
||||||
*.vssscc
|
|
||||||
.builds
|
|
||||||
*.pidb
|
|
||||||
*.svclog
|
|
||||||
*.scc
|
|
||||||
|
|
||||||
# Chutzpah Test files
|
|
||||||
_Chutzpah*
|
|
||||||
|
|
||||||
# Visual C++ cache files
|
|
||||||
ipch/
|
|
||||||
*.aps
|
|
||||||
*.ncb
|
|
||||||
*.opendb
|
|
||||||
*.opensdf
|
|
||||||
*.sdf
|
|
||||||
*.cachefile
|
|
||||||
*.VC.db
|
|
||||||
*.VC.VC.opendb
|
|
||||||
|
|
||||||
# Visual Studio profiler
|
|
||||||
*.psess
|
|
||||||
*.vsp
|
|
||||||
*.vspx
|
|
||||||
*.sap
|
|
||||||
|
|
||||||
# Visual Studio Trace Files
|
|
||||||
*.e2e
|
|
||||||
|
|
||||||
# TFS 2012 Local Workspace
|
|
||||||
$tf/
|
|
||||||
|
|
||||||
# Guidance Automation Toolkit
|
|
||||||
*.gpState
|
|
||||||
|
|
||||||
# ReSharper is a .NET coding add-in
|
|
||||||
_ReSharper*/
|
|
||||||
*.[Rr]e[Ss]harper
|
|
||||||
*.DotSettings.user
|
|
||||||
|
|
||||||
# TeamCity is a build add-in
|
|
||||||
_TeamCity*
|
|
||||||
|
|
||||||
# DotCover is a Code Coverage Tool
|
|
||||||
*.dotCover
|
|
||||||
|
|
||||||
# AxoCover is a Code Coverage Tool
|
|
||||||
.axoCover/*
|
|
||||||
!.axoCover/settings.json
|
|
||||||
|
|
||||||
# Coverlet is a free, cross platform Code Coverage Tool
|
|
||||||
coverage*.json
|
|
||||||
coverage*.xml
|
|
||||||
coverage*.info
|
|
||||||
|
|
||||||
# Visual Studio code coverage results
|
|
||||||
*.coverage
|
|
||||||
*.coveragexml
|
|
||||||
|
|
||||||
# NCrunch
|
|
||||||
_NCrunch_*
|
|
||||||
.*crunch*.local.xml
|
|
||||||
nCrunchTemp_*
|
|
||||||
|
|
||||||
# MightyMoose
|
|
||||||
*.mm.*
|
|
||||||
AutoTest.Net/
|
|
||||||
|
|
||||||
# Web workbench (sass)
|
|
||||||
.sass-cache/
|
|
||||||
|
|
||||||
# Installshield output folder
|
|
||||||
[Ee]xpress/
|
|
||||||
|
|
||||||
# DocProject is a documentation generator add-in
|
|
||||||
DocProject/buildhelp/
|
|
||||||
DocProject/Help/*.HxT
|
|
||||||
DocProject/Help/*.HxC
|
|
||||||
DocProject/Help/*.hhc
|
|
||||||
DocProject/Help/*.hhk
|
|
||||||
DocProject/Help/*.hhp
|
|
||||||
DocProject/Help/Html2
|
|
||||||
DocProject/Help/html
|
|
||||||
|
|
||||||
# Click-Once directory
|
|
||||||
publish/
|
|
||||||
|
|
||||||
# Publish Web Output
|
|
||||||
*.[Pp]ublish.xml
|
|
||||||
*.azurePubxml
|
|
||||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
|
||||||
*.pubxml
|
|
||||||
*.publishproj
|
|
||||||
|
|
||||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
|
||||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
|
||||||
# in these scripts will be unencrypted
|
|
||||||
PublishScripts/
|
|
||||||
|
|
||||||
# NuGet Packages
|
|
||||||
*.nupkg
|
|
||||||
# NuGet Symbol Packages
|
|
||||||
*.snupkg
|
|
||||||
# The packages folder can be ignored because of Package Restore
|
|
||||||
**/[Pp]ackages/*
|
|
||||||
# except build/, which is used as an MSBuild target.
|
|
||||||
!**/[Pp]ackages/build/
|
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
|
||||||
#!**/[Pp]ackages/repositories.config
|
|
||||||
# NuGet v3's project.json files produces more ignorable files
|
|
||||||
*.nuget.props
|
|
||||||
*.nuget.targets
|
|
||||||
|
|
||||||
# Microsoft Azure Build Output
|
|
||||||
csx/
|
|
||||||
*.build.csdef
|
|
||||||
|
|
||||||
# Microsoft Azure Emulator
|
|
||||||
ecf/
|
|
||||||
rcf/
|
|
||||||
|
|
||||||
# Windows Store app package directories and files
|
|
||||||
AppPackages/
|
|
||||||
BundleArtifacts/
|
|
||||||
Package.StoreAssociation.xml
|
|
||||||
_pkginfo.txt
|
|
||||||
*.appx
|
|
||||||
*.appxbundle
|
|
||||||
*.appxupload
|
|
||||||
|
|
||||||
# Visual Studio cache files
|
|
||||||
# files ending in .cache can be ignored
|
|
||||||
*.[Cc]ache
|
|
||||||
# but keep track of directories ending in .cache
|
|
||||||
!?*.[Cc]ache/
|
|
||||||
|
|
||||||
# Others
|
|
||||||
ClientBin/
|
|
||||||
~$*
|
|
||||||
*~
|
|
||||||
*.dbmdl
|
|
||||||
*.dbproj.schemaview
|
|
||||||
*.jfm
|
|
||||||
*.pfx
|
|
||||||
*.publishsettings
|
|
||||||
orleans.codegen.cs
|
|
||||||
|
|
||||||
# Including strong name files can present a security risk
|
|
||||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
|
||||||
#*.snk
|
|
||||||
|
|
||||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
|
||||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
|
||||||
#bower_components/
|
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
|
||||||
Generated_Code/
|
|
||||||
|
|
||||||
# Backup & report files from converting an old project file
|
|
||||||
# to a newer Visual Studio version. Backup files are not needed,
|
|
||||||
# because we have git ;-)
|
|
||||||
_UpgradeReport_Files/
|
|
||||||
Backup*/
|
|
||||||
UpgradeLog*.XML
|
|
||||||
UpgradeLog*.htm
|
|
||||||
ServiceFabricBackup/
|
|
||||||
*.rptproj.bak
|
|
||||||
|
|
||||||
# SQL Server files
|
|
||||||
*.mdf
|
|
||||||
*.ldf
|
|
||||||
*.ndf
|
|
||||||
|
|
||||||
# Business Intelligence projects
|
|
||||||
*.rdl.data
|
|
||||||
*.bim.layout
|
|
||||||
*.bim_*.settings
|
|
||||||
*.rptproj.rsuser
|
|
||||||
*- [Bb]ackup.rdl
|
|
||||||
*- [Bb]ackup ([0-9]).rdl
|
|
||||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
|
||||||
|
|
||||||
# Microsoft Fakes
|
|
||||||
FakesAssemblies/
|
|
||||||
|
|
||||||
# GhostDoc plugin setting file
|
|
||||||
*.GhostDoc.xml
|
|
||||||
|
|
||||||
# Node.js Tools for Visual Studio
|
|
||||||
.ntvs_analysis.dat
|
|
||||||
node_modules/
|
|
||||||
|
|
||||||
# Visual Studio 6 build log
|
|
||||||
*.plg
|
|
||||||
|
|
||||||
# Visual Studio 6 workspace options file
|
|
||||||
*.opt
|
|
||||||
|
|
||||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
|
||||||
*.vbw
|
|
||||||
|
|
||||||
# Visual Studio LightSwitch build output
|
|
||||||
**/*.HTMLClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/ModelManifest.xml
|
|
||||||
**/*.Server/GeneratedArtifacts
|
|
||||||
**/*.Server/ModelManifest.xml
|
|
||||||
_Pvt_Extensions
|
|
||||||
|
|
||||||
# Paket dependency manager
|
|
||||||
.paket/paket.exe
|
|
||||||
paket-files/
|
|
||||||
|
|
||||||
# FAKE - F# Make
|
|
||||||
.fake/
|
|
||||||
|
|
||||||
# CodeRush personal settings
|
|
||||||
.cr/personal
|
|
||||||
|
|
||||||
# Python Tools for Visual Studio (PTVS)
|
|
||||||
__pycache__/
|
|
||||||
*.pyc
|
|
||||||
|
|
||||||
# Cake - Uncomment if you are using it
|
|
||||||
# tools/**
|
|
||||||
# !tools/packages.config
|
|
||||||
|
|
||||||
# Tabs Studio
|
|
||||||
*.tss
|
|
||||||
|
|
||||||
# Telerik's JustMock configuration file
|
|
||||||
*.jmconfig
|
|
||||||
|
|
||||||
# BizTalk build output
|
|
||||||
*.btp.cs
|
|
||||||
*.btm.cs
|
|
||||||
*.odx.cs
|
|
||||||
*.xsd.cs
|
|
||||||
|
|
||||||
# OpenCover UI analysis results
|
|
||||||
OpenCover/
|
|
||||||
|
|
||||||
# Azure Stream Analytics local run output
|
|
||||||
ASALocalRun/
|
|
||||||
|
|
||||||
# MSBuild Binary and Structured Log
|
|
||||||
*.binlog
|
|
||||||
|
|
||||||
# NVidia Nsight GPU debugger configuration file
|
|
||||||
*.nvuser
|
|
||||||
|
|
||||||
# MFractors (Xamarin productivity tool) working folder
|
|
||||||
.mfractor/
|
|
||||||
|
|
||||||
# Local History for Visual Studio
|
|
||||||
.localhistory/
|
|
||||||
|
|
||||||
# BeatPulse healthcheck temp database
|
|
||||||
healthchecksdb
|
|
||||||
|
|
||||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
|
||||||
MigrationBackup/
|
|
||||||
|
|
||||||
# Ionide (cross platform F# VS Code tools) working folder
|
|
||||||
.ionide/
|
|
||||||
|
|
||||||
# Fody - auto-generated XML schema
|
|
||||||
FodyWeavers.xsd
|
|
|
@ -1,33 +0,0 @@
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("Translation Updater")]
|
|
||||||
[assembly: AssemblyDescription("Auto-Updater for KF3TL Project")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("Katworks")]
|
|
||||||
[assembly: AssemblyProduct("TranslationUpdater.Properties")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("e710dbad-86d3-4e7f-bd68-39420acb65d0")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
|
@ -8,11 +8,11 @@ namespace TranslationUpdater
|
||||||
{
|
{
|
||||||
public const string pluginGuid = "katboi01.TranslationUpdater";
|
public const string pluginGuid = "katboi01.TranslationUpdater";
|
||||||
public const string pluginName = "KF3 Translation Updater";
|
public const string pluginName = "KF3 Translation Updater";
|
||||||
public const string pluginVersion = "1.2.0";
|
public const string pluginVersion = "1.1.0";
|
||||||
|
|
||||||
public void Awake()
|
public void Awake()
|
||||||
{
|
{
|
||||||
UpdateHandler.PluginVersion = pluginVersion;
|
Console.WriteLine("Loading Updater");
|
||||||
UpdateHandler.Create();
|
UpdateHandler.Create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,6 @@
|
||||||
<Reference Include="BepInEx">
|
<Reference Include="BepInEx">
|
||||||
<HintPath>..\Libs\BepInEx.dll</HintPath>
|
<HintPath>..\Libs\BepInEx.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\Libs\Newtonsoft.Json.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.IO.Compression" />
|
<Reference Include="System.IO.Compression" />
|
||||||
|
@ -69,6 +65,9 @@
|
||||||
<Reference Include="UnityEngine.IMGUIModule">
|
<Reference Include="UnityEngine.IMGUIModule">
|
||||||
<HintPath>..\Libs\UnityEngine.IMGUIModule.dll</HintPath>
|
<HintPath>..\Libs\UnityEngine.IMGUIModule.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.JSONSerializeModule">
|
||||||
|
<HintPath>..\Libs\UnityEngine.JSONSerializeModule.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="UnityEngine.TextRenderingModule">
|
<Reference Include="UnityEngine.TextRenderingModule">
|
||||||
<HintPath>..\Libs\UnityEngine.TextRenderingModule.dll</HintPath>
|
<HintPath>..\Libs\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -84,13 +83,8 @@
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="TranslationUpdater.cs" />
|
<Compile Include="TranslationUpdater.cs" />
|
||||||
<Compile Include="UI\PopupMessage.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="UI\ProgressSlider.cs" />
|
|
||||||
<Compile Include="UI\SettingsPanel.cs" />
|
|
||||||
<Compile Include="UI\UpdateAvailable.cs" />
|
|
||||||
<Compile Include="UI\UpdateChecker.cs" />
|
|
||||||
<Compile Include="UpdateHandler.cs" />
|
<Compile Include="UpdateHandler.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
public class PopupMessage : MonoBehaviour
|
|
||||||
{
|
|
||||||
public Text Content;
|
|
||||||
public float MessageTime;
|
|
||||||
|
|
||||||
public System.Action OnFinishedAction;
|
|
||||||
|
|
||||||
public PopupMessage Init(string message, float time = 2)
|
|
||||||
{
|
|
||||||
Content.text = message;
|
|
||||||
MessageTime = time;
|
|
||||||
gameObject.SetActive(true);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
if (MessageTime > 0)
|
|
||||||
{
|
|
||||||
MessageTime -= Time.deltaTime;
|
|
||||||
|
|
||||||
if (MessageTime <= 0)
|
|
||||||
{
|
|
||||||
OnFinishedAction?.Invoke();
|
|
||||||
Destroy(gameObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnClick()
|
|
||||||
{
|
|
||||||
Destroy(this.gameObject);
|
|
||||||
OnFinishedAction?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
public class ProgressSlider : MonoBehaviour
|
|
||||||
{
|
|
||||||
public Slider SlUpdateProgress;
|
|
||||||
public Text TextUpdateProgress;
|
|
||||||
|
|
||||||
public void SetUpdateProgress(float value)
|
|
||||||
{
|
|
||||||
if (value == 0 || value >= 1) { SetActive(false); }
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetActive(true);
|
|
||||||
SlUpdateProgress.value = value;
|
|
||||||
TextUpdateProgress.text = $"{Mathf.Round(value * 10000) / 100}%";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetActive(bool active)
|
|
||||||
{
|
|
||||||
gameObject.SetActive(active);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,86 +0,0 @@
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
public class SettingsPanel : MonoBehaviour
|
|
||||||
{
|
|
||||||
public UpdateHandler Handler;
|
|
||||||
public Dropdown DdRepository;
|
|
||||||
public InputField InRepositoryUrl;
|
|
||||||
|
|
||||||
public Text TextUpdaterVersion;
|
|
||||||
public Text TextTranslatorVersion;
|
|
||||||
public Text TextTranslationVersion;
|
|
||||||
|
|
||||||
private bool _settingsChanged;
|
|
||||||
|
|
||||||
public SettingsPanel Init(string updaterVersion)
|
|
||||||
{
|
|
||||||
_settingsChanged = false;
|
|
||||||
TextUpdaterVersion.text = "Updater Version: " + updaterVersion;
|
|
||||||
TextTranslatorVersion.text = "KF3TL Version:\n" + PlayerPrefs.GetString(UpdateHandler.TRANSLATOR_VER, "undefined");
|
|
||||||
TextTranslationVersion.text = "Translation Version:\n" + PlayerPrefs.GetString(UpdateHandler.TRANSLATION_VER, "undefined");
|
|
||||||
|
|
||||||
int mode = PlayerPrefs.GetInt(UpdateHandler.REPO_CUSTOM_NAME, 0);
|
|
||||||
OnSourceDropdown(mode);
|
|
||||||
DdRepository.SetValueWithoutNotify(mode);
|
|
||||||
|
|
||||||
_settingsChanged = false;
|
|
||||||
gameObject.SetActive(true);
|
|
||||||
transform.SetAsLastSibling();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnSourceDropdown(int choice)
|
|
||||||
{
|
|
||||||
switch (choice)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
PlayerPrefs.SetInt(UpdateHandler.REPO_CUSTOM_NAME, 0);
|
|
||||||
InRepositoryUrl.text = UpdateHandler.REPO_DEFAULT;
|
|
||||||
InRepositoryUrl.interactable = false;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
PlayerPrefs.SetInt(UpdateHandler.REPO_CUSTOM_NAME, 1);
|
|
||||||
InRepositoryUrl.text = PlayerPrefs.GetString(UpdateHandler.REPO_CUSTOM_URL, UpdateHandler.REPO_DEFAULT);
|
|
||||||
InRepositoryUrl.interactable = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
PlayerPrefs.Save();
|
|
||||||
_settingsChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnSourceEditFinished(string text)
|
|
||||||
{
|
|
||||||
PlayerPrefs.SetString(UpdateHandler.REPO_CUSTOM_URL, text);
|
|
||||||
PlayerPrefs.Save();
|
|
||||||
_settingsChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnClearTranslatorButton()
|
|
||||||
{
|
|
||||||
PlayerPrefs.SetString(UpdateHandler.TRANSLATOR_VER, "undefined");
|
|
||||||
PlayerPrefs.Save();
|
|
||||||
TextTranslatorVersion.text = "KF3TL Version:\n" + PlayerPrefs.GetString(UpdateHandler.TRANSLATOR_VER, "undefined");
|
|
||||||
_settingsChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnClearTranslationButton()
|
|
||||||
{
|
|
||||||
PlayerPrefs.SetString(UpdateHandler.TRANSLATION_VER, "undefined");
|
|
||||||
PlayerPrefs.Save();
|
|
||||||
TextTranslationVersion.text = "Translation Version:\n" + PlayerPrefs.GetString(UpdateHandler.TRANSLATION_VER, "undefined");
|
|
||||||
_settingsChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnSettingsClose()
|
|
||||||
{
|
|
||||||
if (_settingsChanged)
|
|
||||||
{
|
|
||||||
Handler.StopAllCoroutines();
|
|
||||||
Destroy(Handler.gameObject);
|
|
||||||
UpdateHandler.Create();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
using System.Collections;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
public class UpdateAvailable : MonoBehaviour
|
|
||||||
{
|
|
||||||
public Text Header;
|
|
||||||
public Text CurrentVersion;
|
|
||||||
public Text NewVersion;
|
|
||||||
public System.Action OnDownloadAction;
|
|
||||||
public System.Action OnIgnoreAction;
|
|
||||||
public System.Action OnIgnorePersistentAction;
|
|
||||||
public Button IgnorePersistentButton;
|
|
||||||
|
|
||||||
public UpdateAvailable Init(string title, string currentVersion, string newVersion)
|
|
||||||
{
|
|
||||||
Header.text = title;
|
|
||||||
CurrentVersion.text = "Current: " + currentVersion;
|
|
||||||
NewVersion.text = "Update: " + newVersion;
|
|
||||||
gameObject.SetActive(true);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnDownload()
|
|
||||||
{
|
|
||||||
OnDownloadAction?.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnIgnore()
|
|
||||||
{
|
|
||||||
OnIgnoreAction?.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnIgnorePersistent()
|
|
||||||
{
|
|
||||||
OnIgnorePersistentAction?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class UpdateChecker : MonoBehaviour
|
|
||||||
{
|
|
||||||
public UpdateHandler Handler;
|
|
||||||
|
|
||||||
public void OpenSettings()
|
|
||||||
{
|
|
||||||
Handler.OpenSettingsDetached();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetActive(bool active)
|
|
||||||
{
|
|
||||||
gameObject.SetActive(active);
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
481
UpdateHandler.cs
481
UpdateHandler.cs
|
@ -1,48 +1,30 @@
|
||||||
using System;
|
using System.IO.Compression;
|
||||||
using System.Collections;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System;
|
||||||
using System.Reflection;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
using Newtonsoft.Json.Linq;
|
using UnityEngine.UI;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
public class UpdateHandler : MonoBehaviour
|
public class UpdateHandler : MonoBehaviour
|
||||||
{
|
{
|
||||||
/// <summary> Set by harmony/bepinex </summary>
|
private string _serverVersion = "";
|
||||||
public static string PluginVersion = "1.0.0";
|
private float _messageTime = 0;
|
||||||
|
private bool _readyForDeletion = false;
|
||||||
|
|
||||||
[Header("Message")]
|
private const string PluginVersion = "1.1.0";
|
||||||
public PopupMessage PanelMessage;
|
private const string defaultRepositoryUrl = "https://git.japari.cafe/api/v1/repos/Vorked/VorkedTranslationPack";
|
||||||
|
|
||||||
[Header("UpdateChecker")]
|
|
||||||
public UpdateChecker UpdateChecker;
|
|
||||||
|
|
||||||
[Header("UpdateProgress")]
|
|
||||||
public ProgressSlider UpdateProgress;
|
|
||||||
|
|
||||||
[Header("UpdateAvailable")]
|
|
||||||
public UpdateAvailable UpdatePanel;
|
|
||||||
|
|
||||||
[Header("Settings")]
|
|
||||||
public SettingsPanel PanelSettings;
|
|
||||||
|
|
||||||
public const string REPO_DEFAULT = "https://git.japari.cafe/api/v1/repos/Vorked/VorkedTranslationPack";
|
|
||||||
|
|
||||||
//playerprefs keys
|
//playerprefs keys
|
||||||
public const string TRANSLATION_VER = "translationVersion";
|
private const string translationVersionKey = "lastVersion";
|
||||||
public const string TRANSLATOR_VER = "KF3TLVersion";
|
private const string repositoryUrlKey = "customRepositoryUrl";
|
||||||
public const string REPO_CUSTOM_URL = "customRepositoryUrl";
|
private const string customRepositoryKey = "customRepository";
|
||||||
public const string REPO_CUSTOM_NAME = "customRepository";
|
|
||||||
|
|
||||||
private int _idleFrames = 0;
|
|
||||||
|
|
||||||
public static void Create()
|
public static void Create()
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
//var prefab = AssetBundle.LoadFromFile(Application.dataPath + "/AssetBundles/UpdateHandler");
|
var prefab = AssetBundle.LoadFromFile(@"R:\Unity\KF3Modder2\Assets\AssetBundles\UpdateHandler");
|
||||||
var prefab = Resources.Load("UpdateHandler");
|
|
||||||
Instantiate(prefab);
|
|
||||||
#else
|
#else
|
||||||
var prefab = AssetBundle.LoadFromMemory(LoadResource("UpdateHandler.asset"));
|
var prefab = AssetBundle.LoadFromMemory(LoadResource("UpdateHandler.asset"));
|
||||||
#endif
|
#endif
|
||||||
|
@ -72,204 +54,103 @@ public class UpdateHandler : MonoBehaviour
|
||||||
{
|
{
|
||||||
yield return 0;
|
yield return 0;
|
||||||
transform.SetAsLastSibling();
|
transform.SetAsLastSibling();
|
||||||
UpdateChecker.SetActive(true);
|
PanelUpdateChecker.SetActive(true);
|
||||||
|
|
||||||
yield return CheckKF3TLUpdate();
|
string repositoryUrl = PlayerPrefs.GetInt(customRepositoryKey, 0) == 0 ? defaultRepositoryUrl : PlayerPrefs.GetString(repositoryUrlKey, defaultRepositoryUrl);
|
||||||
yield return CheckTranslationUpdate();
|
string currentVersion = PlayerPrefs.GetString(translationVersionKey, "undefined");
|
||||||
|
string newVersion = currentVersion;
|
||||||
|
string downloadError = "";
|
||||||
|
bool updateSuccess = false;
|
||||||
|
|
||||||
yield return new WaitForSeconds(5);
|
yield return DownloadText(repositoryUrl,
|
||||||
UpdateChecker.SetActive(false);
|
(json) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(json))
|
||||||
|
{
|
||||||
|
throw new System.Exception("No response from " + repositoryUrl);
|
||||||
|
}
|
||||||
|
var newData = JsonUtility.FromJson<JsonSmall>(json);
|
||||||
|
newVersion = newData.updated_at;
|
||||||
|
updateSuccess = true;
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
downloadError = e.Message;
|
||||||
|
updateSuccess = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!updateSuccess)
|
||||||
|
{
|
||||||
|
PanelUpdateChecker.SetActive(false);
|
||||||
|
yield return SetAwaitableMessage("Failed to check for update!\nError: " + downloadError, 5);
|
||||||
|
OpenSettings();
|
||||||
|
_readyForDeletion = true;
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Log("local version: " + currentVersion);
|
||||||
|
Debug.Log("server version: " + newVersion);
|
||||||
|
|
||||||
|
if (newVersion != currentVersion)
|
||||||
|
{
|
||||||
|
OpenUpdateAvailable();
|
||||||
|
_serverVersion = newVersion;
|
||||||
|
PanelUpdateChecker.SetActive(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float time = 0;
|
||||||
|
while (time < 3 || PanelSettings.activeInHierarchy)
|
||||||
|
{
|
||||||
|
time += Time.deltaTime;
|
||||||
|
yield return 0;
|
||||||
|
}
|
||||||
|
Destroy(this.gameObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < transform.childCount; i++)
|
if (_messageTime > 0)
|
||||||
{
|
{
|
||||||
if (transform.GetChild(i).gameObject.activeSelf)
|
_messageTime -= Time.deltaTime;
|
||||||
|
|
||||||
|
if (_messageTime <= 0)
|
||||||
{
|
{
|
||||||
_idleFrames = 0;
|
PanelMessage.SetActive(false);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (_readyForDeletion && !PanelSettings.activeInHierarchy)
|
||||||
if (_idleFrames >= 5)
|
|
||||||
{
|
{
|
||||||
Destroy(this.gameObject);
|
Destroy(this.gameObject);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
_idleFrames++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator CheckKF3TLUpdate()
|
public IEnumerator UpdateTranslation()
|
||||||
{
|
{
|
||||||
Debug.Log("Checking KF3TL Update");
|
PanelUpdateProgress.SetActive(true);
|
||||||
|
SlUpdateProgress.value = 0;
|
||||||
|
|
||||||
string currentVersion = PlayerPrefs.GetString(TRANSLATOR_VER, "undefined");
|
|
||||||
var firstRun = currentVersion == "undefined";
|
|
||||||
BranchCheckResult result = null;
|
|
||||||
|
|
||||||
yield return GetRepoVersion("https://api.github.com/repos/Vorked/KF3TL/branches/main", data =>
|
|
||||||
{
|
|
||||||
result = data;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (result == null || !result.Success)
|
|
||||||
{
|
|
||||||
UpdateChecker.SetActive(false);
|
|
||||||
if (result == null)
|
|
||||||
{
|
|
||||||
yield return SetAwaitableMessage("Failed to get response from server", 5);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yield return SetAwaitableMessage("Failed to check for update!\nError: " + result.Error, 5);
|
|
||||||
}
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Log("local version: " + currentVersion);
|
|
||||||
Debug.Log("server version: " + result.Version);
|
|
||||||
|
|
||||||
if (firstRun)
|
|
||||||
{
|
|
||||||
yield return SetAwaitableMessage("First run detected. Press Ignore on next prompt if you have the newest version of KF3TL", 150);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.Version != currentVersion)
|
|
||||||
{
|
|
||||||
var panel = Instantiate(UpdatePanel, transform);
|
|
||||||
panel.Init("KF3TL Plugin Update", currentVersion, result.Version);
|
|
||||||
panel.OnDownloadAction = () =>
|
|
||||||
{
|
|
||||||
StartCoroutine(UpdateKF3TL(result.Version, () => Destroy(panel.gameObject)));
|
|
||||||
panel.gameObject.SetActive(false);
|
|
||||||
};
|
|
||||||
panel.OnIgnoreAction = () =>
|
|
||||||
{
|
|
||||||
Destroy(panel.gameObject);
|
|
||||||
};
|
|
||||||
if (firstRun)
|
|
||||||
{
|
|
||||||
panel.OnIgnorePersistentAction = () =>
|
|
||||||
{
|
|
||||||
PlayerPrefs.SetString(TRANSLATOR_VER, result.Version);
|
|
||||||
PlayerPrefs.Save();
|
|
||||||
Destroy(panel.gameObject);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
panel.IgnorePersistentButton.gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
while (panel != null) yield return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerator UpdateKF3TL(string version, System.Action onComplete)
|
|
||||||
{
|
|
||||||
byte[] bytes = null;
|
byte[] bytes = null;
|
||||||
yield return DownloadBytes("https://api.github.com/repos/Vorked/KF3TL/zipball/main",
|
string repositoryUrl = PlayerPrefs.GetInt(customRepositoryKey, 0) == 0 ? defaultRepositoryUrl : PlayerPrefs.GetString(repositoryUrlKey, defaultRepositoryUrl);
|
||||||
(newBytes) =>
|
|
||||||
{
|
|
||||||
bytes = newBytes;
|
|
||||||
},
|
|
||||||
UpdateProgress.SetUpdateProgress
|
|
||||||
);
|
|
||||||
|
|
||||||
UpdateProgress.SetUpdateProgress(1);
|
|
||||||
|
|
||||||
if (bytes.Length <= 0)
|
|
||||||
{
|
|
||||||
yield return SetAwaitableMessage("Failed to download the update!\nDownload new version from https://github.com/Vorked/KF3TL", 15);
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var path = Application.dataPath + "/../" + "KF3TL.zip";
|
|
||||||
File.WriteAllBytes(path, bytes);
|
|
||||||
|
|
||||||
PlayerPrefs.SetString(TRANSLATOR_VER, version);
|
|
||||||
PlayerPrefs.Save();
|
|
||||||
UpdateProgress.SetActive(false);
|
|
||||||
var message = Instantiate(PanelMessage, transform).Init($"New version downloaded as KF3TL.zip. Please close the game and install it.", 150);
|
|
||||||
message.OnFinishedAction = () =>
|
|
||||||
{
|
|
||||||
System.Diagnostics.Process.Start("explorer.exe", "/select," + path.Replace("/", "\\"));
|
|
||||||
onComplete?.Invoke();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerator CheckTranslationUpdate()
|
|
||||||
{
|
|
||||||
Debug.Log("Checking Translation Update");
|
|
||||||
|
|
||||||
string repositoryUrl = PlayerPrefs.GetInt(REPO_CUSTOM_NAME, 0) == 0 ? REPO_DEFAULT : PlayerPrefs.GetString(REPO_CUSTOM_URL, REPO_DEFAULT);
|
|
||||||
string currentVersion = PlayerPrefs.GetString(TRANSLATION_VER, "undefined");
|
|
||||||
BranchCheckResult result = null;
|
|
||||||
|
|
||||||
yield return GetRepoVersion(repositoryUrl + "/branches/master", data =>
|
|
||||||
{
|
|
||||||
result = data;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (result == null || !result.Success)
|
|
||||||
{
|
|
||||||
UpdateChecker.SetActive(false);
|
|
||||||
if (result == null)
|
|
||||||
{
|
|
||||||
yield return SetAwaitableMessage("Failed to get response from server", 5);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yield return SetAwaitableMessage("Failed to check for update!\nError: " + result.Error, 5);
|
|
||||||
}
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Log("local version: " + currentVersion);
|
|
||||||
Debug.Log("server version: " + result.Version);
|
|
||||||
|
|
||||||
if (result.Version != currentVersion)
|
|
||||||
{
|
|
||||||
var panel = Instantiate(UpdatePanel, transform);
|
|
||||||
panel.Init("Translation pack", currentVersion, result.Version);
|
|
||||||
panel.OnDownloadAction = () =>
|
|
||||||
{
|
|
||||||
StartCoroutine(UpdateTranslation(result.Version, () => Destroy(panel.gameObject)));
|
|
||||||
panel.gameObject.SetActive(false);
|
|
||||||
};
|
|
||||||
panel.OnIgnoreAction = () =>
|
|
||||||
{
|
|
||||||
Destroy(panel.gameObject);
|
|
||||||
};
|
|
||||||
panel.OnIgnorePersistentAction = () =>
|
|
||||||
{
|
|
||||||
PlayerPrefs.SetString(TRANSLATION_VER, result.Version);
|
|
||||||
PlayerPrefs.Save();
|
|
||||||
Destroy(panel.gameObject);
|
|
||||||
};
|
|
||||||
do yield return 0; while (panel != null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerator UpdateTranslation(string version, System.Action onComplete)
|
|
||||||
{
|
|
||||||
byte[] bytes = null;
|
|
||||||
string repositoryUrl = PlayerPrefs.GetInt(REPO_CUSTOM_NAME, 0) == 0 ? REPO_DEFAULT : PlayerPrefs.GetString(REPO_CUSTOM_URL, REPO_DEFAULT);
|
|
||||||
yield return DownloadBytes(repositoryUrl + "/archive/master.zip",
|
yield return DownloadBytes(repositoryUrl + "/archive/master.zip",
|
||||||
(newBytes) =>
|
(newBytes) =>
|
||||||
{
|
{
|
||||||
bytes = newBytes;
|
bytes = newBytes;
|
||||||
},
|
},
|
||||||
UpdateProgress.SetUpdateProgress
|
SetUpdateProgress
|
||||||
);
|
);
|
||||||
|
|
||||||
UpdateProgress.SetUpdateProgress(1);
|
|
||||||
|
|
||||||
if (bytes.Length <= 0)
|
if (bytes.Length <= 0)
|
||||||
{
|
{
|
||||||
|
PanelUpdateProgress.SetActive(false);
|
||||||
yield return SetAwaitableMessage("Failed to download the update!\nCheck your settings.", 5);
|
yield return SetAwaitableMessage("Failed to download the update!\nCheck your settings.", 5);
|
||||||
|
OpenSettings();
|
||||||
|
_readyForDeletion = true;
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,61 +175,148 @@ public class UpdateHandler : MonoBehaviour
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
{
|
{
|
||||||
Instantiate(PanelMessage, transform).Init("Failed to install the update!\nError:" + e.Message, 5);
|
SetMessage("Failed to install the update!\nError:" + e.Message, 5);
|
||||||
|
_readyForDeletion = true;
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerPrefs.SetString(TRANSLATION_VER, version);
|
PlayerPrefs.SetString(translationVersionKey, _serverVersion);
|
||||||
PlayerPrefs.Save();
|
PlayerPrefs.Save();
|
||||||
UpdateProgress.SetActive(false);
|
PanelUpdateProgress.SetActive(false);
|
||||||
var message = Instantiate(PanelMessage, transform).Init("Update completed! Please restart the game to apply it.", 5);
|
SetMessage("Update completed! Please restart the game to apply it.", 5);
|
||||||
message.OnFinishedAction = onComplete;
|
_readyForDeletion = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator GetRepoVersion(string url, System.Action<BranchCheckResult> callback)
|
#region Message
|
||||||
|
[Header("Message")]
|
||||||
|
public GameObject PanelMessage;
|
||||||
|
public Text TextMessage;
|
||||||
|
|
||||||
|
private void SetMessage(string message, float time = 2)
|
||||||
{
|
{
|
||||||
BranchCheckResult result = null;
|
PanelMessage.SetActive(true);
|
||||||
yield return DownloadText(url,
|
TextMessage.text = message;
|
||||||
(json) =>
|
_messageTime = time;
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(json))
|
|
||||||
{
|
|
||||||
throw new System.Exception("No response from " + url);
|
|
||||||
}
|
|
||||||
result = new BranchCheckResult();
|
|
||||||
var newData = JObject.Parse(json).ToObject<BranchInfo>();
|
|
||||||
result.Version = newData.commit.timestamp /* gitea */ ?? newData.commit.commit.author.date; //github
|
|
||||||
result.Success = true;
|
|
||||||
}
|
|
||||||
catch (System.Exception e)
|
|
||||||
{
|
|
||||||
result.Error = e.Message;
|
|
||||||
result.Success = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
callback(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator SetAwaitableMessage(string message, float time)
|
private IEnumerator SetAwaitableMessage(string message, float time)
|
||||||
{
|
{
|
||||||
var msg = Instantiate(PanelMessage, transform).Init(message, time);
|
SetMessage(message, time);
|
||||||
do yield return 0; while (msg != null);
|
do
|
||||||
|
{
|
||||||
|
yield return 0;
|
||||||
|
}
|
||||||
|
while (PanelMessage.activeInHierarchy);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region UpdateChecker
|
||||||
|
[Header("UpdateChecker")]
|
||||||
|
public GameObject PanelUpdateChecker;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region UpdateProgress
|
||||||
|
[Header("UpdateProgress")]
|
||||||
|
public GameObject PanelUpdateProgress;
|
||||||
|
public Slider SlUpdateProgress;
|
||||||
|
public Text TextUpdateProgress;
|
||||||
|
|
||||||
|
public void SetUpdateProgress(float value)
|
||||||
|
{
|
||||||
|
SlUpdateProgress.value = value;
|
||||||
|
TextUpdateProgress.text = $"{Mathf.Round(value * 10000) / 100}%";
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region UpdateAvailable
|
||||||
|
[Header("UpdateAvailable")]
|
||||||
|
public GameObject PanelUpdateAvailable;
|
||||||
|
|
||||||
|
public void OpenUpdateAvailable()
|
||||||
|
{
|
||||||
|
PanelUpdateAvailable.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenSettingsDetached()
|
public void OnIgnore()
|
||||||
{
|
{
|
||||||
if (PanelSettings.gameObject.activeSelf) return;
|
Destroy(this.gameObject);
|
||||||
StartCoroutine(OpenSettings());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator OpenSettings()
|
public void OnDownload()
|
||||||
{
|
{
|
||||||
PanelSettings.Init(PluginVersion);
|
PanelUpdateAvailable.SetActive(false);
|
||||||
do yield return 0; while (PanelSettings.gameObject.activeSelf);
|
StartCoroutine(UpdateTranslation());
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Settings
|
||||||
|
private bool _settingsChanged = false;
|
||||||
|
[Header("Settings")]
|
||||||
|
public GameObject PanelSettings;
|
||||||
|
public Dropdown DdRepository;
|
||||||
|
public InputField InRepositoryUrl;
|
||||||
|
public Text TextUpdaterVersion;
|
||||||
|
public Text TextTranslationVersion;
|
||||||
|
|
||||||
|
public void OpenSettings()
|
||||||
|
{
|
||||||
|
PanelSettings.gameObject.SetActive(true);
|
||||||
|
int mode = PlayerPrefs.GetInt(customRepositoryKey, 0);
|
||||||
|
OnSourceDropdown(mode);
|
||||||
|
DdRepository.SetValueWithoutNotify(mode);
|
||||||
|
TextUpdaterVersion.text = "Updater Version: " + PluginVersion;
|
||||||
|
TextTranslationVersion.text = "Translation Version: " + PlayerPrefs.GetString(translationVersionKey, "undefined");
|
||||||
|
_settingsChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnSourceDropdown(int choice)
|
||||||
|
{
|
||||||
|
switch (choice)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
PlayerPrefs.SetInt(customRepositoryKey, 0);
|
||||||
|
InRepositoryUrl.text = defaultRepositoryUrl;
|
||||||
|
InRepositoryUrl.interactable = false;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
PlayerPrefs.SetInt(customRepositoryKey, 1);
|
||||||
|
InRepositoryUrl.text = PlayerPrefs.GetString(repositoryUrlKey, defaultRepositoryUrl);
|
||||||
|
InRepositoryUrl.interactable = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
PlayerPrefs.Save();
|
||||||
|
_settingsChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnSourceEditFinished(string text)
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetString(repositoryUrlKey, text);
|
||||||
|
PlayerPrefs.Save();
|
||||||
|
_settingsChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnClearButton()
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetString(translationVersionKey, "undefined");
|
||||||
|
PlayerPrefs.Save();
|
||||||
|
OpenSettings();
|
||||||
|
_settingsChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnSettingsClose()
|
||||||
|
{
|
||||||
|
if (_settingsChanged)
|
||||||
|
{
|
||||||
|
Destroy(this.gameObject);
|
||||||
|
Create();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PanelSettings.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
public static IEnumerator DownloadBytes(string url, System.Action<byte[]> callback, System.Action<float> onProgressChanged = null)
|
public static IEnumerator DownloadBytes(string url, System.Action<byte[]> callback, System.Action<float> onProgressChanged = null)
|
||||||
{
|
{
|
||||||
|
@ -391,37 +359,8 @@ public class UpdateHandler : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Serializable]
|
public class JsonSmall
|
||||||
public class BranchInfo
|
|
||||||
{
|
{
|
||||||
public CommitInfo commit;
|
public string updated_at;
|
||||||
|
|
||||||
[System.Serializable]
|
|
||||||
public class CommitInfo
|
|
||||||
{
|
|
||||||
public string id;
|
|
||||||
public string sha;
|
|
||||||
public string timestamp;
|
|
||||||
public CommitInfo2 commit;
|
|
||||||
|
|
||||||
[System.Serializable]
|
|
||||||
public class CommitInfo2
|
|
||||||
{
|
|
||||||
public AuthorInfo author;
|
|
||||||
|
|
||||||
[System.Serializable]
|
|
||||||
public class AuthorInfo
|
|
||||||
{
|
|
||||||
public string date;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BranchCheckResult
|
|
||||||
{
|
|
||||||
public bool Success;
|
|
||||||
public string Version;
|
|
||||||
public string Error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue