コード例 #1
0
ファイル: Win_mmselect.xaml.cs プロジェクト: Mnuzz/sc2dsstats
        private void ProcessRows_player()
        {
            int itct = dg_player.Items.Count;

            for (int i = 0; i < itct; i++)
            {
                ///var row = dg_player.ItemContainerGenerator.ContainerFromItem(pl) as DataGridRow;

                dsplayer pl = dg_player.Items[i] as dsplayer;

                var row = dg_player.ItemContainerGenerator.ContainerFromIndex(i) as DataGridRow;
                if (row != null)
                {
                    if (MW.player_list.Contains(pl.NAME))
                    {
                        row.Background = Brushes.YellowGreen;
                    }
                    else if (pl.NAME == null)
                    {
                        row.Background = Brushes.Azure;
                    }
                    else
                    {
                        row.Background = Brushes.Yellow;
                    }
                }
            }
        }
コード例 #2
0
ファイル: dsreplay.cs プロジェクト: macisasandwich/sc2dsstats
        public override void AddGame(dsplayer pl, dsplayer opp)
        {
            dsstats_race cmdr = new dsstats_race();

            cmdr = this.objRace(pl.RACE);
            this.GAMES++;
            cmdr.RGAMES++;

            cmdr.DPS += pl.GetDPS();
            this.DPS += pl.GetDPS();

            cmdr.DPM += pl.GetDPM();
            this.DPM += pl.GetDPM();

            cmdr.DPV += pl.GetDPV();
            this.DPV += pl.GetDPV();


            dsstats_vs cmdr_vs = new dsstats_vs();

            cmdr_vs = cmdr.OPP;
            cmdr_vs.GAMES++;
            dsstats_race cmdr_opp = new dsstats_race();

            cmdr_opp = cmdr_vs.objRaceVS(opp.RACE);
            cmdr_opp.RGAMES++;

            cmdr_opp.DPS += pl.GetDPS();
            cmdr_opp.DPM += pl.GetDPM();
            cmdr_opp.DPV += pl.GetDPV();
        }
コード例 #3
0
ファイル: Win_regex.xaml.cs プロジェクト: Mnuzz/sc2dsstats
        private void Dg_player_MouseDoubleClick(object sender, RoutedEventArgs e)
        {
            Dictionary <string, int> units   = new Dictionary <string, int>();
            List <rxunit>            rxunits = new List <rxunit>();

            foreach (var dataItem in dg_player.SelectedItems)
            {
                dsplayer pl = new dsplayer();
                pl = dataItem as dsplayer;
                if (pl.UNITS.ContainsKey("ALL"))
                {
                    foreach (string unit in pl.UNITS["ALL"].Keys)
                    {
                        if (units.ContainsKey(unit))
                        {
                            units[unit] += pl.UNITS["ALL"][unit];
                        }
                        else
                        {
                            units.Add(unit, pl.UNITS["ALL"][unit]);
                        }
                    }
                }
            }
            foreach (string unit in units.Keys)
            {
                rxunits.Add(new rxunit(unit, units[unit]));
            }

            dg_units.ItemsSource = rxunits.OrderByDescending(o => o.COUNT);
        }
コード例 #4
0
ファイル: Win_regex.xaml.cs プロジェクト: Mnuzz/sc2dsstats
        private void dg_games_DClick(object sender, RoutedEventArgs e)
        {
            List <dsplayer>          temp    = new List <dsplayer>();
            Dictionary <string, int> units   = new Dictionary <string, int>();
            List <rxunit>            rxunits = new List <rxunit>();
            dsplayer pltemp = new dsplayer();

            foreach (var dataItem in dg_games.SelectedItems)
            {
                //myGame game = dataItem as myGame;
                dsreplay game = dataItem as dsreplay;
                pltemp.RACE = game.REPLAY;
                temp.Add(pltemp);
                foreach (dsplayer pl in game.PLAYERS)
                {
                    temp.Add(pl);
                    if (pl.UNITS.ContainsKey("ALL"))
                    {
                        foreach (string unit in pl.UNITS["ALL"].Keys)
                        {
                            if (units.ContainsKey(unit))
                            {
                                units[unit] += pl.UNITS["ALL"][unit];
                            }
                            else
                            {
                                units.Add(unit, pl.UNITS["ALL"][unit]);
                            }
                        }
                    }
                }
            }
            foreach (string unit in units.Keys)
            {
                rxunits.Add(new rxunit(unit, units[unit]));
            }

            dg_units.ItemsSource = rxunits.OrderByDescending(o => o.COUNT);

            if (temp.Count > 300)
            {
                pltemp.RACE = "Visibility limit is 300. Sorry.";
                List <dsplayer> bab = new List <dsplayer>();
                bab.Add(pltemp);

                dg_player.ItemsSource = bab;
            }
            else
            {
                dg_player.ItemsSource = temp;
            }

            if (temp.Count < 120)
            {
                dg_player.EnableRowVirtualization = false;

                Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle, new Action(ProcessRows_player));
            }
            //ProcessRows_player();
        }
