Files
JJBB/Assets/Project/Script/GUI/Chat/ChatLinkActiveFunc.cs
2024-08-23 15:49:34 +08:00

108 lines
3.7 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using Games.Item;
using GCGame;
using GCGame.Table;
using Games.ChatHistory;
public class ChatLinkActiveFunc : ChatLinkName {
public ChatLinkType _chatLinkType;
public void SetChatLinkType(ChatLinkType type)
{
_chatLinkType = type;
}
private int _paramId = -1;
public override void SetLinkBySendStr(Text text, ChatHistoryItem chatHistory, string linkStr, string[] linkParams)
{
StrSend = linkStr;
StrInput = linkStr;
if (linkParams.Length != 2)
return;
_paramId = int.Parse(linkParams[1]);
StrShow = StrDictionary.GetClientDictionaryString("#{79312}");
}
protected override void LinkClick(int linkindex)
{
switch(_chatLinkType)
{
case ChatLinkType.ActiveAdvanceFashion:
{
var advanceFashionTab = TableManager.GetAdvanceFashionByID(_paramId, 0);
if(advanceFashionTab == null)
{
return;
}
var advanceFashionType = advanceFashionTab.Type;
if (!AdvanceCanadvanceCtr.GetInstance().IsAdvanceFuncOpen(advanceFashionType))
{
GUIData.AddNotifyData("#{2182}");
return;
}
UIManager.ShowUI(UIInfo.AdvanceMountPanel, delegate(bool bSucess, object param) {
if(bSucess)
{
AdvanceMountPanelCtr.Instance.SetAdvanceType(advanceFashionType);
AdvanceMountPanelCtr.Instance.ShowAdnvaceFashionPanel();
}
});
}
break;
case ChatLinkType.ActiveFashion:
{
var fashionItemTab = TableManager.GetFashionItemByID(_paramId, 0);
if(fashionItemTab == null)
{
return;
}
var _optionType = fashionItemTab.ClassId;
UIManager.ShowUI(UIInfo.BackPackRoot, delegate(bool bSucess, object param) {
if(bSucess)
{
BackPackLogic.Instance()._TagPanel.ShowPage(1);
if(FashionPanelCtr.Instance && FashionPanelCtr.Instance.gameObject.activeInHierarchy)
{
FashionPanelCtr.Instance.OnItemClick(_optionType);
}
}
});
}
break;
case ChatLinkType.ActivePet:
{
//宠物功能ID是3
var petFunctionId = 3;
if (!GameManager.gameManager.PlayerDataPool.FunctionOpenState.ContainsKey(petFunctionId)
|| !GameManager.gameManager.PlayerDataPool.FunctionOpenState[petFunctionId])
{
GUIData.AddNotifyData("#{2182}");
return;
}
UIManager.ShowUI(UIInfo.PetMainWndPath, delegate (bool bSucess, object param)
{
if (bSucess)
{
PetMainWnd.Instance._TagPanel.ShowPage(4);
}
});
}
break;
case ChatLinkType.ActiveTitle:
{
UIManager.ShowUI(UIInfo.TitleView);
}
break;
}
}
}