Advertisement
Guest User

Untitled

a guest
May 15th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using TomShane.Neoforce.Controls;
  6. using Omnion.SquadOmegaClient.Networking;
  7. using Omnion.SquadOmega.Shared.Diagnostic;
  8. using Omnion.SquadOmega.Shared.IO;
  9. using Omnion.SquadOmega.Shared.Networking;
  10. using Omnion.SquadOmega.Shared.Secruity;
  11.  
  12. namespace Omnion.SquadOmegaClient.MainMenuScreen
  13. {
  14.     public class MainMenuWindow : Window
  15.     {
  16.         private Label usernameL;
  17.         private Label passwordL;
  18.         private TextBox usernameTB;
  19.         private TextBox passwordTB;
  20.         private Button loginB;
  21.         private Button registerB;
  22.         private Button aboutB;
  23.         private Button optionsB;
  24.         private Button exitB;
  25.         private CheckBox rembUsernameCB;
  26.  
  27.         private ConnectingDialog connectDialog;
  28.         private RegisterWindow registerWin;
  29.  
  30.         public string Username
  31.         {
  32.             get
  33.             {
  34.                 return this.usernameTB.Text;
  35.             }
  36.         }
  37.         public byte[] PassHash
  38.         {
  39.             get
  40.             {
  41.                 return HashUtility.HashString(this.passwordTB.Text);
  42.             }
  43.         }
  44.  
  45.         public MainMenuWindow(Manager manager)
  46.             : base(manager)
  47.         {
  48.            
  49.         }
  50.  
  51.         public override void Init()
  52.         {
  53.             base.Init();
  54.             this.Text = "Squad Omega - Main Menu";
  55.             this.Width = 300;
  56.             this.Height = 400;
  57.             this.Resizable = false;
  58.             this.Movable = false;
  59.             this.CloseButtonVisible = false;
  60.             this.Center();
  61.  
  62.             this.InitControls();
  63.         }
  64.  
  65.         private void InitControls()
  66.         {
  67.             this.usernameL = new Label(this.Manager);
  68.             this.usernameL.Init();
  69.             this.usernameL.Text = "Username : ";
  70.             this.usernameL.Ellipsis = false;
  71.             this.usernameL.Width += 3;
  72.             this.usernameL.Left = Layout.LargeSpace;
  73.             this.usernameL.Top = Layout.LargeSpace;
  74.             this.usernameL.Parent = this;
  75.  
  76.             this.usernameTB = new TextBox(this.Manager);
  77.             this.usernameTB.Init();
  78.             this.usernameTB.Left = this.usernameL.Left + this.usernameL.Width + Layout.SmallSpace;
  79.             this.usernameTB.Top = this.usernameL.Top;
  80.             this.usernameTB.Width = this.ClientWidth - (this.usernameTB.Left + Layout.LargeSpace);
  81.             this.usernameTB.Parent = this;
  82.  
  83.             this.passwordL = new Label(this.Manager);
  84.             this.passwordL.Init();
  85.             this.passwordL.Text = "Password : ";
  86.             this.passwordL.Ellipsis = false;
  87.             this.passwordL.Left = this.usernameL.Left;
  88.             this.passwordL.Top = this.usernameTB.Top + this.usernameTB.Height + Layout.SmallSpace;
  89.             this.passwordL.Parent = this;
  90.  
  91.             this.passwordTB = new TextBox(this.Manager);
  92.             this.passwordTB.Init();
  93.             this.passwordTB.Left = this.usernameTB.Left;
  94.             this.passwordTB.Top = this.passwordL.Top;
  95.             this.passwordTB.Width = this.usernameTB.Width;
  96.             this.passwordTB.Mode = TextBoxMode.Password;
  97.             this.passwordTB.Parent = this;
  98.  
  99.             this.rembUsernameCB = new CheckBox(this.Manager);
  100.             this.rembUsernameCB.Text = "Remember Username";
  101.             this.rembUsernameCB.Left = this.passwordL.Left;
  102.             this.rembUsernameCB.Top = this.passwordTB.Top + this.passwordTB.Height + Layout.SmallSpace;
  103.             this.rembUsernameCB.Width = this.passwordTB.Width;
  104.             this.rembUsernameCB.Parent = this;
  105.  
  106.             this.loginB = new Button(this.Manager);
  107.             this.loginB.Init();
  108.             this.loginB.Text = "Login";
  109.             this.loginB.Left = this.rembUsernameCB.Left;
  110.             this.loginB.Top = this.rembUsernameCB.Top + this.rembUsernameCB.Height + Layout.SmallSpace;
  111.             this.loginB.Width = this.ClientWidth - (Layout.LargeSpace * 2);
  112.             this.loginB.Click += new TomShane.Neoforce.Controls.EventHandler(OnLoginClick);
  113.             this.loginB.Parent = this;
  114.  
  115.             this.registerB = new Button(this.Manager);
  116.             this.registerB.Init();
  117.             this.registerB.Text = "Register";
  118.             this.registerB.Left = this.loginB.Left;
  119.             this.registerB.Top = this.loginB.Top + this.loginB.Height + Layout.SmallSpace;
  120.             this.registerB.Width = this.loginB.Width;
  121.             this.registerB.Click += new TomShane.Neoforce.Controls.EventHandler(OnRegisterClick);
  122.             this.registerB.Parent = this;
  123.  
  124.             this.aboutB = new Button(this.Manager);
  125.             this.aboutB.Init();
  126.             this.aboutB.Text = "About";
  127.             this.aboutB.Left = this.registerB.Left;
  128.             this.aboutB.Top = this.registerB.Top + this.registerB.Height + Layout.SmallSpace;
  129.             this.aboutB.Width = this.registerB.Width;
  130.             this.aboutB.Click += new TomShane.Neoforce.Controls.EventHandler(OnAboutClick);
  131.             this.aboutB.Parent = this;
  132.  
  133.             this.optionsB = new Button(this.Manager);
  134.             this.optionsB.Init();
  135.             this.optionsB.Text = "Options";
  136.             this.optionsB.Left = this.loginB.Left;
  137.             this.optionsB.Top = this.aboutB.Top + this.aboutB.Height + Layout.SmallSpace;
  138.             this.optionsB.Width = this.aboutB.Width;
  139.             this.optionsB.Parent = this;
  140.  
  141.             this.exitB = new Button(this.Manager);
  142.             this.exitB.Init();
  143.             this.exitB.Text = "Exit";
  144.             this.exitB.Left = this.aboutB.Left;
  145.             this.exitB.Top = this.optionsB.Top + this.optionsB.Height + Layout.SmallSpace;
  146.             this.exitB.Width = this.optionsB.Width;
  147.             this.exitB.Click += new TomShane.Neoforce.Controls.EventHandler(OnExitClick);
  148.             this.exitB.Parent = this;
  149.  
  150.             this.ClientHeight = this.exitB.Top + this.exitB.Height + Layout.LargeSpace;
  151.             this.Center();
  152.         }
  153.  
  154.         private void OnLoginClick(object sender, TomShane.Neoforce.Controls.EventArgs e)
  155.         {
  156.            
  157.         }
  158.         private void OnRegisterClick(object sender, TomShane.Neoforce.Controls.EventArgs e)
  159.         {
  160.             this.Hide();
  161.             this.registerWin = new RegisterWindow(this.Manager, this);
  162.             this.registerWin.Init();
  163.             this.Manager.Add(this.registerWin);
  164.             this.registerWin.Show();
  165.         }
  166.         private void OnExitClick(object sender, TomShane.Neoforce.Controls.EventArgs e)
  167.         {
  168.             this.Manager.Game.Exit();
  169.         }
  170.     }
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement