예제 #1
0
        public LoginView(double width, double height)
            : base(width, height)
        {
            BackgroundColor = new Color(255, 255, 255);

            Inputbox username = new Inputbox("Brugernavn");
            username.X = 75;
            username.Y = 100;
            username.Width = 450;
            username.Height = 36;
            username.Align = TextAlignment.Left;

            Inputbox password = new Inputbox("Kode", true);
            password.X = 75;
            password.Y = 160;
            password.Width = 450;
            password.Height = 36;
            password.Align = TextAlignment.Left;

            ButtonView submit = new ButtonView("Log ind", () => {
                if (OnLogin != null)
                    OnLogin(username.Text, password.Text);
            });
            submit.X = 220;
            submit.Y = 250;
            submit.Width = 160;
            submit.Height = 60;
            submit.BackgroundColor = new Color(40, 175, 100);
            submit.TextColor = new Color(255, 255, 255);

            Status = new LabelView(" ");
            Status.X = 75;
            Status.Y = 200;
            Status.Width = 200;
            Status.Height = 30;
            Status.TextColor = new Color(200, 0, 0);

            SetContent(new CompositeView(600, 400)
            {
                Children = new List<View>() {
                    username,
                    password,
                    submit,
                    Status
                }
            });
        }
예제 #2
0
        public virtual void Build(GameModel game)
        {
            menuButton = new ButtonView("Menu", () => OnExit())
            {
                Width = 100,
                Height = 50,
                BackgroundColor = new Color(192, 57, 43),
                TextColor = new Color(255, 255, 255),
            };

            nextButton = new ButtonView("Næste", () => OnNextLevel())
            {
                X = Width - 100,
                Width = 100,
                Height = 50,
                BackgroundColor = game.IsLastLevel || game.IsLevelCompleted == false ? new Color(190, 190, 190) : new Color(40, 120, 130),
                TextColor = new Color(255, 255, 255),
            };

            restartButton = new ImageView("restart.png", 50, 50)
            {
                OnClick = () => game.RestartLevel(),
                X = 110,
                Y = 0,
                BackgroundColor = new Color(192, 57, 43)
            };

            toolTipView = new ToolTipView(game.User.CurrentLevel.Description, 300, 100)
            {
                X = Width - 300,
                Y = 50,
                Visible = false,

                OnClick = () =>
                {
                    if (helpButton.OnClick != null && toolTipView.Visible == true)
                    {
                        helpButton.OnClick();
                    }
                }
            };
            toolTipView.ArrowPosition = 155;

            helpButton = new ButtonView(
                "?",
                () =>
                {
                    if(game.User.CurrentLevel.Description != "")
                    {
                        if(toolTipView.Visible == true)
                        {
                            helpButton.Text = "?";
                            toolTipView.Visible = false;
                        }
                        else
                        {
                            helpButton.Text = " Luk ";
                            toolTipView.Visible = true;
                        }
                    }
                }
            )
            {
                X = Width - 160,
                Y = 0,
                Width = 50,
                Height = 50,
                BackgroundColor = game.User.CurrentLevel.Description == "" ? new Color(190, 190, 190) : new Color(40, 120, 130),
                TextColor = new Color(255, 255, 255),
            };

            progressbar = new ProgressbarStarView(game.ProgressBar, Width - 340, 30)
            {
                X = 170,
                Y = 10
            };

            identityMenu = new IdentityMenuView(game.ExprModel, Width, 100)
            {
                Y = Height - 125
            };

            expression = new ExpressionView(game.ExprModel, Width - 100, Height - 275, 8)
            {
                X = 50,
                Y = 100,
            };

            Children = new List<View>()
            {
                menuButton,
                nextButton,
                restartButton,
                helpButton,
                progressbar,
                identityMenu,
                expression,
                toolTipView,
            };

            if(OnChanged != null)
            {
                OnChanged();
            }
        }
        public void Build()
        {
            int offSetY = 5;
            Children = new List<View>();
            congratulationView = new LabelView("Tillykke !!!")
            {
                X = (Width * 0.5) - ((this.Width * 0.65) / 2),
                Y = offSetY,
                Width = this.Width * 0.65,
                Height = this.Height * 0.20
            };

            descriptionView = new LabelView("Du har gennemført kategorien: " + Category.Name + (isLastCategory ? " \nog dermed gennemført hele spillet!" : ""))
            {
                X = (Width * 0.5) - ((congratulationView.Width * 0.75) * 0.5),
                Y = offSetY + congratulationView.Height,
                Width = congratulationView.Width * 0.75,
                Height = congratulationView.Height / 2
            };
            Children.Add(congratulationView);
            Children.Add(descriptionView);

            PlayerListView badgeDic = new PlayerListView(Width, Height);

            badgeView = null;
            if (badgeDic.badgeDictionary.ContainsKey(Category.Badge))
            {
                badgeView = new ImageView(badgeDic.badgeDictionary[Category.Badge], Width * 0.25, Width * 0.25)
                {
                    X = Width / 2 - ((Width * 0.25) / 2),
                    Y = Height * 0.40
                };
                Children.Add(badgeView);
            }

            MenuButton = new ButtonView("Menu", () => { if (OnExit != null) OnExit(); })
            {
                X = badgeView.X + (badgeView.Width / 2) - 115,
                Y = Height - 50,
                Width = 105,
                Height = 35,
                BackgroundColor = new Color(192, 57, 43),
                TextColor = new Color(255, 255, 255)
            };
            if (isLastCategory == false)
            {
                nextCategory = new ButtonView("Næste", () => { if (OnNext != null) OnNext(); })
                {
                    X = badgeView.X + (badgeView.Width / 2) + 10,
                    Y = Height - 50,
                    Width = 105,
                    Height = 35,
                    TextColor = new Color(255, 255, 255),
                    BackgroundColor = new Color(40, 120, 130)
                };
                Children.Add(nextCategory);
            }
            Children.Add(MenuButton);
        }
        public void Build(CurrentPlayer user)
        {
            MenuButton = new ButtonView("Menu", () => { if (OnExit != null) { OnExit(); } })
            {
                Width = 75,
                Height = 30,
                BackgroundColor = new Color(193, 57, 43),
                TextColor = new Color(255, 255, 255),
            };

            TitelView = new CompositeView(200, 40)
            {
                X = 100,
                Y = 10,
            };
            CategoryName = new LabelView(user.Categories[Category].Name)
            {
                Width = TitelView.Width * 0.6,
                Height = TitelView.Height,
                X = TitelView.X - (TitelView.Width * 0.6) / 2
            };

            StarTextView = new LabelView("")
            {
                Width = TitelView.Width * 0.15,
                Height = 15,
                X = CategoryName.X + CategoryName.Width + 7.5,
                Y = CategoryName.Y + ((CategoryName.Height) / 2) - 7.5
            };

            StarView = new ImageView("star_activated.png", TitelView.Width * 0.10, TitelView.Width * 0.10)
            {
                X = CategoryName.X + CategoryName.Width + StarTextView.Width + 10,
                Y = CategoryName.Y + 0.5 * (TitelView.Width * 0.10)
            };

            BadgeView = new ImageView("tutorialbadge.png", TitelView.Width * 0.15, TitelView.Width * 0.15)
            {
                X = 0 - ((TitelView.Width * 0.10) / 2) + 5,
                Y = CategoryName.Y + (0.5 * (TitelView.Width * 0.15)) - 10
            };

            TitelView.Add(StarTextView);
            TitelView.Add(CategoryName);
            TitelView.Add(StarView);
            TitelView.Add(BadgeView);

            Levels = new FrameView(Width - 100, Height - (CategoryName.Y + CategoryName.Height))
            {
                X = 50,
                Y = CategoryName.Y + CategoryName.Height,
            };

            ArrowRight = new VectorImageView(345, Levels.Y + Levels.Height / 2 - 75 / 2, 50, 75)
            {
                { 0,0    },
                { 25,75/2 },
                { 0,75   },
            };

            ArrowRight.Visible = Category < user.Categories.Count - 1;
            ArrowRight.BackgroundColor = new Color(44, 119, 130);
            ArrowRight.OnClick = () =>
            {
                if (Category < user.Categories.Count - 1)
                {
                    Category++;
                    OnChanged();
                }
            };

            ArrowLeft = new VectorImageView(5, Levels.Y + Levels.Height / 2 - 75 / 2, 50, 75)
            {
                { 25,75/2 },
                { 50,0    },
                { 50,75   },
            };

            ArrowLeft.BackgroundColor = new Color(44, 119, 130);
            ArrowLeft.OnClick = () =>
            {
                if (Category > 0)
                {
                    Category--;
                    OnChanged();
                }
            };
            ArrowLeft.Visible = Category > 0;

            Children.Add(MenuButton);
            Children.Add(ArrowLeft);
            Children.Add(ArrowRight);
            Children.Add(Levels);
            Children.Add(TitelView);

            Update(user);
        }
