コード例 #1
0
        public InventoryScreen(ScreenComponent manager) : base(manager)
        {
            player = manager.Player;
            IsOverlay = true;

            Texture2D panelBackground = manager.Game.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/panel.png", manager.GraphicsDevice);
            Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30);

            HorizontalAlignment = HorizontalAlignment.Center;
            VerticalAlignment = VerticalAlignment.Center;
            Width = 600;
            Height = 400;

            Label headLine = new Label(manager);
            headLine.Text = Languages.OctoClient.Inventory;
            headLine.Font = Skin.Current.HeadlineFont;
            headLine.HorizontalAlignment = HorizontalAlignment.Left;
            headLine.VerticalAlignment = VerticalAlignment.Top;
            Controls.Add(headLine);

            Button closeButton = Button.TextButton(manager, Languages.OctoClient.Close);
            closeButton.LeftMouseClick += (s, e) => { manager.NavigateBack(); };
            Controls.Add(closeButton);

            //counter = new LabelControl(ScreenManager)
            //{
            //    Font = ScreenManager.NormalText,
            //    Color = Color.Black,
            //    Position = new Index2(((ScreenManager.ScreenSize.X - 600) / 2) + 100,
            //        ((ScreenManager.ScreenSize.Y - 400) / 2) + 140),
            //};
            //Controls.Add(counter);

            Title = Languages.OctoClient.Inventory;
        }
コード例 #2
0
ファイル: PauseScreen.cs プロジェクト: BlackOrca/octoawesome
        public PauseScreen(ScreenComponent manager)
            : base(manager)
        {
            assets = manager.Game.Assets;

            // IsOverlay = true;
            // Background = new BorderBrush(new Color(Color.Black, 0.5f));

            Background = new TextureBrush(assets.LoadTexture(typeof(ScreenComponent), "background"), TextureBrushMode.Stretch);

            StackPanel stack = new StackPanel(manager);
            Controls.Add(stack);

            Button resumeButton = Button.TextButton(manager, Languages.OctoClient.Resume);
            resumeButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            resumeButton.Margin = new Border(0, 0, 0, 10);
            resumeButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateBack();
            };
            stack.Controls.Add(resumeButton);

            Button optionButton = Button.TextButton(manager, Languages.OctoClient.Options);
            optionButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            optionButton.Margin = new Border(0, 0, 0, 10);
            optionButton.MinWidth = 300;
            optionButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateToScreen(new OptionsScreen(manager));
            };
            stack.Controls.Add(optionButton);

            Button creditsButton = Button.TextButton(manager, Languages.OctoClient.CreditsCrew);
            creditsButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            creditsButton.Margin = new Border(0, 0, 0, 10);
            creditsButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateToScreen(new CreditsScreen(manager));
            };
            stack.Controls.Add(creditsButton);

            Button mainMenuButton = Button.TextButton(manager, Languages.OctoClient.ToMainMenu);
            mainMenuButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            mainMenuButton.Margin = new Border(0, 0, 0, 10);
            mainMenuButton.LeftMouseClick += (s, e) =>
            {
                manager.Player.RemovePlayer();
                manager.Game.Simulation.ExitGame();
                manager.NavigateHome();
            };
            stack.Controls.Add(mainMenuButton);
        }
コード例 #3
0
ファイル: MessageScreen.cs プロジェクト: ManuelHu/octoawesome
        public MessageScreen(ScreenComponent manager, string title, string content, string buttonText = "OK", Action<Control, MouseEventArgs> buttonClick = null)
            : base(manager)
        {
            IsOverlay = true;
            Background = new BorderBrush(Color.Black * 0.5f);
            Title = title;

            Texture2D panelBackground = manager.Game.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/panel.png", manager.GraphicsDevice);
            Panel panel = new Panel(manager)
            {
                Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30),
                Padding = Border.All(20),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center
            };
            Controls.Add(panel);

            StackPanel spanel = new StackPanel(manager);
            panel.Controls.Add(spanel);

            Label headLine = new Label(manager)
            {
                Text = title,
                Font = Skin.Current.HeadlineFont,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };
            spanel.Controls.Add(headLine);

            Label contentLabel = new Label(manager)
            {
                Text = content,
                Font = Skin.Current.TextFont,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };
            spanel.Controls.Add(contentLabel);

            Button closeButton = Button.TextButton(manager, buttonText);
            closeButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            closeButton.LeftMouseClick += (s, e) =>
            {
                if (buttonClick != null)
                    buttonClick(s, e);
                else
                    manager.NavigateBack();
            };
            spanel.Controls.Add(closeButton);
        }
