188 lines
5.6 KiB
C#
188 lines
5.6 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
using GCGame.Table;
|
|
using Games.Item;
|
|
using System.Collections.Generic;
|
|
|
|
public class ActivityInfoTipController : MonoBehaviour {
|
|
|
|
public static ActivityInfoTipController Instance;
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
Instance = null;
|
|
}
|
|
|
|
public Image m_infoIcon;
|
|
public Text m_InfoNameText;
|
|
public Text m_InfoJoinTimesText;
|
|
public Text m_InfoCanJoinTimeText;
|
|
public Text m_InfoActivityType;
|
|
public Text m_infoLimitLevel;
|
|
public Text m_InfoDesc;
|
|
|
|
public GameObject _ActivityTimeObj;
|
|
public GameObject _SpecialParamObj;
|
|
public Text _SpeciaParam;
|
|
//活动奖励
|
|
public GameObject m_AwardItemPrefab; //奖励按钮预设体
|
|
public Transform m_AwardParent; //奖励按钮父节点
|
|
|
|
private List<GameObject> itemPrefabList = new List<GameObject>();
|
|
public void InitMyItemTip(int itemId)
|
|
{
|
|
if (itemId == -1)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Tab_ActivityBase infoBase = TableManager.GetActivityBaseByID(itemId, 0);
|
|
if(infoBase == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
string m_IconPath = infoBase.ActivityIcon;
|
|
if(m_IconPath != null)
|
|
LoadAssetBundle.Instance.SetImageSprite(m_infoIcon, m_IconPath);
|
|
|
|
m_InfoNameText.text = infoBase.ActivityName;
|
|
int param = ActivityDataManager.Instance.GetActivityCompleteTimes(infoBase.ActivityServerType,false);
|
|
|
|
int LimitTimes = infoBase.ActityLimitTimes;
|
|
|
|
//活动次数
|
|
if(infoBase.ActivityServerType == (int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_EXERCISEROOM)
|
|
{
|
|
_ActivityTimeObj.SetActive(false);
|
|
_SpecialParamObj.SetActive(true);
|
|
_SpeciaParam.text = param + "";
|
|
ReqSpecialParam();
|
|
}
|
|
else
|
|
{
|
|
_ActivityTimeObj.SetActive(true);
|
|
_SpecialParamObj.SetActive(false);
|
|
if (LimitTimes != -1)
|
|
{
|
|
m_InfoJoinTimesText.text = param.ToString() + "/" + LimitTimes.ToString();
|
|
}
|
|
else
|
|
{
|
|
m_InfoJoinTimesText.text = StrDictionary.GetClientDictionaryString("#{43036}"); // " 不限制";
|
|
}
|
|
}
|
|
|
|
//活动时间
|
|
SetTimeDesc(infoBase.OpenTimeDesc);
|
|
|
|
|
|
//活动等级限制
|
|
int m_LimitLevel = infoBase.Level;
|
|
m_infoLimitLevel.text = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level >= m_LimitLevel
|
|
? StrDictionary.GetClientDictionaryString("#{48002}", m_LimitLevel) : StrDictionary.GetClientDictionaryString("#{48003}", m_LimitLevel); //m_LimitLevel + "级开启";
|
|
|
|
|
|
//活动形式
|
|
if (infoBase.Format == 1)
|
|
{
|
|
//单人任务
|
|
m_InfoActivityType.text = StrDictionary.GetClientDictionaryString("#{43034}"); // "单人任务";
|
|
}else
|
|
{
|
|
m_InfoActivityType.text = StrDictionary.GetClientDictionaryString("#{43035}"); // "组队任务";
|
|
}
|
|
|
|
//活动描述
|
|
m_InfoDesc.text = infoBase.Desc;
|
|
|
|
|
|
//活动奖励
|
|
string[] m_itemId = infoBase.Reward.Split('|');
|
|
ClearPrefab();
|
|
for (int index = 0; index < m_itemId.Length; index++)
|
|
{
|
|
GameItem item = new GameItem();
|
|
item.DataID = int.Parse(m_itemId[index]);
|
|
|
|
GameObject m_ItemPrefab = GameObject.Instantiate(m_AwardItemPrefab);
|
|
m_ItemPrefab.transform.parent = m_AwardParent;
|
|
m_ItemPrefab.transform.localScale = Vector3.one;
|
|
m_ItemPrefab.transform.localRotation = Quaternion.Euler(Vector3.zero);
|
|
|
|
m_ItemPrefab.GetComponent<RewardInfoItemController>().initItem(item.DataID);
|
|
itemPrefabList.Add(m_ItemPrefab);
|
|
}
|
|
}
|
|
|
|
public void RefershExerciseRoomRemainTime(int remainTime)
|
|
{
|
|
_SpeciaParam.text = remainTime + "";
|
|
}
|
|
|
|
void ReqSpecialParam()
|
|
{
|
|
//练功房
|
|
ReqExerciseRoomInfo req = new ReqExerciseRoomInfo();
|
|
req.flag = 1;
|
|
req.SendMsg();
|
|
}
|
|
|
|
public void SetTimeDesc(string desc)
|
|
{
|
|
m_InfoCanJoinTimeText.text = desc;
|
|
//string m_StartMinute = "00";
|
|
//string m_TabStartTime = infoBase.GetTimebyIndex(0);
|
|
//string[] m_StartTime = m_TabStartTime.Split('|');
|
|
//int startTime = int.Parse(m_StartTime[0]);
|
|
//int hour = startTime / 100;
|
|
//int minute = startTime - hour * 100;
|
|
|
|
//if (minute < 10)
|
|
//{
|
|
// m_StartMinute = '0' + minute.ToString();
|
|
//}
|
|
//else
|
|
//{
|
|
// m_StartMinute = minute.ToString();
|
|
//}
|
|
|
|
//int endTime = int.Parse(m_StartTime[1]);
|
|
//int endHour = endTime / 100;
|
|
//int endMinute = endTime - endHour * 100;
|
|
|
|
//if (endMinute < 10)
|
|
//{
|
|
// m_InfoCanJoinTimeText.text = StrDictionary.GetClientDictionaryString("#{43031}", hour, m_StartMinute, endHour, endMinute); // hour + ":" + m_StartMinute + "至" + endHour + ":" + "0" + endMinute;
|
|
//}
|
|
//else
|
|
//{
|
|
// m_InfoCanJoinTimeText.text = StrDictionary.GetClientDictionaryString("#{43032}", hour, m_StartMinute, endHour, endMinute); // hour + ":" + m_StartMinute + "至" + endHour + ":" + endMinute;
|
|
//}
|
|
}
|
|
|
|
public void ClearPrefab()
|
|
{
|
|
for(int index = 0; index < itemPrefabList.Count; index++)
|
|
{
|
|
GameObject.Destroy(itemPrefabList[index]);
|
|
}
|
|
itemPrefabList.Clear();
|
|
}
|
|
|
|
|
|
|
|
|
|
public void MyPanelClick()
|
|
{
|
|
UIManager.CloseUI(UIInfo.ActivityInfoTip);
|
|
}
|
|
|
|
|
|
}
|