private void AddLetterToBetaAnagram(BetaMatchAnagram matcher, bool anagramState, MatchMaker Matcher)
 {
     if (anagramState == true)
         matcher.AddAvailableLetter(Matcher);
     else
         matcher.AddMatchMaker(Matcher);
 }
Beispiel #2
0
 public void SetMyPlayerIcon()
 {
     if (MatchMaker.IsPlayerOne())
     {
         //iconP1 = myIcon;
         iconP1 = GameData.current.avatarIcon;
     }
     else
     {
         //iconP2 = myIcon;
         iconP2 = GameData.current.avatarIcon;
     }
 }
Beispiel #3
0
 public void SetMyPlayerName()
 {
     if (MatchMaker.IsPlayerOne())
     {
         //UpdatePlayer1Name(myName);
         UpdatePlayer1Name(AvatarHandler.Instance.currAvatarText.text);
     }
     else
     {
         //UpdatePlayer2Name(myName);
         UpdatePlayer2Name(AvatarHandler.Instance.currAvatarText.text);
     }
 }
Beispiel #4
0
    public IEnumerator LeaveGroupIE()
    {
        WWWForm form = new WWWForm();

        form.AddField("PartyIDPost", AccountManager.GetComponent <SqlManager>().partyID);

        if (AccountManager.GetComponent <SqlManager>().GroupID[0] == AccountManager.GetComponent <SqlManager>().Username)
        {
            form.AddField("PlayerNumberPost", 1);
        }

        if (AccountManager.GetComponent <SqlManager>().GroupID[1] == AccountManager.GetComponent <SqlManager>().Username)
        {
            form.AddField("PlayerNumberPost", 2);
        }

        if (AccountManager.GetComponent <SqlManager>().GroupID[2] == AccountManager.GetComponent <SqlManager>().Username)
        {
            form.AddField("PlayerNumberPost", 3);
        }

        if (AccountManager.GetComponent <SqlManager>().GroupID[3] == AccountManager.GetComponent <SqlManager>().Username)
        {
            form.AddField("PlayerNumberPost", 4);
        }

        WWW www = new WWW(SqlManager.url + "LeaveGroup.php", form);

        yield return(www);

        StopCoroutine(GameObject.Find("RequestManager").GetComponent <RequestReader>().ReadGroupChange());
        StopCoroutine(GameObject.Find("RequestManager").GetComponent <RequestReader>().JoinQueueRead());
        StopCoroutine(GameObject.Find("RequestManager").GetComponent <RequestReader>().LeaveQueueRead());

        AccountManager.GetComponent <SqlManager>().partyID    = 0;
        AccountManager.GetComponent <SqlManager>().GroupID[0] = AccountManager.GetComponent <SqlManager>().Username;
        AccountManager.GetComponent <SqlManager>().GroupID[1] = "";
        AccountManager.GetComponent <SqlManager>().GroupID[2] = "";
        AccountManager.GetComponent <SqlManager>().GroupID[3] = "";

        MatchMaker matchMaker = GameObject.Find("NetworkManager").GetComponent <MatchMaker>();

        matchMaker.QueueObject.SetActive(false);
        matchMaker.TimerMinutesFloat = 0;
        matchMaker.TimerSecondFloat  = 0;

        if (www.text.Contains("HTML"))
        {
            StartCoroutine(LeaveGroupIE());
        }
    }
Beispiel #5
0
    private void Awake()
    {
        instance = this;

        DontDestroyOnLoad(gameObject);
        StartMatchMaker();

        CardDB.Instance.Init();

        startScene = SceneManager.GetActiveScene();
        matchMaker.SetProgramAppID((AppID)1156002);

        StartCoroutine(DoGetMatchList());
    }
        private List <Pairing> GetPairingFromDatabase()
        {
            IEnumerable <Period> periods = from p in _context.tblSeanceCours
                                           join r in _context.tblRencontre.DefaultIfEmpty() on p.id equals r.seanceCoursId
                                           where r.etudiantId == null
                                           select new Period(p.id, p.startTime, p.endTime);

            IEnumerable <Disponibility> disponibilities = from d in _context.tblDisponibilites
                                                          join e in _context.tblEtudiant on d.etudiantId equals e.Id
                                                          where e.Jumeler == false
                                                          select new Disponibility(d.etudiantId, d.startTime, d.endTime, d.priority);

            return(MatchMaker.Match(periods.ToList(), disponibilities.ToList()));
        }
