using vnxbqy.UI; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace EnhancedUI.EnhancedScroller { public class ViewFuncCell : ScrollerUI { [SerializeField] Image m_FuncIcon; [SerializeField] Text m_CompareFightPower; [SerializeField] Text m_MyFightPower; [SerializeField] Text[] m_CompareDescs; [SerializeField] Text[] m_MyDescs; [SerializeField] Image m_CompareRealmIcon; [SerializeField] Image m_MyRealmIcon; RoleParticularModel model { get { return ModelCenter.Instance.GetModel(); } } TreasureModel treasureModel { get { return ModelCenter.Instance.GetModel(); } } PetModel petModel { get { return ModelCenter.Instance.GetModel(); } } MountModel horseModel { get { return ModelCenter.Instance.GetModel(); } } PackModel packModel { get { return ModelCenter.Instance.GetModel(); } } EquipGemModel equipGemModel { get { return ModelCenter.Instance.GetModel(); } } ReikiRootModel reikiRootModel { get { return ModelCenter.Instance.GetModel(); } } EquipStarModel equipStarModel { get { return ModelCenter.Instance.GetModel(); } } EquipModel equipModel { get { return ModelCenter.Instance.GetModel(); } } EquipStrengthModel equipStrengthModel { get { return ModelCenter.Instance.GetModel(); } } EquipTrainModel equipTrainModel { get { return ModelCenter.Instance.GetModel(); } } MagicianModel godWeaponModel { get { return ModelCenter.Instance.GetModel(); } } RuneModel runeModel { get { return ModelCenter.Instance.GetModel(); } } TreasureSkillModel treasureSkillModel { get { return ModelCenter.Instance.GetModel(); } } AlchemyModel alchemyModel { get { return ModelCenter.Instance.GetModel(); } } public override void Refresh(CellView cell) { var otherPlayerInfo = model.GetViewPlayerData(model.viewPlayer); int funcId = cell.index; var config = ViewRoleFuncConfig.Get(funcId); if (otherPlayerInfo != null && config != null) { m_FuncIcon.SetSprite(config.Icon); m_CompareFightPower.text = StringUtility.Contact(Language.Get("RoleParticularWin_4"), UIHelper.ReplaceLargeNum(otherPlayerInfo.rolePlusData.GetFightPower(funcId))); m_MyFightPower.text = StringUtility.Contact(Language.Get("RoleParticularWin_5"), UIHelper.ReplaceLargeNum(model.GetFuncFightPower(funcId))); int targetValue1 = 0; int selfValue1 = 0; int targetValue2 = 0; int selfValue2 = 0; bool handled = false; bool towCompare = false; m_MyRealmIcon.SetActive(false); m_CompareRealmIcon.SetActive(false); switch ((FuncPowerType)funcId) { case FuncPowerType.Reiki: { foreach (var id in reikiRootModel.reikiRoots) { selfValue1 += reikiRootModel.GetReikiRootPoint(id); } if (otherPlayerInfo.rolePropData.LingGenPoint != null) { foreach (var point in otherPlayerInfo.rolePropData.LingGenPoint) { targetValue1 += point; } } } break; case FuncPowerType.Equip: { var singlePack = packModel.GetSinglePack(PackType.Equip); if (singlePack != null) { var equips = singlePack.GetAllItems(); if (equips != null) { foreach (var item in equips.Values) { if (ItemLogicUtility.Instance.IsRealmEquip(item.itemId)) { if (item.config.ItemColor >= config.condition[0]) { selfValue1++; } } } } } targetValue1 = otherPlayerInfo.rolePlusData.orangeEquipsCount; } break; case FuncPowerType.Star: { var singlePack = packModel.GetSinglePack(PackType.Equip); if (singlePack != null) { var equips = singlePack.GetAllItems(); if (equips != null) { foreach (var item in equips.Values) { selfValue1 += equipStarModel.GetEquipStarLevel(new Int2(item.config.LV, item.config.EquipPlace)); } } } targetValue1 = otherPlayerInfo.rolePlusData.totalEquipStarLevel; } break; case FuncPowerType.Plus: { var singlePack = packModel.GetSinglePack(PackType.Equip); if (singlePack != null) { var equips = singlePack.GetAllItems(); if (equips != null) { foreach (var item in equips.Values) { selfValue1 += equipStrengthModel.GetStrengthLevel(item.config.LV, item.config.EquipPlace); } } } targetValue1 = otherPlayerInfo.rolePlusData.totalEquipStrengthLevel; } break; case FuncPowerType.Stone: targetValue1 = otherPlayerInfo.rolePlusData.totalGemsLevel; selfValue1 = equipGemModel.GetAllGemsLevel(); break; case FuncPowerType.Wash: { var singlePack = packModel.GetSinglePack(PackType.Equip); if (singlePack != null) { var equips = singlePack.GetAllItems(); if (equips != null) { foreach (var item in equips.Values) { selfValue1 += Mathf.Max(0, equipTrainModel.GetTrainLevel(new Int2(item.config.LV, item.config.EquipPlace))); } } } targetValue1 = otherPlayerInfo.rolePlusData.totalEquipWashLevel; } break; case FuncPowerType.Alchemy: { var drugs = alchemyModel.GetAlchemyDrugs(); foreach (var drugId in drugs) { AlchemyDrugUseLimit drugUseLimit; if (alchemyModel.TryGetAlchemyUseLimit(drugId, out drugUseLimit)) { selfValue1 += drugUseLimit.eatTimes; } } targetValue1 = otherPlayerInfo.rolePlusData.GetUseAlchemyDrugsCount(); } break; case FuncPowerType.Pet: selfValue1 = petModel._DicPetBack.Count; targetValue1 = otherPlayerInfo.rolePlusData.Pet; break; case FuncPowerType.Horse: selfValue1 = horseModel.HorseLV; targetValue1 = otherPlayerInfo.rolePlusData.Horse; break; case FuncPowerType.Realm: handled = true; var realmConfig = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel); if (PlayerDatas.Instance.baseData.realmLevel > 0 && realmConfig != null) { m_MyRealmIcon.SetActive(true); m_MyRealmIcon.SetSprite(realmConfig.Img); m_MyRealmIcon.SetNativeSize(); m_MyDescs[0].text = config.compareTip[0]; } else { m_MyRealmIcon.SetActive(false); m_MyDescs[0].text = config.compareTip[0] + Language.Get("RoleParticularWin_6"); } realmConfig = RealmConfig.Get(otherPlayerInfo.rolePropData.RealmLV); if (otherPlayerInfo.rolePropData.RealmLV > 0 && realmConfig != null) { m_CompareRealmIcon.SetActive(true); m_CompareRealmIcon.SetSprite(realmConfig.Img); m_CompareRealmIcon.SetNativeSize(); m_CompareDescs[0].text = config.compareTip[0]; } else { m_CompareRealmIcon.SetActive(false); m_CompareDescs[0].text = config.compareTip[0] + Language.Get("RoleParticularWin_6"); } break; case FuncPowerType.GodWeapon: foreach (var type in godWeaponModel.godWeaponTypes) { var data = godWeaponModel.GetGodWeaponInfo(type); if (data != null) { selfValue1 += data.level; } targetValue1 += otherPlayerInfo.rolePlusData.GetGodWeaponLevel(type); } break; case FuncPowerType.Rune: selfValue1 = runeModel.GetRuneTotalLevel(); targetValue1 = otherPlayerInfo.rolePlusData.Rune; break; case FuncPowerType.Human: selfValue1 += treasureModel.GetCollectedTreasureCount(TreasureCategory.Human); targetValue1 = otherPlayerInfo.rolePlusData.GetTreasureCount((int)TreasureCategory.Human); List skills; if (treasureSkillModel.TryGetSkills(out skills)) { foreach (var skillId in skills) { TreasureSkill skill; if (treasureSkillModel.TryGetSkill(skillId, out skill)) { selfValue2 += skill.level; } } } targetValue2 = otherPlayerInfo.rolePlusData.totalSkillLevel; towCompare = true; break; case FuncPowerType.Demon: selfValue1 += treasureModel.GetCollectedTreasureCount(TreasureCategory.Demon); targetValue1 = otherPlayerInfo.rolePlusData.GetTreasureCount((int)TreasureCategory.Demon); break; case FuncPowerType.Fairy: selfValue1 += treasureModel.GetCollectedTreasureCount(TreasureCategory.Fairy); targetValue1 = otherPlayerInfo.rolePlusData.GetTreasureCount((int)TreasureCategory.Fairy); break; case FuncPowerType.King: selfValue1 += treasureModel.GetCollectedTreasureCount(TreasureCategory.King); targetValue1 = otherPlayerInfo.rolePlusData.GetTreasureCount((int)TreasureCategory.King); break; } if (!handled) { m_CompareDescs[0].text = string.Format(config.compareTip[0], targetValue1); m_MyDescs[0].text = string.Format(config.compareTip[0], selfValue1); if (towCompare) { m_CompareDescs[1].text = string.Format(config.compareTip[1], targetValue2); m_MyDescs[1].text = string.Format(config.compareTip[1], selfValue2); } } m_CompareDescs[1].SetActive(towCompare); m_MyDescs[1].SetActive(towCompare); } } } }