Exemplo n.º 1
0
            public NewCharacterWindow() : base(null, true)
            {
                zHeroClass = HeroClass.Invalid;
                InitProps(new Vector2(-11, 5), new Vector2(22, 15), new Color(0.3f, 0.3f, 0.3f, 0.75f), "", Color.White);
                CloseWithEscape = true;

                zNametextbox = new TextBox(this);
                zNametextbox.InitProps(Position + new Vector2(1, -7), new Vector2(14, 1.5f), new Color(0.1f, 0.1f, 0.1f, 1), "", Color.White);
                zNametextbox.MaxLength = 18;

                Window elfbutton = new Button(this);

                elfbutton.InitProps(Position + new Vector2(1, -1), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Elf", Color.White);
                elfbutton.OnClick = delegate()
                {
                    DisplayCharSprite(HeroClass.Elf);
                };

                Window knightbutton = new Button(this);

                knightbutton.InitProps(elfbutton.Position + new Vector2(5, 0), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Knight", Color.White);
                knightbutton.OnClick = delegate()
                {
                    DisplayCharSprite(HeroClass.Knight);
                };

                Window wizardbutton = new Button(this);

                wizardbutton.InitProps(knightbutton.Position + new Vector2(5, -0), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Wizard", Color.White);
                wizardbutton.OnClick = delegate()
                {
                    DisplayCharSprite(HeroClass.Wizard);
                };

                Window createbutton = new Button(this);

                createbutton.InitProps(Position + new Vector2(16.5f, -7), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Create", Color.White);
                createbutton.OnClick = CreateNewCharacter;

                Window backbutton = new Button(this);

                backbutton.InitProps(createbutton.Position + new Vector2(0, -3), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Back", Color.White);
                backbutton.OnClick = Destroy;

                zCharSprite = new Window(this);
                zCharSprite.InitProps(Position + new Vector2(15, -1), new Vector2(4, 4), Color.White, "", Color.White);
                zCharSprite.Visible = false;
            }
Exemplo n.º 2
0
 public Chat() : base()
 {
     InitProps(new Vector2(-22, -11), new Vector2(10, 1), new Color(0.3f, 0.3f, 0.3f, 0.75f), "", Color.White);
     zMaxCount  = 100;
     zShowCount = 7;
     zTexts     = new List <Window>();
     for (int i = 0; i < zShowCount; i++)
     {
         Window w = new Window(this);
         w.InitProps(Position + new Vector2(0, i * 1.5f + 2),
                     new Vector2(15, 1), new Color(0.1f, 0.1f, 0.1f, 1), "", Color.White);
         w.Visible = false;
         zTexts.Add(w);
     }
     zMessages   = new Queue <ChatMessage>();
     zStartIndex = -1;
     InitEvents();
     zMessageTextBox           = new TextBox(this);
     zMessageTextBox.MaxLength = 35;
     zMessageTextBox.InitProps(Position + new Vector2(3, 0), new Vector2(10, 1), new Color(0.1f, 0.1f, 0.1f, 1), "", Color.White);
     zMessageTextBox.AutoScale = true;
     zMessageTextBox.Visible   = false;
     zMessageTextBox.OnEnter   = delegate()
     {
         ProcessInput(zMessageTextBox.Text);
         zMessageTextBox.Text    = string.Empty;
         zMessageTextBox.Visible = false;
     };
     //hide if not typing
     Globals.EventManager.AddEvent(delegate()
     {
         if (Collect)
         {
             return(0);
         }
         if (!zMessageTextBox.IsTyping())
         {
             zMessageTextBox.Visible = false;
         }
         return(1);
     }, "hideifnotyping");
 }
Exemplo n.º 3
0
 public Chat() : base()
 {
     InitProps(new Vector2(-22,-11),new Vector2(10,1), new Color(0.3f, 0.3f, 0.3f, 0.75f), "", Color.White);
     zMaxCount = 100;
     zShowCount = 7;
     zTexts = new List<Window>();
     for (int i = 0; i < zShowCount; i++)
     {
         Window w = new Window(this);
         w.InitProps(Position + new Vector2(0, i * 1.5f +2), 
             new Vector2(15, 1), new Color(0.1f, 0.1f, 0.1f, 1), "", Color.White);
         w.Visible = false;
         zTexts.Add(w);
     }
     zMessages = new Queue<ChatMessage>();
     zStartIndex = -1;
     InitEvents();
     zMessageTextBox = new TextBox(this);
     zMessageTextBox.MaxLength = 35;            
     zMessageTextBox.InitProps(Position + new Vector2(3, 0), new Vector2(10, 1), new Color(0.1f, 0.1f, 0.1f, 1), "", Color.White);
     zMessageTextBox.AutoScale = true;
     zMessageTextBox.Visible = false;
     zMessageTextBox.OnEnter = delegate ()
     {
         ProcessInput(zMessageTextBox.Text);
         zMessageTextBox.Text = string.Empty;
         zMessageTextBox.Visible = false;
     };
     //hide if not typing
     Globals.EventManager.AddEvent(delegate ()
     {
         if (Collect)
             return 0;
         if (!zMessageTextBox.IsTyping())
             zMessageTextBox.Visible = false;
         return 1;
     }, "hideifnotyping");
 }
Exemplo n.º 4
0
            public NewCharacterWindow():base(null,true)
            {
                zHeroClass = HeroClass.Invalid;
                InitProps(new Vector2(-11, 5), new Vector2(22, 15), new Color(0.3f, 0.3f, 0.3f, 0.75f), "", Color.White);
                CloseWithEscape = true;

                zNametextbox = new TextBox(this);
                zNametextbox.InitProps(Position + new Vector2(1, -7), new Vector2(14, 1.5f), new Color(0.1f, 0.1f, 0.1f, 1), "", Color.White);
                zNametextbox.MaxLength = 18;

                Window elfbutton = new Button(this);
                elfbutton.InitProps(Position + new Vector2(1, -1), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Elf", Color.White);
                elfbutton.OnClick = delegate ()
                {
                    DisplayCharSprite(HeroClass.Elf);
                };

                Window knightbutton = new Button(this);
                knightbutton.InitProps(elfbutton.Position + new Vector2(5, 0), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Knight", Color.White);
                knightbutton.OnClick = delegate ()
                {
                    DisplayCharSprite(HeroClass.Knight);
                };

                Window wizardbutton = new Button(this);
                wizardbutton.InitProps(knightbutton.Position + new Vector2(5, -0), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Wizard", Color.White);
                wizardbutton.OnClick = delegate ()
                {
                    DisplayCharSprite(HeroClass.Wizard);
                };

                Window createbutton = new Button(this);
                createbutton.InitProps(Position + new Vector2(16.5f, -7), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Create", Color.White);
                createbutton.OnClick = CreateNewCharacter;

                Window backbutton = new Button(this);
                backbutton.InitProps(createbutton.Position + new Vector2(0, -3), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Back", Color.White);
                backbutton.OnClick = Destroy;

                zCharSprite = new Window(this);
                zCharSprite.InitProps(Position + new Vector2(15, -1), new Vector2(4, 4), Color.White, "", Color.White);
                zCharSprite.Visible = false;
            }
Exemplo n.º 5
0
            public PlayWindow() : base(null, true)
            {
                InitProps(new Vector2(-11, 5), new Vector2(22, 10), new Color(0.3f, 0.3f, 0.3f, 0.75f), "", Color.White);
                CloseWithEscape = true;

                var zServerLabel = new Window(this);
                zServerLabel.InitProps(Position + new Vector2(1, -1), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 0), "Server", Color.White);

                zServer = new TextBox(this);
                zServer.InitProps(zServerLabel.Position + new Vector2(5, 0), new Vector2(15, 1.5f), new Color(0.1f, 0.1f, 0.1f, 1), Ini.Server, Color.White);
                zServer.MaxLength = 30;

                var portlabel = new Window(this);
                portlabel.InitProps(Position + new Vector2(1, -4), new Vector2(3, 2), new Color(0.1f, 0.1f, 0.1f, 0), "Port", Color.White);


                zPort = new TextBox(this);
                zPort.InitProps(portlabel.Position + new Vector2(5, 0), new Vector2(15, 1.5f), new Color(0.1f, 0.1f, 0.1f, 1), Ini.Port, Color.White);
                zPort.MaxLength = 5;

                Window startbutton = new Button(this);
                startbutton.InitProps(Position + new Vector2(1, -7), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Start", Color.White);
                startbutton.OnClick = delegate ()
                {
                    Globals.Ip = "127.0.0.1";
                    MainMenu m = (MainMenu)ScreenManager.CurrentScreen;
                    if (TryPort())
                        m.Start();
                    else
                        new MessageBox("Invalid port");
                };

                Window joinbutton = new Button(this);
                joinbutton.InitProps(Position + new Vector2(6, -7), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Join", Color.White);
                joinbutton.OnClick = delegate()
                {
                    Globals.Ip = zServer.Text == string.Empty ? "localhost" : zServer.Text;
                    MainMenu m = (MainMenu)ScreenManager.CurrentScreen;
                    if (TryPort())
                        m.Join();
                    else
                        new MessageBox("Invalid port");
                };

                Window closebutton = new Button(this);
                closebutton.InitProps(Position + new Vector2(11, -7), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Back", Color.White);
                closebutton.OnClick = delegate ()
                {
                    Destroy();
                };
            }
Exemplo n.º 6
0
            public PlayWindow() : base(null, true)
            {
                InitProps(new Vector2(-11, 5), new Vector2(22, 10), new Color(0.3f, 0.3f, 0.3f, 0.75f), "", Color.White);
                CloseWithEscape = true;

                var zServerLabel = new Window(this);

                zServerLabel.InitProps(Position + new Vector2(1, -1), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 0), "Server", Color.White);

                zServer = new TextBox(this);
                zServer.InitProps(zServerLabel.Position + new Vector2(5, 0), new Vector2(15, 1.5f), new Color(0.1f, 0.1f, 0.1f, 1), Ini.Server, Color.White);
                zServer.MaxLength = 30;

                var portlabel = new Window(this);

                portlabel.InitProps(Position + new Vector2(1, -4), new Vector2(3, 2), new Color(0.1f, 0.1f, 0.1f, 0), "Port", Color.White);


                zPort = new TextBox(this);
                zPort.InitProps(portlabel.Position + new Vector2(5, 0), new Vector2(15, 1.5f), new Color(0.1f, 0.1f, 0.1f, 1), Ini.Port, Color.White);
                zPort.MaxLength = 5;

                Window startbutton = new Button(this);

                startbutton.InitProps(Position + new Vector2(1, -7), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Start", Color.White);
                startbutton.OnClick = delegate()
                {
                    Globals.Ip = "127.0.0.1";
                    MainMenu m = (MainMenu)ScreenManager.CurrentScreen;
                    if (TryPort())
                    {
                        m.Start();
                    }
                    else
                    {
                        new MessageBox("Invalid port");
                    }
                };

                Window joinbutton = new Button(this);

                joinbutton.InitProps(Position + new Vector2(6, -7), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Join", Color.White);
                joinbutton.OnClick = delegate()
                {
                    Globals.Ip = zServer.Text == string.Empty ? "localhost" : zServer.Text;
                    MainMenu m = (MainMenu)ScreenManager.CurrentScreen;
                    if (TryPort())
                    {
                        m.Join();
                    }
                    else
                    {
                        new MessageBox("Invalid port");
                    }
                };

                Window closebutton = new Button(this);

                closebutton.InitProps(Position + new Vector2(11, -7), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Back", Color.White);
                closebutton.OnClick = delegate()
                {
                    Destroy();
                };
            }