ClientServer/Client/Assets/Scripts/UI/OnPreGameCanvas.cs

47 lines
1.1 KiB
C#
Raw Normal View History

2025-09-06 17:17:39 +04:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class OnPreGameCanvas : MonoBehaviour
{
[SerializeField] private Button backButton;
private void Start()
{
backButton.onClick.AddListener(CloseMenu);
}
private void OnEnable()
{
if (Player.Instance != null && !UIManager.Instance.loginScreen)
{
Player.Instance.updatePlayer = false;
Player.Instance.OnlyCastPlayerShadows(false);
Player.Instance.LockCursor(false);
Player.Instance.PlayerEntity.CurrentlyEquippedSkin.SkinActiveEvent?.Invoke();
}
}
private void CloseMenu()
{
UIManager.Instance.hideInterface(gameObject.name);
Player.Instance.UpdatePlayerOnMenuClose();
Player.Instance.OnlyCastPlayerShadows(true);
}
private void OnDisable()
{
if (gameObject.scene.isLoaded)
{
if (!UIManager.Instance.loginScreen)
{
Player.Instance.UpdatePlayerOnMenuClose();
Player.Instance.OnlyCastPlayerShadows(true);
}
}
}
}