예제 #1
0
        public PlayerViewModel(Player player, Notifier notifier)
        {
            this.player = player;
            notifier.SubscribeToViewModel(this);

            Icons icons = new Icons();
            switch (player.Role)
            {
                case "Dispatcher":
                    pawn = icons["pawnPurple"];
                    break;
                case "Medic":
                    pawn = icons["pawnOrange"];
                    break;
                case "Scientist":
                    pawn = icons["pawnWhite"];
                    break;
                case "Quarantine Specialist":
                    pawn = icons["pawnDarkGreen"];
                    break;
                case "Researcher":
                    pawn = icons["pawnBrown"];
                    break;
                case "Operations Expert":
                    pawn = icons["pawnGreen"];
                    break;
            }
        }
 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     if (value == null)
         return null;
     Disease disease = (Disease)value;
     Icons icons = new Icons();
     switch(disease.Type)
     {
         case DiseaseType.Yellow:
             return icons["compoundYellow"];
         case DiseaseType.Red:
             return icons["compoundRed"];
         case DiseaseType.Blue:
             return icons["compoundBlue"];
         case DiseaseType.Black:
             return icons["compoundBlack"];
     }
     return null;
 }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string role = (string)value;
            Icons icons = new Icons();
            switch (role)
            {
                case "Dispatcher":
                    return icons["pawnPurple"];
                case "Medic":
                    return icons["pawnOrange"];
                case "Scientist":
                    return icons["pawnWhite"];
                case "Quarantine Specialist":
                    return icons["pawnDarkGreen"];
                case "Researcher":
                    return icons["pawnBrown"];
                case "Operations Expert":
                    return icons["pawnGreen"];
            }

            return icons["pawnWhite"];
        }
 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     if (value == null)
         return null;
     Disease disease = (Disease)value;
     Icons icons = new Icons();
     if(disease.IsCured)
     {
         switch (disease.Type)
         {
             case DiseaseType.Yellow:
                 return icons["curedYellow"];
             case DiseaseType.Red:
                 return icons["curedRed"];
             case DiseaseType.Blue:
                 return icons["curedBlue"];
             case DiseaseType.Black:
                 return icons["curedBlack"];
         }
     }
     else if(disease.IsEradicated)
     {
         switch (disease.Type)
         {
             case DiseaseType.Yellow:
                 return icons["eradicatedYellow"];
             case DiseaseType.Red:
                 return icons["eradicatedRed"];
             case DiseaseType.Blue:
                 return icons["eradicatedBlue"];
             case DiseaseType.Black:
                 return icons["eradicatedBlack"];
         }
     }
     return null;
 }
        private void Ndc_Infected(object sender, Engine.CustomEventArgs.InfectionEventArgs e)
        {
            IAnchorViewModel avm = boardViewModel.AnchorViewModels.Single(i => i.Node == e.NodeDiseaseCounter.Node);
            Left = avm.Left;
            Top = avm.Top;
            ScaleX = 0;
            ScaleY = 0;
            Translate = 0;
            timer.Stop();
            animationTimer.Stop();
            InfectedCity = e.NodeDiseaseCounter.Node.City;
            InfectionCount = e.NodeDiseaseCounter.Count;

            Icons icons = new Icons();
            switch (e.NodeDiseaseCounter.Disease.Type)
            {
                case DiseaseType.Yellow:
                    InfectionIcon = icons["compoundYellow"];
                    break;
                case DiseaseType.Red:
                    InfectionIcon = icons["compoundRed"];
                    break;
                case DiseaseType.Blue:
                    InfectionIcon = icons["compoundBlue"];
                    break;
                case DiseaseType.Black:
                    InfectionIcon = icons["compoundBlack"];
                    break;
            }

            BannerVisibility = System.Windows.Visibility.Visible;
            timer.Start();
            animationTimer.Start();
        }
예제 #6
0
        private void SelectedPlayer_ContextChanged(object sender, ContextChangedEventArgs<Player> e)
        {
            Icons icons = new Icons();
            switch (selectedPlayer.Context.Role)
            {
                case "Dispatcher":
                    content = icons["pawnPurple"];
                    break;
                case "Medic":
                    content = icons["pawnOrange"];
                    break;
                case "Scientist":
                    content = icons["pawnWhite"];
                    break;
                case "Quarantine Specialist":
                    content = icons["pawnDarkGreen"];
                    break;
                case "Researcher":
                    content = icons["pawnBrown"];
                    break;
                case "Operations Expert":
                    content = icons["pawnGreen"];
                    break;
            }

            Point location = GetLocation();
            Left = location.X;
            Top = location.Y;

            NotifyPropertyChanged("Content");
        }
