Пример #1
0
        public JoinScreen(GraphicsDeviceManager graphics, ContentManager Content, SivEventHandler theEvent, Game1 parent)
            : base("JoinScreen", theEvent, parent)
        {
            bg = new Background(Content.Load <Texture2D>("Resource/background"), this);

            #region Image
            saber = new Image("saber"
                              , Content.Load <Texture2D>("Resource/SaberLily_Trans")
                              , new RectangleF(720, 110, 480, 615), 0.99f, this);

            gameList = new Image("gameList"
                                 , Content.Load <Texture2D>("Resource/gamelist")
                                 , new RectangleF(50, 50, 700, 650), 0.97f, this);
            #endregion

            #region Button
            ok_button = new ImageButton("Ok"
                                        , Content.Load <Texture2D>("Resource/button/ok_button")
                                        , new RectangleF(170, 650, 120, 42), this);

            host_button = new ImageButton("Host"
                                          , Content.Load <Texture2D>("Resource/button/host_button")
                                          , new RectangleF(320, 650, 120, 42), this);
            host_button.OnClick += HostClicked;

            back_button = new ImageButton("Back"
                                          , Content.Load <Texture2D>("Resource/button/back_button")
                                          , new RectangleF(470, 650, 120, 42), this);
            back_button.OnClick += BackClicked;
            #endregion

            playerName = new TextBox("Player Name", Game1.whiteTextbox, Game1.highlightedTextbox,
                                     Game1.caret, Game1.font, new RectangleF(600, 65, 150, 20), this);
            playerNameLabel = new Label("PlayerName Label", Game1.arial13Bold, "Name: ",
                                        540, 65, 100, Color.White, this);
            playerName.Text = "SivCloud";

            #region JoinScreen_RegisterHandler
            OnKeysDown += JoinScreen_OnKeysDown;
            #endregion
        }
Пример #2
0
        public MenuScreen(GraphicsDeviceManager graphics, ContentManager theContent, SivEventHandler theScreenEvent, Game1 parent)
            : base("MenuScreen", theScreenEvent, parent)
        {
            font = theContent.Load <SpriteFont>("SpriteFont1");

            start_button          = new ImageButton("start_button", theContent.Load <Texture2D>("Resource/button/start"), new RectangleF(38, 653, 173, 51), 0.9f, this);
            start_button.OnClick += Menu_button_click_handler;

            host_button = new ImageButton("host_button"
                                          , theContent.Load <Texture2D>("Resource/button/hostgame")
                                          , new RectangleF(246, 653, 173, 51), 0.9f, this);
            host_button.OnClick += Menu_button_click_handler;

            join_button = new ImageButton("join_button"
                                          , theContent.Load <Texture2D>("Resource/button/joingame")
                                          , new RectangleF(783, 653, 173, 51), 0.9f, this);
            join_button.OnClick += Menu_button_click_handler;

            quit_button = new ImageButton("quit_button"
                                          , theContent.Load <Texture2D>("Resource/button/quit")
                                          , new RectangleF(987, 653, 173, 51), 0.9f, this);
            quit_button.OnClick += Menu_button_click_handler;

            bg_rec     = new RectangleF(0, 0, main_game.window_width, main_game.window_height);
            bg_texture = theContent.Load <Texture2D>("Resource/menu_background_2");

            List <string> ls = new List <string>();

            ls.Add("30 fps");
            ls.Add("60 fps");
            ls.Add("120 fps");
            ls.Add("Unlimited fps");
            ContextMenu = new Menu("ContextMenu", font, ls, this);
            ContextMenu.MenuItemSelected += ContextMenu_Item_Selected;

            #region Screen_RegisterHandler
            this.OnRightMouseClick += MenuScreen_OnRightMouseClick;
            #endregion
        }
