121 lines
3.4 KiB
C#
121 lines
3.4 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
using GCGame.Table;
|
|
using UnityEngine.Events;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
public class BossInfoItem : MonoBehaviour {
|
|
|
|
public List<Sprite> _SpriteList;
|
|
public Image _BG;
|
|
public Image _MarkIcon;
|
|
public Material _GrayMaterial;
|
|
|
|
public Image headIcon;
|
|
public Text nameDesc;
|
|
public Image markIcon;
|
|
public int _CopySceneId = -1;
|
|
public Text needLevel;
|
|
|
|
//通过ID进行初始化
|
|
private int _CurLevelType = 1;
|
|
public void InitMyItem(int m_Id, StroyCopySceneRootCtrl.CopySceneType type)
|
|
{
|
|
//根据难度设置背景
|
|
_CurLevelType = (int)type;
|
|
//SetInfoItemBGAndMarkIcon();
|
|
|
|
_CopySceneId = m_Id;
|
|
Tab_StroyCopy stroyCopy = TableManager.GetStroyCopyByID(m_Id, 0);
|
|
if(stroyCopy == null)
|
|
{
|
|
return;
|
|
}
|
|
needLevel.text = stroyCopy.Level.ToString();
|
|
|
|
Tab_RoleBaseAttr roleBaseAttr = TableManager.GetRoleBaseAttrByID(stroyCopy.BossId, 0);
|
|
if (roleBaseAttr == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Tab_CharModel charModel = TableManager.GetCharModelByID(roleBaseAttr.CharModelID, 0);
|
|
if(charModel == null)
|
|
{
|
|
return;
|
|
}
|
|
string imagePath = charModel.HeadPic;
|
|
//设置头像
|
|
LoadAssetBundle.Instance.SetImageSprite(headIcon, imagePath, delegate(bool bSucess,GameObject obj) {
|
|
headIcon.material = _IsLock ? _GrayMaterial : headIcon.defaultMaterial;
|
|
});
|
|
|
|
nameDesc.text = stroyCopy.Name;
|
|
SetItemState();
|
|
}
|
|
|
|
|
|
//Islock 等级不足或者任务未完成
|
|
private bool _IsLock = false;
|
|
public GameObject _LockIcon;
|
|
public void SetItemState()
|
|
{
|
|
Tab_StroyCopy stroyCopy = TableManager.GetStroyCopyByID(_CopySceneId, 0);
|
|
if (stroyCopy == null)
|
|
{
|
|
return;
|
|
}
|
|
int LimitLevel = stroyCopy.Level;
|
|
int level = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;//人物等级
|
|
if (level < LimitLevel || !GameManager.gameManager.MissionManager.IsMissionHaveDone(stroyCopy.LimitMissionId))
|
|
{
|
|
_LockIcon.SetActive(true);
|
|
SetHeadIconMaterial();
|
|
_IsLock = true;
|
|
}else
|
|
{
|
|
_IsLock = false;
|
|
_LockIcon.SetActive(false);
|
|
SetHeadIconMaterial();
|
|
}
|
|
}
|
|
|
|
private int _CurRemainTimes = -1;
|
|
public void SetRemainChallengeTimes(int _RemainTimes)
|
|
{
|
|
_CurRemainTimes = _RemainTimes;
|
|
|
|
SetItemState();
|
|
SetHeadIconMaterial();
|
|
}
|
|
|
|
public void SetHeadIconMaterial()
|
|
{
|
|
headIcon.material = _IsLock ? _GrayMaterial : headIcon.defaultMaterial;
|
|
}
|
|
|
|
//private void SetInfoItemBGAndMarkIcon()
|
|
//{
|
|
// _BG.overrideSprite = _SpriteList[1]; //背景
|
|
// _MarkIcon.overrideSprite = _SpriteList[3]; //选择背景
|
|
//}
|
|
|
|
public void RefreshBossItemInfo(StroyCopySceneRootCtrl.CopySceneType type)
|
|
{
|
|
Tab_StroyCopy stroyCopy = TableManager.GetStroyCopyByID(_CopySceneId, 0);
|
|
if (stroyCopy == null)
|
|
{
|
|
return;
|
|
}
|
|
_CurLevelType = (int)type;
|
|
//SetInfoItemBGAndMarkIcon();
|
|
}
|
|
|
|
public void OnItemClick()
|
|
{
|
|
StroyCopySceneRootCtrl.GteInstance().InitMyBossInfo(_CopySceneId, _IsLock);
|
|
}
|
|
}
|