feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)

Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
This commit is contained in:
gamer147
2026-06-05 17:22:20 -04:00
parent 0d9d8acae0
commit 957af3d1ec
1795 changed files with 166536 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
using System.Collections.Generic;
using UnityEngine;
namespace Cute;
public class AssetBundleObject
{
public AssetBundle assetBundle { get; set; }
public List<AssetObject> objectArray { get; set; }
public AssetBundleObject()
{
assetBundle = null;
objectArray = new List<AssetObject>();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,16 @@
using UnityEngine;
namespace Cute;
public class AssetObject
{
public string basePath { get; private set; }
public Object baseObject { get; private set; }
public AssetObject(string path, Object obj)
{
basePath = path;
baseObject = obj;
}
}

View File

@@ -0,0 +1,182 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Cute;
public class AsyncJob
{
private class Unit
{
public object action;
public Action cancelAction;
public Unit(object action, Action cancelAction)
{
this.action = action;
this.cancelAction = cancelAction;
}
}
private int num;
private MonoBehaviour mono;
private List<Unit> jobList = new List<Unit>();
private bool isCancel;
private int? _waitFramesBetweenJobs;
private int _waitFramesBetweenJobsMin;
private FramerateProfiler _framerateProfiler = new FramerateProfiler();
public int WAIT_FRAMES_INCREMENT = 5;
public int WAIT_FRAMES_DECREMENT = 1;
public bool IsIdle
{
get
{
if (!isCancel)
{
return jobList.Count == 0;
}
return false;
}
}
public int? WantedWaitFramesBetweenJobs
{
set
{
_waitFramesBetweenJobs = value;
_waitFramesBetweenJobsMin = value.GetValueOrDefault();
}
}
public AsyncJob(MonoBehaviour mono, int num)
{
this.mono = mono;
this.num = num;
}
public void Add(IEnumerator enumerator)
{
jobList.Add(new Unit(enumerator, null));
}
public void Add(IEnumerator enumerator, Action calcelAction)
{
jobList.Add(new Unit(enumerator, calcelAction));
}
public void Add(Action action)
{
jobList.Add(new Unit(action, null));
}
public void Add(Action action, Action calcelAction)
{
jobList.Add(new Unit(action, calcelAction));
}
public void Cancel()
{
if (!isCancel && jobList.Count != 0)
{
isCancel = true;
Add(CancelTerminator, CancelTerminator);
}
}
public void CancelTerminator()
{
isCancel = false;
}
public void Start()
{
for (int i = 0; i < num; i++)
{
mono.StartCoroutine(MicroThread());
}
_framerateProfiler = new FramerateProfiler();
mono.StartCoroutine(RunFpsProfiler());
}
private IEnumerator RunFpsProfiler()
{
_framerateProfiler.Init();
while (true)
{
_framerateProfiler.Update();
yield return null;
}
}
private IEnumerator MicroThread()
{
while (true)
{
if (jobList.Count <= 0)
{
yield return null;
continue;
}
Unit unit = jobList[0];
jobList.RemoveAt(0);
if (isCancel)
{
if (unit.cancelAction != null)
{
unit.cancelAction();
}
}
else if (unit.action is IEnumerator)
{
yield return mono.StartCoroutine((IEnumerator)unit.action);
if (!_waitFramesBetweenJobs.HasValue)
{
continue;
}
float? fps = _framerateProfiler.Fps;
if (fps.HasValue)
{
if (fps < 20f)
{
_waitFramesBetweenJobs += WAIT_FRAMES_INCREMENT;
_framerateProfiler.Init();
}
else if (fps > 30f)
{
_waitFramesBetweenJobs -= WAIT_FRAMES_INCREMENT;
if (_waitFramesBetweenJobs.Value < _waitFramesBetweenJobsMin)
{
_waitFramesBetweenJobs = _waitFramesBetweenJobsMin;
}
_framerateProfiler.Init();
}
}
yield return WaitFrames(_waitFramesBetweenJobs.Value);
}
else if (unit.action is Action)
{
((Action)unit.action)();
}
}
}
private static IEnumerator WaitFrames(int frameCount)
{
while (frameCount > 0)
{
frameCount--;
yield return null;
}
}
}

View File

@@ -0,0 +1,808 @@
using System;
using System.Collections;
using System.Collections.Generic;
using CriWare;
using UnityEngine;
namespace Cute;
public class AudioManager : MonoBehaviour, IManager
{
[SerializeField]
private GameObject _bgmParent;
[SerializeField]
private CriAtomSource[] _bgm;
private int _bgmSourceCount;
[SerializeField]
private GameObject _seParent;
[SerializeField]
private CriAtomSource[] _se;
private int _seSourceCount;
private SoundData[] _playingSe;
[SerializeField]
private GameObject _voiceParent;
[SerializeField]
private CriAtomSource[] _voice;
private int _voiceSourceCount;
private bool _bgmPlaySuspend;
private const int BGM_FADEOUT_TIME = 500;
private const int SONG_PREVIEW_FADE_TIME = 500;
private const int SONG_PREVIEW_FADE_SPACE_TIME = 1500;
private const float SE_FADE_TIME = 0.5f;
public const int DELAY_TIME_OFFSET = -4;
private const float VOULMN_BOOST_FACTOR = 1.5f;
public const string ACB_EXTENSION_WITHPARAM = "{0}.acb";
public const string ACB_EXTENSION = ".acb";
public const string AWB_EXTENSION_WITHPARAM = "{0}.awb";
public const string AWB_EXTENSION = ".awb";
private const string STR_SUBFOLDER_BGM = "b/";
public const string STR_SUBFOLDER_SE = "s/";
private const string STR_SUBFOLDER_SONG = "l/";
private const string STR_SUBFOLDER_VOICE = "v/";
private const string STR_SUBFOLDER_STORY = "c/";
private const string STR_SUBFOLDER_ROOM = "r/";
public bool isDownloadVoiceUse = true;
protected bool _isRedy;
private bool _noSeMode;
private CriAtomExPlayback _playback;
private CriAtomExPlayback _bgmPlayback;
private float _sampleTime;
private int _delayTime;
private int _criDelayTime;
private int _criInitializeCount;
private const int CRI_RETRY_COUNT = 3;
private Dictionary<string, CriAtomExAcb> _acbDictionary = new Dictionary<string, CriAtomExAcb>();
private string[] STR_PREINSTALL_FILENAME = new string[1] { "preinstall" };
public const float VOICE_MASTER_VOLUME = 0.8f;
private Action _callbackVoiseEnd;
private string _bgmName = "";
private int _cueId = -1;
private string _bgmCue = "";
public bool isRedy => _isRedy;
public int delayTime
{
get
{
return _delayTime;
}
set
{
_delayTime = value;
}
}
public string bgmName
{
get
{
return _bgmName;
}
set
{
_bgmName = value;
}
}
public int cueId
{
get
{
return _cueId;
}
set
{
_cueId = value;
}
}
public string bgmCue
{
get
{
return _bgmCue;
}
set
{
_bgmCue = value;
}
}
private void Awake()
{
}
private IEnumerator Start()
{
_bgm = _bgmParent.GetComponentsInChildren<CriAtomSource>();
_bgmSourceCount = _bgm.Length;
for (int i = 0; i < _bgmSourceCount; i++)
{
CriAtomExPlayer player = _bgm[i].player;
player.AttachFader();
player.ResetFaderParameters();
player.SetFadeOutTime(500);
}
_se = _seParent.GetComponentsInChildren<CriAtomSource>();
_seSourceCount = _se.Length;
_playingSe = new SoundData[_seSourceCount];
for (int j = 0; j < _seSourceCount; j++)
{
CriAtomExPlayer player2 = _se[j].player;
player2.AttachFader();
player2.ResetFaderParameters();
}
_voice = _voiceParent.GetComponentsInChildren<CriAtomSource>();
_voiceSourceCount = _voice.Length;
for (int k = 0; k < _voiceSourceCount; k++)
{
CriAtomExPlayer player3 = _voice[k].player;
player3.AttachFader();
player3.ResetFaderParameters();
}
Toolbox.AudioManager = this;
yield break;
}
public void ResetSoundMode()
{
_noSeMode = false;
}
private void Update()
{
}
public void PauseAllBgm(bool pauseStatus)
{
if (pauseStatus)
{
_bgmPlaySuspend = false;
for (int i = 0; i < _bgmSourceCount; i++)
{
if (_bgm[i].status == CriAtomSource.Status.Prep || _bgm[i].status == CriAtomSource.Status.Playing)
{
_bgm[i].Pause(sw: true);
_bgmPlaySuspend = true;
}
}
}
else if (_bgmPlaySuspend)
{
for (int j = 0; j < _bgmSourceCount; j++)
{
_bgm[j].Pause(sw: false);
}
}
}
public long GetMusicLength(string acbName)
{
CriAtomExAcb acb = CriAtom.GetAcb(acbName);
if (acb != null && acb.GetCueInfo(0, out var info))
{
return info.length;
}
return -1L;
}
public bool IsAvailableCueSheet(string cueName)
{
CriAtomCueSheet cueSheet = CriAtom.GetCueSheet(cueName);
if (cueSheet != null)
{
return cueSheet.acb != null;
}
return false;
}
public bool AddCueSheet(string _name, string acbFile, string subFolderPath, string awbname = "")
{
_name = _name.Replace(".acb", "");
if (CriAtom.GetCueSheet(_name) != null || CriAtom.GetCueSheet(acbFile) != null)
{
return true;
}
bool flag = false;
int num = STR_PREINSTALL_FILENAME.Length;
for (int i = 0; i < num; i++)
{
if (string.Compare(_name, STR_PREINSTALL_FILENAME[i]) == 0)
{
flag = true;
break;
}
}
if (flag)
{
acbFile = $"{subFolderPath}{acbFile}";
awbname = $"{subFolderPath}{awbname}";
}
else
{
acbFile = string.Format("{0}{1}{2}{3}", Application.persistentDataPath, "/", subFolderPath, acbFile);
awbname = string.Format("{0}{1}{2}{3}", Application.persistentDataPath, "/", subFolderPath, awbname);
}
CriAtomCueSheet criAtomCueSheet = CriAtom.AddCueSheet(_name, acbFile, awbname);
if (criAtomCueSheet == null)
{
return false;
}
if (criAtomCueSheet.acb == null)
{
RemoveCueSheet(_name);
return false;
}
return true;
}
public bool AddCueSheetFromFileName(string _name, string acbFile, string awbname)
{
_name = _name.Replace(".acb", "");
int num = STR_PREINSTALL_FILENAME.Length;
for (int i = 0; i < num && string.Compare(_name, STR_PREINSTALL_FILENAME[i]) != 0; i++)
{
}
if (CriAtom.GetCueSheet(_name) != null)
{
return true;
}
CriAtomCueSheet criAtomCueSheet = CriAtom.AddCueSheet(_name, acbFile, awbname);
if (criAtomCueSheet == null)
{
return false;
}
if (criAtomCueSheet.acb == null)
{
RemoveCueSheet(_name);
return false;
}
return true;
}
public void RemoveCueSheet(string name)
{
name = name.Replace(".awb", "");
name = name.Replace(".acb", "");
name = name.Replace("s/", "");
name = name.Replace("b/", "");
CriAtom.RemoveCueSheet(name);
}
public void RemoveCueSheet(List<string> nameList)
{
for (int i = 0; i < nameList.Count; i++)
{
RemoveCueSheet(nameList[i]);
}
}
public float GetSampleTime()
{
long numSamples = 0L;
int samplingRate = 0;
if (_playback.GetNumPlayedSamples(out numSamples, out samplingRate))
{
_sampleTime = (float)numSamples / (float)samplingRate;
}
return _sampleTime;
}
private void OnDestroy()
{
foreach (KeyValuePair<string, CriAtomExAcb> item in _acbDictionary)
{
item.Value.Dispose();
}
}
public int GetDelayTimeFromCRI()
{
int result = 0;
if (_criInitializeCount >= 3)
{
return result;
}
return _criDelayTime / 10;
}
public CriAtomSource GetBgmSource(int bgmId)
{
return _bgm[bgmId];
}
public int GetBgmMaxCount()
{
return _bgmSourceCount;
}
public void VolumeUpdate_Bgm(int level, bool mute, int bgmId = -1)
{
if (bgmId < 0)
{
int num = _bgm.Length;
for (int i = 0; i < num; i++)
{
Volume_Bgm((float)level * 0.1f, mute, i);
}
}
else
{
Volume_Bgm((float)level * 0.1f, mute, bgmId);
}
}
public void Volume_Bgm(float level, bool mute, int bgmId = -1)
{
if (mute)
{
level = 0f;
}
if (bgmId < 0)
{
int num = _bgm.Length;
for (int i = 0; i < num; i++)
{
_bgm[i].volume = level;
_bgm[i].player.Update(_bgmPlayback);
}
}
else
{
_bgm[bgmId].volume = level;
_bgm[bgmId].player.Update(_bgmPlayback);
}
}
public bool IsPlayBgm(int bgmId = 0)
{
if (_bgm[bgmId].status == CriAtomSource.Status.Prep || _bgm[bgmId].status == CriAtomSource.Status.Playing)
{
return true;
}
return false;
}
public int PlayBgmFromName(string cueSheet, string cueName, string acbName, string awbName = "", int bgmId = 0, bool loop = true, float FadeInfime = 0f, float OffsetTime = 0f, long startTime = 0L)
{
if (_bgmName == cueName)
{
return -1;
}
string acbFile = "";
string awbname = "";
if (acbName.CompareTo("") != 0)
{
acbFile = acbName + ".acb";
}
if (awbName.CompareTo("") != 0)
{
awbname = awbName + ".awb";
}
if (AddCueSheet(cueSheet, acbFile, "b/", awbname))
{
StopBgm(bgmId);
_bgm[bgmId].cueSheet = cueSheet;
_bgm[bgmId].cueName = cueName;
_bgm[bgmId].player.ResetFaderParameters();
_bgm[bgmId].player.SetStartTime(startTime);
_bgm[bgmId].player.SetFadeInTime((int)(FadeInfime * 1000f));
_bgm[bgmId].player.SetFadeInStartOffset((int)(OffsetTime * 1000f));
_bgm[bgmId].loop = loop;
_bgmPlayback = _bgm[bgmId].Play();
_bgmName = cueName;
return 0;
}
return -1;
}
public int PlayBgmFromId(string cueSheet, int cueId, int bgmId = 0, bool loop = true, float FadeInfime = 0f, float OffsetTime = 0f, long startTime = 0L)
{
if (_bgmCue == cueSheet && cueId == _cueId)
{
return -1;
}
if (CriAtom.GetCueSheet(cueSheet) != null)
{
StopBgm(bgmId);
_bgm[bgmId].cueSheet = cueSheet;
_bgm[bgmId].player.ResetFaderParameters();
_bgm[bgmId].player.SetStartTime(startTime);
_bgm[bgmId].player.SetFadeInTime((int)(FadeInfime * 1000f));
_bgm[bgmId].player.SetFadeInStartOffset((int)(OffsetTime * 1000f));
_bgm[bgmId].loop = loop;
_bgmPlayback = _bgm[bgmId].Play(cueId);
_cueId = cueId;
_bgmCue = "";
return 1;
}
return 0;
}
public void StopBgm(int bgmId = 0)
{
_bgmName = "";
_bgm[bgmId].Stop();
}
public void PauseBgm(bool isPause, int bgmId = 0)
{
_bgm[bgmId].Pause(isPause);
}
public void StopFadeBgm(int bgmId = 0, float time = 0.5f)
{
_bgm[bgmId].player.SetFadeOutTime((int)(time * 1000f));
StopBgm(bgmId);
}
public void SetBgmVolume(float volume)
{
GameMgr.GetIns().GetSoundMgr().SetBgmVolume(volume);
}
public void StartCoroutine_DelayMethod(float waitTime, Action process)
{
StartCoroutine(Timer.DelayMethod(waitTime, process));
}
public void VolumeUpdate_Se(int level, bool mute)
{
Volume_Se((float)level * 0.1f, mute);
}
public void Volume_Se(float level, bool mute)
{
if (mute)
{
level = 0f;
}
for (int i = 0; i < _seSourceCount; i++)
{
_se[i].volume = level;
}
}
public int PlaySeFromId(ref SoundData seData, bool loop = false)
{
int index = -1;
CriAtomSource criAtomSource = FindSe(ref seData, out index);
if (criAtomSource != null)
{
criAtomSource.cueSheet = seData._acbName;
criAtomSource.loop = loop;
CriAtomExPlayer player = criAtomSource.player;
player.ResetFaderParameters();
player.SetFadeOutTime(0);
criAtomSource.Play(seData._cueName);
return index;
}
return index;
}
public int PlaySeFromId(string cueName, int cueId, bool loop = false)
{
if (!IsAvailableCueSheet(cueName))
{
return -1;
}
for (int i = 0; i < _seSourceCount; i++)
{
if (_se[i].status == CriAtomSource.Status.PlayEnd)
{
_se[i].Stop();
}
if (_se[i].status == CriAtomSource.Status.Stop)
{
_se[i].cueSheet = cueName;
_se[i].loop = loop;
_se[i].Play(cueId);
return i;
}
}
return -1;
}
private CriAtomSource FindSe(ref SoundData seData, out int index)
{
index = -1;
if (_noSeMode)
{
return null;
}
if (!IsAvailableCueSheet(seData._acbName))
{
Debug.LogError($"No Include Acb!!!:{seData._acbName},{seData._cueName}");
return null;
}
for (int i = 0; i < _seSourceCount; i++)
{
if (_se[i].status == CriAtomSource.Status.PlayEnd)
{
_se[i].Stop();
}
if (_se[i].status == CriAtomSource.Status.Stop)
{
index = i;
return _se[i];
}
}
return null;
}
public int PlaySe(string cueName, int cueId, bool loop = false)
{
if (!IsAvailableCueSheet(cueName))
{
return -1;
}
for (int i = 0; i < _seSourceCount; i++)
{
if (_se[i].status == CriAtomSource.Status.PlayEnd)
{
_se[i].Stop();
}
if (_se[i].status == CriAtomSource.Status.Stop)
{
_se[i].cueSheet = cueName;
_se[i].loop = loop;
_se[i].Play(cueId);
return i;
}
}
return -1;
}
public void StopSe(int index, float fadeout = 500f)
{
if (index >= 0 && index < _seSourceCount)
{
ResumeSe(index);
_se[index].player.SetFadeOutTime((int)(fadeout * 1000f));
_se[index].Stop();
}
}
public void StopSe(string cuename, float fadeout = 500f)
{
for (int i = 0; i < _se.Length; i++)
{
if (_se[i].cueName.CompareTo(cuename) == 0)
{
ResumeSe(i);
_se[i].player.SetFadeOutTime((int)(fadeout * 1000f));
_se[i].Stop();
}
}
}
public void StopSeAll(float fadeout = 500f)
{
for (int i = 0; i < _seSourceCount; i++)
{
StopSe(i, fadeout);
}
}
public void PauseSe(int index)
{
if (index >= 0 && index < _seSourceCount && (_se[index].status == CriAtomSource.Status.Playing || _se[index].status == CriAtomSource.Status.Prep))
{
_se[index].Pause(sw: true);
}
}
public void ResumeSe(int index)
{
if (index >= 0 && index < _seSourceCount && _se[index].status == CriAtomSource.Status.Playing)
{
_se[index].Pause(sw: false);
}
}
public bool IsPlaySe(string cueName, int cueId)
{
for (int i = 0; i < _seSourceCount; i++)
{
if (_playingSe[i]._cueName == cueName && _playingSe[i]._cueId == cueId && (_se[i].status == CriAtomSource.Status.Prep || _se[i].status == CriAtomSource.Status.Playing))
{
return true;
}
}
return false;
}
public bool IsPlaySe(string cueSheetName, string cueName, out int number)
{
number = 0;
for (int i = 0; i < _seSourceCount; i++)
{
if (_playingSe[i]._acbName == cueSheetName && _playingSe[i]._cueName == cueName && _se[i].status == CriAtomSource.Status.Playing)
{
number++;
}
}
if (number > 0)
{
return true;
}
return false;
}
public bool IsPrepSe(string cueSheetName, string cueName, out int number)
{
number = 0;
for (int i = 0; i < _seSourceCount; i++)
{
if (_playingSe[i]._acbName == cueSheetName && _playingSe[i]._cueName == cueName && _se[i].status == CriAtomSource.Status.Prep)
{
number++;
}
}
if (number > 0)
{
return true;
}
return false;
}
public void ResetSe()
{
for (int i = 0; i < _seSourceCount; i++)
{
_se[i].Stop();
_se[i].Pause(sw: false);
}
}
public bool IsPlaySe(int index)
{
if (_se[index].status == CriAtomSource.Status.Prep || _se[index].status == CriAtomSource.Status.Playing)
{
return true;
}
return false;
}
public void SetAisac(string cuename, string param, float num)
{
for (int i = 0; i < _se.Length; i++)
{
if (_se[i].cueName.CompareTo(cuename) == 0)
{
_se[i].SetAisacControl(param, num);
}
}
}
public int PlaySeFromName(string acbName, string seName, bool loop = false, float fadeInfime = 0f, long startTime = 0L)
{
if (!IsAvailableCueSheet(acbName))
{
return -1;
}
for (int i = 0; i < _seSourceCount; i++)
{
if (_se[i].status == CriAtomSource.Status.PlayEnd)
{
_se[i].Stop();
}
if (_se[i].status == CriAtomSource.Status.Stop)
{
_se[i].cueSheet = acbName;
_se[i].cueName = seName;
_se[i].loop = loop;
_se[i].player.ResetFaderParameters();
_se[i].player.SetStartTime(startTime);
_se[i].player.SetFadeInTime((int)(fadeInfime * 1000f));
_se[i].Play(seName);
return i;
}
}
return -1;
}
public int GetVoiceSourceCount()
{
return _voiceSourceCount;
}
public void VolumeUpdate_Voice(int level, bool mute, int voiceId = -1)
{
Volume_Voice((float)level * 0.1f, mute, voiceId);
}
public void Volume_Voice(float level, bool mute, int voiceId = -1)
{
if (mute)
{
level = 0f;
}
if (voiceId < 0)
{
int num = _voice.Length;
for (int i = 0; i < num; i++)
{
_voice[i].volume = level;
}
}
else
{
_voice[voiceId].volume = level;
}
}
public bool IsPlayVoice(int index)
{
if (_voice[index].status == CriAtomSource.Status.Prep || _voice[index].status == CriAtomSource.Status.Playing)
{
return true;
}
return false;
}
public void PlayVoice(int voiceId, string acbFile, string cueSheet, string cueName)
{
AddCueSheet(cueSheet, acbFile, "v/");
_voice[voiceId].Play(cueName);
}
public void PlayVoice(int voiceId, string cueName)
{
_voice[voiceId].Play(cueName);
}
public void StopVoice(int voiceId, float fadetout = 500f)
{
CriAtomSource criAtomSource = _voice[voiceId];
if (criAtomSource != null && criAtomSource.player != null)
{
criAtomSource.player.SetFadeOutTime((int)(fadetout * 1000f));
criAtomSource.Stop();
}
}
}

View File

@@ -0,0 +1,93 @@
using System.Collections;
using UnityEngine;
using Wizard;
namespace Cute;
public class BootNetwork : MonoBehaviour
{
public bool _autoSetup;
public static bool IsDoneLanguageSetting;
public bool IsDoneGameStartCheck { get; set; }
private void Awake()
{
Object.DontDestroyOnLoad(base.gameObject);
}
private IEnumerator Start()
{
while (Toolbox.BootSystem == null)
{
yield return 0;
}
while (Toolbox.NetworkManager == null)
{
yield return 0;
}
Toolbox.BootNetwork = this;
if (_autoSetup)
{
SetupNetwork();
}
SetupNetworkLanguage();
while (!IsDoneLanguageSetting)
{
yield return 0;
}
}
private void OnDestroy()
{
}
public void SetupNetwork()
{
if (!IsDoneGameStartCheck)
{
StartCoroutine(SetupNetworkCoroutine());
}
}
public void SetupNetworkLanguage()
{
string text = Toolbox.SavedataManager.GetString("LANG_SETTING");
if (text == "Jpn")
{
Toolbox.SavedataManager.DeleteKey("LANG_SETTING");
Toolbox.SavedataManager.DeleteKey("LANG_SOUND_SETTING");
text = "";
Toolbox.AssetManager.ClearAllAssetFile();
Toolbox.AssetManager.ClearAssetCacheAssetBundle();
}
if (string.IsNullOrEmpty(text))
{
CustomPreference.SetScemeMode(CustomPreference.eSchemeType.Https);
CustomPreference.SetApplicationServerURL("utoongaize.shadowverse.jp/shadowverse/");
}
else
{
IsDoneLanguageSetting = true;
}
}
private IEnumerator SetupNetworkCoroutine()
{
if (!IsDoneGameStartCheck)
{
yield return StartCoroutine(Toolbox.NetworkManager._certification.Login());
}
}
public IEnumerator SetupNetworkCertification()
{
SetupNetwork();
while (!IsDoneGameStartCheck)
{
yield return 0;
}
yield return StartCoroutine(Toolbox.AssetManager.InitializeManifest(null, Data.Load.data._userTutorial.tutorial_step != 100));
}
}

View File

@@ -0,0 +1,145 @@
#define STEAM
using System;
using System.Collections;
using System.Diagnostics;
using com.adjust.sdk;
using RedShellUnity;
using Steamworks;
using UnityEngine;
using Wizard;
namespace Cute;
public class BootSystem : MonoBehaviour
{
[SerializeField]
[Tooltip("チェックするとMaxFramerateが有効")]
private bool _dontVsync;
[SerializeField]
[Range(0f, 60f)]
private int _maxFramerate;
public static bool isRootBootCamera;
private Coroutine _logCoroutine;
private string _logMsg = "";
private void Awake()
{
_logMsg += "Awake";
if (isRootBootCamera)
{
UnityEngine.Object.Destroy(GameObject.Find("BootCamera"));
isRootBootCamera = false;
}
VisibleBootCamera(enable: true);
UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
}
private IEnumerator Start()
{
_logCoroutine = StartCoroutine(WaitToAccumulateTraceLog());
_logMsg += " Start";
while (Toolbox.DeviceManager == null)
{
yield return 0;
}
_logMsg += " DeviceManager";
while (Toolbox.SavedataManager == null)
{
yield return 0;
}
_logMsg += " SavedataManager";
while (Toolbox.QualityManager == null)
{
yield return 0;
}
_logMsg += " QualityManager";
while (Toolbox.SceneManager == null)
{
yield return 0;
}
_logMsg += " SceneManager";
while (Toolbox.ResourcesManager == null)
{
yield return 0;
}
_logMsg += " ResourcesManager";
while (Toolbox.AssetManager == null)
{
yield return 0;
}
_logMsg += " AssetManager";
while (Toolbox.AudioManager == null)
{
yield return 0;
}
_logMsg += " AudioManager";
while (Toolbox.MovieManager == null)
{
yield return 0;
}
_logMsg += " MovieManager";
SocialServiceUtility.CreateInstance();
bootAdjust();
setupRedShell();
if (_dontVsync)
{
QualitySettings.vSyncCount = 0;
Application.targetFrameRate = _maxFramerate;
}
StopCoroutine(_logCoroutine);
Toolbox.BootSystem = this;
}
private IEnumerator WaitToAccumulateTraceLog()
{
yield return new WaitForSeconds(5f);
LocalLog.AccumulateTraceInquiryLog("BootSystem " + _logMsg);
}
private void bootAdjust()
{
try
{
}
catch (Exception ex)
{
LocalLog.AccumulateTraceLog(ex.ToString());
}
Adjust.addSessionCallbackParameter("viewer_id", Certification.ViewerId.ToString());
}
private void OnDestroy()
{
}
public void VisibleBootCamera(bool enable)
{
GameObject gameObject = base.transform.Find("BootCamera").gameObject;
if (gameObject != null)
{
gameObject.SetActive(enable);
}
}
[Conditional("STEAM")]
private void setupRedShell()
{
RedShell.SetVerboseLogs(verboseLogs: true);
RedShell.SetApiKey("04b8d4a58416140132fdcd680b17a0d8");
try
{
RedShell.SetUserId(SteamUser.GetSteamID().m_SteamID.ToString());
}
catch (Exception ex)
{
Debug.LogError("<color=aqua>steam client が起動していない。steamの機能を使えません。</color>");
Debug.LogError(ex.Message);
Debug.LogError(ex.StackTrace);
}
RedShell.MarkConversion();
}
}

View File

@@ -0,0 +1,248 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Cute;
public class CryptAES
{
public static byte[] encrypt(byte[] byteSrc)
{
return EncryptRJ256Api(byteSrc);
}
public static string encrypt(string byteSrc)
{
return Convert.ToBase64String(EncryptRJ256Api(Encoding.UTF8.GetBytes(byteSrc)));
}
public static string encryptForNode(string src)
{
return EncryptRJ256ForNode(src);
}
public static byte[] decrypt(string src)
{
return DecryptRJ256Api(Convert.FromBase64String(src));
}
public static string decryptForNode(string src)
{
return DecryptRJ256ForNode(src);
}
private static byte[] EncryptRJ256Api(byte[] toEncryptData)
{
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
rijndaelManaged.Mode = CipherMode.CBC;
rijndaelManaged.KeySize = 256;
rijndaelManaged.BlockSize = 128;
byte[] array = new byte[0];
byte[] array2 = new byte[0];
string s = Cryptographer.generateKeyString();
string s2 = Certification.Udid.Replace("-", "").Substring(0, 16);
array = Encoding.UTF8.GetBytes(s);
array2 = Encoding.UTF8.GetBytes(s2);
ICryptoTransform transform = rijndaelManaged.CreateEncryptor(array, array2);
using MemoryStream memoryStream = new MemoryStream();
using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write);
cryptoStream.Write(toEncryptData, 0, toEncryptData.Length);
cryptoStream.FlushFinalBlock();
byte[] array3 = memoryStream.ToArray();
byte[] array4 = new byte[array3.Length + array.Length];
Array.Copy(array3, 0, array4, 0, array3.Length);
Array.Copy(array, 0, array4, array3.Length, array.Length);
rijndaelManaged.Clear();
memoryStream.Flush();
memoryStream.Close();
cryptoStream.Flush();
cryptoStream.Close();
return array4;
}
public static string EncryptRJ256(string prm_text_to_encrypt)
{
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
rijndaelManaged.Padding = PaddingMode.Zeros;
rijndaelManaged.Mode = CipherMode.CBC;
rijndaelManaged.KeySize = 256;
rijndaelManaged.BlockSize = 256;
byte[] array = new byte[0];
byte[] array2 = new byte[0];
string s = Cryptographer.generateKeyString();
string s2 = Certification.Udid.Replace("-", "");
array = Encoding.UTF8.GetBytes(s);
array2 = Encoding.UTF8.GetBytes(s2);
ICryptoTransform transform = rijndaelManaged.CreateEncryptor(array, array2);
using MemoryStream memoryStream = new MemoryStream();
using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write);
byte[] bytes = Encoding.UTF8.GetBytes(prm_text_to_encrypt);
cryptoStream.Write(bytes, 0, bytes.Length);
cryptoStream.FlushFinalBlock();
byte[] array3 = memoryStream.ToArray();
byte[] array4 = new byte[array3.Length + array.Length];
Array.Copy(array3, 0, array4, 0, array3.Length);
Array.Copy(array, 0, array4, array3.Length, array.Length);
rijndaelManaged.Clear();
memoryStream.Flush();
memoryStream.Close();
cryptoStream.Flush();
cryptoStream.Close();
return Convert.ToBase64String(array4);
}
public static string EncryptRJ256ForNode(string prm_text_to_encrypt)
{
using AesManaged aesManaged = new AesManaged();
string text = Cryptographer.generateKeyString();
string s = text.Substring(0, 16);
aesManaged.BlockSize = 128;
aesManaged.KeySize = 256;
aesManaged.IV = Encoding.UTF8.GetBytes(s);
aesManaged.Key = Encoding.UTF8.GetBytes(text);
aesManaged.Mode = CipherMode.CBC;
aesManaged.Padding = PaddingMode.PKCS7;
byte[] bytes = Encoding.UTF8.GetBytes(prm_text_to_encrypt);
using ICryptoTransform cryptoTransform = aesManaged.CreateEncryptor();
byte[] inArray = cryptoTransform.TransformFinalBlock(bytes, 0, bytes.Length);
aesManaged.Clear();
return text + Convert.ToBase64String(inArray);
}
private static byte[] DecryptRJ256Api(byte[] sEncryptedString)
{
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
rijndaelManaged.Mode = CipherMode.CBC;
rijndaelManaged.KeySize = 256;
rijndaelManaged.BlockSize = 128;
byte[] array = new byte[32];
byte[] array2 = new byte[16];
byte[] array3 = new byte[sEncryptedString.Length - array.Length];
Array.Copy(sEncryptedString, 0, array3, 0, array3.Length);
Array.Copy(sEncryptedString, sEncryptedString.Length - array.Length, array, 0, array.Length);
array2 = Encoding.UTF8.GetBytes(Certification.Udid.Replace("-", "").Substring(0, 16));
ICryptoTransform transform = rijndaelManaged.CreateDecryptor(array, array2);
byte[] array4 = new byte[array3.Length];
using MemoryStream memoryStream = new MemoryStream(array3);
using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Read);
cryptoStream.Read(array4, 0, array4.Length);
rijndaelManaged.Clear();
cryptoStream.Flush();
cryptoStream.Close();
memoryStream.Flush();
memoryStream.Close();
return array4;
}
public static string DecryptRJ256(string prm_text_to_decrypt)
{
byte[] array = Convert.FromBase64String(prm_text_to_decrypt);
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
rijndaelManaged.Padding = PaddingMode.Zeros;
rijndaelManaged.Mode = CipherMode.CBC;
rijndaelManaged.KeySize = 256;
rijndaelManaged.BlockSize = 256;
byte[] array2 = new byte[32];
byte[] array3 = new byte[32];
byte[] array4 = new byte[array.Length - array2.Length];
Array.Copy(array, 0, array4, 0, array4.Length);
Array.Copy(array, array.Length - array2.Length, array2, 0, array2.Length);
array3 = Encoding.UTF8.GetBytes(Certification.Udid.Replace("-", ""));
ICryptoTransform transform = rijndaelManaged.CreateDecryptor(array2, array3);
byte[] array5 = new byte[array4.Length];
using MemoryStream memoryStream = new MemoryStream(array4);
using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Read);
cryptoStream.Read(array5, 0, array5.Length);
rijndaelManaged.Clear();
cryptoStream.Flush();
cryptoStream.Close();
memoryStream.Flush();
memoryStream.Close();
return Encoding.UTF8.GetString(array5).TrimEnd(default(char));
}
public static string DecryptRJ256ForNode(string prm_text_to_decrypt)
{
using AesManaged aesManaged = new AesManaged();
string text = prm_text_to_decrypt.Substring(0, 32);
string s = text.Substring(0, 16);
string s2 = prm_text_to_decrypt.Substring(32);
aesManaged.BlockSize = 128;
aesManaged.KeySize = 256;
aesManaged.Key = Encoding.UTF8.GetBytes(text);
aesManaged.IV = Encoding.UTF8.GetBytes(s);
aesManaged.Mode = CipherMode.CBC;
aesManaged.Padding = PaddingMode.PKCS7;
byte[] array = Convert.FromBase64String(s2);
using ICryptoTransform cryptoTransform = aesManaged.CreateDecryptor();
byte[] bytes = cryptoTransform.TransformFinalBlock(array, 0, array.Length);
string result = Encoding.UTF8.GetString(bytes);
aesManaged.Clear();
return result;
}
public static byte[] EncryptRJ256(byte[] binData)
{
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
rijndaelManaged.Padding = PaddingMode.PKCS7;
rijndaelManaged.Mode = CipherMode.CBC;
rijndaelManaged.KeySize = 256;
rijndaelManaged.BlockSize = 256;
byte[] array = new byte[0];
byte[] array2 = new byte[0];
string s = Cryptographer.generateKeyString();
string s2 = Certification.Udid.Replace("-", "");
array = Encoding.UTF8.GetBytes(s);
array2 = Encoding.UTF8.GetBytes(s2);
ICryptoTransform transform = rijndaelManaged.CreateEncryptor(array, array2);
using MemoryStream memoryStream = new MemoryStream();
using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write);
byte[] bytes = BitConverter.GetBytes(binData.Length);
byte[] array3 = new byte[4 + binData.Length];
Array.Copy(bytes, 0, array3, 0, 4);
Array.Copy(binData, 0, array3, 4, binData.Length);
cryptoStream.Write(array3, 0, array3.Length);
cryptoStream.FlushFinalBlock();
byte[] array4 = memoryStream.ToArray();
byte[] array5 = new byte[array.Length + array4.Length];
Array.Copy(array4, 0, array5, 0, array4.Length);
Array.Copy(array, 0, array5, array4.Length, array.Length);
rijndaelManaged.Clear();
memoryStream.Flush();
memoryStream.Close();
cryptoStream.Flush();
cryptoStream.Close();
return array5;
}
public static byte[] DecryptRJ256(byte[] binData)
{
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
rijndaelManaged.Padding = PaddingMode.PKCS7;
rijndaelManaged.Mode = CipherMode.CBC;
rijndaelManaged.KeySize = 256;
rijndaelManaged.BlockSize = 256;
byte[] array = new byte[32];
byte[] array2 = new byte[32];
byte[] array3 = new byte[binData.Length - array.Length];
Array.Copy(binData, 0, array3, 0, array3.Length);
Array.Copy(binData, binData.Length - array.Length, array, 0, array.Length);
array2 = Encoding.UTF8.GetBytes(Certification.Udid.Replace("-", ""));
ICryptoTransform transform = rijndaelManaged.CreateDecryptor(array, array2);
byte[] array4 = new byte[array3.Length];
using MemoryStream memoryStream = new MemoryStream(array3);
using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Read);
cryptoStream.Read(array4, 0, array4.Length);
byte[] array5 = new byte[4];
Array.Copy(array4, 0, array5, 0, 4);
byte[] array6 = new byte[BitConverter.ToInt32(array5, 0)];
Array.Copy(array4, 4, array6, 0, array6.Length);
rijndaelManaged.Clear();
memoryStream.Flush();
memoryStream.Close();
cryptoStream.Flush();
cryptoStream.Close();
return array6;
}
}