Beispiel #7
0
        public static void TestFinder()
        {
            MatchPlayer p0 = new MatchPlayer();

            p0.mmr = 1100;
            MatchPlayer p1 = new MatchPlayer();

            p1.mmr = 1500;
            MatchPlayer p2 = new MatchPlayer();

            p2.mmr = 2250;
            MatchPlayer p3 = new MatchPlayer();

            p3.mmr = 2700;
            MatchPlayer p4 = new MatchPlayer();

            p4.mmr = 4000;
            MatchPlayer p5 = new MatchPlayer();

            p5.mmr = 6500;
            MatchPlayer p6 = new MatchPlayer();

            p6.mmr = 5700;
            MatchPlayer p7 = new MatchPlayer();

            p7.mmr = 5150;
            MatchPlayer p8 = new MatchPlayer();

            p8.mmr = 4860;
            MatchPlayer p9 = new MatchPlayer();

            p9.mmr = 4000;


            MatchMaker.Join(p0);
            MatchMaker.Join(p1);
            MatchMaker.Join(p2);
            MatchMaker.Join(p3);
            MatchMaker.Join(p4);
            MatchMaker.Join(p5);
            MatchMaker.Join(p6);
            MatchMaker.Join(p7);
            MatchMaker.Join(p8);
            MatchMaker.Join(p9);

            MatchMaker.Update();

            return;
        }
Beispiel #8
0
 void Awake()
 {
     // deal with the singleton part
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         DestroyImmediate(gameObject);
     }
     DontDestroyOnLoad(gameObject);
     loadPlayers();
     simulating = false;
 }
Beispiel #9
0
        private List <Pairing> GetPairingFromDatabase()
        {
            IEnumerable <DatePickerEvent> tempListCours = (from p in _context.tblSeanceCours join e in _context.tblRencontre on p.id equals e.seanceCoursId select p);

            IEnumerable <DatePickerEvent> thlist = _context.tblSeanceCours.Select(e => e).Except(tempListCours);

            IEnumerable <Period> periods = thlist.Select(p => new Period(p.id, p.startTime, p.endTime));

            //////////////////////////////////////////////////////////////////
            IEnumerable <DatePickerEventEtu> tempListDispo = (from p in _context.tblDisponibilites join e in _context.tblRencontre on p.id equals e.seanceCoursId select p);

            IEnumerable <DatePickerEventEtu> dispolist = _context.tblDisponibilites.Select(e => e).Except(tempListDispo);

            IEnumerable <Disponibility> disponibilities = dispolist.Select(p => new Disponibility(p.etudiantId, p.startTime, p.endTime, p.priority));

            return(MatchMaker.Match(periods.ToList(), disponibilities.ToList()));
        }
Beispiel #10
0
        private static IEnumerable <string> FindMentions(string input)
        {
            var matchmaker = new MatchMaker()
            {
                IgnoreDuplicateMatches = true, MatchThreshold = 5
            };

            matchmaker.IsDuplicate = (match, matches) => { return(matches.Any(x => String.Equals(x.Groups["user"].Value, match.Groups["user"].Value, StringComparison.OrdinalIgnoreCase))); };

            if (matchmaker.Process(input, CONSTANTS.ACCEPTABLE_LEADS + CONSTANTS.USER_HOT_LINK_REGEX))
            {
                var matches = matchmaker.FilteredMatches;
                var users   = matches.Where(x => !x.Groups["notify"].Success).Select(x => x.Groups["user"].Value);
                return(users.ToList());
            }

            return(Enumerable.Empty <string>());
        }
Beispiel #11
0
 private void EnterMMPool(int cnnId, int channelId, int recHostId, Net_EnterMMPool msg)
 {
     if (msg.inPool)
     {
         MatchMakerObject mmo = new MatchMakerObject();
         mmo.channelId    = channelId;
         mmo.connectionId = cnnId;
         mmo.hostId       = recHostId;
         MatchMaker.GetInstance().QueueMatchMakerObject(mmo);
     }
     else
     {
         MatchMakerObject mmo = new MatchMakerObject();
         mmo.channelId    = channelId;
         mmo.connectionId = cnnId;
         mmo.hostId       = recHostId;
         MatchMaker.GetInstance().RemoveMatchMakerObject(mmo);
     }
 }
Beispiel #12
0
        private async Task Update()
        {
            //m_guild = m_client.GetGuild(m_guildId);
            //m_channel = m_guild.GetTextChannel(m_channelId);
            Console.WriteLine("Updating status...");
            if (m_messageId != 0)
            {
                await m_channel.DeleteMessageAsync(m_messageId);
            }

            EmbedBuilder embed = new EmbedBuilder();

            embed.Color = Color.DarkRed;
            embed.AddField("Players in Queue: ", MatchMaker.QueueSize());

            var rs = await m_channel.SendMessageAsync(embed : embed.Build());

            m_messageId = rs.Id;
        }
        public ActionResult Create([Bind(Include = "TimePlayed,Winner,Loser,TournamentID,GameID")] MatchMaker match)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    db.MakeMatchEasy(match.TimePlayed, match.TournamentID, match.Winner, match.Loser, match.GameID);
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    @ViewBag.Error = "Could not process match";
                    return(View());
                }
                return(RedirectToAction("Index"));
            }

            return(View(match));
        }
