public static void Update()
 {
     if (KeyBoardHandler.KeyDown(Core.KeyBindings.DebugControl) && KeyBoardHandler.KeyDown(Keys.C))
     {
         //Debug.Print("CRASH IN: " + Delay.ToString(NumberFormatInfo.InvariantInfo));
         Delay -= 0.1f;
         if (Delay <= 0f)
         {
             Crash();
         }
     }
     else
     {
         Delay = 14f;
     }
 }
        public static void FunctionKeys()
        {
            if (KeyBoardHandler.KeyPressed(Core.KeyBindings.ScreenShot) && Core.CurrentScreen.CanTakeScreenshot)
            {
                CaptureScreen();
            }

            if (KeyBoardHandler.KeyPressed(Core.KeyBindings.FullScreen) && Core.CurrentScreen.CanGoFullscreen)
            {
                ToggleFullScreen();
            }

            if (KeyBoardHandler.KeyPressed(Core.KeyBindings.DebugControl))
            {
                Core.GameOptions.ShowDebug = !Core.GameOptions.ShowDebug;
                Options.SaveOptions(Core.GameOptions);
            }
            if (KeyBoardHandler.KeyPressed(Core.KeyBindings.GUIControl))
            {
                Core.GameOptions.ShowGUI = !Core.GameOptions.ShowGUI;
                Options.SaveOptions(Core.GameOptions);
            }
            if (KeyBoardHandler.KeyPressed(Core.KeyBindings.MuteMusic) && Core.CurrentScreen.CanMuteMusic)
            {
                Core.GameOptions.Muted = !Core.GameOptions.Muted;
                MusicManager.Mute(Core.GameOptions.Muted);
                SoundEffectManager.Mute(Core.GameOptions.Muted);
                Options.SaveOptions(Core.GameOptions);
                Core.CurrentScreen.ToggledMute();
            }

            if (KeyBoardHandler.KeyPressed(Core.KeyBindings.LightKey))
            {
                Core.GameOptions.LightingEnabled = !Core.GameOptions.LightingEnabled;
            }

            if (KeyBoardHandler.KeyDown(Core.KeyBindings.DebugControl))
            {
                if (KeyBoardHandler.KeyPressed(Keys.F))
                {
                    TextureManager.TextureList.Clear();
                }

                if (KeyBoardHandler.KeyPressed(Keys.S))
                {
                    Core.SetWindowSize(new Vector2(1200, 680));
                }

                if (KeyBoardHandler.KeyPressed(Keys.L))
                {
                    Logger.DisplayLog = !Logger.DisplayLog;
                }
            }
            if (ControllerHandler.ButtonPressed(Buttons.Back, true))
            {
                Core.GameOptions.GamePadEnabled = !Core.GameOptions.GamePadEnabled;
                Core.GameMessage.ShowMessage(Core.GameOptions.GamePadEnabled ? "Enabled XBOX 360 GamePad support." : "Disabled XBOX 360 GamePad support.", 12, FontManager.MainFont, Color.White);
                Options.SaveOptions(Core.GameOptions);
            }

            if (KeyBoardHandler.KeyPressed(Keys.B) && KeyBoardHandler.KeyDown(Core.KeyBindings.DebugControl))
            {
                Core.GameOptions.DrawViewBox = !Core.GameOptions.DrawViewBox;
            }
        }
Example #3
0
        public void Update()
        {
            if (Showing)
            {
                ResetCursor();
                if (PositionY <= Core.WindowSize.Height - 160f)
                {
                    if (!_through)
                    {
                        if (Text.Length > _currentChar)
                        {
                            if (_delay <= 0f)
                            {
                                if (Text[_currentChar].ToString(NumberFormatInfo.InvariantInfo) == "\\")
                                {
                                    if (Text.Length > _currentChar + 1)
                                    {
                                        _showText[_currentLine] += Text[_currentChar + 1];

                                        _currentChar += 2;
                                    }
                                    else
                                    {
                                        _currentChar += 1;
                                    }
                                }
                                else
                                {
                                    switch (Text[_currentChar])
                                    {
                                    case '~':
                                        if (_currentLine == 1)
                                        {
                                            _through = true;
                                        }
                                        else
                                        {
                                            _currentLine += 1;
                                        }
                                        break;

                                    case '*':
                                        _currentLine   = 0;
                                        _clearNextLine = true;
                                        _through       = true;
                                        break;

                                    case '%':
                                        ProcessChooseBox();
                                        break;

                                    default:
                                        _showText[_currentLine] += Text[_currentChar];
                                        break;
                                    }

                                    _currentChar += 1;
                                }

                                if (KeyBoardHandler.KeyDown(Core.KeyBindings.Enter1) || KeyBoardHandler.KeyDown(Core.KeyBindings.Enter2) || MouseHandler.ButtonDown(MouseHandler.MouseButtons.LeftButton) == true || ControllerHandler.ButtonDown(Buttons.A) == true || ControllerHandler.ButtonDown(Buttons.B) == true)
                                {
                                    _delay = 0f;
                                }
                                else
                                {
                                    _delay = GetTextSpeed();
                                }
                            }
                            else
                            {
                                _delay -= 0.1f;
                            }
                        }
                        else
                        {
                            _through = true;
                        }
                    }
                    else
                    {
                        if (Controls.Accept() || Controls.Dismiss())
                        {
                            SoundEffectManager.PlaySound("select");
                            if (Text.Length <= _currentChar)
                            {
                                if (CanProceed == true)
                                {
                                    Showing = false;
                                    ResetCursor();

                                    if ((FollowUp != null))
                                    {
                                        FollowUp.Invoke();
                                        FollowUp = null;
                                    }

                                    TextFont  = FontManager.GetFontContainer("textfont");
                                    TextColor = DefaultColor;
                                    if (_doReDelay == true)
                                    {
                                        ReDelay = 1f;
                                    }
                                }
                            }
                            else
                            {
                                if (_clearNextLine == true)
                                {
                                    _showText[0] = "";
                                }
                                else
                                {
                                    _showText[0] = _showText[1];
                                }
                                _showText[1]   = "";
                                _through       = false;
                                _clearNextLine = false;
                            }
                        }
                    }
                }
                else
                {
                    float ySpeed = 3.5f;
                    switch (TextSpeed)
                    {
                    case 1:
                        ySpeed = 3.5f;
                        break;

                    case 2:
                        ySpeed = 4.5f;
                        break;

                    case 3:
                        ySpeed = 6.5f;
                        break;
                    }
                    PositionY -= ySpeed;
                }
            }
            else
            {
                if (ReDelay > 0f)
                {
                    ReDelay -= 0.1f;
                    if (ReDelay <= 0f)
                    {
                        ReDelay = 0f;
                    }
                }
            }
        }
