少年修仙传客户端代码仓库
client_Hale
2019-04-29 2276596d7d83190567e06deceee2920ab26607b7
Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
5个文件已修改
371 ■■■■■ 已修改文件
System/Chat/ChatCtrl.cs 72 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipGem/EquipStrengthModel.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/ItemTip/ItemTipUtility.cs 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Message/HrefAnalysis.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Message/RichTableEvent.cs 228 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Chat/ChatCtrl.cs
@@ -150,6 +150,11 @@
    }
    EquipGemModel equipGemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } }
    EquipStrengthModel equipStrengthModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } }
    EquipStarModel equipStarModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
    EquipTrainModel equipTrainModel { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } }
    EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
    PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
    public Dictionary<ChatInfoType, List<string>> achievementRandoms = new Dictionary<ChatInfoType, List<string>>();
@@ -759,16 +764,16 @@
                data.richText.Append(content.Substring(index, matchArray[i].Index - index));
                index = matchArray[i].Index + matchArray[i].Length;
                string detail = matchArray[i].Groups[1].Value;
                var chatSendItem = LitJson.JsonMapper.ToObject<ChatSendItem>(detail);
                if (chatSendItem.itemId != 0)
                var itemplus = LitJson.JsonMapper.ToObject<ItemTipUtility.CustomItemPlus>(detail);
                if (itemplus.ItemID != 0)
                {
                    ItemConfig itemConfig = ItemConfig.Get(chatSendItem.itemId);
                    ItemConfig itemConfig = ItemConfig.Get(itemplus.ItemID);
                    if (itemConfig != null)
                    {
                        try
                        {
                            string append = string.Format("<a><Word info=item id={0} chatsenditem={1} chatsend=1/>|showitem={0} chatsenditem={1}</a>",
                                      chatSendItem.itemId, detail);
                            string append = string.Format("<a><Word info=item id={0} itemplus={1} chatsend=1/>|showitem={0} itemplus={1}</a>",
                                      itemplus.ItemID, detail);
                            append = UIHelper.AppendColor(itemConfig.ItemColor, append);
                            data.richText.Append(append);
                        }
@@ -845,28 +850,61 @@
            var _length = _textBuilder.Length;
            if (i < itemPlaceList.Count)
            {
                ItemConfig cfg = ItemConfig.Get((int)itemPlaceList[i].itemId);
                if (cfg.ItemName == matchArray[i].Groups[1].Value)
                var itemConfig = ItemConfig.Get((int)itemPlaceList[i].itemId);
                if (itemConfig.ItemName == matchArray[i].Groups[1].Value)
                {
                    bool equip = itemPlaceList[i].packType == PackType.Equip;
                    int[] equipGems = null;
                    var strengthLevel = 0;
                    var evolveLevel = 0;
                    var starLevel = 0;
                    ItemTipUtility.CustomEquipWash equipWash = new ItemTipUtility.CustomEquipWash();
                    List<int[]> equips = new List<int[]>();
                    if (equip)
                    {
                        var position = new Int2(itemConfig.LV, itemConfig.EquipPlace);
                        equipGemModel.TryGetEquipGems(itemPlaceList[i].gridIndex, out equipGems);
                        strengthLevel = equipStrengthModel.GetStrengthLevel(itemConfig.LV, itemConfig.EquipPlace);
                        starLevel = equipStarModel.GetEquipStarLevel(new Int2(itemConfig.LV, itemConfig.EquipPlace));
                        evolveLevel = equipStrengthModel.GetStrengthEvolveLevel(position.x, position.y);
                        equipWash.LV = equipTrainModel.GetTrainLevel(position);
                        var property = equipTrainModel.GetTrainedProperties(position);
                        equipWash.Value = new int[3] { property.x, property.y, property.z };
                        for (int place = 1; place <= 12; place++)
                        {
                            var equipGuid = equipModel.GetEquip(new Int2(position.x, place));
                            if (!string.IsNullOrEmpty(equipGuid))
                            {
                                var equipItem = packModel.GetItemByGuid(equipGuid);
                                int[] array = new int[2];
                                array[0] = equipItem.itemId;
                                array[1] = equipStarModel.GetEquipStarLevel(new Int2(position.x, place));
                                equips.Add(array);
                            }
                        }
                    }
                    _textBuilder.Append("#item#");
                    var chatSendItem = new ChatSendItem()
                    var itemplus = new ItemTipUtility.CustomItemPlus()
                    {
                        itemId = (int)itemPlaceList[i].itemId,
                        ItemID = (int)itemPlaceList[i].itemId,
                        count = (int)itemPlaceList[i].count,
                        equipGems = equipGems,
                        useData = itemPlaceList[i].itemInfo.userData,
                        Stone = equipGems,
                        UserData = itemPlaceList[i].itemInfo.userData,
                        PlusLV = strengthLevel,
                        EvolveLV = evolveLevel,
                        Star = starLevel,
                        Wash = equipWash,
                        Equips = equips.Count > 0 ? equips.ToArray() : null,
                    };
                    _textBuilder.Append(LitJson.JsonMapper.ToJson(chatSendItem));
                    _textBuilder.Append(LitJson.JsonMapper.ToJson(itemplus));
                    _textBuilder.Append("#item#");
                    if (_recently != null)
                    {
                        _recently.Add(cfg.ItemName, _textBuilder.ToString().Substring(_length));
                        _recently.Add(itemConfig.ItemName, _textBuilder.ToString().Substring(_length));
                    }
                }
                else
@@ -1141,14 +1179,6 @@
        return RedPointState.None;
    }
    #endregion
    public struct ChatSendItem
    {
        public int itemId;
        public int count;
        public int[] equipGems;
        public string useData;
    }
}
public struct ChatExtraData
{
System/EquipGem/EquipStrengthModel.cs
@@ -445,6 +445,17 @@
        return lv;
    }
    public int GetStrengthEvolveLevel(int level, int equipPlace)
    {
        int lv = 0;
        int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, equipPlace);
        if (EquipStrengthDic.ContainsKey(equipIndex))
        {
            lv = EquipStrengthDic[equipIndex].EvolveLV;
        }
        return lv;
    }
    public int GetEquipStrengthState(Int2 position)
    {
        var equipGuid = equipModel.GetEquip(position);
System/ItemTip/ItemTipUtility.cs
@@ -152,6 +152,25 @@
            public Dictionary<int, int> gems;
        }
        public struct CustomItemPlus
        {
            public int ItemID;
            public int count;
            public int Star;
            public int PlusLV;
            public int EvolveLV;
            public string UserData;
            public int[] Stone;
            public CustomEquipWash Wash;
            public int[][] Equips;
        }
        public struct CustomEquipWash
        {
            public int LV;
            public int[] Value;
        }
        static PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        static EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
        static EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