コード例 #4
0
ファイル: CreditsScreen.cs プロジェクト: jvbsl/octoawesome
        public CreditsScreen(ScreenComponent manager)
            : base(manager)
        {
            Padding = new Border(0, 0, 0, 0);

            Title = "Credits";

            Image background = new Image(manager);
            background.Texture = Manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/background_notext.png", Manager.GraphicsDevice);
            background.VerticalAlignment = VerticalAlignment.Stretch;
            background.HorizontalAlignment = HorizontalAlignment.Stretch;
            Controls.Add(background);

            Button backButton = Button.TextButton(manager, "Back");
            backButton.VerticalAlignment = VerticalAlignment.Top;
            backButton.HorizontalAlignment = HorizontalAlignment.Left;
            backButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateBack();
            };
            backButton.Margin = new Border(10, 10, 10, 10);
            Controls.Add(backButton);

            List<CrewMember> crew = CrewMember.getCrew(manager);

            ScrollContainer crewScroll = new ScrollContainer(manager)
            {
                VerticalAlignment = VerticalAlignment.Stretch,
                Margin = new Border(10, 10, 10, 10),
                CanFocus = false
            };

            StackPanel crewList = new StackPanel(manager) {
                MinWidth = 700,
                VerticalAlignment = VerticalAlignment.Stretch,
                Orientation = Orientation.Vertical,
            };
            crewScroll.Content = crewList;

            foreach(CrewMember member in crew)
            {
                Panel memberPanel = new Panel(manager)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    MinHeight = 30,
                    Background = new BorderBrush(Color.White),
                    Margin = new Border(5, 5, 5, 5),
                    HoveredBackground = new BorderBrush(Color.LightGray)

                };

                memberPanel.LeftMouseClick += (s, e) =>
                {
                    manager.NavigateToScreen(new CrewMemberScreen(manager, member));
                };

                Label name = new Label(manager)
                {
                    Text = member.Username,
                    VerticalAlignment = VerticalAlignment.Stretch,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Padding = new Border(5, 5, 5, 5)
                };

                memberPanel.Controls.Add(name);
                crewList.Controls.Add(memberPanel);

            }

            Controls.Add(crewScroll);
        }
コード例 #5
0
ファイル: TargetScreen.cs プロジェクト: ManuelHu/octoawesome
        public TargetScreen(ScreenComponent manager, Action<int, int> tp, int x, int y)
            : base(manager)
        {
            IsOverlay = true;
            Background = new BorderBrush(Color.Black * 0.5f);
            Title = "Select target";

            Texture2D panelBackground = manager.Game.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/panel.png", manager.GraphicsDevice);
            Panel panel = new Panel(manager)
            {
                Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30),
                Padding = Border.All(20),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center
            };
            Controls.Add(panel);

            StackPanel spanel = new StackPanel(manager);
            panel.Controls.Add(spanel);

            Label headLine = new Label(manager)
            {
                Text = Title,
                Font = Skin.Current.HeadlineFont,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };
            spanel.Controls.Add(headLine);

            StackPanel vstack = new StackPanel(manager);
            vstack.Orientation = Orientation.Vertical;
            spanel.Controls.Add(vstack);

            Textbox xText = new Textbox(manager)
            {
                Background = new BorderBrush(Color.Gray),
                Width = 150,
                Margin = new Border(10, 10, 10, 10),
                Text = x.ToString()
            };
            vstack.Controls.Add(xText);

            Textbox yText = new Textbox(manager)
            {
                Background = new BorderBrush(Color.Gray),
                Width = 150,
                Margin = new Border(10, 10, 10, 10),
                Text = y.ToString()
            };
            vstack.Controls.Add(yText);

            Button closeButton = Button.TextButton(manager, "Teleport");
            closeButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            closeButton.LeftMouseClick += (s, e) =>
            {
                if (tp != null)
                    tp(int.Parse(xText.Text), int.Parse(yText.Text));
                else
                    manager.NavigateBack();
            };
            spanel.Controls.Add(closeButton);
        }
