예제 #1
0
        protected override DashboardButton CreateButton(string buttonType)
        {
            DashboardButton button = null;

            if (buttonType == "Card")
            {
                button = new PenaltyCardButton {
                    PenaltyCard = new PenaltyCard("Red", Color.Red, CardShape.Rectangle)
                };
            }
            else if (buttonType == "Score")
            {
                button = new ScoreButton {
                    Score = new Score("Score", 1)
                };
            }
            else if (buttonType == "Timer")
            {
                button = new TimerButton {
                    Timer = new LMTimer {
                        Name = "Timer"
                    }
                };
            }
            else
            {
                button = base.CreateButton(buttonType);
            }
            return(button);
        }
        public void ViewModelFactoryService_CreateScoreButtonVM()
        {
            var model = new ScoreButton();
            var vm    = factoryService.CreateViewModel <DashboardButtonVM, DashboardButton> (model);

            Assert.IsTrue(vm is ScoreButtonVM);
        }
예제 #3
0
 public ScoreObject(ScoreButton score) : base(score)
 {
     Button = score;
     if (iconImage == null)
     {
         iconImage = new Image(System.IO.Path.Combine(Config.ImagesDir,
                                                      StyleConf.ButtonScoreIcon));
     }
 }
예제 #4
0
        public void TestScoreButton()
        {
            ScoreButton sb = new ScoreButton();

            Assert.IsNotNull(sb.Score);
            sb.Score = new Score("test", 2);
            Assert.AreEqual(sb.Name, "test");
            Assert.AreEqual(sb.BackgroundColor, sb.EventType.Color);
            Assert.AreEqual(sb.ScoreEventType, sb.EventType);
        }
예제 #5
0
        public void TestSerialization()
        {
            DashboardButton db = new DashboardButton();

            Utils.CheckSerialization(db);
            db = new PenaltyCardButton();
            Utils.CheckSerialization(db);
            db = new PenaltyCardButton();
            Utils.CheckSerialization(db);
            db = new ScoreButton();
            Utils.CheckSerialization(db);
        }
예제 #6
0
        public void AddButton(string buttontype)
        {
            DashboardButton button = null;

            if (buttontype == "Card")
            {
                button = new PenaltyCardButton {
                    PenaltyCard = new PenaltyCard("Red", Color.Red, CardShape.Rectangle)
                };
            }
            else if (buttontype == "Score")
            {
                button = new ScoreButton {
                    Score = new Score("Score", 1)
                };
            }
            else if (buttontype == "Timer")
            {
                button = new TimerButton {
                    Timer = new Timer {
                        Name = "Timer"
                    }
                };
            }
            else if (buttontype == "Tag")
            {
                button = new TagButton {
                    Tag = new Tag("Tag", "")
                };
            }
            else if (buttontype == "Category")
            {
                button = template.AddDefaultItem(template.List.Count);
            }
            else
            {
                return;
            }

            if (buttontype != "Category")
            {
                template.List.Add(button);
            }
            button.Position = new Point(template.CanvasWidth, 0);
            edited          = true;
            Refresh(button);
        }
예제 #7
0
        public void TestSerialization()
        {
            DashboardButton db = new DashboardButton();

            Utils.CheckSerialization(db);
            db = new TimedDashboardButton();
            Utils.CheckSerialization(db);
            db = new TagButton();
            Utils.CheckSerialization(db);
            db = new TimerButton();
            Utils.CheckSerialization(db);
            db = new EventButton();
            Utils.CheckSerialization(db);
            db = new AnalysisEventButton();
            Utils.CheckSerialization(db);
            db = new PenaltyCardButton();
            Utils.CheckSerialization(db);
            db = new PenaltyCardButton();
            Utils.CheckSerialization(db);
            db = new ScoreButton();
            Utils.CheckSerialization(db);
        }
예제 #8
0
        private void ScoreClick(object sender, EventArgs e)
        {
            ScoreButton button = (ScoreButton)sender;
            int         score  = button.Score;

            // Update the Question's properties and save it
            QuestionManager.AnswerQuestion(_currentQuestion, score);
            Question.Save(_currentQuestion);

            // Pop the next question, or if there's none left pop the controller
            ++_questionIndex;

            if (_questionIndex < _questions.Count)
            {
                _currentQuestion = _questions[_questionIndex];
                BindQuestion(_currentQuestion);
            }
            else
            {
                NavigationController.PopViewControllerAnimated(true);
            }
        }