Beispiel #14
0
    public void Join()
    {
        joinMatchInput.interactable = false;
        joinButton.interactable     = false;
        hostButton.interactable     = false;

        //PlayerPrefs.SetString(Enums.PlayerPrefKeys.PlayerName.ToString(), displayName.text);
        string playerName = string.Empty;

        if (displayName.text == string.Empty)
        {
            playerName = "Player-" + MatchMaker.GetRandomMatchID();
        }
        else
        {
            playerName = displayName.text;
        }
        Player.localPlayer.JoinGame(joinMatchInput.text.ToUpper(), playerName);
    }
Beispiel #15
0
        public async Task JoinDefaultAsync()
        {
            SocketUser sender = Context.User;

            UserData user = new UserData(sender.Id);
            bool     rs   = await user.Fetch();

            if (rs)
            {
                Console.WriteLine(user.err);
                return;
            }

            MatchPlayer player  = new MatchPlayer(user);
            bool        didJoin = MatchMaker.Join(player);

            if (!didJoin)
            {
                return;
            }

            await ReplyAsync($"{sender.Username} has joined the queue! Position {player.joinSlot}");
        }
        public GameServer()
        {
            var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());

            XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));

            Log.Info("Initializing SabberStone GameServer!");

            _gameServer                 = new TcpServer(2010, "127.0.0.1");
            _gameServer.OnConnected    += OnConnected;
            _gameServer.OnDisconnected += OnDisconnected;
            _gameServer.OnReceived     += OnReceived;
            _gameServer.OnException    += OnException;
            _gameServer.OnStarted      += OnStarted;
            _gameServer.OnStopped      += OnStopped;

            _id    = 1;        // server id
            _token = "server"; // server token

            _registredUsers = new ConcurrentDictionary <string, UserInfoData>();

            _matchMaker = new MatchMaker(this);
        }
    public IEnumerator JoinQueueRead()
    {
        WWWForm form = new WWWForm();

        form.AddField("PlayerPost", AccountManager.GetComponent <SqlManager>().Username);

        WWW www = new WWW(SqlManager.url + "JoinQueueRead.php", form);

        yield return(www);

        if (www.text == "Join")
        {
            AccountManager.GetComponent <SqlManager>().inQueue = true;
            MatchMaker matchMaker = GameObject.Find("NetworkManager").GetComponent <MatchMaker>();
            matchMaker.QueueObject.SetActive(true);
            StartCoroutine(matchMaker.ListPlayerInQueue());
            StartCoroutine(LeaveQueueRead());
            yield break;
        }

        yield return(new WaitForSeconds(1.5f));

        StartCoroutine(JoinQueueRead());
    }
    public IEnumerator LeaveQueueRead()
    {
        WWWForm form = new WWWForm();

        form.AddField("PlayerPost", AccountManager.GetComponent <SqlManager>().Username);

        WWW www = new WWW(SqlManager.url + "LeaveQueueRead.php", form);

        yield return(www);

        if (www.text == "Leave")
        {
            MatchMaker matchMaker = GameObject.Find("NetworkManager").GetComponent <MatchMaker>();
            matchMaker.QueueObject.SetActive(false);
            matchMaker.TimerMinutesFloat = 0;
            matchMaker.TimerSecondFloat  = 0;
            StartCoroutine(JoinQueueRead());
            yield break;
        }

        yield return(new WaitForSeconds(1.5f));

        StartCoroutine(LeaveQueueRead());
    }
 internal void AddMatchMaker(MatchMaker mkr)
 {
     this.innerMatch.Add(mkr);
 }
Beispiel #20
0
 public string GetMyPlayerName()
 {
     return(MatchMaker.IsPlayerOne() ? nameP1 : nameP2);
 }
Beispiel #21
0
    //Host Game
    public void HostGame(string playerDisplayName)
    {
        string matchId = MatchMaker.GetRandomMatchID();

        CmdHostGame(matchId, playerDisplayName);
    }
Beispiel #22
0
 private void Start()
 {
     instance = this;
 }
Beispiel #23
0
 void Awake()
 {
     //SetOfflineMode();
     if(instance)
         DestroyImmediate(gameObject);
     else
     {
         DontDestroyOnLoad(gameObject);
         instance = this;
     }
 }
Beispiel #24
0
 public async Task LeaveDefaultAsync()
 {
     MatchMaker.Leave(Context.User.Id);
     await ReplyAsync($"{Context.User.Username} has left the queue!");
 }