View File

@@ -0,0 +1,144 @@
using System;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;
namespace Cute;
public class Cryptographer
{
public const int FBENCRYPT_BLOCK_SIZE = 32;
private static string encode_buf;
private static Random cRandom = new Random();
private static SHA1CryptoServiceProvider sha1 = null;
private static UTF8Encoding utf8 = null;
private static int random()
{
return cRandom.Next(1, 9);
}
public static string generateIvString()
{
string text = "";
for (int i = 0; i < 32; i++)
{
text += $"{random()}";
}
return text;
}
public static string generateKeyString()
{
string text = "";
for (int i = 0; i < 32; i++)
{
text += $"{cRandom.Next(0, 65535):x}";
}
return Convert.ToBase64String(Encoding.ASCII.GetBytes(text.ToString())).Substring(0, 32);
}
public static string encode(string dat)
{
int length = dat.Length;
encode_buf = $"{length:x4}";
foreach (char value in dat)
{
encode_buf += $"{random(),1:x}";
encode_buf += $"{random(),1:x}";
encode_buf += (char)(Convert.ToInt32(value) + 10);
encode_buf += $"{random(),1:x}";
}
encode_buf += generateIvString();
return encode_buf;
}
public static string decode(string dat)
{
if (dat == null || dat.Length < 4)
{
return dat;
}
int num = int.Parse(dat.Substring(0, 4), NumberStyles.AllowHexSpecifier);
string text = "";
int num2 = 2;
string text2 = dat.Substring(4, dat.Length - 4);
foreach (char value in text2)
{
if (num2 % 4 == 0)
{
text += (char)(Convert.ToInt32(value) - 10);
}
num2++;
if (text.Length >= num)
{
break;
}
}
return text;
}
public static string ComputeHash(string data)
{
if (string.IsNullOrEmpty(data))
{
return null;
}
SHA1CryptoServiceProvider sHA1CryptoServiceProvider = new SHA1CryptoServiceProvider();
byte[] bytes = Encoding.UTF8.GetBytes(data);
byte[] array = sHA1CryptoServiceProvider.ComputeHash(bytes);
string text = "";
byte[] array2 = array;
foreach (byte b in array2)
{
text += $"{b:x2}";
}
sHA1CryptoServiceProvider.Clear();
return text;
}
public static string MakeMd5(string input)
{
MD5CryptoServiceProvider mD5CryptoServiceProvider = new MD5CryptoServiceProvider();
byte[] bytes = Encoding.UTF8.GetBytes(input + "r!I@ws8e5i=");
byte[] array = mD5CryptoServiceProvider.ComputeHash(bytes);
string text = "";
byte[] array2 = array;
foreach (byte b in array2)
{
text += b.ToString("x2");
}
mD5CryptoServiceProvider.Clear();
return text;
}
public static string ComputeSHA1(string seed)
{
if (sha1 == null)
{
sha1 = new SHA1CryptoServiceProvider();
}
if (utf8 == null)
{
utf8 = new UTF8Encoding();
}
if (string.IsNullOrEmpty(seed))
{
return "";
}
byte[] bytes = utf8.GetBytes(seed);
byte[] array = sha1.ComputeHash(bytes);
StringBuilder stringBuilder = new StringBuilder();
int num = array.Length;
for (int i = 0; i < num; i++)
{
stringBuilder.Append(Convert.ToString(array[i], 16).PadLeft(2, '0'));
}
sha1.Initialize();
return stringBuilder.ToString();
}
}

