61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class TrophyRoomGUI : MonoBehaviour
|
|
{
|
|
public GameObject cursorParent;
|
|
|
|
public GameObject infoFishParent;
|
|
|
|
public Text infoFishName;
|
|
|
|
public Text infoFishWeight;
|
|
|
|
public Text infoFishLength;
|
|
|
|
public Text infoFishFishery;
|
|
|
|
public UIAquarium uiAquarium;
|
|
|
|
private void Start()
|
|
{
|
|
ShowCursor(false);
|
|
ShowFishInfo(null);
|
|
if (VRManager.IsVROn())
|
|
{
|
|
base.transform.parent = TrophyRoomManager.Instance.trophyPlayerVR.GetComponentInChildren<vp_FPCamera>(true).transform;
|
|
Canvas component = GetComponent<Canvas>();
|
|
component.renderMode = RenderMode.WorldSpace;
|
|
component.worldCamera = VRManager.Instance.eyeCenterTransform.GetComponent<Camera>();
|
|
GetComponent<CanvasScaler>().dynamicPixelsPerUnit = 10f;
|
|
RectTransform component2 = component.GetComponent<RectTransform>();
|
|
component2.localScale = Vector3.one * 0.0015f;
|
|
component2.anchoredPosition3D = new Vector3(0f, 0.2f, 0.6f);
|
|
component2.localRotation = Quaternion.identity;
|
|
}
|
|
uiAquarium.gameObject.SetActive(!VRManager.IsVROn());
|
|
}
|
|
|
|
public void ShowCursor(bool show)
|
|
{
|
|
cursorParent.SetActive(show);
|
|
}
|
|
|
|
public void ShowFishInfo(FishManager.FishDefinition fishDefinition)
|
|
{
|
|
infoFishParent.SetActive(fishDefinition != null);
|
|
if (fishDefinition != null)
|
|
{
|
|
infoFishName.text = Utilities.GetTranslation(fishDefinition.fishPrefab.fishName);
|
|
infoFishWeight.text = Utilities.GetTranslation("ENCYCLOPEDIA/WEIGHT") + ": " + ((fishDefinition.length != 0f) ? UtilitiesUnits.GetWeightString(fishDefinition.weight) : " -");
|
|
infoFishLength.text = Utilities.GetTranslation("ENCYCLOPEDIA/LENGTH") + ": " + ((fishDefinition.length != 0f) ? UtilitiesUnits.GetLengthString(fishDefinition.length) : " -");
|
|
infoFishFishery.text = Utilities.GetTranslation("ENCYCLOPEDIA/FISHERY") + ": " + ((fishDefinition.length != 0f) ? Utilities.GetTranslation(fishDefinition.fishery) : " -");
|
|
}
|
|
}
|
|
|
|
public bool TryClose()
|
|
{
|
|
return uiAquarium.TryClose();
|
|
}
|
|
}
|