Beispiel #25
0
 public abstract void GetInformation(MatchMaker otherMatchMaker);
        protected void MatchLetterWithCurrent(LetterNode l, List<INode> results, MatchMaker current)
        {
            Constants.Debug("MatchSetBase.MatchLetterWithCurrent.Enter");
            DebugCounts.CallFunction("MatchSetBase.MatchLetterWithCurrent");

            bool anyMatch = false;
            LetterNode resultLetter = LetterNode.GetInstance(l.Letter);

            if (current.IsMatchComplete())
            {
                this.Next();
                anyMatch = MatchAndMerge(l, resultLetter) || anyMatch;
                this.Prev();
            }
            else
            {
                // we probably should not hit this case-
                // if the current matcher is not complete, but it is still open.
                // ie. it has not matched enough, but it cannot match any more.

                if (!current.IsMatchOpen())
                {
                    this.Next();
                    anyMatch = MatchAndMerge(l, resultLetter) || anyMatch;
                    this.Prev();
                }
            }

            if (current.IsMatchOpen())
            {
                anyMatch = MatchAndMerge(l, resultLetter) || anyMatch;
            }

            if (anyMatch)
            {
                DebugCounts.CallFunction("MatchSetBase.MatchLetterWithCurrent.AnyMatchTrue");
                results.Add(resultLetter);
            }
            Constants.Debug("MatchSetBase.MatchLetterWithCurrent.Exit");
        }
Beispiel #27
0
 public Introducer(MatchMaker man, MatchMaker woman)
 {
     m_man   = man;
     m_woman = woman;
 }
    /*
     * HOST GAME
     */

    public void HostGame(bool publicMatch)
    {
        string matchID = MatchMaker.GetRandomMatchID();

        CmdHostGame(matchID, publicMatch);
    }
Beispiel #29
0
    public void HostGame()
    {
        string matchID = MatchMaker.GetRandomMatchID();

        CmdHostGame(matchID);
    }
Beispiel #30
0
 public MatchMaker()
 {
     instance = this;
 }
Beispiel #31
0
 void Start()
 {
     instance = this;
 }
Beispiel #32
0
 public override void GetInformation(MatchMaker otherMatchMaker)
 {
     m_favor += -otherMatchMaker.m_age * 3 + otherMatchMaker.m_money + otherMatchMaker.m_familyBg * 2;
 }
Beispiel #33
0
 /// <summary>
 /// Starts the MatchMaker.
 /// </summary>
 void Start()
 {
     lanDiscovery.Initialize();
     instance = this;
     NetworkManager.singleton.StartMatchMaker();
 }
        public virtual string Replace(string content, object state)
        {
            if (content == null)
            {
                return(content);
            }
            string result = content;

            var matchmaker = new MatchMaker()
            {
                MatchThreshold = MatchThreshold, IgnoreDuplicateMatches = IgnoreDuplicateMatches
            };

            if (matchmaker.Process(content, RegEx))
            {
                //var matches = PreFilterMatches(Regex.Matches(content, RegEx, RegexOptions.IgnoreCase));

                string[] escapeBlocks = { "~~~", "`" };

                int offset = 0;

                //List<string> matchvalues = new List<string>();
                //List<Match> processedMatches = new List<Match>();
                //int maxIndex = (MatchThreshold > 0) ? Math.Min(MatchThreshold, matches.Count) : matches.Count;

                //flag content as having ignored areas if it has more than 1 match
                bool requiresAdditionalProcecessing = (matchmaker.Matches.Count() > 0) ? HasAnyTokens(content, escapeBlocks) : false;

                foreach (Match m in matchmaker.FilteredMatches)
                {
                    //Match m = matches[i];

                    //make sure this match isn't in a block
                    if (!requiresAdditionalProcecessing || (requiresAdditionalProcecessing && !IsInBlock(m, content, escapeBlocks)))
                    {
                        //make sure this match isn't in an anchor
                        if (!IsInMarkDownAnchor(m, content))
                        {
                            //if (!IgnoreDuplicateMatches || IgnoreDuplicateMatches && !IsDuplicate(m, processedMatches))
                            //{
                            //get the replacement value for match
                            string substitution = _replacementFunc(m, content, state);

                            //Concat method (fractions of milliseconds faster)
                            result = String.Concat(result.Substring(0, m.Index + offset), substitution, result.Substring(m.Index + m.Length + offset, result.Length - (m.Length + m.Index + offset)));

                            //Replace method
                            //result = result.Remove(m.Index + offset, m.Length).Insert(m.Index + offset, substitution);

                            offset += substitution.Length - m.Length;

                            //processedMatches.Add(m);
                            //}
                        }
                    }
                }
            }



            return(result);
        }
 internal void AddAvailableLetter(MatchMaker mkr)
 {
     this.available.Add(mkr);
 }