//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Tuesday, September 18, 2018
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
|
using System;
|
using System.Collections.Generic;
|
using DG.Tweening;
|
|
namespace vnxbqy.UI {
|
|
public class FeatureNoticeTip:MonoBehaviour {
|
private int OpenTag = 0;
|
[SerializeField] Image _FunctionIcon;//图标Icon
|
[SerializeField] Text _NameText;//标题名
|
[SerializeField] Text _Information;//信息内容
|
[SerializeField] GameObject m_FeatureNoticeTipObj;
|
[SerializeField] Text m_Information_reward;//有奖励可领取
|
FeatureNoticeModel featureNoticeModel { get { return ModelCenter.Instance.GetModel<FeatureNoticeModel>(); } }
|
List<FunctionForecastConfig> configs = new List<FunctionForecastConfig>();
|
public GameObject FeatureNoticeTipObj
|
{
|
get { return m_FeatureNoticeTipObj; }
|
set { m_FeatureNoticeTipObj = value; }
|
}
|
public void Init()//初始化
|
{
|
DataAssignment();
|
}
|
void DataAssignment()
|
{
|
if (configs.Count <= 0)
|
{
|
configs= FunctionForecastConfig.GetValues();
|
}
|
// var configs = FunctionForecastConfig.GetValues();
|
foreach (var config in configs)
|
{
|
if (!FuncOpen.Instance.IsFuncOpen(config.FuncId)
|
&& PlayerDatas.Instance.baseData.LV >= config.OpenLevel && config.Display == 1)
|
{
|
OpenTag = config.FuncId;
|
OpenPanel(OpenTag);
|
return;
|
}
|
}
|
bool IsOpen = false;
|
foreach (var _key in featureNoticeModel.DicOpenFuncState.Keys)
|
{
|
if (featureNoticeModel.DicRedPoint.ContainsKey(_key) && featureNoticeModel.DicOpenFuncState[_key].State == 1
|
&& featureNoticeModel.DicOpenFuncState[_key].AwardState == 0 && featureNoticeModel.DicAwardItem.ContainsKey(_key))
|
{
|
IsOpen = true;
|
}
|
}
|
if (IsOpen)//预告完毕还有奖励能领取
|
{
|
_FunctionIcon.SetSprite("PersonBossIcon");
|
m_Information_reward.SetActive(true);
|
_NameText.SetActive(false);
|
_Information.SetActive(false);
|
return;
|
}
|
return;
|
}
|
void OpenPanel(int ID)
|
{
|
m_Information_reward.SetActive(false);
|
_NameText.SetActive(true);
|
_Information.SetActive(true);
|
_FunctionIcon.SetSprite(FunctionForecastConfig.Get(ID).FuncIconKey);
|
_NameText.text = FunctionForecastConfig.Get(ID).Describe;
|
FuncOpenLVConfig funcoPenConfig = FuncOpenLVConfig.Get(ID);
|
if (funcoPenConfig.LimitMagicWeapon != 0 || funcoPenConfig.LimitMissionID != 0)
|
{
|
if (funcoPenConfig.LimitMagicWeapon != 0)
|
{
|
int faBaoID = funcoPenConfig.LimitMagicWeapon / 100;
|
TreasureConfig treasure = TreasureConfig.Get(faBaoID);
|
_Information.text = string.Format(Language.Get("FuncFBOpen"), treasure.Name);
|
return;
|
}
|
if (funcoPenConfig.LimitMissionID != 0)
|
{
|
_Information.text = string.Format(Language.Get("TaskFuncOpen"), funcoPenConfig.LimitLV);
|
return;
|
}
|
}
|
else
|
{
|
_Information.text = string.Format(Language.Get("FuncLevelOpen"), funcoPenConfig.LimitLV);
|
}
|
|
}
|
}
|
|
}
|
|
|
|