1027 lines
30 KiB
C#
1027 lines
30 KiB
C#
using UFS2.Gameplay;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class HudManager : MonoBehaviour
|
|
{
|
|
public enum SelectorRodSetting
|
|
{
|
|
Speed = 0,
|
|
Drag = 1,
|
|
Leeder = 2
|
|
}
|
|
|
|
public GameObject RodSection;
|
|
|
|
public GameObject RodSetingsSelector;
|
|
|
|
public GameObject DayWeatherSection;
|
|
|
|
[SerializeField]
|
|
private Transform[] SelectorsItems;
|
|
|
|
public GameObject RodEquipedInfoBox;
|
|
|
|
public GameObject TensionBarsContent;
|
|
|
|
public Image[] ReelDragBoxesImage;
|
|
|
|
public Image[] ReelSpeedArrowsImage;
|
|
|
|
public Image[] HalfCirclesLineDetailImage;
|
|
|
|
public Image[] LineTensionWarningImage;
|
|
|
|
public Image[] RodTensionWarningImage;
|
|
|
|
public Image[] ReelTensionWarningImage;
|
|
|
|
public Text[] InfoDepthDistanceText;
|
|
|
|
public Text[] InfoDragSpeedText;
|
|
|
|
public Text LeaderLevelText;
|
|
|
|
public Text MethodLureText;
|
|
|
|
public Text CurrentSetNameText;
|
|
|
|
public Image CurrentSetBaitImage;
|
|
|
|
public Text CurrentSetBaitAmountText;
|
|
|
|
public Text CurrentSetHookText;
|
|
|
|
public Text CurrentSetLineText;
|
|
|
|
public Color[] HalfCirclesLineDetailColor;
|
|
|
|
public Color[] TensionNormalWarningColor;
|
|
|
|
public Color[] ReelSpeedArrowColor;
|
|
|
|
private FPlayer playermain;
|
|
|
|
private bool rodSectionVisable;
|
|
|
|
[HideInInspector]
|
|
public float lineCutTimer;
|
|
|
|
private float rodCutTimer;
|
|
|
|
private float reelCutTimer;
|
|
|
|
public FloatPointerUI floatPointerUi;
|
|
|
|
public SpinningPointerUI spinningPointerUi;
|
|
|
|
public FeederPointerUI feederPointerUi;
|
|
|
|
public WaterPointer waterPointer;
|
|
|
|
public FishCatchPanel fishCatchPanel;
|
|
|
|
public GameObject canvasThrowingBarPrefab;
|
|
|
|
[HideInInspector]
|
|
public CanvasThrowingBar currentCanvasThrowinigBar;
|
|
|
|
public Image getQCounterFill;
|
|
|
|
public Text timeAndDayText;
|
|
|
|
public Text temperatureText;
|
|
|
|
public Image weatherIconImage;
|
|
|
|
public GameObject getDropRodPrefab;
|
|
|
|
[HideInInspector]
|
|
public GetDropRodPanel currentGetDropPanel;
|
|
|
|
public GameObject getDropSupportPrefab;
|
|
|
|
private GetDropSupportPanel currentGetDropSupportPanel;
|
|
|
|
[SerializeField]
|
|
private GameObject leaveBoatPanelPrefab;
|
|
|
|
public GetDropRodPanel currentLeaveBoatPanel;
|
|
|
|
public GetDropRodPanel currentEnterBoatPanel;
|
|
|
|
public GetDropRodPanel currentTeleportBoatPanel;
|
|
|
|
public GetDropRodPanel currentSteerBoatPanel;
|
|
|
|
public SelectorRodSetting selectorRodSetting;
|
|
|
|
private string MethodLureLiftDrop = "";
|
|
|
|
private string MethodLureSlowLoftDrop = "";
|
|
|
|
private string MethodLureSlowStraight = "";
|
|
|
|
private string MethodLureStraight = "";
|
|
|
|
private string setEquipment = "";
|
|
|
|
private string lineStrenght = "";
|
|
|
|
public bool isInLeaveBoatCollider;
|
|
|
|
private int currentSelectorIndex;
|
|
|
|
private GameManager.PlayerData.CBaits bait;
|
|
|
|
private GameManager.PlayerData.CHooks hook;
|
|
|
|
private GameManager.PlayerData.CLines line;
|
|
|
|
private int baitId = -1;
|
|
|
|
private int hookId = -1;
|
|
|
|
private int lineId = -1;
|
|
|
|
private float lineLenght;
|
|
|
|
private float _DamageTimeThreshold = 2f;
|
|
|
|
private float _OverweightedMod = 3f;
|
|
|
|
private float _OverweightedDamageTimeThreshold = 1f;
|
|
|
|
public static float CurrentTensionLine01;
|
|
|
|
public static float CurrentTensionRod01;
|
|
|
|
public static float CurrentTensionReel01;
|
|
|
|
private void Start()
|
|
{
|
|
HalfCirclesLineDetailImage[0].color = HalfCirclesLineDetailColor[0];
|
|
HalfCirclesLineDetailImage[1].color = HalfCirclesLineDetailColor[1];
|
|
MethodLureLiftDrop = LanguageManager.Instance.GetText("LURE_METHOD_LIFT_DROP");
|
|
MethodLureSlowLoftDrop = LanguageManager.Instance.GetText("LURE_METHOD_SLOW_LIFT_DROP");
|
|
MethodLureSlowStraight = LanguageManager.Instance.GetText("LURE_METHOD_SLOW_STRAIGHT");
|
|
MethodLureStraight = LanguageManager.Instance.GetText("LURE_METHOD_STRAIGHT");
|
|
setEquipment = LanguageManager.Instance.GetText("SET_EQUIPMENT");
|
|
lineStrenght = LanguageManager.Instance.GetText("STRENGTH");
|
|
}
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
if (playermain != FScriptsHandler.Instance.m_PlayerMain)
|
|
{
|
|
playermain = FScriptsHandler.Instance.m_PlayerMain;
|
|
}
|
|
ShowHideCurrentRodSections();
|
|
FloatPointerController();
|
|
SpinningPointerController();
|
|
FeederPointerController();
|
|
if (InputManager.isQClicked)
|
|
{
|
|
if (ShouldQImageBeShowed())
|
|
{
|
|
getQCounterFill.fillAmount = (float)GameManager.Instance.player.GetButtonTimePressed("resetCast");
|
|
getQCounterFill.transform.parent.gameObject.SetActive(value: true);
|
|
getQCounterFill.GetComponentInChildren<Image>().enabled = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
getQCounterFill.fillAmount = 0f;
|
|
getQCounterFill.transform.parent.gameObject.SetActive(value: false);
|
|
getQCounterFill.GetComponentInChildren<Image>().enabled = false;
|
|
}
|
|
}
|
|
|
|
private bool ShouldQImageBeShowed()
|
|
{
|
|
return Singleton<InputManager>.Instance.CanResetCast();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if ((bool)playermain)
|
|
{
|
|
ChangeCurrentSelectorSets();
|
|
}
|
|
}
|
|
|
|
private void ChangeCurrentSelectorSets()
|
|
{
|
|
if (!RodSetingsSelector || !RodSetingsSelector.activeSelf || !playermain || !playermain.currentRod)
|
|
{
|
|
return;
|
|
}
|
|
if (currentSelectorIndex == 2 && !playermain.currentRod.currentFloat)
|
|
{
|
|
currentSelectorIndex = 0;
|
|
selectorRodSetting = (SelectorRodSetting)currentSelectorIndex;
|
|
RefreshSelectors();
|
|
}
|
|
if (currentSelectorIndex == 2 && (bool)playermain.currentRod.currentFloat && playermain.currentRod.fishingLine.currentLineHandler.PhisicsLineOut > 0f)
|
|
{
|
|
currentSelectorIndex = 0;
|
|
selectorRodSetting = (SelectorRodSetting)currentSelectorIndex;
|
|
RefreshSelectors();
|
|
}
|
|
if (!Input.GetMouseButtonDown(2))
|
|
{
|
|
return;
|
|
}
|
|
currentSelectorIndex++;
|
|
if ((bool)playermain.currentRod.currentFloat && !playermain.currentRod.currentFloat.waterDisplacement.IsInWater)
|
|
{
|
|
if (currentSelectorIndex == 3)
|
|
{
|
|
currentSelectorIndex = 0;
|
|
}
|
|
}
|
|
else if (currentSelectorIndex == 2)
|
|
{
|
|
currentSelectorIndex = 0;
|
|
}
|
|
selectorRodSetting = (SelectorRodSetting)currentSelectorIndex;
|
|
RefreshSelectors();
|
|
}
|
|
|
|
private void RefreshSelectors()
|
|
{
|
|
for (int i = 0; i < SelectorsItems.Length; i++)
|
|
{
|
|
if (currentSelectorIndex == i)
|
|
{
|
|
SelectorsItems[i].GetComponent<Image>().enabled = true;
|
|
}
|
|
else
|
|
{
|
|
SelectorsItems[i].GetComponent<Image>().enabled = false;
|
|
}
|
|
Text[] componentsInChildren = SelectorsItems[i].GetComponentsInChildren<Text>();
|
|
for (int j = 0; j < componentsInChildren.Length; j++)
|
|
{
|
|
if (currentSelectorIndex == i)
|
|
{
|
|
componentsInChildren[j].color = Color.black;
|
|
}
|
|
else
|
|
{
|
|
componentsInChildren[j].color = Color.white;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ShowHelpPanel()
|
|
{
|
|
if (GameManager.Instance._playerData.currentPlayerProfileIndex > -1 && !Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().HideStartHelpPanel)
|
|
{
|
|
GameManager.Instance._playerData.startHelpPanelViaStart = true;
|
|
GameManager.Instance.LoadAddectiveScene("Help");
|
|
}
|
|
}
|
|
|
|
public void ShowHideThrowingBar(bool visable, float value = 0f, float minValue = 0f)
|
|
{
|
|
if (!visable)
|
|
{
|
|
if (!(currentCanvasThrowinigBar == null))
|
|
{
|
|
currentCanvasThrowinigBar.barValue = 0f;
|
|
Object.Destroy(currentCanvasThrowinigBar.gameObject);
|
|
currentCanvasThrowinigBar = null;
|
|
}
|
|
}
|
|
else if (currentCanvasThrowinigBar == null)
|
|
{
|
|
currentCanvasThrowinigBar = Object.Instantiate(canvasThrowingBarPrefab, base.transform).GetComponent<CanvasThrowingBar>();
|
|
currentCanvasThrowinigBar.barMinValue = minValue;
|
|
currentCanvasThrowinigBar.barValue = 0f;
|
|
}
|
|
else
|
|
{
|
|
currentCanvasThrowinigBar.barValue = value;
|
|
}
|
|
}
|
|
|
|
public float StopThrowingBar()
|
|
{
|
|
if (currentCanvasThrowinigBar == null)
|
|
{
|
|
return 0f;
|
|
}
|
|
return currentCanvasThrowinigBar.GetComponent<CanvasThrowingBar>().Stop();
|
|
}
|
|
|
|
private void WaterPointerController()
|
|
{
|
|
if (Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().GameMode == GameManager.PlayerData.CPlayer.GameMode.Realistic)
|
|
{
|
|
if (!GameManager.Instance.isDevModeAllowed && waterPointer.gameObject.activeSelf)
|
|
{
|
|
waterPointer.gameObject.SetActive(value: false);
|
|
}
|
|
return;
|
|
}
|
|
if (!Singleton<SaveDataManager>.Instance.SettingsData.IsFishCursorEnabled)
|
|
{
|
|
if (waterPointer.gameObject.activeSelf)
|
|
{
|
|
waterPointer.gameObject.SetActive(value: false);
|
|
}
|
|
return;
|
|
}
|
|
if ((bool)playermain && (bool)playermain.m_Camera && !playermain.m_Camera.enabled)
|
|
{
|
|
if (waterPointer.gameObject.activeSelf)
|
|
{
|
|
waterPointer.gameObject.SetActive(value: false);
|
|
}
|
|
return;
|
|
}
|
|
if ((bool)playermain && !playermain.currentRod)
|
|
{
|
|
if (waterPointer.gameObject.activeSelf)
|
|
{
|
|
waterPointer.gameObject.SetActive(value: false);
|
|
}
|
|
return;
|
|
}
|
|
waterPointer.gameObject.SetActive(value: true);
|
|
if ((bool)playermain && (bool)playermain.currentRod && (bool)playermain.currentRod.currentLure)
|
|
{
|
|
if (!playermain.currentRod.currentLure.waterDisplacement.IsInWater)
|
|
{
|
|
waterPointer.worldPoint = playermain.currentRod.currentLure.transform.position;
|
|
}
|
|
else
|
|
{
|
|
waterPointer.worldPoint = new Vector3(playermain.currentRod.currentLure.transform.position.x, playermain.currentRod.currentLure.waterDisplacement.waterHeightPosition, playermain.currentRod.currentLure.transform.position.z);
|
|
}
|
|
}
|
|
if ((bool)playermain && (bool)playermain.currentRod && (bool)playermain.currentRod.currentHook)
|
|
{
|
|
if (!playermain.currentRod.currentHook.waterDisplacement.IsInWater)
|
|
{
|
|
waterPointer.worldPoint = playermain.currentRod.currentHook.transform.position;
|
|
}
|
|
else
|
|
{
|
|
waterPointer.worldPoint = new Vector3(playermain.currentRod.currentHook.transform.position.x, playermain.currentRod.currentHook.waterDisplacement.waterHeightPosition, playermain.currentRod.currentHook.transform.position.z);
|
|
}
|
|
}
|
|
waterPointer.lineStrenght = Mathf.Clamp(playermain.currentRod.fishingLine.CurrentLineTension / playermain.currentRod.fishingLine.lineStrenght, 0f, 1f);
|
|
}
|
|
|
|
private void FloatPointerController()
|
|
{
|
|
if (!playermain || !playermain.currentRod)
|
|
{
|
|
return;
|
|
}
|
|
if (!playermain.currentRod.currentFloat || !playermain.currentRod.currentHook)
|
|
{
|
|
if (LeaderLevelText.transform.parent.gameObject.activeSelf)
|
|
{
|
|
LeaderLevelText.transform.parent.gameObject.SetActive(value: false);
|
|
}
|
|
return;
|
|
}
|
|
if (!LeaderLevelText.transform.parent.gameObject.activeSelf)
|
|
{
|
|
LeaderLevelText.transform.parent.gameObject.SetActive(value: true);
|
|
}
|
|
else
|
|
{
|
|
LeaderLevelText.text = GameManager.Instance.ConvertLenghtWithUnit(playermain.currentRod.currentFloat.currentFloatDeepth);
|
|
}
|
|
if (!(playermain.currentRod.currentFloat.transform.position.y > playermain.currentRod.currentFloat.waterDisplacement.waterHeightPosition + 0.2f))
|
|
{
|
|
_ = (bool)playermain.currentRod.currentFish;
|
|
}
|
|
}
|
|
|
|
private void SpinningPointerController()
|
|
{
|
|
if (Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().GameMode == GameManager.PlayerData.CPlayer.GameMode.Realistic && spinningPointerUi.gameObject.activeSelf)
|
|
{
|
|
spinningPointerUi.gameObject.SetActive(value: false);
|
|
}
|
|
}
|
|
|
|
private void FeederPointerController()
|
|
{
|
|
if (Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().GameMode == GameManager.PlayerData.CPlayer.GameMode.Realistic && feederPointerUi.gameObject.activeSelf)
|
|
{
|
|
feederPointerUi.gameObject.SetActive(value: false);
|
|
}
|
|
}
|
|
|
|
private void ShowCurrentSetInfo()
|
|
{
|
|
if ((bool)fishCatchPanel)
|
|
{
|
|
RodEquipedInfoBox.SetActive(value: false);
|
|
return;
|
|
}
|
|
int indexOfslot = playermain.currentRod.indexOfslot;
|
|
if (indexOfslot == -1)
|
|
{
|
|
return;
|
|
}
|
|
if (Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerSlotsEquip[indexOfslot].bait.isNull)
|
|
{
|
|
if (RodEquipedInfoBox.activeSelf)
|
|
{
|
|
RodEquipedInfoBox.SetActive(value: false);
|
|
}
|
|
return;
|
|
}
|
|
RodEquipedInfoBox.SetActive(value: true);
|
|
if (baitId == -1 || baitId != Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerSlotsEquip[indexOfslot].bait.ID)
|
|
{
|
|
bait = Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerSlotsEquip[indexOfslot].bait;
|
|
baitId = bait.ID;
|
|
Sprite iconImage = GameManager.Instance.gameBaits[GameManager.Instance.GetIndexByItemId(GameManager.ItemType.Bait, bait.ID)].GetIconImage();
|
|
CurrentSetBaitImage.sprite = iconImage;
|
|
CurrentSetNameText.text = CurrentSetName();
|
|
CurrentSetBaitAmountText.text = "";
|
|
}
|
|
if (hookId == -1 || hookId != Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerSlotsEquip[indexOfslot].hook.ID)
|
|
{
|
|
hook = Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerSlotsEquip[indexOfslot].hook;
|
|
hookId = hook.ID;
|
|
if (!hook.isNull)
|
|
{
|
|
int gameItemIndexByItemId = GameManager.Instance._playerData.GetGameItemIndexByItemId(GameManager.ItemType.Hook, hook.ID);
|
|
CurrentSetHookText.text = GameManager.Instance.gameHooks[gameItemIndexByItemId].GetName() + " " + GameManager.Instance.gameHooks[gameItemIndexByItemId].GetSizetext();
|
|
}
|
|
else
|
|
{
|
|
CurrentSetHookText.text = GameManager.Instance.gameBaits[GameManager.Instance.GetIndexByItemId(GameManager.ItemType.Bait, bait.ID)].GetName();
|
|
}
|
|
}
|
|
if (lineId == -1 || lineId != Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerSlotsEquip[indexOfslot].line.ID || line.lenght != lineLenght)
|
|
{
|
|
line = Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerSlotsEquip[indexOfslot].line;
|
|
lineLenght = line.lenght;
|
|
lineId = line.ID;
|
|
if (!line.isNull)
|
|
{
|
|
int gameItemIndexByItemId2 = GameManager.Instance._playerData.GetGameItemIndexByItemId(GameManager.ItemType.Line, line.ID);
|
|
CurrentSetLineText.text = GameManager.Instance.gameLines[gameItemIndexByItemId2].name + "\n" + lineStrenght + " " + GameManager.Instance.ConvertWeight(GameManager.Instance.gameLines[gameItemIndexByItemId2].strength) + " / " + GameManager.Instance.ConvertLenghtWithUnit(line.lenght);
|
|
}
|
|
else
|
|
{
|
|
CurrentSetLineText.text = "<color=#ff0000>" + LanguageManager.Instance.GetText("LINE_EMPTY") + "</color>";
|
|
}
|
|
}
|
|
if ((bool)playermain.currentRod.currentLure)
|
|
{
|
|
switch (playermain.currentRod.currentLure.LureMoveType)
|
|
{
|
|
case FLure.MoveType.None:
|
|
MethodLureText.text = "";
|
|
break;
|
|
case FLure.MoveType.Opadający:
|
|
MethodLureText.text = MethodLureLiftDrop;
|
|
break;
|
|
case FLure.MoveType.PowolnyOpadający:
|
|
MethodLureText.text = MethodLureSlowLoftDrop;
|
|
break;
|
|
case FLure.MoveType.PowolnyWleczony:
|
|
MethodLureText.text = MethodLureSlowStraight;
|
|
break;
|
|
case FLure.MoveType.Wleczony:
|
|
MethodLureText.text = MethodLureStraight;
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MethodLureText.text = "";
|
|
}
|
|
}
|
|
|
|
public void ShowHideFishCatchPanel(bool visable = true, bool release = false)
|
|
{
|
|
if ((bool)fishCatchPanel && !visable)
|
|
{
|
|
playermain.SetMouseCursor(visable: false);
|
|
GameManager.Instance.SetMouseCurrsor(val: false);
|
|
if (release)
|
|
{
|
|
playermain.currentRod.currentFish.UnJoinFish(resetPosition: true);
|
|
playermain.DestroyCurrentFish();
|
|
if ((bool)playermain.currentAnglerFishView)
|
|
{
|
|
playermain.DestroyFishViewAngler();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
playermain.DestroyCurrentFish();
|
|
if ((bool)playermain.currentAnglerFishView)
|
|
{
|
|
playermain.DestroyFishViewAngler();
|
|
}
|
|
}
|
|
Object.Destroy(fishCatchPanel.gameObject);
|
|
fishCatchPanel = null;
|
|
}
|
|
else if (!fishCatchPanel)
|
|
{
|
|
playermain.SetMouseCursor(visable: true);
|
|
GameManager.Instance.SetMouseCurrsor(val: true);
|
|
fishCatchPanel = Object.Instantiate(FScriptsHandler.Instance.fishCatchPanel, base.transform.parent).GetComponent<FishCatchPanel>();
|
|
_ = FishEntity.CurrentFishInFight.Data.ID;
|
|
fishCatchPanel.fishWeight = FishEntity.CurrentFishInFight.Weight;
|
|
fishCatchPanel.fishFightTime = FishEntity.CurrentFishInFight.FightTime;
|
|
fishCatchPanel.fishID = FishEntity.CurrentFishInFight.Data.ID;
|
|
fishCatchPanel.playerMain = playermain;
|
|
fishCatchPanel.Initialize();
|
|
}
|
|
}
|
|
|
|
private void ShowHideCurrentRodSections()
|
|
{
|
|
if ((bool)fishCatchPanel)
|
|
{
|
|
RodSection.SetActive(value: false);
|
|
RodSetingsSelector.SetActive(value: false);
|
|
RodEquipedInfoBox.SetActive(value: false);
|
|
DayWeatherSection.SetActive(value: false);
|
|
}
|
|
else if (Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().GameMode == GameManager.PlayerData.CPlayer.GameMode.Realistic)
|
|
{
|
|
if (RodSection.activeSelf)
|
|
{
|
|
RodSection.SetActive(value: false);
|
|
}
|
|
if (playermain.currentRod != null)
|
|
{
|
|
if (!RodSetingsSelector.activeSelf)
|
|
{
|
|
RodSetingsSelector.SetActive(value: true);
|
|
}
|
|
ShowCurrentSetInfo();
|
|
ShowReelDragInfoLite();
|
|
ShowAllStrenghtBars();
|
|
}
|
|
else
|
|
{
|
|
if (RodSetingsSelector.activeSelf)
|
|
{
|
|
RodSetingsSelector.SetActive(value: false);
|
|
}
|
|
if (RodEquipedInfoBox.activeSelf)
|
|
{
|
|
RodEquipedInfoBox.SetActive(value: false);
|
|
}
|
|
}
|
|
}
|
|
else if ((bool)playermain && playermain.currentRod != null)
|
|
{
|
|
RodSection.SetActive(value: true);
|
|
RodSetingsSelector.SetActive(value: true);
|
|
ShowCurrentSetInfo();
|
|
ShowReelDragInfo();
|
|
ShowReelSpeedInfo();
|
|
ShowLineTensionHalfCircles();
|
|
ShowAllStrenghtBars();
|
|
ShowDepthAndDistanceInfo();
|
|
}
|
|
else if (RodSection.activeSelf)
|
|
{
|
|
RodSection.SetActive(value: false);
|
|
RodEquipedInfoBox.SetActive(value: false);
|
|
RodSetingsSelector.SetActive(value: false);
|
|
}
|
|
}
|
|
|
|
private void ShowDepthAndDistanceInfo()
|
|
{
|
|
if (!(playermain.currentRod == null) && (bool)playermain.currentRod.fishingLine && (bool)playermain.currentRod.LureHookWaterDisplacement)
|
|
{
|
|
if (playermain.currentRod.fishingLine.ropeToHookDistance > 0f)
|
|
{
|
|
InfoDepthDistanceText[0].text = GameManager.Instance.ConvertLenghtWithUnit(playermain.currentRod.LureHookWaterDisplacement.depth);
|
|
InfoDepthDistanceText[1].text = GameManager.Instance.ConvertLenghtWithUnit(playermain.currentRod.fishingLine.currentLineHandler.ObiLineOut);
|
|
}
|
|
else
|
|
{
|
|
InfoDepthDistanceText[0].text = "-";
|
|
InfoDepthDistanceText[1].text = "-";
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ShowReelDragInfo()
|
|
{
|
|
if (playermain.currentRod.currentReel == null)
|
|
{
|
|
return;
|
|
}
|
|
InfoDragSpeedText[0].text = (playermain.currentRod.currentReel.reelingDrag * 100f).ToString("F0") + " %";
|
|
float num = 1f / (float)ReelDragBoxesImage.Length;
|
|
int num2 = Mathf.RoundToInt(playermain.currentRod.currentReel.reelingDrag / num);
|
|
for (int i = 0; i < ReelDragBoxesImage.Length; i++)
|
|
{
|
|
if (num2 - 1 >= i)
|
|
{
|
|
ReelDragBoxesImage[i].enabled = true;
|
|
}
|
|
else
|
|
{
|
|
ReelDragBoxesImage[i].enabled = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ShowReelDragInfoLite()
|
|
{
|
|
if (!(playermain.currentRod.currentReel == null))
|
|
{
|
|
InfoDragSpeedText[0].text = (playermain.currentRod.currentReel.reelingDrag * 100f).ToString("F0") + " %";
|
|
InfoDragSpeedText[1].text = (playermain.currentRod.currentReel.reelingSpeed * 100f).ToString("F0") + " %";
|
|
}
|
|
}
|
|
|
|
private void ShowReelSpeedInfo()
|
|
{
|
|
if (playermain.currentRod.currentReel == null)
|
|
{
|
|
return;
|
|
}
|
|
InfoDragSpeedText[1].text = (playermain.currentRod.currentReel.reelingSpeed * 100f).ToString("F0") + " %";
|
|
float num = 1f / (float)ReelSpeedArrowsImage.Length;
|
|
int num2 = Mathf.RoundToInt(playermain.currentRod.currentReel.reelingSpeed / num);
|
|
for (int i = 0; i < ReelSpeedArrowsImage.Length; i++)
|
|
{
|
|
if (num2 - 1 >= i)
|
|
{
|
|
ReelSpeedArrowsImage[i].color = ReelSpeedArrowColor[1];
|
|
}
|
|
else
|
|
{
|
|
ReelSpeedArrowsImage[i].color = ReelSpeedArrowColor[0];
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ShowLineTensionHalfCircles()
|
|
{
|
|
if (!(playermain.currentRod.fishingLine == null))
|
|
{
|
|
float num = Mathf.Clamp(playermain.currentRod.fishingLine.linelenghtDiferent, -1f, 1f);
|
|
if (num > 0f)
|
|
{
|
|
HalfCirclesLineDetailImage[0].fillAmount = 0f;
|
|
HalfCirclesLineDetailImage[1].fillAmount = num;
|
|
}
|
|
else if (num < 0f)
|
|
{
|
|
HalfCirclesLineDetailImage[1].fillAmount = 0f;
|
|
HalfCirclesLineDetailImage[0].fillAmount = 0f - num;
|
|
}
|
|
else
|
|
{
|
|
HalfCirclesLineDetailImage[0].fillAmount = 0f;
|
|
HalfCirclesLineDetailImage[1].fillAmount = 0f;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ShowAllStrenghtBars()
|
|
{
|
|
if (!(playermain.currentRod == null))
|
|
{
|
|
ShowLineTensionBar();
|
|
ShowRodTensionBar();
|
|
ShowReelTensionBar();
|
|
}
|
|
}
|
|
|
|
private void ShowLineTensionBar()
|
|
{
|
|
if (!playermain.currentRod)
|
|
{
|
|
return;
|
|
}
|
|
FFishingLine fishingLine = playermain.currentRod.fishingLine;
|
|
FReel currentReel = playermain.currentRod.currentReel;
|
|
if (fishingLine == null || currentReel == null)
|
|
{
|
|
return;
|
|
}
|
|
float fixedDeltaTime = Time.fixedDeltaTime;
|
|
float num = fishingLine.lineStrenght;
|
|
float num2 = (playermain.currentRod.currentFishEntity ? playermain.currentRod.currentFishEntity.WeightTugging : 0f);
|
|
float linePullingForce = currentReel.LinePullingForce;
|
|
float value = Mathf.Min(fishingLine.CurrentLineTension, linePullingForce) / num;
|
|
value = Mathf.Clamp01(value);
|
|
CurrentTensionLine01 = Mathf.MoveTowards(CurrentTensionLine01, value, fixedDeltaTime);
|
|
int num3 = Mathf.RoundToInt((float)LineTensionWarningImage.Length * CurrentTensionLine01);
|
|
for (int i = 0; i < LineTensionWarningImage.Length; i++)
|
|
{
|
|
if (num3 - 1 >= i)
|
|
{
|
|
if (i >= 10)
|
|
{
|
|
LineTensionWarningImage[i].color = TensionNormalWarningColor[3];
|
|
}
|
|
else
|
|
{
|
|
LineTensionWarningImage[i].color = TensionNormalWarningColor[1];
|
|
}
|
|
}
|
|
else if (i >= 10)
|
|
{
|
|
LineTensionWarningImage[i].color = TensionNormalWarningColor[2];
|
|
}
|
|
else
|
|
{
|
|
LineTensionWarningImage[i].color = TensionNormalWarningColor[0];
|
|
}
|
|
}
|
|
bool flag = (bool)playermain.currentRod.currentFishEntity && playermain.currentRod.currentFishEntity.IsCatched;
|
|
if (num3 == LineTensionWarningImage.Length && !flag)
|
|
{
|
|
lineCutTimer += Time.deltaTime;
|
|
float num4 = ((num2 / num > _OverweightedMod) ? _OverweightedDamageTimeThreshold : _DamageTimeThreshold);
|
|
bool flag2 = Mathf.Min(num, playermain.currentRod.maxRodStrength, currentReel.maxReelStrength) == num;
|
|
if (lineCutTimer >= num4 && flag2)
|
|
{
|
|
playermain.currentRod.CutLine(destroyBaits: true);
|
|
lineCutTimer = 0f;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
lineCutTimer = 0f;
|
|
}
|
|
}
|
|
|
|
private void ShowRodTensionBar()
|
|
{
|
|
if (!playermain.currentRod)
|
|
{
|
|
return;
|
|
}
|
|
FRod currentRod = playermain.currentRod;
|
|
float fixedDeltaTime = Time.fixedDeltaTime;
|
|
float maxRodStrength = currentRod.maxRodStrength;
|
|
float num = (playermain.currentRod.currentFishEntity ? playermain.currentRod.currentFishEntity.WeightTugging : 0f);
|
|
float linePullingForce = currentRod.currentReel.LinePullingForce;
|
|
float value = Mathf.Min(currentRod.fishingLine.CurrentLineTension, linePullingForce) / maxRodStrength;
|
|
value = Mathf.Clamp01(value);
|
|
CurrentTensionRod01 = Mathf.MoveTowards(CurrentTensionRod01, value, fixedDeltaTime);
|
|
int num2 = Mathf.RoundToInt((float)RodTensionWarningImage.Length * CurrentTensionRod01);
|
|
for (int i = 0; i < RodTensionWarningImage.Length; i++)
|
|
{
|
|
if (num2 - 1 >= i)
|
|
{
|
|
if (i >= 10)
|
|
{
|
|
RodTensionWarningImage[i].color = TensionNormalWarningColor[3];
|
|
}
|
|
else
|
|
{
|
|
RodTensionWarningImage[i].color = TensionNormalWarningColor[1];
|
|
}
|
|
}
|
|
else if (i >= 10)
|
|
{
|
|
RodTensionWarningImage[i].color = TensionNormalWarningColor[2];
|
|
}
|
|
else
|
|
{
|
|
RodTensionWarningImage[i].color = TensionNormalWarningColor[0];
|
|
}
|
|
}
|
|
bool flag = (bool)playermain.currentRod.currentFishEntity && playermain.currentRod.currentFishEntity.IsCatched;
|
|
if (num2 == RodTensionWarningImage.Length && !flag)
|
|
{
|
|
rodCutTimer += Time.deltaTime;
|
|
float num3 = ((num / maxRodStrength > _OverweightedMod) ? _OverweightedDamageTimeThreshold : _DamageTimeThreshold);
|
|
bool flag2 = Mathf.Min(currentRod.fishingLine.lineStrenght, maxRodStrength, currentRod.currentReel.maxReelStrength) == maxRodStrength;
|
|
if (rodCutTimer >= num3 && flag2)
|
|
{
|
|
playermain.currentRod.Damage();
|
|
rodCutTimer = 0f;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
rodCutTimer = 0f;
|
|
}
|
|
}
|
|
|
|
private void ShowReelTensionBar()
|
|
{
|
|
if (!playermain.currentRod)
|
|
{
|
|
return;
|
|
}
|
|
FFishingLine fishingLine = playermain.currentRod.fishingLine;
|
|
FReel currentReel = playermain.currentRod.currentReel;
|
|
if (fishingLine == null || currentReel == null)
|
|
{
|
|
return;
|
|
}
|
|
float fixedDeltaTime = Time.fixedDeltaTime;
|
|
float maxReelStrength = currentReel.maxReelStrength;
|
|
float num = (playermain.currentRod.currentFishEntity ? playermain.currentRod.currentFishEntity.WeightTugging : 0f);
|
|
float linePullingForce = currentReel.LinePullingForce;
|
|
float value = Mathf.Min(fishingLine.CurrentLineTension, linePullingForce) / maxReelStrength;
|
|
value = Mathf.Clamp01(value);
|
|
CurrentTensionReel01 = Mathf.MoveTowards(CurrentTensionReel01, value, fixedDeltaTime);
|
|
int num2 = Mathf.RoundToInt((float)ReelTensionWarningImage.Length * CurrentTensionReel01);
|
|
for (int i = 0; i < ReelTensionWarningImage.Length; i++)
|
|
{
|
|
if (num2 - 1 >= i)
|
|
{
|
|
if (i >= 10)
|
|
{
|
|
ReelTensionWarningImage[i].color = TensionNormalWarningColor[3];
|
|
}
|
|
else
|
|
{
|
|
ReelTensionWarningImage[i].color = TensionNormalWarningColor[1];
|
|
}
|
|
}
|
|
else if (i >= 10)
|
|
{
|
|
ReelTensionWarningImage[i].color = TensionNormalWarningColor[2];
|
|
}
|
|
else
|
|
{
|
|
ReelTensionWarningImage[i].color = TensionNormalWarningColor[0];
|
|
}
|
|
}
|
|
bool flag = (bool)playermain.currentRod.currentFishEntity && playermain.currentRod.currentFishEntity.IsCatched;
|
|
if (num2 == ReelTensionWarningImage.Length && !flag)
|
|
{
|
|
reelCutTimer += Time.deltaTime;
|
|
float num3 = ((num / maxReelStrength > _OverweightedMod) ? _OverweightedDamageTimeThreshold : _DamageTimeThreshold);
|
|
bool flag2 = Mathf.Min(fishingLine.lineStrenght, playermain.currentRod.maxRodStrength, maxReelStrength) == maxReelStrength;
|
|
if (reelCutTimer >= num3 && flag2)
|
|
{
|
|
playermain.currentRod.currentReel.Damage();
|
|
reelCutTimer = 0f;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
reelCutTimer = 0f;
|
|
}
|
|
}
|
|
|
|
public void ShowGetDropPanel(bool hide, string infoText = "")
|
|
{
|
|
if (hide && (bool)currentGetDropPanel)
|
|
{
|
|
Object.Destroy(currentGetDropPanel.gameObject);
|
|
currentGetDropPanel = null;
|
|
}
|
|
else if (!hide && !currentGetDropPanel)
|
|
{
|
|
currentGetDropPanel = Object.Instantiate(getDropRodPrefab, FScriptsHandler.Instance.m_Canvas.transform).GetComponent<GetDropRodPanel>();
|
|
currentGetDropPanel.Set(infoText, "E", 1);
|
|
}
|
|
}
|
|
|
|
public void ShowGetDropSupportPanel(bool hide, int mouseIndex = 0, string infoText = "", string cancel = "")
|
|
{
|
|
if (hide && (bool)currentGetDropSupportPanel)
|
|
{
|
|
Object.Destroy(currentGetDropSupportPanel.gameObject);
|
|
currentGetDropSupportPanel = null;
|
|
}
|
|
else if (!hide && !currentGetDropSupportPanel)
|
|
{
|
|
currentGetDropSupportPanel = Object.Instantiate(getDropSupportPrefab, FScriptsHandler.Instance.m_Canvas.transform).GetComponent<GetDropSupportPanel>();
|
|
currentGetDropSupportPanel.Set(mouseIndex, infoText, cancel);
|
|
}
|
|
}
|
|
|
|
public void ShowLeaveBoatPanel(bool hide, string infoText = "")
|
|
{
|
|
if (hide && (bool)currentLeaveBoatPanel)
|
|
{
|
|
Object.Destroy(currentLeaveBoatPanel.gameObject);
|
|
currentLeaveBoatPanel = null;
|
|
}
|
|
else if (!hide)
|
|
{
|
|
if ((bool)currentLeaveBoatPanel)
|
|
{
|
|
currentLeaveBoatPanel.circleImage.fillAmount = 0f;
|
|
return;
|
|
}
|
|
infoText = LanguageManager.Instance.GetText("LEAVE_BOAT");
|
|
string key = "B";
|
|
currentLeaveBoatPanel = Object.Instantiate(leaveBoatPanelPrefab, FScriptsHandler.Instance.m_Canvas.transform).GetComponent<GetDropRodPanel>();
|
|
currentLeaveBoatPanel.Set(infoText, key, 2);
|
|
}
|
|
}
|
|
|
|
public void ShowEnterToBoatPanel(bool hide, string infoText = "")
|
|
{
|
|
if (hide && (bool)currentEnterBoatPanel)
|
|
{
|
|
Object.Destroy(currentEnterBoatPanel.gameObject);
|
|
currentEnterBoatPanel = null;
|
|
}
|
|
else if (!hide)
|
|
{
|
|
if ((bool)currentEnterBoatPanel)
|
|
{
|
|
currentEnterBoatPanel.circleImage.fillAmount = 0f;
|
|
return;
|
|
}
|
|
infoText = LanguageManager.Instance.GetText("ENTER_TO_BOAT");
|
|
string key = "B";
|
|
currentEnterBoatPanel = Object.Instantiate(leaveBoatPanelPrefab, FScriptsHandler.Instance.m_Canvas.transform).GetComponent<GetDropRodPanel>();
|
|
currentEnterBoatPanel.Set(infoText, key, 2);
|
|
}
|
|
}
|
|
|
|
public void ShowSteerBoatPanel(bool hide, string infoText = "")
|
|
{
|
|
if (hide && (bool)currentSteerBoatPanel)
|
|
{
|
|
Object.Destroy(currentSteerBoatPanel.gameObject);
|
|
currentSteerBoatPanel = null;
|
|
}
|
|
else if (!hide)
|
|
{
|
|
if ((bool)currentSteerBoatPanel)
|
|
{
|
|
currentSteerBoatPanel.circleImage.fillAmount = 0f;
|
|
return;
|
|
}
|
|
infoText = LanguageManager.Instance.GetText("BOAT_START_STERING_KEY");
|
|
string key = "R";
|
|
currentSteerBoatPanel = Object.Instantiate(leaveBoatPanelPrefab, FScriptsHandler.Instance.m_Canvas.transform).GetComponent<GetDropRodPanel>();
|
|
currentSteerBoatPanel.Set(infoText, key, 3);
|
|
}
|
|
}
|
|
|
|
public void ShowTeleportToParkingBoatPanel(bool hide, string infoText = "")
|
|
{
|
|
if (hide && (bool)currentTeleportBoatPanel)
|
|
{
|
|
Object.Destroy(currentTeleportBoatPanel.gameObject);
|
|
currentTeleportBoatPanel = null;
|
|
}
|
|
else
|
|
{
|
|
if (hide)
|
|
{
|
|
return;
|
|
}
|
|
if ((bool)currentTeleportBoatPanel)
|
|
{
|
|
currentTeleportBoatPanel.circleImage.fillAmount = 0f;
|
|
return;
|
|
}
|
|
infoText = LanguageManager.Instance.GetText("TELEPORT_TO_PARKING_BOAT");
|
|
string key = "T";
|
|
if ((bool)currentLeaveBoatPanel)
|
|
{
|
|
Object.Destroy(currentLeaveBoatPanel.gameObject);
|
|
}
|
|
currentTeleportBoatPanel = Object.Instantiate(leaveBoatPanelPrefab, FScriptsHandler.Instance.m_Canvas.transform).GetComponent<GetDropRodPanel>();
|
|
currentTeleportBoatPanel.Set(infoText, key, 2);
|
|
}
|
|
}
|
|
|
|
private string CurrentSetName()
|
|
{
|
|
for (int i = 0; i < Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerSlotsEquip.Count; i++)
|
|
{
|
|
if (Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerSlotsEquip[i].rod.status == GameManager.PlayerData.CRods.Status.InHand)
|
|
{
|
|
switch (i)
|
|
{
|
|
case 0:
|
|
return Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().SetNames[0];
|
|
case 1:
|
|
return Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().SetNames[1];
|
|
case 2:
|
|
return Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().SetNames[2];
|
|
case 3:
|
|
return Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().SetNames[3];
|
|
case 4:
|
|
return Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().SetNames[4];
|
|
}
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
}
|