add android platform build support
This commit is contained in:
@@ -15,8 +15,8 @@ public class LoadSound : ScriptableObject
|
||||
|
||||
public UmaSoundInfo getSoundPath(string name) {
|
||||
UmaSoundInfo info;
|
||||
info.acbPath = UmaViewerBuilder.GetABPath(Main.AbList.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("acb")));
|
||||
info.awbPath = UmaViewerBuilder.GetABPath(Main.AbList.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb")));
|
||||
info.acbPath = UmaDatabaseController.GetABPath(Main.AbList.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("acb")));
|
||||
info.awbPath = UmaDatabaseController.GetABPath(Main.AbList.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb")));
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,26 +56,33 @@ public class UmaDatabaseController
|
||||
/// Master Database Connection
|
||||
/// </summary>
|
||||
private SqliteConnection masterDb;
|
||||
|
||||
/// <summary>
|
||||
/// Loads the file database
|
||||
/// </summary>
|
||||
public UmaDatabaseController()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
try
|
||||
{
|
||||
metaDb = new SqliteConnection($@"Data Source=/data/data/jp.co.cygames.umamusume/files/meta;");
|
||||
masterDb = new SqliteConnection($@"Data Source=/data/data/jp.co.cygames.umamusume/files/master/master.mdb;");
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
metaDb = new SqliteConnection($@"Data Source={GetGameRootPath()}/meta;");
|
||||
masterDb = new SqliteConnection($@"Data Source={GetGameRootPath()}/master/master.mdb;");
|
||||
}
|
||||
else
|
||||
{
|
||||
metaDb = new SqliteConnection($@"Data Source={Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume\meta;");
|
||||
masterDb = new SqliteConnection($@"Data Source={Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume\master\master.mdb;");
|
||||
}
|
||||
metaDb.Open();
|
||||
MetaEntries = ReadMeta(metaDb);
|
||||
masterDb.Open();
|
||||
CharaData = ReadMaster(masterDb);
|
||||
}
|
||||
else
|
||||
catch
|
||||
{
|
||||
metaDb = new SqliteConnection($@"Data Source={Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume\meta;");
|
||||
masterDb = new SqliteConnection($@"Data Source={Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume\master\master.mdb;");
|
||||
UmaViewerUI.Instance.LyricsText.text = $"Database not found: \n{GetGameRootPath()}/meta\n{GetGameRootPath()}/master/master.mdb";
|
||||
UmaViewerUI.Instance.LyricsText.color = Color.red;
|
||||
}
|
||||
metaDb.Open();
|
||||
MetaEntries = ReadMeta(metaDb);
|
||||
masterDb.Open();
|
||||
CharaData = ReadMaster(masterDb);
|
||||
}
|
||||
|
||||
static IEnumerable<UmaDatabaseEntry> ReadMeta(SqliteConnection conn)
|
||||
@@ -120,4 +127,23 @@ public class UmaDatabaseController
|
||||
}
|
||||
//conn.Close();
|
||||
}
|
||||
|
||||
public static string GetABPath(UmaDatabaseEntry entry)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
return $"{GetGameRootPath()}/dat/{entry.Url.Substring(0, 2)}/{entry.Url}";
|
||||
}
|
||||
|
||||
return $"{GetGameRootPath()}\\dat\\{entry.Url.Substring(0, 2)}\\{entry.Url}";
|
||||
}
|
||||
|
||||
public static string GetGameRootPath()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
return Application.persistentDataPath;
|
||||
}
|
||||
return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\\Cygames\\umamusume";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
{
|
||||
List<AudioClip> clips = new List<AudioClip>();
|
||||
UmaViewerUI.Instance.LoadedAssetsAdd(awb);
|
||||
string awbPath = GetABPath(awb); ;
|
||||
string awbPath = UmaDatabaseController.GetABPath(awb); ;
|
||||
if (!File.Exists(awbPath)) return clips;
|
||||
|
||||
FileStream awbFile = File.OpenRead(awbPath);
|
||||
@@ -485,7 +485,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
UmaDatabaseEntry lyricsAsset = Main.AbList.FirstOrDefault(a => a.Name.Contains(lyricsVar));
|
||||
if (lyricsAsset != null)
|
||||
{
|
||||
string filePath = GetABPath(lyricsAsset);
|
||||
string filePath = UmaDatabaseController.GetABPath(lyricsAsset);
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
AssetBundle bundle;
|
||||
@@ -533,7 +533,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
Debug.Log("Loading " + entry.Name);
|
||||
if (Main.LoadedBundles.ContainsKey(entry.Name)) return;
|
||||
|
||||
string filePath = GetABPath(entry);
|
||||
string filePath = UmaDatabaseController.GetABPath(entry);
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
AssetBundle bundle = AssetBundle.LoadFromFile(filePath);
|
||||
@@ -856,13 +856,5 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
UI.LoadedAssetsClear();
|
||||
}
|
||||
|
||||
public static string GetABPath(UmaDatabaseEntry entry)
|
||||
{
|
||||
if(Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
return $"/data/data/jp.co.cygames.umamusume/files/dat/{entry.Url.Substring(0, 2)}/{entry.Url}";
|
||||
}
|
||||
|
||||
return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\\Cygames\\umamusume\\dat\\{entry.Url.Substring(0, 2)}\\{entry.Url}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ public class UmaViewerMain : MonoBehaviour
|
||||
public static UmaViewerMain Instance;
|
||||
private UmaViewerUI UI => UmaViewerUI.Instance;
|
||||
private UmaViewerBuilder Builder => UmaViewerBuilder.Instance;
|
||||
|
||||
public JArray UmaCharaData;
|
||||
public JArray UmaLiveData;
|
||||
|
||||
@@ -30,11 +31,11 @@ public class UmaViewerMain : MonoBehaviour
|
||||
{
|
||||
Application.targetFrameRate = -1;
|
||||
Instance = this;
|
||||
AbList = UmaDatabaseController.Instance.MetaEntries.ToList();
|
||||
}
|
||||
|
||||
IEnumerator Start()
|
||||
{
|
||||
AbList = UmaDatabaseController.Instance.MetaEntries.ToList();
|
||||
yield return UmaViewerDownload.DownloadText("https://www.tracenacademy.com/api/BasicCharaDataInfo", txt =>
|
||||
{
|
||||
UmaCharaData = JArray.Parse(txt);
|
||||
|
||||
@@ -77,10 +77,10 @@ public class UmaViewerUI : MonoBehaviour,FaceLoadCallBack
|
||||
public void LoadedAssetsAdd(UmaDatabaseEntry entry)
|
||||
{
|
||||
LoadedAssetCount++;
|
||||
string filePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\\Cygames\\umamusume\\dat\\{entry.Url.Substring(0, 2)}\\{entry.Url}";
|
||||
string filePath = UmaDatabaseController.GetABPath(entry);
|
||||
var container = Instantiate(UmaContainerAssetsPrefab, LoadedAssetsPanel).GetComponent<UmaUIContainer>();
|
||||
container.Name.text = Path.GetFileName(entry.Name) + "\n" + entry.Url;
|
||||
container.Button.onClick.AddListener(() => { Process.Start("explorer.exe", "/select," + filePath);});
|
||||
container.Button.onClick.AddListener(() => {Process.Start("explorer.exe", "/select," + filePath);});
|
||||
LoadedAssetsPanel.sizeDelta = new Vector2(0, LoadedAssetCount * 35);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user