View File

@@ -0,0 +1,318 @@
using Wizard;
namespace Cute;
public class CustomPreference
{
public enum eSchemeType
{
Http,
Https,
File,
Node,
StreamingAssets
}
public enum PlatformType
{
NONE,
APPLE,
GOOGLE,
DMM,
STEAM
}
public enum SmallResourceStatus
{
NO_SELECT,
USE_NORMAL,
USE_SMALL
}
private const string fileScheme = "file:///";
private const string httpScheme = "http://";
private const string httpsScheme = "https://";
private const string jarFileScheme = "jar:file://";
private static string nodeServerScheme = "ws://";
private const string directoryLowLevelResources = "Low/";
private const string directoryHighLevelResources = "High/";
private static string directoryRoot = "dl/";
private static string _applicationServerUrl = "";
private static string _resourceServerUrl = "";
private static string _nodeServerUrl = "";
private static string _deckBuilderServerUrl = "";
public static string _localePref = "Eng";
private static string _signaturePref = "";
private static string _languagePref = "Eng";
private static string _languageSoundPref = "Eng";
private static string _assetbundleurl = "";
private static string _manifestsuburl = "";
private static string _soundurl = "";
private static string _movieurl = "";
private static string _manifestUrl = "";
private static eSchemeType _schemeType = eSchemeType.Http;
private static eSchemeType _schemeCDNType = eSchemeType.Http;
private static bool _isPreferenceComplete = false;
private static bool _isLocalAssetBundles = false;
public static bool isPreferenceComplete
{
get
{
return _isPreferenceComplete;
}
set
{
_isPreferenceComplete = value;
}
}
public static bool isLocalAssetBundles
{
get
{
return _isLocalAssetBundles;
}
set
{
_isLocalAssetBundles = value;
}
}
public static bool IsNormalResource => !IsSmallResource;
public static bool IsSmallResource => PlayerPrefsCache.Instance.GetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS) == 2;
public static string GetApplicationServerURL()
{
return GetScheme() + _applicationServerUrl;
}
public static void SetApplicationServerURL(string strApplicationServer)
{
_applicationServerUrl = strApplicationServer;
}
public static string GetResourceServerURL()
{
return GetCDNScheme() + _resourceServerUrl;
}
public static void SetResourceServerURL(string strResourceServer)
{
_resourceServerUrl = strResourceServer;
}
public static string GetNodeServerURL()
{
return nodeServerScheme + _nodeServerUrl;
}
public static void SetNodeServerURL(string strNodeServer)
{
if (!string.IsNullOrEmpty(strNodeServer))
{
_nodeServerUrl = strNodeServer;
}
}
public static string GetDeckBuilderServerURL()
{
return GetScheme() + _deckBuilderServerUrl;
}
public static void SetDeckBuilderServerURL(string strDeckBuilderServer)
{
_deckBuilderServerUrl = strDeckBuilderServer;
}
public static int GetPlatform()
{
return 4;
}
public static string GetAssetBundleURL()
{
return _assetbundleurl;
}
public static string GetManifestURL()
{
return _manifestUrl;
}
public static string GetSubManifestURL()
{
if (_isLocalAssetBundles)
{
_manifestsuburl = GetResourceServerURL() + Utility.GetRuntimePlatform() + "/";
}
else
{
_manifestsuburl = GetResourceServerURL() + directoryRoot + "Manifest/" + GetVersionFolderName() + GetSoundMovieLanguageFolderName() + Utility.GetRuntimePlatform() + "/";
}
return _manifestsuburl;
}
public static string GetSoundResourceURL()
{
return _soundurl;
}
public static string GetMoiveResourceURL()
{
return _movieurl;
}
public static string GetScheme()
{
return _schemeType switch
{
eSchemeType.Http => "http://",
eSchemeType.Https => "https://",
eSchemeType.File => "file:///",
eSchemeType.Node => nodeServerScheme,
eSchemeType.StreamingAssets => "file:///",
_ => "http://",
};
}
public static string GetCDNScheme()
{
return _schemeCDNType switch
{
eSchemeType.Http => "http://",
eSchemeType.Https => "https://",
_ => "http://",
};
}
public static string GetVersionFolderName()
{
return Toolbox.SavedataManager.GetResourceVersion() + "/";
}
public static void SetScemeMode(eSchemeType schemeType)
{
_schemeType = schemeType;
}
public static void SetScemeModeCDN(eSchemeType schemeCDNType)
{
_schemeCDNType = schemeCDNType;
}
public static void SetOptionalNodeSceme()
{
if (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SELECT_WSS))
{
SetNodeSceme("wss://");
}
else
{
SetNodeSceme("ws://");
}
}
private static void SetNodeSceme(string scheme)
{
nodeServerScheme = scheme;
}
public static void SetRootFolderName(string strDir)
{
directoryRoot = strDir;
}
public static void SetTextLanguage(string strLanguage)
{
_languagePref = strLanguage;
}
public static void SetLocale(string strLocale)
{
_localePref = strLocale;
}
public static string GetLanguageFolderName()
{
return _languagePref + "/";
}
public static string GetTextLanguage()
{
return GetResourceLanguage();
}
public static string GetResourceLanguage()
{
return _languagePref;
}
public static void SetSoundLanguage(string strLanguage)
{
_languageSoundPref = strLanguage;
}
public static string GetSoundMovieLanguageFolderName()
{
return _languageSoundPref + "/";
}
public static string GetSoundMovieLanguage()
{
return _languageSoundPref;
}
public static void SetSignature(string strSignature)
{
_signaturePref = strSignature;
}
public static string GetSignaturePath()
{
return "/../" + _signaturePref;
}
public static void createResourcePath()
{
if (_isLocalAssetBundles)
{
_assetbundleurl = GetResourceServerURL() + Utility.GetRuntimePlatform() + "/";
_manifestsuburl = GetResourceServerURL() + Utility.GetRuntimePlatform() + "/";
}
else
{
_assetbundleurl = GetResourceServerURL() + directoryRoot + "Resource/" + GetLanguageFolderName() + Utility.GetRuntimePlatform() + "/";
string text = "Manifest/";
_manifestsuburl = GetResourceServerURL() + directoryRoot + text + GetVersionFolderName() + GetSoundMovieLanguageFolderName() + Utility.GetRuntimePlatform() + "/";
_manifestUrl = GetResourceServerURL() + directoryRoot + text + GetVersionFolderName() + GetLanguageFolderName() + Utility.GetRuntimePlatform() + "/";
}
_soundurl = GetResourceServerURL() + directoryRoot + "Sound/" + GetSoundMovieLanguageFolderName();
_movieurl = GetResourceServerURL() + directoryRoot + "Resource/" + GetSoundMovieLanguageFolderName() + Utility.GetRuntimePlatform() + "/";
}
}

