Beispiel #1
0
 public void SetPlayer(JobPlayer player, Job job)
 {
     Player = player;
     Job    = job;
     // Fade out labels and images
     ((Storyboard)FindResource("fade_out")).Begin(tbName);
     ((Storyboard)FindResource("fade_out")).Begin(bdIcon);
     salGoldie.SetSalmoniod(Salmoniod.Key.goldie);
     salSteelhead.SetSalmoniod(Salmoniod.Key.steelhead);
     salFlyfish.SetSalmoniod(Salmoniod.Key.flyfish);
     salScrapper.SetSalmoniod(Salmoniod.Key.scrapper);
     salSteelEel.SetSalmoniod(Salmoniod.Key.steel_eel);
     salStinger.SetSalmoniod(Salmoniod.Key.stinger);
     salMaws.SetSalmoniod(Salmoniod.Key.maws);
     salGriller.SetSalmoniod(Salmoniod.Key.griller2);
     salDrizzler.SetSalmoniod(Salmoniod.Key.drizzler);
     if (Player != null && Job != null)
     {
         // Update player
         tbName.Text = Player.Nickname;
         ((Storyboard)FindResource("fade_in")).Begin(tbName);
         string image = FileFolderUrl.ApplicationData + FileFolderUrl.IconFolder + @"\" + System.IO.Path.GetFileName(Player.Image) + ".jpg";
         try
         {
             ImageBrush brush = new ImageBrush(new BitmapImage(new Uri(image)));
             brush.Stretch     = Stretch.UniformToFill;
             bdIcon.Background = brush;
             ((Storyboard)FindResource("fade_in")).Begin(bdIcon);
         }
         catch
         {
             // Download the image
             Downloader downloader = new Downloader(Player.Image, image, Downloader.SourceType.Player, Depot.Proxy);
             DownloadHelper.AddDownloader(downloader, new DownloadCompletedEventHandler(() =>
             {
                 if (System.IO.Path.GetFileName(image) == System.IO.Path.GetFileName(Player.Image) + ".jpg")
                 {
                     ImageBrush brush  = new ImageBrush(new BitmapImage(new Uri(image)));
                     brush.Stretch     = Stretch.UniformToFill;
                     bdIcon.Background = brush;
                     ((Storyboard)FindResource("fade_in")).Begin(bdIcon);
                 }
             }));
         }
         // Update salmoniods
         salGoldie.SetSalmoniod(Salmoniod.Key.goldie, Player, Job);
         salSteelhead.SetSalmoniod(Salmoniod.Key.steelhead, Player, Job);
         salFlyfish.SetSalmoniod(Salmoniod.Key.flyfish, Player, Job);
         salScrapper.SetSalmoniod(Salmoniod.Key.scrapper, Player, Job);
         salSteelEel.SetSalmoniod(Salmoniod.Key.steel_eel, Player, Job);
         salStinger.SetSalmoniod(Salmoniod.Key.stinger, Player, Job);
         salMaws.SetSalmoniod(Salmoniod.Key.maws, Player, Job);
         salGriller.SetSalmoniod(Salmoniod.Key.griller2, Player, Job);
         salDrizzler.SetSalmoniod(Salmoniod.Key.drizzler, Player, Job);
     }
 }
Beispiel #2
0
        public void SetSalmoniod(Salmoniod.Key salmoniod, JobPlayer player = null, Job job = null)
        {
            Salmoniod = salmoniod;
            Player    = player;
            Job       = job;
            ((Storyboard)FindResource("fade_out")).Begin(gridMain);
            Storyboard sb = (Storyboard)FindResource("resize_width");

            (sb.Children[0] as DoubleAnimation).To = 0;
            sb.Begin(bdRatio);
            ((Storyboard)FindResource("fade_out")).Begin(bdRatio);
            if (Salmoniod != Class.Salmoniod.Key.salmoniod_unknown && Player != null && Job != null)
            {
                lbName.SetResourceReference(ContentProperty, Salmoniod.ToString());
                int kill     = Player.SalmoniodKills.Find(p => p.Salmoniod == Salmoniod).Count;
                int jobKill  = Job.GetSalmoniodKill(Salmoniod);
                int jobCount = Job.SalmoniodAppearances.Find(p => p.Salmoniod == Salmoniod).Count;
                if (jobKill == jobCount && jobKill != 0)
                {
                    lbName.Foreground      = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF" + Design.NeonYellow));
                    lbKill.Foreground      = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF" + Design.NeonYellow));
                    lbKillShort.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF" + Design.NeonYellow));
                }
                else
                {
                    lbName.Foreground      = new SolidColorBrush(Colors.White);
                    lbKill.Foreground      = new SolidColorBrush(Colors.White);
                    lbKillShort.Foreground = new SolidColorBrush(Colors.White);
                }
                lbKill.Content      = string.Format(Translate("x{0}/{1}/{2}", true), kill, jobKill, jobCount);
                lbKillShort.Content = string.Format(Translate("x{0}", true), kill);
                ((Storyboard)FindResource("fade_in")).Begin(gridMain);
                if (jobKill != 0)
                {
                    double to = (kill * 0.9 / jobKill + 0.1) * bdMain.Width;
                    (sb.Children[0] as DoubleAnimation).To = to;
                    sb.Begin(bdRatio);
                    ((Storyboard)FindResource("fade_in")).Begin(bdRatio);
                }
                else
                {
                    double to = 0.1 * bdMain.Width;
                    (sb.Children[0] as DoubleAnimation).To = to;
                    sb.Begin(bdRatio);
                    ((Storyboard)FindResource("fade_in")).Begin(bdRatio);
                }
            }
        }