コード例 #6
0
ファイル: OptionsScreen.cs プロジェクト: jvbsl/octoawesome
        public OptionsScreen(ScreenComponent manager)
            : base(manager)
        {
            game = (OctoGame)manager.Game;
            Padding = new Border(0, 0, 0, 0);

            Title = "Options";

            ////////////////////////////////////////////Background////////////////////////////////////////////
            Image background = new Image(manager);
            background.Texture = Manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/background_notext.png", Manager.GraphicsDevice);
            background.VerticalAlignment = VerticalAlignment.Stretch;
            background.HorizontalAlignment = HorizontalAlignment.Stretch;
            Controls.Add(background);

            ////////////////////////////////////////////Back Button////////////////////////////////////////////
            Button backButton = Button.TextButton(manager, "Back");
            backButton.VerticalAlignment = VerticalAlignment.Top;
            backButton.HorizontalAlignment = HorizontalAlignment.Left;
            backButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateBack();
            };
            backButton.Margin = new Border(10, 10, 10, 10);
            Controls.Add(backButton);

            ////////////////////////////////////////////Settings Stack////////////////////////////////////////////
            StackPanel settingsStack = new StackPanel(manager);
            settingsStack.Orientation = Orientation.Vertical;
            Texture2D panelBackground = manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/panel.png", manager.GraphicsDevice);
            settingsStack.Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30);
            settingsStack.Padding = new Border(20, 20, 20, 20);
            Controls.Add(settingsStack);

            //////////////////////Viewrange//////////////////////
            string viewrange = ConfigurationManager.AppSettings["Viewrange"];

            rangeTitle = new Label(manager);
            rangeTitle.Text = "Viewrange: " + viewrange;
            settingsStack.Controls.Add(rangeTitle);

            Slider viewrangeSlider = new Slider(manager);
            viewrangeSlider.HorizontalAlignment = HorizontalAlignment.Stretch;
            viewrangeSlider.Height = 20;
            viewrangeSlider.Range = 9;
            viewrangeSlider.Value = int.Parse(viewrange) -1;
            viewrangeSlider.ValueChanged += (value) => SetViewrange(value + 1);
            settingsStack.Controls.Add(viewrangeSlider);

            //////////////////////Persistence//////////////////////
            StackPanel persistenceStack = new StackPanel(manager);
            persistenceStack.Orientation = Orientation.Horizontal;
            persistenceStack.Margin = new Border(0, 10, 0, 0);
            settingsStack.Controls.Add(persistenceStack);

            persistenceTitle = new Label(manager);
            persistenceTitle.Text = "Disable persistence:";
            persistenceStack.Controls.Add(persistenceTitle);

            Checkbox disablePersistence = new Checkbox(manager);
            disablePersistence.Checked = bool.Parse(ConfigurationManager.AppSettings["DisablePersistence"]);
            disablePersistence.CheckedChanged += (state) => SetPersistence(state);
            persistenceStack.Controls.Add(disablePersistence);

            //////////////////////Map Path//////////////////////
            StackPanel mapPathStack = new StackPanel(manager);
            mapPathStack.Orientation = Orientation.Horizontal;
            mapPathStack.Margin = new Border(0, 10, 0, 0);
            mapPathStack.HorizontalAlignment = HorizontalAlignment.Stretch;
            settingsStack.Controls.Add(mapPathStack);

            mapPath = new Textbox(manager);
               // mapPath.HorizontalAlignment = HorizontalAlignment.Stretch;
            mapPath.Text = ConfigurationManager.AppSettings["ChunkRoot"];
            mapPath.Enabled = false;
            mapPath.Background = new BorderBrush(Color.LightGray, LineType.Solid, Color.Gray);
            mapPathStack.Controls.Add(mapPath);

            Button changePath = Button.TextButton(manager, "Change Path");
            changePath.Height = 31;
            changePath.LeftMouseClick += (s, e) => ChangePath();
            mapPathStack.Controls.Add(changePath);

            //////////////////////Delete Map//////////////////////
            deleteButton = Button.TextButton(manager, "Delete Map");
            deleteButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            deleteButton.Margin = new Border(0, 10, 0, 0);
            deleteButton.LeftMouseClick += (s, e) => deleteMap();
            settingsStack.Controls.Add(deleteButton);

            ////////////////////////////////////////////Restart Button////////////////////////////////////////////
            exitButton = Button.TextButton(manager, "Restart game to apply changes");
            exitButton.VerticalAlignment = VerticalAlignment.Top;
            exitButton.HorizontalAlignment = HorizontalAlignment.Right;
            exitButton.Enabled = false;
            exitButton.Visible = false;
            exitButton.LeftMouseClick += (s, e) =>
            {
                Process.Start(System.Reflection.Assembly.GetEntryAssembly().Location);
                game.Exit();
            };
            exitButton.Margin = new Border(10, 10, 10, 10);
            Controls.Add(exitButton);
        }
