87 lines
2.7 KiB
C#
87 lines
2.7 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using Games.Item;
|
|
using GCGame.Table;
|
|
|
|
public class EquipGemTakeOffMsgBox : MonoBehaviour
|
|
{
|
|
public Text _DescText;
|
|
public UICurrencyItem _ConsumeMoney;
|
|
public UICurrencyItem _OwnMoney;
|
|
|
|
private GameItem _EquipItem;
|
|
private GemData _GemData;
|
|
|
|
public void SetTakeOff(GemData gemData, GameItem equipItem)
|
|
{
|
|
gameObject.SetActive(true);
|
|
_EquipItem = equipItem;
|
|
_GemData = gemData;
|
|
var gemLvupConsume = TableManager.GetGemLvlUpConsumeByID(gemData.DataID);
|
|
int getBackCnt = gemLvupConsume.GemMaterialCnt;
|
|
var commonItemTab = TableManager.GetCommonItemByID(gemData.DataID, 0);
|
|
|
|
_DescText.text = StrDictionary.GetClientDictionaryString("#{5335}", getBackCnt, gemData.GetColorName());
|
|
_ConsumeMoney.ShowCurrency(MONEYTYPE.MONEYTYPE_YUANBAO_BIND, 10);
|
|
_OwnMoney.ShowOwnCurrency(MONEYTYPE.MONEYTYPE_YUANBAO_BIND);
|
|
|
|
}
|
|
|
|
public void OnOkClick()
|
|
{
|
|
int decLevel = 0;
|
|
int equipPos = _EquipItem.GetEquipSlotIndex();
|
|
var propTab = _GemData.GetGemPropTab(equipPos);
|
|
for (int i = 0; i < propTab.getPropIDCount(); ++i)
|
|
{
|
|
if (propTab.GetPropIDbyIndex(i) == (int)PropID.PropertyID.EQUIP_XILIAN_EQUIPLEVEL)
|
|
{
|
|
decLevel += propTab.GetPropValuebyIndex(i);
|
|
}
|
|
}
|
|
|
|
var tabGemSuit = TableManager.GetGemSuitByID(_EquipItem.GemSuitID, 0);
|
|
if (tabGemSuit != null)
|
|
{
|
|
for (int i = 0; i < tabGemSuit.getPropIDCount(); ++i)
|
|
{
|
|
if (tabGemSuit.GetPropIDbyIndex(i) == (int)PropID.PropertyID.EQUIP_XILIAN_EQUIPLEVEL)
|
|
{
|
|
decLevel += tabGemSuit.GetPropValuebyIndex(i);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 是否已穿戴
|
|
bool hasEquip = GameManager.gameManager.PlayerDataPool.EquipPack.GetItemIdx(_EquipItem) != -1;
|
|
if (_EquipItem.EquipUseLevel + decLevel > GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level && hasEquip)
|
|
{
|
|
MessageBoxLogic.OpenOKCancelBox(5374, -1, OnOkClickOk);
|
|
}
|
|
else
|
|
{
|
|
OnOkClickOk();
|
|
}
|
|
}
|
|
|
|
public void OnOkClickOk()
|
|
{
|
|
if (GameManager.gameManager.PlayerDataPool.GetLongPropty((int)CONSUM_TYPE.MONEY, (int)MONEYTYPE.MONEYTYPE_YUANBAO_BIND) >= 10)
|
|
{
|
|
gameObject.SetActive(false);
|
|
EquipEnhanceXiangqian.Instance().GemTakeOffOk();
|
|
}
|
|
else
|
|
{
|
|
gameObject.SetActive(false);
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{6106}"));
|
|
}
|
|
}
|
|
|
|
public void OnCancelClick()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|