940 lines
28 KiB
C#
940 lines
28 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Games.ChatHistory;
|
|
using GCGame.Table;
|
|
using Games.GlobeDefine;
|
|
using GCGame;
|
|
using Module.Log;
|
|
using Games.Item;
|
|
|
|
public class ChatInfoLogItem : MonoBehaviour
|
|
{
|
|
public virtual float GetItemHeight()
|
|
{
|
|
return _LayoutElement.minHeight;
|
|
}
|
|
public bool _IsSelf = false;
|
|
public Image _ChatInfoBG;
|
|
//public Image _HornBG;
|
|
public Text _ChatInfo;
|
|
public Text _SenderName;
|
|
public Text _SenderLv;
|
|
public Image _SenderIcon;
|
|
public Image _SenderIconBG;
|
|
public Image _HeadOutlineImage;
|
|
public Image _CannelIcon;
|
|
public LayoutElement _LayoutElement;
|
|
public LayoutElement _ContexLayoutElement;
|
|
|
|
public GameObject _OriginHorn;
|
|
public GameObject _BattleHorn;
|
|
public GameObject _AllHorn;
|
|
|
|
public Image _NormalImage;
|
|
public bool _IsShowBlackColor = true;
|
|
|
|
//没有使用特殊外观的时候使用原始值
|
|
public Sprite _OriginChatBG;
|
|
public Sprite _OriginHeadBG;
|
|
|
|
protected bool _IsUsedOrnamentChatPopBG = false;
|
|
|
|
public Vector2 contentBoard = Vector2.zero; // 调整气泡边界宽度
|
|
|
|
public ChatHistoryLogic _ChatHistoryPanel;
|
|
|
|
protected RectTransform _RectTransform;
|
|
public RectTransform RectTransform
|
|
{
|
|
get
|
|
{
|
|
if (_RectTransform == null)
|
|
{
|
|
_RectTransform = GetComponent<RectTransform>();
|
|
}
|
|
return _RectTransform;
|
|
}
|
|
}
|
|
|
|
//高度需要减去一行字体的高度
|
|
public Vector2 _ChatInfoBGMinSize = new Vector2(168, 120);
|
|
|
|
protected ChatHistoryItem _ChatHistory;
|
|
public ChatHistoryItem ChatHistory
|
|
{
|
|
get
|
|
{
|
|
return _ChatHistory;
|
|
}
|
|
}
|
|
|
|
protected string _ModifiedStr;
|
|
|
|
protected IEnumerator WaitLayout()
|
|
{
|
|
yield return null;
|
|
while (_ChatInfo != null && !string.IsNullOrEmpty(_ChatInfo.text))
|
|
{
|
|
if (_ChatInfo.cachedTextGenerator.characterCountVisible == _ChatInfo.text.Length)
|
|
{
|
|
SetLinksAfterLayout();
|
|
break;
|
|
}
|
|
else
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
//void OnDisable()
|
|
//{
|
|
// ClearChat();
|
|
//}
|
|
|
|
public virtual void ClearChat()
|
|
{
|
|
if (_ChatInfo != null)
|
|
_ChatInfo.text = "";
|
|
ClearAllLinks();
|
|
if (_LinkLists != null)
|
|
_LinkLists.Clear();
|
|
}
|
|
|
|
public bool SetChatLog(ChatHistoryItem history)
|
|
{
|
|
_ChatHistory = history;
|
|
if (_ChatHistory == null)
|
|
return false;
|
|
if(gameObject.activeInHierarchy)
|
|
StartCoroutine(SetOrnamentBG());
|
|
|
|
return SetDetailLog();
|
|
}
|
|
|
|
protected IEnumerator SetOrnamentBG(){
|
|
|
|
yield return new WaitForEndOfFrame();
|
|
|
|
if(_ChatInfoBG == null || _OriginChatBG == null)
|
|
{
|
|
yield break;
|
|
}
|
|
_IsUsedOrnamentChatPopBG = _ChatHistory.ChatPopType != -1;
|
|
//LogModule.ErrorLog("SenderName : " + _ChatHistory.SenderName + ", info : " +ChatHistory.ChatInfo + ", headBG : " + ChatHistory.HeadBGType
|
|
// + ", ChatPopType : " + ChatHistory.ChatPopType);
|
|
if (_ChatHistory.ChatPopType == -1)
|
|
{
|
|
_ChatInfoBG.overrideSprite = _OriginChatBG;
|
|
//if(_HornBG)
|
|
// _HornBG.overrideSprite = _OriginChatBG;
|
|
}
|
|
else
|
|
{
|
|
var ornamentTab = TableManager.GetOrnamentByID(_ChatHistory.ChatPopType, 0);
|
|
if (ornamentTab == null)
|
|
{
|
|
Debug.LogError("ornamentTab is null : " + _ChatHistory.ChatPopType);
|
|
_ChatInfoBG.overrideSprite = _OriginChatBG;
|
|
yield break;
|
|
}
|
|
_ChatInfoBG.overrideSprite = null;
|
|
LoadAssetBundle.Instance.SetImageSprite(_ChatInfoBG, _IsSelf ? ornamentTab.SelfChatBG : ornamentTab.OtherChatBG,
|
|
delegate(bool bSucess, GameObject obj) {
|
|
ForceUpdateCanvas();
|
|
});
|
|
//LoadAssetBundle.Instance.SetImageSprite(_HornBG, isSelf ? ornamentTab.SelfChatBG : ornamentTab.OtherChatBG);
|
|
}
|
|
|
|
if (_ChatHistory.HeadBGType == -1)
|
|
{
|
|
if(_HeadOutlineImage)
|
|
_HeadOutlineImage.overrideSprite = _OriginHeadBG;
|
|
}
|
|
else
|
|
{
|
|
var ornamentTab = TableManager.GetOrnamentByID(_ChatHistory.HeadBGType, 0);
|
|
if(ornamentTab == null)
|
|
{
|
|
Debug.LogError("ornamentTab is null : " + _ChatHistory.HeadBGType);
|
|
_HeadOutlineImage.overrideSprite = _OriginHeadBG;
|
|
yield break;
|
|
}
|
|
if (_HeadOutlineImage)
|
|
{
|
|
_HeadOutlineImage.overrideSprite = null;
|
|
LoadAssetBundle.Instance.SetImageSprite(_HeadOutlineImage, ornamentTab.ShowIconName);
|
|
}
|
|
}
|
|
|
|
yield break;
|
|
}
|
|
|
|
private void ForceUpdateCanvas()
|
|
{
|
|
//Debug.LogError("ForceUpdateCanvas");
|
|
//Canvas.ForceUpdateCanvases();
|
|
//if(ChatInfoLogic.Instance())
|
|
//{
|
|
// var canvasComponent = ChatInfoLogic.Instance().GetComponent<Canvas>();
|
|
// if(canvasComponent == null)
|
|
// {
|
|
// LogModule.ErrorLog("canvasComponent is null");
|
|
// return;
|
|
// }
|
|
|
|
//}
|
|
}
|
|
|
|
protected virtual bool SetDetailLog()
|
|
{
|
|
ClearChat();
|
|
if (_SenderName != null)
|
|
{
|
|
if(_ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_ALLSERSPEAKER
|
|
|| _ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_CROSSSERSPEAKER)
|
|
_SenderName.text = _ChatHistory.ServerName + "·" + _ChatHistory.SenderName;
|
|
else
|
|
_SenderName.text = _ChatHistory.SenderName;
|
|
_SenderName.gameObject.SetActive(true);
|
|
}
|
|
|
|
if (_SenderLv != null)
|
|
{
|
|
_SenderLv.text = _ChatHistory.SenderLevel.ToString();
|
|
}
|
|
|
|
if (_SenderIcon != null)
|
|
{
|
|
string spriteName = _ChatHistory.SenderIcon;
|
|
LoadAssetBundle.Instance.SetImageSprite(_SenderIcon, spriteName);
|
|
_SenderIcon.gameObject.SetActive(true);
|
|
_SenderIconBG.gameObject.SetActive(true);
|
|
}
|
|
|
|
if (_OriginHorn)
|
|
_OriginHorn.SetActive(_ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_LOUDSPEAKER);
|
|
if (_BattleHorn)
|
|
_BattleHorn.SetActive(_ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_CROSSSERSPEAKER);
|
|
if (_AllHorn)
|
|
_AllHorn.SetActive(_ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_ALLSERSPEAKER);
|
|
|
|
//var cannleSprite = GetCannelStr(_ChatHistory.EChannel);
|
|
//if (string.IsNullOrEmpty(cannleSprite))
|
|
{
|
|
if (_CannelIcon != null)
|
|
{
|
|
_CannelIcon.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
//else
|
|
//{
|
|
// _CannelIcon.gameObject.SetActive(true);
|
|
// LoadAssetBundle.Instance.SetImageSprite(_CannelIcon, cannleSprite);
|
|
//}
|
|
|
|
if (_ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_INVALID)
|
|
{
|
|
_ModifiedStr = _ChatHistory.ChatInfo;
|
|
}
|
|
else
|
|
{
|
|
// 若信息没被处理过,再处理一遍?
|
|
if ((_ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM || (_ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_WORLD && _ChatHistory.SenderGuid == GlobeVar.INVALID_GUID)) && _ChatHistory.ChatInfo[0] == '#')
|
|
{
|
|
_ModifiedStr = StrDictionary.GetServerDictionaryFormatString(_ChatHistory.ChatInfo);
|
|
|
|
}
|
|
else if (_ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_GUILD && _ChatHistory.SenderGuid == GlobeVar.INVALID_GUID && _ChatHistory.ChatInfo[0] == '#')
|
|
{
|
|
_ModifiedStr = StrDictionary.GetServerDictionaryFormatString(_ChatHistory.ChatInfo);
|
|
}
|
|
else
|
|
{
|
|
_ModifiedStr = _ChatHistory.ChatInfo;
|
|
}
|
|
|
|
GetAllChatLinks(_ChatHistory);
|
|
_ModifiedStr = GetLinkedStr(_ChatHistory);
|
|
}
|
|
if(string.IsNullOrEmpty(_ModifiedStr))
|
|
{
|
|
return false;
|
|
}
|
|
_ChatInfo.text = _ModifiedStr;
|
|
_ChatInfo.CalculateLayoutInputHorizontal();
|
|
_ChatInfo.CalculateLayoutInputVertical();
|
|
|
|
SetBGWidth();
|
|
|
|
if(this.gameObject.activeInHierarchy == true)
|
|
{
|
|
StartCoroutine(WaitLayout());
|
|
}
|
|
|
|
SetPrivilegeVIPIcon();
|
|
SetVIPIcon();
|
|
|
|
return true;
|
|
}
|
|
|
|
protected virtual void SetBGWidth()
|
|
{
|
|
if (_ChatInfoBG == null)
|
|
return;
|
|
|
|
Debug.Log("chatItemWidth:" + RectTransform.sizeDelta.x);
|
|
float bgWidth = _ChatInfoBGMinSize.x;
|
|
if (_ChatInfo.preferredWidth + 20 > bgWidth && _ChatInfo.preferredWidth + 20 < _ChatInfo.rectTransform.rect.width)
|
|
{
|
|
bgWidth = _ChatInfo.preferredWidth + 25;
|
|
}
|
|
else if (_ChatInfo.preferredWidth + 20 > _ChatInfo.rectTransform.rect.width)
|
|
{
|
|
bgWidth = _ChatInfo.rectTransform.rect.width + 25;
|
|
}
|
|
|
|
_ChatInfoBG.gameObject.SetActive(true);
|
|
_ChatInfoBG.rectTransform.sizeDelta = new Vector2(Math.Min(_ChatInfoBGMinSize.x + _ChatInfo.preferredWidth, 430) , _ChatInfo.preferredHeight + _ChatInfoBGMinSize.y);
|
|
|
|
_LayoutElement.minHeight = _ChatInfoBG.rectTransform.rect.height;
|
|
_LayoutElement.minWidth = RectTransform.rect.width;
|
|
}
|
|
|
|
protected string GetCannelStr(GC_CHAT.CHATTYPE cannel)
|
|
{
|
|
switch (cannel)
|
|
{
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_GUILD:
|
|
return ("_0005_guid");
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_NORMAL:
|
|
return ("_0011_normal");
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM:
|
|
return ("_0001_system");
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_TEAM:
|
|
return ("_0004_team");
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_WORLD:
|
|
return ("_0000_world");
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_BATTLE:
|
|
return ("_0009_battle");
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_LOUDSPEAKER: //喇叭当做世界频道处理
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_ALLSERSPEAKER:
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_CROSSSERSPEAKER:
|
|
return ("_0006_louder");
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_TEAM_INVITE:
|
|
return ("_0012_teaminfo");
|
|
}
|
|
|
|
return "";
|
|
}
|
|
protected string GetCannelTitleStr(GC_CHAT.CHATTYPE cannel)
|
|
{
|
|
switch (cannel)
|
|
{
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_GUILD:
|
|
return StrDictionary.GetClientDictionaryString("#{42608}");
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_NORMAL:
|
|
return StrDictionary.GetClientDictionaryString("#{42609}");
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM:
|
|
return StrDictionary.GetClientDictionaryString("#{42610}");
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_TEAM:
|
|
return StrDictionary.GetClientDictionaryString("#{42611}");
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_WORLD:
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_LOUDSPEAKER:
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_ALLSERSPEAKER:
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_CROSSSERSPEAKER:
|
|
return StrDictionary.GetClientDictionaryString("#{42612}");
|
|
case GC_CHAT.CHATTYPE.CHAT_TYPE_BATTLE: //喇叭当做世界频道处理
|
|
return StrDictionary.GetClientDictionaryString("#{42613}");
|
|
default:
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public void OnViewChatSenderInfo()
|
|
{
|
|
if (!gameObject.name.Contains("Mine") && _ChatHistory.SenderGuid == GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid)
|
|
{
|
|
Debug.LogError("SenderGuidError");
|
|
return;
|
|
}
|
|
//if (_NameLinkGuid.Count > 0)
|
|
{
|
|
PlayerTooltipsLogic.ShowPlayerTooltip(_ChatHistory.SenderGuid, _ChatHistory.SenderName, _ChatHistory.SenderIcon, _ChatHistory.SenderLevel, -1, 0, Vector3.zero, 0, _ChatHistory.ChatInfo);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#region link base
|
|
|
|
protected List<ChatLinkBase> _LinkLists = new List<ChatLinkBase>();
|
|
|
|
protected void ClearAllLinks()
|
|
{
|
|
foreach (var link in _LinkLists)
|
|
{
|
|
if(link != null)
|
|
link.ClearLink();
|
|
}
|
|
_LinkLists.Clear();
|
|
if(_ChatInfo != null)
|
|
_ChatInfo.text = "";
|
|
}
|
|
|
|
|
|
protected void GetAllChatLinks(ChatHistoryItem history)
|
|
{
|
|
int checkPos = _ModifiedStr.IndexOf(ChatLinkBase.StrSendStart);
|
|
int checkEndPos = -1;
|
|
string checkStr = "";
|
|
while (checkPos >= 0)
|
|
{
|
|
checkEndPos = _ModifiedStr.IndexOf(ChatLinkBase.StrSendEnd, checkPos);
|
|
checkStr = _ModifiedStr.Substring(checkPos, checkEndPos - checkPos);
|
|
if (!string.IsNullOrEmpty(checkStr))
|
|
{
|
|
var chatLink = ChatLinkBase.CreateChatLinkBySendStr(_ChatInfo, history, checkStr, _IsShowBlackColor);
|
|
chatLink.StartPosInText = checkPos;
|
|
chatLink.EndPosInText = checkEndPos;
|
|
_LinkLists.Add(chatLink);
|
|
}
|
|
|
|
checkPos = _ModifiedStr.IndexOf(ChatLinkBase.StrSendStart, checkEndPos);
|
|
}
|
|
}
|
|
|
|
protected string GetLinkedStr(ChatHistoryItem history)
|
|
{
|
|
int subStrStart = 0;
|
|
int subStrEnd = 0;
|
|
int newInputEnd = 0;
|
|
string newInputText = "";
|
|
for (int i = 0; i < _LinkLists.Count; ++i)
|
|
{
|
|
if (i > 0)
|
|
{
|
|
subStrStart = _LinkLists[i - 1].EndPosInText + 1;
|
|
}
|
|
subStrEnd = _LinkLists[i].StartPosInText;
|
|
|
|
if (subStrEnd > subStrStart)
|
|
{
|
|
newInputText += _ModifiedStr.Substring(subStrStart, subStrEnd - subStrStart);
|
|
}
|
|
_LinkLists[i].StartPosInShowText = newInputText.Length;
|
|
newInputText += _LinkLists[i].StrShow;
|
|
newInputEnd = _LinkLists[i].EndPosInText + 1;
|
|
_LinkLists[i].EndPosInShowText = newInputText.Length;
|
|
}
|
|
newInputText += _ModifiedStr.Substring(newInputEnd, _ModifiedStr.Length - newInputEnd);
|
|
|
|
return newInputText;
|
|
}
|
|
|
|
protected void SetLinksAfterLayout()
|
|
{
|
|
foreach (var link in _LinkLists)
|
|
{
|
|
link.SetLinkAfterLayout(_ChatInfo);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region modify for char name
|
|
|
|
protected string GetSenderNameLink(ChatHistoryItem history)
|
|
{
|
|
if (history.SenderGuid != GlobeVar.INVALID_GUID
|
|
&& !string.IsNullOrEmpty( history.SenderName)
|
|
&& history.EChannel != GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM
|
|
&& !_ChatHistory.IsSystem)
|
|
{
|
|
var chatLink = new ChatLinkName();
|
|
if(history.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_ALLSERSPEAKER
|
|
|| history.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_CROSSSERSPEAKER)
|
|
chatLink.SetLinkCharName(history.ServerName + "·" + history.SenderName, history.SenderGuid);
|
|
else
|
|
chatLink.SetLinkCharName(history.SenderName, history.SenderGuid);
|
|
return chatLink.StrSend;
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region static for link tips
|
|
|
|
public static void ShowItemTooltips(GC_RET_SHOW_CHAT_APPENDIX_INFO_ITEM packet)
|
|
{
|
|
LogModule.DebugLog("show ShowItemTooltips");
|
|
|
|
GameItem item = new GameItem();
|
|
|
|
int nRawId = item.DataID;
|
|
UInt64 RawGuidID = item.Guid;
|
|
//ID
|
|
item.DataID = packet.Dataid;
|
|
//GUID
|
|
item.Guid = packet.Guid;
|
|
//绑定
|
|
|
|
item.IsFrenzy = packet.HasIsfrenzy;
|
|
|
|
if (packet.HasBindflag)
|
|
{
|
|
if (packet.Bindflag == 1)
|
|
{
|
|
item.BindFlag = true;
|
|
}
|
|
else
|
|
{
|
|
item.BindFlag = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
item.BindFlag = false;
|
|
}
|
|
//叠加数量
|
|
if (packet.HasStackcount)
|
|
{
|
|
item.StackCount = packet.Stackcount;
|
|
}
|
|
else
|
|
{
|
|
item.StackCount = 1;
|
|
}
|
|
//创建时间
|
|
item.CreateTime = packet.Createtime;
|
|
//强化等级
|
|
if (packet.HasEnchancelevel)
|
|
{
|
|
item.EnchanceLevel = packet.Enchancelevel;
|
|
item.StrengthLevel = packet.Enchancelevel;
|
|
item.StrengPerfect.Clear();
|
|
for (int i = 0; i < packet.enchancelvladdpercentCount; ++i)
|
|
{
|
|
item.StrengPerfect.Add(packet.GetEnchancelvladdpercent(i));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
item.EnchanceLevel = 0;
|
|
item.StrengthLevel = 0;
|
|
item.StrengPerfect.Clear();
|
|
}
|
|
//强化经验
|
|
if (packet.HasEnchanceexp)
|
|
{
|
|
item.EnchanceExp = packet.Enchanceexp;
|
|
}
|
|
else
|
|
{
|
|
item.EnchanceExp = 0;
|
|
}
|
|
//强化总经验
|
|
if (packet.HasEnctotaltexp)
|
|
{
|
|
item.EnchanceTotalExp = packet.Enctotaltexp;
|
|
}
|
|
else
|
|
{
|
|
item.EnchanceTotalExp = 0;
|
|
}
|
|
//打星等级
|
|
if (packet.HasStarlevel)
|
|
{
|
|
item.StarLevel = packet.Starlevel;
|
|
}
|
|
else
|
|
{
|
|
item.StarLevel = 0;
|
|
}
|
|
//打星次数
|
|
if (packet.HasStartimes)
|
|
{
|
|
item.StarTimes = packet.Startimes;
|
|
}
|
|
else
|
|
{
|
|
item.StarTimes = 0;
|
|
}
|
|
//动态参数
|
|
if (packet.HasDynamicdata1)
|
|
{
|
|
item.DynamicData[0] = packet.Dynamicdata1;
|
|
}
|
|
else
|
|
{
|
|
item.DynamicData[0] = 0;
|
|
}
|
|
if (packet.HasDynamicdata2)
|
|
{
|
|
item.DynamicData[1] = packet.Dynamicdata2;
|
|
}
|
|
else
|
|
{
|
|
item.DynamicData[1] = 0;
|
|
}
|
|
if (packet.HasDynamicdata3)
|
|
{
|
|
item.DynamicData[2] = packet.Dynamicdata3;
|
|
}
|
|
else
|
|
{
|
|
item.DynamicData[2] = 0;
|
|
}
|
|
if (packet.HasDynamicdata4)
|
|
{
|
|
item.DynamicData[3] = packet.Dynamicdata4;
|
|
}
|
|
else
|
|
{
|
|
item.DynamicData[3] = 0;
|
|
}
|
|
if (packet.HasDynamicdata5)
|
|
{
|
|
item.DynamicData[4] = packet.Dynamicdata5;
|
|
}
|
|
else
|
|
{
|
|
item.DynamicData[4] = 0;
|
|
}
|
|
if (packet.HasDynamicdata6)
|
|
{
|
|
item.DynamicData[5] = packet.Dynamicdata6;
|
|
}
|
|
else
|
|
{
|
|
item.DynamicData[5] = 0;
|
|
}
|
|
if (packet.HasDynamicdata7)
|
|
{
|
|
item.DynamicData[6] = packet.Dynamicdata7;
|
|
}
|
|
else
|
|
{
|
|
item.DynamicData[6] = 0;
|
|
}
|
|
if (packet.HasDynamicdata8)
|
|
{
|
|
item.DynamicData[7] = packet.Dynamicdata8;
|
|
}
|
|
else
|
|
{
|
|
item.DynamicData[7] = 0;
|
|
}
|
|
|
|
//装备评分
|
|
if (packet.HasEnchancescore)
|
|
{
|
|
item.CombatValue = packet.Enchancescore;
|
|
}
|
|
else
|
|
{
|
|
item.CombatValue = 0;
|
|
}
|
|
|
|
//装备完美值
|
|
if (packet.HasEnchanceperfectid)
|
|
{
|
|
item.StrengthPerfect = packet.Enchanceperfectid;
|
|
}
|
|
else
|
|
{
|
|
item.StrengthPerfect = 0;
|
|
}
|
|
item.StrengPerfect.Clear();
|
|
for (int i = 0; i < packet.enchancelvladdpercentCount; ++i)
|
|
{
|
|
item.StrengPerfect.Add(packet.GetEnchancelvladdpercent(i));
|
|
}
|
|
|
|
//基础属性
|
|
//item.BaseOriginAttrs.Clear();
|
|
//for (int i = 0; i < packet.basicbaptizepropvalueCount; ++i)
|
|
//{
|
|
// item.BaseOriginAttrs.Add(item.GetBaseAttr(i, packet.GetBasicbaptizepropvalue(i)));
|
|
//}
|
|
|
|
item.BaseAttrs.Clear();
|
|
for (int i = 0; i < packet.basicbaptizepropvalueCount; ++i)
|
|
{
|
|
item.BaseAttrs.Add(item.GetBaseAttr(i, packet.GetBasicbaptizepropvalue(i), packet.GetBasicpropaddvalue(i)));
|
|
}
|
|
|
|
|
|
//词条
|
|
item.ExAttrs.Clear();
|
|
if (packet.propbarpropidCount > 0)
|
|
{
|
|
var equipAttrTab = TableManager.GetEquipBaptizeByID((int)item.GetQuality(), 0);
|
|
for (int i = 0; i < packet.propbarpropidCount; ++i)
|
|
{
|
|
var exProp = item.GetXilianAttr(packet.GetPropbarpropid(i), packet.GetPropbarsubpropid(i), packet.GetPropbarpropvalue(i));
|
|
if(exProp != null)
|
|
{
|
|
if (equipAttrTab != null && i < equipAttrTab.PropBarFixedNumber)
|
|
{
|
|
exProp.IsFixedImg = true;
|
|
}
|
|
|
|
item.ExAttrs.Add(exProp);
|
|
}
|
|
}
|
|
}
|
|
|
|
//洗练词条
|
|
item.ExAttrsNew.Clear();
|
|
if (packet.newpropbarpropidCount > 0)
|
|
{
|
|
var equipAttrTab = TableManager.GetEquipBaptizeByID((int)item.GetQuality(), 0);
|
|
for (int i = 0; i < packet.newpropbarpropidCount; ++i)
|
|
{
|
|
var exProp = item.GetXilianAttr(packet.GetNewpropbarpropid(i), packet.GetNewpropbarsubpropid(i), packet.GetNewpropbarpropvalue(i));
|
|
if (exProp != null)
|
|
{
|
|
if (equipAttrTab != null && i < equipAttrTab.PropBarFixedNumber)
|
|
{
|
|
exProp.IsFixedImg = true;
|
|
}
|
|
|
|
item.ExAttrsNew.Add(exProp);
|
|
}
|
|
}
|
|
}
|
|
|
|
//洗练积分
|
|
if (packet.HasPropbarbaptizetimes)
|
|
{
|
|
item.XilianPoint = packet.Propbarbaptizetimes;
|
|
}
|
|
|
|
//耐久
|
|
if (packet.HasDurable)
|
|
{
|
|
item.Durable = packet.Durable;
|
|
}
|
|
else
|
|
{
|
|
item.Durable = 0;
|
|
}
|
|
|
|
//level
|
|
if (packet.HasEquipwearlevel)
|
|
{
|
|
item.EquipUseLevel = packet.Equipwearlevel;
|
|
}
|
|
else
|
|
{
|
|
item.EquipUseLevel = item.GetEquipLevel();
|
|
}
|
|
|
|
//珍品
|
|
if (packet.HasIstreasure)
|
|
{
|
|
item.IsRare = packet.Istreasure > 0;
|
|
}
|
|
else
|
|
{
|
|
item.IsRare = false;
|
|
}
|
|
|
|
//失魂
|
|
if (packet.HasInvalidexpiretime)
|
|
{
|
|
item.ShihunTime = packet.Invalidexpiretime;
|
|
}
|
|
else
|
|
{
|
|
item.ShihunTime = 0;
|
|
}
|
|
|
|
//宝石
|
|
item.GemItems.Clear();
|
|
int gemCnt = packet.Holeamount;
|
|
for (int i = 0; i < GameItem.MAX_GEM_INFO; ++i)
|
|
{
|
|
if (i < gemCnt)
|
|
{
|
|
item.GemItems.Add(new GemData() { IsOpen = true });
|
|
}
|
|
else
|
|
{
|
|
item.GemItems.Add(new GemData() { IsOpen = false });
|
|
}
|
|
}
|
|
for (int i = 0; i < packet.gemidCount; ++i)
|
|
{
|
|
item.GemItems[i].DataID = packet.GetGemid(i);
|
|
item.GemItems[i].Level = packet.GetGemlvl(i);
|
|
}
|
|
|
|
if (packet.gemsuitindexidCount > 0)
|
|
{
|
|
item._GemSuit1 = packet.gemsuitindexidList[0];
|
|
|
|
if (packet.gemsuitindexidCount > 1)
|
|
item._GemSuit2 = packet.gemsuitindexidList[1];
|
|
|
|
if (packet.gemsuitindexidCount > 2)
|
|
item._GemSuit3 = packet.gemsuitindexidList[2];
|
|
}
|
|
else
|
|
{
|
|
item._GemSuit1 = -1;
|
|
item._GemSuit2 = -1;
|
|
item._GemSuit3 = -1;
|
|
}
|
|
|
|
if (item.IsEquipMent())
|
|
{
|
|
item.EnchanceScore = CombatValue.CalculateEquipSingle(item);
|
|
item.BaseCombat = CombatValue.CalculateBaseAttr(item);
|
|
item.BaseCombat += CombatValue.CalculateXilian(item.ExAttrs, item.DataID);
|
|
EquipTooltipsLogic.ShowEquipTooltip(item, ItemTooltipsLogic.ShowType.Compare, new Vector3(-1,0,0));
|
|
}
|
|
else if(item.IsMagicMent())
|
|
{
|
|
item.EnchanceScore = CombatValue.CalculateMagicSingle(item);
|
|
MagicTooltipLogic.ShowEquipTooltip(item, ItemTooltipsLogic.ShowType.Compare);
|
|
}
|
|
else
|
|
{
|
|
ItemTooltipsLogic.ShowItemTooltip(item, ItemTooltipsLogic.ShowType.Info, new Vector3(-1,0,0));
|
|
}
|
|
|
|
}
|
|
|
|
public static void ShowEquipTooltips(GC_RET_SHOW_CHAT_APPENDIX_INFO_EQUIPMENT itemPacket)
|
|
{
|
|
LogModule.DebugLog("show ShowEquipTooltips");
|
|
}
|
|
|
|
public static void ShowPetTooltips(GC_RET_SHOW_CHAT_APPENDIX_INFO_PET packet)
|
|
{
|
|
Games.Fellow.Fellow fellow = new Games.Fellow.Fellow();
|
|
string Name = packet.OwnerName;
|
|
fellow.Guid = packet.Guid;
|
|
fellow.DataId = packet.Dataid;
|
|
fellow.Name = packet.Name;
|
|
if (packet.HasExp)
|
|
{
|
|
fellow.Exp = packet.Exp;
|
|
}
|
|
else
|
|
{
|
|
fellow.Exp = 0;
|
|
}
|
|
|
|
if (packet.HasLevel)
|
|
{
|
|
fellow.Level = packet.Level;
|
|
}
|
|
else
|
|
{
|
|
fellow.Level = 1;
|
|
}
|
|
fellow.StarLevel = 0;
|
|
fellow.Quality = packet.Quality;
|
|
|
|
int count = packet.skillIdCount;
|
|
for (int nIndex = 0; nIndex < count; nIndex++)
|
|
{
|
|
fellow.SetOwnSkillId(packet.GetSkillId(nIndex), -1);
|
|
}
|
|
|
|
fellow.character = packet.Character;
|
|
fellow.grow = packet.Growth * 1.0f / 10000.0f;
|
|
fellow.cultivation = packet.Caltivation;
|
|
fellow.sawy = packet.Savvy;
|
|
fellow.blood = packet.MaxHp;
|
|
fellow.CombatValue = packet.Combat;
|
|
|
|
//资质
|
|
fellow.Boneatitude = packet.ConstituAptitude;
|
|
fellow.Forceatitude = packet.MorfiAptitude;
|
|
fellow.Poweratitude = packet.StrengthAptitude;
|
|
fellow.Smartatitude = packet.IntellengAptitude;
|
|
fellow.Agileatitude = packet.AgileAptitude;
|
|
|
|
fellow.AptitudeTotle = packet.Star * 1.0f / 100.0f;
|
|
|
|
|
|
fellow.attack = packet.Attack;
|
|
fellow.avoid = packet.Dodge;
|
|
fellow.hit = packet.Hit;
|
|
fellow.physical = packet.PysDef;
|
|
fellow.magic = packet.MagDef;
|
|
|
|
fellow.bone = packet.Constitu;
|
|
fellow.force = packet.Morfi;
|
|
fellow.power = packet.Strength;
|
|
fellow.smart = packet.Intelleng;
|
|
fellow.agile = packet.Agile;
|
|
|
|
UIManager.ShowUI(UIInfo.OtherPetInfoWndPath, delegate (bool succ, object param)
|
|
{
|
|
if (succ)
|
|
{
|
|
GameObject Wnd = UIManager.GetUIGameObject(UIInfo.OtherPetInfoWndPath);
|
|
if (Wnd != null)
|
|
{
|
|
OtherPetInfoWnd petInfo = Wnd.GetComponent<OtherPetInfoWnd>();
|
|
if (petInfo != null)
|
|
{
|
|
petInfo.OPenBaseAttrWnd(param as Games.Fellow.Fellow, Name);
|
|
}
|
|
}
|
|
}
|
|
}, fellow);
|
|
}
|
|
#endregion
|
|
|
|
#region vip info
|
|
|
|
public Image _PrivilegeVipIcon;
|
|
public Image _VipIcon;
|
|
|
|
protected void SetPrivilegeVIPIcon()
|
|
{
|
|
if (_PrivilegeVipIcon == null)
|
|
return;
|
|
|
|
string priVipIcon = Utils.GetPrivilegeVipIcon(_ChatHistory.SenderPrivilegeVIP);
|
|
if (string.IsNullOrEmpty(priVipIcon))
|
|
{
|
|
_PrivilegeVipIcon.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
_PrivilegeVipIcon.gameObject.SetActive(true);
|
|
LoadAssetBundle.Instance.SetImageSprite(_PrivilegeVipIcon, priVipIcon);
|
|
}
|
|
}
|
|
|
|
protected void SetVIPIcon()
|
|
{
|
|
if (_VipIcon == null)
|
|
return;
|
|
|
|
string vipIcon = Utils.GetVipIcon(_ChatHistory.SenderVIPLevel);
|
|
if (string.IsNullOrEmpty(vipIcon))
|
|
{
|
|
_VipIcon.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
_VipIcon.gameObject.SetActive(true);
|
|
LoadAssetBundle.Instance.SetImageSprite(_VipIcon, vipIcon);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|