Beispiel #3
0
        public void SetPlayer(JobPlayer player)
        {
            Player = player;
            ((Storyboard)FindResource("fade_out")).Begin(gridMain);
            ((Storyboard)FindResource("fade_out")).Begin(bdIcon);
            ((Storyboard)FindResource("fade_out")).Begin(bdSpecialWeapon);
            wp1.SetWeapon(null);
            wp2.SetWeapon(null);
            wp3.SetWeapon(null);
            ((Storyboard)FindResource("bg_to_black")).Begin(bdMain);
            if (Player != null)
            {
                // Background change
                if (Player.IsSelf)
                {
                    ((Storyboard)FindResource("bg_to_white")).Begin(bdMain);
                }
                // Icon
                string image = FileFolderUrl.ApplicationData + FileFolderUrl.IconFolder + @"\" + System.IO.Path.GetFileName(Player.Image) + ".jpg";
                try
                {
                    ImageBrush brush = new ImageBrush(new BitmapImage(new Uri(image)));
                    brush.Stretch     = Stretch.UniformToFill;
                    bdIcon.Background = brush;
                    ((Storyboard)FindResource("fade_in")).Begin(bdIcon);
                }
                catch
                {
                    // Download the image
                    Downloader downloader = new Downloader(Player.Image, image, Downloader.SourceType.Job, Depot.Proxy);
                    DownloadHelper.AddDownloader(downloader, new DownloadCompletedEventHandler(() =>
                    {
                        if (Player != null)
                        {
                            if (System.IO.Path.GetFileName(image) == System.IO.Path.GetFileName(Player.Image) + ".jpg")
                            {
                                ImageBrush brush  = new ImageBrush(new BitmapImage(new Uri(image)));
                                brush.Stretch     = Stretch.UniformToFill;
                                bdIcon.Background = brush;
                                ((Storyboard)FindResource("fade_in")).Begin(bdIcon);
                            }
                        }
                    }));
                }
                // Nickname
                tbNickname.Text = Player.Nickname;
                // Weapons
                wp1.SetWeapon(Player.Weapons[0]);
                if (Player.Weapons.Count > 1)
                {
                    wp2.SetWeapon(Player.Weapons[1]);
                    if (Player.Weapons.Count > 2)
                    {
                        wp3.SetWeapon(Player.Weapons[2]);
                    }
                }
                // Special
                string image2 = FileFolderUrl.ApplicationData + Player.Weapons[0].SpecialWeapon.Image1;
                try
                {
                    ImageBrush brush = new ImageBrush(new BitmapImage(new Uri(image2)));
                    brush.Stretch = Stretch.UniformToFill;
                    bdSpecialWeapon.Background = brush;
                    ((Storyboard)FindResource("fade_in")).Begin(bdSpecialWeapon);
                }
                catch
                {
                    // Download the image
                    Downloader downloader = new Downloader(FileFolderUrl.SplatNet + Player.Weapons[0].SpecialWeapon.Image1, image2, Downloader.SourceType.Battle, Depot.Proxy);
                    DownloadHelper.AddDownloader(downloader, new DownloadCompletedEventHandler(() =>
                    {
                        if (Player != null)
                        {
                            if (System.IO.Path.GetFileName(image2) == System.IO.Path.GetFileName(Player.Weapons[0].SpecialWeapon.Image1))
                            {
                                ImageBrush brush           = new ImageBrush(new BitmapImage(new Uri(image2)));
                                brush.Stretch              = Stretch.UniformToFill;
                                bdSpecialWeapon.Background = brush;
                                ((Storyboard)FindResource("fade_in")).Begin(bdSpecialWeapon);
                            }
                        }
                    }));
                }
                // Golden egg, power egg, save, dead
                lbGoldenEgg.Content = string.Format(Translate("x{0}", true), Player.GoldenEgg);
                lbPowerEgg.Content  = string.Format(Translate("x{0}", true), Player.PowerEgg);
                lbHelp.Content      = string.Format(Translate("x{0}", true), Player.Help);
                lbDead.Content      = string.Format(Translate("x{0}", true), Player.Dead);
                switch (player.Species)
                {
                case JobPlayer.SpeciesType.inklings:
                    ((Storyboard)FindResource("fade_in")).Begin(imgInklingsSave);
                    ((Storyboard)FindResource("fade_in")).Begin(imgInklingsDead);
                    ((Storyboard)FindResource("fade_out")).Begin(imgOctolingsSave);
                    ((Storyboard)FindResource("fade_out")).Begin(imgOctolingsDead);
                    break;

                case JobPlayer.SpeciesType.octolings:
                    ((Storyboard)FindResource("fade_in")).Begin(imgOctolingsSave);
                    ((Storyboard)FindResource("fade_in")).Begin(imgOctolingsDead);
                    ((Storyboard)FindResource("fade_out")).Begin(imgInklingsSave);
                    ((Storyboard)FindResource("fade_out")).Begin(imgInklingsDead);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                // Show all
                ((Storyboard)FindResource("fade_in")).Begin(gridMain);
            }
        }
Beispiel #4
0
        private void JobNotifying()
        {
            if (Depot.Notification)
            {
                Job job = Depot.Job;
                // Send job notification
                DateTime endTime  = job.StartTime.AddSeconds(60 * 7);
                double   diffTime = (DateTime.Now - endTime).TotalSeconds;
                if (diffTime <= 300)
                {
                    // Format title
                    string title;
                    if (job.IsClear)
                    {
                        title = string.Format(Translate("{0}_(No._{1})", true), Translate("clear", true), Translate(job.Number.ToString()));
                    }
                    else
                    {
                        title = string.Format(Translate("{0}_(No._{1})", true), Translate("defeat", true), Translate(job.Number.ToString()));
                    }
                    // Format content
                    string content = Translate(job.Stage.Id.ToString());
                    // Format scoreTitle
                    string scoreTitle;
                    if (job.HazardLevel == 200)
                    {
                        scoreTitle = string.Format("{0} {1}{2}", Translate("hazard_level", true), Translate("max", true), Translate("%", true));
                    }
                    else
                    {
                        scoreTitle = string.Format("{0} {1}{2}", Translate("hazard_level", true), job.HazardLevel.ToString(), Translate("%", true));
                    }
                    // Format status and value string
                    string goldenEgg = job.GoldenEgg.ToString();
                    string quota     = job.Quota.ToString();
                    // Format ratio
                    double ratio = 0;
                    if (job.IsClear)
                    {
                        ratio = 1;
                    }
                    else
                    {
                        switch (job.FailureWave)
                        {
                        case 1:
                            ratio = job.Waves[0].GoldenEgg * 1.0 / job.Waves[0].Quota;
                            break;

                        case 2:
                            ratio = 1.0 / 3 + job.Waves[1].GoldenEgg * 1.0 / job.Waves[1].Quota;
                            break;

                        case 3:
                            ratio = 2.0 / 3 + job.Waves[2].GoldenEgg * 1.0 / job.Waves[2].Quota;
                            break;

                        default:
                            throw new ArgumentOutOfRangeException();
                        }
                    }
                    // Get player icon
                    JobPlayer player = job.MyPlayer;
                    string    image  = FileFolderUrl.ApplicationData + FileFolderUrl.IconFolder + @"\" + System.IO.Path.GetFileName(player.Image) + ".jpg";
                    try
                    {
                        // Show notification
                        NotificationHelper.SendJobNotification(title, content, scoreTitle, goldenEgg, quota, ratio, image);
                    }
                    catch
                    {
                        // Download the image
                        Downloader downloader = new Downloader(player.Image, image, Downloader.SourceType.Battle, Depot.Proxy);
                        DownloadHelper.AddDownloader(downloader, new DownloadCompletedEventHandler(() =>
                        {
                            if (player != null)
                            {
                                if (System.IO.Path.GetFileName(image) == System.IO.Path.GetFileName(player.Image) + ".jpg")
                                {
                                    // Show notification
                                    NotificationHelper.SendJobNotification(title, content, scoreTitle, goldenEgg, quota, ratio, image);
                                }
                            }
                        }));
                    }
                }
            }
        }