123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using System.Linq;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.Events;
- using WebTools.Environments;
- namespace WebTools.Environments.Behaviours
- {
- public class PanelEnvironmentBehaviour : MonoBehaviour
- {
- [Header("UI")]
- [SerializeField]
- private Text textCurrentLocation;
- [SerializeField]
- private Text textPanelPopUp;
- [SerializeField]
- private string textPopUpTravelto;
- [SerializeField]
- private GameObject panelPopUpEnvironment;
- [SerializeField]
- private GameObject panelMap;
- [Header("EVENTS")]
- [SerializeField]
- private UnityEvent OnTravelCompletes;
- [SerializeField]
- private UnityEvent OnClickMarkers;
- private void OnEnable()
- {
- EnableOrDisableMap(true);
- // EnableEvents();
- }
- private void OnDisable()
- {
- EnableOrDisableMap(false);
- // DisableEvents();
- }
- /* private void EnableEvents()
- {
- EnviromentTravelManagerBehaviour.OnMarkerTravelSuccess += OnTravelComplete;
- EnviromentTravelManagerBehaviour.OnCanTravelToSuccess += OnCanTravelTo;
- }
- private void DisableEvents()
- {
- EnviromentTravelManagerBehaviour.OnMarkerTravelSuccess -= OnTravelComplete;
- EnviromentTravelManagerBehaviour.OnCanTravelToSuccess -= OnCanTravelTo;
- }*/
- private void EnableOrDisableMap(bool active)
- {
- if (panelMap)
- {
- panelMap.SetActive(active);
- }
- }
- private void SetCurrentLocation(string id)
- {
- textCurrentLocation.text = id;
- }
- private void SetTravelToLocation(string id)
- {
- panelPopUpEnvironment.SetActive(true);
- textPanelPopUp.text = textPopUpTravelto + " " + id + "?";
- }
- /* private void OnCanTravelTo(OnlineMapsMarkerBase marker)
- {
- SetTravelToLocation(marker.id);
- OnClickMarkers.Invoke();
- }
- private void OnTravelComplete(OnlineMapsMarkerBase marker)
- {
- SetCurrentLocation(marker.id);
- OnTravelCompletes.Invoke();
- }*/
- }
- }
|