Пример #3
0
        public Screen(String _name, SivEventHandler theScreenEvent, Game1 parent)
        {
            name        = _name;
            main_game   = parent;
            ScreenEvent = theScreenEvent;

            OnClick            += On_Click_Dispatcher;
            OnMouseUp          += On_Mouse_Up_Dispatcher;
            OnMouseDown        += On_Mouse_Down_Dispatcher;
            OnRightMouseClick  += On_Right_Mouse_Click_Dispatcher;
            OnRightMouseUp     += On_Right_Mouse_Up_Dispatcher;
            OnRightMouseDown   += On_Right_Mouse_Down_Dispatcher;
            OnMiddleMouseClick += On_Middle_Mouse_Click_Dispatcher;
            OnMiddleMouseUp    += On_Middle_Mouse_Up_Dispatcher;
            OnMiddleMouseDown  += On_Middle_Mouse_Down_Dispatcher;
            OnMouseHover       += On_Mouse_Hover_Dispatcher;
            OnMouseScroll      += On_Mouse_Scroll_Dispatcher;
            OnMouseMove        += On_Mouse_Move_Dispatcher;
            OnKeysPress        += On_Keys_Pressed_Dispatcher;
            OnKeysDown         += On_Keys_Down_Dispatcher;
            OnKeysUp           += On_Keys_Up_Dispatcher;
        }
Пример #4
0
        public CharacterSelectScreen(GraphicsDeviceManager graphics, ContentManager Content, SivEventHandler theEvent, Game1 parent)
            : base("JoinScreen", theEvent, parent)
        {
            #region Load Resource
            bg           = new Background(Content.Load <Texture2D>("Resource/graphic/BG7"), this);
            panelTexture = Content.Load <Texture2D>("Resource/graphic/Panel");
            this.Content = Content;
            #endregion

            #region Character Select
            int x = 70; int y = 80;

            for (int i = 0; i < 7; i++)
            {
                characterImage[i] = new Image("Char" + i + " Image", Content.Load <Texture2D>("Resource/character_back"),
                                              new RectangleF((x) + 155 * i, y, 147, 206), 0.3f, this);
            }
            for (int i = 0; i < 7; i++)
            {
                charSelectBorder[i] = new Border("Char " + i + " Border", Color.Red, 2,
                                                 characterImage[i].Rect, this);
            }

            #endregion

            Image infoPanel = new Image("Info Panel", panelTexture, new RectangleF(20, 460, 500, 200), 0.3f, this);
            roomInfoLabel = new Label("Room Info", Game1.arial12Bold, "Test Test Test", 50, 500, 1000, Color.White, this);

            #region Button
            okButton = new ImageButton("OK Button", Content.Load <Texture2D>("Resource/button/ok_button"),
                                       new RectangleF(500, 300, 180, 70), this);
            //okButton = new ImageButton("Cancel Button", Content.Load<Texture2D>("Resource/ok_button"),
            //    new Rectangle(500, 450, 180, 70), this);
            #endregion

            #region inGameScreen_RegisterHandler
            OnKeysDown += CharacterSelectScreen_OnKeysDown;

            //foreach (var img in characterImage)
            //{
            //    img.OnClick = new FormEventHandler(CharacterClick);
            //}

            //okButton.OnClick = new FormEventHandler(OkClick);
            #endregion

            #region XML loading
            //Character's data load
            xml.Load("Data/Character.xml");
            XmlNodeList xml_master_list  = xml.GetElementsByTagName("Master")[0].ChildNodes;
            XmlNodeList xml_servant_list = xml.GetElementsByTagName("Servant")[0].ChildNodes;
            for (int i = 0; i < xml_master_list.Count; i++)
            {
                XmlElement temp     = (XmlElement)xml_master_list[i];
                Character  charTemp = new Character(
                    xml_master_list[i].InnerText,
                    "Master",
                    Convert.ToDouble(temp.GetAttribute("health")),
                    temp.GetAttribute("img"),
                    Character.Type.Master);
                characterList.Add(charTemp);
            }
            for (int i = 0; i < xml_servant_list.Count; i++)
            {
                XmlElement temp     = (XmlElement)xml_servant_list[i];
                Character  charTemp = new Character(
                    xml_servant_list[i].InnerText,
                    temp.GetAttribute("class"),
                    Convert.ToDouble(temp.GetAttribute("health")),
                    temp.GetAttribute("img"),
                    Character.Type.Servant);
                characterList.Add(charTemp);
            }
            //End character's data load
            #endregion
        }
