using Snxxz.UI;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
|
namespace EnhancedUI.EnhancedScroller
|
{
|
public class ViewFuncCell : ScrollerUI
|
{
|
RoleParticularModel m_Model;
|
RoleParticularModel model
|
{
|
get
|
{
|
return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<RoleParticularModel>());
|
}
|
}
|
|
TreasureModel m_TreasureModel;
|
TreasureModel treasureModel
|
{
|
get
|
{
|
return m_TreasureModel ?? (m_TreasureModel = ModelCenter.Instance.GetModel<TreasureModel>());
|
}
|
}
|
|
PetModel m_petModel;
|
PetModel petmodel
|
{
|
get
|
{
|
return m_petModel ?? (m_petModel = ModelCenter.Instance.GetModel<PetModel>());
|
}
|
}
|
|
MountModel m_HorseModel;
|
MountModel horsemodel
|
{
|
get
|
{
|
return m_HorseModel ?? (m_HorseModel = ModelCenter.Instance.GetModel<MountModel>());
|
}
|
}
|
PackModel _playerPack;
|
PackModel playerPack
|
{
|
get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); }
|
}
|
|
EquipGemModel equipGemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } }
|
|
[SerializeField] Image funcImg;
|
[SerializeField] Text targetFightPowerTxt;
|
[SerializeField] Text selfFightPowerTxt;
|
[SerializeField] Text targetCompareTxt;
|
[SerializeField] Text selfCompareTxt;
|
[SerializeField] Image targetCompareImg;
|
[SerializeField] Image selfCompareImg;
|
|
public override void Refresh(CellView cell)
|
{
|
RoleParticularModel.ViewPlayerData viewPlayerData = model.GetViewPlayerData(model.viewPlayer);
|
int key = cell.index;
|
ViewRoleFuncConfig viewRoleFuncModel = ViewRoleFuncConfig.Get(key);
|
if (viewPlayerData != null && viewRoleFuncModel != null)
|
{
|
funcImg.SetSprite(viewRoleFuncModel.Icon);
|
targetFightPowerTxt.text = StringUtility.Contact(Language.Get("RoleParticularWin_4"), UIHelper.ReplaceLargeNum(viewPlayerData.rolePlusData.GetFightPower(key)));
|
selfFightPowerTxt.text = StringUtility.Contact(Language.Get("RoleParticularWin_5"), UIHelper.ReplaceLargeNum(model.GetFuncFightPower(key)));
|
int targetValue = 0;
|
int selfValue = 0;
|
bool handled = false;
|
selfCompareImg.gameObject.SetActive(false);
|
targetCompareImg.gameObject.SetActive(false);
|
switch ((FuncPowerType)key)
|
{
|
case FuncPowerType.Equip:
|
{
|
foreach (var itemData in viewPlayerData.roleEquipDataDic.Values)
|
{
|
ItemConfig _tagChinItemModel = ItemConfig.Get(itemData.ItemID);
|
if (_tagChinItemModel != null && (_tagChinItemModel.ItemColor > viewRoleFuncModel.condition[0]
|
|| (_tagChinItemModel.ItemColor == viewRoleFuncModel.condition[0]
|
&& (viewRoleFuncModel.condition.Length < 2 || _tagChinItemModel.StarLevel >= viewRoleFuncModel.condition[1]))))
|
{
|
targetValue++;
|
}
|
}
|
var packTypeModel = playerPack.GetSinglePack(PackType.Equip);
|
if (packTypeModel == null || packTypeModel.GetAllItems() == null)
|
break;
|
foreach (var itemData in packTypeModel.GetAllItems().Values)
|
{
|
ItemConfig _tagChinItemModel = ItemConfig.Get((int)itemData.itemId);
|
if (_tagChinItemModel != null && (_tagChinItemModel.ItemColor > viewRoleFuncModel.condition[0]
|
|| (_tagChinItemModel.ItemColor == viewRoleFuncModel.condition[0]
|
&& (viewRoleFuncModel.condition.Length < 2 || _tagChinItemModel.StarLevel >= viewRoleFuncModel.condition[1]))))
|
{
|
selfValue++;
|
}
|
}
|
}
|
break;
|
case FuncPowerType.Plus:
|
{
|
targetValue = viewPlayerData.rolePlusData.GetAllEquipStarLV();
|
var packTypeModel = playerPack.GetSinglePack(PackType.Equip);
|
if (packTypeModel == null || packTypeModel.GetAllItems() == null)
|
break;
|
foreach (var itemPlace in packTypeModel.GetAllItems().Keys)
|
{
|
selfValue += 0;
|
}
|
}
|
break;
|
case FuncPowerType.Stone:
|
targetValue = GetAllStoneLv(viewPlayerData.rolePlusData.GetAllEquipStone());
|
selfValue = equipGemModel.GetAllGemsLevel();
|
break;
|
case FuncPowerType.Wing:
|
{
|
handled = true;
|
RoleParticularModel.ItemData itemData = model.GetItemData(RoleEquipType.Wing);
|
if (itemData!=null)
|
{
|
ItemConfig _tagChinItemModel = ItemConfig.Get(itemData.ItemID);
|
targetCompareTxt.text = string.Format(viewRoleFuncModel.compareTip, _tagChinItemModel.ItemName);
|
}
|
else
|
{
|
targetCompareTxt.text = string.Format(viewRoleFuncModel.compareTip, Language.Get("RoleParticularWin_7"));
|
}
|
var equipPlace = EquipPlaceMapConfig.GetServerPlace(0, (int)RoleEquipType.Wing);
|
var itemModel = playerPack.GetItemByIndex(PackType.Equip, equipPlace);
|
if (itemModel != null)
|
{
|
ItemConfig _tagChinItemModel = ItemConfig.Get((int)itemModel.itemId);
|
selfCompareTxt.text = string.Format(viewRoleFuncModel.compareTip, _tagChinItemModel.ItemName);
|
}
|
else
|
{
|
selfCompareTxt.text = string.Format(viewRoleFuncModel.compareTip, Language.Get("RoleParticularWin_7"));
|
}
|
}
|
break;
|
case FuncPowerType.Wash:
|
targetValue = viewPlayerData.rolePlusData.GetAllEquipWashLv();
|
break;
|
case FuncPowerType.Pet:
|
selfValue = petmodel._DicPetBack.Count;
|
targetValue = viewPlayerData.rolePlusData.Pet;
|
break;
|
case FuncPowerType.Horse:
|
selfValue = horsemodel._DicHorse.Count;
|
targetValue = viewPlayerData.rolePlusData.Horse;
|
break;
|
case FuncPowerType.Prestige:
|
handled = true;
|
RealmConfig _tagRealmModel = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel);
|
if (_tagRealmModel != null && _tagRealmModel.Lv != 0)
|
{
|
selfCompareImg.gameObject.SetActive(true);
|
selfCompareImg.SetSprite(_tagRealmModel.Img);
|
selfCompareImg.SetNativeSize();
|
selfCompareTxt.text = viewRoleFuncModel.compareTip;
|
}
|
else
|
{
|
selfCompareTxt.text = StringUtility.Contact(viewRoleFuncModel.compareTip, Language.Get("RoleParticularWin_6"));
|
}
|
_tagRealmModel = RealmConfig.Get(viewPlayerData.rolePropData.RealmLV);
|
if (_tagRealmModel != null && _tagRealmModel.Lv != 0)
|
{
|
targetCompareImg.gameObject.SetActive(true);
|
targetCompareImg.SetSprite(_tagRealmModel.Img);
|
targetCompareImg.SetNativeSize();
|
targetCompareTxt.text = viewRoleFuncModel.compareTip;
|
}
|
else
|
{
|
targetCompareTxt.text = StringUtility.Contact(viewRoleFuncModel.compareTip, Language.Get("RoleParticularWin_6"));
|
}
|
break;
|
case FuncPowerType.GodWeapon:
|
GodWeaponInfo data = ModelCenter.Instance.GetModel<MagicianModel>().GetGodWeaponInfo(2);
|
if (data != null)
|
selfValue = data.level;
|
targetValue = viewPlayerData.rolePlusData.GetGodWeaponLevel(2);
|
break;
|
case FuncPowerType.Rune:
|
selfValue = ModelCenter.Instance.GetModel<RuneModel>().GetRuneInlayCount();
|
targetValue = viewPlayerData.rolePlusData.Rune;
|
break;
|
case FuncPowerType.Human:
|
selfValue += treasureModel.GetCollectedTreasureCount(TreasureCategory.Human);
|
targetValue = viewPlayerData.rolePlusData.GetTreasureCount((int)TreasureCategory.Human);
|
break;
|
case FuncPowerType.Demon:
|
selfValue += treasureModel.GetCollectedTreasureCount(TreasureCategory.Demon);
|
targetValue = viewPlayerData.rolePlusData.GetTreasureCount((int)TreasureCategory.Demon);
|
break;
|
case FuncPowerType.Fairy:
|
selfValue += treasureModel.GetCollectedTreasureCount(TreasureCategory.Fairy);
|
targetValue = viewPlayerData.rolePlusData.GetTreasureCount((int)TreasureCategory.Fairy);
|
break;
|
}
|
if (!handled)
|
{
|
targetCompareTxt.text = string.Format(viewRoleFuncModel.compareTip, targetValue);
|
selfCompareTxt.text = string.Format(viewRoleFuncModel.compareTip, selfValue);
|
}
|
if (viewRoleFuncModel.func != 0 && !FuncOpen.Instance.IsFuncOpen(viewRoleFuncModel.func))
|
{
|
selfCompareTxt.text = Language.Get("RoleParticularWin_8");
|
}
|
}
|
}
|
|
public int GetAllStoneLv(Dictionary<int, int[]> dict)
|
{
|
int allStoneLv = 0;
|
foreach (int[] array in dict.Values)
|
{
|
if (array == null || array.Length == 0)
|
continue;
|
for (int i = 0; i < array.Length; i++)
|
{
|
if (array[i] == 0)
|
continue;
|
ItemConfig _tagChinItemModel = ItemConfig.Get((int)array[i]);
|
if (_tagChinItemModel == null)
|
continue;
|
allStoneLv += _tagChinItemModel.EffectValueB1;
|
}
|
}
|
return allStoneLv;
|
}
|
}
|
}
|
|