View File

@@ -0,0 +1,190 @@
using System.Collections.Generic;
namespace Cute;
public static class CuteNetworkDefine
{
public enum ApiType
{
SignUp,
GameStartCheck,
CheckSpecialTitle,
PaymentItemList,
PaymentStart,
PaymentCancel,
PaymentFinish,
PaymentSendLog,
PaymentPCItemList,
PaymentPCStart,
PaymentPCCancel,
PaymentPCFinish,
SteamGetUserInfo,
SteamMicroTxnInit,
BirthUpdate,
AccountMigration,
GetGameDataBySocialAccount,
GetTransitionCode,
TransitionCodeMigration,
GetGameDataByTransitionCode,
GetFacebookNonce,
CheckiCloudUser,
MigrateiCloudUser
}
public enum ACCOUNT_TYPE
{
NONE,
GOOGLE_PLAY,
GAME_CENTER,
FACEBOOK,
DMM,
STEAM,
APPLE_ID
}
public enum CONNECT_TYPE
{
SOCIAL_ACCOUNT_CONNECT = 1,
SOCIAL_ACCOUNT_DISCONNECT,
SOCIAL_ACCOUNT_GAME_DATA_UPDATE,
TRANS_CODE_GAME_DATA_UPDATE
}
public const int API_RESULT_SUCCESS_CODE = 1;
public const int RESULT_CODE_DATABASE_ERROR = 100;
public const int RESULT_CODE_MAINTENANCE_COMMON = 101;
public const int RESULT_CODE_SERVER_ERROR = 102;
public const int API_RESULT_SESSION_ERROR = 201;
public const int RESULT_CODE_ACCOUNT_BLOCK_ERROR = 203;
public const int RESULT_CODE_ACCOUNT_LIMITED_BLOCK_ERROR = 217;
public const string ACCOUNT_LIMITED_BLOCK_END_TIME = "account_block_end_time";
public const int RESULT_CODE_NETEASE_ACCOUNT_BLOCK_ERROR = 330;
public const int API_RESULT_VERSION_ERROR = 204;
public const int RESULT_CODE_PROCESSED_ERROR = 213;
public const int RESULT_CODE_PAYMENT_VALIDATION_ERROR = 308;
public const int RESULT_CODE_DMM_ONETIMETOKEN_EXPIRED = 317;
public const int RESULT_CODE_SOLO_PLAY_ALREADY_FINISH = 1352;
public const int RESULT_CODE_MAINTENANCE_FROM = 2000;
public const int RESULT_CODE_MAINTENANCE_TO = 2999;
public const string MAINTENACE_END_TIME = "maintenance_end_time";
public const int RESULT_CODE_MAINTENANCE_CARD_TWO_PICK = 1710;
public const int RESULT_CODE_MAINTENANCE_CARD_OPEN_SIX = 5013;
public const int RESULT_CODE_ALREADY_BATTLE_RESULT = 3502;
public const int RC_OPEN_ROOM_SET_DECK_IN_BATTLE_PHASE = 1768;
public static Dictionary<ApiType, string> ApiUrlList = new Dictionary<ApiType, string>
{
{
ApiType.SignUp,
"tool/signup"
},
{
ApiType.CheckSpecialTitle,
"check/special_title"
},
{
ApiType.GameStartCheck,
"check/game_start"
},
{
ApiType.PaymentItemList,
"payment/item_list"
},
{
ApiType.PaymentStart,
"payment/start"
},
{
ApiType.PaymentCancel,
"payment/cancel"
},
{
ApiType.PaymentFinish,
"payment/finish"
},
{
ApiType.PaymentSendLog,
"payment/send_log"
},
{
ApiType.PaymentPCItemList,
"payment_pc/item_list"
},
{
ApiType.PaymentPCStart,
"payment_pc/start"
},
{
ApiType.PaymentPCCancel,
"payment_pc/cancel"
},
{
ApiType.PaymentPCFinish,
"payment_pc/finish"
},
{
ApiType.SteamGetUserInfo,
"payment_pc/steam_get_user_info"
},
{
ApiType.SteamMicroTxnInit,
"payment_pc/steam_micro_txn_init"
},
{
ApiType.BirthUpdate,
"account/update_birth"
},
{
ApiType.AccountMigration,
"account/chain_by_social_account"
},
{
ApiType.GetGameDataBySocialAccount,
"account/get_by_social_account"
},
{
ApiType.GetTransitionCode,
"account/publish_transition_code"
},
{
ApiType.TransitionCodeMigration,
"account/chain_by_transition_code"
},
{
ApiType.GetGameDataByTransitionCode,
"account/get_by_transition_code"
},
{
ApiType.GetFacebookNonce,
"account/get_facebook_nonce"
},
{
ApiType.CheckiCloudUser,
"account/get_by_icloud_data"
},
{
ApiType.MigrateiCloudUser,
"account/chain_by_icloud_data"
}
};
}

View File

@@ -0,0 +1,102 @@
using System;
using System.Diagnostics;
using UnityEngine;
namespace Cute;
public class DebugManager : MonoBehaviour
{
public enum LOG_LEVEL
{
NORMAL,
HIGH,
VERY_HIGH,
VERY_HIGH2,
VERY_HIGH3,
VERY_HIGH4
}
[Conditional("USE_DBGSYS")]
public void Log(string text)
{
}
[Conditional("USE_DBGSYS")]
public void LogWarning(string text)
{
}
[Conditional("USE_DBGSYS")]
public void LogAppend(string text)
{
}
[Conditional("USE_DBGSYS")]
public void LogAppendWarning(string text)
{
}
public void ClearLog()
{
}
[Conditional("USE_DBGSYS")]
public void TextLog(string text)
{
}
[Conditional("USE_DBGSYS")]
public void SoundLog(string text)
{
}
[Conditional("USE_DBGSYS")]
public void SoundLogWarning(string text)
{
}
[Conditional("USE_DBGSYS")]
public void SoundLogAppend(string text)
{
}
[Conditional("USE_DBGSYS")]
public void SoundLogAppendWarning(string text)
{
}
[Conditional("USE_DBGSYS")]
public void ClearSoundLog()
{
}
[Conditional("USE_DBGSYS")]
public void BattleLogAppend(string text)
{
}
[Conditional("USE_DBGSYS")]
public void BattleLogAppendWarning(string text)
{
}
[Conditional("USE_DBGSYS")]
public void ClearBattleLog()
{
}
[Conditional("USE_DBGSYS")]
public void Log(object log, LOG_LEVEL level)
{
}
[Conditional("USE_DBGSYS")]
public void LogError(object log)
{
}
[Conditional("USE_DBGSYS")]
public void LogException(Exception e)
{
}
}

View File

@@ -0,0 +1,284 @@
using System;
using System.Collections;
using System.IO;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text;
using System.Xml;
using UnityEngine;
using Wizard;
namespace Cute;
public class DeviceManager : MonoBehaviour, IManager
{
public enum TextureCompression
{
ETC,
DXT,
ATC,
PVRTC
}
public enum DeviceType
{
NONE,
IPHONE,
ANDROID,
WINDOWS,
OSX
}
private const string BUILDPARAMFILE = "/CuteBuildParam.xml";
private string strBuildVersionName = "9.9.9";
private TextureCompression textureCommpression;
private IPAddress _ipAddress;
private string _winOsVersion;
private bool tokenSent;
private string _getIpAddressWithFamilyTypeLog = "";
private void Awake()
{
CheckTextureCompression();
}
private void Start()
{
SetBuildVersionName();
Toolbox.DeviceManager = this;
}
private void Update()
{
}
private void OnDestroy()
{
}
public TextureCompression GetTextureCompression()
{
return textureCommpression;
}
private void CheckTextureCompression()
{
textureCommpression = TextureCompression.DXT;
}
public string GetModelName()
{
return SystemInfo.deviceModel;
}
public string GetOsVersion()
{
if (string.IsNullOrEmpty(_winOsVersion))
{
try
{
string operatingSystem = SystemInfo.operatingSystem;
string value = Environment.OSVersion.Version.ToString();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append(operatingSystem.Substring(0, operatingSystem.IndexOf('(') + 1));
stringBuilder.Append(value);
stringBuilder.Append(operatingSystem.Substring(operatingSystem.IndexOf(')')));
_winOsVersion = stringBuilder.ToString();
}
catch (Exception)
{
_winOsVersion = SystemInfo.operatingSystem;
}
}
return _winOsVersion;
}
public int GetDeviceType()
{
return 3;
}
public string GetAppVersionName()
{
return strBuildVersionName;
}
public string GetLocale()
{
return CustomPreference._localePref;
}
public string getSignature()
{
return "";
}
public bool isRootUser()
{
return false;
}
public string GetDeviceUniqueIdentifier()
{
string text = "";
text = SystemInfo.deviceUniqueIdentifier;
if (string.IsNullOrEmpty(text))
{
text = "";
}
return text;
}
public string GetDeviceName()
{
return SystemInfo.deviceModel;
}
public string GetGraphicsDeviceName(bool textureCheck = false)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append(SystemInfo.graphicsDeviceName);
if (textureCheck)
{
if (SystemInfo.SupportsTextureFormat(TextureFormat.ETC2_RGB) && SystemInfo.SupportsTextureFormat(TextureFormat.ETC2_RGBA8))
{
stringBuilder.Append("[ETC2=1]");
}
else
{
stringBuilder.Append("[ETC2=0]");
}
if (SystemInfo.SupportsTextureFormat(TextureFormat.ASTC_6x6) && SystemInfo.SupportsTextureFormat(TextureFormat.ASTC_6x6))
{
stringBuilder.Append("[ASTC=1]");
}
else
{
stringBuilder.Append("[ASTC=0]");
}
}
return stringBuilder.ToString();
}
private IPAddress GetIpAddressWithFamilyType(AddressFamily family = AddressFamily.InterNetwork)
{
_getIpAddressWithFamilyTypeLog = "";
_getIpAddressWithFamilyTypeLog += "GetIpAddressWithFamilyType ";
if (family == AddressFamily.InterNetworkV6 && !Socket.OSSupportsIPv6)
{
return null;
}
UnicastIPAddressInformation unicastIPAddressInformation = null;
NetworkInterface[] allNetworkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
_getIpAddressWithFamilyTypeLog += "GetIpAddressWithFamilyType2 ";
NetworkInterface[] array = allNetworkInterfaces;
foreach (NetworkInterface networkInterface in array)
{
if (networkInterface.OperationalStatus != OperationalStatus.Up)
{
_getIpAddressWithFamilyTypeLog = _getIpAddressWithFamilyTypeLog + " OperationalStatus" + networkInterface.OperationalStatus;
continue;
}
NetworkInterfaceType networkInterfaceType = networkInterface.NetworkInterfaceType;
if (networkInterfaceType != NetworkInterfaceType.Wireless80211 && networkInterfaceType != NetworkInterfaceType.Ethernet)
{
_getIpAddressWithFamilyTypeLog = _getIpAddressWithFamilyTypeLog + " Type " + networkInterfaceType;
continue;
}
IPInterfaceProperties iPProperties = networkInterface.GetIPProperties();
if (iPProperties.GatewayAddresses.Count == 0)
{
_getIpAddressWithFamilyTypeLog += " GatewayAddresses.Count 0 ";
continue;
}
foreach (UnicastIPAddressInformation unicastAddress in iPProperties.UnicastAddresses)
{
if (unicastAddress.Address.AddressFamily != family)
{
continue;
}
if (IPAddress.IsLoopback(unicastAddress.Address))
{
_getIpAddressWithFamilyTypeLog += " IsLoopback ";
continue;
}
if (!unicastAddress.IsDnsEligible)
{
if (unicastIPAddressInformation == null)
{
unicastIPAddressInformation = unicastAddress;
}
_getIpAddressWithFamilyTypeLog += " ip.IsDnsEligible ";
continue;
}
return unicastAddress.Address;
}
}
_getIpAddressWithFamilyTypeLog += "GetIpAddressWithFamilyType3 ";
return unicastIPAddressInformation?.Address;
}
public string GetIpAddress()
{
if (_ipAddress != null)
{
return _ipAddress.ToString();
}
LocalLog.AccumulateTraceInquiryLog("GetIpAddress " + StackTraceUtility.ExtractStackTrace());
_ipAddress = GetIpAddressWithFamilyType();
if (_ipAddress == null)
{
LocalLog.AccumulateTraceInquiryLog("GetIpAddress Empty " + _getIpAddressWithFamilyTypeLog + " " + StackTraceUtility.ExtractStackTrace());
return string.Empty;
}
return _ipAddress.ToString();
}
public void ClearIpAddress()
{
_ipAddress = null;
LocalLog.AccumulateTraceInquiryLog("ClearIpAddress " + StackTraceUtility.ExtractStackTrace());
}
public string GetCarrier()
{
return "";
}
public void SetVersionName()
{
SetBuildVersionName();
}
public void SetBuildVersionName()
{
string text = Application.streamingAssetsPath + "/CuteBuildParam.xml";
if (!File.Exists(text))
{
return;
}
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(text);
if (xmlDocument.FirstChild == null || xmlDocument.FirstChild.NextSibling == null)
{
return;
}
IEnumerator enumerator = xmlDocument.FirstChild.NextSibling.GetEnumerator();
while (enumerator.MoveNext())
{
XmlNode xmlNode = (XmlNode)enumerator.Current;
if (xmlNode.Name.Equals("versionName"))
{
strBuildVersionName = xmlNode.InnerText;
break;
}
}
}
}

View File

