Beispiel #1
0
        private void ginfo_Click(object sender, EventArgs e)
        {
            try
            {
                RiotSharp.Region lolregsharp = RiotTool.PlatformToRegion(CurrentGame.platformId.ToUpper());
                long             sid         = Program.MainFormInstance.API.GetSummoner(lolregsharp, CurrentGame.participants[0].summonerName).Id;

                RootObject rg = Program.MainFormInstance.API.GetCurrentGame(lolregsharp, sid, CurrentGame.platformId.ToUpper());
                UpdateCurrentGameInvoker u = new UpdateCurrentGameInvoker(Program.MainFormInstance.currentGame1.LoadGame);
                u.BeginInvoke(rg, Program.MainFormInstance.API, lolregsharp, 0, null, null);
                Program.MainFormInstance.MainTabControl.SelectedTab = Program.MainFormInstance.GameInfoTab;
            }
            catch
            {
            }
        }
        void LoadEvents()
        {
            try
            {
                string cachefile = Application.StartupPath + @"\Temp\" + META.gameKey.gameId + "-" + META.gameKey.platformId + ".cached";


                StringBuilder sb = new StringBuilder();
                RiotSharp.StaticDataEndpoint.ItemListStatic items = RiotSharp.StaticRiotApi.GetInstance(SettingsManager.Settings.ApiKey).GetItems(RiotTool.PlatformToRegion(META.gameKey.platformId));
                RiotSharp.MatchEndpoint.MatchDetail         m     = Program.MainFormInstance.API.GetMatch(RiotTool.PlatformToRegion(META.gameKey.platformId), META.gameKey.gameId, true, cachefile, true);
                foreach (Participant p in m.Participants)
                {
                    parts.Add(p.ParticipantId, FindParticipant(p.ChampionId, p.TeamId));
                }


                foreach (Frame f in m.Timeline.Frames)
                {
                    sb.AppendLine("***" + string.Format("{0:0}:{1:00}", f.Timestamp.Minutes, f.Timestamp.Seconds) + "***********************************************************************************");
                    if (f.Events != null)
                    {
                        foreach (Event ev in f.Events)
                        {
                            sb.AppendLine(EventToString(ev, items));
                        }
                    }
                }
                metroTabControl1.Invoke(new MethodInvoker(delegate
                {
                    nsTextBox1.Text = sb.ToString();

                    metroTabControl1.TabPages.Add(metroTabPage4);
                    metroTabControl1.SelectedIndex = 0;
                }));
                sb.Length = 0;
                sb        = null;
            }
            catch
            {
            }
        }
        public void LoadGame(EndOfGameStats eog, GameMetaData meta, BasicInfo pi, bool bluewin)
        {
            try
            {
                //   RiotSharp.MatchEndpoint.MatchDetail m = Program.MainFormInstance.API.GetMatch(RiotTool.PlatformToRegion(meta.gameKey.platformId), (long)eog.GameId);

                TeamStats blueteam = new TeamStats();
                TeamStats redteam  = new TeamStats();
                BluePanel.Controls.Clear();
                RedPanel.Controls.Clear();
                if (!bluewin)
                {
                    metroLabel1.Text  = "Red Team Wins";
                    metroLabel1.Style = MetroFramework.MetroColorStyle.Red;
                }
                if (meta.gameKey.platformId != "PBE1")
                {
                    ginfo.Text = RiotTool.ToMapString((RiotSharp.MapType)pi.Map) + ", " + RiotTool.ToQueueString((QueueType)pi.Queue) + " - " + RiotTool.PlatformToRegion(meta.gameKey.platformId).ToString().ToUpper();
                }
                else
                {
                    ginfo.Text = eog.GameMode + ", " + eog.GameType.Replace("_", " ") + " - " + RiotTool.PlatformToRegion(meta.gameKey.platformId).ToString().ToUpper();
                }
                if (eog != null)
                {
                    foreach (PlayerParticipantStatsSummary p in eog.TeamPlayerParticipantStats)
                    {
                        Player2Ctrl p2 = new Player2Ctrl(p.TeamId == 200);

                        p2.LoadPlayer(p, p.SummonerName, p.SkinName, ref blueteam);
                        p2.Dock = DockStyle.Top;
                        if (p.TeamId == 100)
                        {
                            BluePanel.Controls.Add(p2);
                        }
                        else
                        {
                            RedPanel.Controls.Add(p2);
                        }
                    }
                    foreach (PlayerParticipantStatsSummary p in eog.OtherTeamPlayerParticipantStats)
                    {
                        Player2Ctrl p2 = new Player2Ctrl(p.TeamId == 200);

                        p2.LoadPlayer(p, p.SummonerName, p.SkinName, ref redteam);
                        p2.Dock = DockStyle.Top;
                        if (p.TeamId == 100)
                        {
                            BluePanel.Controls.Add(p2);
                        }
                        else
                        {
                            RedPanel.Controls.Add(p2);
                        }
                    }
                }

                bluewk.Text     = blueteam.WD.ToString();
                bluewp.Text     = blueteam.WP.ToString();
                bluecreeps.Text = blueteam.CREEPS.ToString();
                bluekda.Text    = blueteam.Kill + " / " + blueteam.Deaths + " / " + blueteam.Assists;
                bluetd.Text     = blueteam.TD.ToString();

                redwk.Text     = redteam.WD.ToString();
                redwp.Text     = redteam.WP.ToString();
                redcreeps.Text = redteam.CREEPS.ToString();
                redkda.Text    = redteam.Kill + " / " + redteam.Deaths + " / " + redteam.Assists;
                redtd.Text     = redteam.TD.ToString();

                BluePanel.Controls.Add(panel5);
                RedPanel.Controls.Add(panel4);
            }
            catch (Exception ex)
            {
                Logger.Instance.Log.Error("Failed to load game", ex);
            }
        }