예제 #9
0
        /// <summary>
        /// Creates a new dashboard with a default set of buttons
        /// </summary>
        /// <returns>the new dashboadrd.</returns>
        /// <param name="count">Number of <see cref="AnalysisEventButton"/> to add.</param>
        public static LMDashboard DefaultTemplate(int count)
        {
            TagButton         tagbutton;
            TimerButton       timerButton;
            PenaltyCardButton cardButton;
            ScoreButton       scoreButton;
            LMDashboard       template = new LMDashboard();

            template.FillDefaultTemplate(count);
            template.GamePeriods = new ObservableCollection <string> {
                "1", "2"
            };
            template.FieldBackground     = App.Current.FieldBackground;
            template.HalfFieldBackground = App.Current.HalfFieldBackground;
            template.GoalBackground      = App.Current.GoalBackground;

            tagbutton = new TagButton {
                Tag      = new Tag(Catalog.GetString("Attack"), ""),
                Position = new Point(10, 10)
            };
            template.List.Add(tagbutton);

            tagbutton = new TagButton {
                Tag      = new Tag(Catalog.GetString("Defense"), ""),
                Position = new Point(10 + (10 + CAT_WIDTH) * 1, 10)
            };
            template.List.Add(tagbutton);

            cardButton = new PenaltyCardButton {
                PenaltyCard = new PenaltyCard(Catalog.GetString("Red card"),
                                              Color.Red, CardShape.Rectangle),
                Position = new Point(10 + (10 + CAT_WIDTH) * 2, 10)
            };
            template.List.Add(cardButton);

            cardButton = new PenaltyCardButton {
                PenaltyCard = new PenaltyCard(Catalog.GetString("Yellow card"),
                                              Color.Yellow, CardShape.Rectangle),
                Position = new Point(10 + (10 + CAT_WIDTH) * 3, 10)
            };
            template.List.Add(cardButton);

            scoreButton = new ScoreButton {
                Position        = new Point(10 + (10 + CAT_WIDTH) * 4, 10),
                BackgroundColor = Colors.ButtonScoreColor,
                Score           = new Score(Catalog.GetString("Free play goal"), 1),
            };
            template.List.Add(scoreButton);

            scoreButton = new ScoreButton {
                BackgroundColor = Colors.ButtonScoreColor,
                Position        = new Point(10 + (10 + CAT_WIDTH) * 5, 10),
                Score           = new Score(Catalog.GetString("Penalty goal"), 1),
            };
            template.List.Add(scoreButton);

            timerButton = new TimerButton {
                Timer = new LMTimer {
                    Name = Catalog.GetString("Ball playing")
                },
                Position = new Point(10 + (10 + CAT_WIDTH) * 6, 10)
            };
            template.List.Add(timerButton);
            template.Preview = App.Current.PreviewService.CreatePreview(template);
            return(template);
        }
        private void AddScoreButtons()
        {
            int width = 45;
            int height = 40;
            int top = 370;
            int left = 12;
            int padding = 5;

            UIImage image1 = UIImage.FromFile("Assets/Images/button_1.png");
            _buttonScore1 = new ScoreButton();
            _buttonScore1.Score = 0;
            _buttonScore1.SetBackgroundImage(image1, UIControlState.Normal);
            _buttonScore1.Frame = new RectangleF(left, top, width, height);
            _buttonScore1.TouchDown += ScoreClick;
            View.AddSubview(_buttonScore1);
            left += width + padding;

            UIImage image2 = UIImage.FromFile("Assets/Images/button_2.png");
            _buttonScore2 = new ScoreButton();
            _buttonScore2.Score = 1;
            _buttonScore2.SetBackgroundImage(image2, UIControlState.Normal);
            _buttonScore2.Frame = new RectangleF(left, top, width, height);
            _buttonScore2.TouchDown += ScoreClick;
            View.AddSubview(_buttonScore2);
            left += width + padding;

            UIImage image3 = UIImage.FromFile("Assets/Images/button_3.png");
            _buttonScore3 = new ScoreButton();
            _buttonScore3.Score = 2;
            _buttonScore3.SetBackgroundImage(image3, UIControlState.Normal);
            _buttonScore3.Frame = new RectangleF(left, top, width, height);
            _buttonScore3.TouchDown += ScoreClick;
            View.AddSubview(_buttonScore3);
            left += width + padding;

            UIImage image4 = UIImage.FromFile("Assets/Images/button_4.png");
            _buttonScore4 = new ScoreButton();
            _buttonScore4.Score = 3;
            _buttonScore4.SetBackgroundImage(image4, UIControlState.Normal);
            _buttonScore4.Frame = new RectangleF(left, top, width, height);
            _buttonScore4.TouchDown += ScoreClick;
            View.AddSubview(_buttonScore4);
            left += width + padding;

            UIImage image5 = UIImage.FromFile("Assets/Images/button_5.png");
            _buttonScore5 = new ScoreButton();
            _buttonScore5.Score = 4;
            _buttonScore5.SetBackgroundImage(image5, UIControlState.Normal);
            _buttonScore5.Frame = new RectangleF(left, top, width, height);
            _buttonScore5.TouchDown += ScoreClick;
            View.AddSubview(_buttonScore5);
            left += width + padding;

            UIImage image6 = UIImage.FromFile("Assets/Images/button_6.png");
            _buttonScore6 = new ScoreButton();
            _buttonScore6.Score = 5;
            _buttonScore6.SetBackgroundImage(image6, UIControlState.Normal);
            _buttonScore6.Frame = new RectangleF(left, top, width, height);
            _buttonScore6.TouchDown += ScoreClick;
            View.AddSubview(_buttonScore6);

            // Set the buttons to invisible to start with
            SetButtonAlphas();
        }