Example #4
0
        public static void Draw()
        {
            if (BaseJoinServerScreen.Online && BaseConnectScreen.Connected)
            {
                if (KeyBoardHandler.KeyDown(Core.KeyBindings.OnlineStatus))
                {
                    var playerList = Core.ServersManager.PlayerCollection;

                    int width  = 1;
                    int height = playerList.Count;

                    if (height > 10)
                    {
                        width = Convert.ToInt32(Math.Ceiling(height / 10d));
                    }
                    height = 10;

                    int startX = Convert.ToInt32(Core.WindowSize.Width / 2 - ((width * 256) / 2));
                    int startY = 120;

                    for (var x = 1; x <= width; x++)
                    {
                        for (var y = 1; y <= height; y++)
                        {
                            Canvas.DrawRectangle(new Rectangle(startX + (x - 1) * 256, startY + (y - 1) * 40, 256, 40), new Color(0, 0, 0, 150));
                            if (playerList.Count - 1 >= (x - 1) * 10 + (y - 1))
                            {
                                string name = playerList[(x - 1) * 10 + (y - 1)].Name;
                                Color  c    = Color.White;
                                if (playerList[(x - 1) * 10 + (y - 1)].ServersID == Core.ServersManager.ID)
                                {
                                    name = Core.Player.Name;
                                    c    = BaseChat.OwnColor;
                                }
                                else
                                {
                                    if (Core.Player.IsGameJoltSave)
                                    {
                                        string GJID = playerList[(x - 1) * 10 + (y - 1)].GameJoltId;
                                        if (!string.IsNullOrEmpty(GJID) && Core.GameJoltSave.Friends.Contains(GJID))
                                        {
                                            c = BaseChat.FriendColor;
                                        }
                                    }
                                }
                                Core.SpriteBatch.DrawString(FontManager.MainFont, name, new Vector2(startX + (x - 1) * 256 + 4, startY + (y - 1) * 40 + 6), c);

                                switch (playerList[(x - 1) * 10 + (y - 1)].BusyType)
                                {
                                case 1:
                                    //Battle
                                    Core.SpriteBatch.Draw(TextureManager.GetTexture("Textures|emoticons", new Rectangle(48, 16, 16, 16), ""), new Rectangle(startX + (x - 1) * 256 + 222, startY + (y - 1) * 40 + 6, 32, 32), Color.White);
                                    break;

                                case 2:
                                    //Chat
                                    Core.SpriteBatch.Draw(TextureManager.GetTexture("Textures|emoticons", new Rectangle(0, 0, 16, 16), ""), new Rectangle(startX + (x - 1) * 256 + 222, startY + (y - 1) * 40 + 6, 32, 32), Color.White);
                                    break;

                                case 3:
                                    //AFK
                                    Core.SpriteBatch.Draw(TextureManager.GetTexture("Textures|emoticons", new Rectangle(0, 48, 16, 16), ""), new Rectangle(startX + (x - 1) * 256 + 222, startY + (y - 1) * 40 + 6, 32, 32), Color.White);
                                    break;
                                }
                            }
                            Canvas.DrawBorder(3, new Rectangle(startX + (x - 1) * 256, startY + (y - 1) * 40, 256, 40), new Color(220, 220, 220));
                        }
                    }

                    string serverName  = BaseJoinServerScreen.SelectedServer.GetName();
                    int    plateLength = 256;
                    if (FontManager.MainFont.MeasureString(serverName).X > 230f)
                    {
                        plateLength = 26 + Convert.ToInt32(FontManager.MainFont.MeasureString(serverName).X);
                    }

                    Canvas.DrawRectangle(new Rectangle(Convert.ToInt32(Core.WindowSize.Width / 2 - plateLength / 2), 80, plateLength, 40), new Color(0, 0, 0, 150));
                    Core.SpriteBatch.DrawString(FontManager.MainFont, serverName, new Vector2(Convert.ToInt32(Core.WindowSize.Width / 2 - plateLength / 2) + 4, 80 + 6), BaseChat.ServerColor);
                    Canvas.DrawBorder(3, new Rectangle(Convert.ToInt32(Core.WindowSize.Width / 2 - plateLength / 2), 80, plateLength, 40), new Color(220, 220, 220));
                }
            }
        }