@@ -0,0 +1,139 @@
using System.Collections.Generic;
using LitJson;
using UnityEngine;
using Wizard;
namespace Cute;
public class GameStartCheckTask : NetworkTask
{
private class CheckParams : PostParams
{
public int app_type;
public string campaign_data = "";
public string campaign_sign = "";
public int campaign_user;
}
private CuteNetworkDefine.ApiType apiType = CuteNetworkDefine.ApiType.GameStartCheck;
public static bool IsSocialAccountDataTransNotSetAndTutorialClear = false;
public static bool IsTutorialClear = false;
public static List<CuteNetworkDefine.ACCOUNT_TYPE> IsSocialAccountDataTransSet;
public static bool IsSetTransitionPassword;
public static int _tosId;
public static int _privacyPolicyId;
public static bool HasAppliedForAccountDeletion { get; private set; } = false;
public static string RefundUrl { get; private set; } = string.Empty;
public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}";
public GameStartCheckTask()
{
if (Toolbox.BootNetwork != null)
{
Toolbox.BootNetwork.IsDoneGameStartCheck = false;
}
IsSocialAccountDataTransSet = new List<CuteNetworkDefine.ACCOUNT_TYPE>();
}
public void SetParameter()
{
CheckParams checkParams = new CheckParams();
if (URLScheme.AppType != 0)
{
checkParams.campaign_data = URLScheme.CampaignData;
checkParams.app_type = URLScheme.AppType;
}
checkParams.campaign_sign = Toolbox.DeviceManager.getSignature();
int num = Random.Range(0, 100000);
if (Toolbox.DeviceManager.isRootUser())
{
checkParams.campaign_user = 2 * num + 1;
}
else
{
checkParams.campaign_user = 2 * num;
}
base.Params = checkParams;
}
protected override int Parse()
{
int num = base.Parse();
if (num != 1)
{
return num;
}
IsSocialAccountDataTransNotSetAndTutorialClear = false;
IsSocialAccountDataTransSet.Clear();
IsSetTransitionPassword = false;
RefundUrl = string.Empty;
if (base.ResponseData["data"].Keys.Contains("transition_account_data"))
{
JsonData jsonData = base.ResponseData["data"]["transition_account_data"];
for (int i = 0; i < jsonData.Count; i++)
{
if (jsonData[i]["social_account_type"].ToInt() == 1)
{
IsSocialAccountDataTransSet.Add(CuteNetworkDefine.ACCOUNT_TYPE.GOOGLE_PLAY);
}
else if (jsonData[i]["social_account_type"].ToInt() == 2)
{
IsSocialAccountDataTransSet.Add(CuteNetworkDefine.ACCOUNT_TYPE.GAME_CENTER);
}
else if (jsonData[i]["social_account_type"].ToInt() == 3)
{
IsSocialAccountDataTransSet.Add(CuteNetworkDefine.ACCOUNT_TYPE.FACEBOOK);
}
else if (jsonData[i]["social_account_type"].ToInt() == 6)
{
IsSocialAccountDataTransSet.Add(CuteNetworkDefine.ACCOUNT_TYPE.APPLE_ID);
}
}
if (base.ResponseData["data"]["now_tutorial_step"].ToInt() == 100)
{
IsTutorialClear = true;
}
if (jsonData.Count == 0 && base.ResponseData["data"]["now_tutorial_step"].ToInt() == 100)
{
IsSocialAccountDataTransNotSetAndTutorialClear = true;
}
}
if (base.ResponseData["data"].Keys.Contains("rewrite_viewer_id"))
{
Certification.ViewerId = base.ResponseData["data"]["rewrite_viewer_id"].ToInt();
}
if (base.ResponseData["data"].Keys.Contains("is_set_transition_password"))
{
IsSetTransitionPassword = base.ResponseData["data"]["is_set_transition_password"].ToBoolean();
}
HasAppliedForAccountDeletion = base.ResponseData["data"].Keys.Contains("account_delete_reservation_status");
ParseAgreementData(base.ResponseData);
if (base.ResponseData["data"].Keys.Contains("refund_url"))
{
RefundUrl = base.ResponseData["data"]["refund_url"].ToString();
}
return num;
}
private void ParseAgreementData(JsonData responseData)
{
PlayerStaticData._tosAgreementState = (PlayerStaticData.AgreementState)responseData["data"]["tos_state"].ToInt();
PlayerStaticData._privacyPolicyAgreementState = (PlayerStaticData.AgreementState)responseData["data"]["policy_state"].ToInt();
PlayerStaticData.KorAuthorityAgreementState = (PlayerStaticData.AgreementState)responseData["data"]["kor_authority_state"].ToInt();
AcceptAgreementTask._tosId = responseData["data"]["tos_id"].ToInt();
AcceptAgreementTask._privacyPolicyId = responseData["data"]["policy_id"].ToInt();
AcceptAgreementTask.KorAuthorityId = responseData["data"]["kor_authority_id"].ToInt();
}
}

View File

@@ -0,0 +1,77 @@
using LitJson;
using Wizard;
namespace Cute;
public class GetiCloudUserDataTask : NetworkTask
{
private class iCloudUserParams : PostParams
{
public string icloud_data = "";
}
public class VerifiediCloudBackupUserData
{
public int iCloudViewerId { get; set; }
public string iCloudUserName { get; set; } = " - ";
public string UserRankRotation { get; set; }
public string UserRankUnlimited { get; set; }
public bool HasUserData()
{
return iCloudViewerId != 0;
}
public void Reset()
{
iCloudViewerId = 0;
iCloudUserName = " - ";
}
}
private CuteNetworkDefine.ApiType apiType = CuteNetworkDefine.ApiType.CheckiCloudUser;
public static readonly VerifiediCloudBackupUserData VerifiediCloudUserData = new VerifiediCloudBackupUserData();
public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}";
public void SetParameter(string iCloudData)
{
iCloudUserParams iCloudUserParams = new iCloudUserParams();
iCloudUserParams.icloud_data = iCloudData;
base.Params = iCloudUserParams;
}
protected override int Parse()
{
if (resultCode != 1)
{
return resultCode;
}
JsonData jsonData = base.ResponseData["data"];
if (jsonData["icloud_data_verified"].ToBoolean())
{
VerifiediCloudUserData.iCloudViewerId = jsonData["icloud_viewer_id"].ToInt();
VerifiediCloudUserData.iCloudUserName = jsonData["icloud_name"].ToString();
string text = 1.ToString();
string text2 = 2.ToString();
SystemText systemText = Data.SystemText;
if (base.ResponseData["data"].Keys.Contains("rank") && base.ResponseData["data"]["rank"] != null)
{
JsonData jsonData2 = base.ResponseData["data"]["rank"];
if (jsonData2.Keys.Contains(text))
{
VerifiediCloudUserData.UserRankRotation = systemText.Get(jsonData2[text].ToString());
}
if (jsonData2.Keys.Contains(text2))
{
VerifiediCloudUserData.UserRankUnlimited = systemText.Get(jsonData2[text2].ToString());
}
}
}
return resultCode;
}
}

View File

@@ -0,0 +1,224 @@
using System;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using UnityEngine;
namespace Cute;
public static class HangulManager
{
private class JosiConversionRule
{
public char Type { get; private set; }
public string Text1 { get; private set; }
public string Text2 { get; private set; }
public Func<char, bool> IsConvertToText1 { get; private set; }
public JosiConversionRule(char type, string text1, string text2, Func<char, bool> isConvertToText1)
{
Type = type;
Text1 = text1;
Text2 = text2;
IsConvertToText1 = isConvertToText1;
}
}
private class DecomposedHangul
{
public char? Chosung { get; set; }
public char? Jungsung { get; set; }
public char? Jongsung { get; set; }
public DecomposedHangul()
{
Chosung = null;
Jungsung = null;
Jongsung = null;
}
public DecomposedHangul(char hangulCharacter)
{
int num = hangulCharacter - 44032;
int num2 = (int)Mathf.Floor((float)num / (float)JUNGSUNG_TABLE.Length / (float)JONGSUNG_TABLE.Length);
Chosung = CHOSUNG_TABLE[num2];
int num3 = (int)Mathf.Floor((float)num / (float)JONGSUNG_TABLE.Length - (float)(num2 * JUNGSUNG_TABLE.Length));
Jungsung = JUNGSUNG_TABLE[num3];
Jongsung = JONGSUNG_TABLE[num % JONGSUNG_TABLE.Length];
}
}
private const int STRING_BUILDER_CAPACITY = 512;
private const char dHANGUL_START = '가';
private const char dHANGUL_END = '힣';
private const char JOSI_TYPE_IDENTIFIER = '@';
private static readonly char[] CHOSUNG_TABLE = new char[19]
{
'ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ',
'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'
};
private static readonly char[] JUNGSUNG_TABLE = new char[21]
{
'ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ', 'ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ',
'ㅙ', 'ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅠ', 'ㅡ', 'ㅢ',
'ㅣ'
};
private static readonly char?[] JONGSUNG_TABLE = new char?[28]
{
null, 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ',
'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ',
'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'
};
private static readonly JosiConversionRule[] RULE_TABLE = new JosiConversionRule[6]
{
new JosiConversionRule('a', "이", "가", IsConvertToText1_common),
new JosiConversionRule('b', "은", "는", IsConvertToText1_common),
new JosiConversionRule('c', "을", "를", IsConvertToText1_common),
new JosiConversionRule('d', "과", "와", IsConvertToText1_common),
new JosiConversionRule('e', "으로", "로", IsConvertToText1_typeE),
new JosiConversionRule('f', "이라면", "라면", IsConvertToText1_common)
};
private static StringBuilder _strBuilder = new StringBuilder(512);
private const string START_TAG = "START_TAG";
private const string END_TAG = "END_TAG";
private const string ENCLOSED = "ENCLOSED";
private const string NUMERAL_PATTERN = "(?<START_TAG>\\[num\\])(?<ENCLOSED>.*?)(?<END_TAG>\\[/num\\])";
private static readonly string[] NUMERAL_TABLE = new string[100]
{
"0", "하나", "둘", "셋", "넷", "다섯", "여섯", "일곱", "여덟", "아홉",
"열", "열하나", "열둘", "열셋", "열넷", "열다섯", "열여섯", "열일곱", "열여덟", "열아홉",
"스물", "스물하나", "스물둘", "스물셋", "스물넷", "스물다섯", "스물여섯", "스물일곱", "스물여덟", "스물아홉",
"서른", "서른하나", "서른둘", "서른셋", "서른넷", "서른다섯", "서른여섯", "서른일곱", "서른여덟", "서른아홉",
"마흔", "마흔하나", "마흔둘", "마흔셋", "마흔넷", "마흔다섯", "마흔여섯", "마흔일곱", "마흔여덟", "마흔아홉",
"쉰", "쉰하나", "쉰둘", "쉰셋", "쉰넷", "쉰다섯", "쉰여섯", "쉰일곱", "쉰여덟", "쉰아홉",
"예순", "예순하나", "예순둘", "예순셋", "예순넷", "예순다섯", "예순여섯", "예순일곱", "예순여덟", "예순아홉",
"일흔", "일흔하나", "일흔둘", "일흔셋", "일흔넷", "일흔다섯", "일흔여섯", "일흔일곱", "일흔여덟", "일흔아홉",
"여든", "여든하나", "여든둘", "여든셋", "여든넷", "여든다섯", "여든여섯", "여든일곱", "여든여덟", "여든아홉",
"아흔", "아흔하나", "아흔둘", "아흔셋", "아흔넷", "아흔다섯", "아흔여섯", "아흔일곱", "아흔여덟", "아흔아홉"
};
public static string ConvertRule(string inputStr)
{
return ConvertJosiType(ConvertNumeral(inputStr));
}
private static string ConvertNumeral(string inputStr)
{
foreach (Match item in Regex.Matches(inputStr, "(?<START_TAG>\\[num\\])(?<ENCLOSED>.*?)(?<END_TAG>\\[/num\\])").Cast<Match>().Reverse())
{
Group obj = item.Groups["END_TAG"];
inputStr = inputStr.Remove(obj.Index, obj.Length);
Group obj2 = item.Groups["ENCLOSED"];
foreach (Match item2 in Regex.Matches(obj2.Value, "\\d+").Cast<Match>().Reverse())
{
Group obj3 = item2.Groups[0];
int num = int.Parse(obj3.Value);
if (0 < num && num < NUMERAL_TABLE.Length)
{
int startIndex = obj2.Index + obj3.Index;
inputStr = inputStr.Remove(startIndex, obj3.Length).Insert(startIndex, NUMERAL_TABLE[num]);
}
}
Group obj4 = item.Groups["START_TAG"];
inputStr = inputStr.Remove(obj4.Index, obj4.Length);
}
return inputStr;
}
private static string ConvertJosiType(string inputStr)
{
if (inputStr.Length <= 0)
{
return inputStr;
}
_strBuilder.Length = 0;
_strBuilder.Append(inputStr[0]);
int length = inputStr.Length;
for (int i = 1; i < length; i++)
{
char c = inputStr[i];
if (c != '@')
{
_strBuilder.Append(c);
continue;
}
if (i + 1 == length)
{
_strBuilder.Append(c);
break;
}
bool flag = false;
char c2 = inputStr[i + 1];
for (int j = 0; j < RULE_TABLE.Length; j++)
{
JosiConversionRule josiConversionRule = RULE_TABLE[j];
if (josiConversionRule.Type == c2)
{
flag = true;
_strBuilder.Append(josiConversionRule.IsConvertToText1(inputStr[i - 1]) ? josiConversionRule.Text1 : josiConversionRule.Text2);
i++;
break;
}
}
if (!flag)
{
_strBuilder.Append(c);
}
}
return _strBuilder.ToString();
}
private static char? GetJongsung(char character)
{
if (character < '가' || '힣' < character)
{
return null;
}
return JONGSUNG_TABLE[(character - 44032) % JONGSUNG_TABLE.Length];
}
private static bool IsConvertToText1_common(char latestCharacter)
{
if (GetJongsung(latestCharacter).HasValue)
{
return true;
}
if ("013678".IndexOf(latestCharacter) >= 0)
{
return true;
}
return false;
}
private static bool IsConvertToText1_typeE(char latestCharacter)
{
char? jongsung = GetJongsung(latestCharacter);
if (jongsung.HasValue && jongsung.Value != 'ㄹ')
{
return true;
}
if ("036".IndexOf(latestCharacter) >= 0)
{
return true;
}
return false;
}
}

View File

@@ -0,0 +1,18 @@
using UnityEngine.SocialPlatforms;
namespace Cute;
public interface IAchievementCallback
{
void OnSignIn(bool success);
void OnSignOut();
void OnReleaseAchievement(bool success);
void OnProceedAchievement(bool success);
void OnLoadAchievements(IAchievement[] achievements);
void OnLoadAchievementDescriptions(IAchievementDescription[] descriptions);
}

View File

@@ -0,0 +1,20 @@
using System;
namespace Cute;
public interface ILocalKVS : IDisposable
{
string savePath { get; }
string Get(string key);
void Set(string key, string value);
void Delete(string key);
void DeleteAll();
void Transaction(Action block);
void Optimize();
}

View File