예제 #11
0
        /// <summary>
        /// Creates a new dashboard with a default set of buttons
        /// </summary>
        /// <returns>the new dashboadrd.</returns>
        /// <param name="count">Number of <see cref="AnalysisEventButton"/> to add.</param>
        public static Dashboard DefaultTemplate(int count)
        {
            TagButton         tagbutton;
            TimerButton       timerButton;
            PenaltyCardButton cardButton;
            ScoreButton       scoreButton;
            List <string>     periods  = new List <string> ();
            Dashboard         template = new Dashboard();

            template.FillDefaultTemplate(count);

            periods.Add("1");
            periods.Add("2");
            template.GamePeriods = periods;

            tagbutton = new TagButton {
                Tag      = new Tag(Catalog.GetString("Attack"), ""),
                Position = new Point(10, 10)
            };
            template.List.Add(tagbutton);

            tagbutton = new TagButton {
                Tag      = new Tag(Catalog.GetString("Defense"), ""),
                Position = new Point(10 + (10 + CAT_WIDTH) * 1, 10)
            };
            template.List.Add(tagbutton);

            cardButton = new PenaltyCardButton {
                PenaltyCard = new PenaltyCard(Catalog.GetString("Red card"),
                                              Color.Red, CardShape.Rectangle),
                Position = new Point(10 + (10 + CAT_WIDTH) * 2, 10)
            };
            template.List.Add(cardButton);

            cardButton = new PenaltyCardButton {
                PenaltyCard = new PenaltyCard(Catalog.GetString("Yellow card"),
                                              Color.Yellow, CardShape.Rectangle),
                Position = new Point(10 + (10 + CAT_WIDTH) * 3, 10)
            };
            template.List.Add(cardButton);

            scoreButton = new ScoreButton {
                Score = new Score {
                    Name   = Catalog.GetString("Free play goal"),
                    Points = 1,
                    Color  = StyleConf.ButtonScoreColor
                },
                Position = new Point(10 + (10 + CAT_WIDTH) * 4, 10)
            };
            template.List.Add(scoreButton);

            scoreButton = new ScoreButton {
                Score = new Score {
                    Name   = Catalog.GetString("Penalty goal"),
                    Points = 1,
                    Color  = StyleConf.ButtonScoreColor
                },
                Position = new Point(10 + (10 + CAT_WIDTH) * 5, 10)
            };
            template.List.Add(scoreButton);

            timerButton = new TimerButton {
                Timer = new Timer {
                    Name = Catalog.GetString("Ball playing")
                },
                Position = new Point(10 + (10 + CAT_WIDTH) * 6, 10)
            };
            template.List.Add(timerButton);
            return(template);
        }
