166 lines
5.4 KiB
C#
166 lines
5.4 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Games.Item;
|
|
using GCGame.Table;
|
|
using Module.Log;
|
|
using GCGame;
|
|
|
|
public class EquipGemLvUpQualityPanel : UIControllerBase<EquipGemLvUpQualityPanel>
|
|
{
|
|
void OnEnable()
|
|
{
|
|
SetInstance(this);
|
|
|
|
if (EquipGemLvUpRoot.Instance().SelectGem != null)
|
|
{
|
|
OnGemSelect();
|
|
}
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
SetInstance(null);
|
|
}
|
|
|
|
public void UpdateEquip()
|
|
{
|
|
_DestLevel = 0;
|
|
|
|
_MaterialSlot.UpdateNum();
|
|
}
|
|
|
|
#region gem
|
|
|
|
public Text _CurName;
|
|
public Text _CurDesc;
|
|
public UIImgText _CurCombat;
|
|
public Text _DestName;
|
|
public Text _DestDesc;
|
|
public UIImgText _DestCombat;
|
|
public Text _DestNeedLevel;
|
|
public CommonItemMaterialSlot _MaterialSlot;
|
|
public GameObject _DestSelectPanel;
|
|
public UIContainerSelect _DestContainer;
|
|
public GameObject _CurLevelPanel;
|
|
public Vector3 _LvUpPos;
|
|
public Vector3 _LvMaxPos;
|
|
public GameObject _DescLevelPanel;
|
|
public GameObject _MaxLevelPanel;
|
|
|
|
private Tab_GemLvlUpConsume _CurLvConsume;
|
|
private int _DestLevel = 0;
|
|
|
|
public void OnGemSelect()
|
|
{
|
|
|
|
var tabGem = TableManager.GetCommonItemByID(EquipGemLvUpRoot.Instance().SelectGem.DataID, 0);
|
|
|
|
string gemName = tabGem.Name;
|
|
//string levelStr = StrDictionary.GetClientDictionaryString("#{1166}", EquipGemLvUpRoot.Instance().SelectGem.Level);
|
|
_CurName.text = Utils.GetItemQualityColor(EquipGemLvUpRoot.Instance().SelectGem.GetQuality()) + gemName + "</color>";
|
|
|
|
int equipPos = EquipGemLvUpRoot.Instance().SelectEquip.GetEquipSlotIndex();
|
|
var propTab = EquipGemLvUpRoot.Instance().SelectGem.GetGemPropTab(equipPos);
|
|
string attrProStr = GemData.GetPropStr(propTab);
|
|
|
|
_CurDesc.text = attrProStr;
|
|
_CurCombat.text = StrDictionary.GetClientDictionaryString("#{2829}", propTab.CombatValue);
|
|
|
|
_CurLvConsume = EquipGemLvUpRoot.Instance().SelectGem.GetGemLvUpConsumeTab();
|
|
var tabGemLvUps = TableManager.GetGemLvlUpConsume().Values;
|
|
|
|
if (_CurLvConsume.NextQuality > 0)
|
|
{
|
|
SetDestGemInfo(_CurLvConsume.NextQuality);
|
|
_CurLevelPanel.transform.localPosition = _LvUpPos;
|
|
}
|
|
else
|
|
{
|
|
SetDestGemInfo(-1);
|
|
_CurLevelPanel.transform.localPosition = _LvMaxPos;
|
|
}
|
|
|
|
}
|
|
|
|
private void SetDestGemInfo(int nextGemDataID)
|
|
{
|
|
if (nextGemDataID <= 0)
|
|
{
|
|
_DescLevelPanel.gameObject.SetActive(false);
|
|
_MaxLevelPanel.gameObject.SetActive(true);
|
|
return;
|
|
}
|
|
_DescLevelPanel.gameObject.SetActive(true);
|
|
_MaxLevelPanel.gameObject.SetActive(false);
|
|
|
|
var tabDestGem = TableManager.GetCommonItemByID(nextGemDataID, 0);
|
|
|
|
int equipPos = EquipGemLvUpRoot.Instance().SelectEquip.GetEquipSlotIndex();
|
|
var propTab = TableManager.GetGemPropByID(nextGemDataID);
|
|
string attrProStr = "";
|
|
for (int i = 0; i < propTab.getPropIDCount(); ++i)
|
|
{
|
|
if (propTab.GetPropIDbyIndex(i) < 0)
|
|
continue;
|
|
|
|
if (!string.IsNullOrEmpty(attrProStr))
|
|
{
|
|
attrProStr += "\n";
|
|
}
|
|
attrProStr += PropID.GetAttrValue((PropID.PropertyID)propTab.GetPropIDbyIndex(i), propTab.GetPropSubIDbyIndex(i), propTab.GetPropValuebyIndex(i));
|
|
}
|
|
|
|
string gemName = tabDestGem.Name;
|
|
_DestName.text = Utils.GetItemQualityColor(EquipGemLvUpRoot.Instance().SelectGem.GetQuality()) + gemName + "</color>";
|
|
_DestDesc.text = attrProStr;
|
|
_DestCombat.text = StrDictionary.GetClientDictionaryString("#{2829}", propTab.CombatValue);
|
|
|
|
var levelLimitTab = TableManager.GetGemInlayLvlLimitByID(propTab.GemLevel, 0);
|
|
_DestLevel = levelLimitTab.MinLvl;
|
|
if (_DestLevel > GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level)
|
|
{
|
|
_DestNeedLevel.text = StrDictionary.GetClientDictionaryString("#{5530}") + StrDictionary.GetClientDictionaryString("#{1166}", _DestLevel) + "</color>";
|
|
}
|
|
else
|
|
{
|
|
_DestNeedLevel.text = StrDictionary.GetClientDictionaryString("#{1166}", _DestLevel);
|
|
}
|
|
|
|
_MaterialSlot.InitMaterial(_CurLvConsume.QualityConsumeSubType, _CurLvConsume.QualityConsumeNum);
|
|
_MaterialSlot.UpdateNum();
|
|
}
|
|
|
|
public void OnBtnLevelUp()
|
|
{
|
|
//TestGem();
|
|
if (_DestLevel > GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level)
|
|
{
|
|
GUIData.AddNotifyData("#{5327}");
|
|
return;
|
|
}
|
|
if (_MaterialSlot.IsMaterialEnough())
|
|
{
|
|
CG_GEM_CLASS_UP packet = (CG_GEM_CLASS_UP)PacketDistributed.CreatePacket(MessageID.PACKET_CG_GEM_CLASS_UP);
|
|
if (EquipGemLvUpRoot.Instance().SelectEquip.IsPlayerEquiped())
|
|
{
|
|
packet.Packtype = (int)GameItemContainer.Type.TYPE_EQUIPPACK;
|
|
}
|
|
else
|
|
{
|
|
packet.Packtype = (int)GameItemContainer.Type.TYPE_BACKPACK;
|
|
}
|
|
packet.Equipguid = EquipGemLvUpRoot.Instance().SelectEquip.Guid;
|
|
packet.Gemdataid = EquipGemLvUpRoot.Instance().SelectGem.DataID;
|
|
packet.SendPacket();
|
|
}
|
|
else
|
|
{
|
|
_MaterialSlot.ShowGetPath();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|