예제 #5
0
        public void Build(GameModel game)
        {
            CurrentPlayer user = game.User;
            IEnumerable<Player> players = game.Players;
            BackgroundColor = new Color(255, 255, 255);
            WelcomeText = new LabelView("Velkommen " + user.PlayerName)
            {
                X = 10,
                Y = 10,
                Height = 50,
                Width = 220
            };

            BadgesView = new CompositeView(220, 40)
            {
                X = WelcomeText.X,
                Y = WelcomeText.Y + WelcomeText.Height
            };

            BadgeInfoText = new LabelView("Badges: ")
            {
                Width = 100,
                Height = 20,
                X = -10
            };

            BadgesView.Add(BadgeInfoText);

            if (user.Badges != null)
            {
                // start spacing half the width of a badge
                int spacing = -10;
                foreach (BadgeName badge in user.Badges)
                {
                    if (PlayerView.badgeDictionary.ContainsKey(badge))
                    {
                        BadgesView.Add(new ImageView(PlayerView.badgeDictionary[badge], 25, 25)
                        {
                            X = BadgeInfoText.X + BadgeInfoText.Width + spacing,
                        });
                    }
                    spacing += 30;
                }
            }

            VectorImageView playIcon = new VectorImageView(0, 0, 100, 100)
            {
                { 25,25 },
                { 75,50 },
                { 25,75 }
            };

            LogoutButton = new ButtonView("Log ud", () =>
            {
                if (OnLogout != null)
                {
                    OnLogout();
                }
            })
            {
                Width = 50,
                Height = 15,
                TextColor = new Color(255, 255, 255),
                BackgroundColor = new Color(193, 57, 43)
            };

            playIcon.BackgroundColor = new Color(255, 255, 255);
            PlayButton = new CompositeView(100, 100)
            {
                playIcon,
            };
            PlayButton.BackgroundColor = new Color(39, 174, 97);
            PlayButton.X = 10;
            PlayButton.Y = BadgesView.Y + BadgesView.Height;
            VectorImageView levelIcon1 = new VectorImageView(0, 0, 100, 100)
            {
                { 20,20 },
                { 45,20 },
                { 45,45 },
                { 20,45 },
                { 20,20 },
            };
            VectorImageView levelIcon2 = new VectorImageView(0, 0, 100, 100)
            {
                { 80,20 },
                { 80,45 },
                { 55,45 },
                { 55,20 },
                { 80,20 },
            };
            VectorImageView levelIcon3 = new VectorImageView(0, 0, 100, 100)
            {
                { 80,80 },
                { 55,80 },
                { 55,55 },
                { 80,55 },
                { 80,80 },
            };
            VectorImageView levelIcon4 = new VectorImageView(0, 0, 100, 100)
            {
                { 20,80 },
                { 20,55 },
                { 45,55 },
                { 45,80 },
                { 20,80 },
            };
            levelIcon1.BackgroundColor = new Color(255, 255, 255);
            levelIcon2.BackgroundColor = new Color(255, 255, 255);
            levelIcon3.BackgroundColor = new Color(255, 255, 255);
            levelIcon4.BackgroundColor = new Color(255, 255, 255);

            LevelButton = new CompositeView(100, 100)
            {
                levelIcon1,
                levelIcon2,
                levelIcon3,
                levelIcon4,
            };
            LevelButton.BackgroundColor = new Color(42, 128, 185);
            LevelButton.X = PlayButton.X + PlayButton.Width + 20;
            LevelButton.Y = BadgesView.Y + BadgesView.Height;

            PlayerList = new PlayerListView(players, 160, 200)
            {
                X = LevelButton.X + LevelButton.Width + 20,
                Y = WelcomeText.Y
            };

            Children = new List<View>(){
                LogoutButton,
                WelcomeText,
                LevelButton,
                PlayerList,
                PlayButton,
                BadgesView
            };
        }