Exemplo n.º 1
0
        private void UpdateEnabled(bool enabled)
        {
            if (enableRaisingEvents && !enabled)
            {
                if (pollThread != null)
                {
                    pollThread.Abort();
                    pollThread = null;

                    events  = null;
                    matches = null;
                    details = null;
                }
            }

            if (!enableRaisingEvents && enabled)
            {
                if (World == null)
                {
                    throw new Exception("World must be set before enabling GwWatcher");
                }

                pollThread = new Thread(PollMethod);
                pollThread.Start();
            }

            enableRaisingEvents = enabled;
        }
Exemplo n.º 2
0
        public GwMatchDetails GetMatchDetails(string matchId)
        {
            var request = new RestRequest(RequestUrls["MatchDetails"], Method.GET);

            request.AddParameter("match_id", matchId);
            var response = client.Execute <MatchDetailsResult>(request);

            var details = new GwMatchDetails(response.Data.match_id);
            var maps    = new List <GwMatchMap>();

            foreach (var m in response.Data.maps)
            {
                var map        = new GwMatchMap(details, m.type, m.scores);
                var objectives = new List <GwMatchObjective>();
                foreach (var o in m.objectives)
                {
                    objectives.Add(new GwMatchObjective(details, map, o.id, nameCache.GetObjective(o.id), o.owner));
                }
                map.Objectives = objectives.AsReadOnly();
                maps.Add(map);
            }
            details.Score = new GwMatchScore(response.Data.scores);
            details.Maps  = maps.AsReadOnly();
            return(details);
        }
Exemplo n.º 3
0
 public GwMatchObjective(GwMatchDetails details, GwMatchMap map, string id, string name, GwMatchTeam owner)
 {
     Details = details;
     Map     = map;
     Id      = id;
     Name    = name;
     Owner   = owner;
 }
Exemplo n.º 4
0
        private void CheckWvWDetailChanges()
        {
            var newDetails = World.Match.FetchDetails();

            if (details != null)
            {
                if (notifyFilter.HasFlag(GwNotifyFilter.WvWScore))
                {
                    if (details.Score != newDetails.Score)
                    {
                        if (WvWScoreChanged != null)
                        {
                            WvWScoreChanged(this, details, newDetails);
                        }
                    }
                }

                if (notifyFilter.HasFlag(GwNotifyFilter.WvWMapScore))
                {
                    for (var i = 0; i < details.Maps.Count; i++)
                    {
                        var o = details.Maps[i];
                        var n = newDetails.Maps[i];

                        if (o.Score != n.Score)
                        {
                            if (WvWMapScoreChanged != null)
                            {
                                WvWMapScoreChanged(this, o, n);
                            }
                        }
                    }
                }

                if (notifyFilter.HasFlag(GwNotifyFilter.WvWObjective))
                {
                    for (var i = 0; i < details.Maps.Count; i++)
                    {
                        var o = details.Maps[i];
                        var n = newDetails.Maps[i];

                        for (var j = 0; j < o.Objectives.Count; j++)
                        {
                            if (o.Objectives[j] != n.Objectives[j])
                            {
                                if (WvWObjectiveChanged != null)
                                {
                                    WvWObjectiveChanged(this, o.Objectives[j], n.Objectives[j]);
                                }
                            }
                        }
                    }
                }
            }

            details = newDetails;
        }
Exemplo n.º 5
0
 public GwMatchObjective(GwMatchDetails details, GwMatchMap map, string id, string name, GwMatchTeam owner)
 {
     Details = details;
     Map = map;
     Id = id;
     Name = name;
     Owner = owner;
 }
Exemplo n.º 6
0
 public GwMatchMap(GwMatchDetails details, string type, List<int> score)
 {
     Details = details;
     Type = type;
     Score = new GwMatchScore(score);
 }
Exemplo n.º 7
0
        private void UpdateEnabled(bool enabled)
        {
            if (enableRaisingEvents && !enabled)
            {
                if (pollThread != null)
                {
                    pollThread.Abort();
                    pollThread = null;

                    events = null;
                    matches = null;
                    details = null;
                }
            }

            if (!enableRaisingEvents && enabled)
            {
                if (World == null)
                {
                    throw new Exception("World must be set before enabling GwWatcher");
                }

                pollThread = new Thread(PollMethod);
                pollThread.Start();
            }

            enableRaisingEvents = enabled;
        }
Exemplo n.º 8
0
        private void CheckWvWDetailChanges()
        {
            var newDetails = World.Match.FetchDetails();

            if (details != null)
            {
                if (notifyFilter.HasFlag(GwNotifyFilter.WvWScore))
                {
                    if (details.Score != newDetails.Score)
                    {
                        if (WvWScoreChanged != null)
                            WvWScoreChanged(this, details, newDetails);
                    }
                }

                if (notifyFilter.HasFlag(GwNotifyFilter.WvWMapScore))
                {
                    for (var i = 0; i < details.Maps.Count; i++)
                    {
                        var o = details.Maps[i];
                        var n = newDetails.Maps[i];

                        if (o.Score != n.Score)
                        {
                            if (WvWMapScoreChanged != null)
                                WvWMapScoreChanged(this, o, n);
                        }
                    }
                }

                if (notifyFilter.HasFlag(GwNotifyFilter.WvWObjective))
                {
                    for (var i = 0; i < details.Maps.Count; i++)
                    {
                        var o = details.Maps[i];
                        var n = newDetails.Maps[i];

                        for (var j = 0; j < o.Objectives.Count; j++)
                        {
                            if (o.Objectives[j] != n.Objectives[j])
                            {
                                if (WvWObjectiveChanged != null)
                                    WvWObjectiveChanged(this, o.Objectives[j], n.Objectives[j]);
                            }
                        }
                    }
                }
            }

            details = newDetails;
        }
Exemplo n.º 9
0
        public GwMatchDetails GetMatchDetails(string matchId)
        {
            var request = new RestRequest(RequestUrls["MatchDetails"], Method.GET);
            request.AddParameter("match_id", matchId);
            var response = client.Execute<MatchDetailsResult>(request);

            var details = new GwMatchDetails(response.Data.match_id);
            var maps = new List<GwMatchMap>();
            foreach (var m in response.Data.maps)
            {
                var map = new GwMatchMap(details, m.type, m.scores);
                var objectives = new List<GwMatchObjective>();
                foreach (var o in m.objectives)
                {
                    objectives.Add(new GwMatchObjective(details, map, o.id, nameCache.GetObjective(o.id), o.owner));
                }
                map.Objectives = objectives.AsReadOnly();
                maps.Add(map);
            }
            details.Score = new GwMatchScore(response.Data.scores);
            details.Maps = maps.AsReadOnly();
            return details;
        }
Exemplo n.º 10
0
 public GwMatchMap(GwMatchDetails details, string type, List <int> score)
 {
     Details = details;
     Type    = type;
     Score   = new GwMatchScore(score);
 }