HeavenStudio/Assets/Scripts/OpeningManager.cs
minenice55 3002e48350
Alternate Control Styles Support (#554)
* add mouse controller

* support different control styles in options

deprecate old input check methods

* fully functional input actions system

* btsds InputAction

* blue bear InputAction

* more games

fix bugs with some input related systems

* coin toss re-toss

* cheer readers touch

* dog ninja touch

* multiple games

* last of the easy games' touch

* more specialized games

* specialized games 2

* finish ktb games

* remove legacy settings disclaimer

* "only" two games left

* karate man touch

* rockers touch

still needs fixes and bad judge strum

* DSGuy flicking animation

* playstyle chart property

* improve performance of minigame preloading

* improve look of cursor

make assetbundles use chunk-based compression
refactor assetbundle loading methods a bit

* prime conductor stream playback to stabilize seeking operations

* fix air rally swing on pad release

* use virtual mouse pointer

* add UniTask

* make BeatAction use UniTask

* implement UniTask to replace some coroutines

* add touch style UI elements and effects

games now support the ability to define two cursor colours if they need split screen touch inputs

* update plugins and buildscript

* implement thresholded pointer position clipping

* fix clamping

* instant show / hide

fix discord game SDK crashes
2023-10-29 19:44:47 +00:00

103 lines
3.6 KiB
C#

using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using HeavenStudio.Common;
namespace HeavenStudio
{
public class OpeningManager : MonoBehaviour
{
[SerializeField] Animator openingAnim;
[SerializeField] TMP_Text buildText;
[SerializeField] TMP_Text versionDisclaimer;
[SerializeField] bool enableSecondDisclaimer;
public static string OnOpenFile;
bool fastBoot = false;
void Start()
{
string[] args = System.Environment.GetCommandLineArgs();
for (int i = 1; i < args.Length; i++)
{
// first arg is always this executable
Debug.Log(args[i]);
if (args[i].IndexOfAny(Path.GetInvalidPathChars()) == -1)
{
if (File.Exists(args[i]) && (args[i].EndsWith(".riq") || args[i].EndsWith(".tengoku")))
{
OnOpenFile = args[i];
}
}
if (args[i] == "--nosplash")
{
fastBoot = true;
}
}
#if UNITY_EDITOR
buildText.text = "EDITOR";
#else
buildText.text = Application.buildGUID.Substring(0, 8) + " " + AppInfo.Date.ToString("dd/MM/yyyy hh:mm:ss");
#endif
if ((Application.platform is RuntimePlatform.OSXPlayer or RuntimePlatform.OSXEditor) || !enableSecondDisclaimer)
{
versionDisclaimer.text = "";
}
else
{
string ver = "<color=#FFFFCC>If you're coming from an older Heaven Studio build, copy your settings configs over from\n<color=#FFFF00>";
if (Application.platform is RuntimePlatform.WindowsPlayer or RuntimePlatform.WindowsEditor)
{
ver += Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\AppData\\LocalLow\\Megaminerzero\\Heaven Studio\\";
ver += "<color=#FFFFCC>\nto\n<color=#FFFF00>";
ver += Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\AppData\\LocalLow\\RHeavenStudio\\Heaven Studio\\";
}
else if (Application.platform is RuntimePlatform.LinuxPlayer or RuntimePlatform.LinuxEditor)
{
ver += "~/.config/unity3d/Megaminerzero/Heaven Studio/";
ver += "<color=#FFFFCC>\nto\n<color=#FFFF00>";
ver += "~/.config/unity3d/RHeavenStudio/Heaven Studio/";
}
versionDisclaimer.text = ver;
}
if (!GlobalGameManager.IsFirstBoot && !PersistentDataManager.gameSettings.showSplash)
{
fastBoot = true;
}
if (fastBoot)
{
OnFinishDisclaimer(0.1f);
}
else
{
openingAnim.Play("FirstOpening", -1, 0);
StartCoroutine(WaitAndFinishOpening());
}
}
IEnumerator WaitAndFinishOpening()
{
yield return new WaitForSeconds(8f);
OnFinishDisclaimer(0.35f);
}
void OnFinishDisclaimer(float fadeDuration = 0)
{
if (OnOpenFile is not null or "")
{
GlobalGameManager.LoadScene("Game", fadeDuration, 0.5f);
}
else
{
GlobalGameManager.LoadScene("Editor", fadeDuration, fadeDuration);
}
}
}
}