Example #1
0
        public static void RegisterMenu_RegisterClick(object sender, CallbackArgs e)
        {
            // Retrieve our data from the UI.
            var username    = Interface.GUI.Get<TGUI.Panel>("mainmenu").Get<TGUI.EditBox>("username").Text;
            var password    = Interface.GUI.Get<TGUI.Panel>("mainmenu").Get<TGUI.EditBox>("password").Text;
            var password2   = Interface.GUI.Get<TGUI.Panel>("mainmenu").Get<TGUI.EditBox>("password2").Text;

            // Perform some preliminary checks.
            if (username.Length < 1 || password.Length < 1 || password2.Length < 1) {
                Interface.ShowMessagebox("Error", "Please fill in every field.");
                return;
            }
            if (!password.Equals(password2)) {
                Interface.ShowMessagebox("Error", "Passwords do not match.");
                return;
            }

            // We've passed the client-side checks! On to the server we go!
            Send.NewAccount(username, password);

            // Set our screen to the loading screen since we are awaiting a response.
            // Make sure we store some data so we can come back to this.
            Interface.LastWindow = Interface.Windows.Register;
            Interface.LastData.Clear();
            Interface.LastData.Add(username);
            Interface.LastData.Add(password);
            Interface.LastData.Add(password2);
            Interface.ChangeUI(Interface.Windows.Loading);
            Interface.GUI.Get<Panel>("loadpanel").Get<Label>("loadtext").Text = "Sending account data..";
        }
Example #2
0
 internal static void CharacterSelect_Char1Click(object sender, CallbackArgs e)
 {
     // Make sure we have a character here or not.
     if (Data.CharSelect[0].Name.Length > 0) {
         Send.UseCharacter(0);
     } else {
         Send.RequestNewCharacter();
     }
     Interface.LastWindow = Interface.Windows.CharacterCreate;
     Interface.LastData.Clear();
     Interface.ChangeUI(Interface.Windows.Loading);
     Interface.GUI.Get<Panel>("loadpanel").Get<Label>("loadtext").Text = "Waiting for server...";
 }
Example #3
0
 public static void RegisterMenu_CancelClick(object sender, CallbackArgs e)
 {
     // Change our UI over to the Main interface.
     Interface.ChangeUI(Interface.Windows.MainMenu);
 }
Example #4
0
 public static void MainMenu_RegisterClick(object sender, CallbackArgs e)
 {
     // Change our UI over to the Registration interface.
     Interface.ChangeUI(Interface.Windows.Register);
 }
        private void buttonInventory_LeftMouseClickedCallback(object sender, CallbackArgs e)
        {
            this._inventoryVisible = !this._inventoryVisible;

            this.GUI.Get<Picture>("picInventory").Visible = this._inventoryVisible;
        }
Example #6
0
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Respond when the internal list box gets unfocused
 /// </summary>
 ///
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 private void ListBoxUnfocusedCallbackFunction(object sender, CallbackArgs e)
 {
     if (m_MouseHover == false)
         HideListBox();
 }
        private void buttonSendLogin_LeftMouseClickedCallback(object sender, CallbackArgs e)
        {
            this.GUI.Get<Label>("labelStatus").Text = "Connecting to the server...";
            this.GUI.Get<Label>("labelStatus").Position = new Vector2f((Window.Size.X / 2) - (this.GUI.Get<Label>("labelStatus").Size.X / 2), 50);

            ServiceLocator.NetManager.Connect();

            this.GUI.Get<Label>("labelStatus").Text = "Connected! Sending login information...";
            this.GUI.Get<Label>("labelStatus").Position = new Vector2f((Window.Size.X / 2) - (this.GUI.Get<Label>("labelStatus").Size.X / 2), 50);

            var loginPacket = new Packet(PacketType.LoginPacket);
            loginPacket.Message.Write(this.GUI.Get<EditBox>("textUser").Text);
            loginPacket.Message.Write(this.GUI.Get<EditBox>("textPassword").Text);

            ServiceLocator.NetManager.SendMessage(loginPacket.Message, NetDeliveryMethod.ReliableOrdered, ChannelTypes.WORLD);
        }
Example #8
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Copy constructor
        /// </summary>
        ///
        /// <param name="copy">Instance to copy</param>
        ///
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public Widget(Widget copy)
            : base(copy)
        {
            FocusedCallback      = copy.FocusedCallback;
            UnfocusedCallback    = copy.UnfocusedCallback;
            MouseEnteredCallback = copy.MouseEnteredCallback;
            MouseLeftCallback    = copy.MouseLeftCallback;

            m_Enabled            = copy.m_Enabled;
            m_Visible            = copy.m_Visible;
            m_WidgetPhase        = copy.m_WidgetPhase;
            m_Parent             = copy.m_Parent;
            m_Opacity            = copy.m_Opacity;
            m_AllowFocus         = copy.m_AllowFocus;
            m_AnimatedWidget     = copy.m_AnimatedWidget;
            m_DraggableWidget    = copy.m_DraggableWidget;
            m_Container          = copy.m_Container;

            m_Callback = new CallbackArgs();
            m_Callback.Id = copy.m_Callback.Id;
        }
