//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Sunday, December 10, 2017
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
|
public class TreasureCollectProgress : MonoBehaviour
|
{
|
[SerializeField] Transform m_ContainerProgress;
|
[SerializeField] FrameEffect m_ProgressBar;
|
[SerializeField] FrameEffect m_FullEffect;
|
[SerializeField] float m_Progress = 0f;
|
|
public float progress {
|
get { return m_Progress; }
|
set {
|
if (this.m_Progress != value)
|
{
|
this.m_Progress = value;
|
if (Mathf.Abs(this.m_Progress - 1f) < 0.001f)
|
{
|
m_ContainerProgress.SetActive(false);
|
m_FullEffect.SetActive(true);
|
}
|
else
|
{
|
m_ContainerProgress.SetActive(true);
|
m_FullEffect.SetActive(false);
|
m_ProgressBar.transform.localPosition = m_ProgressBar.transform.localPosition.SetY(this.height * (progress - 1.07f));
|
}
|
}
|
}
|
}
|
|
float height = 0f;
|
|
private void OnEnable()
|
{
|
this.height = (this.transform as RectTransform).rect.height;
|
m_ProgressBar.transform.localPosition = m_ProgressBar.transform.localPosition.SetY(this.height * (progress - 1.07f));
|
}
|
|
}
|
|
}
|