140 lines
3.7 KiB
C#
140 lines
3.7 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class ChristmasPrize : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private Text itemNameText;
|
|
|
|
[SerializeField]
|
|
private Text prizeDescriptionText;
|
|
|
|
[SerializeField]
|
|
private Text closeText;
|
|
|
|
[SerializeField]
|
|
private Transform[] prizeTypeImage;
|
|
|
|
[SerializeField]
|
|
private GameManager.ItemType[] prizeItemType;
|
|
|
|
[SerializeField]
|
|
private int[] prizeGameId;
|
|
|
|
[SerializeField]
|
|
private Text[] decorationValueText;
|
|
|
|
private bool isClose;
|
|
|
|
private void Start()
|
|
{
|
|
closeText.enabled = false;
|
|
FScriptsHandler.Instance.m_PlayerMain.firstPersonController.frezzePosition = true;
|
|
FScriptsHandler.Instance.m_PlayerMain.firstPersonController.frezzeRotation = true;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (isClose && Input.anyKeyDown)
|
|
{
|
|
FScriptsHandler.Instance.m_PlayerMain.firstPersonController.UnFrezzeLook();
|
|
Object.Destroy(base.gameObject);
|
|
}
|
|
}
|
|
|
|
public void Setup(int prizeIndex)
|
|
{
|
|
if (prizeIndex == 1)
|
|
{
|
|
itemNameText.text = "";
|
|
prizeDescriptionText.text = "";
|
|
prizeTypeImage[4].gameObject.SetActive(value: true);
|
|
}
|
|
else
|
|
{
|
|
itemNameText.text = "";
|
|
prizeDescriptionText.text = LanguageManager.Instance.GetText("REWARD_CHRISTMAS");
|
|
switch (prizeItemType[prizeIndex])
|
|
{
|
|
case GameManager.ItemType.Bait:
|
|
{
|
|
GameManager.PlayerData.CBaits cBaits = new GameManager.PlayerData.CBaits();
|
|
cBaits.amount = 1;
|
|
cBaits.ID = prizeGameId[prizeIndex];
|
|
cBaits.wear = 100;
|
|
cBaits.buyPrice = 0f;
|
|
cBaits.uniqueId = GameManager.GetUniqueNumber();
|
|
Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerBaits.Add(cBaits);
|
|
break;
|
|
}
|
|
case GameManager.ItemType.Rod:
|
|
{
|
|
GameManager.PlayerData.CRods cRods = new GameManager.PlayerData.CRods();
|
|
cRods.amount = 1;
|
|
cRods.ID = prizeGameId[prizeIndex];
|
|
cRods.wear = 100;
|
|
cRods.buyPrice = 0f;
|
|
cRods.uniqueId = GameManager.GetUniqueNumber();
|
|
Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerRods.Add(cRods);
|
|
break;
|
|
}
|
|
case GameManager.ItemType.Reel:
|
|
{
|
|
GameManager.PlayerData.CReels cReels = new GameManager.PlayerData.CReels();
|
|
cReels.amount = 1;
|
|
cReels.ID = prizeGameId[prizeIndex];
|
|
cReels.wear = 100;
|
|
cReels.buyPrice = 0f;
|
|
cReels.uniqueId = GameManager.GetUniqueNumber();
|
|
Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerReels.Add(cReels);
|
|
break;
|
|
}
|
|
case GameManager.ItemType.Float:
|
|
{
|
|
GameManager.PlayerData.CFloats cFloats = new GameManager.PlayerData.CFloats();
|
|
cFloats.amount = 1;
|
|
cFloats.ID = prizeGameId[prizeIndex];
|
|
cFloats.wear = 100;
|
|
cFloats.buyPrice = 0f;
|
|
cFloats.uniqueId = GameManager.GetUniqueNumber();
|
|
Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerFloats.Add(cFloats);
|
|
break;
|
|
}
|
|
}
|
|
prizeTypeImage[prizeIndex].gameObject.SetActive(value: true);
|
|
itemNameText.text = GameManager.Instance.GetGameItemName(prizeItemType[prizeIndex], prizeGameId[prizeIndex]);
|
|
}
|
|
decorationValueText[0].text = "0 / 1";
|
|
decorationValueText[1].text = "0 / 1";
|
|
decorationValueText[2].text = "0 / 1";
|
|
decorationValueText[3].text = "0 / 1";
|
|
switch (prizeIndex)
|
|
{
|
|
case 0:
|
|
decorationValueText[0].text = "1 / 1";
|
|
break;
|
|
case 1:
|
|
decorationValueText[0].text = "1 / 1";
|
|
decorationValueText[1].text = "1 / 1";
|
|
break;
|
|
case 2:
|
|
decorationValueText[0].text = "1 / 1";
|
|
decorationValueText[1].text = "1 / 1";
|
|
decorationValueText[2].text = "1 / 1";
|
|
break;
|
|
case 3:
|
|
decorationValueText[0].text = "1 / 1";
|
|
decorationValueText[1].text = "1 / 1";
|
|
decorationValueText[2].text = "1 / 1";
|
|
decorationValueText[3].text = "1 / 1";
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void ShowClose()
|
|
{
|
|
isClose = true;
|
|
closeText.enabled = true;
|
|
}
|
|
}
|