This commit is contained in:
happy44300
2018-08-13 18:21:50 +02:00
3 changed files with 24 additions and 26 deletions
+11 -21
View File
@@ -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;
}
}
+6 -1
View File
@@ -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))
+7 -4
View File
@@ -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();
}
}