Пример #1
0
        public void UpdateMatchList()
        {
            if (!NeedUpdateList)
            {
                return;
            }
            NeedUpdateList = false;
            mainInstance.g_bnotifierChanged = true;

            var asLines = Settings.Default.notifierText.Split('\n');
            var iLines  = asLines.Length;

            notifyMatchList = new List <NotifyMatch>();
            var tempMatchErrorLines = new ConcurrentBag <int>();

            for (int i = 0; i < iLines; i++)
            {
                try {
                    NotifyMatch notifyMatch = NotifyMatch.FromString(asLines[i]);
                    if (notifyMatch != null)
                    {
                        notifyMatchList.Add(notifyMatch);
                    }
                } catch (Exception) {
                    tempMatchErrorLines.Add(i);
                    logger.Debug($"Warning: NotifierUpdateList() - Could not parse line {i}");
                }
            }

            MatchErrorLines = tempMatchErrorLines;
        }
Пример #2
0
        private void OnTimeOver()
        {
            NotifyMatch result = new NotifyMatch();

            if (mNotReady.Count > 0 || mPlayers.Count < mMaxCount)
            {
                result.Success = 0;
                IsVanish       = true;
            }
            else
            {
                result.Success = 1;
                mTime          = -1;

                // 通知Room服务器创建场景;
                JsonData json = new JsonData();
                json["maxCount"] = mMaxCount;
                json["scnID"]    = 3;
                NetWork.SendToServer("RoomServer", STS.STS_CreateScn, json, OnCreateScnSuccess);
            }
            // 通知所有玩家匹配失败;
            for (int i = 0; i < mPlayers.Count; ++i)
            {
                Player player = mPlayers[i];
                player.mRoom = null;
                NetWork.NotifyMessage <NotifyMatch>(player.mUserID, STC.STC_MatchFailed, result);
            }
        }
Пример #3
0
            public static NotifyMatch FromString(string line)
            {
                var matchLine = new NotifyMatch();

                if (matchLine.Parse(line) == false)
                {
                    return(null);
                }

                return(matchLine);
            }
Пример #4
0
        public List <string> FindItemsFromNotifierString(string notifierString)
        {
            if (InitItemCache() == false)
            {
                return(new List <string>()
                {
                    "Error updating NotifierCache - Probably not ingame"
                });
            }

            List <string> asMatches = new List <string>();

            NotifyMatch testMatch = NotifyMatch.FromString(notifierString);

            if (testMatch != null)
            {
                var sMatch     = testMatch.Match;
                var iFlagsTier = testMatch.Flags[ItemFlagGroup.Tier];

                for (int i = 0; i < ItemCache.Count; i++)
                {
                    var sName     = ItemCache[i].FullText;
                    var iTierFlag = ItemCache[i].Tier;

                    if (Regex.IsMatch(sName, sMatch))
                    {
                        if (iFlagsTier != 0 && (iFlagsTier & iTierFlag) == 0)
                        {
                            continue;
                        }

                        asMatches.Add(ItemCache[i].Name);
                    }
                }
            }
            return(asMatches);
        }