예제 #7
0
 private IEnumerable<IAnchorViewModel> CreateAnchorViewModels(IEnumerable<Node> nodes, IEnumerable<NodeDiseaseCounter> diseaseCounters, Notifier notifier)
 {
     Icons icons = new Icons();
     List<AnchorViewModel> anchorViewModels = new List<AnchorViewModel>();
     foreach (Node node in nodes)
     {
         switch(node.City.Name)
         {
             case "Atlanta":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 1400, Top = 1400, Background = Brushes.Blue, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Montreal":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 1625, Top = 1175, Background = Brushes.Blue, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Chicago":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 1325, Top = 1125, Background = Brushes.Blue, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "San Francisco":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 800, Top = 1200, Background = Brushes.Blue, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "New York":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 1950, Top = 1200, Background = Brushes.Blue, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Washington":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 1800, Top = 1350, Background = Brushes.Blue, ContentForeground = Brushes.White, NameplateFontSize = 13, Fill = Brushes.White });
                 break;
             case "London":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 2625, Top = 1025, Background = Brushes.Blue, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Madrid":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 2600, Top = 1300, Background = Brushes.Blue, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Paris":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 2900, Top = 1175, Background = Brushes.Blue, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Milan":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 3150, Top = 1125, Background = Brushes.Blue, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "St. Petersburg":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 3325, Top = 900, Background = Brushes.Blue, ContentForeground = Brushes.White, NameplateFontSize = 12, Fill = Brushes.White });
                 break;
             case "Essen":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 2975, Top = 975, Background = Brushes.Blue, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Miami":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 1600, Top = 1575, Background = Brushes.Yellow, ContentForeground = Brushes.Black, Fill = Brushes.Black });
                 break;
             case "Los Angeles":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 800, Top = 1525, Background = Brushes.Yellow, ContentForeground = Brushes.Black, Fill = Brushes.Black });
                 break;
             case "Mexico City":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 1100, Top = 1600, Background = Brushes.Yellow, ContentForeground = Brushes.Black, Fill = Brushes.Black });
                 break;
             case "Lima":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 1450, Top = 2300, Background = Brushes.Yellow, ContentForeground = Brushes.Black, Fill = Brushes.Black });
                 break;
             case "Santiago":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 1525, Top = 2600, Background = Brushes.Yellow, ContentForeground = Brushes.Black, Fill = Brushes.Black });
                 break;
             case "Bogota":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 1600, Top = 1900, Background = Brushes.Yellow, ContentForeground = Brushes.Black, Fill = Brushes.Black });
                 break;
             case "Sao Paulo":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 2125, Top = 2275, Background = Brushes.Yellow, ContentForeground = Brushes.Black, Fill = Brushes.Black });
                 break;
             case "Buenos Aires":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 1900, Top = 2525, Background = Brushes.Yellow, ContentForeground = Brushes.Black, Fill = Brushes.Black });
                 break;
             case "Lagos":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 2800, Top = 1875, Background = Brushes.Yellow, ContentForeground = Brushes.Black, Fill = Brushes.Black });
                 break;
             case "Khartoum":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 3300, Top = 1825, Background = Brushes.Yellow, ContentForeground = Brushes.Black, NameplateFontSize = 14, Fill = Brushes.Black });
                 break;
             case "Kinshasa":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 3100, Top = 2100, Background = Brushes.Yellow, ContentForeground = Brushes.Black, Fill = Brushes.Black });
                 break;
             case "Johannesburg":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 3350, Top = 2375, Background = Brushes.Yellow, ContentForeground = Brushes.Black, NameplateFontSize = 11, Fill = Brushes.Black });
                 break;
             case "Algiers":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 2900, Top = 1450, Background = Brushes.Black, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Cairo":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 3300, Top = 1550, Background = Brushes.Black, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Moscow":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 3550, Top = 1100, Background = Brushes.Black, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Istanbul":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 3300, Top = 1275, Background = Brushes.Black, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Baghdad":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 3550, Top = 1400, Background = Brushes.Black, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Tehran":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 3900, Top = 1250, Background = Brushes.Black, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Karachi":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 4000, Top = 1550, Background = Brushes.Black, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Delhi":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 4200, Top = 1400, Background = Brushes.Black, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Riyadh":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 3625, Top = 1675, Background = Brushes.Black, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Mumbai":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 4075, Top = 1750, Background = Brushes.Black, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Chennai":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 4300, Top = 1875, Background = Brushes.Black, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Kolkata":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 4525, Top = 1500, Background = Brushes.Black, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Shanghai":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 4725, Top = 1275, Background = Brushes.Red, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Beijing":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 4750, Top = 1000, Background = Brushes.Red, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Seoul":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 5000, Top = 1050, Background = Brushes.Red, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Tokyo":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 5250, Top = 1200, Background = Brushes.Red, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Hong Kong":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 4775, Top = 1600, Background = Brushes.Red, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Bangkok":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 4575, Top = 1750, Background = Brushes.Red, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Taipei":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 5100, Top = 1600, Background = Brushes.Red, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Osaka":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 5400, Top = 1475, Background = Brushes.Red, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Ho Chi Minh City":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 4825, Top = 1925, Background = Brushes.Red, ContentForeground = Brushes.White, NameplateFontSize = 15, Fill = Brushes.White });
                 break;
             case "Manila":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 5175, Top = 1950, Background = Brushes.Red, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Jakarta":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 4600, Top = 2125, Background = Brushes.Red, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
             case "Sydney":
                 anchorViewModels.Add(new AnchorViewModel(node, diseaseCounters.Where(i => i.Node == node), this, notifier) { Left = 5350, Top = 2600, Background = Brushes.Red, ContentForeground = Brushes.White, Fill = Brushes.White });
                 break;
         }
     }
     return anchorViewModels;
 }