823 lines
29 KiB
C#
823 lines
29 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Runtime.Remoting.Lifetime;
|
||
using Games.GlobeDefine;
|
||
using Games.LogicObj;
|
||
using Games.SkillModle;
|
||
using GCGame;
|
||
using GCGame.Table;
|
||
using Module.Log;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
using System.Collections;
|
||
using Games.MountModule;
|
||
using Games.Fellow;
|
||
using Games.Events;
|
||
|
||
public class PetMainWnd : MonoBehaviour
|
||
{
|
||
#region static
|
||
|
||
public static void ShowPetWin(string pageStr, string subPageStr)
|
||
{
|
||
int page = int.Parse(pageStr);
|
||
int subPage = int.Parse(subPageStr);
|
||
UIManager.ShowUI(UIInfo.PetMainWndPath, delegate (bool bSuccess, object param)
|
||
{
|
||
|
||
if (bSuccess && PetMainWnd.Instance != null)
|
||
{
|
||
PetMainWnd.Instance.ShowPage(page, PetMainWnd.CurrentSelectFellowId);
|
||
if (page == 4)
|
||
{
|
||
if (subPage == 0)
|
||
{
|
||
var normalBtn = PetMainWnd.Instance.m_petInfoWnd.transform.Find("Btns/Common");
|
||
if (normalBtn == null)
|
||
return;
|
||
|
||
var toggle = normalBtn.GetComponentInChildren<Toggle>();
|
||
if (toggle == null)
|
||
return;
|
||
toggle.isOn = true;
|
||
}
|
||
else if (subPage == 1)
|
||
{
|
||
var godBtn = PetMainWnd.Instance.m_petInfoWnd.transform.Find("Btns/God");
|
||
if (godBtn == null)
|
||
return;
|
||
|
||
var toggle = godBtn.GetComponentInChildren<Toggle>();
|
||
if (toggle == null)
|
||
return;
|
||
toggle.isOn = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
});
|
||
}
|
||
|
||
#endregion
|
||
|
||
|
||
public static PetMainWnd Instance;
|
||
|
||
public UIContainerSelect m_Container;
|
||
|
||
public PetMainAttrWnd m_petAttrWnd; //属性界面管理类
|
||
public PetXiuWuWnd m_petXiuWuWnd; //洗炼界面管理类
|
||
public PetSkillWnd m_petSkillWnd; //技能界面管理类
|
||
public PetClearOperaWnd m_petClearWnd; //修悟界面管理类
|
||
public PetsInfoWnd m_petInfoWnd; //宠物图鉴管理类
|
||
public PetGrowWnd m_petGrowWnd; //宠物成长
|
||
public UITagPanel _TagPanel;
|
||
|
||
public AddPetFromBag PetsInBagWnd; //背包中的宠物物品
|
||
|
||
//弹出框
|
||
public GameObject PopWnd;
|
||
public GameObject AddPetLimitWnd;
|
||
|
||
public GameObject TipObj;
|
||
public GameObject PetInfoObj;
|
||
public UICameraTexture ModelTexture; //模型展示的RenderTexture
|
||
//public Image PetQuilityIcon;
|
||
public Image GodPetSign;
|
||
public Text petName; //宠物名称
|
||
public UIImgText totlePower; //总战力
|
||
|
||
public GameObject SkillLimit;
|
||
public GameObject XiuWuLimit;
|
||
public GameObject GrowLimit;
|
||
public GameObject SkillToggle;
|
||
public GameObject XiuWuToggle;
|
||
public GameObject GrowToggle;
|
||
|
||
public static ulong CurrentSelectFellowId = GlobeVar.INVALID_GUID;
|
||
|
||
public void Awake()
|
||
{
|
||
Instance = this;
|
||
|
||
Hashtable calbackMoveparam1 = new Hashtable();
|
||
calbackMoveparam1["name"] = "UpdateFelllow";
|
||
MessageEventCallBack fun1 = UpdateFelllow;
|
||
calbackMoveparam1.Add("callFun", fun1);
|
||
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.UpdatePetInfo, calbackMoveparam1);
|
||
|
||
Hashtable calbackMoveparam2 = new Hashtable();
|
||
calbackMoveparam2["name"] = "AddHasFellowMax";
|
||
MessageEventCallBack fun2 = AddHasFellowMax;
|
||
calbackMoveparam2.Add("callFun", fun2);
|
||
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.AddHasFellowMax, calbackMoveparam2);
|
||
|
||
Hashtable calbackMoveparam3 = new Hashtable();
|
||
calbackMoveparam3["name"] = "AddNewFellow";
|
||
MessageEventCallBack fun3 = AddNewFellow;
|
||
calbackMoveparam3.Add("callFun", fun3);
|
||
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.AddNewFellow, calbackMoveparam3);
|
||
|
||
Hashtable calbackMoveparam4 = new Hashtable();
|
||
calbackMoveparam4["name"] = "LetPetFreeSuccess";
|
||
MessageEventCallBack fun4 = LetPetFreeSuccess;
|
||
calbackMoveparam4.Add("callFun", fun4);
|
||
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.LetPetFree, calbackMoveparam4);
|
||
|
||
Hashtable calbackMoveparam5 = new Hashtable();
|
||
calbackMoveparam5["name"] = "SelectFellowSuccess";
|
||
MessageEventCallBack fun5 = SelectFellowSuccess;
|
||
calbackMoveparam5.Add("callFun", fun5);
|
||
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.SelectFellow, calbackMoveparam5);
|
||
|
||
Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.UPDATA_PET_CALLFIGHTINFO, UpdateCallBtnList);
|
||
|
||
Hashtable calbackMoveparam6 = new Hashtable();
|
||
calbackMoveparam6["name"] = "PetMainBags";
|
||
MessageEventCallBack fun6 = PayFresh;
|
||
calbackMoveparam6.Add("callFun", fun6);
|
||
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.FRESHSAMEUSETIP, calbackMoveparam6);
|
||
|
||
EventDispatcher.Instance.Add(Games.Events.EventId.UpFellowSkillLevel, UpSkillLevelSuccess);
|
||
|
||
ModelTexture.isPreview = true;
|
||
}
|
||
|
||
public void PayFresh(Hashtable addparam, Hashtable sendparam)
|
||
{
|
||
FreshAddPetItem();
|
||
if (m_petInfoWnd.gameObject.activeInHierarchy)
|
||
m_petInfoWnd.OnItemFresh();
|
||
}
|
||
|
||
public void UpSkillLevelSuccess(object param)
|
||
{
|
||
Fellow pet = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(PetMainWnd.CurrentSelectFellowId);
|
||
if (pet == null)
|
||
return;
|
||
totlePower.text = pet.CombatValue.ToString();
|
||
}
|
||
|
||
public void OnDestroy()
|
||
{
|
||
PetMainWnd.CurrentSelectFellowId = GlobeVar.INVALID_GUID;
|
||
Instance = null;
|
||
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.UpdatePetInfo, "UpdateFelllow");
|
||
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.AddHasFellowMax, "AddHasFellowMax");
|
||
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.AddNewFellow, "AddNewFellow");
|
||
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.LetPetFree, "LetPetFreeSuccess");
|
||
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.SelectFellow, "SelectFellowSuccess");
|
||
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.UPDATA_PET_CALLFIGHTINFO, UpdateCallBtnList);
|
||
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.FRESHSAMEUSETIP, "PetMainBags");
|
||
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.UpFellowSkillLevel, UpSkillLevelSuccess);
|
||
}
|
||
|
||
void OnEnable()
|
||
{
|
||
UIManager.ShowUI(UIInfo.MoneyInfoPanel);
|
||
}
|
||
|
||
private void OnDisable()
|
||
{
|
||
UIManager.CloseUI(UIInfo.MoneyInfoPanel);
|
||
showTagPageWait = -1;
|
||
showPageWait = -1;
|
||
}
|
||
|
||
private bool m_CurrClearState = true;
|
||
public void ClearInfo(bool state)
|
||
{
|
||
//PetQuilityIcon.gameObject.SetActive(state);
|
||
if(state==false)
|
||
{
|
||
ModelTexture.gameObject.SetActive(false);
|
||
ModelTexture.DestroyObj();
|
||
petName.text = "";
|
||
}
|
||
m_petAttrWnd.ClearInfo(state);
|
||
m_petSkillWnd.ClearInfo(state);
|
||
m_petXiuWuWnd.ClearInfo(state);
|
||
m_petGrowWnd.ClearInfo(state);
|
||
m_CurrClearState = state;
|
||
SkillLimit.SetActive(state==false);
|
||
SkillToggle.SetActive(state);
|
||
|
||
XiuWuLimit.SetActive(state == false);
|
||
XiuWuToggle.SetActive(state);
|
||
|
||
CheckGrowLimit();
|
||
|
||
totlePower.text = "";
|
||
}
|
||
|
||
public void UpdateCallBtnList(object obj)
|
||
{
|
||
if(m_Container!=null)
|
||
{
|
||
m_Container.RefreshItems();
|
||
}
|
||
}
|
||
|
||
public void LetPetFreeSuccess(Hashtable addparam, Hashtable sendparam)
|
||
{
|
||
Fellow pet = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(CurrentSelectFellowId);
|
||
if (pet != null)
|
||
{
|
||
|
||
}
|
||
PetMainWnd.CurrentSelectFellowId = GlobeVar.INVALID_GUID;
|
||
InitPetList();
|
||
}
|
||
|
||
public void AddNewFellow(Hashtable addparam, Hashtable sendparam)
|
||
{
|
||
InitPetList();
|
||
}
|
||
|
||
public void AddHasFellowMax(Hashtable addparam, Hashtable sendparam)
|
||
{
|
||
InitPetList();
|
||
}
|
||
|
||
public void UpdateFelllow(Hashtable addparam, Hashtable sendparam)
|
||
{
|
||
if (sendparam == null || sendparam.ContainsKey("guid") == false)
|
||
return;
|
||
m_Container.RefreshItems(sendparam);
|
||
|
||
Fellow pet = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(CurrentSelectFellowId);
|
||
if (pet == null)
|
||
return;
|
||
CheckLimitOpen(pet);
|
||
petName.text = string.Format("Lv.{0} {1}", pet.Level, pet.Name);
|
||
totlePower.text = pet.CombatValue.ToString();
|
||
if (m_petClearWnd != null && m_petClearWnd.gameObject.activeInHierarchy)
|
||
m_petClearWnd.SetDate(pet);
|
||
if (m_petGrowWnd != null && m_petGrowWnd.gameObject.activeInHierarchy)
|
||
m_petGrowWnd.OnSelectPet();
|
||
if (m_petAttrWnd != null && m_petAttrWnd.gameObject.activeInHierarchy)
|
||
m_petAttrWnd.FellowAttachInfo();
|
||
_TagPanel.ShowPage(openIndex);
|
||
}
|
||
|
||
public int openIndex = -1;
|
||
public void ShowPage(int page,ulong selectId)
|
||
{
|
||
openIndex = page;
|
||
showTagPageWait = 4;
|
||
Debug.Log("ShowPage:" + page);
|
||
if (selectId != Games.GlobeDefine.GlobeVar.INVALID_GUID)
|
||
{
|
||
PetMainWnd.CurrentSelectFellowId = selectId;
|
||
}
|
||
}
|
||
|
||
public void OnClickPetItem(object param)
|
||
{
|
||
if(param==null)
|
||
{
|
||
return;
|
||
}
|
||
Fellow pet = param as Fellow;
|
||
if (pet == null)
|
||
return;
|
||
if (pet.Guid == CurrentSelectFellowId && CurrentSelectFellowId != GlobeVar.INVALID_GUID)
|
||
return;
|
||
|
||
// 若宠物合法,通知服务器做出相应改变
|
||
if (pet.IsValid() && pet.Guid != GlobeVar.INVALID_GUID)
|
||
{
|
||
CG_SELECT_CUR_FELLOW send = (CG_SELECT_CUR_FELLOW)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SELECT_CUR_FELLOW);
|
||
send.SetFellowGuid(pet.Guid);
|
||
send.SendPacket();
|
||
return;
|
||
}
|
||
|
||
// -1表示该槽尚未装备宠物,开启小界面,通知玩家选择背包中的宠物使用召唤
|
||
if(pet.DataId == -1)
|
||
{
|
||
if (PetsInBagWnd != null && PetsInBagWnd.gameObject.activeSelf == false)
|
||
{
|
||
PetsInBagWnd.gameObject.SetActive(true);
|
||
Utils.SetObjInputPosition(PetsInBagWnd.m_TransPosition);
|
||
}
|
||
return;
|
||
}
|
||
|
||
// 用于提升槽上限
|
||
if(pet.DataId == -2)
|
||
{
|
||
OnClick_AddPetLimitWnd();
|
||
}
|
||
}
|
||
|
||
public void SelectFellowSuccess(Hashtable addparam, Hashtable sendparam)
|
||
{
|
||
Debug.Log("SelectFellowSuccess:");
|
||
if (sendparam == null)
|
||
return;
|
||
if (sendparam.ContainsKey("guid") == false)
|
||
{
|
||
return;
|
||
}
|
||
ulong uid = (ulong)sendparam["guid"];
|
||
int attackPower = (int)sendparam["AttackPower"];
|
||
Fellow pet = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(uid);
|
||
if (pet == null)
|
||
return;
|
||
|
||
petName.text = string.Format("Lv.{0} {1}",pet.Level, pet.Name);
|
||
totlePower.text = pet.CombatValue.ToString();
|
||
|
||
pet.CombatValue = attackPower;
|
||
CurrentSelectFellowId = pet.Guid;
|
||
List<Fellow> selects = new List<Fellow>();
|
||
selects.Add(pet);
|
||
m_Container.SetSelect(selects);
|
||
int pageOk = 0;
|
||
|
||
CheckLimitOpen(pet);
|
||
|
||
if (openIndex == 2)
|
||
{
|
||
int skillLevel = SystemParam.GetSystemParam_INT(35);
|
||
if (pet.Level < skillLevel)
|
||
{
|
||
_TagPanel.ShowPage(0);
|
||
openIndex = 0;
|
||
showPageWait = 1;
|
||
pageOk = 1;
|
||
SkillLimitClick();
|
||
return;
|
||
}
|
||
}
|
||
else if (openIndex == 5)
|
||
{
|
||
Debug.Log("select pet CurrentSelectFellowId:" + CurrentSelectFellowId);
|
||
pageOk = 1;
|
||
TagShowPage(5);
|
||
}
|
||
else if (m_lastShowPage == 3)
|
||
{
|
||
int XWLevel = SystemParam.GetSystemParam_INT(36);
|
||
if (pet.Level < XWLevel)
|
||
{
|
||
_TagPanel.ShowPage(0);
|
||
openIndex = 0;
|
||
showPageWait = 1;
|
||
pageOk = 1;
|
||
XiuWuLimitClick();
|
||
return;
|
||
}
|
||
}
|
||
if(pageOk ==0 )
|
||
{
|
||
_TagPanel.ShowPage(m_lastShowPage);
|
||
openIndex = m_lastShowPage;
|
||
showPageWait = 1;
|
||
}
|
||
}
|
||
|
||
void CheckGrowLimit()
|
||
{
|
||
int GrowLevel = SystemParam.GetSystemParam_INT(54);
|
||
GrowLimit.SetActive(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < GrowLevel);
|
||
GrowToggle.SetActive(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level >= GrowLevel);
|
||
}
|
||
|
||
void CheckLimitOpen(Fellow pet)
|
||
{
|
||
int skillLevel = SystemParam.GetSystemParam_INT(35);
|
||
SkillLimit.SetActive(pet!=null && pet.Level < skillLevel);
|
||
SkillToggle.SetActive(pet == null || pet.Level >= skillLevel);
|
||
|
||
int XWLevel = SystemParam.GetSystemParam_INT(36);
|
||
XiuWuLimit.SetActive(pet!=null && pet.Level < XWLevel);
|
||
XiuWuToggle.SetActive(pet == null || pet.Level >= XWLevel);
|
||
}
|
||
|
||
void ShowModelTexture(bool state)
|
||
{
|
||
if (state == false)
|
||
{
|
||
ModelTexture.gameObject.SetActive(false);
|
||
return;
|
||
}
|
||
|
||
Fellow pet = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(CurrentSelectFellowId);
|
||
if (pet == null)
|
||
{
|
||
ModelTexture.gameObject.SetActive(false);
|
||
return;
|
||
}
|
||
int dataID = -1;
|
||
if (pet.Called)
|
||
dataID = GameManager.gameManager.PlayerDataPool.FellowBookData.FightPetBook;
|
||
if (pet.Helped)
|
||
dataID = GameManager.gameManager.PlayerDataPool.FellowBookData.HelpFightPetBook;
|
||
var modelTab = pet.CharModel(dataID);
|
||
if (modelTab != null)
|
||
{
|
||
ModelTexture.InitModelPath(modelTab.ResPath,modelTab, LoadAssetBundle.BUNDLE_PATH_PET, true,delegate()
|
||
{
|
||
ShowModel();
|
||
});
|
||
}
|
||
if (state)
|
||
{
|
||
pet.SetGodPetSign(GodPetSign);
|
||
}
|
||
}
|
||
|
||
private void ShowModel()
|
||
{
|
||
ModelTexture.gameObject.SetActive(true);
|
||
}
|
||
|
||
public void AddCanAddPetItem()
|
||
{
|
||
InitPetList();
|
||
}
|
||
|
||
//显示拥有的宠物
|
||
public void InitPetList()
|
||
{
|
||
List<Fellow> selects = new List<Fellow>();
|
||
List<Fellow> showList = new List<Fellow>(GameManager.gameManager.PlayerDataPool.FellowContainer.ContainerSize);
|
||
Fellow pet = GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowByGuid(CurrentSelectFellowId);
|
||
if (pet != null && pet.IsValid())
|
||
{
|
||
selects.Add(pet);
|
||
}
|
||
|
||
showList = FellowTool.FellowSort(GameManager.gameManager.PlayerDataPool.FellowContainer);
|
||
if (showList == null)
|
||
{
|
||
if(m_CurrClearState == true)
|
||
{
|
||
ClearInfo(false);
|
||
}
|
||
return;
|
||
}
|
||
|
||
if(GameManager.gameManager.PlayerDataPool.FellowContainer.GetFellowCount() <= 0)
|
||
{
|
||
if (m_CurrClearState == true)
|
||
{
|
||
ClearInfo(false);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (m_CurrClearState == false)
|
||
{
|
||
ClearInfo(true);
|
||
}
|
||
}
|
||
|
||
if(selects.Count <= 0 && showList.Count > 0)
|
||
{
|
||
if(showList[0].IsValid())
|
||
selects.Add(showList[0]);
|
||
}
|
||
|
||
// 在最后添加一个可解锁宠物上限提示
|
||
Fellow fellow1 = new Fellow();
|
||
fellow1.Guid = GlobeVar.INVALID_GUID;
|
||
fellow1.DataId = -2;
|
||
showList.Add(fellow1);
|
||
m_Container.InitSelectContent(showList, selects, OnClickPetItem, null);
|
||
TipObj.SetActive(showList.Count > 6);
|
||
if (PetsInBagWnd.gameObject.activeSelf)
|
||
{
|
||
PetsInBagWnd.AddNewFellow();
|
||
}
|
||
}
|
||
|
||
public void HandBookInfo(RespHandbookFellowList info)
|
||
{
|
||
m_petInfoWnd.RespHandBookInfos();
|
||
ShowModelTexture(ModelTexture.gameObject.activeSelf);
|
||
}
|
||
|
||
public void OnClick_AddPopWnd_Cancle()
|
||
{
|
||
if (PopWnd != null)
|
||
{
|
||
PopWnd.SetActive(false);
|
||
if (AddPetLimitWnd != null)
|
||
{
|
||
AddPetLimitWnd.SetActive(false);
|
||
}
|
||
}
|
||
}
|
||
|
||
//增加拥有宠物上限
|
||
public void OnClick_AddPopWnd_UnLock()
|
||
{
|
||
CG_OPEN_FELLOW_PACK send = (CG_OPEN_FELLOW_PACK)PacketDistributed.CreatePacket(MessageID.PACKET_CG_OPEN_FELLOW_PACK);
|
||
send.Guid = Singleton<ObjManager>.Instance.MainPlayer.GUID;
|
||
send.SendPacket();
|
||
OnClick_AddPopWnd_Cancle();
|
||
}
|
||
|
||
public void FreshAddPetItem()
|
||
{
|
||
if(AddPetLimitWnd.activeInHierarchy)
|
||
{
|
||
Tab_AddFellowCarryNum cost = TableManager.GetAddFellowCarryNumByID(GameManager.gameManager.PlayerDataPool.FellowContainer.ContainerSize + 1, 0);
|
||
if (cost == null)
|
||
return;
|
||
if (cost.DefaultOpen == 0 && cost.ConsumeType == 3)
|
||
{
|
||
Tab_CommonItem item = TableManager.GetCommonItemByID(cost.ConsumeSubType, 0);
|
||
Transform IconText = AddPetLimitWnd.transform.Find("icon/Text");
|
||
if (IconText != null)
|
||
{
|
||
Text strText = IconText.gameObject.GetComponent<Text>();
|
||
if (strText != null)
|
||
{
|
||
int hasCount = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(cost.ConsumeSubType);
|
||
if (hasCount < cost.ConsumeNum)
|
||
{
|
||
strText.text = string.Format("<color=#ff0000ff>{0}</color>/{1}", hasCount, cost.ConsumeNum);
|
||
}
|
||
else
|
||
{
|
||
strText.text = string.Format("<color=#00ff00ff>{0}</color>/{1}", hasCount, cost.ConsumeNum);
|
||
}
|
||
}
|
||
}
|
||
Transform tipText = AddPetLimitWnd.transform.Find("tip");
|
||
if (tipText != null)
|
||
{
|
||
Text strText = tipText.gameObject.GetComponent<Text>();
|
||
if (strText != null)
|
||
{
|
||
int hasCount = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(cost.ConsumeSubType);
|
||
if (hasCount < cost.ConsumeNum)
|
||
{
|
||
strText.text = StrDictionary.GetClientDictionaryString("#{20131}", item.Name, "ff0000ff", hasCount, cost.ConsumeNum);
|
||
}
|
||
else
|
||
{
|
||
strText.text = StrDictionary.GetClientDictionaryString("#{20131}", item.Name, "00ff00ff", hasCount, cost.ConsumeNum);
|
||
}
|
||
}
|
||
}
|
||
Transform GetBtn = AddPetLimitWnd.transform.Find("icon/Get");
|
||
if (GetBtn != null)
|
||
{
|
||
int hasCount = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(cost.ConsumeSubType);
|
||
if (hasCount < cost.ConsumeNum)
|
||
{
|
||
GetBtn.gameObject.SetActive(true);
|
||
Button btn = GetBtn.GetComponent<Button>();
|
||
if (btn != null)
|
||
{
|
||
btn.onClick.AddListener(delegate ()
|
||
{
|
||
ItemGetPathPopRoot.Show(item.Id, btn.transform.position);
|
||
});
|
||
}
|
||
}
|
||
else
|
||
{
|
||
GetBtn.gameObject.SetActive(false);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
//添加宠物上限
|
||
public void OnClick_AddPetLimitWnd()
|
||
{
|
||
if(PopWnd!=null)
|
||
{
|
||
if(AddPetLimitWnd != null)
|
||
{
|
||
Tab_AddFellowCarryNum cost = TableManager.GetAddFellowCarryNumByID(GameManager.gameManager.PlayerDataPool.FellowContainer.ContainerSize+1, 0);
|
||
if(cost!=null)
|
||
{
|
||
if(cost.DefaultOpen==0 && cost.ConsumeType == 3)
|
||
{
|
||
Tab_CommonItem item = TableManager.GetCommonItemByID(cost.ConsumeSubType, 0);
|
||
if (item != null)
|
||
{
|
||
Transform Icon = AddPetLimitWnd.transform.Find("icon");
|
||
if (Icon != null)
|
||
{
|
||
Image iconImage = Icon.gameObject.GetComponent<Image>();
|
||
if (iconImage != null)
|
||
{
|
||
LoadAssetBundle.Instance.SetImageSprite(iconImage, item.Icon);
|
||
if (item.QualityEffect > 0)
|
||
{
|
||
CommonItemContainerItem.ShowQualityEffect(true, item.QualityEffect, iconImage.transform);
|
||
}
|
||
else
|
||
{
|
||
CommonItemContainerItem.ShowQualityEffect(false, item.QualityEffect, iconImage.transform);
|
||
}
|
||
}
|
||
}
|
||
|
||
Transform Quility = AddPetLimitWnd.transform.Find("Quility");
|
||
if (Quility != null)
|
||
{
|
||
Image QuilityImage = Quility.gameObject.GetComponent<Image>();
|
||
if (QuilityImage != null)
|
||
{
|
||
LoadAssetBundle.Instance.SetImageSprite(QuilityImage, Utils.GetItemQualityFrame(item));
|
||
}
|
||
}
|
||
|
||
Transform IconText = AddPetLimitWnd.transform.Find("icon/Text");
|
||
if (IconText != null)
|
||
{
|
||
Text strText = IconText.gameObject.GetComponent<Text>();
|
||
if (strText != null)
|
||
{
|
||
int hasCount = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(cost.ConsumeSubType);
|
||
if (hasCount < cost.ConsumeNum)
|
||
{
|
||
strText.text = string.Format("<color=#ff0000ff>{0}</color>/{1}", hasCount, cost.ConsumeNum);
|
||
}
|
||
else
|
||
{
|
||
strText.text = string.Format("<color=#00ff00ff>{0}</color>/{1}", hasCount, cost.ConsumeNum);
|
||
}
|
||
}
|
||
}
|
||
|
||
Transform GetBtn = AddPetLimitWnd.transform.Find("icon/Get");
|
||
if (GetBtn != null)
|
||
{
|
||
int hasCount = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(cost.ConsumeSubType);
|
||
if (hasCount < cost.ConsumeNum)
|
||
{
|
||
GetBtn.gameObject.SetActive(true);
|
||
Button btn = GetBtn.GetComponent<Button>();
|
||
if(btn!=null)
|
||
{
|
||
btn.onClick.AddListener(delegate ()
|
||
{
|
||
ItemTooltipsLogic.ShowItemTooltip(item.Id, ItemTooltipsLogic.ShowType.GetPath, GetBtn.position);
|
||
});
|
||
}
|
||
}
|
||
else
|
||
{
|
||
GetBtn.gameObject.SetActive(false);
|
||
}
|
||
}
|
||
|
||
Transform tipText = AddPetLimitWnd.transform.Find("tip");
|
||
if (tipText != null)
|
||
{
|
||
Text strText = tipText.gameObject.GetComponent<Text>();
|
||
if (strText != null)
|
||
{
|
||
int hasCount = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(cost.ConsumeSubType);
|
||
if (hasCount < cost.ConsumeNum)
|
||
{
|
||
strText.text = StrDictionary.GetClientDictionaryString("#{20131}", item.Name,"82439cff", hasCount, cost.ConsumeNum);
|
||
}
|
||
else
|
||
{
|
||
strText.text = StrDictionary.GetClientDictionaryString("#{20131}", item.Name,"3c4c5cff", hasCount, cost.ConsumeNum);
|
||
}
|
||
}
|
||
}
|
||
PopWnd.SetActive(true);
|
||
AddPetLimitWnd.SetActive(true);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{1810}"));
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
public void TagShowPageMain(int page)
|
||
{
|
||
if (showTagPageWait > 0)
|
||
return;
|
||
openIndex = page;
|
||
showPageWait = 1;
|
||
}
|
||
|
||
int showTagPageWait = -1;
|
||
int showPageWait = -1;
|
||
private void Update()
|
||
{
|
||
if (showPageWait > 0)
|
||
{
|
||
showPageWait--;
|
||
if (showPageWait == 0)
|
||
{
|
||
showPageWait = -1;
|
||
TagShowPage(openIndex);
|
||
}
|
||
}
|
||
|
||
if (showTagPageWait > 0)
|
||
{
|
||
showTagPageWait--;
|
||
if(showTagPageWait==2)
|
||
{
|
||
InitPetList();
|
||
}
|
||
if (showTagPageWait == 0)
|
||
{
|
||
showTagPageWait = -1;
|
||
_TagPanel.ShowPage(openIndex);
|
||
}
|
||
}
|
||
}
|
||
|
||
int m_lastShowPage = 0;
|
||
public void TagShowPage(int page, bool showIs = false)
|
||
{
|
||
Debug.Log("TagShowPage:" + page);
|
||
if (page == 0)
|
||
{
|
||
m_petAttrWnd.OnSelectPet();
|
||
m_Container.gameObject.SetActive(true);
|
||
PetInfoObj.SetActive(true);
|
||
ShowModelTexture(true);
|
||
}
|
||
if (page == 1)
|
||
{
|
||
m_petClearWnd.OnSelectPet();
|
||
m_Container.gameObject.SetActive(true);
|
||
PetInfoObj.SetActive(false);
|
||
ShowModelTexture(false);
|
||
}
|
||
if (page == 2)
|
||
{
|
||
m_petSkillWnd.OnSelectPet();
|
||
m_Container.gameObject.SetActive(true);
|
||
PetInfoObj.SetActive(false);
|
||
ShowModelTexture(false);
|
||
}
|
||
if (page == 3)
|
||
{
|
||
m_Container.gameObject.SetActive(true);
|
||
m_petXiuWuWnd.OnSelectPet();
|
||
PetInfoObj.SetActive(true);
|
||
ShowModelTexture(true);
|
||
}
|
||
if (page == 4)
|
||
{
|
||
m_petInfoWnd.OnSelectPet();
|
||
PetInfoObj.SetActive(false);
|
||
ShowModelTexture(false);
|
||
m_Container.gameObject.SetActive(false);
|
||
}
|
||
if (page == 5)
|
||
{
|
||
m_petGrowWnd.OnSelectPet();
|
||
m_Container.gameObject.SetActive(true);
|
||
PetInfoObj.SetActive(false);
|
||
}
|
||
m_lastShowPage = page;
|
||
openIndex = page;
|
||
}
|
||
|
||
public void ChangeToggleState(int toggleIndex)
|
||
{
|
||
_TagPanel.ShowPage(toggleIndex);
|
||
}
|
||
|
||
public void OnClick_OPenPetsWnd()
|
||
{
|
||
UIManager.ShowUI(UIInfo.PetsInfoWndPath);
|
||
}
|
||
|
||
public void SkillLimitClick()
|
||
{
|
||
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{20145}", SystemParam.GetSystemParam_INT(35)));
|
||
}
|
||
|
||
public void XiuWuLimitClick()
|
||
{
|
||
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{20146}", SystemParam.GetSystemParam_INT(36)));
|
||
}
|
||
|
||
public void GrowLimitClick()
|
||
{
|
||
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{20179}", SystemParam.GetSystemParam_INT(54)));
|
||
}
|
||
|
||
public void OnClick_Close()
|
||
{
|
||
UIManager.CloseUI(UIInfo.PetMainWndPath);
|
||
openIndex = -1;
|
||
}
|
||
} |