@@ -0,0 +1,281 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using Sqlite3Plugin;
namespace Cute;
public class LocalSqliteKVS : ILocalKVS, IDisposable
{
protected DBProxy _db;
protected PreparedQuery _keyQuery;
protected PreparedQuery _upsertQuery;
protected PreparedQuery _deleteQuery;
protected PreparedQuery _likeQuery;
protected PreparedQuery _selectAllQuery;
protected bool _enableCache;
protected Dictionary<string, string> _tableCache;
public string savePath => _db.dbPath;
protected LocalSqliteKVS(string path, bool enableCache)
{
try
{
string directoryName = Path.GetDirectoryName(path);
if (!Directory.Exists(directoryName))
{
Directory.CreateDirectory(directoryName);
}
_db = new DBProxy();
if (!_db.OpenWritable(path))
{
throw new ApplicationException($"Failed to open LocalKVS at {path}");
}
if (!_db.Exec("CREATE TABLE IF NOT EXISTS t (k TEXT NOT NULL, v TEXT NOT NULL, PRIMARY KEY(k));"))
{
throw new ApplicationException($"Failed to initialize LocalKVS at {path}");
}
_db.Exec("pragma cache_size=0");
_keyQuery = _db.PreparedQuery("SELECT v FROM t WHERE k=?;");
_upsertQuery = _db.PreparedQuery("REPLACE INTO t(k,v)VALUES(?,?);");
_deleteQuery = _db.PreparedQuery("DELETE FROM t WHERE k=?;");
_likeQuery = _db.PreparedQuery("SELECT k FROM t WHERE k LIKE ? ESCAPE '!';");
_selectAllQuery = _db.PreparedQuery("SELECT k FROM t;");
_enableCache = enableCache;
if (!_enableCache)
{
return;
}
using (Query query = _db.Query("SELECT COUNT(*) FROM t;"))
{
query.Step();
int capacity = query.GetInt(0);
_tableCache = new Dictionary<string, string>(capacity);
}
using Query query2 = _db.Query("SELECT k,v FROM t;");
while (query2.Step())
{
string text = query2.GetText(0);
string text2 = query2.GetText(1);
_tableCache[text] = text2;
}
}
catch (Exception ex)
{
Dispose();
throw ex;
}
}
public static LocalSqliteKVS Open(string path, bool enableCache)
{
return new LocalSqliteKVS(path, enableCache);
}
~LocalSqliteKVS()
{
Dispose();
}
public virtual void Dispose()
{
if (_db != null)
{
if (_keyQuery != null)
{
_keyQuery.Dispose();
_keyQuery = null;
}
if (_upsertQuery != null)
{
_upsertQuery.Dispose();
_upsertQuery = null;
}
if (_deleteQuery != null)
{
_deleteQuery.Dispose();
_deleteQuery = null;
}
if (_likeQuery != null)
{
_likeQuery.Dispose();
_likeQuery = null;
}
if (_selectAllQuery != null)
{
_selectAllQuery.Dispose();
_selectAllQuery = null;
}
_db.Dispose();
_db = null;
_tableCache = null;
}
}
public List<string> FindLike(string pattern)
{
List<string> list = new List<string>();
try
{
_likeQuery.BindText(1, pattern);
while (_likeQuery.Step())
{
list.Add(_likeQuery.GetText(0));
}
return list;
}
catch (Exception ex)
{
throw ex;
}
finally
{
_likeQuery.Reset();
}
}
public string EscapeLikePattern(string pattern)
{
return Regex.Replace(pattern, "[_%\\[!]", "!$0");
}
public void DisableCache()
{
_enableCache = false;
_tableCache = null;
}
public List<string> GetAll()
{
List<string> list = new List<string>();
try
{
while (_selectAllQuery.Step())
{
list.Add(_selectAllQuery.GetText(0));
}
return list;
}
catch (Exception ex)
{
throw ex;
}
finally
{
_selectAllQuery.Reset();
}
}
public string Get(string key)
{
if (_enableCache)
{
if (!_tableCache.TryGetValue(key, out var value))
{
return null;
}
return value;
}
try
{
_keyQuery.BindText(1, key);
if (_keyQuery.Step())
{
return _keyQuery.GetText(0);
}
return null;
}
catch (Exception ex)
{
throw ex;
}
finally
{
_keyQuery.Reset();
}
}
public void Set(string key, string value)
{
if (_enableCache)
{
_tableCache[key] = value;
}
try
{
_upsertQuery.BindText(1, key);
_upsertQuery.BindText(2, value);
_upsertQuery.Step();
}
catch (Exception ex)
{
throw ex;
}
finally
{
_upsertQuery.Reset();
}
}
public void Delete(string key)
{
if (_enableCache && !_tableCache.Remove(key))
{
return;
}
try
{
_deleteQuery.BindText(1, key);
_deleteQuery.Step();
}
catch (Exception ex)
{
throw ex;
}
finally
{
_deleteQuery.Reset();
}
}
public void Transaction(Action block)
{
if (!_db.Begin())
{
throw new ApplicationException("Failed to begin LocalKVS transaction");
}
try
{
block();
_db.Commit();
}
catch (Exception ex)
{
_db.Rollback();
throw ex;
}
}
public void DeleteAll()
{
_db.Exec("DELETE FROM t;");
if (_enableCache)
{
_tableCache.Clear();
}
}
public void Optimize()
{
_db.Vacuum();
}
}

View File

@@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
namespace Cute;
public class ManifestDatahashKVS : ILocalKVS, IDisposable
{
protected LocalSqliteKVS _kvs;
public string savePath => _kvs.savePath;
public ManifestDatahashKVS(string path)
{
_kvs = LocalSqliteKVS.Open(path, enableCache: true);
}
~ManifestDatahashKVS()
{
Dispose();
}
public virtual void Dispose()
{
if (_kvs != null)
{
_kvs.Dispose();
_kvs = null;
}
}
public string Get(string name)
{
string text = _kvs.Get(name);
return (text == null) ? "" : text;
}
public void Set(string name, string hash)
{
_kvs.Set(name, hash);
}
public void Set(Dictionary<string, string> _dictionary)
{
if (_dictionary.Count <= 0)
{
return;
}
foreach (KeyValuePair<string, string> item in _dictionary)
{
Set(item.Key, item.Value);
}
}
public void Delete(string name)
{
_kvs.Delete(name);
}
public void DeleteAll()
{
_kvs.DeleteAll();
Optimize();
}
public void DisableCache()
{
_kvs.DisableCache();
}
public void DeleteByList(List<string> _deleteList)
{
if (_deleteList.Count > 0)
{
Transaction(delegate
{
_deleteList.ForEach(Delete);
});
Optimize();
}
}
public void DeleteByPrefix(string prefix)
{
List<string> deleteList = _kvs.FindLike(_kvs.EscapeLikePattern(prefix) + "%");
if (deleteList.Count <= 0)
{
return;
}
Transaction(delegate
{
foreach (string item in deleteList)
{
Delete(item);
}
});
Optimize();
}
public List<string> GetAll()
{
return _kvs.GetAll();
}
public List<string> FindLike(string patternEscaped)
{
return _kvs.FindLike(patternEscaped);
}
public string EscapeLikePattern(string patternNoEscape)
{
return _kvs.EscapeLikePattern(patternNoEscape);
}
public void Optimize()
{
_kvs.Optimize();
}
public void Transaction(Action block)
{
_kvs.Transaction(block);
}
}

View File

@@ -0,0 +1,217 @@
using System;
using System.Collections;
using UnityEngine;
using Wizard;
namespace Cute;
public class MovieManager : MonoBehaviour, IManager
{
private string fileRootPath;
private string streamingAssetfileRootPath;
private MoviePlayer _player;
private float _volume = 1f;
private MovieSubtitles _movieSubtitles;
private IEnumerator Start()
{
Toolbox.MovieManager = this;
while (!CustomPreference.isPreferenceComplete)
{
yield return null;
}
fileRootPath = "file:///" + Application.persistentDataPath + "/";
streamingAssetfileRootPath = "file:///" + Application.streamingAssetsPath + "/";
}
private void CreateMoviePlayer()
{
GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("Prefab/Movie/MoviePlayer")) as GameObject;
gameObject.transform.parent = base.transform;
_player = gameObject.GetComponent<MoviePlayer>();
_player.SetVolume(_volume);
}
public void Load(string filename)
{
if (!_player)
{
CreateMoviePlayer();
}
_player.Load(fileRootPath + filename);
}
public void Unload()
{
if ((bool)_player)
{
UnityEngine.Object.Destroy(_player.gameObject);
}
}
public void Play()
{
if (IsReady() || IsPaused() || IsStopped())
{
_player.Play();
}
}
public void PlayWithSubtitles(string subtitlesCSV)
{
GameObject prefab = (GameObject)Resources.Load("UI/MovieSubtitles");
_movieSubtitles = NGUITools.AddChild(UIManager.GetInstance().UIManagerRoot.gameObject, prefab).GetComponent<MovieSubtitles>();
SetCallbackStart(delegate
{
_movieSubtitles.PlaySubtitles(subtitlesCSV);
});
Play();
}
public void Stop()
{
if (_movieSubtitles != null)
{
_movieSubtitles.Finish();
_movieSubtitles = null;
}
if (IsPlaying() || IsPaused())
{
_player.Stop();
}
}
public void Pause()
{
if (IsPlaying())
{
_player.Pause();
}
}
public void SetVolume(float volume)
{
_volume = volume;
if ((bool)_player)
{
_player.SetVolume(volume);
}
}
public int GetSeekPosition()
{
if (!_player)
{
return 0;
}
return _player.GetSeekPosition();
}
public int GetDuration()
{
if (!_player)
{
return 0;
}
return _player.GetDuration();
}
public int GetCurrentSeekPercent()
{
if (!_player)
{
return 0;
}
return _player.GetCurrentSeekPercent();
}
public void SeekTo(int seek)
{
if ((bool)_player)
{
_player.SeekTo(seek);
}
}
public bool IsReady()
{
if (!_player)
{
return false;
}
return _player.IsReady();
}
public bool IsPlaying()
{
if (!_player)
{
return false;
}
return _player.IsPlaying();
}
public bool IsPaused()
{
if (!_player)
{
return false;
}
return _player.IsPaused();
}
public bool IsStopped()
{
if (!_player)
{
return false;
}
return _player.IsStopped();
}
public bool IsFinished()
{
if (!_player)
{
return false;
}
return _player.IsFinished();
}
public bool IsError()
{
if (!_player)
{
return true;
}
return _player.IsError();
}
public void SetCallbackReady(Action callback)
{
if ((bool)_player)
{
_player.CallbackReady += callback;
}
}
public void SetCallbackStart(Action callback)
{
if ((bool)_player)
{
_player.CallbackStart += callback;
}
}
public void SetCallbackEnd(Action callback)
{
if ((bool)_player)
{
_player.CallbackEnd += callback;
}
}
}

View File

@@ -0,0 +1,155 @@
using System;
using CriWare;
using CriWare.CriMana;
using UnityEngine;
namespace Cute;
public class MoviePlayer : MonoBehaviour
{
[SerializeField]
private CriManaMovieMaterial _movieController;
[SerializeField]
private Camera _camera;
public event Action CallbackReady;
public event Action CallbackStart;
public event Action CallbackEnd;
private void Update()
{
if (_movieController.player == null)
{
return;
}
switch (_movieController.player.status)
{
case Player.Status.Playing:
if (this.CallbackStart != null)
{
this.CallbackStart();
this.CallbackStart = null;
}
break;
case Player.Status.PlayEnd:
Stop();
if (this.CallbackEnd != null)
{
this.CallbackEnd();
this.CallbackEnd = null;
}
break;
}
}
public void Load(string filePath)
{
filePath = filePath.Replace("file:///", "");
_movieController.maxFrameDrop = CriManaMovieMaterial.MaxFrameDrop.Ten;
_movieController.player.Stop();
_movieController.player.SetFile(null, filePath);
_movieController.player.Prepare();
if (this.CallbackReady != null)
{
this.CallbackReady();
this.CallbackReady = null;
}
}
public void Play()
{
_camera.enabled = true;
if (IsPaused())
{
_movieController.player.Pause(sw: false);
}
else
{
_movieController.player.Start();
}
}
public void Stop()
{
QualitySettings.vSyncCount = 0;
_camera.enabled = false;
_movieController.player.Stop();
}
public void Pause()
{
_movieController.player.Pause(!_movieController.player.IsPaused());
}
public void SetVolume(float volume)
{
_movieController.player.SetVolume(volume);
}
public int GetSeekPosition()
{
return (int)(_movieController.player.GetTime() / 1000);
}
public int GetDuration()
{
int totalFrames = (int)_movieController.player.movieInfo.totalFrames;
int num = (int)(_movieController.player.movieInfo.framerateN / 1000);
if (num == 0)
{
return -1;
}
return totalFrames / num * 1000;
}
public int GetCurrentSeekPercent()
{
return GetSeekPosition() / GetDuration() * 100;
}
public void SeekTo(int seek)
{
int num = (int)(_movieController.player.movieInfo.framerateN / 1000);
int seekPosition = seek * num / 1000;
_movieController.player.Stop();
_movieController.player.SetSeekPosition(seekPosition);
_movieController.player.Start();
}
public bool IsReady()
{
return _movieController.player.status == Player.Status.Ready;
}
public bool IsPlaying()
{
if (_movieController.player.status == Player.Status.Playing)
{
return !IsPaused();
}
return false;
}
public bool IsPaused()
{
return _movieController.player.IsPaused();
}
public bool IsStopped()
{
return _movieController.player.status == Player.Status.Stop;
}
public bool IsFinished()
{
return _movieController.player.status == Player.Status.PlayEnd;
}
public bool IsError()
{
return _movieController.player.status == Player.Status.Error;
}
}

View File

@@ -0,0 +1,36 @@
using System;
namespace Cute;
public class ParallelJob
{
private Action _action;
public bool isDone { get; private set; }
public static ParallelJob Dispatch(Action action)
{
ParallelJob parallelJob = new ParallelJob(action);
LeanThreadPool.Instance.AddJob(parallelJob);
return parallelJob;
}
private ParallelJob(Action action)
{
isDone = false;
_action = action;
}
internal void Run()
{
if (!isDone)
{
if (_action != null)
{
_action();
_action = null;
}
isDone = true;
}
}
}

View File

@@ -0,0 +1,69 @@
using Wizard;
namespace Cute;
public class PaymentPCFinishTask : NetworkTask
{
public class PaymentPCFinishParams : PostParams
{
public string product_id = "";
public string steam_app_id = "";
public string steam_order_id = "";
public string steam_user_country = "";
}
private CuteNetworkDefine.ApiType apiType = CuteNetworkDefine.ApiType.PaymentPCFinish;
public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}";
public void SetParameter(string ProductId, string StreamAppID = "", string SteamOrderId = "")
{
PaymentPCFinishParams paymentPCFinishParams = new PaymentPCFinishParams();
paymentPCFinishParams.product_id = ProductId;
paymentPCFinishParams.steam_app_id = StreamAppID;
paymentPCFinishParams.steam_order_id = SteamOrderId;
paymentPCFinishParams.steam_user_country = PCPlatformSTEAM.Country;
base.Params = paymentPCFinishParams;
}
protected override int Parse()
{
int num = base.Parse();
if (num != 1)
{
return num;
}
if (base.ResponseData["data"].Count > 0)
{
if (base.ResponseData["data"]["purchased_times_data"] != null)
{
Data.Load.data._userCrystalCount._lastPaymentItemBuyNumber = base.ResponseData["data"]["purchased_times_data"]["number_of_product_purchased"].ToInt();
if (base.ResponseData["data"]["purchased_times_data"].Keys.Contains("csv_data_id"))
{
Data.Load.data._userCrystalCount._lastPaymentId = base.ResponseData["data"]["purchased_times_data"]["csv_data_id"].ToString();
}
}
else
{
Data.Load.data._userCrystalCount._lastPaymentItemBuyNumber = 0;
Data.Load.data._userCrystalCount._lastPaymentId = null;
}
Data.Load.data._userCrystalCount.total_crystal = base.ResponseData["data"]["after_free_crystal"].ToInt() + base.ResponseData["data"]["after_crystal"].ToInt();
Data.Load.data._userCrystalCount.free_crystal = base.ResponseData["data"]["after_free_crystal"].ToInt();
Data.Load.data._userCrystalCount.charge_crystal = base.ResponseData["data"]["after_crystal"].ToInt();
MyPageMenu.Instance.UpdateCrystalCount();
if (CreateItemList.GetInstance() != null)
{
CreateItemList.GetInstance().UpdateCrystalCount();
}
if (GachaUI.GetInstance() != null)
{
GachaUI.GetInstance().UpdateUserItemCount();
}
}
return num;
}
}

