powerfun-unity/Assets/Scripts/UI/Prefab/GameRoom/GameRoomDownloadTask.cs

52 lines
1.1 KiB
C#

using Assets.Scripts;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
class GameRoomDownloadTask : MonoBehaviour
{
public GameObject btn;
public Slider slider;
public GameObject icon;
private GameObject modal;
public GameObject done;
public GameObject doneTxt;
public int RoomId { get; set; }
private void Start()
{
UIManager.AddEvent(btn, EventTriggerType.PointerClick, (e) =>
{
modal.SetActive(true);
transform.parent.parent.parent.parent.gameObject.SetActive(false);
//TODO:
});
}
public void Init(int roomId,GameObject parent)
{
RoomId = roomId;
modal = parent;
}
public void UpdateProcess(float process)
{
slider.value = process;
if (process >= 100)
{
done.SetActive(true);
doneTxt.SetActive(true);
icon.SetActive(false);
slider.gameObject.SetActive(false);
}
}
public void Dispose()
{
gameObject.SetActive(false);
}
}