Add Delivery Manager UI and UI logic
This commit is contained in:
parent
8c5f4f2acf
commit
3ec46256e8
89 changed files with 14001 additions and 12 deletions
|
@ -1,50 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ProgressBarUI : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] private GameObject hasProgressGameObject;
|
||||
[SerializeField] private Image barImage;
|
||||
|
||||
private IHasProgress hasProgress;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
hasProgress = hasProgressGameObject.GetComponent<IHasProgress>();
|
||||
if (hasProgress == null) {
|
||||
Debug.LogError("Game Object " + hasProgressGameObject + " does not have a componenet that implements IHasProgress!");
|
||||
}
|
||||
|
||||
hasProgress.OnProgressChange += HasProgress_OnProgressChange;
|
||||
|
||||
barImage.fillAmount = 0f;
|
||||
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void HasProgress_OnProgressChange(object sender, IHasProgress.OnProgressChangeEventsArgs e)
|
||||
{
|
||||
barImage.fillAmount = e.progressNormalized;
|
||||
|
||||
if (e.progressNormalized == 0f || e.progressNormalized == 1f) {
|
||||
Hide();
|
||||
} else
|
||||
{
|
||||
Show();
|
||||
}
|
||||
}
|
||||
|
||||
private void Show()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue