156 lines
4.2 KiB
C#
156 lines
4.2 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
using System.Collections.Generic;
|
|
using GCGame.Table;
|
|
|
|
public class AdvanceCopyItem : MonoBehaviour {
|
|
|
|
#region
|
|
|
|
public Image itemBG;
|
|
public Text itemName;
|
|
public Text remainTimes;
|
|
|
|
public Image scoreIcon;
|
|
|
|
public GameObject passTimeObj;
|
|
public Text passTimes;
|
|
|
|
public GameObject challengeBtn;
|
|
public GameObject completeIcon;
|
|
public Text unLockLevelDesc;
|
|
|
|
public List<Sprite> scoreIconList; //6:SSS 5:SS 4:S 3:A 2:B 1:C 副本评分
|
|
|
|
public Image markIcon;
|
|
|
|
|
|
#endregion
|
|
|
|
public int curBseId = 0;
|
|
public bool isPassOnce = false;
|
|
public int remainChallengeTimes = 0;
|
|
public int _UnLockLevel=0;
|
|
public void InitItem(AdvanceCopyItemInfo info)
|
|
{
|
|
curBseId = info.fubenId;
|
|
Tab_NewCopyBase copyBase = TableManager.GetNewCopyBaseByID(info.fubenId, 0);
|
|
if(copyBase == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
isPassOnce = info.isGainFirstRew;
|
|
remainChallengeTimes = info.remainTimes;
|
|
|
|
LoadAssetBundle.Instance.SetImageSprite(itemBG, copyBase.Icon);
|
|
|
|
Tab_Fuben fuben = TableManager.GetFubenByID(info.fubenId, 0);
|
|
if(fuben == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
itemName.text = fuben.Name;
|
|
remainTimes.text = (info.remainTimes < 0 ? 0 : info.remainTimes).ToString();//StrDictionary.GetClientDictionaryString("#{44013}", (info.remainTimes < 0 ? 0 : info.remainTimes));
|
|
|
|
if (copyBase.UnLockLevel > GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level)
|
|
{
|
|
challengeBtn.SetActive(false);
|
|
completeIcon.gameObject.SetActive(false);
|
|
scoreIcon.gameObject.SetActive(false);
|
|
|
|
unLockLevelDesc.gameObject.SetActive(true);
|
|
unLockLevelDesc.text = StrDictionary.GetClientDictionaryString("#{44036}", copyBase.UnLockLevel);
|
|
_UnLockLevel = copyBase.UnLockLevel;
|
|
}
|
|
else
|
|
{
|
|
unLockLevelDesc.gameObject.SetActive(false);
|
|
challengeBtn.SetActive(true);
|
|
if (info.remainTimes < 1)
|
|
{
|
|
challengeBtn.SetActive(false);
|
|
completeIcon.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
challengeBtn.SetActive(true);
|
|
completeIcon.SetActive(false);
|
|
}
|
|
}
|
|
|
|
if (info.score < 0)
|
|
{
|
|
scoreIcon.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
scoreIcon.gameObject.SetActive(true);
|
|
scoreIcon.overrideSprite = scoreIconList[info.score - 1];
|
|
scoreIcon.SetNativeSize();
|
|
}
|
|
|
|
if(info.bestPassTime < 1)
|
|
{
|
|
passTimeObj.SetActive(false);
|
|
}else
|
|
{
|
|
passTimeObj.SetActive(true);
|
|
|
|
int minute = info.bestPassTime / 60;
|
|
int second = (info.bestPassTime - minute * 60) % 60;
|
|
|
|
passTimes.text = StrDictionary.GetClientDictionaryString("#{44026}", minute, second);
|
|
}
|
|
}
|
|
|
|
public void RefreshRemainTimes(int remainTime)
|
|
{
|
|
remainTimes.text = (remainTime < 0 ? 0 : remainTime).ToString(); // StrDictionary.GetClientDictionaryString("#{44013}", (remainTime < 0 ? 0 : remainTime));
|
|
if (remainChallengeTimes > 0)
|
|
{
|
|
if(!challengeBtn.gameObject.activeInHierarchy)
|
|
{
|
|
challengeBtn.SetActive(true);
|
|
completeIcon.SetActive(false);
|
|
}
|
|
}else
|
|
{
|
|
challengeBtn.SetActive(false);
|
|
completeIcon.SetActive(true);
|
|
}
|
|
}
|
|
|
|
public void OnChallengeBtnClick()
|
|
{
|
|
if(curBseId == 0)
|
|
{
|
|
return;
|
|
}
|
|
if(remainChallengeTimes < 1)
|
|
{
|
|
if (!CopyCtrBase.GetInstance().CanBuyCopyChallengeTimes(curBseId))
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
MessageBoxLogic.ShowEnterCopySceneEnsureMessageBox(curBseId, 2);
|
|
}
|
|
|
|
public void OnItemClick()
|
|
{
|
|
if(AdvanceCopySceneRootCtr.Instance)
|
|
{
|
|
AdvanceCopySceneRootCtr.Instance.OnItemClick(curBseId);
|
|
}
|
|
}
|
|
|
|
public void ShowMarkIcon(bool isSHow)
|
|
{
|
|
markIcon.gameObject.SetActive(isSHow);
|
|
}
|
|
}
|