예제 #12
0
        private void AddScoreButtons()
        {
            int width   = 45;
            int height  = 40;
            int top     = 370;
            int left    = 12;
            int padding = 5;

            UIImage image1 = UIImage.FromFile("Assets/Images/button_1.png");

            _buttonScore1       = new ScoreButton();
            _buttonScore1.Score = 0;
            _buttonScore1.SetBackgroundImage(image1, UIControlState.Normal);
            _buttonScore1.Frame      = new RectangleF(left, top, width, height);
            _buttonScore1.TouchDown += ScoreClick;
            View.AddSubview(_buttonScore1);
            left += width + padding;

            UIImage image2 = UIImage.FromFile("Assets/Images/button_2.png");

            _buttonScore2       = new ScoreButton();
            _buttonScore2.Score = 1;
            _buttonScore2.SetBackgroundImage(image2, UIControlState.Normal);
            _buttonScore2.Frame      = new RectangleF(left, top, width, height);
            _buttonScore2.TouchDown += ScoreClick;
            View.AddSubview(_buttonScore2);
            left += width + padding;

            UIImage image3 = UIImage.FromFile("Assets/Images/button_3.png");

            _buttonScore3       = new ScoreButton();
            _buttonScore3.Score = 2;
            _buttonScore3.SetBackgroundImage(image3, UIControlState.Normal);
            _buttonScore3.Frame      = new RectangleF(left, top, width, height);
            _buttonScore3.TouchDown += ScoreClick;
            View.AddSubview(_buttonScore3);
            left += width + padding;

            UIImage image4 = UIImage.FromFile("Assets/Images/button_4.png");

            _buttonScore4       = new ScoreButton();
            _buttonScore4.Score = 3;
            _buttonScore4.SetBackgroundImage(image4, UIControlState.Normal);
            _buttonScore4.Frame      = new RectangleF(left, top, width, height);
            _buttonScore4.TouchDown += ScoreClick;
            View.AddSubview(_buttonScore4);
            left += width + padding;

            UIImage image5 = UIImage.FromFile("Assets/Images/button_5.png");

            _buttonScore5       = new ScoreButton();
            _buttonScore5.Score = 4;
            _buttonScore5.SetBackgroundImage(image5, UIControlState.Normal);
            _buttonScore5.Frame      = new RectangleF(left, top, width, height);
            _buttonScore5.TouchDown += ScoreClick;
            View.AddSubview(_buttonScore5);
            left += width + padding;

            UIImage image6 = UIImage.FromFile("Assets/Images/button_6.png");

            _buttonScore6       = new ScoreButton();
            _buttonScore6.Score = 5;
            _buttonScore6.SetBackgroundImage(image6, UIControlState.Normal);
            _buttonScore6.Frame      = new RectangleF(left, top, width, height);
            _buttonScore6.TouchDown += ScoreClick;
            View.AddSubview(_buttonScore6);

            // Set the buttons to invisible to start with
            SetButtonAlphas();
        }
예제 #13
0
        public override void Draw()
        {
            switch (NogardGame.GameState)
            {
            case NogardGame.GameStateEnum.MainMenu:
                PlayButton.DrawStandardButton(5, "Play", 1);
                ScoreButton.DrawStandardButton(5, " Highscore", 0.5f);
                AboutNogardButton.DrawStandardButton(5, "About Nogard", 0.4f);
                InstuctionsButton.DrawStandardButton(5, "  How to play", 0.4f);
                ExitButton.DrawStandardButton(5, " Exit", 0.4f);
                MapButton.DrawStandardButton(5, " MapMaker", 0.4f);
                break;

            case NogardGame.GameStateEnum.Story:
                if (StoryMode.IntroStory)
                {
                    BackButton.DrawStandardButton(5, " Back", 0.5f);
                }
                else
                {
                    ContinueButton.DrawStandardButton(5, "  Continue", 0.5f);
                }
                break;

            case NogardGame.GameStateEnum.GameActive:
                break;

            case NogardGame.GameStateEnum.HighScoreView:
                BackButton.DrawStandardButton(5, " Back", 0.5f);
                break;

            case NogardGame.GameStateEnum.Pause:
                ResumeButton.DrawStandardButton(5, "Resume", 0.5f);
                PauseMenuButton.DrawStandardButton(5, "MainMenu", 0.5f);
                break;

            case NogardGame.GameStateEnum.GameOver:
                if (GameOverManager.ScoreForm.GameSaved == false)
                {
                    SaveScoreButton.DrawStandardButton(5, "Save Score", 0.5f);
                }
                else
                {
                    SaveScoreButton.DrawStandardButton(5, "Score saved", 0.45f);
                }
                MainMenuButton.DrawStandardButton(5, " MainMenu", 0.4f);
                QuitButton.DrawStandardButton(5, " Quit Game", 0.4f);
                break;

            case NogardGame.GameStateEnum.MapMaker:
                break;

            case NogardGame.GameStateEnum.LevelSelector:
                LevelOneButton.DrawStandardButton(5, " Level One", 0.5f);
                LevelTwoButton.DrawStandardButton(5, " Level Two", 0.5f);
                LevelThreeButton.DrawStandardButton(5, " Level Three", 0.5f);
                SelectorBackButton.DrawStandardButton(5, " Back", 0.4f);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }