Пример #1
0
    private static void JoinGame()
    {
        // Reseta os valores
        Chat.Order                 = new System.Collections.Generic.List <Chat.Structure>();
        Chat.Lines_First           = 0;
        Loop.Chat_Timer            = Environment.TickCount + Chat.Sleep_Timer;
        TextBoxes.Get("Chat").Text = string.Empty;
        CheckBoxes.Get("Options_Sounds").Checked = Lists.Options.Sounds;
        CheckBoxes.Get("Options_Musics").Checked = Lists.Options.Musics;
        CheckBoxes.Get("Options_Chat").Checked   = Lists.Options.Chat;
        Game.Need_Information = 0;
        Loop.Chat_Timer       = Loop.Chat_Timer = Environment.TickCount + 10000;
        Player.Me.Party       = new byte[0];

        // Fecha os paineis
        Panels.Get("Menu_Character").Visible   = false;
        Panels.Get("Menu_Inventory").Visible   = false;
        Panels.Get("Menu_Options").Visible     = false;
        Panels.Get("Chat").Visible             = false;
        Panels.Get("Drop").Visible             = false;
        Panels.Get("Party_Invitation").Visible = false;

        // Abre o jogo
        Audio.Music.Stop();
        Tools.CurrentWindow = Tools.Windows.Game;
    }
Пример #2
0
    private static void Connect_Ok()
    {
        // Salva o nome do usuário
        Lists.Options.Username = TextBoxes.Get("Connect_Username").Text;
        Write.Options();

        // Conecta-se ao jogo
        Game.SetSituation(Game.Situations.Connect);
    }
Пример #3
0
    public static void Register()
    {
        NetOutgoingMessage Data = Socket.Device.CreateMessage();

        // Envia os dados
        Data.Write((byte)Packets.Register);
        Data.Write(TextBoxes.Get("Register_Username").Text);
        Data.Write(TextBoxes.Get("Register_Password").Text);
        Packet(Data);
    }
Пример #4
0
    public static void Connect()
    {
        NetOutgoingMessage Data = Socket.Device.CreateMessage();

        // Envia os dados
        Data.Write((byte)Packets.Connect);
        Data.Write(TextBoxes.Get("Connect_Username").Text);
        Data.Write(TextBoxes.Get("Connect_Password").Text);
        Data.Write(false); // Acesso pelo cliente
        Packet(Data);
    }
Пример #5
0
    private static void Register_Ok()
    {
        // Regras de segurança
        if (TextBoxes.Get("Register_Password").Text != TextBoxes.Get("Register_Password2").Text)
        {
            MessageBox.Show("The password don't match.");
            return;
        }

        // Registra o jogador, se estiver tudo certo
        Game.SetSituation(Game.Situations.Registrar);
    }
Пример #6
0
    public static void CreateCharacter()
    {
        NetOutgoingMessage Data = Socket.Device.CreateMessage();

        // Envia os dados
        Data.Write((byte)Packets.CreateCharacter);
        Data.Write(TextBoxes.Get("CreateCharacter_Name").Text);
        Data.Write(Game.CreateCharacter_Class);
        Data.Write(CheckBoxes.Get("GenderMale").Checked);
        Data.Write(Game.CreateCharacter_Tex);
        Packet(Data);
    }
Пример #7
0
    private static void CreateCharacter()
    {
        // Reseta os valores
        TextBoxes.Get("CreateCharacter_Name").Text = string.Empty;
        CheckBoxes.Get("GenderMale").Checked       = true;
        CheckBoxes.Get("GenderFemale").Checked     = false;
        Game.CreateCharacter_Class = 1;
        Game.CreateCharacter_Tex   = 0;

        // Abre o painel de criação de personagem
        Panels.Menu_Close();
        Panels.Get("CreateCharacter").Visible = true;
    }
Пример #8
0
    private static void Drop_Confirm()
    {
        // Quantidade
        short.TryParse(TextBoxes.Get("Drop_Amount").Text, out short Amount);

        // Verifica se o valor digitado é válidp
        if (Amount == 0)
        {
            MessageBox.Show("Enter a valid value!");
            return;
        }

        // Solta o item
        Send.DropItem(Game.Drop_Slot, Amount);
        Panels.Get("Drop").Visible = false;
    }
Пример #9
0
    private static void Game_Chat()
    {
        Panels.Structure Tool = Panels.Get("Chat");
        Tool.Visible = TextBoxes.Focused != null && ((TextBoxes.Structure)TextBoxes.Focused.Data).Name.Equals("Chat");

        // Renderiza as mensagens
        if (Tool.Visible || (Chat.Text_Visible && Lists.Options.Chat))
        {
            for (byte i = Chat.Lines_First; i <= Chat.Lines_Visible + Chat.Lines_First; i++)
            {
                if (Chat.Order.Count > i)
                {
                    DrawText(Chat.Order[i].Text, 16, 461 + 11 * (i - Chat.Lines_First), Chat.Order[i].Color);
                }
            }
        }

        // Dica de como abrir o chat
        if (!Tool.Visible)
        {
            DrawText("Press [Enter] to open chat.", TextBoxes.Get("Chat").Position.X + 5, TextBoxes.Get("Chat").Position.Y + 3, SFML.Graphics.Color.White);
        }
    }
Пример #10
0
    private static void Options()
    {
        // Cria o arquivo se ele não existir
        if (!Directories.Options.Exists)
        {
            Clear.Options();
            Write.Options();
        }
        // Lê os dados
        else
        {
            FileStream Stream = Directories.Options.OpenRead();
            Lists.Options = (Lists.Structures.Options) new BinaryFormatter().Deserialize(Stream);
            Stream.Close();
        }

        // Eventos
        CheckBoxes.Get("Connect_Save_Username").Checked = Lists.Options.SaveUsername;
        if (Lists.Options.SaveUsername)
        {
            TextBoxes.Get("Connect_Username").Text = Lists.Options.Username;
        }
    }
Пример #11
0
    public static void Type()
    {
        TextBoxes.Structure Tool  = TextBoxes.Get("Chat");
        Panels.Structure    Panel = Panels.Get("Chat");

        // Somente se necessário
        if (!Player.IsPlaying(Player.MyIndex))
        {
            return;
        }

        // Altera a visiblidade da caixa
        Panel.Visible = !Panel.Visible;

        // Altera o foco do digitalizador
        if (Panel.Visible)
        {
            Text_Visible      = true;
            TextBoxes.Focused = Tools.Get(Tool);
            return;
        }
        else
        {
            TextBoxes.Focused = null;
        }

        // Dados
        string Message = Tool.Text;

        // Somente se necessário
        if (Message.Length < 3)
        {
            Tool.Text = string.Empty;
            return;
        }

        // Limpa a caixa de texto
        Tool.Text = string.Empty;

        // Separa as mensagens em partes
        string[] Parts = Message.Split(' ');

        // Comandos
        switch (Parts[0].ToLower())
        {
        case "/party":
            if (Parts.Length > 1)
            {
                Send.Party_Invite(Parts[1]);
            }
            break;

        case "/partyleave":
            Send.Party_Leave();
            break;

        default:
            // Mensagem lobal
            if (Message.Substring(0, 1) == "'")
            {
                Send.Message(Message.Substring(1), Game.Messages.Global);
            }
            // Mensagem particular
            else if (Message.Substring(0, 1) == "!")
            {
                // Previne erros
                if (Parts.GetUpperBound(0) < 1)
                {
                    AddText("Use: '!' + Addressee + 'Message'", Color.White);
                }
                else
                {
                    // Dados
                    string Destiny = Message.Substring(1, Parts[0].Length - 1);
                    Message = Message.Substring(Parts[0].Length + 1);

                    // Envia a mensagem
                    Send.Message(Message, Game.Messages.Private, Destiny);
                }
            }
            // Mensagem mapa
            else
            {
                Send.Message(Message, Game.Messages.Map);
            }
            break;
        }
    }