| | |
| | | {
|
| | | public class ViewFuncCell : ScrollerUI
|
| | | {
|
| | | RoleParticularModel m_Model;
|
| | | RoleParticularModel model
|
| | | {
|
| | | get
|
| | | {
|
| | | return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<RoleParticularModel>());
|
| | | }
|
| | | }
|
| | | [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;
|
| | |
|
| | | 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>()); }
|
| | | }
|
| | |
|
| | | RoleParticularModel model { get { return ModelCenter.Instance.GetModel<RoleParticularModel>(); } }
|
| | | TreasureModel treasureModel { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } }
|
| | | PetModel petModel { get { return ModelCenter.Instance.GetModel<PetModel>(); } }
|
| | | MountModel horseModel { get { return ModelCenter.Instance.GetModel<MountModel>(); } }
|
| | | PackModel packModel { get { return 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;
|
| | | ReikiRootModel reikiRootModel { get { return ModelCenter.Instance.GetModel<ReikiRootModel>(); } }
|
| | | EquipStarModel equipStarModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
|
| | | EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
|
| | | EquipStrengthModel equipStrengthModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } }
|
| | | EquipTrainModel equipTrainModel { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } }
|
| | | MagicianModel godWeaponModel { get { return ModelCenter.Instance.GetModel<MagicianModel>(); } }
|
| | | RuneModel runeModel { get { return ModelCenter.Instance.GetModel<RuneModel>(); } }
|
| | | TreasureSkillModel treasureSkillModel { get { return ModelCenter.Instance.GetModel<TreasureSkillModel>(); } }
|
| | |
|
| | | 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)
|
| | | var otherPlayerInfo = model.GetViewPlayerData(model.viewPlayer);
|
| | | int funcId = cell.index;
|
| | | var config = ViewRoleFuncConfig.Get(funcId);
|
| | | if (otherPlayerInfo != null && config != 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;
|
| | | 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;
|
| | | selfCompareImg.gameObject.SetActive(false);
|
| | | targetCompareImg.gameObject.SetActive(false);
|
| | | switch ((FuncPowerType)key)
|
| | | bool towCompare = false;
|
| | |
|
| | | m_MyRealmIcon.gameObject.SetActive(false);
|
| | | m_CompareRealmIcon.gameObject.SetActive(false);
|
| | |
|
| | | switch ((FuncPowerType)funcId)
|
| | | {
|
| | | case FuncPowerType.Reiki:
|
| | | {
|
| | | foreach (var id in reikiRootModel.reikiRoots)
|
| | | {
|
| | | selfValue1 += reikiRootModel.GetReikiRootPoint(id);
|
| | | }
|
| | | targetValue1 = 0;
|
| | | }
|
| | | break;
|
| | | case FuncPowerType.Equip:
|
| | | {
|
| | | if (viewPlayerData.rolePropData.EquipShowID != null)
|
| | | var singlePack = packModel.GetSinglePack(PackType.Equip);
|
| | | if (singlePack != null)
|
| | | {
|
| | | foreach (var itemId in viewPlayerData.rolePropData.EquipShowID)
|
| | | var equips = singlePack.GetAllItems();
|
| | | if (equips != null)
|
| | | {
|
| | | ItemConfig _tagChinItemModel = ItemConfig.Get(itemId);
|
| | | if (_tagChinItemModel != null && (_tagChinItemModel.ItemColor > viewRoleFuncModel.condition[0]
|
| | | || (_tagChinItemModel.ItemColor == viewRoleFuncModel.condition[0]
|
| | | && (viewRoleFuncModel.condition.Length < 2 || _tagChinItemModel.StarLevel >= viewRoleFuncModel.condition[1]))))
|
| | | foreach (var item in equips.Values)
|
| | | {
|
| | | targetValue++;
|
| | | if (item.config.SuiteiD > 0)
|
| | | {
|
| | | selfValue1++;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | var packTypeModel = playerPack.GetSinglePack(PackType.Equip);
|
| | | if (packTypeModel == null || packTypeModel.GetAllItems() == null)
|
| | | break;
|
| | | foreach (var itemData in packTypeModel.GetAllItems().Values)
|
| | |
|
| | | targetValue1 = 0;
|
| | | }
|
| | | break;
|
| | | case FuncPowerType.Star:
|
| | | {
|
| | | var singlePack = packModel.GetSinglePack(PackType.Equip);
|
| | | if (singlePack != null)
|
| | | {
|
| | | 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]))))
|
| | | var equips = singlePack.GetAllItems();
|
| | | if (equips != null)
|
| | | {
|
| | | selfValue++;
|
| | | foreach (var item in equips.Values)
|
| | | {
|
| | | selfValue1 += equipStarModel.GetEquipStarLevel(new Int2(item.config.LV, item.config.EquipPlace));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | targetValue1 = 0;
|
| | | }
|
| | | 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)
|
| | | var singlePack = packModel.GetSinglePack(PackType.Equip);
|
| | | if (singlePack != null)
|
| | | {
|
| | | selfValue += 0;
|
| | | var equips = singlePack.GetAllItems();
|
| | | if (equips != null)
|
| | | {
|
| | | foreach (var item in equips.Values)
|
| | | {
|
| | | selfValue1 += equipStrengthModel.GetStrengthLevel(item.config.LV, item.config.EquipPlace);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | targetValue1 = 0;
|
| | | }
|
| | | break;
|
| | | case FuncPowerType.Stone:
|
| | | targetValue = GetAllStoneLv(viewPlayerData.rolePlusData.GetAllEquipStone());
|
| | | selfValue = equipGemModel.GetAllGemsLevel();
|
| | | break;
|
| | | case FuncPowerType.Wing:
|
| | | {
|
| | | handled = true;
|
| | | var wingId = viewPlayerData.GetItemId(RoleEquipType.Wing);
|
| | | if (wingId != 0)
|
| | | {
|
| | | ItemConfig _tagChinItemModel = ItemConfig.Get(wingId);
|
| | | 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"));
|
| | | }
|
| | | }
|
| | | targetValue1 = GetGemsLevel(otherPlayerInfo.rolePlusData.GetAllEquipStone());
|
| | | selfValue1 = equipGemModel.GetAllGemsLevel();
|
| | | break;
|
| | | case FuncPowerType.Wash:
|
| | | targetValue = viewPlayerData.rolePlusData.GetAllEquipWashLv();
|
| | | {
|
| | | var singlePack = packModel.GetSinglePack(PackType.Equip);
|
| | | if (singlePack != null)
|
| | | {
|
| | | var equips = singlePack.GetAllItems();
|
| | | if (equips != null)
|
| | | {
|
| | | foreach (var item in equips.Values)
|
| | | {
|
| | | selfValue1 += equipTrainModel.GetTrainLevel(new Int2(item.config.LV, item.config.EquipPlace));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | targetValue1 = otherPlayerInfo.rolePlusData.GetAllEquipWashLv();
|
| | | }
|
| | | break;
|
| | | case FuncPowerType.Alchemy:
|
| | | break;
|
| | | case FuncPowerType.Pet:
|
| | | selfValue = petmodel._DicPetBack.Count;
|
| | | targetValue = viewPlayerData.rolePlusData.Pet;
|
| | | selfValue1 = petModel._DicPetBack.Count;
|
| | | targetValue1 = otherPlayerInfo.rolePlusData.Pet;
|
| | | break;
|
| | | case FuncPowerType.Horse:
|
| | | selfValue = horsemodel._DicHorse.Count;
|
| | | targetValue = viewPlayerData.rolePlusData.Horse;
|
| | | selfValue1 = horseModel._DicHorse.Count;
|
| | | targetValue1 = otherPlayerInfo.rolePlusData.Horse;
|
| | | break;
|
| | | case FuncPowerType.Prestige:
|
| | | case FuncPowerType.Realm:
|
| | | handled = true;
|
| | | RealmConfig _tagRealmModel = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel);
|
| | | if (_tagRealmModel != null && _tagRealmModel.Lv != 0)
|
| | | var realmConfig = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel);
|
| | | if (realmConfig != null)
|
| | | {
|
| | | selfCompareImg.gameObject.SetActive(true);
|
| | | selfCompareImg.SetSprite(_tagRealmModel.Img);
|
| | | selfCompareImg.SetNativeSize();
|
| | | selfCompareTxt.text = viewRoleFuncModel.compareTip;
|
| | | m_MyRealmIcon.gameObject.SetActive(true);
|
| | | m_MyRealmIcon.SetSprite(realmConfig.Img);
|
| | | m_MyRealmIcon.SetNativeSize();
|
| | | m_MyDescs[0].text = config.compareTip[0];
|
| | | }
|
| | | else
|
| | | realmConfig = RealmConfig.Get(otherPlayerInfo.rolePropData.RealmLV);
|
| | | if (realmConfig != null)
|
| | | {
|
| | | 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"));
|
| | | m_CompareRealmIcon.gameObject.SetActive(true);
|
| | | m_CompareRealmIcon.SetSprite(realmConfig.Img);
|
| | | m_CompareRealmIcon.SetNativeSize();
|
| | | m_CompareDescs[0].text = config.compareTip[0];
|
| | | }
|
| | | break;
|
| | | case FuncPowerType.GodWeapon:
|
| | | GodWeaponInfo data = ModelCenter.Instance.GetModel<MagicianModel>().GetGodWeaponInfo(2);
|
| | | if (data != null)
|
| | | selfValue = data.level;
|
| | | targetValue = viewPlayerData.rolePlusData.GetGodWeaponLevel(2);
|
| | | foreach (var type in godWeaponModel.godWeaponTypes)
|
| | | {
|
| | | var data = godWeaponModel.GetGodWeaponInfo(type);
|
| | | if (data != null)
|
| | | {
|
| | | selfValue1 += data.level;
|
| | | }
|
| | | targetValue1 += otherPlayerInfo.rolePlusData.GetGodWeaponLevel(2);
|
| | | }
|
| | | break;
|
| | | case FuncPowerType.Rune:
|
| | | selfValue = ModelCenter.Instance.GetModel<RuneModel>().GetRuneInlayCount();
|
| | | targetValue = viewPlayerData.rolePlusData.Rune;
|
| | | selfValue1 = runeModel.GetRuneTotalLevel();
|
| | | targetValue1 = otherPlayerInfo.rolePlusData.Rune;
|
| | | break;
|
| | | case FuncPowerType.Human:
|
| | | selfValue += treasureModel.GetCollectedTreasureCount(TreasureCategory.Human);
|
| | | targetValue = viewPlayerData.rolePlusData.GetTreasureCount((int)TreasureCategory.Human);
|
| | | selfValue1 += treasureModel.GetCollectedTreasureCount(TreasureCategory.Human);
|
| | | targetValue1 = otherPlayerInfo.rolePlusData.GetTreasureCount((int)TreasureCategory.Human);
|
| | | List<int> skills;
|
| | | if (treasureSkillModel.TryGetSkills(out skills))
|
| | | {
|
| | | foreach (var skillId in skills)
|
| | | {
|
| | | TreasureSkill skill;
|
| | | if (treasureSkillModel.TryGetSkill(skillId, out skill))
|
| | | {
|
| | | selfValue2 += skill.level;
|
| | | }
|
| | | }
|
| | | }
|
| | | targetValue2 = 0;
|
| | | towCompare = true;
|
| | | break;
|
| | | case FuncPowerType.Demon:
|
| | | selfValue += treasureModel.GetCollectedTreasureCount(TreasureCategory.Demon);
|
| | | targetValue = viewPlayerData.rolePlusData.GetTreasureCount((int)TreasureCategory.Demon);
|
| | | selfValue1 += treasureModel.GetCollectedTreasureCount(TreasureCategory.Demon);
|
| | | targetValue1 = otherPlayerInfo.rolePlusData.GetTreasureCount((int)TreasureCategory.Demon);
|
| | | break;
|
| | | case FuncPowerType.Fairy:
|
| | | selfValue += treasureModel.GetCollectedTreasureCount(TreasureCategory.Fairy);
|
| | | targetValue = viewPlayerData.rolePlusData.GetTreasureCount((int)TreasureCategory.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)
|
| | | {
|
| | | targetCompareTxt.text = string.Format(viewRoleFuncModel.compareTip, targetValue);
|
| | | selfCompareTxt.text = string.Format(viewRoleFuncModel.compareTip, selfValue);
|
| | | 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], targetValue1);
|
| | | m_MyDescs[1].text = string.Format(config.compareTip[1], selfValue1);
|
| | | }
|
| | | }
|
| | | if (viewRoleFuncModel.func != 0 && !FuncOpen.Instance.IsFuncOpen(viewRoleFuncModel.func))
|
| | | {
|
| | | selfCompareTxt.text = Language.Get("RoleParticularWin_8");
|
| | | }
|
| | |
|
| | | m_CompareDescs[1].gameObject.SetActive(towCompare);
|
| | | m_MyDescs[1].gameObject.SetActive(towCompare);
|
| | | }
|
| | | }
|
| | |
|
| | | public int GetAllStoneLv(Dictionary<int, int[]> dict)
|
| | | static int GetGemsLevel(Dictionary<int, int[]> dict)
|
| | | {
|
| | | int allStoneLv = 0;
|
| | | foreach (int[] array in dict.Values)
|
| | | var level = 0;
|
| | | foreach (int[] gems in dict.Values)
|
| | | {
|
| | | if (array == null || array.Length == 0)
|
| | | continue;
|
| | | for (int i = 0; i < array.Length; i++)
|
| | | if (gems == null || gems.Length == 0)
|
| | | {
|
| | | if (array[i] == 0)
|
| | | continue;
|
| | | }
|
| | | for (int i = 0; i < gems.Length; i++)
|
| | | {
|
| | | if (gems[i] == 0)
|
| | | {
|
| | | continue;
|
| | | ItemConfig _tagChinItemModel = ItemConfig.Get((int)array[i]);
|
| | | if (_tagChinItemModel == null)
|
| | | }
|
| | | var config = ItemConfig.Get((int)gems[i]);
|
| | | if (config == null)
|
| | | {
|
| | | continue;
|
| | | allStoneLv += _tagChinItemModel.EffectValueB1;
|
| | | }
|
| | | level += config.EffectValueB1;
|
| | | }
|
| | | }
|
| | | return allStoneLv;
|
| | | return level;
|
| | | }
|
| | | }
|
| | | }
|