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

1879 lines
69 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
using UnityEngine.UI;
using System.Text;
using System.Collections;
using GCGame.Table;
using Games.Item;
using Games.GlobeDefine;
using GCGame;
using System;
using System.Collections.Generic;
using Module.Log;
using Games.UserCommonData;
public class ItemTooltipsLogic : MonoBehaviour
{
public enum ShowType
{
Normal = 1, // 正常tooltips
Info, // 无操作按钮的tooltips
ShopBuy, // 购买界面
ShopBuyBatch, // 可以批量购买
QianKunDaiStuff, // 乾坤袋材料选择 比Normal多一个放入
ChatLink, // 聊天栏超链
CangKu, // 仓库取出
CangKuBackPack, // 仓库放入
BuyBack, // 回购
Equiped,
UnEquiped,
Compare,
GetPath, // 查看获取路径
LiveSkillGet, // 采集
}
public enum MenuBtnType
{
Use = 1, // 使用
BuyBack, // 回收
Bind, // 绑定
OnSell, // 出售
DivItem, // 拆解
PutsOn, // 装备
MakeOut, // 打造
LostGhost, // 失魂
Refix, // 修理
CallOut, // 召唤
SetFree, // 放生
}
public RectTransform _RootTransform;
public CommonItemTipsSlot _ItemSlot;
public Text _ItemName;
public Text _ItemType;
public Text _ItemDesc;
public Text _ItemLevel;
public UISubScollMenu _PopMenu;
public float _PosLeft;
public float _PosRight;
public GameObject _MenuContainer;
public GameObject _BtnSell;
public Text giftBagUseLimit; // 用于显示物品使用次数和上限,由于只有礼包到,暂定专属命名
public Text giftBagDeleteLine; // 删除线,表示已经或的该奖励
public UIContainerBase itemGetPathContainer; // 物品获取列表
private StringBuilder deleteLine = new StringBuilder();
public GameItem m_Item = null;
private static ItemTooltipsLogic m_Instance;
public static ItemTooltipsLogic Instance()
{
return m_Instance;
}
private static Action callBack;
private static GameItem m_curItem;
private static ShowType m_curType;
private static Vector3 _ClickPos;
private static int m_ItemClassId;
public Transform _ItemToolTipsTrans;
public static void ShowItemTooltip(int dataId, ShowType type, Vector3 pos, Action cb = null)
{
GameItem item = new GameItem();
item.DataID = dataId;
if (item.IsValid()/* && !item.IsEquipMent()*/)
{
ShowItemTooltip(item, type, pos, cb);
}
}
public static void ShowItemTooltip(GameItem equip, ShowType type, Vector3 pos, Action cb = null)
{
callBack = cb;
m_curItem = equip;
m_curType = type;
_ClickPos = pos;
LogModule.DebugLog("_ClickPos:" + _ClickPos);
//判断是否要显示模型
if (IsShowModel())
{
UIManager.ShowUI(UIInfo.ItemModelViewPanel, delegate(bool bSucess, object param) {
if(bSucess)
{
ItemModelViewPanel.Instance.Init(m_curItem, type);
}
});
return;
}
UIManager.ShowUI(UIInfo.ItemTooltipsRoot, ItemTooltipsLogic.OnShowItemTip);
}
static bool IsShowModel()
{
//进阶界面特殊处理
if (AdvanceMountPanelCtr.Instance && AdvanceMountPanelCtr.Instance.isActiveAndEnabled)
return false;
//背包时装界面
if (FashionPanelCtr.Instance && FashionPanelCtr.Instance.isActiveAndEnabled)
return false;
var commonItem = TableManager.GetCommonItemByID(m_curItem.DataID, 0);
if (commonItem != null &&
((commonItem.ClassID == (int)ItemClass.FASHION && (commonItem.SubClassID == 1 || commonItem.SubClassID == 2))
//|| (commonItem.ClassID == (int)ItemClass.FELLOW && commonItem.SubClassID == (int)FellowSubClass.CALL)
|| commonItem.ClassID == (int)ItemClass.ADVANCEFASHION))
{
return true;
}
return false;
}
private static void OnShowItemTip(bool bSuccess, object param)
{
if (!bSuccess)
{
LogModule.ErrorLog("load equiptooltip error");
callBack = null;
return;
}
ItemTooltipsLogic.Instance().ShowTooltips(m_curItem, m_curType);
// 特殊礼包的某些数据需要请求服务端
if(m_curItem.GetClass() == (int)ItemClass.GIFTBAG)
{
if(m_curItem.GetSubClass() == (int)GiftBagSubType.TypeAmountTime)
{
ItemTooltipsLogic.Instance().AskUseCountAndLimit();
}
else if(m_curItem.GetSubClass() == (int)GiftBagSubType.AccumulateTime)
{
ItemTooltipsLogic.Instance().AskPayAndNeed();
}
}
}
// 新手指引
private int m_NewPlayerGuideFlag_Step = -1;
void Awake()
{
m_Instance = this;
}
void Start()
{
Check_NewPlayerGuide();
}
private void OnDisable()
{
callBack = null;
}
void OnDestroy()
{
m_Instance = null;
}
private void ShowTooltips(GameItem item, ShowType type)
{
if (item == null)
{
CloseWindow();
return;
}
if (item.IsValid() == false)
{
CloseWindow();
return;
}
m_Item = item;
gameObject.SetActive(true);
_ItemSlot.InitItem(item);
SetItemName(item);
SetItemType(item);
SetItemUseLevel(item);
SetItemDesc(item);
//if (_ClickPos.x < 0)
//{
// _RootTransform.anchoredPosition = new Vector2(_PosRight, _RootTransform.anchoredPosition.y);
//}
//else
//{
// _RootTransform.anchoredPosition = new Vector2(_PosLeft, _RootTransform.anchoredPosition.y);
//}
int canuse = item.CanUse() ? 1 : 0;
int cansell = item.CanSell() ? 1 : 0;
int canthrow = TableManager.GetCommonItemByID(item.DataID, 0).CanThrow;
int isShowGainPath = TableManager.GetCommonItemByID(item.DataID, 0).IsShowGainPath;
_PopMenu.Clear();
_PopMenu.gameObject.SetActive(true);
_BtnSell.SetActive(false);
itemGetPathContainer.gameObject.SetActive(false);
HideGemData();
if (type == ShowType.Info) //仅显示信息 没有操作按钮的tips
{
_PopMenu.gameObject.SetActive(false);
//宝石特殊处理
if (m_curItem.IsGem())
{
ShowGemData();
}
else
{
HideGemData();
}
}
else if (type == ShowType.ShopBuy)
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4549}"));
}
else if (type == ShowType.ShopBuyBatch)
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4549}"));
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4574}"));
}
else if (type == ShowType.ChatLink)
{
//根据是否可以上架 决定是否显示求购按钮
//if (ConsignSaleBag.isCanConsignSale(item, true))
//{
// _PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4577}"));
//}
}
else if (type == ShowType.CangKu) //仓库界面 仓库物品tips
{
//显示取回按钮
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4576}"));
}
else if (type == ShowType.CangKuBackPack) //仓库界面 背包物品tips
{
//显示放入仓库按钮
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4573}"));
}
else if (type == ShowType.BuyBack) //回购
{
//显示回购按钮
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{1086}"));
}
else if (type == ShowType.GetPath)
{
//显示获取路径
//if (isShowGainPath == 1)
//{
ShowItmeGetPath();
//_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{52001}")); //获取途径
//}
}
else if (type == ShowType.LiveSkillGet)
{
//显示获取路径
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4753}"));
}
else
{
if (item.GetClass() == (int)ItemClass.FELLOW && item.GetSubClass() == (int)FellowSubClass.CALL) //特殊描述,与使用功能相同
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{42000}")); //召唤
}
else
{
if (item.CanUse())
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4571}")); //使用
}
}
if (ItemCombine.CanItemCombine(item.DataID))
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{42003}")); //合成
}
if (item.GetClass() == (int)ItemClass.MEDIC
&& item.GetSubClass() != (int)MedicSubClass.ATTR)
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{42200}")); //药品装备
}
if (!item.BindFlag)
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3580}")); //绑定
}
var canSellItems = TableManager.GetUserShopItem();
var canSellSysItems = TableManager.GetExchangeMarket();
if ((canSellItems.ContainsKey(item.DataID)
|| canSellSysItems.ContainsKey(item.DataID))
&& !item.BindFlag)
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4578}")); //出售
}
if (canuse == 1 && item.StackCount > 1 && CanBatchUse(item.DataID))
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4572}")); //批量使用
}
if (canthrow == 1)
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4579}")); //丢弃
}
if(isShowGainPath == 1)
{
ShowItmeGetPath();
//_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{52001}")); //获取途径
}
else
{
itemGetPathContainer.gameObject.SetActive(false);
}
if (cansell == 1)
{
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3877}")); //回收
//_BtnSell.SetActive(true);
}
}
if (_PopMenu.SubBtns.Count > 0)
{
_MenuContainer.SetActive(true);
}
else
{
_MenuContainer.SetActive(false);
}
//gameObject.SetActive(true);
//UIManager.ShowUI(UIInfo.ItemTooltipsRoot);
}
bool CanBatchUse(int itemId)
{
var commonItem = TableManager.GetCommonItemByID(itemId, 0);
if(commonItem != null)
{
return commonItem.CanBulkUse != -1 ? true : false;
}
//if (m_Item.GetClass() == (int)ItemClass.PRIZE)
//{
// if (m_Item.GetSubClass() == 1
// || m_Item.GetSubClass() == 2
// || m_Item.GetSubClass() == 4)
// {
// return true;
// }
//}
return false;
}
private void ShowItmeGetPath()
{
var _ItemPathTab = TableManager.GetItemGetPathByID(m_Item.DataID, 0);
if (_ItemPathTab == null)
{
LogModule.ErrorLog("ItemGetPath没有配置这个物品" + m_Item.DataID);
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);
string infoRaw = _ItemPathTab.GetItemPathbyIndex(i).Trim('"');
string[] infos = infoRaw.Split('|');
//Debug.LogError("infos10 == " + infos.Length);
for (int j = 0; j < infos.Length; ++j)
{
ItemGetPathPopRoot.GetPathData item = new ItemGetPathPopRoot.GetPathData();
item.pathType = i;
item.info = infos[j];
item.itemID = _ItemPathTab.Id;
pathList.Add(item);
}
}
break;
case 1:
case 2:
case 3:
case 6:
case 8:
case 11:
{
// 详细
string infoRaw = _ItemPathTab.GetItemPathbyIndex(i).Trim('"');
string[] infos = infoRaw.Split('|');
for (int j = 0; j < infos.Length; ++j)
{
ItemGetPathPopRoot.GetPathData 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)
{
//Debug.LogError(pathList.Count+ " pathList.Count");
itemGetPathContainer.gameObject.SetActive(true);
itemGetPathContainer.InitContentItem(pathList, OnGetItemCllick);
}
}
}
private void OnGetItemCllick(object data)
{
ItemGetPathPopRoot.GetPathData info = data as ItemGetPathPopRoot.GetPathData;
if (data != null)
{
ItemGetPathPopRoot.GoGetPath(info, callBack);
}
CloseWindow();
}
void SetItemName(GameItem item)
{
if (item != null && item.IsValid())
{
int nQuality = (int)item.GetQuality();
_ItemName.text = Utils.GetQualityColorInTip(nQuality);
_ItemName.text += TableManager.GetCommonItemByID(item.DataID, 0).Name + "</color>";
}
}
void SetItemType(GameItem item)
{
if (item != null && item.IsValid())
{
Tab_CommonItem tabItem = TableManager.GetCommonItemByID(item.DataID, 0);
if (tabItem != null)
{
int nClassID = tabItem.ClassID;
int nSubClassID = tabItem.SubClassID;
_ItemType.text = Utils.GetItemType(nClassID, nSubClassID, tabItem.ProfessionRequire);
}
}
}
void SetItemUseLevel(GameItem item)
{
if (item != null && item.IsValid())
{
int nPlayerLevel = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;
Tab_CommonItem tabItem = TableManager.GetCommonItemByID(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>";
}
}
}
}
bool IsInUsabItemTab(int _itemId)
{
var usabItemTab = TableManager.GetUsableItemByID(_itemId, 0);
if (usabItemTab != null)
return true;
return false;
}
void SetItemDesc(GameItem item)
{
if (item != null && item.IsValid())
{
if (null != TableManager.GetCommonItemByID(item.DataID, 0))
{
string strItemDesc = StrDictionary.GetClientString_WithNameSex(TableManager.GetCommonItemByID(item.DataID, 0).Tips);
if(string.IsNullOrEmpty(item.SignName)==false)
{
strItemDesc += "\n";
strItemDesc += StrDictionary.GetClientDictionaryString("#{5163}", item.SignName);
}
_ItemDesc.text = strItemDesc;
//_ItemDesc.text = string.Format(strItemDesc, itemLimitInfo.GetItemRemainCanUseTimes(item.DataID));
}
if (item.DataID == GlobeVar.MARRY_RING_ITEMID)
{
_ItemDesc.text = Utils.GetMarryRingString(item);
}
giftBagUseLimit.gameObject.SetActive(false);
giftBagDeleteLine.gameObject.SetActive(false);
// 礼包三的特殊处理
if (item.GetClass() == (int)ItemClass.GIFTBAG)
{
if (item.GetSubClass() == (int)GiftBagSubType.OneAmountTime)
{
giftBagUseLimit.text = StrDictionary.GetClientDictionaryString("#{79000}", item.UsedCount, item.UseLimit);
giftBagDeleteLine.text = "";
string[] descs = _ItemDesc.text.Split('\n');
for (int i = 1; i < descs.Length; ++i)
{
deleteLine.Length = 0;
if (i - 1 < item.UsedCount)
{
for (int j = 0; j < descs[i].Length; ++j)
{
deleteLine.Append("—");
}
}
if (i == descs.Length - 1)
{
giftBagDeleteLine.text += deleteLine.ToString();
}
else
{
giftBagDeleteLine.text += deleteLine.ToString() + "\n";
}
}
giftBagUseLimit.gameObject.SetActive(true);
giftBagDeleteLine.gameObject.SetActive(true);
}
else
{
giftBagDeleteLine.gameObject.SetActive(false);
}
}
else
{
Tab_UsableItem useItem = TableManager.GetUsableItemByID(item.DataID, 0);
if (useItem != null)
{
Tab_CountLimit countLimit = TableManager.GetCountLimitByID(useItem.LimitId, 0);
if (countLimit != null)
{
var itemLimitInfo = GameManager.gameManager.PlayerDataPool.ItemLimitInfo;
giftBagDeleteLine.gameObject.SetActive(true);
if (countLimit.DayLimit > 0)
{
giftBagDeleteLine.text = StrDictionary.GetClientDictionaryString("#{41439}",
itemLimitInfo.GetItemRemainCanUseTimes(item.DataID) == -1 ? 0 : itemLimitInfo.GetItemRemainCanUseTimes(item.DataID));
return;
}
if (countLimit.WeekLimit > 0)
{
giftBagDeleteLine.text = StrDictionary.GetClientDictionaryString("#{41440}",
itemLimitInfo.GetItemRemainCanUseTimes(item.DataID) == -1 ? 0 : itemLimitInfo.GetItemRemainCanUseTimes(item.DataID));
return;
}
if (countLimit.MonthLimit > 0)
{
giftBagDeleteLine.text = StrDictionary.GetClientDictionaryString("#{41441}",
itemLimitInfo.GetItemRemainCanUseTimes(item.DataID) == -1 ? 0 : itemLimitInfo.GetItemRemainCanUseTimes(item.DataID));
return;
}
if (countLimit.TotalLimit > 0)
{
giftBagDeleteLine.text = StrDictionary.GetClientDictionaryString("#{41442}",
itemLimitInfo.GetItemRemainCanUseTimes(item.DataID) == -1 ? 0 : itemLimitInfo.GetItemRemainCanUseTimes(item.DataID));
return;
}
}
}
}
}
}
// 显示礼包4的已使用次数描述
public void SetGift4UsedCountAndLimit(RetSpecialGift4Info packet)
{
if (m_curItem.GetClass() == (int)ItemClass.GIFTBAG
&& m_curItem.GetSubClass() == (int)GiftBagSubType.TypeAmountTime
&& m_curItem.DataID == packet.itemid)
{
giftBagUseLimit.text = StrDictionary.GetClientDictionaryString("#{79001}", packet.usedcount, packet.maxcount);
//giftBagUseLimit.text = string.Format("今日已用次数: {0}/{1}", packet.usedcount, packet.maxcount);
giftBagUseLimit.gameObject.SetActive(true);
}
else
{
giftBagUseLimit.gameObject.SetActive(false);
}
}
// 显示礼包5的已使用次数描述
public void SetGift5UsedCountAndLimit(RetSpecialGift5Info packet)
{
if (m_curItem.GetClass() == (int)ItemClass.GIFTBAG
&& m_curItem.GetSubClass() == (int)GiftBagSubType.AccumulateTime
&& m_curItem.DataID == packet.itemid)
{
// 白色 FBF6F6FF
// 绿色 44E736FF
string payTime;
if (packet.payTimes >= packet.needTimes)
{
payTime = string.Format("<color=#44E736FF>{0}</color>", packet.payTimes);
}
else
{
payTime = string.Format("<color=#FBF6F6FF>{0}</color>", packet.payTimes);
}
giftBagUseLimit.text = StrDictionary.GetClientDictionaryString("#{79004}", payTime, packet.needTimes);
giftBagUseLimit.gameObject.SetActive(true);
}
else
{
giftBagUseLimit.gameObject.SetActive(false);
}
}
public static void CloseWindowStatic()
{
UIManager.CloseUI(UIInfo.ItemTooltipsRoot);
}
public void CloseWindow()
{
//m_Item = null;
//gameObject.SetActive(false);
UIManager.CloseUI(UIInfo.ItemTooltipsRoot);
}
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 - 召唤
//ItemTooltipsLogic.ItemUse(m_Item);
UseGameProp(m_Item);
}
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);
CloseWindow();
}
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{42200}"))
{
// 携带
EquipMedicItem();
}
else if (menuStr == StrDictionary.GetClientDictionaryString("#{3580}"))
{
// 绑定
BindItem();
}
}
public static void UseGameProp(GameItem gameItem)
{
if (gameItem.DataID == 919)
{
var _ImpactId = -1;
for (int i = 0; i < Singleton<ObjManager>.Instance.MainPlayer.ClientImpactInfos.Count; ++i)
{
_ImpactId = Singleton<ObjManager>.Instance.MainPlayer.ClientImpactInfos[i].ImpactId;
}
if (_ImpactId == 99998)
{
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{48311}"), "", delegate ()
{
ItemTooltipsLogic.ItemUse(gameItem);
}, null);
}
else
{
ItemTooltipsLogic.ItemUse(gameItem);
}
}
else
{
ItemTooltipsLogic.ItemUse(gameItem);
}
}
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);
CloseWindow();
}
}
}
}
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())
{
if (m_Item.CanSell() == false)
{
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{8902}"));
return;
}
if (m_Item.IsGem())//宝石
{
m_Item.GetName();//名字
Tab_GemLvlUpConsume tab_GemLvlUpConsume = TableManager.GetGemLvlUpConsumeByID(m_Item.DataID, 0);//宝石
if (tab_GemLvlUpConsume == null)
return;
Tab_GemLvlUpConsume tab_GemLvlUpConsume1 = TableManager.GetGemLvlUpConsumeByID(tab_GemLvlUpConsume.ConsumeSubType, 0);//宝石子类
if (tab_GemLvlUpConsume1 == null)
return;
Tab_CommonItem tab_CommonItem = TableManager.GetCommonItemByID(tab_GemLvlUpConsume1.Id, 0);//工具表
if (tab_CommonItem == null)
return;
if (tab_GemLvlUpConsume.DesLevel == 1)
{
string moneyName = Utils.GetMoneyName(tab_CommonItem.SellMoneyType);//卖出货币类型
SysShopController.m_TipSelDataID = m_Item.DataID;
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{6152}", m_Item.GetName(), tab_CommonItem.SellPrice * m_Item.StackCount + moneyName), "", ItemSellOK, null);
}
else
{
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{6151}", m_Item.GetName(), tab_GemLvlUpConsume.GemMaterialCnt, tab_CommonItem.Name), "", ItemSellOK, null);
}
}
else if (m_Item.GetQuality() >= ItemQuality.QUALITY_BLUE)
{
SysShopController.m_TipSelDataID = m_Item.DataID;
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{4668}"), "", ItemSellOK, null);
}
else
{
SysShopController.m_TipSelDataID = m_Item.DataID;
ItemSellOK();
}
}
CloseWindow();
}
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);
});
}
CloseWindow();
}
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);
CloseWindow();
}
}
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);
}
CloseWindow();
}
}
public static bool CanOpenFunctionUI(GameItem item)
{
//3
//1 强化界面 2.词条洗脸界面 3.基础洗脸界面 4.词条置换界面 5.宝石镶嵌界面 6.人物技能界面 7.生活技能
int mainPlayerLevel = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;
if (mainPlayerLevel < item.GetMinLevelRequire())
{
return false;
}
int classId = item.GetClass();
int subClassId = 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}");
CloseWindowStatic();
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}");
CloseWindowStatic();
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}");
CloseWindowStatic();
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;
}
CloseWindowStatic();
return isOpenUI;
}
case (int)ItemClass.PRIZE:
{
if (subClassId == (int)PrizeSubClass.SPEAKER
|| subClassId == (int)PrizeSubClass.AllSERVERHORN
|| subClassId == (int)PrizeSubClass.CROSSSERVERHORN)
{
//弹出喇叭UI
UIManager.ShowUI(UIInfo.HornInputPanel, delegate(bool bSucessm, object param) {
if(bSucessm)
{
HornInputPanelCtr.Instance.RecordHornType(subClassId);
}
});
}else if(subClassId >= (int)PrizeSubClass.DAILYCOPY1 && subClassId <= (int)PrizeSubClass.DAILYCOPY4)
{
UIManager.ShowUI(UIInfo.CopyScenePanelCtr, delegate (bool bSucess, object param)
{
if (bSucess)
{
CopyScenePanelCtr.Instance.OnMenuItemClick(0, subClassId - 50);
}
});
}
else if(subClassId == (int)PrizeSubClass.EQUIPCOPY)
{
UIManager.ShowUI(UIInfo.CopyScenePanelCtr, delegate(bool bSucess, object param) {
if(bSucess)
{
CopyScenePanelCtr.Instance.OnMenuItemClick(1);
}
});
}
else if (subClassId == (int)PrizeSubClass.ROSE)
{
CommunityLogic.ShowMyCommunityRoot();
}
else if (subClassId == (int)PrizeSubClass.GUILDCONTRIBUTIONDAN)
{
Tab_UsableItem useItem = TableManager.GetUsableItemByID(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(item))
{
Singleton<ObjManager>.Instance.MainPlayer.UseItem(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 == item.DataID || liveItem.ConsumeSubTypeB == item.DataID)
{
productItemID = liveItem.Id;
}
for (int i = 0; i < liveItem.getConsumeSubTypeCount(); ++i)
{
if (liveItem.GetConsumeSubTypebyIndex(i) == 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(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)
{
UIManager.ShowUI(UIInfo.MarryRoot, delegate(bool bSucess, object param) {
if(bSucess)
{
MarryRoot.Instance.ShowPage(MarryRoot.MarryMenuItemType.Tree);
}
});
}else if(subClassId == (int)PrizeSubClass.DIAMOND)
{
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 if (subClassId == (int)PrizeSubClass.DreamDan)
{
isOpenUI = false;
var itemAddCount = TableManager.GetUsableItemByID(item.DataID, 0).UseParamA;
int _RemainCount = ActivityDataManager.Instance.GetActivityCompleteTimes((int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_EXERCISEROOM);
if(_RemainCount>=0)
{
if (itemAddCount + _RemainCount > TableManager.GetExerciseRoomSetUpByID(0, 0).DayLimit)
{
isOpenUI = true;
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{8140}"), "", delegate ()
{
if (null != Singleton<ObjManager>.Instance.MainPlayer &&
Singleton<ObjManager>.Instance.MainPlayer.CheckUseItem(item))
{
Singleton<ObjManager>.Instance.MainPlayer.UseItem(item);
CloseWindowStatic();
}
UIManager.CloseUI(UIInfo.MessageBox);
}, delegate ()
{
UIManager.CloseUI(UIInfo.MessageBox);
});
}
}
}
else if (subClassId == (int)PrizeSubClass.CHILDGROWTH
|| subClassId == (int)PrizeSubClass.CHILDSTUDY)
{
UIManager.ShowUI(UIInfo.ChildPanel, (bool bSucess, object param) => {
if(bSucess)
{
ChildPanel.Instance.ShowPanel(subClassId - 54);
}
});
}
else
{
isOpenUI = false;
}
CloseWindowStatic();
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(item.DataID);
}
CloseWindowStatic();
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) == 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;
}
}
CloseWindowStatic();
return isOpenUI;
}
case (int)ItemClass.FASHION:
{
if (subClassId == (int)FashionSubClass.CHILDFASHION)
{
UIManager.ShowUI(UIInfo.ChildPanel, (bool bSucess, object param) =>
{
if (bSucess)
{
ChildPanel.Instance.ShowPanel(3);
}
});
CloseWindowStatic();
return true;
}
CloseWindowStatic();
return false;
}
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._TagPanel.ShowPage(0);
PetMainWnd.Instance.ShowPage(0, 0);
PetMainWnd.Instance.m_petAttrWnd.ShowAddExpItem(); //宠物经验道具
}
break;
case 2:
{
//打开宠物的属性面板 寿命
//PetMainWnd.Instance._TagPanel.ShowPage(0);
PetMainWnd.Instance.ShowPage(0, 0);
PetMainWnd.Instance.m_petAttrWnd.ShowAddLiftItem(); //宠物寿命道具
}
break;
case 3:
{
//技能面板
//PetMainWnd.Instance._TagPanel.ShowPage(2);
PetMainWnd.Instance.ShowPage(2, 0);
}
break;
case 4:
case 5:
{
//PetMainWnd.Instance._TagPanel.ShowPage(3);
PetMainWnd.Instance.ShowPage(3, 0);
}
break;
case 6:
{
//PetMainWnd.Instance._TagPanel.ShowPage(1);
//PetMainWnd.Instance.TagShowPageMain(1);
PetMainWnd.Instance.ShowPage(1, 0);
}
break;
case 7:
{
PetMainWnd.Instance.ShowPage(0, 0);
//PetMainWnd.Instance._TagPanel.ShowPage(0);
}
break;
case 11:
{
PetMainWnd.Instance.ShowPage(5, 1);
//PetMainWnd.Instance._TagPanel.ShowPage(0);
}
break;
default:
PetMainWnd.Instance.ShowPage(0, 0);
isOpenUI = false;
break;
}
}
});
CloseWindowStatic();
return isOpenUI;
}
case (int)ItemClass.MARKETINGACT:
{
Tab_ActItemUsePath tab = TableManager.GetActItemUsePathByID(subClassId, 0);
if(tab != null)
{
string parm = tab.ActParam;
string[] parms = parm.TrimEnd(' ', '"').Split('*');
if(parms.Length > 1)
{
ItemGetPathPopRoot.GotoOperationalAct(Convert.ToInt32(parms[0]), Convert.ToInt32(parms[1]));
CloseWindowStatic();
}
else if(parms.Length > 0)
{
ItemGetPathPopRoot.GotoOperationalAct(Convert.ToInt32(parms[0]), -1);
CloseWindowStatic();
}
}
return true;
}
case (int)ItemClass.GUILDCHANGENAME:
{
UIManager.ShowUI(UIInfo.GuildMainInfoWnd, delegate (bool bSucess, object param)
{
if (bSucess)
{
if(HasGuildMainWnd.Instance()!=null)
HasGuildMainWnd.Instance().OPenChangeName();
CloseWindowStatic();
}
});
return true;
}
}
return false;
}
public static void ItemUse(GameItem gameItem)
{
Tab_UsableItem usabItem = TableManager.GetUsableItemByID(gameItem.DataID, 0);
if (usabItem != null && GameManager.gameManager.m_RunningScene == 658 && usabItem.DrugType == 1)
{
GUIData.AddNotifyData(GCGame.Table.StrDictionary.GetClientDictionaryString("#{79513}"));
return; // 在紫禁之巅禁止使用血包
}
if (gameItem == null || gameItem.IsValid() == false)
return;
var itemGuid = gameItem.Guid;
if(GlobalData.MyShortCutItemGuidList.Contains(itemGuid))
{
GlobalData.MyShortCutItemGuidList.Remove(itemGuid);
}
var commonItem = TableManager.GetCommonItemByID(gameItem.DataID, 0);
if (gameItem != null && gameItem.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(gameItem)) //判断是否是要打开对应的UI
{
return;
}
if (gameItem != null && gameItem.IsValid())
{
if (gameItem.GetClass() == (int)ItemClass.MEDIC
&& gameItem.GetSubClass() != (int)MedicSubClass.ATTR)
{
if (GlobalData.CanUseMedicItem(gameItem.DataID))
{
Tab_UsableItem usableItem = TableManager.GetUsableItemByID(gameItem.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
{
CloseWindowStatic();
return;
}
}
if (gameItem.GetClass() == (int)ItemClass.TRESURE
&& (gameItem.GetSubClass() != (int)TresureSubClass.UndefinedLow
&& gameItem.GetSubClass() != (int)TresureSubClass.UndefinedHeight))
{
TresureItem.Instance.UseTresureItemInBackPack(gameItem);
CloseWindowStatic();
return;
}
if (null != Singleton<ObjManager>.Instance.MainPlayer &&
Singleton<ObjManager>.Instance.MainPlayer.CheckUseItem(gameItem))
{
Singleton<ObjManager>.Instance.MainPlayer.UseItem(gameItem);
CloseWindowStatic();
return;
}
if (gameItem.DataID == GlobeVar.MARRY_RING_ITEMID)
{
if (BackPackLogic.Instance() != null)
{
BackPackLogic.Instance().CloseWindow();
}
if (PlayerFrameLogic.Instance() != null)
{
//PlayerFrameLogic.Instance().PlayerFrameHeadOnClick();
}
}
CloseWindowStatic();
}
}
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);
// }
// }
// CloseWindow();
//}
if(num == -1)
{
CloseWindow();
return;
}
if(m_Item != null && m_Item.IsValid())
{
Singleton<ObjManager>.Instance.MainPlayer.BulkUseItem(m_Item, num);
CloseWindow();
}
}
void ItemShareLink()
{
if (m_Item != null && m_Item.IsValid())
{
}
//ShareLinkDirectChatInfo();
}
void PutInQianKunDai()
{
if (m_Item != null && m_Item.IsValid())
{
CloseWindow();
}
}
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());
//}
CloseWindow();
}
}
}
void CangKuIn()
{
if (m_Item != null && m_Item.IsValid() && null != Singleton<ObjManager>.Instance.MainPlayer)
{
Singleton<ObjManager>.Instance.MainPlayer.CangKuPutIn(m_Item);
CloseWindow();
}
}
void CangKuOut()
{
if (m_Item != null && m_Item.IsValid() && null != Singleton<ObjManager>.Instance.MainPlayer)
{
Singleton<ObjManager>.Instance.MainPlayer.CangKuTakeOut(m_Item);
CloseWindow();
}
}
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);
CloseWindow();
}
void ShowItemGetPath()
{
var pos = UIManager.Instance().UICamera.WorldToScreenPoint(transform.position);
ItemGetPathPopRoot.Show(m_Item.DataID, pos);
CloseWindow();
}
// 请求特殊礼包4的特殊数据使用次数和使用上限
private void AskUseCountAndLimit()
{
ReqSpecialGift4Info req = new ReqSpecialGift4Info();
req.itemid = m_curItem.DataID;
req.SendMsg();
}
// 请求特殊礼包5的特殊数据使用次数和使用上限
private void AskPayAndNeed()
{
ReqSpecialGift5Info req = new ReqSpecialGift5Info();
req.itemid = m_curItem.DataID;
req.SendMsg();
}
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();
CloseWindow();
}
void LiveSkillGet()
{
if (LiveSkillLogic.Instance())
{
LiveSkillLogic.Instance().ShowLiveItem(m_Item.DataID);
}
CloseWindow();
}
void SetShortCutUseItem()
{
PlayerPreferenceData.ShortCutItemId = m_Item.DataID;
if (SkillBarLogic.Instance())
{
SkillBarLogic.Instance().SetUseItem();
}
CloseWindow();
}
#region gem specil
public GameObject _BtnMaxGem;
public EquipMaxGemTooltips _MaxGemTips;
public void ShowGemData()
{
_BtnMaxGem.gameObject.SetActive(true);
_MenuContainer.gameObject.SetActive(false);
_MaxGemTips.gameObject.SetActive(false);
}
public void HideGemData()
{
_BtnMaxGem.gameObject.SetActive(false);
_MenuContainer.gameObject.SetActive(true);
_MaxGemTips.gameObject.SetActive(false);
}
public void OnBtnShowMaxGem()
{
_MaxGemTips.SetGemMaxInfo(m_curItem.DataID);
}
#endregion
}