View File

@@ -0,0 +1,340 @@
using System.Collections;
using UnityEngine;
namespace Cute;
public class QualityManager : MonoBehaviour, IManager
{
public enum GPUQualityLevel
{
Level_1,
Level_2,
Level_3,
Level_4
}
public enum AssetQualityLevel
{
None,
Level_1,
Level_2,
Max
}
public enum SoundQualityLevel
{
None,
Level_1,
Level_2,
Max
}
public enum MovieQualityLevel
{
None,
Level_1,
Level_2,
Max
}
public enum MemoryQualityLevel
{
Level_1,
Level_2
}
public enum GameQualityLevel
{
Level_1,
Level_2,
Level_3,
Level_4
}
public enum OutLineLevel
{
OutLine_On,
OutLine_Off
}
private GPUQualityLevel _gpuQualityLevel;
private AssetQualityLevel _assetQualityLevel;
private SoundQualityLevel _soundQualityLevel;
private MovieQualityLevel _movieQualityLevel;
private MemoryQualityLevel _memoryQualityLevel;
private Vector2 _deviceResolution = Vector2.zero;
private Vector2 _gameResolution = Vector2.zero;
private int _defaultFrameRate = 60;
private bool _isDeviceResolutionSetting;
public bool isFullScreen;
private GameQualityLevel _gameQualityLevel;
private OutLineLevel _outlineLevel;
public Vector2 deviceResolution => _deviceResolution;
public Vector2 gameResolution => _gameResolution;
private void Awake()
{
UpdateFromUnity();
}
private IEnumerator Start()
{
while (Toolbox.SavedataManager == null)
{
yield return 0;
}
Initialize();
Toolbox.QualityManager = this;
}
private void OnDestroy()
{
}
public void Initialize()
{
CheckGPUQuality();
CheckMemoryQuality();
CheckAssetQuality();
CheckSoundQuality();
CheckMovieQuality();
InitializeGameQuality();
}
private void CheckGPUQuality()
{
_gpuQualityLevel = GPUQualityLevel.Level_4;
}
private void CheckMemoryQuality()
{
_memoryQualityLevel = MemoryQualityLevel.Level_2;
}
private void CheckAssetQuality()
{
_assetQualityLevel = ((_memoryQualityLevel == MemoryQualityLevel.Level_1) ? AssetQualityLevel.Level_1 : AssetQualityLevel.Level_2);
SetAssetQualityLevel(_assetQualityLevel);
}
private void CheckSoundQuality()
{
int num = Toolbox.SavedataManager.GetInt("SOUNDQUALIY");
if (num != 0)
{
_soundQualityLevel = (SoundQualityLevel)num;
}
else
{
_soundQualityLevel = ((_memoryQualityLevel == MemoryQualityLevel.Level_1) ? SoundQualityLevel.Level_1 : SoundQualityLevel.Level_2);
}
SetSoundQualityLevel(_soundQualityLevel);
}
private void CheckMovieQuality()
{
_movieQualityLevel = ((_memoryQualityLevel == MemoryQualityLevel.Level_1) ? MovieQualityLevel.Level_1 : MovieQualityLevel.Level_2);
}
public static GPUQualityLevel GetGPUQualityLevel()
{
if (Toolbox.QualityManager == null)
{
return GPUQualityLevel.Level_1;
}
return Toolbox.QualityManager._gpuQualityLevel;
}
public static MemoryQualityLevel GetMemoryQualityLevel()
{
if (Toolbox.QualityManager == null)
{
return MemoryQualityLevel.Level_1;
}
return Toolbox.QualityManager._memoryQualityLevel;
}
public static void SetAssetQualityLevel(AssetQualityLevel _AssetQualityLevel)
{
if (Toolbox.QualityManager != null)
{
Toolbox.QualityManager._assetQualityLevel = _AssetQualityLevel;
}
}
public static AssetQualityLevel GetAssetQualityLevel()
{
if (Toolbox.QualityManager == null)
{
return AssetQualityLevel.Level_1;
}
return Toolbox.QualityManager._assetQualityLevel;
}
public static void SetSoundQualityLevel(SoundQualityLevel _SoundQualityLevel)
{
if (Toolbox.QualityManager != null)
{
Toolbox.QualityManager._soundQualityLevel = _SoundQualityLevel;
Toolbox.SavedataManager.SetInt("SOUNDQUALIY", (int)Toolbox.QualityManager._soundQualityLevel);
}
}
public static SoundQualityLevel GetSoundQualityLevel()
{
if (Toolbox.QualityManager == null)
{
return SoundQualityLevel.Level_1;
}
return Toolbox.QualityManager._soundQualityLevel;
}
public static void SetMovieQualityLevel(MovieQualityLevel _MovieQualityLevel)
{
if (Toolbox.QualityManager != null)
{
Toolbox.QualityManager._movieQualityLevel = _MovieQualityLevel;
}
}
public static MovieQualityLevel GetMovieQualityLevel()
{
if (Toolbox.QualityManager == null)
{
return MovieQualityLevel.Level_1;
}
return Toolbox.QualityManager._movieQualityLevel;
}
public void LimitResolution()
{
_gameResolution = _deviceResolution;
if (_deviceResolution.x > 1280f || _deviceResolution.y > 1280f)
{
float num = 1280f / _deviceResolution.x;
_gameResolution = new Vector2(_deviceResolution.x * num, _deviceResolution.y * num);
Screen.SetResolution((int)_gameResolution.x, (int)_gameResolution.y, isFullScreen);
}
}
public void ChangeResolution(float rate, bool saveratio = true)
{
LimitResolution();
float num = _gameResolution.x * rate / _gameResolution.x;
_gameResolution = new Vector2(_gameResolution.x * num, _gameResolution.y * num);
Screen.SetResolution((int)_gameResolution.x, (int)_gameResolution.y, isFullScreen);
}
public void ChangeResolutionToDeviceSetting()
{
_gameResolution = _deviceResolution;
Screen.SetResolution((int)_gameResolution.x, (int)_gameResolution.y, isFullScreen);
}
public void ChangeResolution(float width, float height, bool fullscreen)
{
if (width == 0f || height == 0f)
{
width = Screen.width;
height = Screen.height;
}
isFullScreen = fullscreen;
_deviceResolution = new Vector2(width, height);
Screen.SetResolution((int)width, (int)height, fullscreen);
}
private void InitializeGameQuality()
{
if (_gpuQualityLevel == GPUQualityLevel.Level_4)
{
_gameQualityLevel = GameQualityLevel.Level_4;
}
else if (_gpuQualityLevel == GPUQualityLevel.Level_3)
{
_gameQualityLevel = GameQualityLevel.Level_3;
}
else if (_gpuQualityLevel == GPUQualityLevel.Level_2)
{
_gameQualityLevel = GameQualityLevel.Level_2;
}
else
{
_gameQualityLevel = GameQualityLevel.Level_1;
}
if (_memoryQualityLevel == MemoryQualityLevel.Level_1)
{
_gameQualityLevel = GameQualityLevel.Level_1;
}
if (!_isDeviceResolutionSetting)
{
_deviceResolution = new Vector2(Screen.width, Screen.height);
_isDeviceResolutionSetting = true;
}
if (_gpuQualityLevel <= GPUQualityLevel.Level_2 && Toolbox.SavedataManager.GetInt("SOUNDQUALIY") == 0)
{
SetSoundQualityLevel(SoundQualityLevel.Level_1);
}
DecideDeviceSetting();
}
private void DecideDeviceSetting()
{
string graphicsDeviceName = SystemInfo.graphicsDeviceName;
if (graphicsDeviceName.Contains("PowerVR") && graphicsDeviceName.Contains("SGX 540"))
{
_outlineLevel = OutLineLevel.OutLine_Off;
}
}
public void SetGameQualityLevel(GPUQualityLevel level)
{
_gpuQualityLevel = level;
}
public GameQualityLevel GetGameQualityLevel()
{
return _gameQualityLevel;
}
public void SetFrameRate(int frameRate)
{
_defaultFrameRate = frameRate;
}
public int GetFrameRate()
{
return _defaultFrameRate;
}
public void ChangeResolutionFixedHalf()
{
}
public void ChangeResolutionFixedBack()
{
}
public OutLineLevel GetOutLineLevel()
{
return _outlineLevel;
}
public void UpdateFromUnity()
{
isFullScreen = Screen.fullScreen;
_deviceResolution = new Vector2(Screen.width, Screen.height);
}
}

View File

@@ -0,0 +1,90 @@
using CodeStage.AntiCheat.ObscuredTypes;
using UnityEngine;
namespace Cute;
public class SavedataManager : MonoBehaviour, IManager
{
public const string RESOURCE_VERSION_KEY = "RES_VER";
public const string LANGUAGE_FIRST_SET = "LANG_FIRST_SET";
public const string LANGUAGE_KEY = "LANG_SETTING";
public const string LANGUAGE_SOUND_KEY = "LANG_SOUND_SETTING";
public const string LANGUAGE_FONT_KEY = "LANG_FONT";
public static string OMOTENASHI_COUNTRY_KEY = "OMOTE_COUNTRY";
public static string LANGUAGE_CHANGE = "LANG_CHANGE";
private void Start()
{
Toolbox.SavedataManager = this;
}
private void OnDestroy()
{
}
public void DeleteAll()
{
ObscuredPrefs.DeleteAll();
}
public void DeleteKey(string key)
{
ObscuredPrefs.DeleteKey(key);
}
public float GetFloat(string key, float defaultValue = 0f)
{
return ObscuredPrefs.GetFloat(key, defaultValue);
}
public void SetFloat(string key, float value)
{
ObscuredPrefs.SetFloat(key, value);
}
public int GetInt(string key, int defaultValue = 0)
{
return ObscuredPrefs.GetInt(key, defaultValue);
}
public void SetInt(string key, int value)
{
ObscuredPrefs.SetInt(key, value);
}
public string GetString(string key, string defaultValue = "")
{
return ObscuredPrefs.GetString(key, defaultValue);
}
public void SetString(string key, string value)
{
ObscuredPrefs.SetString(key, value);
}
public bool HasKey(string key)
{
return ObscuredPrefs.HasKey(key);
}
public void Save()
{
ObscuredPrefs.Save();
}
public void SetResourceVersion(string version)
{
SetString("RES_VER", version);
}
public string GetResourceVersion()
{
return GetString("RES_VER", "00000000");
}
}

View File

@@ -0,0 +1,72 @@
using LitJson;
using UnityEngine;
namespace Cute;
public class SignUpTask : NetworkTask
{
private class LoginPostParams : PostParams
{
public string device_name = "";
public string client_type = "";
public string os_version = "";
public string app_version = "";
public string resource_version = "";
public string carrier = "";
}
private CuteNetworkDefine.ApiType apiType;
public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}";
public void SetParameter()
{
LoginPostParams loginPostParams = new LoginPostParams();
loginPostParams.device_name = Toolbox.DeviceManager.GetModelName();
loginPostParams.client_type = Toolbox.DeviceManager.GetDeviceType().ToString();
loginPostParams.os_version = Toolbox.DeviceManager.GetOsVersion();
loginPostParams.app_version = Toolbox.DeviceManager.GetAppVersionName();
loginPostParams.resource_version = "00000000";
loginPostParams.carrier = Toolbox.DeviceManager.GetCarrier();
base.Params = loginPostParams;
}
protected override int Parse()
{
JsonData jsonData = base.ResponseData["data_headers"];
resultCode = jsonData["result_code"].ToInt();
if (resultCode != 1)
{
return resultCode;
}
int viewerId = jsonData["viewer_id"].ToInt();
int shortUdid = jsonData["short_udid"].ToInt();
string text = jsonData["udid"].ToString();
if (Certification.Udid != text)
{
Debug.LogError("udid一致しません。不正のアクセスです。");
}
else
{
Certification.ViewerId = viewerId;
Certification.ShortUdid = shortUdid;
Certification.SessionId = "";
AdjustManager.ViewerIDEvent();
GameObject gameObject = GameObject.Find("OmotePlugin");
if (gameObject != null)
{
OmotePlugin component = gameObject.GetComponent<OmotePlugin>();
if (component != null)
{
component.SendConversion(text);
}
}
}
return resultCode;
}
}

View File

@@ -0,0 +1,48 @@
using System;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Cute;
public static class SoftwareResetBase
{
public static bool isSoftwareReset;
private static Action resetAction;
public static bool IsSoftwareReset()
{
return isSoftwareReset;
}
public static void setSoftwareResetAction(Action _action)
{
resetAction = _action;
}
public static void SoftwareReset(string sceneName, Action _resetAction)
{
isSoftwareReset = true;
if (_resetAction != null)
{
resetAction = _resetAction;
}
resetAction.Call();
GameObject gameObject = GameObject.Find("OmotePlugin");
if (gameObject != null)
{
UnityEngine.Object.Destroy(gameObject);
}
Toolbox.BootSystem.VisibleBootCamera(enable: true);
GameObject gameObject2 = GameObject.Find("BootCamera");
if (gameObject2 != null)
{
gameObject2.transform.parent = null;
UnityEngine.Object.DontDestroyOnLoad(gameObject2);
BootSystem.isRootBootCamera = true;
}
Screen.sleepTimeout = -2;
BootApp.BootScene = sceneName;
UnityEngine.SceneManagement.SceneManager.LoadScene("_SoftwareReset");
}
}

View File

@@ -0,0 +1,17 @@
namespace Cute;
public struct SoundData
{
public string _acbName;
public string _cueName;
public int _cueId;
public SoundData(string acbName, string cueName, int cueId)
{
_acbName = acbName;
_cueName = cueName;
_cueId = cueId;
}
}

View File

@@ -0,0 +1,77 @@
using System;
using System.Collections;
using UnityEngine;
namespace Cute;
public class TimeData
{
private long serverTime;
private long connectClientTime;
public void Set(long setServerTime)
{
serverTime = setServerTime;
connectClientTime = (long)TimeNativePlugin.GetDeviceOperatingTime();
}
public DateTime GetNowTime()
{
return TimeUtil.GetNowTime(serverTime, connectClientTime);
}
public DateTime GetNowTime_UTC()
{
return TimeUtil.GetNowTime_UTC(serverTime, connectClientTime);
}
public float GetTimeLeftLong(long endTime)
{
return (float)TimeUtil.GetTimeLeft(serverTime, endTime, 0L).millisecond / 1000f;
}
[Obsolete("動作未検証", false)]
public IEnumerator StartTimeLeft(MonoBehaviour obj, long endTime, Action<TimeUtil.TimeLeftParam> callback)
{
IEnumerator enumerator = timeLeftCoroutine(callback, endTime, 0L);
obj.StartCoroutine(enumerator);
return enumerator;
}
[Obsolete("動作未検証", false)]
public IEnumerator StartTimeLeft(MonoBehaviour obj, long endTime, long consumingTime, Action<TimeUtil.TimeLeftParam> callback)
{
IEnumerator enumerator = timeLeftCoroutine(callback, endTime, consumingTime);
obj.StartCoroutine(enumerator);
return enumerator;
}
[Obsolete("動作未検証", false)]
public string GetNowTimeString()
{
DateTime nowTime = GetNowTime();
return $"{nowTime.Year:D4}-{nowTime.Month:D2}-{nowTime.Day:D2} {nowTime.Hour:D2}:{nowTime.Minute:D2}:{nowTime.Second:D2}";
}
[Obsolete("動作未検証", false)]
private TimeUtil.TimeLeftParam GetTimeLeft(long endTime, long consumingTime = 0L)
{
return TimeUtil.GetTimeLeft(TimeUtil.ToUnixTime(GetNowTime()), endTime, consumingTime);
}
[Obsolete("動作未検証", false)]
private IEnumerator timeLeftCoroutine(Action<TimeUtil.TimeLeftParam> callback, long endTime, long consumingTime = 0L)
{
while (true)
{
TimeUtil.TimeLeftParam timeLeft = GetTimeLeft(endTime, consumingTime);
callback(timeLeft);
if (timeLeft.isEnd)
{
break;
}
yield return null;
}
}
}

