91 lines
2.9 KiB
C#
91 lines
2.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using GCGame.Table;
|
|
using Module.Log;
|
|
|
|
public class TestingCopyMenuItem : UIItemSelect {
|
|
|
|
private int _TestingCopyId = -1;
|
|
|
|
public Image _MenuItemUnSelectIcon;
|
|
public Image _MenuItemSelectIcon;
|
|
public Text _SelectedNameDesc;
|
|
public Text _UnSelectedNameDesc;
|
|
public Text _LockDesc;
|
|
public GameObject _LockIcon;
|
|
|
|
public GameObject remainTimeIcon;
|
|
public Text remainTimeText;
|
|
|
|
private Tab_TestingCopy _TestingCopyTab;
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
base.Show(hash);
|
|
|
|
_TestingCopyId = (int)hash["InitObj"];
|
|
_TestingCopyTab = TableManager.GetTestingCopyByID(_TestingCopyId, 0);
|
|
if(_TestingCopyTab == null)
|
|
{
|
|
LogModule.ErrorLog("Can't find TestCopy id : " + _TestingCopyId);
|
|
return;
|
|
}
|
|
|
|
//BGIcon
|
|
LoadAssetBundle.Instance.SetImageSprite(_MenuItemSelectIcon, _TestingCopyTab.TestingMenuItemSelectIcon);
|
|
LoadAssetBundle.Instance.SetImageSprite(_MenuItemUnSelectIcon, _TestingCopyTab.TestingMenuItemUnSelectIcon);
|
|
_SelectedNameDesc.text = _TestingCopyTab.TestingName;
|
|
_UnSelectedNameDesc.text = _TestingCopyTab.TestingName;
|
|
|
|
//unlockIcon
|
|
_LockIcon.SetActive(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < _TestingCopyTab.UnlockLevel);
|
|
if(_LockIcon.activeInHierarchy)
|
|
{
|
|
_LockDesc.text = StrDictionary.GetClientDictionaryString("#{44036}", _TestingCopyTab.UnlockLevel);
|
|
}
|
|
|
|
RefreshRemainTimeIcon();
|
|
}
|
|
|
|
public override void Selected()
|
|
{
|
|
base.Selected();
|
|
if(_MenuItemUnSelectIcon != null)
|
|
{
|
|
_MenuItemUnSelectIcon.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public override void UnSelected()
|
|
{
|
|
base.UnSelected();
|
|
if (_MenuItemUnSelectIcon != null)
|
|
{
|
|
_MenuItemUnSelectIcon.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
|
|
public void RefreshRemainTimeIcon()
|
|
{
|
|
var stateList = GameManager.gameManager.PlayerDataPool.FunctionRemainTimeStateManager.copyBaseRemainTimeStateList;
|
|
for(int index = 0; index < stateList.Length; index++)
|
|
{
|
|
if(stateList[index].type == FunctionRewStateManager.CopyEnum.testing)
|
|
{
|
|
if(stateList[index].subTypeIndexAndCountDic != null
|
|
&& stateList[index].subTypeIndexAndCountDic.ContainsKey(_TestingCopyId) && stateList[index].subTypeIndexAndCountDic[_TestingCopyId] > 0)
|
|
{
|
|
remainTimeIcon.SetActive(true);
|
|
remainTimeText.text = stateList[index].subTypeIndexAndCountDic[_TestingCopyId].ToString();
|
|
}
|
|
else
|
|
{
|
|
remainTimeIcon.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|