Example #9
0
 internal static void CreateCharacter_CancelClick(object sender, CallbackArgs e)
 {
     // Change our UI!
     Interface.ChangeUI(Interface.Windows.CharacterSelect);
 }
Example #10
0
 internal static void CharacterSelect_LogoutClick(object sender, CallbackArgs e)
 {
     Send.Logout();
     Interface.ChangeUI(Interface.Windows.MainMenu);
 }
Example #11
0
        private void textMyChat_ReturnKeyPressedCallback(object sender, CallbackArgs e)
        {
            var textMyChat = this.GUI.Get<EditBox>("textMyChat");
            var chatMessagePacket = new Packet(PacketType.ChatMessagePacket);

            chatMessagePacket.Message.Write(textMyChat.Text);
            ServiceLocator.NetManager.SendMessage(chatMessagePacket.Message, NetDeliveryMethod.Unreliable, ChannelTypes.CHAT);
            textMyChat.Text = "";
        }
Example #12
0
 private void picInventory_LeftMouseClickedCallback(object sender, CallbackArgs e)
 {
     ServiceLocator.WorldManager.PlayerManager.GetPlayer(ServiceLocator.WorldManager.PlayerManager.ClientID).TryDropInventoryItem((int)e.Mouse.X, (int)e.Mouse.Y);
 }
Example #13
0
 private void messageBoxAlert_ClosedCallback(object sender, CallbackArgs e)
 {
     ServiceLocator.ScreenManager.SetActiveScreen("mainMenu");
     ServiceLocator.NetManager.Disconnect();
 }
Example #14
0
 private void buttonLogout_LeftMouseClickedCallback(object sender, CallbackArgs e)
 {
     ServiceLocator.ScreenManager.SetActiveScreen("mainMenu");
     ServiceLocator.NetManager.Disconnect();
 }
Example #15
0
 internal static void Alertbox_OKClick(object sender, CallbackArgs e)
 {
     // Close our screen, and thus our program!
     Graphics.CloseScreen();
 }
Example #16
0
        internal static void CreateCharacter_CreateClick(object sender, CallbackArgs e)
        {
            var name = Interface.GUI.Get<Panel>("window").Get<EditBox>("name").Text;
            var pclass = Interface.GUI.Get<Panel>("window").Get<ComboBox>("class").GetSelectedItemIndex() + 1;
            var male = Interface.GUI.Get<Panel>("window").Get<Checkbox>("male").IsChecked();
            var female = Interface.GUI.Get<Panel>("window").Get<Checkbox>("female").IsChecked();
            var gender = male ? Enumerations.Gender.Male : Enumerations.Gender.Female;

            // Check some stuff.
            if (name.Length < 1) {
                Interface.ShowMessagebox("Error", "Please fill in every field.");
                return;
            }

            // Send our request.
            Send.AddCharacter(name, pclass, gender);

            // Set our screen to the loading screen since we are awaiting a response.
            // Make sure we store some data so we can come back to this.
            Interface.LastWindow = Interface.Windows.CharacterCreate;
            Interface.LastData.Clear();
            Interface.LastData.Add(name);
            Interface.LastData.Add(pclass);
            Interface.LastData.Add(gender);
            Interface.ChangeUI(Interface.Windows.Loading);
            Interface.GUI.Get<Panel>("loadpanel").Get<Label>("loadtext").Text = "Sending character data..";
        }
Example #17
0
 internal static void CreateCharacter_MaleClick(object sender, CallbackArgs e)
 {
     Interface.GUI.Get<Panel>("window").Get<Checkbox>("male").Check();
     Interface.GUI.Get<Panel>("window").Get<Checkbox>("female").Uncheck();
 }
Example #18
0
 private void buttonRegistration_LeftMouseClickedCallback(object sender, CallbackArgs e)
 {
     this.GUI.Get<Button>("buttonSendRegistration").Visible = true;
     this.GUI.Get<Label>("labelUsername").Visible = true;
     this.GUI.Get<Label>("labelPassword").Visible = true;
     this.GUI.Get<Label>("labelStatus").Visible = true;
     this.GUI.Get<EditBox>("textUser").Visible = true;
     this.GUI.Get<EditBox>("textPassword").Visible = true;
     this.GUI.Get<Label>("labelNews").Visible = false;
     this.GUI.Get<Button>("buttonLogin").Visible = false;
     this.GUI.Get<Button>("buttonRegistration").Visible = false;
     this.GUI.Get<Button>("buttonBack").Visible = true;
 }