Пример #5
0
        public HostScreen(GraphicsDeviceManager graphics, ContentManager Content, SivEventHandler theEvent, Game1 parent)
            : base("HostScreen", theEvent, parent)
        {
            #region Load Resource
            font = Content.Load <SpriteFont>("Resource/font/TNRoman_12_Bold");
            bg   = new Background(Content.Load <Texture2D>("Resource/background"), this);
            #endregion

            #region Image
            saber = new Image("saber2", Content.Load <Texture2D>("Resource/saber_trans")
                              , new RectangleF(-50, 0, 700, 735), 0.99f, this);
            dialog = new Image("dialog", Content.Load <Texture2D>("Resource/dialog_menu")
                               , new RectangleF(400, 120, 400, 300), 0.98f, this);
            #endregion

            #region Host Game Panel
            ipTextBox = new TextBox("Hosting IP", Game1.whiteTextbox, Game1.highlightedTextbox, Game1.caret
                                    , font, new RectangleF(470, 160, 250, 20), this);
            ipTextBox.Text = "255.255.255.255";

            Host_name_label = new Label("host_name_label",
                                        font, "Player name"
                                        , 470, 200, 150, Color.White, this);

            Host_name_textbox = new TextBox("Host_name_textbox"
                                            , Game1.whiteTextbox, Game1.highlightedTextbox, Game1.caret
                                            , font, new RectangleF(620, 200, 100, 20), this);
            Host_name_textbox.Text = "AltimaZ";

            Room_name_label = new Label("Room_name_label"
                                        , font, "Room name"
                                        , 470, 230, 150, Color.White, this);

            Room_name_textbox = new TextBox("Room_name_textbox"
                                            , Game1.whiteTextbox, Game1.highlightedTextbox, Game1.caret
                                            , font, new RectangleF(620, 230, 100, 20), this);
            Room_name_textbox.Text = "Room Test";

            Number_of_player_label = new Label("Number_of_player_label"
                                               , font, "Number of Player"
                                               , 470, 260, 150, Color.White, this);

            Number_of_player_textbox = new TextBox("Number_of_player_textbox"
                                                   , Game1.whiteTextbox, Game1.highlightedTextbox, Game1.caret
                                                   , font, new RectangleF(620, 260, 100, 20), this);
            Number_of_player_textbox.Text = "3";

            OK_button = new ImageButton("OK_button"
                                        , Content.Load <Texture2D>("Resource/button/ok_button")
                                        , new RectangleF(480, 300, 120, 42), this);
            OK_button.OnClick += Ok_button_clicked;

            Canel_button = new ImageButton("Cancel_button"
                                           , Content.Load <Texture2D>("Resource/button/back_button")
                                           , new RectangleF(600, 300, 120, 42), this);
            Canel_button.OnClick += Cancel_button_clicked;
            #endregion

            List <string> ls = new List <string>();
            ls.Add("Sakuraba Neku");
            ls.Add("Yayyyyy");
            ls.Add("I'm so powerful");
            ls.Add("Sakuraba Neku");
            ls.Add("Yayyyyy");
            ls.Add("I'm so powerful");
            ls.Add("Sakuraba Neku");
            ls.Add("Yayyyyy");
            ls.Add("I'm so powerful");
            ls.Add("Sakuraba Neku");
            ls.Add("Yayyyyy");
            ls.Add("I'm so powerful");
            test_menu = new Menu("test_menu", font, ls, this);
            test_menu.MenuItemSelected += Test_Menu_Item_Selected;

            #region HostScreen_RegisterHandler
            OnKeysDown        += HostScreen_OnKeysDown;
            OnRightMouseClick += HostScreen_OnRightMouseClick;
            #endregion
        }
