using System.Collections;
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
namespace Snxxz.UI
|
{
|
public class TreasureSoulPattern4 : TreasureSoulPattern
|
{
|
[SerializeField] RectTransform m_ContainerNone;
|
[SerializeField] RectTransform m_ContainerHas;
|
[SerializeField] List<PropertyBehaviour> properties;
|
|
PlayerSuitModel suitModel { get { return ModelCenter.Instance.GetModel<PlayerSuitModel>(); } }
|
PlayerPackModel pack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
|
public PlayerStrengthengDatas strengthengmodel
|
{
|
get
|
{
|
return ModelCenter.Instance.GetModel<PlayerStrengthengDatas>();
|
}
|
}
|
public override void Display(int _id)
|
{
|
base.Display(_id);
|
Display();
|
}
|
|
public override void Dispose()
|
{
|
base.Dispose();
|
}
|
|
protected override void TreasurePrivilegeUpdateEvent(int _id)
|
{
|
base.TreasurePrivilegeUpdateEvent(_id);
|
if (_id == (int)special.type)
|
{
|
Display();
|
}
|
}
|
|
private void Display()
|
{
|
for (int i = 0; i < properties.Count; i++)
|
{
|
properties[i].gameObject.SetActive(false);
|
}
|
switch (special.type)
|
{
|
case TreasurePrivilege.Property:
|
m_ContainerHas.gameObject.SetActive(true);
|
m_ContainerNone.gameObject.SetActive(false);
|
var _index = 0;
|
foreach (var _key in special.propertyDict.Keys)
|
{
|
var _value = special.propertyDict[_key];
|
properties[_index].gameObject.SetActive(true);
|
properties[_index].DisplayUpper(_key, _value);
|
_index++;
|
}
|
break;
|
case TreasurePrivilege.Suit:
|
var percentSuit = (float)special.propertyDict[87] / 10000;
|
var dict = suitModel.GetActiveSuitAttr();
|
var _suitIndex = 0;
|
foreach (var _key in dict.Keys)
|
{
|
var propertyConfig = PlayerPropertyConfig.Get(_key);
|
if (propertyConfig == null || propertyConfig.type != 1)
|
{
|
continue;
|
}
|
properties[_suitIndex].gameObject.SetActive(true);
|
properties[_suitIndex].DisplayUpper(_key, (int)(percentSuit * dict[_key]));
|
_suitIndex++;
|
}
|
m_ContainerHas.gameObject.SetActive(_suitIndex > 0);
|
m_ContainerNone.gameObject.SetActive(_suitIndex == 0);
|
break;
|
case TreasurePrivilege.Wing:
|
var percentWing = (float)special.propertyDict[86] / 10000;
|
var itemModel = pack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retWing);
|
m_ContainerHas.gameObject.SetActive(itemModel != null);
|
m_ContainerNone.gameObject.SetActive(itemModel == null);
|
if (itemModel != null)
|
{
|
var itemConfig = ItemConfig.Get(itemModel.itemId);
|
float value = 0;
|
if (ContainsProperty(itemConfig, 6, out value))
|
{
|
if (itemModel.GetUseDataModel(42) != null)
|
{
|
value += strengthengmodel.BackpackWings(itemModel.itemId, itemModel.GetUseDataModel(42)[0])[1];
|
}
|
}
|
properties[0].gameObject.SetActive(true);
|
properties[0].DisplayUpper(6, (int)(value * percentWing));
|
}
|
break;
|
}
|
}
|
|
public bool ContainsProperty(ItemConfig config, int _property,out float value)
|
{
|
value = 0;
|
if (config.Effect1== _property&& config.EffectValueA1 > 0)
|
{
|
value = config.EffectValueA1;
|
return true;
|
}
|
if (config.Effect2 == _property && config.EffectValueA2 > 0)
|
{
|
value = config.EffectValueA2;
|
return true;
|
}
|
if (config.Effect3 == _property && config.EffectValueA3 > 0)
|
{
|
value = config.EffectValueA3;
|
return true;
|
}
|
if (config.Effect4 == _property && config.EffectValueA4 > 0)
|
{
|
value = config.EffectValueA4;
|
return true;
|
}
|
if (config.Effect5 == _property && config.EffectValueA5 > 0)
|
{
|
value = config.EffectValueA5;
|
return true;
|
}
|
return false;
|
}
|
}
|
}
|