@@ -173,11 +192,9 @@
        {
            secondaryData = null;
            var config = ItemConfig.Get(itemId);
#if UNITY_EDITOR
            Debug.LogFormat("你查看的物品是:itemId->{0}", itemId);
            Debug.LogFormat("你查看的物品是:name->{0}", config.ItemName);
#endif
            var config = ItemConfig.Get(itemId);
            PrintItemBrief(itemId);
            var tipType = GetTipType(itemId);
            switch (tipType)
            {
@@ -228,14 +245,10 @@
            if (item == null)
            {
                return;
            }
#if UNITY_EDITOR
            Debug.LogFormat("你查看的物品是:guid->{0}", string.IsNullOrEmpty(guid) ? "" : guid);
            Debug.LogFormat("你查看的物品是:itemId->{0}", item.itemId);
            Debug.LogFormat("你查看的物品是:name->{0}", item.config.ItemName);
#endif
            }
            PrintItemBrief(item.itemId, guid);
            secondaryData = null;
            var tipType = GetTipType(item.itemId);
            switch (tipType)
@@ -462,7 +475,7 @@
                star = info.starLevel,
                strengthenLevel = info.strengthenLevel,
                score = info.score,
                isEquiped=true,
                isEquiped = true,
            };
            var baseProperty = GetBaseProperty(info.itemId);
