少年修仙传客户端代码仓库
client_Hale
2019-04-25 2db8b395ea4a512cf741132946c43c323fa28281
Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
11个文件已修改
228 ■■■■■ 已修改文件
System/Chat/ChatCtrl.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Chat/ChatWin.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipTrain/EquipTrain.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipTrain/EquipTrainCandidateBehaviour.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipTrain/EquipTrainLevelBehaviour.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipTrain/EquipTrainModel.cs 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipTrain/EquipTrainWin.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Message/HrefAnalysis.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Message/RichEvent.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Message/RichNormalEvent.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Treasure/TreasureDungeonVictoryWin.cs 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Chat/ChatCtrl.cs
@@ -181,6 +181,12 @@
        {
            achievementRandoms.Add(ChatInfoType.World, new List<string>(ConfigParse.GetMultipleStr(_cfg.Numerical1)));
            achievementRandoms.Add(ChatInfoType.Fairy, new List<string>(ConfigParse.GetMultipleStr(_cfg.Numerical2)));
            var json = LitJson.JsonMapper.ToObject(_cfg.Numerical3);
            foreach (var key in json.Keys)
            {
                var type = int.Parse(key);
                m_TaskRandomChats.Add(type, new List<string>(LitJson.JsonMapper.ToObject<string[]>(json[key].ToJson())));
            }
        }
        catch (Exception e)
        {
@@ -999,6 +1005,19 @@
        return string.Empty;
    }
    public bool openFromFairyTask { get; set; }
    Dictionary<int, List<string>> m_TaskRandomChats = new Dictionary<int, List<string>>();
    public string GetTaskRandomChat(ChatInfoType _type)
    {
        if (m_TaskRandomChats.ContainsKey((int)_type))
        {
            var list = m_TaskRandomChats[(int)_type];
            var index = UnityEngine.Random.Range(0, list.Count);
            return Language.Get(list[index]);
        }
        return string.Empty;
    }
    public bool needCheckAssitChat { get; set; }
    public int IsAssitChat(string message, bool force = false)
    {
System/Chat/ChatWin.cs
@@ -71,8 +71,13 @@
            {
                GemFlauntChat();
            }
            else if (ChatCtrl.Inst.openFromFairyTask)
            {
                TaskRandomChat();
            }
            ChatCtrl.Inst.openFromDaily = false;
            ChatCtrl.Inst.openFromGem = false;
            ChatCtrl.Inst.openFromFairyTask = false;
        }
        protected override void OnPreClose()
@@ -82,6 +87,7 @@
            ChatCtrl.Inst.openFromDaily = false;
            ChatCtrl.Inst.openFromGem = false;
            ChatCtrl.Inst.needCheckAssitChat = false;
            ChatCtrl.Inst.openFromFairyTask = false;
            chatCenter.ChangeChatValue(string.Empty, false, true);
        }