コード例 #5
0
ファイル: dsreplay.cs プロジェクト: macisasandwich/sc2dsstats
        public override void AddWin(dsplayer pl, dsplayer opp)
        {
            dsstats_race cmdr = new dsstats_race();

            cmdr = this.objRace(pl.RACE);
            this.WINS++;
            cmdr.RWINS++;

            dsstats_vs cmdr_vs = new dsstats_vs();

            cmdr_vs = cmdr.OPP;
            cmdr_vs.WINS++;
            dsstats_race cmdr_opp = new dsstats_race();

            cmdr_opp = cmdr_vs.objRaceVS(opp.RACE);
            cmdr_opp.RWINS++;
        }
コード例 #6
0
ファイル: dsreplay.cs プロジェクト: macisasandwich/sc2dsstats
        public virtual void AddWin(dsplayer race, dsplayer opp_race)
        {
            dsstats_race cmdr = new dsstats_race();

            cmdr = this.objRace(race.RACE);
            this.WINS++;
            cmdr.RWINS++;

            dsstats_vs cmdr_vs = new dsstats_vs();

            cmdr_vs = cmdr.OPP;
            cmdr_vs.WINS++;
            dsstats_race cmdr_opp = new dsstats_race();

            cmdr_opp = cmdr_vs.objRaceVS(opp_race.RACE);
            cmdr_opp.RWINS++;
        }
コード例 #7
0
ファイル: dsreplay.cs プロジェクト: Mnuzz/sc2dsstats
        public List <dsplayer> GetOpponents(dsplayer pl)
        {
            List <dsplayer> opponents = new List <dsplayer>();

            foreach (dsplayer tm in PLAYERS)
            {
                if (pl.POS == tm.POS)
                {
                    continue;
                }
                if (pl.TEAM != tm.TEAM)
                {
                    opponents.Add(tm);
                }
            }

            return(opponents);
        }
コード例 #8
0
ファイル: dsreplay.cs プロジェクト: Mnuzz/sc2dsstats
        public List <dsplayer> GetTeammates(dsplayer pl)
        {
            List <dsplayer> teammates = new List <dsplayer>();

            foreach (dsplayer tm in PLAYERS)
            {
                if (pl.POS == tm.POS)
                {
                    continue;
                }
                if (pl.TEAM == tm.TEAM)
                {
                    teammates.Add(tm);
                }
            }

            return(teammates);
        }
コード例 #9
0
ファイル: dsreplay.cs プロジェクト: macisasandwich/sc2dsstats
        public virtual void AddGame(dsplayer race, dsplayer opp_race)
        {
            dsstats_race cmdr = new dsstats_race();

            cmdr = this.objRace(race.RACE);
            this.GAMES++;
            cmdr.RGAMES++;
            cmdr.AddGame(race.PDURATION);

            dsstats_vs cmdr_vs = new dsstats_vs();

            cmdr_vs = cmdr.OPP;
            cmdr_vs.GAMES++;
            dsstats_race cmdr_opp = new dsstats_race();

            cmdr_opp = cmdr_vs.objRaceVS(opp_race.RACE);
            cmdr_opp.RGAMES++;
            cmdr_opp.AddGame(race.PDURATION);
        }
コード例 #10
0
ファイル: Win_mmselect.xaml.cs プロジェクト: Mnuzz/sc2dsstats
        private void dg_games_DClick(object sender, RoutedEventArgs e)
        {
            List <dsplayer> temp   = new List <dsplayer>();
            dsplayer        pltemp = new dsplayer();

            foreach (var dataItem in dg_games.SelectedItems)
            {
                //myGame game = dataItem as myGame;
                dsreplay game = dataItem as dsreplay;
                pltemp.RACE = game.REPLAY;
                temp.Add(pltemp);
                foreach (dsplayer pl in game.PLAYERS)
                {
                    temp.Add(pl);
                }
            }

            if (temp.Count > 300)
            {
                pltemp.RACE = "Visibility ilmit is 300. Sorry.";
                List <dsplayer> bab = new List <dsplayer>();
                bab.Add(pltemp);

                dg_player.ItemsSource = bab;
            }
            else
            {
                dg_player.ItemsSource = temp;
            }

            if (temp.Count < 120)
            {
                dg_player.EnableRowVirtualization = false;

                Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle, new Action(ProcessRows_player));
            }
            //ProcessRows_player();
        }
