HeavenStudioPlus/Assets/Scripts/AppInfo.cs
wookywok b42d5d6b7f Airboarder initial PR (#765)
* started working on bon odori

* bon odori is now playable, just no animations and sounds

* bon odori is functional now, just missing the art, better audio and animations

* nothing new, my git is always 1 commit behind

* Revert "nothing new, my git is always 1 commit behind"

This reverts commit b96a70004de5964902f7bc87d819a9e6047e77fb.

* changed the background

im only commiting because saladplainzone is gonna do the anims now

* Accurate BG

* Good prefab

* finalized player prefab

* Finalize Prefab

* More animation stuff

* Bow anim done

* text is now functional, passing the project to AstrlJelly

* merging w master branch

* text scrolling is ALMOST functional

* scrolling is ALMOST ALMOST functional

* FINALLY!!!! TEXT SCOLLING IS DONE!!!!!

* TEXT SCROLLING IS (almost) PERFECT!!!! now we gotta wait for the animations

* minor bug fixes

* TEXT SCROLLING IS ACTUALLY PERFECT NOW. also updated the font

* i forgor to change the outline on the fonts

* Setup

* more working on stuff

* more testing

* more testing

* more testing

* some fixes

* fixes

* testing stuff

* fixed some things

* a few more fixes

* more testing

* More fixes

* bops and animation adjustments

* camera stuff!

* Implementing placeholder icon

* recolorable sky

* fix that bug + format arch file

also change the script name

* oops

---------

Co-authored-by: streitixy <danilomeiraivo@gmail.com>
Co-authored-by: saladplainzone <chocolate2890mail@gmail.com>
Co-authored-by: streitixy <85808002+streitixy@users.noreply.github.com>
Co-authored-by: AstrlJelly <bdlawson115@gmail.com>
Co-authored-by: minenice55 <star.elementa@gmail.com>
2024-03-10 01:47:14 +00:00

88 lines
No EOL
3.3 KiB
C#

using System;
public static class AppInfo {
public const string Version = "1.0.7";
public static readonly DateTime Date = new DateTime(2024, 03, 04, 16, 30, 24, 733, DateTimeKind.Utc);
}
#if UNITY_EDITOR
/// <summary>
/// Increase Build Number Automatically
/// </summary>
public class BuildNumberUpdater : UnityEditor.Build.IPreprocessBuild
{
private static readonly char[] LineDelimiter = {'\n', '\r'};
/// <summary> File name where info is stored </summary>
private const string AppInfoFileName = "AppInfo.cs";
public int callbackOrder {
get { return 1; }
}
void UnityEditor.Build.IPreprocessBuild.OnPreprocessBuild(UnityEditor.BuildTarget target, string path) {
var scriptPath = GetScriptPath(AppInfoFileName);
var version = IncVersion();
var time = DateTime.UtcNow;
string date = "new DateTime(" + time.ToString("yyyy, MM, dd, HH, mm, ss, fff") + ", DateTimeKind.Utc)";
UnityEngine.Debug.LogFormat(
"OnPreprocessBuild. Modify AppInfo in file={0}, set version={1} and current DateTime",
scriptPath, version);
var text = System.IO.File.ReadAllText(scriptPath);
text = ReplaceText(text, " Version = ", "\"" + version + "\";");
text = ReplaceText(text, " Date = ", date + ";");
System.IO.File.WriteAllText(scriptPath, text);
}
private static string ReplaceText(string text, string field, string newValue) {
int v1 = text.IndexOf(field, StringComparison.Ordinal);
int v2 = text.IndexOfAny(LineDelimiter, v1);
if (v1 < 0 || v2 < 0)
throw new Exception("Undefined field=" + field);
return text.Substring(0, v1 + field.Length) + newValue + text.Substring(v2);
}
private static string IncVersion() {
var bundleVersionSplit = UnityEditor.PlayerSettings.bundleVersion.Split('.');
int major = 0;
int minor = 0;
int subVersion = 0;
if (bundleVersionSplit.Length >= 1)
int.TryParse(bundleVersionSplit[0], out major);
if (bundleVersionSplit.Length >= 2)
int.TryParse(bundleVersionSplit[1], out minor);
if (bundleVersionSplit.Length >= 3)
int.TryParse(bundleVersionSplit[2], out subVersion);
#if !HEAVENSTUDIO_PROD
++subVersion;
#endif
string version = string.Format("{0}.{1}.{2}", major, minor, subVersion);
var bundleVersionCode = (major * 100000) + (minor * 1000) + subVersion;
UnityEditor.PlayerSettings.bundleVersion = version;
UnityEditor.PlayerSettings.Android.bundleVersionCode = bundleVersionCode;
UnityEditor.PlayerSettings.macOS.buildNumber = bundleVersionCode.ToString();
return version;
}
private static string GetScriptPath(string fileName) {
var assets = UnityEditor.AssetDatabase.FindAssets(System.IO.Path.GetFileNameWithoutExtension(fileName));
string scriptPath = null;
foreach (var asset in assets) {
var path = UnityEditor.AssetDatabase.GUIDToAssetPath(asset);
if (path.EndsWith(".cs")) {
scriptPath = path;
break;
}
}
if (string.IsNullOrEmpty(scriptPath))
throw new Exception("No asset file with name '" + AppInfoFileName + "' found");
return scriptPath;
}
}
#endif