968 lines
31 KiB
C#
968 lines
31 KiB
C#
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
using System.Collections;
|
||
using GCGame.Table;
|
||
using Games.Item;
|
||
using GCGame;
|
||
using System.Collections.Generic;
|
||
using Games.GlobeDefine;
|
||
using Games.LogicObj;
|
||
using Module.Log;
|
||
using Games.UserCommonData;
|
||
using System;
|
||
|
||
public class EquipTooltipsLogic : MonoBehaviour
|
||
{
|
||
public RectTransform _RootTransform;
|
||
public EquipTooltipsInfo _ShowingEquipInfo;
|
||
public EquipTooltipsInfo _CompareEquipInfo;
|
||
public RectTransform _ShowingEquipRect;
|
||
public RectTransform _CompareEquipRect;
|
||
public UISubScollMenu _PopMenu;
|
||
public GameObject _EquipInfoOffset;
|
||
public float _PosLeft;
|
||
public float _PosRight;
|
||
|
||
public GameObject _MenuContainer;
|
||
public GameObject _BtnSell;
|
||
|
||
private GameItem m_Equip;
|
||
private GameItemContainer.Type _ContainerPack;
|
||
private ItemTooltipsLogic.ShowType m_Type;
|
||
|
||
private static EquipTooltipsLogic m_Instance = null;
|
||
public static EquipTooltipsLogic Instance()
|
||
{
|
||
return m_Instance;
|
||
}
|
||
|
||
private static GameItem m_curItem;
|
||
private static ItemTooltipsLogic.ShowType m_curType;
|
||
private static Vector3 _ClickPos;
|
||
|
||
public static void ShowEquipTooltip(int dataId, ItemTooltipsLogic.ShowType type, Vector3 clickPos)
|
||
{
|
||
|
||
GameItem item = new GameItem();
|
||
item.DataID = dataId;
|
||
if (item.IsValid() && item.IsEquipMent())
|
||
{
|
||
ShowEquipTooltip(item, type, clickPos);
|
||
}
|
||
}
|
||
public static void ShowEquipTooltip(GameItem equip, ItemTooltipsLogic.ShowType type, Vector3 clickPos)
|
||
{
|
||
m_curItem = equip;
|
||
m_curType = type;
|
||
_ClickPos = clickPos;
|
||
UIManager.ShowUI(UIInfo.EquipTooltipsRoot, EquipTooltipsLogic.OnShowEquipTip);
|
||
}
|
||
|
||
private static void OnShowEquipTip(bool bSuccess, object param)
|
||
{
|
||
if (!bSuccess)
|
||
{
|
||
LogModule.ErrorLog("load equiptooltip error");
|
||
return;
|
||
}
|
||
|
||
EquipTooltipsLogic.Instance().ShowTooltips(m_curItem, m_curType);
|
||
}
|
||
|
||
void Awake()
|
||
{
|
||
m_Instance = this;
|
||
}
|
||
|
||
void Start()
|
||
{
|
||
|
||
}
|
||
|
||
public IEnumerator ShowEquip()
|
||
{
|
||
_EquipInfoOffset.transform.localPosition = new Vector3(0, 2000, 0);
|
||
yield return null;
|
||
_EquipInfoOffset.transform.localPosition = Vector3.zero;
|
||
}
|
||
|
||
void OnDestroy()
|
||
{
|
||
m_Instance = null;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 显示装备Tooltips
|
||
/// </summary>
|
||
/// <param name="equip">装备</param>
|
||
private void ShowTooltips(GameItem equip, ItemTooltipsLogic.ShowType type)
|
||
{
|
||
if (equip == null)
|
||
{
|
||
CloseWindow();
|
||
return;
|
||
}
|
||
if (equip.IsValid() == false)
|
||
{
|
||
CloseWindow();
|
||
return;
|
||
}
|
||
|
||
m_Equip = equip;
|
||
m_Type = type;
|
||
|
||
//if (_ClickPos.x < 0)
|
||
//{
|
||
// _RootTransform.anchoredPosition = new Vector2(_PosRight, _RootTransform.anchoredPosition.y);
|
||
//}
|
||
//else
|
||
//{
|
||
// _RootTransform.anchoredPosition = new Vector2(_PosLeft, _RootTransform.anchoredPosition.y);
|
||
//}
|
||
_ShowingEquipRect.anchoredPosition = new Vector2(0, 0);
|
||
|
||
HideAllButtons();
|
||
|
||
//如果本装备位已经装备物品 弹出对比tips
|
||
int slotindex = equip.GetEquipSlotIndex();
|
||
GameItem CompareEquip = GameManager.gameManager.PlayerDataPool.EquipPack.GetItem(slotindex);
|
||
_ShowingEquipInfo.SetEquipInfo(equip, CompareEquip);
|
||
_CompareEquipInfo.gameObject.SetActive(false);
|
||
|
||
_PopMenu.Clear();
|
||
_PopMenu.gameObject.SetActive(true);
|
||
//_BtnSell.SetActive(false);
|
||
if (type == ItemTooltipsLogic.ShowType.Equiped) //点击装备槽位弹出的tips
|
||
{
|
||
_ContainerPack = GameItemContainer.Type.TYPE_EQUIPPACK;
|
||
//脱下按钮 显示
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3876}"));
|
||
//装备强化按钮 显示
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{5422}"));
|
||
if (m_Equip.IsCanXilian())
|
||
{
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{5423}"));
|
||
}
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{5424}"));
|
||
if (m_Equip.IsCanFrenzy())
|
||
{
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{5425}"));
|
||
}
|
||
//修理
|
||
if (equip.Durable != equip.GetEquipMaxDurable())
|
||
{
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{5317}"));
|
||
}
|
||
//失魂
|
||
if (equip.IsShihun())
|
||
{
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{5318}"));
|
||
}
|
||
|
||
////隐藏战斗力箭头
|
||
//m_EquipPowerArrowUpSprite.gameObject.SetActive(false);
|
||
//m_EquipPowerArrowDownSprite.gameObject.SetActive(false);
|
||
|
||
}
|
||
else if (type == ItemTooltipsLogic.ShowType.UnEquiped) //点击物品背包弹出的tips
|
||
{
|
||
_ContainerPack = GameItemContainer.Type.TYPE_BACKPACK;
|
||
//装备按钮 显示
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3874}"));
|
||
|
||
//售出按钮 显示
|
||
int cansell = TableManager.GetCommonItemByID(equip.DataID, 0).CanSell;
|
||
if (equip.CanSell())
|
||
{
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3877}"));
|
||
}
|
||
if (!equip.BindFlag)
|
||
{
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3580}")); //绑定
|
||
}
|
||
|
||
var sellTab = TableManager.GetUserShopItemByID(equip.DataID);
|
||
if (sellTab != null && !equip.BindFlag)
|
||
{
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{4578}")); //出售
|
||
}
|
||
//失魂
|
||
if (equip.IsShihun())
|
||
{
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{5318}"));
|
||
}
|
||
//修理
|
||
if (equip.Durable != equip.GetEquipMaxDurable())
|
||
{
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{5317}"));
|
||
}
|
||
|
||
if (CompareEquip != null && CompareEquip.IsValid())
|
||
{
|
||
OpenCompare(slotindex, null);
|
||
_ShowingEquipRect.anchoredPosition = new Vector2(_PosRight, 0);
|
||
_CompareEquipRect.anchoredPosition = new Vector2(_PosLeft, 0);
|
||
}
|
||
else
|
||
{
|
||
_ShowingEquipRect.anchoredPosition = new Vector2(0, 0);
|
||
_ShowingEquipInfo.SetEquipBaseCombat(0);
|
||
}
|
||
}
|
||
|
||
else if (type == ItemTooltipsLogic.ShowType.ShopBuy)
|
||
{
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3857}"));
|
||
|
||
////隐藏战斗力箭头
|
||
//m_EquipPowerArrowUpSprite.gameObject.SetActive(false);
|
||
//m_EquipPowerArrowDownSprite.gameObject.SetActive(false);
|
||
}
|
||
else if (type == ItemTooltipsLogic.ShowType.ShopBuyBatch)
|
||
{
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3857}"));
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3858}"));
|
||
|
||
////隐藏战斗力箭头
|
||
//m_EquipPowerArrowUpSprite.gameObject.SetActive(false);
|
||
//m_EquipPowerArrowDownSprite.gameObject.SetActive(false);
|
||
}
|
||
else if (type == ItemTooltipsLogic.ShowType.BuyBack)
|
||
{
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{1086}"));
|
||
}
|
||
else if (type == ItemTooltipsLogic.ShowType.Info) //仅显示信息 没有操作按钮的tips
|
||
{
|
||
_PopMenu.gameObject.SetActive(false);
|
||
////隐藏战斗力箭头
|
||
//m_EquipPowerArrowUpSprite.gameObject.SetActive(false);
|
||
//m_EquipPowerArrowDownSprite.gameObject.SetActive(false);
|
||
}
|
||
else if (type == ItemTooltipsLogic.ShowType.Compare) //仅显示信息 没有操作按钮的tips 同时做对比
|
||
{
|
||
if (CompareEquip != null && CompareEquip.IsValid())
|
||
{
|
||
OpenCompare(slotindex, null);
|
||
_ShowingEquipRect.anchoredPosition = new Vector2(_PosRight, 0);
|
||
_CompareEquipRect.anchoredPosition = new Vector2(_PosLeft, 0);
|
||
}
|
||
else
|
||
{
|
||
_ShowingEquipRect.anchoredPosition = new Vector2(0, 0);
|
||
_ShowingEquipInfo.SetEquipBaseCombat(0);
|
||
}
|
||
}
|
||
else if (type == ItemTooltipsLogic.ShowType.ChatLink) //仅显示信息 没有操作按钮的tips
|
||
{
|
||
////隐藏战斗力箭头
|
||
//m_EquipPowerArrowUpSprite.gameObject.SetActive(false);
|
||
//m_EquipPowerArrowDownSprite.gameObject.SetActive(false);
|
||
//根据是否可以上架 决定是否显示求购按钮
|
||
//if (ConsignSaleBag.isCanConsignSale(m_Equip, true))
|
||
//{
|
||
// _PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3882}"));
|
||
//}
|
||
}
|
||
else if (type == ItemTooltipsLogic.ShowType.CangKu) //仓库界面 仓库物品tips
|
||
{
|
||
////隐藏战斗力箭头
|
||
//m_EquipPowerArrowUpSprite.gameObject.SetActive(false);
|
||
//m_EquipPowerArrowDownSprite.gameObject.SetActive(false);
|
||
|
||
//显示取回按钮
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3883}"));
|
||
}
|
||
else if (type == ItemTooltipsLogic.ShowType.CangKuBackPack) //仓库界面 背包物品tips
|
||
{
|
||
////隐藏战斗力箭头
|
||
//m_EquipPowerArrowUpSprite.gameObject.SetActive(false);
|
||
//m_EquipPowerArrowDownSprite.gameObject.SetActive(false);
|
||
|
||
//显示放入仓库按钮
|
||
_PopMenu.PushMenu(StrDictionary.GetClientDictionaryString("#{3875}"));
|
||
}
|
||
|
||
if (_PopMenu.SubBtns.Count > 0)
|
||
{
|
||
_MenuContainer.SetActive(true);
|
||
}
|
||
else
|
||
{
|
||
_MenuContainer.SetActive(false);
|
||
}
|
||
|
||
StartCoroutine(ShowEquip());
|
||
}
|
||
|
||
void HideAllButtons()
|
||
{
|
||
_PopMenu.Clear();
|
||
}
|
||
|
||
public void CloseWindow()
|
||
{
|
||
UIManager.CloseUI(UIInfo.EquipTooltipsRoot);
|
||
}
|
||
|
||
void OpenCompare(int nEquipSlot,GameItem gameItem)
|
||
{
|
||
GameItem equip = GameManager.gameManager.PlayerDataPool.EquipPack.GetItem(nEquipSlot);
|
||
if (equip != null && equip.IsValid())
|
||
{
|
||
_CompareEquipInfo.gameObject.SetActive(true);
|
||
_CompareEquipInfo.SetEquipInfo(equip, null);
|
||
|
||
if (equip.BaseCombat > m_curItem.BaseCombat)
|
||
{
|
||
_ShowingEquipInfo.SetEquipBaseCombat(-1);
|
||
}
|
||
else if (equip.BaseCombat < m_curItem.BaseCombat)
|
||
{
|
||
_ShowingEquipInfo.SetEquipBaseCombat(1);
|
||
}
|
||
else
|
||
{
|
||
_ShowingEquipInfo.SetEquipBaseCombat(0);
|
||
}
|
||
|
||
_CompareEquipInfo.SetEquipBaseCombat(0);
|
||
_RootTransform.anchoredPosition = Vector3.zero;
|
||
}
|
||
else
|
||
{
|
||
_ShowingEquipInfo.SetEquipBaseCombat(0);
|
||
}
|
||
//m_TooltipsGrid.gameObject.transform.localPosition = new Vector3(-175, 0, 0);
|
||
//m_TooltipsGrid.repositionNow = true;
|
||
}
|
||
|
||
void CloseCompare()
|
||
{
|
||
_CompareEquipInfo.gameObject.SetActive(false);
|
||
//m_TooltipsGrid.repositionNow = true;
|
||
//m_EquipTooltips.transform.localPosition = new Vector3(0, 0, 0);
|
||
//m_TooltipsGrid.gameObject.transform.localPosition = new Vector3(0, 0, 0);
|
||
}
|
||
|
||
public void OnBtnPopMenu(object menuObj)
|
||
{
|
||
string menuStr = menuObj as string;
|
||
|
||
if (menuStr == StrDictionary.GetClientDictionaryString("#{3857}"))
|
||
{
|
||
// 购买
|
||
OnBuyClick();
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{3858}"))
|
||
{
|
||
// 批量购买
|
||
OnBuyBatchClick();
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{3882}"))
|
||
{
|
||
// 求购
|
||
ConsignSaleBuyBt();
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{3875}"))
|
||
{
|
||
// 放入
|
||
CangKuIn();
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{3883}"))
|
||
{
|
||
// 取出
|
||
CangKuOut();
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{3874}"))
|
||
{
|
||
// 装备
|
||
EquipUse();
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{3877}"))
|
||
{
|
||
// 回收
|
||
EquipSell();
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{3876}"))
|
||
{
|
||
// 卸下
|
||
EquipTakeOff();
|
||
}
|
||
//else if (menuStr == StrDictionary.GetClientDictionaryString("#{3885}"))
|
||
//{
|
||
// ItemThrow();
|
||
//}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{5422}"))
|
||
{
|
||
// 强化
|
||
EnhanceOnClick(1);
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{5423}"))
|
||
{
|
||
// 洗炼
|
||
EnhanceOnClick(0);
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{5424}"))
|
||
{
|
||
// 镶嵌
|
||
EnhanceOnClick(2);
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{5425}"))
|
||
{
|
||
// 狂化
|
||
EnhanceOnClick(3);
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{3880}"))
|
||
{
|
||
// 分享
|
||
EquipShareLink();
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{1086}"))
|
||
{
|
||
// 回购
|
||
ItemBuyBack();
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{5317}"))
|
||
{
|
||
// 修理
|
||
OnEquipRefit();
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{5318}"))
|
||
{
|
||
// 失魂
|
||
OnEquipShihun();
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{3580}"))
|
||
{
|
||
// 绑定
|
||
BindItem();
|
||
}
|
||
else if (menuStr == StrDictionary.GetClientDictionaryString("#{4578}"))
|
||
{
|
||
// 出售
|
||
ItemMarket();
|
||
}
|
||
}
|
||
|
||
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_Equip.Guid;
|
||
buyPacket.SendPacket();
|
||
}
|
||
|
||
void BindItemCancel()
|
||
{
|
||
|
||
}
|
||
|
||
void ItemMarket()
|
||
{
|
||
UIManager.ShowUI(UIInfo.MarketRoot, (sucess, param) =>
|
||
{
|
||
MarketLogic.Instance()._TagPanel.ShowPage(1);
|
||
MarketLogic.Instance()._MarketPlayerLogic._TagPanel.ShowPage(1);
|
||
});
|
||
CloseWindow();
|
||
}
|
||
|
||
public void EquipSell()
|
||
{
|
||
if (m_Equip != null && m_Equip.IsValid())
|
||
{
|
||
SysShopController.m_TipSelDataID = m_Equip.DataID;
|
||
if (m_Equip.IsEquipMent() && m_Equip.StrengthLevel > 0 || m_Equip.IsEquipGem())
|
||
{
|
||
if(m_Equip.IsEquipGem())
|
||
{
|
||
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{5400}",
|
||
m_Equip.GetEquipName(false, StrDictionary.GetClientDictionaryString("#{6755}"))), "", EquipSellOK, null, GlobeVar.INVALID_ID, MessageBoxLogic.PASSWORD.INVALID);
|
||
}
|
||
else
|
||
{
|
||
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{5400}", m_Equip.GetEquipName()), "", EquipSellOK, null, GlobeVar.INVALID_ID, MessageBoxLogic.PASSWORD.INVALID);
|
||
}
|
||
}
|
||
else if (m_Equip.GetQuality() > ItemQuality.QUALITY_BLUE)
|
||
{
|
||
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{4668}"), "", EquipSellOK, null, GlobeVar.INVALID_ID, MessageBoxLogic.PASSWORD.INVALID);
|
||
}
|
||
else
|
||
{
|
||
EquipSellOK();
|
||
}
|
||
}
|
||
|
||
CloseWindow();
|
||
}
|
||
|
||
void EquipSellOK()
|
||
{
|
||
if (m_Equip != null && m_Equip.IsValid())
|
||
{
|
||
List<GameItem> selllist = new List<GameItem>();
|
||
selllist.Add(m_Equip);
|
||
SysShopController.SellItem((int)GameItemContainer.Type.TYPE_BACKPACK, selllist);
|
||
CloseWindow();
|
||
}
|
||
}
|
||
|
||
void EquipUse()
|
||
{
|
||
if (m_Equip != null && m_Equip.IsValid())
|
||
{
|
||
int nPlayerLevel = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level;
|
||
if (nPlayerLevel < m_Equip.EquipUseLevel)
|
||
{
|
||
GUIData.AddNotifyData("#{1255}");
|
||
//Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{1255}");
|
||
return;
|
||
}
|
||
|
||
int equipProfession = m_Equip.GetProfessionRequire();
|
||
if (equipProfession > 0)
|
||
{
|
||
int nPlayerProfession = Singleton<ObjManager>.Instance.MainPlayer.Profession;
|
||
if (((equipProfession >> nPlayerProfession) & 1) == 0)
|
||
{
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{1256}");
|
||
return;
|
||
}
|
||
}
|
||
|
||
if (m_Equip.BindFlag == false && m_Equip.GetBindType() != 0)
|
||
{
|
||
MessageBoxLogic.OpenOKCancelBox(3028, 1000, EquipUseOK, null);
|
||
}
|
||
else
|
||
{
|
||
EquipUseOK();
|
||
}
|
||
}
|
||
}
|
||
|
||
void EquipUseOK()
|
||
{
|
||
if (Singleton<ObjManager>.Instance.MainPlayer.CheckEquipItem(m_Equip))
|
||
{
|
||
GameManager.gameManager.SoundManager.PlaySoundEffect(144);
|
||
Singleton<ObjManager>.Instance.MainPlayer.EquipItem(m_Equip);
|
||
}
|
||
|
||
CloseWindow();
|
||
}
|
||
|
||
void EquipTakeOff()
|
||
{
|
||
if (m_Equip != null && m_Equip.IsValid())
|
||
{
|
||
if (Singleton<ObjManager>.Instance.MainPlayer.CheckUnEquipItem(m_Equip))
|
||
{
|
||
Singleton<ObjManager>.Instance.MainPlayer.UnEquipItem(m_Equip);
|
||
}
|
||
CloseWindow();
|
||
}
|
||
}
|
||
|
||
void EquipShareLink()
|
||
{
|
||
//if (m_Equip != null && m_Equip.IsValid())
|
||
//{
|
||
// ShareTargetChooseLogic.InitEquipShare(m_Equip);
|
||
//}
|
||
//ShareLinkDirectChatInfo();
|
||
}
|
||
|
||
void PutInQianKunDai()
|
||
{
|
||
//if (m_Equip != null && m_Equip.IsValid())
|
||
//{
|
||
// if (QianKunDaiLogic.Instance() != null && QianKunDaiLogic.Instance().gameObject.activeSelf)
|
||
// {
|
||
// //QianKunDaiLogic.Instance().ChooseStuff(m_Equip, m_curItemSlot);
|
||
// }
|
||
// CloseWindow();
|
||
//}
|
||
}
|
||
|
||
void EquipEnchance()
|
||
{
|
||
if (m_Equip != null && m_Equip.IsValid())
|
||
{
|
||
bool bRet = GameManager.gameManager.PlayerDataPool.CommonData.GetCommondFlag((int)USER_COMMONFLAG.CF_STRENGTHENFUNCTION_OPENFLAG);
|
||
if (bRet == false)
|
||
{
|
||
Singleton<ObjManager>.Instance.MainPlayer.SendNoticMsg(false, "#{2182}");
|
||
return;
|
||
}
|
||
if (_CompareEquipInfo.gameObject.activeSelf == true)
|
||
{
|
||
CloseCompare();
|
||
}
|
||
UIManager.CloseUI(UIInfo.EquipTooltipsRoot);
|
||
//UIManager.ShowUI(UIInfo.EquipStren, OnShowEquipEnchance);
|
||
}
|
||
}
|
||
|
||
void OnShowEquipEnchance(bool bSuccess, object param)
|
||
{
|
||
if (m_Equip != null && m_Equip.IsValid())
|
||
{
|
||
//if (EquipStrengthenLogic.Instance() != null)
|
||
//{
|
||
// //设置勾选当前装备
|
||
// EquipStrengthenLogic.Instance().SetCurSelectEquip(m_Equip);
|
||
// EquipStrengthenLogic.Instance().UpdateTab();
|
||
//}
|
||
}
|
||
}
|
||
|
||
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 ConsignSaleBuyBt()
|
||
{
|
||
//UIManager.ShowUI(UIInfo.ConsignSaleRoot, BuyItemOpenConsignSale);
|
||
}
|
||
|
||
void BuyItemOpenConsignSale(bool bSuccess, object param)
|
||
{
|
||
if (bSuccess)
|
||
{
|
||
//if (ConsignSaleLogic.Instance() != null && m_Equip != null && m_Equip.IsValid() != false)
|
||
//{
|
||
// ConsignSaleLogic.Instance().SearchForAskBuy(m_Equip.GetName());
|
||
//}
|
||
CloseWindow();
|
||
}
|
||
}
|
||
void ShowChatInfoRootOver(bool bSuccess, object param)
|
||
{
|
||
if (bSuccess)
|
||
{
|
||
//ChatInfoLogic.Instance().InsertEquipLinkText(m_Equip);
|
||
EquipTooltipsLogic.Instance().CloseWindow();
|
||
}
|
||
}
|
||
|
||
void CangKuIn()
|
||
{
|
||
if (m_Equip != null && m_Equip.IsValid())
|
||
{
|
||
Singleton<ObjManager>.Instance.MainPlayer.CangKuPutIn(m_Equip);
|
||
CloseWindow();
|
||
}
|
||
}
|
||
|
||
void CangKuOut()
|
||
{
|
||
if (m_Equip != null && m_Equip.IsValid())
|
||
{
|
||
Singleton<ObjManager>.Instance.MainPlayer.CangKuTakeOut(m_Equip);
|
||
CloseWindow();
|
||
}
|
||
}
|
||
|
||
void EnhanceOnClick(int page = 1)
|
||
{
|
||
//bool bRet = GameManager.gameManager.PlayerDataPool.CommonData.GetCommondFlag((int)USER_COMMONFLAG.CF_STRENGTHENFUNCTION_OPENFLAG);
|
||
//if (bRet == false)
|
||
//{
|
||
// Singleton<ObjManager>.Instance.MainPlayer.SendNoticMsg(false, "#{2182}");
|
||
// return;
|
||
//}
|
||
|
||
//没有统一接口,现在只在单独打开功能UI的地方判断当前功能是否开启
|
||
if(!IsMakeFuncOpen())
|
||
{
|
||
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{62935}")); //功能未开启
|
||
CloseWindow();
|
||
return;
|
||
}
|
||
EquipEnhanceRoot.ShowEnhanceRoot(m_Equip, page);
|
||
//UIManager.ShowUI(UIInfo.EquipEnhance);
|
||
CloseWindow();
|
||
}
|
||
|
||
private const int _MakeFuncTabId = 1;
|
||
private bool IsMakeFuncOpen()
|
||
{
|
||
var functionOpenTab = TableManager.GetFunctionOpenByID(_MakeFuncTabId, 0);
|
||
if (functionOpenTab == null)
|
||
{
|
||
return false;
|
||
}
|
||
var _OpenGuide = functionOpenTab.ShowGUIDId;
|
||
var _OpenLevel = functionOpenTab.OpenLevel;
|
||
|
||
if (_OpenGuide > 0)
|
||
{
|
||
if (_OpenGuide > Guide.Instance._FinishGuideID)
|
||
{
|
||
return false;
|
||
}
|
||
}
|
||
else if (_OpenLevel > 0)
|
||
{
|
||
if (GameManager.gameManager.PlayerDataPool.FunctionOpenState.ContainsKey(_MakeFuncTabId)
|
||
&& GameManager.gameManager.PlayerDataPool.FunctionOpenState[_MakeFuncTabId])
|
||
{
|
||
return true;
|
||
}
|
||
else
|
||
{
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
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_Equip.Guid);
|
||
buyBackPacket.SendPacket();
|
||
CloseWindow();
|
||
}
|
||
|
||
private int _DecomConsume = 0;
|
||
void OnDisassembly()
|
||
{
|
||
_DecomConsume = 0;
|
||
if (m_Equip.StrengthLevel > 0)
|
||
{
|
||
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{5336}"));
|
||
return;
|
||
}
|
||
|
||
if(m_Equip.IsEquipGem())
|
||
{
|
||
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{5420}"));
|
||
return;
|
||
}
|
||
|
||
// 返还物品先进行统计,避免一个物品显示两次 Dic<ID, Cout>
|
||
Dictionary<int, int> returnItems = new Dictionary<int, int>();
|
||
|
||
// 基础分解的返还
|
||
var equipDecomposizions = TableManager.GetEquipDecomposition().Values;
|
||
Tab_EquipDecomposition equipDecomTab = null;
|
||
foreach(var equipDecomposition in equipDecomposizions)
|
||
{
|
||
if (equipDecomposition.EquipType == 1&&
|
||
equipDecomposition.EquipLevel >= m_Equip.GetEquipLevel()
|
||
&& equipDecomposition.Quality == (int)m_Equip.GetQuality())
|
||
{
|
||
equipDecomTab = equipDecomposition;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (equipDecomTab != null)
|
||
{
|
||
_DecomConsume = equipDecomTab.ConsumeNum;
|
||
}
|
||
|
||
if (equipDecomTab != null && equipDecomTab.ItemNum > 0)
|
||
{
|
||
|
||
if(returnItems.ContainsKey(equipDecomTab.ItemID))
|
||
{
|
||
returnItems[equipDecomTab.ItemID] += equipDecomTab.ItemNum;
|
||
}
|
||
else
|
||
{
|
||
returnItems[equipDecomTab.ItemID] = equipDecomTab.ItemNum;
|
||
}
|
||
}
|
||
|
||
// 洗练返还
|
||
if (m_Equip.XilianPoint > 0)
|
||
{
|
||
string getBackItemStr2 = "";
|
||
var equipXilianTabs = TableManager.GetEquipPropBarBaptizeConsume().Values;
|
||
foreach (var consumeTab in equipXilianTabs)
|
||
{
|
||
if (consumeTab.MaxLevel >= m_Equip.GetEquipLevel() && consumeTab.Quality == (int)m_Equip.GetQuality())
|
||
{
|
||
if(returnItems.ContainsKey(consumeTab.ConsumeSubType))
|
||
{
|
||
returnItems[consumeTab.ConsumeSubType] += (int)(m_Equip.XilianPoint * consumeTab.ConsumeNum * 0.8f);
|
||
}
|
||
else
|
||
{
|
||
returnItems[consumeTab.ConsumeSubType] = (int)(m_Equip.XilianPoint * consumeTab.ConsumeNum * 0.8f);
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 打孔返还
|
||
//var equipQuality = m_Equip.GetQuality();
|
||
//int gemPos = m_Equip.GetOpenedGemPos();
|
||
//if (gemPos > 0)
|
||
//{
|
||
// var punchTabs = TableManager.GetEquipPunchConsume().Values;
|
||
// Tab_EquipPunchConsume equipPunchConsume = null;
|
||
// foreach (var punchTab in punchTabs)
|
||
// {
|
||
// if (punchTab.MaxLevel >= m_Equip.GetEquipLevel())
|
||
// {
|
||
// equipPunchConsume = punchTab;
|
||
// break;
|
||
// }
|
||
// }
|
||
// int getBackCnt = 0;
|
||
// if (equipPunchConsume != null)
|
||
// {
|
||
// for (int i = 0; i < gemPos; ++i)
|
||
// {
|
||
// getBackCnt += (int)equipPunchConsume.GetReturnNumbyIndex(i);
|
||
// }
|
||
|
||
// if (getBackCnt > 0)
|
||
// {
|
||
// if(returnItems.ContainsKey(equipPunchConsume.ConsumeSubType))
|
||
// {
|
||
// returnItems[equipPunchConsume.ConsumeSubType] += getBackCnt;
|
||
// }
|
||
// else
|
||
// {
|
||
// returnItems[equipPunchConsume.ConsumeSubType] = getBackCnt;
|
||
// }
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
// 狂化返还
|
||
if(m_Equip.IsFrenzy)
|
||
{
|
||
Tab_CommonItem itemTab = TableManager.GetCommonItemByID(m_Equip.DataID, 0);
|
||
var fenzyTabs = TableManager.GetEquipFrenzy().Values;
|
||
foreach (var kv in fenzyTabs)
|
||
{
|
||
if ((int)m_Equip.GetQuality() == kv.Quality
|
||
&& itemTab.MinLevelRequire >= kv.EquipLevelMin
|
||
&& itemTab.MinLevelRequire <= kv.EquipLevelMax)
|
||
{
|
||
if (returnItems.ContainsKey(kv.ReturnSubType))
|
||
{
|
||
returnItems[kv.ReturnSubType] += kv.ReturnNum;
|
||
}
|
||
else
|
||
{
|
||
returnItems[kv.ReturnSubType] = kv.ReturnNum;
|
||
}
|
||
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
string resultStr = "";
|
||
foreach(var kv in returnItems)
|
||
{
|
||
Tab_CommonItem tab = TableManager.GetCommonItemByID(kv.Key, 0);
|
||
if(tab != null)
|
||
{
|
||
if (string.IsNullOrEmpty(resultStr))
|
||
{
|
||
resultStr = Utils.GetItemQualityColor(tab.Quality) + tab.Name + "×" + kv.Value + "</color>";
|
||
}
|
||
else
|
||
{
|
||
resultStr += "," + Utils.GetItemQualityColor(tab.Quality) + tab.Name + "×" + kv.Value + "</color>";
|
||
}
|
||
}
|
||
}
|
||
|
||
string tips = StrDictionary.GetClientDictionaryString("#{5337}", m_Equip.GetEquipName(), _DecomConsume, resultStr);
|
||
MessageBoxLogic.OpenOKCancelBox(tips, null, OnDisassemblyOK);
|
||
}
|
||
|
||
void OnDisassemblyOK()
|
||
{
|
||
long money = GameManager.gameManager.PlayerDataPool.Money.GetMoney_Coin() + GameManager.gameManager.PlayerDataPool.Money.GetMoney_CoinBind();
|
||
if (money < _DecomConsume)
|
||
{
|
||
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{6004}") + StrDictionary.GetClientDictionaryString("#{6000}"));
|
||
return;
|
||
}
|
||
|
||
CG_DECOMPOSITION_EQUIP packet = (CG_DECOMPOSITION_EQUIP)PacketDistributed.CreatePacket(MessageID.PACKET_CG_DECOMPOSITION_EQUIP);
|
||
packet.AddEquipguid(m_Equip.Guid);
|
||
|
||
packet.SendPacket();
|
||
CloseWindow();
|
||
}
|
||
|
||
void OnEquipRefit()
|
||
{
|
||
if (m_Equip != null)
|
||
{
|
||
foreach (var attr in m_Equip.ExAttrs)
|
||
{
|
||
if (attr.XilianTab.PropID == (int)PropID.PropertyID.EQUIP_XILIAN_NOREFIT)
|
||
{
|
||
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{5375}"));
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
m_Equip.EquipRefit((int)_ContainerPack);
|
||
CloseWindow();
|
||
}
|
||
|
||
private int _ShihunCost = 0;
|
||
void OnEquipShihun()
|
||
{
|
||
|
||
var timeSpan = TimeSpan.FromTicks((long)(m_Equip.ShihunTime - GlobalData.ServerAnsiTime) * 10000000L);
|
||
_ShihunCost = (m_Equip.GetEquipMaxDurable() * (int)m_Equip.GetQuality() * (int)(timeSpan.TotalHours + 1));
|
||
string tips = StrDictionary.GetClientDictionaryString("#{5369}", m_Equip.GetEquipName(), _ShihunCost);
|
||
MessageBoxLogic.OpenOKCancelBox(tips, null, OnEquipShihunOK);
|
||
//CloseWindow();
|
||
}
|
||
|
||
void OnEquipShihunOK()
|
||
{
|
||
if (JudgeMoneyLogic.IsMoneyEnough(MONEYTYPE.MONEYTYPE_COIN, _ShihunCost))
|
||
{
|
||
CG_REQ_EQUIP_FIX_INVALID_STATE packet = (CG_REQ_EQUIP_FIX_INVALID_STATE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_EQUIP_FIX_INVALID_STATE);
|
||
packet.Packettype = (int)_ContainerPack;
|
||
packet.Equipguid = m_Equip.Guid;
|
||
|
||
packet.SendPacket();
|
||
CloseWindow();
|
||
}
|
||
}
|
||
} |