コード例 #11
0
ファイル: dsreplay.cs プロジェクト: macisasandwich/sc2dsstats
        public dsplayer GetOpp(int pos)
        {
            string   opp   = null;
            dsplayer plopp = new dsplayer();

            if (this.PLAYERCOUNT == 6)
            {
                if (pos == 1)
                {
                    plopp = this.PLAYERS.Find(x => x.POS == 4);
                }
                if (pos == 2)
                {
                    plopp = this.PLAYERS.Find(x => x.POS == 5);
                }
                if (pos == 3)
                {
                    plopp = this.PLAYERS.Find(x => x.POS == 6);
                }
                if (pos == 4)
                {
                    plopp = this.PLAYERS.Find(x => x.POS == 1);
                }
                if (pos == 5)
                {
                    plopp = this.PLAYERS.Find(x => x.POS == 2);
                }
                if (pos == 6)
                {
                    plopp = this.PLAYERS.Find(x => x.POS == 3);
                }
                opp = plopp.RACE;
            }

            return(plopp);
        }
コード例 #12
0
ファイル: Win_mmselect.xaml.cs プロジェクト: Mnuzz/sc2dsstats
        public void SendRep(dsreplay game)
        {
            string result1 = "";
            string result2 = "";
            string result  = "unknown";

            if (game != null)
            {
                if (game.REPORTED == 0)
                {
                    int mmid = 0;
                    try
                    {
                        mmid = int.Parse(tb_rep_mmid.Text);
                    } catch { }


                    if (mmid > 0 && WM.MMIDS.Count > 0)
                    {
                        if (WM.MMIDS.ContainsKey(mmid) == true)
                        {
                        }
                        else
                        {
                            dsmmid id = new dsmmid();
                            id.MMID = mmid;
                            WM.MMIDS.Add(mmid, id);
                        }
                    }
                    else
                    {
                        dsmmid id = new dsmmid();
                        id.MMID = mmid;
                        WM.MMIDS.Add(mmid, id);
                    }

                    foreach (dsplayer player in game.PLAYERS)
                    {
                        if (player.POS <= game.PLAYERCOUNT / 2)
                        {
                            result1 += "(" + player.NAME + ", " + player.RACE + ", " + player.KILLSUM + ")";
                            if (player.POS != 3)
                            {
                                result1 += ", ";
                            }
                        }
                        else if (player.POS > game.PLAYERCOUNT / 2)
                        {
                            result2 += "(" + player.NAME + ", " + player.RACE + ", " + player.KILLSUM + ")";
                            if (player.POS != 6)
                            {
                                result2 += ", ";
                            }
                        }

                        dsplayer        plid  = new dsplayer();
                        List <dsplayer> ltemp = new List <dsplayer>(WM.MMIDS[mmid].REPORTS.Where(x => x.NAME == player.NAME).ToList());
                        if (ltemp.Count > 0)
                        {
                            plid           = ltemp.ElementAt(0);
                            plid.ARMY      = player.ARMY;
                            plid.INCOME    = player.INCOME;
                            plid.PDURATION = player.PDURATION;
                            plid.POS       = player.POS;
                            //plid.WINNER = player.WINNER;
                        }
                        else
                        {
                            WM.MMIDS[mmid].REPORTS.Add(player);
                        }
                    }
                    if (game.WINNER == 0)
                    {
                        result = result1 + " vs " + result2;
                    }
                    else if (game.WINNER == 1)
                    {
                        result = result2 + " vs " + result1;
                    }
                    result1 = "";
                    result2 = "";

                    WM.MMIDS[mmid].REPLAY   = game;
                    WM.MMIDS[mmid].DURATION = game.DURATION;

                    string smmid = game.MMID;
                    if (smmid == "0")
                    {
                        smmid = tb_rep_mmid.Text;
                    }
                    string response = WM.SendResult("mmid: " + mmid + "; result: " + result, game);
                    if (response == "sc2dsmm: Result: 0")
                    {
                    }
                    else
                    {
                        this.Close();
                    }
                }
            }
        }