@@ -1701,6 +1714,23 @@
        }
        [System.Diagnostics.Conditional("UNITY_EDITOR")]
        private static void PrintItemBrief(int itemId)
        {
            var config = ItemConfig.Get(itemId);
            Debug.LogFormat("你查看的物品是:itemId->{0}", itemId);
            Debug.LogFormat("你查看的物品是:name->{0}", config.ItemName);
        }
        [System.Diagnostics.Conditional("UNITY_EDITOR")]
        private static void PrintItemBrief(int itemId, string guid)
        {
            var config = ItemConfig.Get(itemId);
            Debug.LogFormat("你查看的物品是:guid->{0}", string.IsNullOrEmpty(guid) ? "" : guid);
            Debug.LogFormat("你查看的物品是:itemId->{0}", itemId);
            Debug.LogFormat("你查看的物品是:name->{0}", config.ItemName);
        }
    }
}
System/Message/HrefAnalysis.cs
@@ -290,7 +290,7 @@
    }
    public static Regex EquipRegex = new Regex(@"\[([\u4e00-\u9fa5a-zA-Z0-9\|'_\(\)()\. ::]+?)\]", RegexOptions.Singleline);
    public static Regex EquipDetailRegex = new Regex("#item#([\u4e00-\u9fa5a-zA-Z0-9\\|'_\\(\\)()\\. ::\\,\\[\\]a-zA-Z\"\\{\\}]+?)#item#", RegexOptions.Singleline);
    public static Regex EquipDetailRegex = new Regex("#item#([\u4e00-\u9fa5a-zA-Z0-9\\|'_\\(\\)()\\. ::\\,\\[\\]a-zA-Z\"\\{\\}-]+?)#item#", RegexOptions.Singleline);
    public bool ExcuteHrefEvent(string msg, int index = 0)
    {
System/Message/RichTableEvent.cs
@@ -58,13 +58,12 @@
                                        if (cfg != null)
                                        {
                                            var _itemColor = cfg.ItemColor;
                                            if (cfg.Type == 113)//翅膀
                                            if (ItemLogicUtility.Instance.IsWing(id))//翅膀
                                            {
                                                Dictionary<int, List<int>> userdatadic = null;
                                                if (_dict.ContainsKey("userdata"))
                                                if (_dict.ContainsKey("itemplus"))
                                                {
                                                    string userdata = _dict["userdata"];
                                                    userdatadic = ConfigParse.Analysis(userdata);
                                                    var itemplus = LitJson.JsonMapper.ToObject<ItemTipUtility.CustomItemPlus>(_dict["itemplus"]);
                                                    var userdatadic = ConfigParse.Analysis(itemplus.UserData);
                                                    _itemColor = ItemLogicUtility.Instance.GetItemQuality(cfg.ID, userdatadic);
                                                }
                                            }
@@ -397,125 +396,128 @@
        return string.Empty;
    }
    EquipGemModel equipGemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } }
    private void OnSingleClickItemCell(int itemId, RichTextMgr.HrefInfo hrefInfo)
    {
        int[] stone = null;
        if (hrefInfo.mSplits.ContainsKey("stone"))
        ItemTipUtility.CustomItemPlus itemplus = default(ItemTipUtility.CustomItemPlus);
        if (hrefInfo.mSplits.ContainsKey("itemplus"))
        {
            try
            {
                stone = LitJson.JsonMapper.ToObject<int[]>(hrefInfo.mSplits["stone"]);
            }
            catch (Exception e)
            {
                DebugEx.Log(e.Message);
            }
        }
        int itemCount = 0;
        if (hrefInfo.mSplits.ContainsKey("itemcnt"))
        {
            itemCount = int.Parse(hrefInfo.mSplits["itemcnt"]);
        }
        int isBind = 0;
        if (hrefInfo.mSplits.ContainsKey("isbind"))
        {
            isBind = int.Parse(hrefInfo.mSplits["isbind"]);
        }
        int strengthenLv = 0;
        if (hrefInfo.mSplits.ContainsKey("strengthenlv"))
        {
            strengthenLv = int.Parse(hrefInfo.mSplits["strengthenlv"]);
        }
        int index = 0;
        if (hrefInfo.mSplits.ContainsKey("place"))
        {
            index = int.Parse(hrefInfo.mSplits["place"]);
            itemplus = LitJson.JsonMapper.ToObject<ItemTipUtility.CustomItemPlus>(hrefInfo.mSplits["itemplus"]);
        }
        if (hrefInfo.mSplits.ContainsKey("equippartsuite")
            && hrefInfo.mSplits["equippartsuite"] != string.Empty)
        if (ItemLogicUtility.Instance.IsEquip(itemId))
        {
            LitJson.JsonData _json = null;
            try
            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)
            {
                _json = LitJson.JsonMapper.ToObject(hrefInfo.mSplits["equippartsuite"]);
            }
            catch (Exception e)
            {
                DebugEx.Log(e.Message);
            }
        }
        equipItems = null;
        if (hrefInfo.mSplits.ContainsKey("equipitems")
            && hrefInfo.mSplits["equipitems"] != string.Empty)
        {
            try
            {
                equipItems = LitJson.JsonMapper.ToObject<int[][]>(hrefInfo.mSplits["equipitems"]);
            }
            catch (Exception e)
            {
                DebugEx.Log(e.Message);
            }
        }
        RoleParticularModel.EquipWash _equipWash = default(RoleParticularModel.EquipWash);
        if (hrefInfo.mSplits.ContainsKey("equipwash")
            && hrefInfo.mSplits["equipwash"] != string.Empty)
        {
            try
            {
                _equipWash = LitJson.JsonMapper.ToObject<RoleParticularModel.EquipWash>(hrefInfo.mSplits["equipwash"]);
            }
            catch (Exception e)
            {
                DebugEx.Log(e.Message);
            }
        }
        Dictionary<int, List<int>> userdatadic = null;
        if (hrefInfo.mSplits.ContainsKey("userdata"))
        {
            string userdata = hrefInfo.mSplits["userdata"];
            userdatadic = ConfigParse.Analysis(userdata);
        }
        Dictionary<int, int> suitLvDict = null;
        if (hrefInfo.mSplits.ContainsKey("suitlv"))
        {
            suitLvDict = new Dictionary<int, int>();
            string suitLvData = hrefInfo.mSplits["suitlv"];
            string[] split_data = suitLvData.Split('\'');
            for (int i = 0; i < split_data.Length; i++)
            {
                string[] split_value = split_data[i].Split('_');
                if (split_value.Length == 2)
                for (int i = 0; i < itemplus.Stone.Length; i++)
                {
                    int key = int.Parse(split_value[0]);
                    suitLvDict.Add(key, int.Parse(split_value[1]));
                    gems.Add(i, itemplus.Stone[i]);
                    if (i == 3)
                    {
                        gemHoleActiveStates.Add(i, itemplus.Stone[i] != 0);
                    }
                }
            }
        }
        if (hrefInfo.mSplits.ContainsKey("chatsenditem"))
        {
            var chatSendItem = LitJson.JsonMapper.ToObject<ChatCtrl.ChatSendItem>(hrefInfo.mSplits["chatsenditem"]);
            itemId = chatSendItem.itemId;
            itemCount = chatSendItem.count;
            stone = chatSendItem.equipGems;
            if (!string.IsNullOrEmpty(chatSendItem.useData))
            for (int i = 0; i < EquipGemModel.EQUIPGEM_HOLE_COUNT; i++)
            {
                userdatadic = ConfigParse.Analysis(chatSendItem.useData);
                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 = stars.Count > 1 ? stars[1] : -1;
                var fiveSuitLevel = stars.Count > 4 ? stars[4] : -1;
                var eightSuitLevel = 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,
            });
        }
        //     ItemAttrData attrData = new ItemAttrData(itemId, true, (ulong)itemCount, -1,  false, PackType.Deleted,
        //         "", userdatadic);
        //     attrData.SetGemModel(stone);
        //   attrData.SetStrengthData(strengthenLv, GetStrengthenType(itemId));
        //   itemTipsModel.SetItemTipsModel(attrData);
        ItemTipUtility.Show(itemId);
        else
        {
            ItemTipUtility.Show(itemId);
        }
    }
    List<RoleParticularModel.EquipSuit> equipSuitList = new List<RoleParticularModel.EquipSuit>();
@@ -555,12 +557,6 @@
            default:
                return Language.Get("EquipSuitWhite");
        }
    }
    public static int GetStrengthenType(int _id)
    {
        var _type = 1;
        return _type;
    }
    private static string GetTextColorByItemColor(string info, int _itemColor, Dictionary<string, string> dic)