//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, January 09, 2019 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace vnxbqy.UI { public class OpenServiceItem : MonoBehaviour { [SerializeField] Text m_Text_A; [SerializeField] Image m_BGM; [SerializeField] Image m_ImageShow; [SerializeField] Text m_TextPoint; [SerializeField] Button m_ReceiveBtn; [SerializeField] GameObject m_IsReachImage; [SerializeField] GameObject m_IsDrawImage; [SerializeField] Button m_ViewItem; OpenServiceAchievementModel model { get { return ModelCenter.Instance.GetModel(); } } public void SetReward(int day, WeekPartyItemClass item, int index,int Type) { var weekPartPointConfig = WeekPartyPointConfig.Get(item.ItemID); if (weekPartPointConfig != null) { m_Text_A.text = weekPartPointConfig.name; if (Type == 1) { m_ImageShow.SetSprite(weekPartPointConfig.ImageType1); } else { m_ImageShow.SetSprite(weekPartPointConfig.ImageType2); } m_ImageShow.SetNativeSize(); var RectTrans = m_ImageShow.transform.GetComponent(); RectTrans.localScale = new Vector3(weekPartPointConfig.Zoom, weekPartPointConfig.Zoom, 1); m_ViewItem.SetListener(() => { ItemTipUtility.Show(item.ItemID); }); } int Point = model.GetPoint(day); m_TextPoint.text = Language.Get("OSA_3", item.NeedPoint); bool IsBool = model.IsDayReward(model.SelectedNow, index); if (model.SelectedNow > model.DayNow) { m_ReceiveBtn.SetActive(false); m_IsReachImage.SetActive(false); m_IsDrawImage.SetActive(false); } else { if (Point >= item.NeedPoint && !IsBool)//可领 { m_ReceiveBtn.SetActive(true); m_ReceiveBtn.SetListener(() => { if (model.IsOpen) { model.SendGetWeekPartyPoint(model.SelectedNow, item.NeedPoint); } else { SysNotifyMgr.Instance.ShowTip("SevenDayOver2"); } }); m_IsReachImage.SetActive(false); m_IsDrawImage.SetActive(false); } else if (Point >= item.NeedPoint && IsBool)//已领 { m_ReceiveBtn.SetActive(false); m_IsReachImage.SetActive(false); m_IsDrawImage.SetActive(true); } else if (item.NeedPoint > Point) { m_ReceiveBtn.SetActive(false); m_IsReachImage.SetActive(true); m_IsDrawImage.SetActive(false); } } } } }