Example #19
0
 public static void MainMenu_LoginClick(object sender, CallbackArgs e)
 {
     // Change our UI over to the Login interface.
     Interface.ChangeUI(Interface.Windows.Login);
 }
Example #20
0
        private void buttonSendRegistartion_LeftMouseClickedCallback(object sender, CallbackArgs e)
        {
            ServiceLocator.NetManager.Connect();

            var registrationPacket = new Packet(PacketType.RegistrationPacket);
            registrationPacket.Message.Write(this.GUI.Get<EditBox>("textUser").Text);
            registrationPacket.Message.Write(this.GUI.Get<EditBox>("textPassword").Text);

            ServiceLocator.NetManager.SendMessage(registrationPacket.Message, NetDeliveryMethod.ReliableOrdered, ChannelTypes.WORLD);
        }
Example #21
0
        internal static void Messagebox_OKClick(object sender, CallbackArgs e)
        {
            // Get rid of the messagebox.
            Interface.GUI.Remove("mbox");

            // Check if we came from another UI, if so move back to it with its data intact!
            if (Interface.LastWindow != Interface.Windows.None) {
                switch (Interface.LastWindow) {
                    case Interface.Windows.Register:
                        Interface.ChangeUI(Interface.Windows.Register);
                        Interface.GUI.Get<TGUI.Panel>("mainmenu").Get<TGUI.EditBox>("username").Text = (String)Interface.LastData[0];
                        Interface.GUI.Get<TGUI.Panel>("mainmenu").Get<TGUI.EditBox>("password").Text = (String)Interface.LastData[1];
                        Interface.GUI.Get<TGUI.Panel>("mainmenu").Get<TGUI.EditBox>("password2").Text = (String)Interface.LastData[2];
                    break;

                    case Interface.Windows.Login:
                        Interface.ChangeUI(Interface.Windows.Login);
                        Interface.GUI.Get<TGUI.Panel>("mainmenu").Get<TGUI.EditBox>("username").Text = (String)Interface.LastData[0];
                        Interface.GUI.Get<TGUI.Panel>("mainmenu").Get<TGUI.EditBox>("password").Text = (String)Interface.LastData[1];
                    break;

                    case Interface.Windows.CharacterCreate:
                        Interface.ChangeUI(Interface.Windows.CharacterCreate);
                        Interface.GUI.Get<TGUI.Panel>("window").Get<TGUI.EditBox>("name").Text = (String)Interface.LastData[0];
                        Interface.GUI.Get<TGUI.Panel>("window").Get<TGUI.ComboBox>("class").SetSelectedItem((Int32)Interface.LastData[1] - 1);
                        if ((Enumerations.Gender)Interface.LastData[2] == Enumerations.Gender.Male) {
                            Interface.GUI.Get<TGUI.Panel>("window").Get<TGUI.Checkbox>("male").Check();
                            Interface.GUI.Get<TGUI.Panel>("window").Get<TGUI.Checkbox>("female").Uncheck();
                        } else {
                            Interface.GUI.Get<TGUI.Panel>("window").Get<TGUI.Checkbox>("female").Check();
                            Interface.GUI.Get<TGUI.Panel>("window").Get<TGUI.Checkbox>("male").Uncheck();
                        }
                    break;

                    case Interface.Windows.CharacterSelect:
                        Interface.ChangeUI(Interface.Windows.CharacterSelect);
                   break;
                }
            }
        }
Example #22
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Respond when the internal list box reports that a new item was selected
        /// </summary>
        ///
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        private void NewItemSelectedCallbackFunction(object sender, CallbackArgs e)
        {
            if (ItemSelectedCallback != null)
            {
                m_Callback.Text    = m_ListBox.GetSelectedItem();
                m_Callback.Value   = m_ListBox.GetSelectedItemIndex();
                m_Callback.Trigger = CallbackTrigger.ItemSelected;
                ItemSelectedCallback (this, m_Callback);
            }

            HideListBox();
        }
Example #23
0
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Handles the callback from one of the buttons
 /// </summary>
 ///
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 private void ButtonClickedCallbackFunction(object sender, CallbackArgs e)
 {
     if (ButtonClickedCallback != null)
     {
         m_Callback.Trigger = CallbackTrigger.ButtonClicked;
         m_Callback.Text    = ((Button)sender).Text;
         ButtonClickedCallback (this, m_Callback);
     }
 }