View File

@@ -0,0 +1,147 @@
using System;
namespace Cute;
public class TimeUtil
{
public struct TimeLeftParam
{
public int day;
public int hour;
public int minute;
public int second;
public int millisecond;
public int count;
public bool isEnd;
public bool isCharge;
public TimeLeftParam(long unixTime, long consumingTime)
{
if (unixTime <= 0)
{
isEnd = true;
count = 0;
day = 0;
hour = 0;
minute = 0;
second = 0;
millisecond = 0;
isCharge = true;
return;
}
isEnd = false;
if (consumingTime == 0L)
{
count = 0;
isCharge = false;
}
else
{
count = (int)(unixTime / consumingTime) + 1;
unixTime = unixTime - (count - 1) * consumingTime + 1;
if (unixTime == consumingTime)
{
isCharge = true;
}
else
{
isCharge = false;
}
}
day = (int)unixTime / 86400;
hour = (int)unixTime / 3600 % 24;
minute = (int)unixTime / 60 % 60;
second = (int)unixTime % 60;
millisecond = (int)unixTime % 1000;
}
public override string ToString()
{
return $"回数{count:D2}残り{day:D2}日 {hour:D2}:{minute:D2}:{second:D2}";
}
}
private static readonly DateTime UNIX_EPOCH = new DateTime(1970, 1, 1, 0, 0, 0, 0);
public const int DAY_HOUR = 24;
public const int DAY_SECOND = 86400;
public const int HOUR_SECOND = 3600;
public const int MINUTE_SECOND = 60;
public const int MILLI_SECOND = 1000;
public static DateTime GetNowTime(long serverTime, long connectClientTime)
{
return UNIX_EPOCH.AddSeconds((float)serverTime + TimeNativePlugin.GetDeviceOperatingTime() - (float)connectClientTime).ToLocalTime();
}
public static DateTime GetNowTime_UTC(long serverTime, long connectClientTime)
{
return UNIX_EPOCH.AddSeconds((float)serverTime + TimeNativePlugin.GetDeviceOperatingTime() - (float)connectClientTime);
}
public static DateTime GetAbsoluteTime()
{
return UNIX_EPOCH.AddSeconds(TimeNativePlugin.GetDeviceOperatingTime());
}
public static long ToUnixTime(string str)
{
if (str == null)
{
return 0L;
}
return ToUnixTime(DateTime.Parse(str));
}
public static long ToUnixTime(DateTime dateTime)
{
return (long)ToUnixTimeDouble(dateTime);
}
public static double ToUnixTimeDouble(DateTime dateTime)
{
dateTime = dateTime.ToUniversalTime();
return (dateTime - UNIX_EPOCH).TotalSeconds;
}
public static DateTime FromUnixTime(long unixTime)
{
return UNIX_EPOCH.AddSeconds(Convert.ToDouble(unixTime)).ToLocalTime();
}
public static DateTime MicroTimeToFromUnixTime(long unixTime)
{
return FromUnixTime(unixTime / 1000);
}
public static TimeLeftParam GetTimeLeft(long nowTime, long endTime, long consumingTime = 0L)
{
return new TimeLeftParam(endTime - nowTime, consumingTime);
}
public static long GetElapsedTime(DateTime baseDateTime, DateTime dateTime)
{
return ToUnixTime(dateTime) - ToUnixTime(baseDateTime);
}
public static TimeSpan GetElapsedTimeByTimeSpan(DateTime baseDateTime, DateTime dateTime)
{
return baseDateTime - dateTime;
}
public static bool IsTermTime(string startDate, string endDate, long checkTime = 0L)
{
return true;
}
}

View File

@@ -0,0 +1,65 @@
using System.Threading;
namespace Cute;
public class Toolbox
{
private enum SYSTEM_INIT
{
SYSTEM_NOT_READY,
SYSTEM_READY
}
public static bool isLoadFromLocal;
public static bool isLoadLocalSound;
public static BootSystem BootSystem;
public static BootNetwork BootNetwork;
public static SceneManager SceneManager;
public static NetworkManager NetworkManager;
public static AssetManager AssetManager;
public static SavedataManager SavedataManager;
public static DeviceManager DeviceManager;
public static QualityManager QualityManager;
public static ResourcesManager ResourcesManager;
public static AudioManager AudioManager;
public static MovieManager MovieManager;
public static DebugManager DebugManager;
public static Mutex mute;
public static void Clear()
{
BootSystem = null;
BootNetwork = null;
SceneManager = null;
NetworkManager = null;
AssetManager = null;
SavedataManager = null;
DeviceManager = null;
QualityManager = null;
ResourcesManager = null;
AudioManager = null;
}
public static bool isFrameWorkLoaded()
{
if (BootSystem != null && BootNetwork != null && SceneManager != null && NetworkManager != null && AssetManager != null && SavedataManager != null && DeviceManager != null && QualityManager != null && ResourcesManager != null && AudioManager != null)
{
return true;
}
return false;
}
}

View File

@@ -0,0 +1,180 @@
using UnityEngine;
namespace Cute;
public class URLScheme
{
private enum CPTYPE
{
IORI = 1,
ALIVE
}
private static string process = "";
private static string result = "";
private static string scheme = "";
private static int short_udid = 0;
private static string udid = "";
private static string error_code = "";
private static string campaign_data = "";
private static int app_type = 0;
private const string COMBINE = "combine";
private const string MIGRATION = "migration";
private const string OK = "ok";
private const string NG = "ng";
private const string IORI = "cg";
private const string ALIVE = "pc";
public const string EC_MIGRATION_CANCEL = "3070";
public const string EC_COMBINE_CANCEL = "3060";
public const string EC_MIGRATION_ALREADY_RECORDED = "3061";
public const string EC_COMBINE_NO_URL = "3054";
public const string EC_MIGRATION_NO_URL = "3063";
public const string EC_COMBINE_EXEC_HAVE_RECORD = "3057";
public static string CampaignData => campaign_data;
public static int AppType => app_type;
public static void URLSchemeStartAndroid()
{
GetURLSchemeParamsAndroid();
ProcessSetting();
}
public static void URLSchemeStartiOS(string message)
{
GetURLSchemeParamsiOS(message);
ProcessSetting();
}
public static bool IsCombineOK()
{
if (process == "combine" && result == "ok")
{
return short_udid == Certification.ShortUdid;
}
return false;
}
public static bool IsCombineNG()
{
if (process == "combine" && result == "ng")
{
return error_code != "";
}
return false;
}
public static bool IsMigrationOK()
{
if (process == "migration" && result == "ok")
{
return udid == Certification.Udid;
}
return false;
}
public static bool IsMigrationNG()
{
if (process == "migration" && result == "ng")
{
return error_code != "";
}
return false;
}
public static bool IsMigrationFinished()
{
if (process == "migration" && result == "ng")
{
return error_code == "3061";
}
return false;
}
public static void Clear()
{
scheme = "";
process = "";
result = "";
short_udid = 0;
udid = "";
error_code = "";
}
public static void ClearCampaignData()
{
campaign_data = "";
app_type = 0;
}
private static void GetURLSchemeParamsAndroid()
{
Clear();
}
private static void GetURLSchemeParamsiOS(string url)
{
Clear();
if (url == "")
{
url = PlayerPrefs.GetString("iOSUrlScheme", "");
PlayerPrefs.DeleteKey("iOSUrlScheme");
}
if (url.IndexOf("://") >= 0)
{
scheme = url.Substring(0, url.IndexOf("://"));
AnalysisResult(url.Substring(url.IndexOf("://") + 3));
}
}
private static void ProcessSetting()
{
if (!(scheme == ""))
{
if (IsCombineOK())
{
DataMigration.CombineSucceed();
}
else if (IsCombineNG())
{
DataMigration.CombineFailed();
}
else if (IsMigrationOK())
{
DataMigration.MigrationSucceed();
}
else if (IsMigrationNG())
{
DataMigration.MigrationFailed();
}
}
}
private static void AnalysisResult(string host)
{
if (scheme == "shadowverse")
{
UIManager.GetInstance().AccountTransferHelper.GetAppleData(host);
}
}
}

View File

@@ -0,0 +1,47 @@
using LitJson;
namespace Cute;
public class UpdateiCloudUserDataTask : NetworkTask
{
private class iCloudUserParams : PostParams
{
public string carrier = "";
public string icloud_data = "";
}
private CuteNetworkDefine.ApiType apiType = CuteNetworkDefine.ApiType.MigrateiCloudUser;
public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}";
public void SetParameter(string iCloudData)
{
iCloudUserParams iCloudUserParams = new iCloudUserParams();
iCloudUserParams.icloud_data = iCloudData;
iCloudUserParams.carrier = Toolbox.DeviceManager.GetCarrier();
base.Params = iCloudUserParams;
}
protected override int Parse()
{
if (resultCode != 1)
{
return base.Parse();
}
JsonData jsonData = base.ResponseData["data_headers"];
int viewerId = jsonData["viewer_id"].ToInt();
int shortUdid = jsonData["short_udid"].ToInt();
string text = jsonData["udid"].ToString();
if (Certification.Udid != text)
{
Debug.LogError("udid一致しません。不正のアクセスです。");
}
else
{
Certification.ViewerId = viewerId;
Certification.ShortUdid = shortUdid;
}
return resultCode;
}
}

View File

@@ -0,0 +1,276 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Wizard;
namespace Cute;
public class WebViewManager : MonoBehaviour
{
private static WebViewManager instance;
[SerializeField]
public WebViewScreen m_WebViewScreen;
private Action<string> onError;
private Action<string> onLoaded;
private Vector4 marginNow;
private float screenDpi;
private bool screenDpiChangedWhileInvisible;
private static readonly Dictionary<string, string> FontFamilyDict = new Dictionary<string, string>
{
{
Global.LANG_TYPE.Jpn.ToString(),
"font_jpn"
},
{
Global.LANG_TYPE.Kor.ToString(),
"font_kor"
},
{
Global.LANG_TYPE.Cht.ToString(),
"font_cht"
},
{
Global.LANG_TYPE.Chs.ToString(),
"font_chs"
}
};
public Action<string> Callback { get; set; }
public static bool HasInstance => instance != null;
public Action<string> OnError
{
set
{
onError = value;
}
}
public Action<string> OnLoaded
{
set
{
onLoaded = value;
}
}
public bool Visible { get; private set; }
public Action OnDpiChangedAction { private get; set; }
public static WebViewManager getInstance()
{
return instance;
}
private void UpdateScreenDpi()
{
screenDpi = Screen.dpi;
}
private bool IsScreenDpiChanged()
{
return Math.Abs(screenDpi - Screen.dpi) > 0.1f;
}
private void Awake()
{
instance = this;
SetMargins(Screen.width / 30, Screen.height / 5, Screen.width / 30, Screen.height / 14);
UpdateScreenDpi();
}
private void OnLoadedCallback(string msg)
{
if (onLoaded != null)
{
onLoaded(msg);
}
}
private string GetFontFamilyName()
{
if (!FontFamilyDict.TryGetValue(CustomPreference.GetTextLanguage(), out var value))
{
return "font_alphabet";
}
return value;
}
private void OnErrorCallback(string error)
{
if (onError != null)
{
onError(error);
}
}
private void OnApplicationFocus(bool focus)
{
if (focus && IsScreenDpiChanged())
{
UpdateScreenDpi();
if (Visible)
{
OnDpiChange();
}
else
{
screenDpiChangedWhileInvisible = true;
}
}
}
private void OnDpiChange()
{
if (OnDpiChangedAction != null)
{
OnDpiChangedAction();
}
Vector4 marginBackCoroutine = marginNow;
SetMargins((int)marginBackCoroutine.x, (int)marginBackCoroutine.y, (int)marginBackCoroutine.z - 1, (int)marginBackCoroutine.w - 1);
StartCoroutine(SetMarginBackCoroutine(marginBackCoroutine));
}
private IEnumerator SetMarginBackCoroutine(Vector4 oldMargin)
{
yield return new WaitForSecondsRealtime(0.5f);
SetMargins((int)oldMargin.x, (int)oldMargin.y, (int)oldMargin.z, (int)oldMargin.w);
}
public void ClearFontFilePaths()
{
}
private void OnDestroy()
{
instance = null;
ClearFontFilePaths();
}
public void InitCustomFontFileInfo(Dictionary<string, string> fileNamePathDict, int currentCustomFontFileIndex)
{
}
private void InitIOSCustomFont()
{
}
private void DisableIOSCustomFont()
{
}
public void OpenWeb(string url)
{
m_WebViewScreen.CurBoxCollider.enabled = true;
SetMargins(UIManager.GetInstance().UIManagerRoot, m_WebViewScreen);
LoadWeb(url);
SetVisible(visible: true);
}
public void LoadWeb(string url)
{
}
public void ClearHistory()
{
}
public void SetMargins(int leftMargin, int topMargin, int rightMargin, int bottomMargin)
{
marginNow = new Vector4(leftMargin, topMargin, rightMargin, bottomMargin);
}
public void SetMargins(UIRoot trgUIRoot, WebViewScreen trgScreen)
{
float arg = trgUIRoot.activeHeight;
Func<float, float, float, float, int> func = delegate(float deviceSize, float activeScreenSize, float screenSize, float pos)
{
screenSize += pos * 2f;
screenSize /= activeScreenSize;
screenSize = 1f - screenSize;
return (int)(screenSize * deviceSize * 0.5f);
};
Vector2 deviceResolution = Toolbox.QualityManager.deviceResolution;
float num = Mathf.Max(deviceResolution.x, deviceResolution.y);
BoxCollider curBoxCollider = trgScreen.CurBoxCollider;
int num2 = (int)(num - num * AspectCamera.SafeAreaRate);
int num3 = (int)(num * AspectCamera.SafeAreaRate) / 30 + num2 / 2;
int rightMargin = num3;
int topMargin = func(deviceResolution.y, arg, curBoxCollider.size.y, curBoxCollider.center.y);
int bottomMargin = func(deviceResolution.y, arg, curBoxCollider.size.y, 0f - curBoxCollider.center.y);
getInstance().SetMargins(num3, topMargin, rightMargin, bottomMargin);
}
public void UnloadWebView()
{
m_WebViewScreen.CurBoxCollider.enabled = false;
SetVisible(visible: false);
LoadWeb(CustomPreference.GetApplicationServerURL() + "information/blank");
Callback = null;
OnLoaded = null;
OnError = null;
}
public void DestroyWebViewObject()
{
}
public void EvaluateJS(string js)
{
}
public void SetVisible(bool visible)
{
Visible = visible;
if (visible && screenDpiChangedWhileInvisible)
{
screenDpiChangedWhileInvisible = false;
OnDpiChange();
}
}
public void ClearCaches()
{
}
public void Reload()
{
}
public bool CanGoBack()
{
return false;
}
public void GoBack()
{
}
public void Screenshot()
{
}
public void SetScreenshotData(int width, int height)
{
}
public void SetCallback(Action<string> cb)
{
Callback = cb;
}
public void CacheClear()
{
LoadWeb(CustomPreference.GetApplicationServerURL() + "information/blank");
}
}