138 lines
5.2 KiB
C#
138 lines
5.2 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using GCGame.Table;
|
|
using Games.Fellow;
|
|
|
|
public class PetFightSeting : UIItemBase
|
|
{
|
|
public Text FightState;
|
|
public Text Name;
|
|
public Text Level;
|
|
public Text DescText;
|
|
public Text OPenLevelText;
|
|
public Image Icon;
|
|
public GameObject AddObj;
|
|
public GameObject ZhanIcon;
|
|
public GameObject ZhuIcon;
|
|
public GameObject AttachIcon;
|
|
|
|
|
|
int AttachType;//-1 出战宠物 -2 助战宠物 >0 附加宠物
|
|
int OPenLevel = 1000;
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
base.Show();
|
|
AttachType = (int)hash["InitObj"];
|
|
Fellow fellow = null;
|
|
if(AttachType == -1)
|
|
{
|
|
FightState.text = StrDictionary.GetClientDictionaryString("#{20183}");
|
|
fellow = GameManager.gameManager.PlayerDataPool.FellowContainer.GetCalledFellow();
|
|
OPenLevel = 1;
|
|
DescText.text = StrDictionary.GetClientDictionaryString("#{20180}");
|
|
}
|
|
else if (AttachType == -2)
|
|
{
|
|
FightState.text = StrDictionary.GetClientDictionaryString("#{20184}");
|
|
fellow = GameManager.gameManager.PlayerDataPool.FellowContainer.GetHelpedFellow();
|
|
OPenLevel = SystemParam.GetSystemParam_INT(55);
|
|
//DescText.text = StrDictionary.GetClientDictionaryString("#{20181}");
|
|
Tab_FellowAttached tab = TableManager.GetFellowAttachedByID(1, 0);
|
|
if (tab != null)
|
|
{
|
|
//OPenLevel = tab.OpenLevel;
|
|
DescText.text = StrDictionary.GetClientDictionaryString("#{20181}", tab.AddPerNormal, tab.AddPerGod, tab.AddPerSuper, tab.AddPerUltra);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
Tab_FellowAttached tab = TableManager.GetFellowAttachedByID(AttachType, 0);
|
|
if(tab!=null)
|
|
{
|
|
OPenLevel = tab.OpenLevel;
|
|
//DescText.text = StrDictionary.GetClientDictionaryString("#{20182}",tab.AddPerNormal,tab.AddPerGod);
|
|
DescText.text = StrDictionary.GetClientDictionaryString("#{20182}", tab.AddPerNormal, tab.AddPerGod, tab.AddPerSuper, tab.AddPerUltra);
|
|
}
|
|
FightState.text = StrDictionary.GetClientDictionaryString("#{20185}");
|
|
fellow = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByAttachId(AttachType);
|
|
}
|
|
if(fellow==null)
|
|
{
|
|
Level.text = "";
|
|
Name.text = StrDictionary.GetClientDictionaryString("#{20186}");
|
|
AddObj.SetActive(true);
|
|
ZhanIcon.gameObject.SetActive(false);
|
|
ZhuIcon.gameObject.SetActive(false);
|
|
AttachIcon.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
Level.text = "Lv." + fellow.Level;
|
|
Name.text = fellow.Name;
|
|
AddObj.SetActive(false);
|
|
LoadAssetBundle.Instance.SetImageSprite(Icon, fellow.GetIcon());
|
|
|
|
ZhanIcon.SetActive(fellow.Called);
|
|
ZhuIcon.gameObject.SetActive(fellow.Helped);
|
|
AttachIcon.gameObject.SetActive(fellow.Attached);
|
|
|
|
}
|
|
|
|
if(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level >= OPenLevel)
|
|
{
|
|
OPenLevelText.text = StrDictionary.GetClientDictionaryString("#{20187}");
|
|
}
|
|
else
|
|
{
|
|
OPenLevelText.text = StrDictionary.GetClientDictionaryString("#{46001}", OPenLevel);
|
|
}
|
|
}
|
|
|
|
public void Click_Replace()
|
|
{
|
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < OPenLevel)
|
|
return;
|
|
|
|
Fellow fellow = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(PetMainWnd.CurrentSelectFellowId);
|
|
if (fellow == null)
|
|
return;
|
|
if(AttachType>0)
|
|
{
|
|
CG_PET_SET_ATTACHED cG_PET_SET_ATTACHED = (CG_PET_SET_ATTACHED)PacketDistributed.CreatePacket(MessageID.PACKET_CG_PET_SET_ATTACHED);
|
|
cG_PET_SET_ATTACHED.AttachedId = AttachType;
|
|
cG_PET_SET_ATTACHED.Guid = (long)fellow.Guid;
|
|
cG_PET_SET_ATTACHED.Opty = (fellow.attachId == AttachType) ? 1 : 0;
|
|
cG_PET_SET_ATTACHED.SendPacket();
|
|
|
|
Module.Log.LogModule.ErrorLog("CG_PET_SET_ATTACHED : "+ AttachType.ToString()+" ______ " + fellow.Guid.ToString());
|
|
|
|
}
|
|
if(AttachType == -2) //助战
|
|
{
|
|
if (fellow.lift <= 0)
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{20160}"));
|
|
return;
|
|
}
|
|
CG_SET_HELPER_FELLOW callFellow = (CG_SET_HELPER_FELLOW)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SET_HELPER_FELLOW);
|
|
callFellow.SetGuid(PetMainWnd.CurrentSelectFellowId);
|
|
callFellow.SendPacket();
|
|
}
|
|
if (AttachType == -1) //出战
|
|
{
|
|
if (fellow.lift <= 0)
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{20160}"));
|
|
return;
|
|
}
|
|
|
|
CG_CALL_FELLOW callFellow = (CG_CALL_FELLOW)PacketDistributed.CreatePacket(MessageID.PACKET_CG_CALL_FELLOW);
|
|
callFellow.SetGuid(PetMainWnd.CurrentSelectFellowId);
|
|
callFellow.SendPacket();
|
|
}
|
|
}
|
|
|
|
} |