Пример #6
0
        public RoomScreen(GraphicsDeviceManager graphics, ContentManager Content, SivEventHandler theEvent, Game1 parent)
            : base("RoomScreen", theEvent, parent)
        {
            #region Load Resource
            avatarDefault      = Content.Load <Texture2D>("Resource/avatar_default");
            backGround         = new Background(Content.Load <Texture2D>("Resource/background"), this);
            imageBorderTexture = Content.Load <Texture2D>("Resource/graphic/base2");
            #endregion

            #region Player Content
            div_char[0] = new RectangleF(55, 40, 180, 180);
            div_char[1] = new RectangleF(265, 40, 180, 180);
            div_char[2] = new RectangleF(475, 40, 180, 180);
            div_char[3] = new RectangleF(685, 40, 180, 180);
            div_char[4] = new RectangleF(55, 270, 180, 180);
            div_char[5] = new RectangleF(265, 270, 180, 180);
            div_char[6] = new RectangleF(475, 270, 180, 180);
            div_char[7] = new RectangleF(685, 270, 180, 180);

            //div_border = new Border("player_border", borderColor, 2
            //   , new RectangleF(20, 20, 900, 480), this);
            //Image playerPanel = new Image("Player Panel", panelTexture, new RectangleF(10, 10, 920, 500), 0.3f, this);
            Panel playerPanel = new Panel(new RectangleF(10, 10, 920, 500), this);
            #endregion

            #region Room Information
            //div_info_border = new Border("div_info", borderColor, 2
            //    , new RectangleF(930, 20, 250, 480), this);
            //roomInfoDiv =Image info_pane new Div("Room Info", new RectangleF(932, 22, 246, 476), Color.DarkRed, this);
            //Image infoPanel = new Image("Info Panel", Game1.panelTexture, new RectangleF(932, 22, 246, 476), 0.3f, this);
            Panel infoPanel = new Panel(new RectangleF(932, 22, 246, 476), this);
            roomInfoContent = new Label("Room Info", Game1.gautami12Regular, "", 960, 80, 300, Color.White, this);
            roomInfoTitle   = new Label("Info Label", Game1.gautami14Bold, "Room Information", 970, 50, 300, Color.White, this);
            #endregion

            #region Player Name Label
            for (int i = 0; i < div_char.Length; i++)
            {
                //String name = "div_char" + i;
                //div_char_border[i] = new Border(name, borderColor, 2, div_char[i], this);
                if (i < 4)
                {
                    playerName[i] = new Label("playerNameLabel" + i, Game1.arial12Bold, ""
                                              , 55 + (i * 210), 230, 180, Color.White, this);
                    playerName[i].CenterAlign = true;
                }
                else
                {
                    playerName[i] = new Label("playerNameLabel" + i, Game1.arial12Bold, ""
                                              , 55 + ((i - 4) * 210), 460, 180, Color.White, this);
                    playerName[i].CenterAlign = true;
                }
            }
            MainPlayer_Boder = new Border("MainPlayer_Border", Color.Purple, 2, new RectangleF(0, 0, 0, 0), this);
            #endregion

            #region Button
            cancelButtonTexture = Content.Load <Texture2D>("Resource/button/cancel_button");
            readyButtonTexture  = Content.Load <Texture2D>("Resource/button/ready");
            startButtonTexture  = Content.Load <Texture2D>("Resource/button/start_button");

            start_button = new ImageButton("Start", startButtonTexture
                                           , new RectangleF(980, 540, 180, 70), this);
            start_button.OnClick += Start_button_clicked;

            quit_button = new ImageButton("Quit", Content.Load <Texture2D>("Resource/button/quit_button")
                                          , new RectangleF(980, 620, 180, 70), this);
            quit_button.OnClick += Quit_button_clicked;
            #endregion

            #region Chat
            //Textbox
            chat = new TextBox("Chat Input"
                               , Game1.whiteTextbox, Game1.highlightedTextbox, Game1.caret
                               , Game1.font, new RectangleF(22, 662, 946, 20), this);
            chat.OnEnterPressed += ChatBox_EnterPressed;

            chatDisplay = new TextBox("Chat Display"
                                      , Game1.transparentTextBox, Game1.highlightedTextbox, Game1.caret
                                      , Game1.scrollbarBackground, Game1.scrollbar
                                      , Game1.font, new RectangleF(22, 522, 946, 126), this);
            chatDisplay.Color       = Color.White;
            chatDisplay.ReadOnly    = true;
            chatDisplay.vscrollable = true;

            //Border
            chat_box_border   = new Border("chat_screen", Color.White, 2, chatDisplay.Rect, this);
            chat_input_border = new Border("chat_input", Color.White, 2, chat.Rect, this);
            #endregion

            #region RoomScreen_RegisterHandler
            OnKeysDown += RoomScreen_OnKeysDown;
            #endregion
        }