コード例 #7
0
        public CrewMemberScreen(ScreenComponent manager, CrewMember member) : base(manager)
        {
            VerticalAlignment = VerticalAlignment.Center;
            HorizontalAlignment = HorizontalAlignment.Center;

            SpriteFont boldFont = manager.Content.Load<SpriteFont>("BoldFont");

            Padding = new Border(0, 0, 0, 0);

            //The Background Image
            Image background = new Image(manager)
            {
                Texture = manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/background_notext.png", manager.GraphicsDevice),
                VerticalAlignment = VerticalAlignment.Stretch,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };
            Controls.Add(background);

            //The Panel
            Texture2D panelBackground = manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/panel.png", manager.GraphicsDevice);
            Panel panel = new Panel(manager)
            {
                MaxWidth = 750,
                Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30),
                Padding = new Border(15, 15, 15, 15),
            };

            Controls.Add(panel);

            //The Vertical Stack - Split the Panel in half Vertical
            StackPanel verticalStack = new StackPanel(manager)
            {
                VerticalAlignment = VerticalAlignment.Stretch,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Orientation = Orientation.Vertical,
            };
            // panel.Controls.Add(verticalStack);



            //The Main Stack - Split the Panel in half Horizontal
            StackPanel horizontalStack = new StackPanel(manager)
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                Orientation = Orientation.Horizontal
            };
            panel.Controls.Add(horizontalStack);


            //The Profile Image
            Image profileImage = new Image(manager)
            {
                Height = 200,
                Width = 200,
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                Padding = new Border(0, 0, 10, 0)
            };
            if (member.PictureFilename == null)
                profileImage.Texture = manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/Crew/base.png", manager.GraphicsDevice);
            else profileImage.Texture = manager.Content.LoadTexture2DFromFile(member.PictureFilename, manager.GraphicsDevice);
            horizontalStack.Controls.Add(profileImage);



            //The Text Stack
            StackPanel textStack = new StackPanel(manager);
            textStack.VerticalAlignment = VerticalAlignment.Stretch;
            textStack.HorizontalAlignment = HorizontalAlignment.Left;
            textStack.Width = 430;
            horizontalStack.Controls.Add(textStack);

            //The Username
            Label username = new Label(manager)
            {
                Text = member.Username,
                Font = manager.Content.Load<SpriteFont>("HeadlineFont"),
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Top
            };
            textStack.Controls.Add(username);

            //The Alias
            Label alias = new Label(manager)
            {
                Text = member.Alias,
                HorizontalAlignment = HorizontalAlignment.Left
            };
            textStack.Controls.Add(alias);

            //Achievements
            string achievementString = "";

            foreach (CrewMember.Achievements achievement in member.AchievementList)
            {
                achievementString += " " + achievement.ToString();
                if (member.AchievementList.IndexOf(achievement) != member.AchievementList.Count - 1) achievementString += ", ";
            }
            StackPanel achievementStack = new StackPanel(manager);
            achievementStack.VerticalAlignment = VerticalAlignment.Top;
            achievementStack.HorizontalAlignment = HorizontalAlignment.Left;
            achievementStack.Orientation = Orientation.Horizontal;
            textStack.Controls.Add(achievementStack);

            Label achievementsTitle = new Label(manager) { Text = Languages.OctoClient.Achievements + ": ", Font = boldFont, HorizontalAlignment = HorizontalAlignment.Left };

            Label achievements = new Label(manager) { Text = achievementString, HorizontalAlignment = HorizontalAlignment.Left };

            achievementStack.Controls.Add(achievementsTitle);
            achievementStack.Controls.Add(achievements);



            Panel DescriptionPanel = new Panel(manager)
            {
                VerticalAlignment = VerticalAlignment.Stretch,
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };
            textStack.Controls.Add(DescriptionPanel);

            Label Description = new Label(manager)
            {
                Text = member.Description,
                WordWrap = true,
                VerticalAlignment = VerticalAlignment.Stretch,
                HorizontalAlignment = HorizontalAlignment.Left,
                HorizontalTextAlignment = HorizontalAlignment.Left,
                VerticalTextAlignment = VerticalAlignment.Top,

            };
            Description.InvalidateDimensions();
            DescriptionPanel.Controls.Add(Description);

            panel.Width = 700;

            //The Back Button
            Button backButton = Button.TextButton(manager, Languages.OctoClient.Back);
            backButton.VerticalAlignment = VerticalAlignment.Top;
            backButton.HorizontalAlignment = HorizontalAlignment.Left;
            backButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateBack();
            };
            backButton.Margin = new Border(10, 10, 10, 10);
            Controls.Add(backButton);

            Title = member.Alias;
        }