142 lines
4.3 KiB
C#
142 lines
4.3 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.EventSystems;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
using GCGame.Table;
|
|
using GCGame;
|
|
using Games.GlobeDefine;
|
|
|
|
public class MasterRelationInfo : UIItemBase
|
|
{
|
|
public GameObject _IconBGMale;
|
|
public GameObject _IconBGFemale;
|
|
public Image _Icon;
|
|
public Text _Name;
|
|
public Text _RelationTip;
|
|
public Vector3 _PlayerTooltipPos;
|
|
|
|
private ulong _Guid;
|
|
private string _IconName;
|
|
private int _Level;
|
|
private int _CombatVal;
|
|
|
|
public void SetMaster(RelationDataProto relationData)
|
|
{
|
|
|
|
if (relationData != null)
|
|
{
|
|
SetBaseInfo(relationData);
|
|
if (_RelationTip != null)
|
|
{
|
|
_RelationTip.text = StrDictionary.GetClientDictionaryString("#{7300}");
|
|
_RelationTip.gameObject.SetActive(true);
|
|
}
|
|
_Guid = relationData.Guid;
|
|
_Level = relationData.Level;
|
|
_CombatVal = relationData.Combat;
|
|
}
|
|
else
|
|
{
|
|
SetEmptyInfo();
|
|
}
|
|
|
|
}
|
|
|
|
public void SetApprentice(RelationDataProto relationData)
|
|
{
|
|
|
|
if (relationData != null)
|
|
{
|
|
SetBaseInfo(relationData);
|
|
if (_RelationTip != null)
|
|
{
|
|
//_RelationTip.text = StrDictionary.GetClientDictionaryString("#{7301}");
|
|
//_RelationTip.gameObject.SetActive(true);
|
|
//_RelationTip.text = GameManager.gameManager.PlayerDataPool.m_MasterInfo.GetApprenticeCalling(relationData);
|
|
}
|
|
_Guid = relationData.Guid;
|
|
_Level = relationData.Level;
|
|
_CombatVal = relationData.Combat;
|
|
if (GCGame.Utils.GetProfessionGender(relationData.Prof) == GCGame.Utils.ChatGender.Female)
|
|
{
|
|
_IconBGMale.SetActive(false);
|
|
_IconBGFemale.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
_IconBGMale.SetActive(true);
|
|
_IconBGFemale.SetActive(false);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
SetEmptyInfo();
|
|
}
|
|
|
|
}
|
|
|
|
public void SetSwornBrother(SwornMember swornMember)
|
|
{
|
|
LoadAssetBundle.Instance.SetImageSprite(_Icon, Utils.GetProfessionSpriteName(swornMember.Profession));
|
|
_Name.text = swornMember.Name;
|
|
if (_RelationTip != null)
|
|
{
|
|
_RelationTip.text = GameManager.gameManager.PlayerDataPool._SwornBrother.GetSwornCalling(swornMember);
|
|
_RelationTip.gameObject.SetActive(true);
|
|
}
|
|
if (GCGame.Utils.GetProfessionGender(swornMember.Profession) == GCGame.Utils.ChatGender.Female)
|
|
{
|
|
_IconBGMale.SetActive(false);
|
|
_IconBGFemale.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
_IconBGMale.SetActive(true);
|
|
_IconBGFemale.SetActive(false);
|
|
}
|
|
_Guid = swornMember.Guid;
|
|
_Level = swornMember.Level;
|
|
_CombatVal = 0;
|
|
}
|
|
|
|
public void SetMyInfo()
|
|
{
|
|
LoadAssetBundle.Instance.SetImageSprite(_Icon, Utils.GetProfessionSpriteName(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Profession));
|
|
_Name.text = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.RoleName;
|
|
_RelationTip.gameObject.SetActive(false);
|
|
_Guid = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid;
|
|
}
|
|
|
|
private void SetBaseInfo(RelationDataProto relationData)
|
|
{
|
|
_IconName = Utils.GetProfessionSpriteName(relationData.Prof);
|
|
LoadAssetBundle.Instance.SetImageSprite(_Icon, _IconName);
|
|
_Name.text = relationData.Name;
|
|
}
|
|
|
|
private void SetEmptyInfo()
|
|
{
|
|
_Guid = GlobeVar.INVALID_GUID;
|
|
_IconName = Utils.GetSysIconName( Utils.SysIconType.None);
|
|
LoadAssetBundle.Instance.SetImageSprite(_Icon, _IconName);
|
|
_Name.text = StrDictionary.GetClientDictionaryString("#{7307}");
|
|
}
|
|
|
|
public override void OnItemClick()
|
|
{
|
|
base.OnItemClick();
|
|
|
|
ShowPlayerTooltip();
|
|
}
|
|
|
|
public void ShowPlayerTooltip()
|
|
{
|
|
if (_Guid != GlobeVar.INVALID_GUID)
|
|
{
|
|
PlayerTooltipsLogic.ShowPlayerTooltip(_Guid, _Name.text, _IconName, _Level, -1, _CombatVal, _PlayerTooltipPos);
|
|
}
|
|
}
|
|
}
|