Merge pull request 'feature/optimate' (#394) from feature/optimate into develop
Reviewed-on: https://git.pthub.vn/Unity/perfect-world-unity/pulls/394
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:329ce992197e8e90aa8ecc86ad5a2e9d0e4516ae41630b0e0fb4b68080d9ba75
|
||||
size 303602
|
||||
oid sha256:f809da92f7a74929fe4911b38ecddcf5bfe0fa9f667ad04f6c927511246975ae
|
||||
size 308267
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:08dd99327890c9a20d09b1faadef16ad55b5a276d5080d744bfdc2f4191dceac
|
||||
size 111628
|
||||
oid sha256:7bb8ce7140f7f3652a200d0393561498e3ecdd8f4425bd2248e1ff000f225e5e
|
||||
size 106979
|
||||
|
||||
@@ -15,6 +15,8 @@ using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using BrewMonster.Scripts.UI.Inventory;
|
||||
using CSNetwork.Protocols.RPCData;
|
||||
|
||||
namespace BrewMonster.Scripts.Managers
|
||||
{
|
||||
@@ -166,6 +168,7 @@ namespace BrewMonster.Scripts.Managers
|
||||
ShowDetailPanel(false);
|
||||
ShowSplitPanel(false);
|
||||
RefreshAll();
|
||||
RefreshCharacterModelPreview();
|
||||
}
|
||||
|
||||
private void WireSplitUI()
|
||||
@@ -688,6 +691,7 @@ namespace BrewMonster.Scripts.Managers
|
||||
Debug.Log($"[InventoryUI] Equip request sent for item {currentSelectedItem.m_tid} from slot {currentSelectedSlot} to equip location {equipLocation}");
|
||||
// Refresh inventory after equip
|
||||
RefreshAll();
|
||||
RefreshCharacterModelPreview();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -713,6 +717,7 @@ namespace BrewMonster.Scripts.Managers
|
||||
Debug.Log($"[InventoryUI] Unequip request sent for item {currentSelectedItem.m_tid} from equip location {equipLocation} to inventory slot {emptySlot}");
|
||||
// Refresh inventory after unequip
|
||||
RefreshAll();
|
||||
RefreshCharacterModelPreview();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -738,6 +743,7 @@ namespace BrewMonster.Scripts.Managers
|
||||
|
||||
// Refresh inventory after drop
|
||||
RefreshAll();
|
||||
RefreshCharacterModelPreview();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1617,6 +1623,61 @@ namespace BrewMonster.Scripts.Managers
|
||||
return false;
|
||||
}
|
||||
|
||||
public void RefreshCharacterModelPreview()
|
||||
{
|
||||
var preview = PlayerModelPreview.Instance;
|
||||
if (preview != null)
|
||||
{
|
||||
RoleInfo roleInfo = BuildCurrentPreviewRoleInfo();
|
||||
if (roleInfo != null)
|
||||
{
|
||||
preview.ReloadRoleModel(roleInfo);
|
||||
}
|
||||
}
|
||||
|
||||
var inventoryPreview = FindFirstObjectByType<InventoryCharacterPreview>();
|
||||
if (inventoryPreview != null)
|
||||
{
|
||||
inventoryPreview.QueueRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
private RoleInfo BuildCurrentPreviewRoleInfo()
|
||||
{
|
||||
RoleInfo roleInfo = UnityGameSession.Instance != null ? UnityGameSession.Instance.GetRoleInfo() : null;
|
||||
if (roleInfo == null)
|
||||
return null;
|
||||
|
||||
RoleInfo snapshot = roleInfo.Clone();
|
||||
if (snapshot.equipment == null)
|
||||
snapshot.equipment = new List<GRoleInventory>();
|
||||
else
|
||||
snapshot.equipment.Clear();
|
||||
|
||||
CECHostPlayer host = CECGameRun.Instance?.GetHostPlayer();
|
||||
var equipInv = host?.GetInventory(InventoryConst.IVTRTYPE_EQUIPPACK);
|
||||
if (equipInv == null)
|
||||
return snapshot;
|
||||
|
||||
int size = equipInv.GetSize();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
EC_IvtrItem item = equipInv.GetItem(i, false);
|
||||
if (item == null)
|
||||
continue;
|
||||
|
||||
snapshot.equipment.Add(new GRoleInventory
|
||||
{
|
||||
id = (uint)item.GetTemplateID(),
|
||||
pos = i,
|
||||
count = item.GetCount(),
|
||||
max_count = Math.Max(1, item.GetPileLimitInstance())
|
||||
});
|
||||
}
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
private bool IsPointerOverDetailPanel(Vector2 screenPosition)
|
||||
{
|
||||
var panelRect = detailPanelRoot.transform as RectTransform;
|
||||
|
||||
@@ -6,7 +6,7 @@ using UnityEngine;
|
||||
|
||||
namespace BrewMonster.Scripts
|
||||
{
|
||||
public class PlayerModelPreview : MonoBehaviour
|
||||
public class PlayerModelPreview : MonoSingleton<PlayerModelPreview>
|
||||
{
|
||||
[SerializeField] private Transform modelRoot;
|
||||
|
||||
@@ -15,6 +15,9 @@ namespace BrewMonster.Scripts
|
||||
|
||||
private int _loadVersion;
|
||||
|
||||
private bool _hasRequestedPlayerModelId;
|
||||
private int _requestedPlayerModelId;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (modelRoot == null)
|
||||
@@ -51,20 +54,19 @@ namespace BrewMonster.Scripts
|
||||
|
||||
if (version != _loadVersion)
|
||||
{
|
||||
if (model != null)
|
||||
Destroy(model);
|
||||
Destroy(model);
|
||||
return;
|
||||
}
|
||||
|
||||
if (model == null)
|
||||
continue;
|
||||
|
||||
model.transform.SetParent(modelRoot, false);
|
||||
model.transform.localPosition = Vector3.zero;
|
||||
model.transform.localRotation = Quaternion.identity;
|
||||
model.SetActive(false);
|
||||
|
||||
playerModels.Add(model);
|
||||
playerModelIds.Add(role.roleid);
|
||||
|
||||
ApplyRequestedModelVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,13 +75,36 @@ namespace BrewMonster.Scripts
|
||||
/// </summary>
|
||||
public void ShowPlayerModel(int playerModelId)
|
||||
{
|
||||
//int n = Mathf.Min(playerModels.Count, playerModelIds.Count);
|
||||
//for (int i = 0; i < n; i++)
|
||||
//{
|
||||
// GameObject go = playerModels[i];
|
||||
// if (go == null)
|
||||
// continue;
|
||||
// go.SetActive(playerModelIds[i] == playerModelId);
|
||||
//}
|
||||
_hasRequestedPlayerModelId = true;
|
||||
_requestedPlayerModelId = playerModelId;
|
||||
|
||||
ApplyRequestedModelVisibility();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the visibility of player models based on the requested player model id.
|
||||
/// </summary>
|
||||
private void ApplyRequestedModelVisibility()
|
||||
{
|
||||
if(!_hasRequestedPlayerModelId)
|
||||
return;
|
||||
|
||||
int n = Mathf.Min(playerModels.Count, playerModelIds.Count);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
GameObject go = playerModels[i];
|
||||
if (go == null)
|
||||
if(go == null)
|
||||
continue;
|
||||
go.SetActive(playerModelIds[i] == playerModelId);
|
||||
|
||||
go.SetActive(playerModelIds[i] == _requestedPlayerModelId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,5 +335,14 @@ namespace BrewMonster.Scripts
|
||||
}
|
||||
return skeletonBuilder;
|
||||
}
|
||||
|
||||
public void ReloadRoleModel(RoleInfo roleInfo)
|
||||
{
|
||||
if (roleInfo == null)
|
||||
return;
|
||||
|
||||
ShowAllPlayerModels(new List<RoleInfo> { roleInfo });
|
||||
ShowPlayerModel(roleInfo.roleid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,64 +27,97 @@ namespace BrewMonster.Scripts.UI.Inventory
|
||||
[SerializeField] private Vector3 previewLocalPosition = Vector3.zero;
|
||||
[SerializeField] private Vector3 previewLocalEuler;
|
||||
[SerializeField] private Vector3 previewLocalScale = Vector3.one;
|
||||
[Tooltip("Copy the preview root layer onto the cloned hierarchy so the preview camera can isolate it.")]
|
||||
[SerializeField] private bool inheritPreviewLayer = true;
|
||||
|
||||
[Header("Camera Output")]
|
||||
[SerializeField] private Camera previewCamera;
|
||||
[SerializeField] private RawImage previewFrame;
|
||||
[SerializeField] private RenderTexture previewRenderTexture;
|
||||
[SerializeField] private bool autoFocusCamera = true;
|
||||
[SerializeField] private Vector3 cameraFocusOffset = new Vector3(0f, 1.5f, 0f);
|
||||
[SerializeField] private Vector3 cameraFocusOffset = new Vector3(0f, 0f, 0f);
|
||||
|
||||
[Header("Behaviour")]
|
||||
[Tooltip("Disable PlayerVisual/Animancer components on the clone so it stays in a frozen idle pose.")]
|
||||
[SerializeField] private bool freezeAnimation = true;
|
||||
[Header("Camera Framing")]
|
||||
[SerializeField] private float previewCameraDistance = 3.3f;
|
||||
[SerializeField] private Vector3 previewCameraOffset = new Vector3(0.15f, 0.8f, 0f);
|
||||
[SerializeField] private bool overrideFieldOfView = true;
|
||||
[SerializeField][Range(10f, 60f)] private float previewFieldOfView = 33f;
|
||||
|
||||
[SerializeField] private bool autoFrameByBounds = true;
|
||||
[SerializeField][Range(1f, 2f)] private float autoFramePadding = 1.15f;
|
||||
[SerializeField] private float minAutoCameraDistance = 1.25f;
|
||||
[SerializeField] private float maxAutoCameraDistance = 8f;
|
||||
|
||||
private bool _cameraStateCached;
|
||||
private Vector3 _cachedCameraPosition;
|
||||
private Quaternion _cachedCameraRotation;
|
||||
private float _cachedCameraFov;
|
||||
|
||||
//[Header("Behaviour")]
|
||||
//[Tooltip("Disable PlayerVisual/Animancer components on the clone so it stays in a frozen idle pose.")]
|
||||
//[SerializeField] private bool freezeAnimation = true;
|
||||
|
||||
private GameObject _previewInstance;
|
||||
private bool _refreshQueued;
|
||||
private int _lastOriginModelChildCount;
|
||||
private Transform _lastOriginModelRoot;
|
||||
private Camera _previewCamera;
|
||||
private PlayerModelPreview _playerModelPreview;
|
||||
private RenderTexture _cachedTargetTexture;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
if (previewRoot == null)
|
||||
{
|
||||
previewRoot = transform;
|
||||
}
|
||||
|
||||
TryBindPreviewSystem();
|
||||
TryBindHostPlayer();
|
||||
EnsureCameraBindings();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
TryBindPreviewSystem();
|
||||
EnsureCameraBindings();
|
||||
QueueRefresh();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
DestroyPreviewInstance();
|
||||
RestoreCameraTargetTexture();
|
||||
RestoreSharedCameraState();
|
||||
ReleasePreviewReference();
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
TryBindPreviewSystem();
|
||||
TryBindHostPlayer();
|
||||
|
||||
// Check if origin model structure has changed (equipment models are child objects)
|
||||
// This detects equipment changes in realtime since all equipment is attached as children
|
||||
var currentOriginRoot = ResolveSourceModelRoot();
|
||||
if (currentOriginRoot != null)
|
||||
Transform currentOriginRoot = ResolveSourceModelRoot();
|
||||
if (currentOriginRoot == null)
|
||||
{
|
||||
int currentChildCount = CountAllChildren(currentOriginRoot);
|
||||
|
||||
// Refresh if origin model changed or child count changed (equipment added/removed)
|
||||
if (_lastOriginModelRoot != currentOriginRoot || _lastOriginModelChildCount != currentChildCount)
|
||||
if (_previewInstance == null)
|
||||
{
|
||||
_lastOriginModelRoot = currentOriginRoot;
|
||||
_lastOriginModelChildCount = currentChildCount;
|
||||
QueueRefresh();
|
||||
}
|
||||
if(_refreshQueued)
|
||||
{
|
||||
_refreshQueued = false;
|
||||
BuildPreviewModel();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int currentChildCount = CountAllChildren(currentOriginRoot);
|
||||
|
||||
if (_lastOriginModelRoot != currentOriginRoot || _lastOriginModelChildCount != currentChildCount)
|
||||
{
|
||||
_lastOriginModelRoot = currentOriginRoot;
|
||||
_lastOriginModelChildCount = currentChildCount;
|
||||
QueueRefresh();
|
||||
}
|
||||
|
||||
if (_refreshQueued)
|
||||
@@ -92,6 +125,11 @@ namespace BrewMonster.Scripts.UI.Inventory
|
||||
_refreshQueued = false;
|
||||
BuildPreviewModel();
|
||||
}
|
||||
|
||||
if(_previewInstance != null)
|
||||
{
|
||||
EnsureCameraFocus(_previewInstance.transform);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Allows manual binding from external UI scripts.</summary>
|
||||
@@ -119,6 +157,23 @@ namespace BrewMonster.Scripts.UI.Inventory
|
||||
_refreshQueued = true;
|
||||
}
|
||||
|
||||
private void TryBindPreviewSystem()
|
||||
{
|
||||
if (_playerModelPreview == null)
|
||||
{
|
||||
_playerModelPreview = PlayerModelPreview.Instance;
|
||||
}
|
||||
|
||||
if (_playerModelPreview == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_previewCamera == null)
|
||||
{
|
||||
_previewCamera = _playerModelPreview.GetComponent<Camera>();
|
||||
}
|
||||
}
|
||||
|
||||
private void TryBindHostPlayer()
|
||||
{
|
||||
@@ -136,14 +191,40 @@ namespace BrewMonster.Scripts.UI.Inventory
|
||||
|
||||
private void EnsureCameraBindings()
|
||||
{
|
||||
if (previewCamera != null && previewRenderTexture != null)
|
||||
if (_previewCamera == null)
|
||||
{
|
||||
previewCamera.targetTexture = previewRenderTexture;
|
||||
TryBindPreviewSystem();
|
||||
}
|
||||
|
||||
if (previewFrame != null && previewCamera != null)
|
||||
if (_previewCamera == null || previewFrame == null)
|
||||
{
|
||||
previewFrame.texture = previewCamera.targetTexture;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_cachedTargetTexture == null)
|
||||
{
|
||||
_cachedTargetTexture = _previewCamera.targetTexture;
|
||||
}
|
||||
|
||||
if (previewRenderTexture != null)
|
||||
{
|
||||
_previewCamera.targetTexture = previewRenderTexture;
|
||||
}
|
||||
|
||||
if(previewFrame != null)
|
||||
previewFrame.texture = _previewCamera.targetTexture;
|
||||
}
|
||||
|
||||
private void RestoreCameraTargetTexture()
|
||||
{
|
||||
if (_previewCamera == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_cachedTargetTexture != null)
|
||||
{
|
||||
_previewCamera.targetTexture = _cachedTargetTexture;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,43 +235,41 @@ namespace BrewMonster.Scripts.UI.Inventory
|
||||
return;
|
||||
}
|
||||
|
||||
var sourceRoot = ResolveSourceModelRoot();
|
||||
Transform sourceRoot = ResolveSourceModelRoot();
|
||||
if (sourceRoot == null)
|
||||
{
|
||||
_previewInstance = null;
|
||||
_lastOriginModelRoot = null;
|
||||
_lastOriginModelChildCount = 0;
|
||||
|
||||
QueueRefresh();
|
||||
return;
|
||||
}
|
||||
|
||||
DestroyPreviewInstance();
|
||||
if (!sourceRoot.gameObject.activeSelf)
|
||||
{
|
||||
sourceRoot.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
_previewInstance = Instantiate(sourceRoot.gameObject, previewRoot, false);
|
||||
_previewInstance.name = $"{sourceRoot.name}_Preview";
|
||||
// Use resolved source root, not sourceModelRoot field directly.
|
||||
_previewInstance = sourceRoot.gameObject;
|
||||
Transform instanceTransform = _previewInstance.transform;
|
||||
|
||||
var instanceTransform = _previewInstance.transform;
|
||||
instanceTransform.localPosition = previewLocalPosition;
|
||||
if (instanceTransform.parent != previewRoot)
|
||||
{
|
||||
instanceTransform.SetParent(previewRoot, false);
|
||||
}
|
||||
|
||||
instanceTransform.localPosition = previewLocalPosition + Vector3.up;
|
||||
instanceTransform.localRotation = Quaternion.Euler(previewLocalEuler);
|
||||
instanceTransform.localScale = previewLocalScale;
|
||||
|
||||
if (inheritPreviewLayer)
|
||||
{
|
||||
ApplyLayerRecursive(instanceTransform, previewRoot.gameObject.layer);
|
||||
}
|
||||
|
||||
if (freezeAnimation)
|
||||
{
|
||||
DisableComponentInChildren<PlayerVisual>(_previewInstance);
|
||||
DisableComponentInChildren<AnimancerComponent>(_previewInstance);
|
||||
DisableComponentInChildren<Animator>(_previewInstance);
|
||||
FreezeAnimators(_previewInstance);
|
||||
}
|
||||
|
||||
if (cloneWholeHostHierarchy && stripRuntimeComponents)
|
||||
{
|
||||
StripRuntimeScripts(_previewInstance);
|
||||
}
|
||||
|
||||
ApplyLayerRecursive(instanceTransform, previewRoot.gameObject.layer);
|
||||
EnsureCameraFocus(instanceTransform);
|
||||
EnsureCameraBindings();
|
||||
}
|
||||
|
||||
|
||||
private Transform ResolveSourceModelRoot()
|
||||
{
|
||||
if (sourceModelRoot != null)
|
||||
@@ -198,54 +277,71 @@ namespace BrewMonster.Scripts.UI.Inventory
|
||||
return sourceModelRoot;
|
||||
}
|
||||
|
||||
if (hostPlayer == null)
|
||||
if (_playerModelPreview == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (cloneWholeHostHierarchy)
|
||||
// Prefer active model.
|
||||
for (int i = 0; i < _playerModelPreview.playerModels.Count; i++)
|
||||
{
|
||||
sourceModelRoot = hostPlayer.transform;
|
||||
return sourceModelRoot;
|
||||
}
|
||||
|
||||
var playerVisual = hostPlayer.GetComponentInChildren<PlayerVisual>(true);
|
||||
sourceModelRoot = playerVisual != null ? playerVisual.transform : hostPlayer.transform;
|
||||
return sourceModelRoot;
|
||||
}
|
||||
|
||||
private void DestroyPreviewInstance()
|
||||
{
|
||||
if (_previewInstance != null)
|
||||
{
|
||||
Destroy(_previewInstance);
|
||||
_previewInstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void DisableComponentInChildren<T>(GameObject root) where T : Behaviour
|
||||
{
|
||||
if (root == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var components = root.GetComponentsInChildren<T>(true);
|
||||
for (int i = 0; i < components.Length; i++)
|
||||
{
|
||||
var component = components[i];
|
||||
if (component == null)
|
||||
continue;
|
||||
|
||||
component.enabled = false;
|
||||
|
||||
if (component is PlayerVisual)
|
||||
GameObject model = _playerModelPreview.playerModels[i];
|
||||
if (model != null && model.activeSelf)
|
||||
{
|
||||
Destroy(component);
|
||||
return model.transform;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to first available model.
|
||||
for (int i = 0; i < _playerModelPreview.playerModels.Count; i++)
|
||||
{
|
||||
GameObject model = _playerModelPreview.playerModels[i];
|
||||
if (model != null)
|
||||
{
|
||||
return model.transform;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void ReleasePreviewReference()
|
||||
{
|
||||
_previewInstance = null;
|
||||
}
|
||||
|
||||
//private void DestroyPreviewInstance()
|
||||
//{
|
||||
// if (_previewInstance != null)
|
||||
// {
|
||||
// Destroy(_previewInstance);
|
||||
// _previewInstance = null;
|
||||
// }
|
||||
//}
|
||||
|
||||
//private static void DisableComponentInChildren<T>(GameObject root) where T : Behaviour
|
||||
//{
|
||||
// if (root == null)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// var components = root.GetComponentsInChildren<T>(true);
|
||||
// for (int i = 0; i < components.Length; i++)
|
||||
// {
|
||||
// var component = components[i];
|
||||
// if (component == null)
|
||||
// continue;
|
||||
|
||||
// component.enabled = false;
|
||||
|
||||
// if (component is PlayerVisual)
|
||||
// {
|
||||
// Destroy(component);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
private void ApplyLayerRecursive(Transform root, int layer)
|
||||
{
|
||||
if (root == null)
|
||||
@@ -262,70 +358,113 @@ namespace BrewMonster.Scripts.UI.Inventory
|
||||
|
||||
private void EnsureCameraFocus(Transform modelRoot)
|
||||
{
|
||||
if (!autoFocusCamera || previewCamera == null || modelRoot == null)
|
||||
if (_previewCamera == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var focusPoint = modelRoot.TransformPoint(cameraFocusOffset);
|
||||
|
||||
if (!_cameraStateCached)
|
||||
{
|
||||
_cachedCameraPosition = _previewCamera.transform.position;
|
||||
_cachedCameraRotation = _previewCamera.transform.rotation;
|
||||
_cachedCameraFov = _previewCamera.fieldOfView;
|
||||
_cameraStateCached = true;
|
||||
}
|
||||
|
||||
// Apply FOV override independently from auto focus.
|
||||
if (overrideFieldOfView)
|
||||
{
|
||||
_previewCamera.fieldOfView = previewFieldOfView;
|
||||
}
|
||||
|
||||
if (!autoFocusCamera || modelRoot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 focusPoint = modelRoot.TransformPoint(cameraFocusOffset) + previewCameraOffset;
|
||||
|
||||
Vector3 viewDirection = modelRoot.forward;
|
||||
viewDirection.y = 0f;
|
||||
if (viewDirection.sqrMagnitude < 0.0001f)
|
||||
{
|
||||
viewDirection = Vector3.back;
|
||||
}
|
||||
|
||||
viewDirection.Normalize();
|
||||
|
||||
_previewCamera.transform.position = focusPoint + viewDirection * previewCameraDistance;
|
||||
_previewCamera.transform.LookAt(focusPoint);
|
||||
}
|
||||
|
||||
private void StripRuntimeScripts(GameObject cloneRoot)
|
||||
//private void StripRuntimeScripts(GameObject cloneRoot)
|
||||
//{
|
||||
// if (cloneRoot == null)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// var monoBehaviours = cloneRoot.GetComponentsInChildren<MonoBehaviour>(true);
|
||||
// for (int i = 0; i < monoBehaviours.Length; i++)
|
||||
// {
|
||||
// var behaviour = monoBehaviours[i];
|
||||
// if (behaviour == null)
|
||||
// continue;
|
||||
|
||||
// Destroy(behaviour);
|
||||
// }
|
||||
|
||||
// var colliders = cloneRoot.GetComponentsInChildren<Collider>(true);
|
||||
// for (int i = 0; i < colliders.Length; i++)
|
||||
// {
|
||||
// var collider = colliders[i];
|
||||
// if (collider == null)
|
||||
// continue;
|
||||
|
||||
// Destroy(collider);
|
||||
// }
|
||||
|
||||
// var rigidbodies = cloneRoot.GetComponentsInChildren<Rigidbody>(true);
|
||||
// for (int i = 0; i < rigidbodies.Length; i++)
|
||||
// {
|
||||
// var body = rigidbodies[i];
|
||||
// if (body == null)
|
||||
// continue;
|
||||
|
||||
// Destroy(body);
|
||||
// }
|
||||
//}
|
||||
|
||||
private void RestoreSharedCameraState()
|
||||
{
|
||||
if (cloneRoot == null)
|
||||
if (!_cameraStateCached || _previewCamera == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var monoBehaviours = cloneRoot.GetComponentsInChildren<MonoBehaviour>(true);
|
||||
for (int i = 0; i < monoBehaviours.Length; i++)
|
||||
{
|
||||
var behaviour = monoBehaviours[i];
|
||||
if (behaviour == null)
|
||||
continue;
|
||||
|
||||
Destroy(behaviour);
|
||||
}
|
||||
|
||||
var colliders = cloneRoot.GetComponentsInChildren<Collider>(true);
|
||||
for (int i = 0; i < colliders.Length; i++)
|
||||
{
|
||||
var collider = colliders[i];
|
||||
if (collider == null)
|
||||
continue;
|
||||
|
||||
Destroy(collider);
|
||||
}
|
||||
|
||||
var rigidbodies = cloneRoot.GetComponentsInChildren<Rigidbody>(true);
|
||||
for (int i = 0; i < rigidbodies.Length; i++)
|
||||
{
|
||||
var body = rigidbodies[i];
|
||||
if (body == null)
|
||||
continue;
|
||||
|
||||
Destroy(body);
|
||||
}
|
||||
_previewCamera.transform.position = _cachedCameraPosition;
|
||||
_previewCamera.transform.rotation = _cachedCameraRotation;
|
||||
_previewCamera.fieldOfView = _cachedCameraFov;
|
||||
_cameraStateCached = false;
|
||||
}
|
||||
|
||||
private void FreezeAnimators(GameObject cloneRoot)
|
||||
{
|
||||
if (cloneRoot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//private void FreezeAnimators(GameObject cloneRoot)
|
||||
//{
|
||||
// if (cloneRoot == null)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
var animators = cloneRoot.GetComponentsInChildren<Animator>(true);
|
||||
for (int i = 0; i < animators.Length; i++)
|
||||
{
|
||||
var animator = animators[i];
|
||||
if (animator == null)
|
||||
continue;
|
||||
// var animators = cloneRoot.GetComponentsInChildren<Animator>(true);
|
||||
// for (int i = 0; i < animators.Length; i++)
|
||||
// {
|
||||
// var animator = animators[i];
|
||||
// if (animator == null)
|
||||
// continue;
|
||||
|
||||
animator.speed = 0f;
|
||||
}
|
||||
}
|
||||
// animator.speed = 0f;
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Counts all children recursively in the transform hierarchy.
|
||||
|
||||
@@ -30,7 +30,6 @@ namespace BrewMonster.UI
|
||||
[SerializeField] private Button cancelButton;
|
||||
[SerializeField] private Button backButton;
|
||||
[SerializeField] private CDlgMessageBox messageBoxPrefab;
|
||||
[SerializeField] private PlayerModelPreview playerModelPreview;
|
||||
private CDlgMessageBox _messageBoxInstance;
|
||||
|
||||
private int _currentProfession = -1;
|
||||
@@ -403,12 +402,12 @@ namespace BrewMonster.UI
|
||||
}
|
||||
}
|
||||
|
||||
playerModelPreview.ShowAllPlayerModels(_roleInfos);
|
||||
PlayerModelPreview.Instance.ShowAllPlayerModels(_roleInfos);
|
||||
}
|
||||
|
||||
private void LoadShowModel(int prof, int gender)
|
||||
{
|
||||
playerModelPreview.ShowPlayerModel(prof * (int)Gender.NUM_GENDER + gender);
|
||||
PlayerModelPreview .Instance.ShowPlayerModel(prof * (int)Gender.NUM_GENDER + gender);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
using BrewMonster.Assets.PerfectWorld.Scripts.UI;
|
||||
using BrewMonster.Common;
|
||||
using BrewMonster.Managers;
|
||||
using BrewMonster.Scripts;
|
||||
using BrewMonster.Scripts.Managers;
|
||||
using BrewMonster.UI;
|
||||
using CSNetwork.GPDataType;
|
||||
using Cysharp.Threading.Tasks.Triggers;
|
||||
using PerfectWorld.Scripts.Managers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
public class TestEditBodyChar : AUIDialog
|
||||
{
|
||||
[Header("List Btn")]
|
||||
[SerializeField] private Button btn_dang_nguoi;
|
||||
[SerializeField] private Button btn_face;
|
||||
[SerializeField] private Button btn_eye;
|
||||
[SerializeField] private Button btn_nose_and_mouth;
|
||||
[SerializeField] private Button btn_hair;
|
||||
[SerializeField] private Button btn_cosplay;
|
||||
|
||||
[Header("List Box Of Edit")]
|
||||
[SerializeField] private GameObject box_dang_nguoi;
|
||||
[SerializeField] private GameObject box_face;
|
||||
[SerializeField] private GameObject box_eye;
|
||||
[SerializeField] private GameObject box_nose_and_mouth;
|
||||
[SerializeField] private GameObject box_hair;
|
||||
[SerializeField] private GameObject box_cosplay;
|
||||
|
||||
[Header("Box Dang Nguoi")]
|
||||
[SerializeField] private GameObject box_1;
|
||||
[SerializeField] private GameObject box_2;
|
||||
[SerializeField] private Button btn_save;
|
||||
[SerializeField] private Button btn_delete_and_setup;
|
||||
[SerializeField] private Button btn_random;
|
||||
[SerializeField] private Button btn_setting_advancde;
|
||||
[SerializeField] private Button btn_back;
|
||||
|
||||
[Header("Box Facae")]
|
||||
[SerializeField] private GameObject box_f_1;
|
||||
[SerializeField] private GameObject box_f_2;
|
||||
[SerializeField] private Button btn_setting_f_advancde;
|
||||
[SerializeField] private Button btn_back_f;
|
||||
|
||||
[Header("Box Eye")]
|
||||
[SerializeField] private GameObject box_e_1;
|
||||
[SerializeField] private GameObject box_e_2;
|
||||
[SerializeField] private Button btn_setting_e_advancde;
|
||||
[SerializeField] private Button btn_back_e;
|
||||
|
||||
[Header("Box Nose and Mouth")]
|
||||
[SerializeField] private GameObject box_n_1;
|
||||
[SerializeField] private GameObject box_n_2;
|
||||
[SerializeField] private Button btn_setting_n_advancde;
|
||||
[SerializeField] private Button btn_back_n;
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
btn_dang_nguoi.onClick.AddListener(OnClickBtnDangNguoi);
|
||||
btn_face.onClick.AddListener(OnClickBtnFace);
|
||||
btn_eye.onClick.AddListener(OnClickBtnEye);
|
||||
btn_nose_and_mouth.onClick.AddListener(OnClickBtnNoseAndMouth);
|
||||
btn_hair.onClick.AddListener(OnClickBtnHair);
|
||||
btn_cosplay.onClick.AddListener(OnClickBtnCosplay);
|
||||
|
||||
btn_setting_advancde.onClick.AddListener(OnClickAdvancedDangNguoi);
|
||||
btn_back.onClick.AddListener(OnClickBackDangNguoi);
|
||||
btn_setting_f_advancde.onClick.AddListener(OnClickAdvancedFace);
|
||||
btn_back_f.onClick.AddListener(OnClickBackFace);
|
||||
btn_setting_e_advancde.onClick.AddListener(OnClickAdvancedEye);
|
||||
btn_back_e.onClick.AddListener(OnClickBackEye);
|
||||
btn_setting_n_advancde.onClick.AddListener(OnClickAdvancedNoseAndMouth);
|
||||
btn_back_n.onClick.AddListener(OnClickBackNoseAndMouth);
|
||||
}
|
||||
|
||||
public override void OnDisable()
|
||||
{
|
||||
btn_dang_nguoi.onClick.RemoveListener(OnClickBtnDangNguoi);
|
||||
btn_face.onClick.RemoveListener(OnClickBtnFace);
|
||||
btn_eye.onClick.RemoveListener(OnClickBtnEye);
|
||||
btn_nose_and_mouth.onClick.RemoveListener(OnClickBtnNoseAndMouth);
|
||||
btn_hair.onClick.RemoveListener(OnClickBtnHair);
|
||||
btn_cosplay.onClick.RemoveListener(OnClickBtnCosplay);
|
||||
btn_setting_advancde.onClick.RemoveListener(OnClickAdvancedDangNguoi);
|
||||
btn_back.onClick.RemoveListener(OnClickBackDangNguoi);
|
||||
btn_setting_f_advancde.onClick.RemoveListener(OnClickAdvancedFace);
|
||||
btn_back_f.onClick.RemoveListener(OnClickBackFace);
|
||||
btn_setting_e_advancde.onClick.RemoveListener(OnClickAdvancedEye);
|
||||
btn_back_e.onClick.RemoveListener(OnClickBackEye);
|
||||
btn_setting_n_advancde.onClick.RemoveListener(OnClickAdvancedNoseAndMouth);
|
||||
btn_back_n.onClick.RemoveListener(OnClickBackNoseAndMouth);
|
||||
}
|
||||
|
||||
private void OnClickBtnDangNguoi()
|
||||
{
|
||||
box_dang_nguoi.SetActive(true);
|
||||
box_face.SetActive(false);
|
||||
box_eye.SetActive(false);
|
||||
box_nose_and_mouth.SetActive(false);
|
||||
box_hair.SetActive(false);
|
||||
box_cosplay.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnClickBtnFace()
|
||||
{
|
||||
box_dang_nguoi.SetActive(false);
|
||||
box_face.SetActive(true);
|
||||
box_eye.SetActive(false);
|
||||
box_nose_and_mouth.SetActive(false);
|
||||
box_hair.SetActive(false);
|
||||
box_cosplay.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnClickBtnEye()
|
||||
{
|
||||
box_dang_nguoi.SetActive(false);
|
||||
box_face.SetActive(false);
|
||||
box_eye.SetActive(true);
|
||||
box_nose_and_mouth.SetActive(false);
|
||||
box_hair.SetActive(false);
|
||||
box_cosplay.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnClickBtnNoseAndMouth()
|
||||
{
|
||||
box_dang_nguoi.SetActive(false);
|
||||
box_face.SetActive(false);
|
||||
box_eye.SetActive(false);
|
||||
box_nose_and_mouth.SetActive(true);
|
||||
box_hair.SetActive(false);
|
||||
box_cosplay.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnClickBtnHair()
|
||||
{
|
||||
box_dang_nguoi.SetActive(false);
|
||||
box_face.SetActive(false);
|
||||
box_eye.SetActive(false);
|
||||
box_nose_and_mouth.SetActive(false);
|
||||
box_hair.SetActive(true);
|
||||
box_cosplay.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnClickBtnCosplay()
|
||||
{
|
||||
box_dang_nguoi.SetActive(false);
|
||||
box_face.SetActive(false);
|
||||
box_eye.SetActive(false);
|
||||
box_nose_and_mouth.SetActive(false);
|
||||
box_hair.SetActive(false);
|
||||
box_cosplay.SetActive(true);
|
||||
}
|
||||
|
||||
private void OnClickAdvancedDangNguoi()
|
||||
{
|
||||
box_1.SetActive(false);
|
||||
box_2.SetActive(true);
|
||||
}
|
||||
|
||||
private void OnClickBackDangNguoi()
|
||||
{
|
||||
box_1.SetActive(true);
|
||||
box_2.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnClickAdvancedFace()
|
||||
{
|
||||
box_f_1.SetActive(false);
|
||||
box_f_2.SetActive(true);
|
||||
}
|
||||
|
||||
private void OnClickBackFace()
|
||||
{
|
||||
box_f_1.SetActive(true);
|
||||
box_f_2.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnClickAdvancedEye()
|
||||
{
|
||||
box_e_1.SetActive(false);
|
||||
box_e_2.SetActive(true);
|
||||
}
|
||||
|
||||
private void OnClickBackEye()
|
||||
{
|
||||
box_e_1.SetActive(true);
|
||||
box_e_2.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnClickAdvancedNoseAndMouth()
|
||||
{
|
||||
box_n_1.SetActive(false);
|
||||
box_n_2.SetActive(true);
|
||||
}
|
||||
|
||||
private void OnClickBackNoseAndMouth()
|
||||
{
|
||||
box_n_1.SetActive(true);
|
||||
box_n_2.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ed6d61372d1789479a2ac3ad8eaf022
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 951489a2cb8c576469f156d0397b2811
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -500,10 +500,10 @@ RectTransform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7166820878650541780}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 588.35, y: -59.5}
|
||||
m_SizeDelta: {x: 85, y: 85}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &9112205963990496432
|
||||
CanvasRenderer:
|
||||
@@ -907,10 +907,10 @@ RectTransform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7166820878650541780}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 479.18, y: -59.5}
|
||||
m_SizeDelta: {x: 85, y: 85}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3997873020355048166
|
||||
CanvasRenderer:
|
||||
@@ -1069,138 +1069,6 @@ MonoBehaviour:
|
||||
m_FillOrigin: 2
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &633515748786992396
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5275130098495308601}
|
||||
- component: {fileID: 7874153745862569389}
|
||||
- component: {fileID: 3332719603249310962}
|
||||
m_Layer: 5
|
||||
m_Name: PreviewCamera
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5275130098495308601
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 633515748786992396}
|
||||
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 103}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6778274724352405780}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 1}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!20 &7874153745862569389
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 633515748786992396}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 2
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_Iso: 200
|
||||
m_ShutterSpeed: 0.005
|
||||
m_Aperture: 16
|
||||
m_FocusDistance: 10
|
||||
m_FocalLength: 50
|
||||
m_BladeCount: 5
|
||||
m_Curvature: {x: 2, y: 11}
|
||||
m_BarrelClipping: 0.25
|
||||
m_Anamorphism: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 38
|
||||
orthographic: 1
|
||||
orthographic size: 1
|
||||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 8400000, guid: 42c3c43cd0c3b704cb6cf0dd1051d9ff, type: 2}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!114 &3332719603249310962
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 633515748786992396}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_RenderShadows: 1
|
||||
m_RequiresDepthTextureOption: 2
|
||||
m_RequiresOpaqueTextureOption: 2
|
||||
m_CameraType: 0
|
||||
m_Cameras: []
|
||||
m_RendererIndex: -1
|
||||
m_VolumeLayerMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 1
|
||||
m_VolumeTrigger: {fileID: 0}
|
||||
m_VolumeFrameworkUpdateModeOption: 2
|
||||
m_RenderPostProcessing: 0
|
||||
m_Antialiasing: 0
|
||||
m_AntialiasingQuality: 2
|
||||
m_StopNaN: 0
|
||||
m_Dithering: 0
|
||||
m_ClearDepth: 1
|
||||
m_AllowXRRendering: 1
|
||||
m_AllowHDROutput: 1
|
||||
m_UseScreenCoordOverride: 0
|
||||
m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_RequiresDepthTexture: 0
|
||||
m_RequiresColorTexture: 0
|
||||
m_Version: 2
|
||||
m_TaaSettings:
|
||||
m_Quality: 3
|
||||
m_FrameInfluence: 0.1
|
||||
m_JitterScale: 1
|
||||
m_MipBias: 0
|
||||
m_VarianceClampScale: 0.9
|
||||
m_ContrastAdaptiveSharpening: 0
|
||||
--- !u!1 &644319246446733122
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1370,10 +1238,10 @@ RectTransform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7166820878650541780}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 370.01, y: -59.5}
|
||||
m_SizeDelta: {x: 85, y: 85}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4479228720555407959
|
||||
CanvasRenderer:
|
||||
@@ -5061,10 +4929,10 @@ RectTransform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7166820878650541780}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 42.5, y: -59.5}
|
||||
m_SizeDelta: {x: 85, y: 85}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7052320096474271168
|
||||
CanvasRenderer:
|
||||
@@ -11166,8 +11034,7 @@ RectTransform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5275130098495308601}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3289674559629147232}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
@@ -11231,13 +11098,14 @@ MonoBehaviour:
|
||||
previewLocalPosition: {x: 0, y: 0, z: 100}
|
||||
previewLocalEuler: {x: 0, y: 0, z: 0}
|
||||
previewLocalScale: {x: 1, y: 1, z: 1}
|
||||
inheritPreviewLayer: 1
|
||||
previewCamera: {fileID: 7874153745862569389}
|
||||
previewFrame: {fileID: 6707240765686952970}
|
||||
previewRenderTexture: {fileID: 8400000, guid: 42c3c43cd0c3b704cb6cf0dd1051d9ff, type: 2}
|
||||
autoFocusCamera: 1
|
||||
cameraFocusOffset: {x: 0, y: 0, z: 0}
|
||||
freezeAnimation: 1
|
||||
previewCameraDistance: 3.3
|
||||
previewCameraOffset: {x: 0.06, y: 1.07, z: 0}
|
||||
overrideFieldOfView: 1
|
||||
previewFieldOfView: 44
|
||||
--- !u!1 &5473020210238587200
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -14202,10 +14070,10 @@ RectTransform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7166820878650541780}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 151.67, y: -59.5}
|
||||
m_SizeDelta: {x: 85, y: 85}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4452551064742165538
|
||||
CanvasRenderer:
|
||||
@@ -19649,10 +19517,10 @@ RectTransform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7166820878650541780}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 260.84, y: -59.5}
|
||||
m_SizeDelta: {x: 85, y: 85}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5155025384962724770
|
||||
CanvasRenderer:
|
||||
@@ -20239,7 +20107,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7209086543831860202, guid: c56ed80641ff74ce49f91401e3eb8367, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -928.02
|
||||
value: -836.15
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8894405194986632892, guid: c56ed80641ff74ce49f91401e3eb8367, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
@@ -20259,7 +20127,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8894405194986632892, guid: c56ed80641ff74ce49f91401e3eb8367, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -464.01
|
||||
value: -418.075
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
|
||||
@@ -517,6 +517,7 @@ namespace BrewMonster
|
||||
if (ui != null)
|
||||
{
|
||||
ui.RefreshAll();
|
||||
ui.RefreshCharacterModelPreview();
|
||||
}
|
||||
|
||||
UpdateEquipSkins();
|
||||
|
||||
@@ -19,7 +19,6 @@ namespace BrewMonster.UI
|
||||
[SerializeField] private Button createCharacterButton;
|
||||
[SerializeField] private Button _btnEnterGame;
|
||||
[SerializeField] private CreateCharacterScreen createCharacterScreen;
|
||||
[SerializeField] private PlayerModelPreview playerModelPreview;
|
||||
|
||||
private CharacterItemUI _selectingCharacterItemUI;
|
||||
private Action<RoleInfo> _onClickItemChar;
|
||||
@@ -36,11 +35,11 @@ namespace BrewMonster.UI
|
||||
|
||||
if (_roleInfos != null && _roleInfos.Count > 0)
|
||||
{
|
||||
playerModelPreview?.ShowAllPlayerModels(_roleInfos);
|
||||
PlayerModelPreview.Instance?.ShowAllPlayerModels(_roleInfos);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerModelPreview?.ClearModels();
|
||||
PlayerModelPreview.Instance?.ClearModels();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,12 +122,12 @@ namespace BrewMonster.UI
|
||||
}
|
||||
|
||||
// Load player preview 3D models
|
||||
playerModelPreview?.ShowAllPlayerModels(roleInfos);
|
||||
PlayerModelPreview.Instance?.ShowAllPlayerModels(roleInfos);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (playerModelPreview != null)
|
||||
playerModelPreview.ShowAllPlayerModels(null);
|
||||
if (PlayerModelPreview.Instance != null)
|
||||
PlayerModelPreview.Instance.ShowAllPlayerModels(null);
|
||||
// If roleInfos is null, show createCharacterButton
|
||||
if (createCharacterButton != null)
|
||||
{
|
||||
@@ -152,9 +151,11 @@ namespace BrewMonster.UI
|
||||
_selectingCharacterItemUI = characterItemUI;
|
||||
_selectingCharacterItemUI.SetFocus(true);
|
||||
_btnEnterGame.gameObject.SetActive(true);
|
||||
_btnEnterGame.interactable = false; // Disable the button until the model is ready
|
||||
|
||||
if (playerModelPreview == null || characterItemUI.RoleInfo == null)
|
||||
if (PlayerModelPreview.Instance == null || characterItemUI.RoleInfo == null)
|
||||
{
|
||||
_btnEnterGame.interactable = true; // If we can't show the model, allow entering the game anyway
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -168,21 +169,23 @@ namespace BrewMonster.UI
|
||||
|
||||
private IEnumerator ShowSelectedModelWhenReady(int roleId)
|
||||
{
|
||||
while (isActiveAndEnabled && playerModelPreview != null)
|
||||
while (isActiveAndEnabled && PlayerModelPreview.Instance != null)
|
||||
{
|
||||
if (_pendingShowModelRoleId != roleId)
|
||||
{
|
||||
yield break; // Role changed, stop this coroutine
|
||||
}
|
||||
|
||||
if (playerModelPreview.playerModelIds != null && playerModelPreview.playerModelIds.Contains(roleId))
|
||||
if (PlayerModelPreview.Instance.playerModelIds != null && PlayerModelPreview.Instance.playerModelIds.Contains(roleId))
|
||||
{
|
||||
playerModelPreview.ShowPlayerModel(roleId);
|
||||
PlayerModelPreview.Instance.ShowPlayerModel(roleId);
|
||||
_btnEnterGame.interactable = true;
|
||||
_showModelReadyCoroutine = null;
|
||||
yield break; // Model is ready, show it and stop this coroutine
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
_btnEnterGame.interactable = true;
|
||||
_showModelReadyCoroutine = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user