You've already forked UniversalViewer
DanMachi:
-compatibility improvements Core: -simplified object and keyframe serialization -complicated assetbundle loading
This commit is contained in:
16
Assets/Scripts/SharedBasic/AssetBundleEntry.cs
Normal file
16
Assets/Scripts/SharedBasic/AssetBundleEntry.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class AssetBundleEntry
|
||||
{
|
||||
public string Name;
|
||||
public string FilePath;
|
||||
public AssetBundle AssetBundle;
|
||||
|
||||
public AssetBundleEntry(string name, string filePath, AssetBundle assetbundle)
|
||||
{
|
||||
Name = name;
|
||||
FilePath = filePath;
|
||||
AssetBundle = assetbundle;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/SharedBasic/AssetBundleEntry.cs.meta
Normal file
11
Assets/Scripts/SharedBasic/AssetBundleEntry.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28857a2859d816a4fac387b80257a306
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,19 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Error : MonoBehaviour
|
||||
{
|
||||
public static GameObject ErrorText;
|
||||
public static GameObject CanvasContent;
|
||||
public static Error Instance;
|
||||
public TMPro.TMP_Text LogPanelContent;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
ErrorText = Resources.Load(Strings.ErrorTextPrefab) as GameObject;
|
||||
CanvasContent = GameObject.Find(Strings.ErrorContent);
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
private static TMPro.TMP_Text _logPanelContent => Instance.LogPanelContent;
|
||||
private static int _messageMax = 50;
|
||||
private static int _messageCounter = 0;
|
||||
|
||||
public static void Log(Color color, string message, float time = 5)
|
||||
{
|
||||
Log(message, color, time);
|
||||
@@ -21,11 +23,29 @@ public class Error : MonoBehaviour
|
||||
|
||||
public static void Log(string message, Color color, float time = 5)
|
||||
{
|
||||
Debug.Log(message);
|
||||
if (CanvasContent == null) return;
|
||||
Text text = Instantiate(ErrorText, CanvasContent.transform).GetComponent<Text>();
|
||||
text.text = message;
|
||||
text.color = color;
|
||||
Destroy(text.gameObject, CanvasContent.transform.childCount+1 * time);
|
||||
switch (color)
|
||||
{
|
||||
case Color c when c.Equals(Color.red):
|
||||
Debug.LogError(message);
|
||||
break;
|
||||
case Color c when c.Equals(Color.yellow):
|
||||
Debug.LogWarning(message);
|
||||
break;
|
||||
default:
|
||||
Debug.Log(message);
|
||||
break;
|
||||
}
|
||||
|
||||
if (Instance == null || _logPanelContent == null) return;
|
||||
_messageCounter += 1;
|
||||
var log = _logPanelContent;
|
||||
var text = log.text + $"\n{_messageCounter}: <color=#{ColorUtility.ToHtmlStringRGB(color)}>{message}";
|
||||
var lines = text.Split('\n');
|
||||
if (lines.Length > _messageMax)
|
||||
{
|
||||
lines = lines.Skip(lines.Length - _messageMax).ToArray();
|
||||
text = string.Join("\n", lines);
|
||||
}
|
||||
log.text = text;
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,6 @@ public class Settings
|
||||
public static string AssetsUrl => Instance.assetsUrl;
|
||||
|
||||
public static string ScreenshotDirectory => Format(Instance.screenshotDirectory);
|
||||
public static string SavePoseDirectory => Format(Instance.savePoseDirectory);
|
||||
public static string SaveSceneDirectory => Format(Instance.saveSceneDirectory);
|
||||
public static string AssetsDirectory => Format(Instance.assetsDirectory);
|
||||
public static string AssetListDirectory => Format(Instance.assetListDirectory);
|
||||
public static string CacheDirectory => Format(Instance.cacheDirectory);
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
{
|
||||
"name": "SharedBasic"
|
||||
}
|
||||
"name": "SharedBasic",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
Reference in New Issue
Block a user