improve assetbundles loading

This commit is contained in:
左右看
2023-07-02 00:47:02 +08:00
parent 1642fabc93
commit e19124cd2c
14 changed files with 127 additions and 60 deletions
@@ -28,6 +28,10 @@ namespace Gallop.Live.Cutt
private void Awake()
{
InitializeTimeLineData();
if (Director.instance)
{
Director.instance._liveTimelineControl = this;
}
}
public void InitializeTimeLineData()
@@ -6,6 +6,7 @@ using System.Runtime.CompilerServices;
using UnityEngine;
using Gallop.Live.Cutt;
using static Director;
using UnityEditor.SceneManagement;
namespace Gallop.Live
{
@@ -150,11 +151,11 @@ namespace Gallop.Live
private const float LiveTotalTimeMargin = 0;
private const float MaxOutlineOffLength = 99999;
private const int FINALIZE_CAMERA_DEPTH = 19;
private static Director _instance;
private static Director _instance = null;
[SerializeField]
private Director.State _state;
private bool _isDestroyed;
private LiveTimelineControl _liveTimelineControl;
public LiveTimelineControl _liveTimelineControl; //Edited to public
private bool _isFinished;
private readonly RandomTable<float> _randomTable;
private RandomRatioTable _blinkLightRandomRatioTable;
@@ -167,7 +168,7 @@ namespace Gallop.Live
private bool _isEnableBloom;
private bool _isBloom;
private bool _isDof;
private StageController _stageController;
public StageController _stageController; //Edited to public
private bool _isEnabledStageController;
public RenderTexture[] MonitorTextureArray;
[SerializeField]
@@ -255,7 +256,7 @@ namespace Gallop.Live
private Vector3 _tempRateVector;
private Vector3 _tempAttachRateVector;
public static Director Instance { get; }
public static Director instance => _instance;
public static bool HasInstance { get; }
public LiveTimelineControl LiveTimelineControl { get; }
public Director.DisplayMode displayMode { get; set; }
@@ -303,18 +304,38 @@ namespace Gallop.Live
public static RegisterInfo[] EffectRegisterInfoArray { get; set; }
public static Dictionary<string, List<string>> FlashSeCueNameDict { get; set; }
//Testing
//
public LiveEntry live;
private const string CUTT_PATH = "cutt/cutt_son{0}/cutt_son{0}";
private const string STAGE_PATH = "3d/env/live/live{0}/pfb_env_live{0}_controller000";
private UmaViewerBuilder Builder => UmaViewerBuilder.Instance;
public List<Transform> charaObjs;
private void Awake()
{
if (live != null)
{
_instance = this;
Debug.Log(string.Format(CUTT_PATH, live.MusicId));
Debug.Log(live.BackGroundId);
Builder.LoadAssetPath(string.Format(CUTT_PATH, live.MusicId), this.gameObject.transform);
Builder.LoadAssetPath(string.Format(STAGE_PATH, live.BackGroundId), this.gameObject.transform);
//Make CharacterObject
var characterStandPos = this._liveTimelineControl.transform.Find("CharacterStandPos");
int counter = 0;
foreach (Transform trans in characterStandPos.GetComponentsInChildren<Transform>()) {
if (trans == characterStandPos)
{
continue;
}
var newObj = Instantiate(trans, this.transform);
newObj.gameObject.name = string.Format("CharacterObject{0}", counter);
charaObjs.Add(newObj.transform);
counter++;
};
}
}
}
@@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -7,12 +8,45 @@ namespace Gallop.Live
{
public class StageController : MonoBehaviour
{
[System.Serializable]
[Serializable]
public class StageObjectUnit
{
public string UnitName; // 0x10
public GameObject[] ChildObjects; // 0x18
public bool IsEnabled { get; set; }
public int UnitNameHash { get; set; }
public int[] ChildObjectNameHashArray { get; set; }
}
[SerializeField]
public class StageObjectSelect
{
public enum Condition
{
Random = 0,
Direct = 1
}
[SerializeField] // RVA: 0xEBE0 Offset: 0xEBE0 VA: 0x7FF85CCBEBE0
private string _prefabName; // 0x10
[SerializeField] // RVA: 0xEBE0 Offset: 0xEBE0 VA: 0x7FF85CCBEBE0
private StageController.StageObjectSelect.Condition _condition; // 0x18
[SerializeField] // RVA: 0xEBE0 Offset: 0xEBE0 VA: 0x7FF85CCBEBE0
private int _selectIndex; // 0x1C
[SerializeField] // RVA: 0xEBE0 Offset: 0xEBE0 VA: 0x7FF85CCBEBE0
private GameObject[] _stageObjectArray; // 0x20
private bool _isEnabled; // 0x28
}
[Serializable]
public class MipmapBias
{
public float _stage;
}
public List<GameObject> _stageObjects;
public StageController.StageObjectUnit[] _stageObjectUnits;
public StageController.StageObjectSelect[] _stageObjectSelects;
public List<GameObject> _audienceObjects;
public Vector3 _cyalumeOffsetPosition;
public List<Material> _washLightMaterials;
@@ -36,13 +70,17 @@ namespace Gallop.Live
private void Awake()
{
InitializeStage();
if (Director.instance)
{
Director.instance._stageController = this;
}
}
public void InitializeStage()
{
foreach (GameObject stage_part in _stageObjects)
{
Instantiate(stage_part, transform.parent);
Instantiate(stage_part, transform);
}
}
}