using Snxxz.UI;
|
using System;
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
public class RichTableEvent : TRichTextEvent
|
{
|
public RichTableEvent()
|
{
|
RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.TABLE, this);
|
RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.SHOWITEM, this);
|
}
|
|
public override bool Execute(RichTextEventEnum type, RichTextMgr.HrefInfo href)
|
{
|
switch (type)
|
{
|
case RichTextEventEnum.SHOWITEM:
|
{
|
ItemConfig cfg = ItemConfig.Get(href.mSplits["showitem"]);
|
if (cfg != null)
|
{
|
OnSingleClickItemCell(cfg.ID, href);
|
}
|
}
|
break;
|
}
|
return false;
|
}
|
|
public override string GetDisplay(RichTextEventEnum type, Dictionary<string, string> _dict)
|
{
|
switch (type)
|
{
|
case RichTextEventEnum.TABLE:
|
{
|
if (_dict.ContainsKey("info"))
|
{
|
string info = _dict["info"];
|
switch (info)
|
{
|
case "richtextmsgreplace":
|
{
|
int id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out id))
|
{
|
return RichTextMsgReplaceConfig.GetRichReplace(_dict["name"], id);
|
}
|
}
|
break;
|
case "item":
|
{
|
int id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out id))
|
{
|
ItemConfig cfg = ItemConfig.Get(id);
|
if (cfg != null)
|
{
|
var _itemColor = cfg.ItemColor;
|
if (ItemLogicUtility.Instance.IsWing(id))//翅膀
|
{
|
if (_dict.ContainsKey("itemplus"))
|
{
|
var itemplus = LitJson.JsonMapper.ToObject<ItemTipUtility.CustomItemPlus>(_dict["itemplus"]);
|
var userdatadic = ConfigParse.Analysis(itemplus.UserData);
|
_itemColor = ItemLogicUtility.Instance.GetItemQuality(cfg.ID, userdatadic);
|
}
|
}
|
var itemName = cfg.ItemName;
|
if (_dict != null && _dict.ContainsKey("chatsend"))
|
{
|
itemName = StringUtility.Contact("[", itemName, "]");
|
}
|
if (_dict != null && _dict.ContainsKey("count"))
|
{
|
var count = 0;
|
int.TryParse(_dict["count"], out count);
|
if (count > 0)
|
{
|
itemName = StringUtility.Contact(itemName, "x", count);
|
}
|
}
|
return GetTextColorByItemColor(itemName, _itemColor, _dict);
|
}
|
else
|
{
|
DebugEx.LogError(string.Format("物品表里没有ID{0}对应的物品", id));
|
}
|
}
|
}
|
break;
|
case "npc":
|
{
|
int id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out id))
|
{
|
NPCConfig cfg = NPCConfig.Get(id);
|
if (cfg != null)
|
{
|
return cfg.charName;
|
}
|
}
|
}
|
break;
|
case "map":
|
{
|
int id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out id))
|
{
|
MapConfig cfg = MapConfig.Get(id);
|
if (cfg != null)
|
{
|
return cfg.Name;
|
}
|
}
|
}
|
break;
|
case "skill":
|
{
|
int id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out id))
|
{
|
SkillConfig cfg = SkillConfig.Get(id);
|
if (cfg != null)
|
{
|
return cfg.SkillName;
|
}
|
}
|
}
|
break;
|
case "fairyquestion":
|
{
|
int id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out id))
|
{
|
QuestionBankConfig cfg = QuestionBankConfig.Get(id);
|
if (cfg != null)
|
{
|
return cfg.question;
|
}
|
}
|
}
|
break;
|
case "runetower":
|
{
|
int id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out id))
|
{
|
RuneTowerConfig cfg = RuneTowerConfig.Get(id);
|
if (cfg != null)
|
{
|
return cfg.TowerName;
|
}
|
}
|
}
|
break;
|
case "realm":
|
{
|
int id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out id))
|
{
|
RealmConfig _cfg = RealmConfig.Get(id);
|
if (_cfg != null)
|
{
|
var text = RichTextMgr.Inst.presentRichText;
|
int colorType = 0;
|
if (text != null)
|
{
|
colorType = text.colorType == RichText.ColorType.Dark ? 0 : 1;
|
}
|
return UIHelper.GetRealmName(id, colorType == 1);
|
}
|
}
|
}
|
break;
|
case "pet":
|
{
|
int id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out id))
|
{
|
PetInfoConfig _cfg = PetInfoConfig.Get(id);
|
if (_cfg != null)
|
{
|
return GetTextColorByItemColor(_cfg.Name, _cfg.Quality, _dict);
|
}
|
}
|
}
|
break;
|
case "alchemy":
|
{
|
int id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out id))
|
{
|
AlchemyConfig _cfg = AlchemyConfig.Get(id);
|
if (_cfg != null)
|
{
|
return _cfg.AlchemName;
|
}
|
}
|
}
|
break;
|
case "treasure":
|
{
|
int id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out id))
|
{
|
TreasureConfig _cfg = TreasureConfig.Get(id);
|
if (_cfg != null)
|
{
|
return _cfg.Name;
|
}
|
}
|
}
|
break;
|
case "godweapon":
|
{
|
var _type = 0;
|
if (_dict.ContainsKey("type") && int.TryParse(_dict["type"], out _type))
|
{
|
var _cfg = GodWeaponConfig.GetConfig(_type, 1);
|
if (_cfg != null)
|
{
|
return _cfg.Name;
|
}
|
}
|
}
|
break;
|
case "buffdesc":
|
{
|
var _id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id))
|
{
|
var _cfg = SkillConfig.Get(_id);
|
if (_cfg != null)
|
{
|
return _cfg.BuffDescription;
|
}
|
}
|
}
|
break;
|
case "property":
|
{
|
var _id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id))
|
{
|
var _cfg = PlayerPropertyConfig.Get(_id);
|
if (_cfg != null)
|
{
|
return _cfg.Name;
|
}
|
}
|
}
|
break;
|
case "mount":
|
{
|
var _id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id))
|
{
|
var _cfg = HorseConfig.Get(_id);
|
if (_cfg != null)
|
{
|
return GetTextColorByItemColor(_cfg.Name, _cfg.Quality, _dict);
|
}
|
}
|
}
|
break;
|
case "success":
|
{
|
var _id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id))
|
{
|
var _cfg = SuccessConfig.Get(_id);
|
if (_cfg != null)
|
{
|
return _cfg.Describe;
|
}
|
}
|
}
|
break;
|
case "osredenvelope":
|
{
|
var _id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id))
|
{
|
var _cfg = OSRedAchieveConfig.Get(_id);
|
if (_cfg != null)
|
{
|
return _cfg.typeName;
|
}
|
}
|
}
|
break;
|
case "treasureprivilege":
|
{
|
var _id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id))
|
{
|
var _cfg = TreasurePrivilegeConfig.Get(_id);
|
if (_cfg != null)
|
{
|
return _cfg.Name;
|
}
|
}
|
}
|
break;
|
case "towernewrune":
|
{
|
var _id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id))
|
{
|
var config = RuneTowerConfig.Get(_id + 1);
|
if (config != null)
|
{
|
var itemConfig = ItemConfig.Get(config.ProductRune);
|
return itemConfig.ItemName;
|
}
|
var towerFloor = RuneTowerFloorConfig.Get(_id * 100 + 8);
|
if (config != null)
|
{
|
var itemConfig = ItemConfig.Get(towerFloor.UnLockCompose);
|
return itemConfig.ItemName;
|
}
|
}
|
}
|
break;
|
case "runetowerfloor":
|
{
|
var _id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id))
|
{
|
var config = RuneTowerFloorConfig.Get(_id);
|
if (config != null)
|
{
|
var towerConfig = RuneTowerConfig.Get(config.TowerId);
|
return StringUtility.Contact(towerConfig.TowerName, config.FloorName);
|
}
|
}
|
}
|
break;
|
case "coloritem":
|
{
|
var _id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id))
|
{
|
var config = ItemConfig.Get(_id);
|
if (config != null)
|
{
|
return StringUtility.Contact(GetItemColorChs(config.ItemColor), GetTextColorByItemColor(config.ItemName, config.ItemColor, _dict));
|
}
|
}
|
}
|
break;
|
case "crossserverarena":
|
{
|
var _id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id))
|
{
|
var text = RichTextMgr.Inst.presentRichText;
|
int colorType = 0;
|
if (text != null)
|
{
|
colorType = text.colorType == RichText.ColorType.Dark ? 0 : 1;
|
}
|
return UIHelper.AppendDanLVNameColor(_id, colorType == 1);
|
}
|
}
|
break;
|
case "jadedynastytower":
|
{
|
var _id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id))
|
{
|
var config = JadeDynastyTowerConfig.Get(_id);
|
if (config != null)
|
{
|
return config.floorName;
|
}
|
}
|
}
|
break;
|
case "equipsuitname":
|
{
|
var _id = 0;
|
if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id))
|
{
|
return EquipSuitConfig.GetEquipSuitName(_id);
|
}
|
}
|
break;
|
}
|
}
|
}
|
break;
|
}
|
return string.Empty;
|
}
|
|
|
EquipGemModel equipGemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } }
|
private void OnSingleClickItemCell(int itemId, RichTextMgr.HrefInfo hrefInfo)
|
{
|
ItemTipUtility.CustomItemPlus itemplus = default(ItemTipUtility.CustomItemPlus);
|
if (hrefInfo.mSplits.ContainsKey("itemplus"))
|
{
|
itemplus = LitJson.JsonMapper.ToObject<ItemTipUtility.CustomItemPlus>(hrefInfo.mSplits["itemplus"]);
|
}
|
|
if (ItemLogicUtility.Instance.IsEquip(itemId))
|
{
|
var itemConfig = ItemConfig.Get(itemId);
|
Dictionary<int, int> gems = new Dictionary<int, int>();
|
Dictionary<int, bool> gemHoleActiveStates = new Dictionary<int, bool>();
|
if (itemplus.Stone != null)
|
{
|
for (int i = 0; i < itemplus.Stone.Length; i++)
|
{
|
gems.Add(i, itemplus.Stone[i]);
|
if (i == 3)
|
{
|
gemHoleActiveStates.Add(i, itemplus.Stone[i] != 0);
|
}
|
}
|
}
|
|
for (int i = 0; i < EquipGemModel.EQUIPGEM_HOLE_COUNT; i++)
|
{
|
if (i < 3)
|
{
|
gemHoleActiveStates.Add(i, equipGemModel.IsGemHoleOpen(i, itemplus.Star));
|
}
|
}
|
|
var legendProperties = new List<Int2>();
|
Dictionary<int, List<int>> useDataDict = null;
|
if (!string.IsNullOrEmpty(itemplus.UserData))
|
{
|
useDataDict = ConfigParse.Analysis(itemplus.UserData);
|
if (useDataDict != null)
|
{
|
foreach (var key in useDataDict.Keys)
|
{
|
var list = useDataDict[key];
|
foreach (var value in list)
|
{
|
legendProperties.Add(new Int2(key, value));
|
}
|
}
|
}
|
}
|
|
List<Int2> trainProperties = new List<Int2>();
|
if (!itemplus.Wash.Equals(default(ItemTipUtility.CustomEquipWash)))
|
{
|
var washType = EquipTrainModel.GetTrainType(itemConfig.EquipPlace);
|
var trainConfig = EquipWashConfig.Get(washType, 1);
|
for (int i = 0; i < itemplus.Wash.Value.Length; i++)
|
{
|
var propertyType = i == 0 ? trainConfig.config.attType1 : i == 1 ?
|
trainConfig.config.attType2 : trainConfig.config.attType3;
|
trainProperties.Add(new Int2(propertyType, itemplus.Wash.Value[i]));
|
}
|
}
|
|
Dictionary<EquipSuitType, int> suitLevels = new Dictionary<EquipSuitType, int>();
|
suitLevels.Add(EquipSuitType.TwoSuit, -1);
|
suitLevels.Add(EquipSuitType.FiveSuit, -1);
|
suitLevels.Add(EquipSuitType.EightSuit, -1);
|
|
List<int> suitplaces = new List<int>();
|
|
if (itemplus.Equips != null)
|
{
|
var stars = new List<int>();
|
for (int i = 0; i < itemplus.Equips.Length; i++)
|
{
|
var array = itemplus.Equips[i];
|
var config = ItemConfig.Get(array[0]);
|
if (config.EquipPlace > 8)
|
{
|
continue;
|
}
|
stars.Add(array[1]);
|
|
if (config.SuiteiD > 0)
|
{
|
suitplaces.Add(config.EquipPlace);
|
}
|
}
|
|
stars.Sort((int x, int y) => { return -x.CompareTo(y); });
|
|
var twoSuitLevel = (suitplaces.Count > 1 && stars.Count > 1) ? stars[1] : -1;
|
var fiveSuitLevel = (suitplaces.Count > 4 && stars.Count > 4) ? stars[4] : -1;
|
var eightSuitLevel = (suitplaces.Count > 7 && stars.Count > 7) ? stars[7] : -1;
|
|
suitLevels[EquipSuitType.TwoSuit] = twoSuitLevel;
|
suitLevels[EquipSuitType.FiveSuit] = fiveSuitLevel;
|
suitLevels[EquipSuitType.EightSuit] = eightSuitLevel;
|
}
|
|
ItemTipUtility.ShowCustomEquip(new ItemTipUtility.CustomEquipInfo()
|
{
|
itemId = itemId,
|
job = itemConfig.JobLimit,
|
strengthenLevel = itemplus.PlusLV,
|
starLevel = itemplus.Star,
|
gems = gems,
|
legendProperties = legendProperties,
|
score = ItemLogicUtility.Instance.GetEquipScore(PackType.Item, itemId, useDataDict, true),
|
gemHoleActiveStates = gemHoleActiveStates,
|
suitLevels = suitLevels,
|
suitPlaces = suitplaces,
|
trainProperties = trainProperties,
|
});
|
}
|
else
|
{
|
ItemTipUtility.Show(itemId);
|
}
|
}
|
|
List<RoleParticularModel.EquipSuit> equipSuitList = new List<RoleParticularModel.EquipSuit>();
|
int[][] equipItems = null;
|
|
public int GetItem(int _index)
|
{
|
if (equipItems != null)
|
{
|
for (int i = 0; i < equipItems.Length; i++)
|
{
|
int[] _itemData = equipItems[i];
|
if (_itemData != null && _itemData.Length > 1)
|
{
|
if (_itemData[0] == _index)
|
{
|
return _itemData[1];
|
}
|
}
|
}
|
}
|
return 0;
|
}
|
|
public string GetItemColorChs(int _itemColor)
|
{
|
switch (_itemColor)
|
{
|
case 2:
|
return Language.Get("EquipSuitBlue");
|
case 3:
|
return Language.Get("EquipSuitPurple");
|
case 4:
|
return Language.Get("EquipSuitOrange");
|
case 5:
|
return Language.Get("EquipSuitRed");
|
default:
|
return Language.Get("EquipSuitWhite");
|
}
|
}
|
|
private static string GetTextColorByItemColor(string info, int _itemColor, Dictionary<string, string> dic)
|
{
|
if (dic.ContainsKey("col"))
|
{
|
if (int.Parse(dic["col"]) == 0)
|
{
|
return info;
|
}
|
}
|
var text = RichTextMgr.Inst.presentRichText;
|
int colorType = 0;
|
if (text != null)
|
{
|
colorType = text.colorType == RichText.ColorType.Dark ? 0 : 1;
|
}
|
return UIHelper.AppendColor(_itemColor, info, colorType == 1);
|
}
|
}
|