@@ -262,6 +268,11 @@
            chatCenter.ChangeChatValue(ChatCtrl.Inst.GetAssitRandomChat(ChatCtrl.Inst.presentChatType), false, true);
        }
        private void TaskRandomChat()
        {
            chatCenter.ChangeChatValue(ChatCtrl.Inst.GetTaskRandomChat(ChatCtrl.Inst.presentChatType), false, true);
        }
        private void GemFlauntChat()
        {
            chatCenter.ChangeChatValue(ChatCtrl.Inst.GetGemFlauntChat(), false, true);
System/EquipTrain/EquipTrain.cs
@@ -13,11 +13,14 @@
    public class EquipTrainSet
    {
        public readonly int level = 0;
        public Redpoint redpoint;
        Dictionary<int, EquipTrain> equipTrains = new Dictionary<int, EquipTrain>();
        public EquipTrainSet(int level)
        {
            this.level = level;
            this.redpoint = new Redpoint(910000, 910000 + level * 100);
            for (int i = 1; i <= 12; i++)
            {
                equipTrains[i] = new EquipTrain(this.level, i, EquipTrainModel.GetTrainType(i));
@@ -82,6 +85,26 @@
            return equipTrains.ContainsKey(place) ? equipTrains[place].trainedProperties : Int3.zero;
        }
        public void UpdateRedpoint(int place, RedPointState state)
        {
            if (equipTrains.ContainsKey(place))
            {
                equipTrains[place].redpoint.state = state;
            }
        }
        public RedPointState GetRedpointState(int place)
        {
            if (equipTrains.ContainsKey(place))
            {
                return equipTrains[place].redpoint.state;
            }
            else
            {
                return RedPointState.None;
            }
        }
    }
    public class EquipTrain
@@ -93,12 +116,16 @@
        public Int3 unSavedProperties { get; set; }
        public Int3 trainedProperties { get; set; }
        public Redpoint redpoint;
        public EquipTrain(int level, int place, int trainType)
        {
            this.level = level;
            this.place = place;
            this.trainType = trainType;
            this.trainLevel = 1;
            redpoint = new Redpoint(910000 + level * 100, 910000 + level * 100 + place);
        }
        public void Reset()
System/EquipTrain/EquipTrainCandidateBehaviour.cs
@@ -18,6 +18,7 @@
        [SerializeField] Text m_Description1;
        [SerializeField] Text m_Description2;
        [SerializeField] Button m_Select;
        [SerializeField] RedpointBehaviour m_Redpoint;
        EquipTrainModel model { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } }
        EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
@@ -28,7 +29,7 @@
        public void Display(EquipTrainCandidate candidate)
        {
            this.candidate = candidate;
            this.m_Redpoint.redpointId = 91 * 10000 + this.candidate.equipPosition.x * 100 + this.candidate.equipPosition.y;
            DisplayBaseInfo();
            DisplayDynamicInfo(true);
System/EquipTrain/EquipTrainLevelBehaviour.cs
@@ -17,6 +17,7 @@
        [SerializeField] Image m_BackGround;
        [SerializeField] Image m_Arrow;
        [SerializeField] Text m_Title;
        [SerializeField] RedpointBehaviour m_Redpoint;
        readonly List<EquipTrainCandidateBehaviour> slotBehaviours = new List<EquipTrainCandidateBehaviour>();
@@ -31,6 +32,7 @@
            this.m_Title.text = Language.Get("RealmEquipName", realmConfig.Name);
            this.level = level;
            this.m_Redpoint.redpointId = 91 * 10000 + level * 100;
            m_Select.SetListener(Select);
        }
System/EquipTrain/EquipTrainModel.cs
@@ -23,6 +23,10 @@
        static Dictionary<int, int> trainTypes = new Dictionary<int, int>();
        Dictionary<int, EquipTrainSet> equipTrains = new Dictionary<int, EquipTrainSet>();
        Redpoint redpoint = new Redpoint(910000);
        bool redpointDirty = false;
        LogicUpdate logicUpdate = new LogicUpdate(1);
        EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
@@ -36,10 +40,15 @@
            {
                equipTrains[level] = new EquipTrainSet(level);
            }
            logicUpdate.Start(OnUpdate);
            packModel.refreshItemCountEvent += OnItemCountRefresh;
        }
        public override void UnInit()
        {
            packModel.refreshItemCountEvent -= OnItemCountRefresh;
        }
        public void OnBeforePlayerDataInitialize()
@@ -119,6 +128,8 @@
                    candidatePlaces[i].trainLevel.value = GetTrainLevel(candidatePlaces[i].equipPosition);
                }
            }
            redpointDirty = true;
        }
        public void Train(Int2 equipPosition, bool[] inevitables)
@@ -263,19 +274,36 @@
                    {
                        return -1;
                    }
                    else if (stateX != TrainState.Allowable && stateY == TrainState.Allowable)
                    if (stateX != TrainState.Allowable && stateY == TrainState.Allowable)
                    {
                        return 1;
                    }
                    else if (stateX == TrainState.Allowable && stateY == TrainState.Allowable)
                    if (stateX == TrainState.Allowable && stateY == TrainState.Allowable)
                    {
                        return x.trainLevel.value.CompareTo(y.trainLevel.value);
                        var compareResult = x.trainLevel.value.CompareTo(y.trainLevel.value);
                        if (compareResult == 0)
                        {
                            compareResult = x.equipPosition.y.CompareTo(y.equipPosition.y);
                        }
                        return compareResult;
                    }
                    else if (stateX == TrainState.StarLimit && stateY != TrainState.StarLimit)
                    if (stateX == TrainState.StarLimit && stateY != TrainState.StarLimit)
                    {
                        return -1;
                    }
                    else if (stateX != TrainState.StarLimit && stateY == TrainState.StarLimit)
                    {
                        return 1;
                    }
                    else if (stateX == TrainState.MaxLevel && stateY != TrainState.MaxLevel)
                    {
                        return -1;
                    }
                    else if (stateX != TrainState.MaxLevel && stateY == TrainState.MaxLevel)
                    {
                        return 1;
                    }
@@ -289,9 +317,10 @@
                    }
                    else
                    {
                        return 0;
                        return x.equipPosition.y.CompareTo(y.equipPosition.y);
                    }
                });
                SelectPlace(candidatePlaces[0].equipPosition);
            }
        }
@@ -381,6 +410,24 @@
            }
            inevitableMaterialCount.value = CalculateInevitableMaterialCount(equipPosition);
        }
        public Int2 GetRecommendEquipPosition()
        {
            foreach (var trainSet in equipTrains.Values)
            {
                var level = trainSet.level;
                for (var i = 1; i <= 12; i++)
                {
                    var isRedpoint = trainSet.GetRedpointState(i) != RedPointState.None;
                    if (isRedpoint)
                    {
                        return new Int2(level, i);
                    }
                }
            }
            return new Int2(1, 1);
        }
        public int GetTrainLevel(Int2 equipPosition)
