74 lines
2.0 KiB
C#
74 lines
2.0 KiB
C#
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
using UnityEngine.UI;
|
|
|
|
public class QuickHelp : MonoBehaviour
|
|
{
|
|
public GameObject content;
|
|
|
|
public Text contentText;
|
|
|
|
private int currentContentIndex = -1;
|
|
|
|
private bool isViewContent;
|
|
|
|
private void Start()
|
|
{
|
|
if (Gamepad.current != null)
|
|
{
|
|
base.gameObject.SetActive(value: false);
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
isViewContent = InputManager.quickHelp;
|
|
}
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
if (!isViewContent)
|
|
{
|
|
if (content.activeSelf)
|
|
{
|
|
currentContentIndex = -1;
|
|
content.SetActive(value: false);
|
|
}
|
|
return;
|
|
}
|
|
int num = 0;
|
|
if ((bool)FScriptsHandler.Instance.m_PlayerMain.currentRod)
|
|
{
|
|
if ((bool)FScriptsHandler.Instance.m_PlayerMain.currentRod.currentLure)
|
|
{
|
|
GameWaterSystem.FindWaterLevelAtLocation(FScriptsHandler.Instance.m_PlayerMain.currentRod.currentLure.transform.position, out var waterLevel);
|
|
num = ((FScriptsHandler.Instance.m_PlayerMain.currentRod.currentLure.transform.position.y > waterLevel + 0.1f) ? 1 : ((!FScriptsHandler.Instance.m_PlayerMain.underWaterCamera) ? 2 : 5));
|
|
}
|
|
else if ((bool)FScriptsHandler.Instance.m_PlayerMain.currentRod.currentHook)
|
|
{
|
|
GameWaterSystem.FindWaterLevelAtLocation(FScriptsHandler.Instance.m_PlayerMain.currentRod.currentHook.transform.position, out var waterLevel2);
|
|
num = ((FScriptsHandler.Instance.m_PlayerMain.currentRod.currentHook.transform.position.y > waterLevel2 + 0.1f) ? 1 : ((!FScriptsHandler.Instance.m_PlayerMain.underWaterCamera) ? 2 : 5));
|
|
}
|
|
if ((bool)FScriptsHandler.Instance.m_PlayerMain.currentRod.currentFish)
|
|
{
|
|
num = 3;
|
|
}
|
|
if ((bool)FScriptsHandler.Instance.m_PlayerMain.currentRod.currentFish && FScriptsHandler.Instance.m_PlayerMain.currentRod.currentFish.isGetFish)
|
|
{
|
|
num = 4;
|
|
}
|
|
}
|
|
if (num != currentContentIndex)
|
|
{
|
|
ShowContent(num);
|
|
}
|
|
}
|
|
|
|
private void ShowContent(int index)
|
|
{
|
|
content.SetActive(value: true);
|
|
contentText.GetComponent<LocalizationUIText>().SetKey("QUICK_HELP_STAGE_" + index);
|
|
currentContentIndex = index;
|
|
}
|
|
}
|