mirror of
https://github.com/zoriya/Magical-Garden.git
synced 2026-06-03 09:15:35 +00:00
Merge branch 'master' of https://github.com/AnonymusRaccoon/New-Unity-Project
This commit is contained in:
+11
-21
@@ -7,39 +7,29 @@ using System.Threading.Tasks;
|
||||
public class Pokedex : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI PokeText;
|
||||
public int PokeTemps = 10;
|
||||
private bool PokeBool = false;
|
||||
public bool ArretDéfilement = false;
|
||||
|
||||
public int PokeTemps = 5;
|
||||
private bool ArretDéfilement = false;
|
||||
private string PokeSubDescription;
|
||||
|
||||
public async void PokeDescription(int PokeNumero)
|
||||
{
|
||||
if (PokeBool == false)
|
||||
ArretDéfilement = false;
|
||||
PokeSubDescription = GetComponent<InventoryManager>().items[PokeNumero].description;
|
||||
PokeText.text = null;
|
||||
for (int i = 0; i < PokeSubDescription.Length; i++)
|
||||
{
|
||||
string PokeSubDescription = GetComponent<InventoryManager>().items[PokeNumero].description;
|
||||
PokeText.text = null;
|
||||
PokeBool = true;
|
||||
for (int i = 0; i < PokeSubDescription.Length; i++)
|
||||
if (ArretDéfilement == true)
|
||||
{
|
||||
if (ArretDéfilement == true)
|
||||
{
|
||||
ArretDéfilement = false;
|
||||
PokeBool = false;
|
||||
return;
|
||||
}
|
||||
PokeText.text += PokeSubDescription[i];
|
||||
await Task.Delay(PokeTemps);
|
||||
|
||||
return;
|
||||
}
|
||||
PokeBool = false;
|
||||
PokeText.text += PokeSubDescription[i];
|
||||
await Task.Delay(PokeTemps);
|
||||
}
|
||||
|
||||
}
|
||||
public void UpdateMissionText()
|
||||
{
|
||||
ArretDéfilement = true;
|
||||
|
||||
PokeText.text = GetComponent<Mission>().GetMissionText();
|
||||
ArretDéfilement = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,16 @@ public class InventoryManager : MonoBehaviour
|
||||
public TreeItem[] items = new TreeItem[15];
|
||||
public Plot[] plots = new Plot[25];
|
||||
|
||||
private int draggedPosition = -1;
|
||||
public int draggedPosition = -1;
|
||||
private Vector3 defaultPos;
|
||||
private Vector2Int selectorPos;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
InventorySlot.manager = this;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKey(KeyCode.Mouse0))
|
||||
|
||||
@@ -3,19 +3,22 @@ using UnityEngine.EventSystems;
|
||||
|
||||
public class InventorySlot : MonoBehaviour, IPointerDownHandler, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
public static InventoryManager manager;
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
GameObject.Find("GameManager").GetComponent<InventoryManager>().StartDraggin(int.Parse(transform.parent.name.Substring(6, 2)) - 1);
|
||||
manager.StartDraggin(int.Parse(transform.parent.name.Substring(6, 2)) - 1);
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
|
||||
GameObject.Find("GameManager").GetComponent<Pokedex>().PokeDescription(int.Parse(transform.parent.name.Substring(6, 2)) - 1);
|
||||
if(manager.draggedPosition == -1)
|
||||
GameObject.Find("GameManager").GetComponent<Pokedex>().PokeDescription(int.Parse(transform.parent.name.Substring(6, 2)) - 1);
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
GameObject.Find("GameManager").GetComponent<Pokedex>().UpdateMissionText();
|
||||
if (manager.draggedPosition == -1)
|
||||
GameObject.Find("GameManager").GetComponent<Pokedex>().UpdateMissionText();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user