@@ -696,6 +743,74 @@
            }
        }
        private void OnItemCountRefresh(PackType type, int index, int itemId)
        {
            if (type != PackType.Item)
            {
                return;
            }
            if (itemId == 5303)
            {
                redpointDirty = true;
            }
        }
        private void UpdateTrainRedpoint()
        {
            var ownTrainMaterial = packModel.GetItemCountByID(PackType.Item, 5303);
            var targetEquipPosition = Int2.zero;
            if (ownTrainMaterial != 0)
            {
                var minTrainLevel = 999;
                foreach (var trainSet in equipTrains.Values)
                {
                    var level = trainSet.level;
                    for (var i = 1; i <= 12; i++)
                    {
                        var trainState = GetEquipPlaceTrainState(new Int2(level, i));
                        if (trainState != TrainState.Allowable)
                        {
                            continue;
                        }
                        var needMaterial = GetMaterialNeed(new Int2(level, i));
                        if (needMaterial > ownTrainMaterial)
                        {
                            continue;
                        }
                        var tranLevel = trainSet.GetTrainLevel(i);
                        if (tranLevel < minTrainLevel)
                        {
                            minTrainLevel = tranLevel;
                            targetEquipPosition = new Int2(level, i);
                        }
                    }
                }
            }
            foreach (var trainSet in equipTrains.Values)
            {
                var level = trainSet.level;
                for (var i = 1; i <= 12; i++)
                {
                    var isRedpoint = level == targetEquipPosition.x && i == targetEquipPosition.y;
                    trainSet.UpdateRedpoint(i, isRedpoint ? RedPointState.Simple : RedPointState.None);
                }
            }
        }
        private void OnUpdate()
        {
            if (redpointDirty)
            {
                redpointDirty = false;
                UpdateTrainRedpoint();
            }
        }
        private void ParseConfig()
        {
            var config = FuncConfigConfig.Get("EquipWashGroup");
System/EquipTrain/EquipTrainWin.cs
@@ -66,7 +66,9 @@
        {
            if (model.selectedLevel.value == 0)
            {
                model.SelectLevel(equipModel.GetLastestUnLockEquipSet());
                var equipPosition = model.GetRecommendEquipPosition();
                model.SelectLevel(equipPosition.x);
                model.SelectPlace(equipPosition);
            }
        }
System/Message/HrefAnalysis.cs
@@ -253,6 +253,12 @@
                        presentHrefInfo.Add(split_value, array[1]);
                    }
                    break;
                case "randomchat":
                    {
                        presentHrefInfo.mEvents.Add(RichTextEventEnum.RandomChat);
                        presentHrefInfo.Add(split_value, array[1]);
                    }
                    break;
                default:
                    {
                        presentHrefInfo.Add(split_value, array[1]);
System/Message/RichEvent.cs
@@ -24,4 +24,5 @@
    JOINTEAM,//加入队伍
    AncientRobotName,//上古战场随机名字
    AuctionBidding,//集市竞价
    RandomChat,
}
System/Message/RichNormalEvent.cs
@@ -17,6 +17,7 @@
        RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.JOINTEAM, this);
        RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.AncientRobotName, this);
        RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.AuctionBidding, this);
        RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.RandomChat, this);
    }
    public override bool Execute(RichTextEventEnum type, RichTextMgr.HrefInfo href)
@@ -114,6 +115,18 @@
                    }
                }
                break;
            case RichTextEventEnum.RandomChat:
                {
                    if (href.mSplits.ContainsKey("randomchat"))
                    {
                        var chatType = (ChatInfoType)int.Parse(href.mSplits["randomchat"]);
                        ChatCtrl.Inst.presentChatType = chatType;
                        ChatCtrl.Inst.openFromFairyTask = true;
                        WindowCenter.Instance.Open<ChatWin>();
                        WindowCenter.Instance.Open<MainInterfaceWin>();
                    }
                }
                break;
        }
        return false;
    }
System/Treasure/TreasureDungeonVictoryWin.cs
@@ -53,18 +53,11 @@
        protected override void OnActived()
        {
            base.OnActived();
            if (ClientDungeonStageUtility.isClientDungeon)
            {
                StartCoroutine(Co_DelayDisplay(1f));
            }
            else
            {
                var dataMapId = dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID);
                var config = DungeonOpenTimeConfig.Get(dataMapId);
                StartCoroutine(Co_DelayDisplay(config.DelayTime * 0.001f));
            }
            base.OnActived();
            var dataMapId = dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID);
            var config = DungeonOpenTimeConfig.Get(dataMapId);
            StartCoroutine(Co_DelayDisplay(config.DelayTime * 0.001f));
        }
        #endregion