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

1353 lines
48 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using GCGame.Table;
using Module.Log;
using Games.Item;
using GCGame;
using System;
using Games.GlobeDefine;
using Games.UserCommonData;
public class ItemModelViewPanel : MonoBehaviour {
public static ItemModelViewPanel Instance;
private void Awake()
{
Instance = this;
}
private void OnDestroy()
{
Instance = null;
}
private void OnDisable()
{
_ModelCameraTexture._FakeObj.Disable();
}
public UICameraTexture _ModelCameraTexture;
public CommonItemTipsSlot _ItemSlot;
public Text _ItemName;
public Text _ItemType;
public Text _ItemDesc;
public Text _ItemLevel;
public UISubScollMenu _PopMenu;
public UIContainerBase itemGetPathContainer; // 物品获取列表
public GameObject _MenuContainer;
private GameItem m_Item;
private ItemTooltipsLogic.ShowType _CurShowType;
public void Init(GameItem _Item, ItemTooltipsLogic.ShowType type)
{
m_Item = _Item;
_CurShowType = type;
StartCoroutine(CteareModel());
ShowToolTips();
}
IEnumerator CteareModel()
{
var commonFashionItem = TableManager.GetCommonFashionItemByID(m_Item.DataID, 0);
var charModelId = -1;
if (commonFashionItem != null)
{
Tab_CharModel charModel = null;
var modelIdStr = commonFashionItem.CharModelId;
if (modelIdStr.Contains("|"))
{
charModelId = int.Parse(modelIdStr.Split('|')[GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Profession]);
charModel = TableManager.GetCharModelByID(charModelId, 0);
if (charModel == null)
{
LogModule.ErrorLog("CharModel id : " + charModelId);
yield break;
}
}
else
{
charModelId = int.Parse(modelIdStr);
charModel = TableManager.GetCharModelByID(int.Parse(modelIdStr), 0);
if (charModel == null)
{
LogModule.ErrorLog("CharModel id : " + int.Parse(modelIdStr));
yield break;
}
}
var mainPlayer = Singleton<ObjManager>.GetInstance().MainPlayer;
if (mainPlayer == null)
{
Debug.LogError("mainPlayer is null");
yield break;
}
if (m_Item.GetSubClass() == (int)Games.Item.FashionSubClass.FASHION)
_ModelCameraTexture.InitModel(mainPlayer.Profession,
charModel.Id,
mainPlayer.ModelVisualID > 0 ? mainPlayer.ModelVisualID : mainPlayer.WeaponDataID, mainPlayer.WingModelAuraid,
mainPlayer.WeaponEffectGem, mainPlayer.EffectAuraId,
mainPlayer.AdcaneMountId);
else
_ModelCameraTexture.InitModelPath(charModel.ResPath, charModel, LoadAssetBundle.BUNDLE_PATH_MODEL, true);
yield break;
}
}
bool CanShowMenu()
{
if (BackPackLogic.Instance() && BackPackLogic.Instance().isActiveAndEnabled && (BackPackLogic.Instance()._TagPanel._Tags[0].isOn || BackPackLogic.Instance()._TagPanel._Tags[3].isOn))
return true;
if (PetMainWnd.Instance && PetMainWnd.Instance.isActiveAndEnabled)
return true;
return false;
}
public void ShowToolTips()
{
_ItemSlot.InitItem(m_Item);
SetItemName(m_Item);
SetItemType(m_Item);
SetItemUseLevel(m_Item);
SetItemDesc(m_Item);
int canuse = m_Item.CanUse() ? 1 : 0;
int cansell = m_Item.CanSell() ? 1 : 0;
int canthrow = TableManager.GetCommonItemByID(m_Item.DataID, 0).CanThrow;
int isShowGainPath = TableManager.GetCommonItemByID(m_Item.DataID, 0).IsShowGainPath;
_PopMenu.Clear();
//有些是Getpath的也要隐藏
_PopMenu.gameObject.SetActive(CanShowMenu());
itemGetPathContainer.gameObject.SetActive(false);
if (m_Item.GetClass() == (int)ItemClass.FELLOW && m_Item.GetSubClass() == (int)FellowSubClass.CALL) //特殊描述,与使用功能相同
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{42000}")); //召唤
}
else
{
if(m_Item.GetClass() == (int)ItemClass.FASHION && m_Item.GetSubClass() == (int)FashionSubClass.WEAPON)
{
_ModelCameraTexture._CanDrag = false;
}else
{
_ModelCameraTexture._CanDrag = true;
}
if (m_Item.CanUse())
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4571}")); //使用
}
}
if (ItemCombine.CanItemCombine(m_Item.DataID))
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{42003}")); //合成
}
if (m_Item.GetClass() == (int)ItemClass.MEDIC
&& m_Item.GetSubClass() != (int)MedicSubClass.ATTR)
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{42200}")); //药品装备
}
if (m_Item.CanSell())
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3877}")); //回收
}
if (!m_Item.BindFlag)
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3580}")); //绑定
}
var canSellItems = TableManager.GetUserShopItem();
var canSellSysItems = TableManager.GetExchangeMarket();
if ((canSellItems.ContainsKey(m_Item.DataID)
|| canSellSysItems.ContainsKey(m_Item.DataID))
&& !m_Item.BindFlag)
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4578}")); //出售
}
if (canuse == 1 && m_Item.StackCount > 1 && CanBatchUse(m_Item.DataID))
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4572}")); //批量使用
}
if (canthrow == 1)
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4579}")); //丢弃
}
if (_CurShowType == ItemTooltipsLogic.ShowType.CangKuBackPack) //仓库界面 背包物品tips
{
//显示放入仓库按钮
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4573}"));
}
else if (_CurShowType == ItemTooltipsLogic.ShowType.CangKu) //仓库界面 仓库物品tips
{
//显示取回按钮
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4576}"));
}
if (isShowGainPath == 1)
{
ShowItmeGetPath();
//_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{52001}")); //获取途径
}
else
{
itemGetPathContainer.gameObject.SetActive(false);
}
if (_PopMenu.SubBtns.Count > 0)
{
_MenuContainer.SetActive(true);
}
else
{
_MenuContainer.SetActive(false);
}
}
void SetItemName(GameItem m_Item)
{
if (m_Item != null && m_Item.IsValid())
{
int nQuality = (int)m_Item.GetQuality();
_ItemName.text = Utils.GetQualityColorInTip(nQuality);
_ItemName.text += TableManager.GetCommonItemByID(m_Item.DataID, 0).Name + "</color>";
}
}
void SetItemType(GameItem m_Item)
{
if (m_Item != null && m_Item.IsValid())
{
Tab_CommonItem tabItem = TableManager.GetCommonItemByID(m_Item.DataID, 0);
if (tabItem != null)
{
int nClassID = tabItem.ClassID;
int nSubClassID = tabItem.SubClassID;
_ItemType.text = Utils.GetItemType(nClassID, nSubClassID, tabItem.ProfessionRequire);
}
}
}
bool CanBatchUse(int itemId)
{
var commonItem = TableManager.GetCommonItemByID(itemId, 0);
if (commonItem != null)
{
return commonItem.CanBulkUse != -1 ? true : false;
}
return false;
}
void SetItemUseLevel(GameItem m_Item)
{
if (m_Item != null && m_Item.IsValid())
{
int nPlayerLevel = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;
Tab_CommonItem tabItem = TableManager.GetCommonItemByID(m_Item.DataID, 0);
if (null != tabItem)
{
int nItemUseLevel = tabItem.MinLevelRequire;
if (nPlayerLevel >= nItemUseLevel)
{
_ItemLevel.text = StrDictionary.GetClientDictionaryString("#{3362}", nItemUseLevel);
}
else
{
_ItemLevel.text = StrDictionary.GetClientDictionaryString("#{5526}") + StrDictionary.GetClientDictionaryString("#{3362}", nItemUseLevel) + "</color>";
}
}
}
}
void SetItemDesc(GameItem m_Item)
{
if (m_Item != null && m_Item.IsValid())
{
if (null != TableManager.GetCommonItemByID(m_Item.DataID, 0))
{
string strItemDesc = StrDictionary.GetClientString_WithNameSex(TableManager.GetCommonItemByID(m_Item.DataID, 0).Tips);
_ItemDesc.text = strItemDesc;
}
}
}
private void ShowItmeGetPath()
{
var _ItemPathTab = TableManager.GetItemGetPathByID(m_Item.DataID, 0);
if (_ItemPathTab == null)
{
LogModule.ErrorLog("没有配置这个物品");
itemGetPathContainer.gameObject.SetActive(false);
return;
}
List<ItemGetPathPopRoot.GetPathData> pathList = new List<ItemGetPathPopRoot.GetPathData>();
for (int i = 0; i < _ItemPathTab.getItemPathCount(); ++i)
{
if (string.IsNullOrEmpty(_ItemPathTab.GetItemPathbyIndex(i)))
{
continue;
}
if ("-1" == _ItemPathTab.GetItemPathbyIndex(i))
{
continue;
}
switch (i)
{
case 0:
case 4:
case 5:
case 7:
case 10:
{
// 以上为只会有一种情况的路径
ItemGetPathPopRoot.GetPathData pathType = new ItemGetPathPopRoot.GetPathData();
pathType.pathType = i;
pathType.info = _ItemPathTab.GetItemPathbyIndex(i).Trim('"');
pathType.itemID = _ItemPathTab.Id;
pathList.Add(pathType);
}
break;
case 1:
case 2:
case 3:
case 6:
case 8:
{
// 详细
string infoRaw = _ItemPathTab.GetItemPathbyIndex(i).Trim('"');
string[] infos = infoRaw.Split('|');
for (int j = 0; j < infos.Length; ++j)
{
var item = new ItemGetPathPopRoot.GetPathData();
item.pathType = i;
item.info = infos[j];
item.itemID = _ItemPathTab.Id;
pathList.Add(item);
}
}
break;
// 运营活动的特殊处理一下,会出现类似的活动,需要先判断。
case 9:
{
string infoRaw = _ItemPathTab.GetItemPathbyIndex(i).Trim('"');
string[] infos = infoRaw.Split('|');
for (int j = 0; j < infos.Length; ++j)
{
if (ItemGetPathPopRoot.IsMarketingActActive(infos[j]))
{
ItemGetPathPopRoot.GetPathData item = new ItemGetPathPopRoot.GetPathData();
item.pathType = i;
item.info = infos[j];
item.itemID = _ItemPathTab.Id;
pathList.Add(item);
}
}
}
break;
}
if (pathList.Count > 0)
{
itemGetPathContainer.gameObject.SetActive(true);
itemGetPathContainer.InitContentItem(pathList, OnGetItemCllick);
}
}
}
private static Action callBack;
private void OnGetItemCllick(object data)
{
ItemGetPathPopRoot.GetPathData info = data as ItemGetPathPopRoot.GetPathData;
if (data != null)
{
ItemGetPathPopRoot.GoGetPath(info, callBack);
}
OnBack();
}
public void OnBack()
{
UIManager.CloseUI(UIInfo.ItemModelViewPanel);
}
public void ItemBuyBack()
{
CG_SYSTEMSHOP_BUYBACK buyBackPacket = (CG_SYSTEMSHOP_BUYBACK)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SYSTEMSHOP_BUYBACK);
buyBackPacket.SetShopId((int)GameItemContainer.Type.TYPE_BUYBACKPACK);
buyBackPacket.SetItemGuid(m_Item.Guid);
buyBackPacket.SendPacket();
OnBack();
}
public void OnBtnPopMenu(object menuObj)
{
string menuStr = menuObj as string;
if (menuStr == StrDictionary.GetClientDictionaryString("#{4549}"))
{
// 购买
OnBuyClick();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{4549}"))
{
// 购买
OnBuyBatchClick();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{4577}"))
{
// 求购
ConsignSaleBuyBt();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{4573}"))
{
// 放入
CangKuIn();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{4576}"))
{
// 取出
CangKuOut();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{4571}")
|| menuStr == StrDictionary.GetClientDictionaryString("#{42000}"))
{
// 4571 - 使用
// 42000 - 召唤
ItemUse();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{3877}"))
{
// 回收
ItemSell();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{4578}"))
{
// 出售
ItemMarket();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{4572}"))
{
// 批量使用
ItemBatchUse();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{4579}"))
{
// 丢弃
ItemThrow();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{52001}"))
{
// 获取途径
ItemGainPath();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{4570}"))
{
// 吸收
AbsorbOnClick();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{4575}"))
{
// 分享
ItemShareLink();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{1086}"))
{
// 回购
ItemBuyBack();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{5005}"))
{
// 获取路径
ShowItemGetPath();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{4753}"))
{
// 采集
LiveSkillGet();
}
//else if (menuStr == StrDictionary.GetClientDictionaryString("#{3874}"))
//{
// SetShortCutUseItem();
//}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{42002}"))
{
// 锻造
MagicItem(1);
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{42003}"))
{
if (m_Item.IsMagicMent())
{
// 合成
MagicItem(2);
}
else
{
ItemCombine.ShowCombineUI(m_Item.DataID);
OnBack();
}
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{42200}"))
{
// 携带
EquipMedicItem();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{3580}"))
{
// 绑定
BindItem();
}
}
void BindItem()
{
LogModule.DebugLog("BindItem");
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{5396}"), "", BindItemOK, null);
}
void BindItemOK()
{
CG_REQ_BIND_ITEM buyPacket = (CG_REQ_BIND_ITEM)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_BIND_ITEM);
buyPacket.Itemguid = (long)m_Item.Guid;
buyPacket.SendPacket();
}
void BindItemCancel()
{
}
void EquipMedicItem()
{
if (m_Item != null && m_Item.IsValid())
{
if (m_Item.GetClass() == (int)ItemClass.MEDIC)
{
if (m_Item.GetSubClass() == (int)MedicSubClass.HP
|| m_Item.GetSubClass() == (int)MedicSubClass.MP)
{
SetShortCutUseItem();
}
else if (m_Item.GetSubClass() == (int)MedicSubClass.HP_DY
|| m_Item.GetSubClass() == (int)MedicSubClass.MP_DY)
{
UIManager.ShowUI(UIInfo.AutoUseMedicPanel);
OnBack();
}
}
}
}
void MagicItem(int type)
{
UIManager.ShowUI(UIInfo.MagicWndPath, delegate (bool bSucess, object param)
{
if (bSucess)
{
MagicMain.Instance._TagPanel.ShowPage(type);
}
});
}
public void ItemSell()
{
if (m_Item != null && m_Item.IsValid())
{
SysShopController.m_TipSelDataID = m_Item.DataID;
if (m_Item.GetQuality() >= ItemQuality.QUALITY_BLUE)
{
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{4668}"), "", ItemSellOK, null);
}
else
{
ItemSellOK();
}
}
OnBack();
}
void ItemMarket()
{
var sysMarketItem = TableManager.GetExchangeMarketByID(m_Item.DataID, 0);
if (sysMarketItem == null)
{
UIManager.ShowUI(UIInfo.MarketRoot, (sucess, param) =>
{
MarketLogic.Instance()._TagPanel.ShowPage(1);
MarketLogic.Instance()._MarketPlayerLogic._TagPanel.ShowPage(1);
});
}
else
{
UIManager.ShowUI(UIInfo.MarketRoot, (sucess, param) =>
{
MarketLogic.Instance()._TagPanel.ShowPage(0);
MarketLogic.Instance()._MarketSysLogic.ShowSeletcedSell(m_Item);
});
}
OnBack();
}
void ItemSellOK()
{
if (m_Item != null && m_Item.IsValid())
{
List<GameItem> selllist = new List<GameItem>();
selllist.Add(m_Item);
SysShopController.SellItem((int)GameItemContainer.Type.TYPE_BACKPACK, selllist);
OnBack();
}
}
void ItemGainPath()
{
ItemGetPathPopRoot.Show(m_Item.DataID, this.gameObject.transform.position);
UIManager.CloseUI(UIInfo.ItemTooltipsRoot);
}
void ItemThrow()
{
if (m_Item != null && m_Item.IsValid())
{
MessageBoxLogic.OpenOKCancelBox(3274, 1000, ItemThrowOK);
}
}
void ItemThrowOK()
{
Games.LogicObj.Obj_MainPlayer mainPlayer = Singleton<ObjManager>.Instance.MainPlayer;
if (m_Item != null && m_Item.IsValid() && null != mainPlayer)
{
if (mainPlayer.CheckThrowItem(m_Item))
{
mainPlayer.ThrowItem(m_Item);
}
OnBack();
}
}
bool CanOpenFunctionUI(GameItem m_Item)
{
//3
//1 强化界面 2.词条洗脸界面 3.基础洗脸界面 4.词条置换界面 5.宝石镶嵌界面 6.人物技能界面 7.生活技能
int mainPlayerLevel = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;
if (mainPlayerLevel < m_Item.GetMinLevelRequire())
{
return false;
}
int classId = m_Item.GetClass();
int subClassId = m_Item.GetSubClass();
bool isOpenUI = true;
switch (classId)
{
case (int)ItemClass.ADVANCEITEM:
{
if (subClassId == (int)AdvanceItemSubType.Ride || subClassId == (int)AdvanceItemSubType.GodWeapon || subClassId == (int)AdvanceItemSubType.Wing || subClassId == (int)AdvanceItemSubType.Wish
|| subClassId == (int)AdvanceItemSubType.Seal || subClassId == (int)AdvanceItemSubType.Mask || subClassId == (int)AdvanceItemSubType.Crown)
{
int advanceType = subClassId - 1;
//判断功能是否已经开启
if (!AdvanceCanadvanceCtr.GetInstance().IsAdvanceFuncOpen(advanceType))
{
GUIData.AddNotifyData("#{2182}");
OnBack();
return true;
}
UIManager.ShowUI(UIInfo.AdvanceMountPanel, delegate (bool bSuccess, object param)
{
if (bSuccess)
{
AdvanceMountPanelCtr.Instance.SetAdvanceType(advanceType);
AdvanceMountPanelCtr.Instance.OnMenuItemClick(AdvanceMenuItemPanelCtr.MenuItemOptType.Advance);
}
});
}
else if (subClassId == (int)AdvanceItemSubType.RideSkill || subClassId == (int)AdvanceItemSubType.GodWeaponSkill || subClassId == (int)AdvanceItemSubType.WingSkill || subClassId == (int)AdvanceItemSubType.WishSkill
|| subClassId == (int)AdvanceItemSubType.SealSkill || subClassId == (int)AdvanceItemSubType.MaskSkill || subClassId == (int)AdvanceItemSubType.CrownSkill)
{
int advanceType = subClassId - 9;
if (!AdvanceCanadvanceCtr.GetInstance().IsAdvanceFuncOpen(advanceType))
{
GUIData.AddNotifyData("#{2182}");
OnBack();
return true;
}
UIManager.ShowUI(UIInfo.AdvanceMountPanel, delegate (bool bSuccess, object param)
{
if (bSuccess)
{
AdvanceMountPanelCtr.Instance.SetAdvanceType(advanceType);
AdvanceMountPanelCtr.Instance.OnMenuItemClick(AdvanceMenuItemPanelCtr.MenuItemOptType.Show);
}
});
}
else if (subClassId == (int)AdvanceItemSubType.Meridian)
{
}
else if (subClassId >= (int)AdvanceItemSubType.RideSoul && subClassId <= (int)AdvanceItemSubType.CrownSprit)
{
var advanceType = 0;
if (subClassId >= (int)AdvanceItemSubType.RideSoul && subClassId <= (int)AdvanceItemSubType.CrownSoul)
advanceType = subClassId - 16;
else
advanceType = subClassId - 23;
if (!AdvanceCanadvanceCtr.GetInstance().IsAdvanceFuncOpen(advanceType))
{
GUIData.AddNotifyData("#{2182}");
OnBack();
return true;
}
UIManager.ShowUI(UIInfo.AdvanceMountPanel, delegate (bool bSuccess, object param)
{
if (bSuccess)
{
AdvanceMountPanelCtr.Instance.SetAdvanceType(advanceType);
AdvanceMountPanelCtr.Instance.OnMenuItemClick(AdvanceMenuItemPanelCtr.MenuItemOptType.Show);
}
});
}
else
{
isOpenUI = false;
}
OnBack();
return isOpenUI;
}
case (int)ItemClass.PRIZE:
{
if (subClassId == (int)PrizeSubClass.SPEAKER)
{
//弹出喇叭UI
UIManager.ShowUI(UIInfo.HornInputPanel);
}
else if (subClassId == (int)PrizeSubClass.ROSE)
{
CommunityLogic.ShowMyCommunityRoot();
}
else if (subClassId == (int)PrizeSubClass.GUILDCONTRIBUTIONDAN)
{
Tab_UsableItem useItem = TableManager.GetUsableItemByID(m_Item.DataID, 0);
if (useItem != null)
{
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{25228}", useItem.UseParamA), "", delegate ()
{
if (null != Singleton<ObjManager>.Instance.MainPlayer &&
Singleton<ObjManager>.Instance.MainPlayer.CheckUseItem(m_Item))
{
Singleton<ObjManager>.Instance.MainPlayer.UseItem(m_Item);
return;
}
}, delegate ()
{
});
}
}
else if (subClassId == (int)PrizeSubClass.ROLESKILL)
{
UIManager.ShowUI(UIInfo.SkillInfo);
}
else if (subClassId == (int)PrizeSubClass.LIVINGSKILL)
{
var liveItemTabs = TableManager.GetLivingSkillItem().Values;
int productItemID = -1;
foreach (var liveItem in liveItemTabs)
{
if (liveItem.ConsumeSubTypeA == m_Item.DataID || liveItem.ConsumeSubTypeB == m_Item.DataID)
{
productItemID = liveItem.Id;
}
for (int i = 0; i < liveItem.getConsumeSubTypeCount(); ++i)
{
if (liveItem.GetConsumeSubTypebyIndex(i) == m_Item.DataID)
{
productItemID = liveItem.Id;
}
}
if (productItemID > 0)
break;
}
UIManager.ShowUI(UIInfo.SkillInfo, delegate (bool bSucess, object param)
{
if (bSucess)
{
SkillRootLogic.Instance().ShowTagPage(2);
LiveSkillLogic.Instance().ShowLiveItem(productItemID);
}
});
}
else if (subClassId == (int)PrizeSubClass.SYNTHETICMAT)
{
//合成界面
ItemCombine.ShowCombineUI(m_Item.DataID);
}
else if (subClassId == (int)PrizeSubClass.FRIEND)
{
//好友--结拜道具
UIManager.ShowUI(UIInfo.FriendAndMail, delegate (bool bSucess, object param)
{
if (bSucess)
{
FriendAndMailRoot.Instance()._TagPanel.ShowPage(1);
}
});
}
else if (subClassId == (int)PrizeSubClass.LOVEBEAN)
{
//if(!GameManager.gameManager.PlayerDataPool.IsMarried)
//{
// GUIData.AddNotifyData("#{47029}");
// OnBack();
// return false;
//}
UIManager.ShowUI(UIInfo.MarryRoot, delegate (bool bSucess, object param)
{
if (bSucess)
{
MarryRoot.Instance.ShowPage(MarryRoot.MarryMenuItemType.Tree);
}
});
}
else if (subClassId == (int)PrizeSubClass.DIAMOND)
{
//if (!GameManager.gameManager.PlayerDataPool.IsMarried)
//{
// GUIData.AddNotifyData("#{47029}");
// OnBack();
// return false;
//}
UIManager.ShowUI(UIInfo.MarryRoot, delegate (bool bSucess, object param)
{
if (bSucess)
{
MarryRoot.Instance.ShowPage(MarryRoot.MarryMenuItemType.Ring);
}
});
}
else if (subClassId == (int)PrizeSubClass.Meridian)
{
//打开经脉丹药使用界面
Tab_FunctionOpen functionOpen = TableManager.GetFunctionOpenByID(6, 0);
if (functionOpen != null && functionOpen.ShowLevel > GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level)
{
GUIData.AddNotifyData("#{2182}");
}
else
{
UIManager.ShowUI(UIInfo.MeridiaSoulWnd, delegate (bool bSuccess, object param)
{
if (bSuccess)
{
MeridiaSoulMain.Instance._TagPanel.ShowPage((int)param);
}
},
0);
}
}
else if (subClassId == (int)PrizeSubClass.VIPCOST)
{
UIManager.ShowUI(UIInfo.YuanBaoShop, delegate (bool bSucess, object param)
{
if (bSucess)
{
YuanBaoShopLogic.Instance()._TagPanel.ShowPage(3);
if (VipInfo.Instance)
{
VipInfo.Instance.Click_OpenVIPRoot();
}
}
});
}
else
{
isOpenUI = false;
}
OnBack();
return isOpenUI;
}
case (int)ItemClass.STRENGTHEN:
{
if (subClassId != (int)StrengthenSubClass.JINENG && subClassId != (int)StrengthenSubClass.MAGICCLEAR)
{
UIManager.ShowUI(UIInfo.EquipEnhance, delegate (bool bSucess, object param)
{
if (bSucess)
{
switch (subClassId)
{
case 1:
EquipEnhanceRoot.Instance().TryOpen(1);
break;
case 2:
EquipEnhanceRoot.Instance().TryOpen(0);
break;
case 3:
EquipEnhanceRoot.Instance().TryOpen(0);
EquipEnhanceXilian.Instance()._TagPanel.ShowPage(1); //基础洗练
break;
case 4:
EquipEnhanceRoot.Instance().TryOpen(0);
EquipEnhanceXilian.Instance()._TagPanel.ShowPage(2); //词条置换
break;
case 5:
EquipEnhanceRoot.Instance().TryOpen(2); //宝石镶嵌
break;
case 10:
EquipEnhanceRoot.Instance().TryOpen(3);
break;
default:
isOpenUI = false;
break;
}
}
});
}
else if (subClassId == (int)StrengthenSubClass.MAGICCLEAR)
{
if (MagicMain.ShowMagicPageStr(1))
{
MagicMain.Instance.SetUseItem(m_Item.DataID);
}
OnBack();
return true;
}
else
{
int skillID = -1;
var skillLvUPTabs = TableManager.GetSkillLevelUp().Values;
foreach (var skillLvUpTab in skillLvUPTabs)
{
if (skillLvUpTab.GetConsumTypebyIndex(0) == (int)CONSUM_TYPE.ITEM)
{
if (skillLvUpTab.GetConsumIdbyIndex(0) == m_Item.DataID)
{
skillID = skillLvUpTab.GetId();
}
}
}
var skillex = TableManager.GetSkillExByID(skillID, 0);
var ownSkill = GameManager.gameManager.PlayerDataPool.GetOwnSkillInfo(skillex.BaseId);
if (skillID > 0 && ownSkill == null)
{
UIManager.ShowUI(UIInfo.SkillInfo, delegate (bool bSucess, object param)
{
if (bSucess)
{
SkillRootLogic.Instance().ShowTagPage(0);
SkillRootLogic.Instance().OnShowSkillItem(skillex.BaseId);
}
});
}
else
{
isOpenUI = false;
}
}
OnBack();
return isOpenUI;
}
case (int)ItemClass.FELLOW:
{
if (subClassId == (int)FellowSubClass.CALL)
{
return false;
}
UIManager.ShowUI(UIInfo.PetMainWndPath, delegate (bool bSucess, object param)
{
if (bSucess)
{
switch (subClassId)
{
//0属性 1洗练 2技能 3修悟
case 1:
{
//打开宠物的属性面板 经验
PetMainWnd.Instance.ShowPage(0, 0);
//PetMainWnd.Instance._TagPanel.ShowPage(0);
PetMainWnd.Instance.m_petAttrWnd.ShowAddExpItem(); //宠物经验道具
}
break;
case 2:
{
//打开宠物的属性面板 寿命
PetMainWnd.Instance.ShowPage(0, 0);
//PetMainWnd.Instance._TagPanel.ShowPage(0);
PetMainWnd.Instance.m_petAttrWnd.ShowAddLiftItem(); //宠物寿命道具
}
break;
case 3:
{
//技能面板
PetMainWnd.Instance.ShowPage(2, 0);
//PetMainWnd.Instance._TagPanel.ShowPage(2);
}
break;
case 4:
case 5:
{
PetMainWnd.Instance.ShowPage(2, 0);
//PetMainWnd.Instance._TagPanel.ShowPage(3);
}
break;
case 6:
{
PetMainWnd.Instance.ShowPage(1, 0);
//PetMainWnd.Instance._TagPanel.ShowPage(1);
//PetMainWnd.Instance.TagShowPageMain(1);
}
break;
case 7:
{
PetMainWnd.Instance.ShowPage(0, 0);
//PetMainWnd.Instance._TagPanel.ShowPage(0);
}
break;
default:
isOpenUI = false;
break;
}
}
});
OnBack();
return isOpenUI;
}
}
return false;
}
void ItemUse()
{
var itemGuid = m_Item.Guid;
if (GlobalData.MyShortCutItemGuidList.Contains(itemGuid))
{
GlobalData.MyShortCutItemGuidList.Remove(itemGuid);
}
var commonItem = TableManager.GetCommonItemByID(m_Item.DataID, 0);
if (m_Item != null && m_Item.IsValid())
{
int nPlayerLevel = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;
if (nPlayerLevel < commonItem.MinLevelRequire || nPlayerLevel > commonItem.MaxLevelRequire)
{
GUIData.AddNotifyData("#{1254}");
//Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{1254}");
return;
}
int equipProfession = commonItem.ProfessionRequire;
if (equipProfession > 0)
{
int nPlayerProfession = Singleton<ObjManager>.Instance.MainPlayer.Profession;
if (((equipProfession >> nPlayerProfession) & 1) == 0)
{
GUIData.AddNotifyData("#{5394}");
//Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{5394}");
return;
}
}
}
if (CanOpenFunctionUI(m_Item)) //判断是否是要打开对应的UI
{
return;
}
if (m_Item != null && m_Item.IsValid())
{
if (m_Item.GetClass() == (int)ItemClass.MEDIC
&& m_Item.GetSubClass() != (int)MedicSubClass.ATTR)
{
if (GlobalData.CanUseMedicItem(m_Item.DataID))
{
Tab_UsableItem usableItem = TableManager.GetUsableItemByID(m_Item.DataID, 0);
if (usableItem != null)
{
Tab_CoolDownTime coolDown = TableManager.GetCoolDownTimeByID(usableItem.CoolDownId, 0);
if (coolDown != null) //记录CD结束时间
{
ItemCDInfoCtr.AddItemCDInfo(usableItem.CoolDownId, coolDown.CDTime / 1000);
}
if (BackPackLogic.Instance() != null)
{
BackPackLogic.Instance().UpdateBackPack();
}
}
}
else
{
OnBack();
return;
}
}
if (m_Item.GetClass() == (int)ItemClass.TRESURE
&& (m_Item.GetSubClass() != (int)TresureSubClass.UndefinedLow
&& m_Item.GetSubClass() != (int)TresureSubClass.UndefinedHeight))
{
TresureItem.Instance.UseTresureItemInBackPack(m_Item);
OnBack();
return;
}
if (null != Singleton<ObjManager>.Instance.MainPlayer &&
Singleton<ObjManager>.Instance.MainPlayer.CheckUseItem(m_Item))
{
Singleton<ObjManager>.Instance.MainPlayer.UseItem(m_Item);
OnBack();
return;
}
if (m_Item.DataID == GlobeVar.MARRY_RING_ITEMID)
{
if (BackPackLogic.Instance() != null)
{
BackPackLogic.Instance().CloseWindow();
}
if (PlayerFrameLogic.Instance() != null)
{
//PlayerFrameLogic.Instance().PlayerFrameHeadOnClick();
}
}
OnBack();
}
}
void ItemBatchUse()
{
if (m_Item != null && m_Item.IsValid())
{
InputNumBoxLogic.ShowInputBoxStatic(StrDictionary.GetClientDictionaryString("#{46351}"), m_Item.StackCount, -1, 1, m_Item.StackCount, OnBatchUseNumChoose);
}
}
void OnBatchUseNumChoose(int num)
{
//if (m_Item != null && m_Item.IsValid())
//{
// for (int i = 0; i < num && i < m_Item.StackCount; i++)
// {
// if (null != Singleton<ObjManager>.Instance.MainPlayer &&
// Singleton<ObjManager>.Instance.MainPlayer.CheckUseItem(m_Item))
// {
// Singleton<ObjManager>.Instance.MainPlayer.BulkUseItem(m_Item, num);
// }
// }
// OnBack();
//}
if (num == -1)
{
OnBack();
return;
}
if (m_Item != null && m_Item.IsValid())
{
Singleton<ObjManager>.Instance.MainPlayer.BulkUseItem(m_Item, num);
OnBack();
}
}
void ItemShareLink()
{
if (m_Item != null && m_Item.IsValid())
{
}
//ShareLinkDirectChatInfo();
}
void PutInQianKunDai()
{
if (m_Item != null && m_Item.IsValid())
{
OnBack();
}
}
void Check_NewPlayerGuide()
{
if (BackPackLogic.Instance() != null)
{
//int nIndex = BackPackLogic.Instance().NewPlayerGuideFlag_Step;
//if (nIndex == 1)
//{
// NewPlayerGuide(0);
// BackPackLogic.Instance().NewPlayerGuideFlag_Step = -1;
//}
}
else if (SysShopController.Instance() != null)
{
//int nIndex = SysShopController.Instance().NewPlayerGuide_Step;
//if (nIndex == 1)
//{
// NewPlayerGuide(1);
// SysShopController.Instance().NewPlayerGuide_Step = -1;
//}
}
}
public void NewPlayerGuide(int nIndex)
{
//if (nIndex < 0)
//{
// return;
//}
//m_NewPlayerGuideFlag_Step = nIndex;
//switch (nIndex)
//{
// case 0:
// NewPlayerGuidLogic.OpenWindow(m_UseButton.gameObject, 130, 70, "", "right", 0, true, true);
// break;
// case 1:
// NewPlayerGuidLogic.OpenWindow(m_BuyBatchButton.gameObject, 130, 70, "", "right", 0, true, true);
// break;
//}
}
void OnBuyClick()
{
if (SysShopController.Instance() != null)
{
//SysShopController.Instance().BuyCurItem();
}
}
void OnBuyBatchClick()
{
if (SysShopController.Instance() != null)
{
//SysShopController.Instance().BuyBatchCurItem();
}
}
void ShareLinkDirectChatInfo()
{
UIManager.ShowUI(UIInfo.ChatInfoRoot, ShowChatInfoRootOver);
}
void ShowChatInfoRootOver(bool bSuccess, object param)
{
if (m_Item != null && m_Item.IsValid())
{
if (bSuccess)
{
//ChatInfoLogic.Instance().InsertItemLinkText(m_Item);
ItemTooltipsLogic.Instance().CloseWindow();
}
}
}
//寄售行求购
void ConsignSaleBuyBt()
{
//UIManager.ShowUI(UIInfo.ConsignSaleRoot, BuyItemOpenConsignSale);
}
void BuyItemOpenConsignSale(bool bSuccess, object param)
{
if (m_Item != null && m_Item.IsValid())
{
if (bSuccess)
{
//if (ConsignSaleLogic.Instance() != null)
//{
// ConsignSaleLogic.Instance().SearchForAskBuy(m_Item.GetName());
//}
OnBack();
}
}
}
void CangKuIn()
{
if (m_Item != null && m_Item.IsValid() && null != Singleton<ObjManager>.Instance.MainPlayer)
{
Singleton<ObjManager>.Instance.MainPlayer.CangKuPutIn(m_Item);
OnBack();
}
}
void CangKuOut()
{
if (m_Item != null && m_Item.IsValid() && null != Singleton<ObjManager>.Instance.MainPlayer)
{
Singleton<ObjManager>.Instance.MainPlayer.CangKuTakeOut(m_Item);
OnBack();
}
}
void AbsorbOnClick()
{
bool bRet = GameManager.gameManager.PlayerDataPool.CommonData.GetCommondFlag((int)USER_COMMONFLAG.CF_STRENGTHENFUNCTION_OPENFLAG);
if (bRet == false)
{
Singleton<ObjManager>.Instance.MainPlayer.SendNoticMsg(false, "#{2182}");
return;
}
//UIManager.ShowUI(UIInfo.EquipStren);
OnBack();
}
void ShowItemGetPath()
{
var pos = UIManager.Instance().UICamera.WorldToScreenPoint(transform.position);
ItemGetPathPopRoot.Show(m_Item.DataID, pos);
OnBack();
}
void LiveSkillGet()
{
if (LiveSkillLogic.Instance())
{
LiveSkillLogic.Instance().ShowLiveItem(m_Item.DataID);
}
OnBack();
}
void SetShortCutUseItem()
{
PlayerPreferenceData.ShortCutItemId = m_Item.DataID;
if (SkillBarLogic.Instance())
{
SkillBarLogic.Instance().SetUseItem();
}
OnBack();
}
}