mirror of
https://e.coding.net/circlecloud/CTZLauncher.git
synced 2024-11-15 00:58:50 +00:00
添加注册Email选项...
This commit is contained in:
parent
ec3141e02a
commit
da1f129758
@ -1,85 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Threading;
|
||||
using KMCCC.Authentication;
|
||||
using CityCraft;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
|
||||
namespace KMCCC.Authentication
|
||||
{
|
||||
class CTZAuthenticator
|
||||
{
|
||||
/// <summary>
|
||||
/// 玩家的名字
|
||||
/// </summary>
|
||||
public readonly string Username;
|
||||
public readonly string Password;
|
||||
HttpHelper http = new HttpHelper();
|
||||
/// <summary>
|
||||
/// 验证服务器地址
|
||||
/// </summary>
|
||||
public readonly string Address;
|
||||
/// <summary>
|
||||
/// 验证服务器端口
|
||||
/// </summary>
|
||||
public readonly int Port;
|
||||
/// <summary>
|
||||
/// 构造离线验证器
|
||||
/// </summary>
|
||||
/// <param name="username">玩家的名字</param>
|
||||
public CTZAuthenticator(string username, string password, string address, int port = 25565)
|
||||
{
|
||||
Username = username;
|
||||
Password = password;
|
||||
Address = address.IndexOf("http") > 0 ? address : "http://" + address;
|
||||
Port = port;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标注外部登陆验证器
|
||||
/// </summary>
|
||||
public string Type
|
||||
{
|
||||
get { return "KMCCC.CTZ"; }
|
||||
}
|
||||
|
||||
public bool isRegistered()
|
||||
{
|
||||
return getResult(Address + ":" + Port + "/isregistered?username=" + Username);
|
||||
}
|
||||
|
||||
public bool Register()
|
||||
{
|
||||
return getResult(Address + ":" + Port + "/register?username=" + Username + "&password=" + Password);
|
||||
}
|
||||
|
||||
public bool isLogin()
|
||||
{
|
||||
return getResult(Address + ":" + Port + "/islogin?username=" + Username);
|
||||
}
|
||||
|
||||
public bool Login()
|
||||
{
|
||||
return getResult(Address + ":" + Port + "/login?username=" + Username + "&password=" + Password);
|
||||
}
|
||||
|
||||
public string getServerList()
|
||||
{
|
||||
string sl = http.Send(HttpMethod.GET, Address + ":" + Port + "/serverlist");
|
||||
if (string.IsNullOrEmpty(sl))
|
||||
throw new ArgumentNullException("服务器返回了空的字符串或网络连接异常!");
|
||||
return sl;
|
||||
}
|
||||
|
||||
public bool getResult(string url)
|
||||
{
|
||||
string result = http.Send(HttpMethod.GET, url);
|
||||
if (string.IsNullOrEmpty(result))
|
||||
throw new ArgumentNullException("服务器返回了空的字符串或网络连接异常!");
|
||||
return result.Contains("true") ? true : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Threading;
|
||||
using KMCCC.Authentication;
|
||||
using CityCraft;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
|
||||
namespace KMCCC.Authentication
|
||||
{
|
||||
class CTZAuthenticator
|
||||
{
|
||||
/// <summary>
|
||||
/// 玩家的名字
|
||||
/// </summary>
|
||||
public readonly string Username;
|
||||
public readonly string Password;
|
||||
public readonly string Email;
|
||||
HttpHelper http = new HttpHelper();
|
||||
/// <summary>
|
||||
/// 验证服务器地址
|
||||
/// </summary>
|
||||
public readonly string Address;
|
||||
/// <summary>
|
||||
/// 验证服务器端口
|
||||
/// </summary>
|
||||
public readonly int Port;
|
||||
/// <summary>
|
||||
/// 构造离线验证器
|
||||
/// </summary>
|
||||
/// <param name="username">玩家的名字</param>
|
||||
public CTZAuthenticator(string username, string password, string address, int port = 25565)
|
||||
{
|
||||
Username = username;
|
||||
Password = password;
|
||||
Address = address.IndexOf("http") > 0 ? address : "http://" + address;
|
||||
Port = port;
|
||||
Email = "mc@mc.com";
|
||||
}
|
||||
public CTZAuthenticator(string username, string password, string email, string address, int port = 25565)
|
||||
{
|
||||
Username = username;
|
||||
Password = password;
|
||||
Address = address.IndexOf("http") > 0 ? address : "http://" + address;
|
||||
Port = port;
|
||||
Email = email;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标注外部登陆验证器
|
||||
/// </summary>
|
||||
public string Type
|
||||
{
|
||||
get { return "KMCCC.CTZ"; }
|
||||
}
|
||||
|
||||
public bool isRegistered()
|
||||
{
|
||||
return getResult(Address + ":" + Port + "/isregistered?username=" + Username);
|
||||
}
|
||||
|
||||
public bool Register()
|
||||
{
|
||||
return getResult(Address + ":" + Port + "/register?username=" + Username + "&password=" + Password);
|
||||
}
|
||||
|
||||
public bool isLogin()
|
||||
{
|
||||
return getResult(Address + ":" + Port + "/islogin?username=" + Username);
|
||||
}
|
||||
|
||||
public bool Login()
|
||||
{
|
||||
return getResult(Address + ":" + Port + "/login?username=" + Username + "&password=" + Password);
|
||||
}
|
||||
|
||||
public string getServerList()
|
||||
{
|
||||
string sl = http.Send(HttpMethod.GET, Address + ":" + Port + "/serverlist");
|
||||
if (string.IsNullOrEmpty(sl))
|
||||
throw new ArgumentNullException("服务器返回了空的字符串或网络连接异常!");
|
||||
return sl;
|
||||
}
|
||||
|
||||
public bool getResult(string url)
|
||||
{
|
||||
string result = http.Send(HttpMethod.GET, url);
|
||||
if (string.IsNullOrEmpty(result))
|
||||
throw new ArgumentNullException("服务器返回了空的字符串或网络连接异常!");
|
||||
return result.Contains("true") ? true : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,172 +1,173 @@
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="CTZLauncher.MainWindow"
|
||||
ResizeMode = "NoResize"
|
||||
Title="MainWindow" Height="600" Width="800" Background="#FF3A3A3A" AllowsTransparency="True" WindowStyle="None" Visibility="Visible" HorizontalContentAlignment="Center" HorizontalAlignment="Center" Icon="ico.ico" VerticalAlignment="Center" VerticalContentAlignment="Center" WindowStartupLocation="CenterScreen" Initialized="Window_Initialized" FontFamily="Microsoft YaHei">
|
||||
|
||||
<Window.Resources>
|
||||
<!-- s:Double表示了变量类型 x:key表示了变量名 -->
|
||||
<s:Double x:Key="m_nFontSize">32</s:Double>
|
||||
|
||||
<!--
|
||||
<ControlTemplate x:Key="CornerButton" TargetType="{x:Type Button}">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="10" Background="{TemplateBinding Background}">
|
||||
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate x:Key="CornerTextBox" TargetType="{x:Type TextBox}">
|
||||
<Border BorderBrush="#FFA1A1A1" BorderThickness="3" CornerRadius="10" Background="#FFA1A1A1">
|
||||
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center" Background="#FFA1A1A1"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
-->
|
||||
<ControlTemplate x:Key="CornerButton" TargetType="{x:Type Button}">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="0" Background="{TemplateBinding Background}">
|
||||
<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate x:Key="CornerTextBox" TargetType="{x:Type TextBox}">
|
||||
<Border BorderBrush="#FF3299CC" BorderThickness="1" CornerRadius="0" Background="#FF3299CC">
|
||||
<ScrollViewer x:Name="PART_ContentHost" Background="White"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Window.Resources>
|
||||
<Grid x:Name="outline" Background="#FF3299CC" Height="600" Width="800" VerticalAlignment="Top" MouseLeftButtonDown="outline_MouseLeftButtonDown">
|
||||
<Grid Margin="20,0" Background="#FF3299CC" Height="60" VerticalAlignment="Top" d:IsLocked="True" >
|
||||
<Label x:Name="barl1" Content="论坛" HorizontalAlignment="Left" Margin="245,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/>
|
||||
<Label x:Name="barl2" Content="资源下载" HorizontalAlignment="Left" Margin="350,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/>
|
||||
<Label x:Name="barl3" Content="新手指南" HorizontalAlignment="Left" Margin="455,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/>
|
||||
<Label x:Name="barl4" Content="赞助我们" HorizontalAlignment="Left" Margin="560,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/>
|
||||
<Image HorizontalAlignment="Left" Height="50" Margin="15,5,0,0" VerticalAlignment="Top" Width="50" Source="ico.ico" RenderTransformOrigin="0.56,0.24"/>
|
||||
<Label Content="魔方" HorizontalAlignment="Left" Height="50" Margin="90,5,0,0" VerticalAlignment="Top" Width="74" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontFamily="STXingkai" Foreground="White" FontSize="35" />
|
||||
</Grid>
|
||||
<Grid Name="LoginWindow" Margin="20,60,20,20" Background="White">
|
||||
<Grid Height="270" VerticalAlignment="Top">
|
||||
<Grid Margin="20,20,0,0" HorizontalAlignment="Left" Width="400" >
|
||||
<Border BorderThickness="1" BorderBrush="#FF3299CC">
|
||||
<Image />
|
||||
</Border>
|
||||
</Grid>
|
||||
<Grid Margin="0,20,20,0" HorizontalAlignment="Right" Width="300">
|
||||
<!--760*520-->
|
||||
<Grid>
|
||||
<Grid Margin="10,10,10,0" Height="174" VerticalAlignment="Top">
|
||||
<Label Content="————— 游 戏 帐 号 —————" VerticalAlignment="Top" Margin="10,0" HorizontalContentAlignment="Center" FontSize="15"/>
|
||||
<TextBox x:Name="username" Template="{StaticResource CornerTextBox}" Height="34" TextWrapping="Wrap" Text="" VerticalAlignment="Top" HorizontalContentAlignment="Center" FontFamily="微软雅黑" FontSize="20" Margin="30,30,30,0" KeyDown="username_KeyDown" />
|
||||
<Label Content="————— 游 戏 密 码 —————" VerticalAlignment="Top" Margin="10,69,10,0" HorizontalContentAlignment="Center" FontSize="15"/>
|
||||
<TextBox x:Name="password" Template="{StaticResource CornerTextBox}" TextWrapping="Wrap" HorizontalContentAlignment="Center" FontFamily="微软雅黑" FontSize="20" Margin="30,104,30,0" Height="34" VerticalAlignment="Top" Tag="{}{"areas":[{"name":"\u7eaf\u51c0\u5927\u533a","servers":[{"name":"\u5149\u677f\u5c0f\u9547","address":"CityCraft.cn","port":25565,"info":"\u7eaf\u51c0\u670d\u52a1\u5668","version":"1.8-Forge","url":"CityCraft.cn"}]},{"name":"\u6a21\u7ec4\u5927\u533a","servers":[{"name":"\u5149\u677f\u5c0f\u9547","address":"CityCraft.cn","port":25573,"info":"MOD\u670d\u52a1\u5668: \u8c46\u8150 \u5bb6\u5177 ","version":"1.7.10-Forge","url":"CityCraft.cn"}]}]}" KeyDown="password_KeyDown" />
|
||||
<Button x:Name="forget" Margin="217,106,33,0" Template="{StaticResource CornerButton}" Height="30" Content="?" VerticalAlignment="Top" />
|
||||
</Grid>
|
||||
<Grid Margin="10,0,10,10" Height="50" VerticalAlignment="Bottom">
|
||||
<Button x:Name="Login" Margin="30,10,160,10" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Content="登录" Click="Login_Click"/>
|
||||
<Button x:Name="register" Margin="160,10,30,10" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Content="注册" Click="register_Click" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Height="246" VerticalAlignment="Bottom">
|
||||
<Grid Margin="20,20,0,20" HorizontalAlignment="Left" Width="391" >
|
||||
<TabControl Background="White" BorderThickness="0">
|
||||
<TabItem Header="动态" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="15" >
|
||||
<ListBox BorderThickness="0" FontSize="15">
|
||||
<ListBoxItem Content="动态" />
|
||||
<ListBoxItem Content="动态" />
|
||||
<ListBoxItem Content="动态" />
|
||||
<ListBoxItem Content="动态" />
|
||||
<ListBoxItem Content="动态" />
|
||||
<ListBoxItem Content="动态" />
|
||||
</ListBox>
|
||||
</TabItem>
|
||||
<TabItem Header="新闻" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="15" >
|
||||
<ListBox BorderThickness="0" FontSize="15">
|
||||
<ListBoxItem Content="新闻" />
|
||||
<ListBoxItem Content="新闻" />
|
||||
<ListBoxItem Content="新闻" />
|
||||
<ListBoxItem Content="新闻" />
|
||||
<ListBoxItem Content="新闻" />
|
||||
</ListBox>
|
||||
</TabItem>
|
||||
<TabItem Header="公告" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="15" />
|
||||
<TabItem Header="活动" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="15" />
|
||||
</TabControl>
|
||||
</Grid>
|
||||
<Grid Margin="0,20,20,20" HorizontalAlignment="Right" Width="300" ShowGridLines="True">
|
||||
<Border BorderBrush="#FF3299CC" BorderThickness="1">
|
||||
|
||||
</Border>
|
||||
<!--<Label Margin="10,15,0,0" Content="最大内存" VerticalAlignment="Top" Height="30" FontSize="17" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="Black" HorizontalAlignment="Left" Width="100"/>
|
||||
<TextBox x:Name="maxmem" Template="{StaticResource CornerTextBox}" Text="" Height="30" Width="174" TextWrapping="Wrap" Margin="0,15,10,161" FontSize="20" TextChanged="maxmem_TextChanged" HorizontalAlignment="Right" />
|
||||
<ComboBox x:Name="javacombo" Height="30" Width="174" FontSize="15" Margin="0,50,10,0" VerticalAlignment="Top" HorizontalAlignment="Right"/>
|
||||
<Label Margin="10,50,0,126" Content="JAVA版本" FontSize="17" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="Black" HorizontalAlignment="Left" Width="100"/>
|
||||
<ComboBox x:Name="gamecombo" Height="30" Width="174" FontSize="15" Margin="0,85,10,0" VerticalAlignment="Top" HorizontalAlignment="Right"/>
|
||||
<Label Margin="10,85,0,91" Content="游戏版本" FontSize="17" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="Black" HorizontalAlignment="Left" Width="100"/>
|
||||
<Button x:Name="StartGame" BorderBrush="#FF3299CC" Content="启动游戏" Template="{StaticResource CornerButton}" HorizontalAlignment="Right" Margin="0,0,10,10" Width="100" Height="46" VerticalAlignment="Bottom" FontSize="16" Click="StartGame_Click" IsEnabled="False"/>
|
||||
<Button x:Name="SelServer" BorderBrush="#FF3299CC" Content="选择服务器" Template="{StaticResource CornerButton}" Margin="20,0,0,10" Height="40" Width="100" FontSize="13" Click="StartGame_Click" VerticalAlignment="Bottom" HorizontalAlignment="Left" IsEnabled="False"/>-->
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Margin="20,60,20,20" Background="White" x:Name="ServerWindow" Visibility="Hidden">
|
||||
<!--Visibility="Hidden"-->
|
||||
<Grid HorizontalAlignment="Left" Width="400" Margin="20,20,0,20">
|
||||
<Grid Height="80" VerticalAlignment="Top" Margin="0,0,0,0">
|
||||
<Label Content="选择大区" Margin="155,20" FontSize="20" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
</Grid>
|
||||
<Grid Height="100" VerticalAlignment="Top" Margin="0,80,0,0" Name="GameArea">
|
||||
<Button Name="a0" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="30,30,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
<Button Name="a1" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="120,30,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
<Button Name="a2" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="215,30,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
<Button Name="a3" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="305,30,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
|
||||
<Button Name="a4" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="30,60,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
<Button Name="a5" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="120,60,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
<Button Name="a6" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="215,60,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
<Button Name="a7" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="305,60,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
</Grid>
|
||||
<Grid Height="285" VerticalAlignment="Top" Margin="10,185,10,0">
|
||||
<Grid Height="50" VerticalAlignment="Top" Margin="10,0,10,0">
|
||||
<Label Content="选择服务器" Margin="125,8" FontSize="20" VerticalContentAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
<Grid Margin="10,55,10,10" Name="GameServer">
|
||||
<Button Name="s0" Content="服务器1" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="50,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s1" Content="服务器2" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="150,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s2" Content="服务器3" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="252,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
|
||||
<Button Name="s3" Content="服务器4" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="50,80,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s4" Content="服务器5" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="150,80,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s5" Content="服务器6" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="252,80,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
|
||||
<Button Name="s6" Content="服务器7" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="50,120,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s7" Content="服务器8" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="150,120,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s8" Content="服务器9" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="252,120,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
|
||||
<Button Name="s9" Content="服务器10" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="50,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s10" Content="服务器11" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="150,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s11" Content="服务器12" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="252,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid HorizontalAlignment="Right" Width="300" Margin="0,20,20,20">
|
||||
<Grid Height="269" VerticalAlignment="Top">
|
||||
<Grid Height="40" VerticalAlignment="Top" Margin="10,10,10,0">
|
||||
<Label Content="服务器介绍" Margin="85,2" FontSize="20" VerticalContentAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
<Grid Height="200" VerticalAlignment="Bottom" Margin="10,0,10,10">
|
||||
<Label Name="serverinfo" Content="" Margin="50,35,50,35" FontSize="15"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid ShowGridLines="True" Height="200" VerticalAlignment="Bottom">
|
||||
<Label Content="服务器名称:" Margin="40,20,160,0" FontSize="15" HorizontalContentAlignment="Center" Height="30" VerticalAlignment="Top" />
|
||||
<Label Name="selserver" Content="" Margin="145,20,40,0" FontSize="15" HorizontalContentAlignment="Center" Height="30" VerticalAlignment="Top" />
|
||||
<Label Content="客户端版本:" Margin="40,50,160,0" FontSize="15" HorizontalContentAlignment="Center" Height="30" VerticalAlignment="Top" />
|
||||
<Label Name="needclient" Content="" Margin="145,50,40,0" FontSize="15" HorizontalContentAlignment="Center" Height="30" VerticalAlignment="Top" />
|
||||
<Label Content="在线人数:" Margin="40,80,160,0" FontSize="15" HorizontalContentAlignment="Center" Height="30" VerticalAlignment="Top" />
|
||||
<Label Name="online" Content="" Margin="145,80,40,0" FontSize="15" HorizontalContentAlignment="Center" Height="30" VerticalAlignment="Top" />
|
||||
<Button x:Name="StartGame" BorderBrush="#FF3299CC" Content="启动游戏" Template="{StaticResource CornerButton}" Margin="10,0,10,10" Height="64" VerticalAlignment="Bottom" FontSize="16" Click="StartGame_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Button Template="{StaticResource CornerButton}" Width="30" HorizontalAlignment="Right" Content="r" Background="#FFE05A5A" Height="30" VerticalAlignment="Top" FontFamily="Webdings" Click="close_Click" Margin="0,0,0,0" d:IsLocked="True" />
|
||||
</Grid>
|
||||
</Window>
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="CTZLauncher.MainWindow"
|
||||
ResizeMode = "NoResize"
|
||||
Title="MainWindow" Height="600" Width="800" Background="#FF3A3A3A" AllowsTransparency="True" WindowStyle="None" Visibility="Visible" HorizontalContentAlignment="Center" HorizontalAlignment="Center" Icon="ico.ico" VerticalAlignment="Center" VerticalContentAlignment="Center" WindowStartupLocation="CenterScreen" Initialized="Window_Initialized" FontFamily="Microsoft YaHei">
|
||||
|
||||
<Window.Resources>
|
||||
<!-- s:Double表示了变量类型 x:key表示了变量名 -->
|
||||
<s:Double x:Key="m_nFontSize">32</s:Double>
|
||||
|
||||
<!--
|
||||
<ControlTemplate x:Key="CornerButton" TargetType="{x:Type Button}">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="10" Background="{TemplateBinding Background}">
|
||||
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate x:Key="CornerTextBox" TargetType="{x:Type TextBox}">
|
||||
<Border BorderBrush="#FFA1A1A1" BorderThickness="3" CornerRadius="10" Background="#FFA1A1A1">
|
||||
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center" Background="#FFA1A1A1"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
-->
|
||||
<ControlTemplate x:Key="CornerButton" TargetType="{x:Type Button}">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="0" Background="{TemplateBinding Background}">
|
||||
<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate x:Key="CornerTextBox" TargetType="{x:Type TextBox}">
|
||||
<Border BorderBrush="#FF3299CC" BorderThickness="1" CornerRadius="0" Background="#FF3299CC">
|
||||
<ScrollViewer x:Name="PART_ContentHost" Background="White"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Window.Resources>
|
||||
<Grid x:Name="outline" Background="#FF3299CC" Height="600" Width="800" VerticalAlignment="Top" MouseLeftButtonDown="outline_MouseLeftButtonDown">
|
||||
<Grid Margin="20,0" Background="#FF3299CC" Height="60" VerticalAlignment="Top" d:IsLocked="True" >
|
||||
<Label x:Name="barl1" Content="论坛" HorizontalAlignment="Left" Margin="245,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/>
|
||||
<Label x:Name="barl2" Content="资源下载" HorizontalAlignment="Left" Margin="350,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/>
|
||||
<Label x:Name="barl3" Content="新手指南" HorizontalAlignment="Left" Margin="455,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/>
|
||||
<Label x:Name="barl4" Content="赞助我们" HorizontalAlignment="Left" Margin="560,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/>
|
||||
<Image HorizontalAlignment="Left" Height="50" Margin="15,5,0,0" VerticalAlignment="Top" Width="50" Source="ico.ico" RenderTransformOrigin="0.56,0.24"/>
|
||||
<Label Content="魔方" HorizontalAlignment="Left" Height="50" Margin="90,5,0,0" VerticalAlignment="Top" Width="74" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontFamily="STXingkai" Foreground="White" FontSize="35" />
|
||||
</Grid>
|
||||
<Grid Name="LoginWindow" Margin="20,60,20,20" Background="White">
|
||||
<Grid Height="270" VerticalAlignment="Top">
|
||||
<Grid Margin="20,20,0,0" HorizontalAlignment="Left" Width="400" >
|
||||
<Border BorderThickness="1" BorderBrush="#FF3299CC">
|
||||
<Image />
|
||||
</Border>
|
||||
</Grid>
|
||||
<Grid Margin="0,20,20,0" HorizontalAlignment="Right" Width="300">
|
||||
<!--760*520-->
|
||||
<Grid>
|
||||
<Grid Margin="10,10,10,0" Height="174" VerticalAlignment="Top">
|
||||
<Label Content="————— 游 戏 帐 号 —————" VerticalAlignment="Top" Margin="10,0" HorizontalContentAlignment="Center" FontSize="15"/>
|
||||
<TextBox x:Name="username" Template="{StaticResource CornerTextBox}" Height="34" TextWrapping="Wrap" Text="" VerticalAlignment="Top" HorizontalContentAlignment="Center" FontFamily="微软雅黑" FontSize="20" Margin="30,30,30,0" KeyDown="username_KeyDown" />
|
||||
<Label Content="————— 游 戏 密 码 —————" VerticalAlignment="Top" Margin="10,69,10,0" HorizontalContentAlignment="Center" FontSize="15"/>
|
||||
<TextBox x:Name="password" Template="{StaticResource CornerTextBox}" TextWrapping="Wrap" HorizontalContentAlignment="Center" FontFamily="微软雅黑" FontSize="20" Margin="30,104,30,0" Height="34" VerticalAlignment="Top" Tag="{}{"areas":[{"name":"\u7eaf\u51c0\u5927\u533a","servers":[{"name":"\u5149\u677f\u5c0f\u9547","address":"CityCraft.cn","port":25565,"info":"\u7eaf\u51c0\u670d\u52a1\u5668","version":"1.8-Forge","url":"CityCraft.cn"}]},{"name":"\u6a21\u7ec4\u5927\u533a","servers":[{"name":"\u5149\u677f\u5c0f\u9547","address":"CityCraft.cn","port":25573,"info":"MOD\u670d\u52a1\u5668: \u8c46\u8150 \u5bb6\u5177 ","version":"1.7.10-Forge","url":"CityCraft.cn"}]}]}" KeyDown="password_KeyDown" />
|
||||
<Button x:Name="forget" Margin="217,106,33,0" Template="{StaticResource CornerButton}" Height="30" Content="?" VerticalAlignment="Top" />
|
||||
</Grid>
|
||||
<Grid Margin="10,0,10,10" Height="50" VerticalAlignment="Bottom">
|
||||
<Button x:Name="Login" Margin="30,10,160,10" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Content="登录" Click="Login_Click"/>
|
||||
<Button x:Name="register" Margin="160,10,30,10" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Content="注册" Click="register_Click" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Height="246" VerticalAlignment="Bottom">
|
||||
<Grid Margin="20,20,0,20" HorizontalAlignment="Left" Width="400" >
|
||||
<Border BorderThickness="1" BorderBrush="#FF3299CC"/>
|
||||
<!--<TabControl Background="White" BorderThickness="0">
|
||||
<TabItem Header="动态" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="15" >
|
||||
<ListBox BorderThickness="0" FontSize="15">
|
||||
<ListBoxItem Content="动态" />
|
||||
<ListBoxItem Content="动态" />
|
||||
<ListBoxItem Content="动态" />
|
||||
<ListBoxItem Content="动态" />
|
||||
<ListBoxItem Content="动态" />
|
||||
<ListBoxItem Content="动态" />
|
||||
</ListBox>
|
||||
</TabItem>
|
||||
<TabItem Header="新闻" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="15" >
|
||||
<ListBox BorderThickness="0" FontSize="15">
|
||||
<ListBoxItem Content="新闻" />
|
||||
<ListBoxItem Content="新闻" />
|
||||
<ListBoxItem Content="新闻" />
|
||||
<ListBoxItem Content="新闻" />
|
||||
<ListBoxItem Content="新闻" />
|
||||
</ListBox>
|
||||
</TabItem>
|
||||
<TabItem Header="公告" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="15" />
|
||||
<TabItem Header="活动" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="15" />
|
||||
</TabControl>-->
|
||||
</Grid>
|
||||
<Grid Margin="0,20,20,20" HorizontalAlignment="Right" Width="300" ShowGridLines="True">
|
||||
<Border BorderBrush="#FF3299CC" BorderThickness="1">
|
||||
|
||||
</Border>
|
||||
<!--<Label Margin="10,15,0,0" Content="最大内存" VerticalAlignment="Top" Height="30" FontSize="17" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="Black" HorizontalAlignment="Left" Width="100"/>
|
||||
<TextBox x:Name="maxmem" Template="{StaticResource CornerTextBox}" Text="" Height="30" Width="174" TextWrapping="Wrap" Margin="0,15,10,161" FontSize="20" TextChanged="maxmem_TextChanged" HorizontalAlignment="Right" />
|
||||
<ComboBox x:Name="javacombo" Height="30" Width="174" FontSize="15" Margin="0,50,10,0" VerticalAlignment="Top" HorizontalAlignment="Right"/>
|
||||
<Label Margin="10,50,0,126" Content="JAVA版本" FontSize="17" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="Black" HorizontalAlignment="Left" Width="100"/>
|
||||
<ComboBox x:Name="gamecombo" Height="30" Width="174" FontSize="15" Margin="0,85,10,0" VerticalAlignment="Top" HorizontalAlignment="Right"/>
|
||||
<Label Margin="10,85,0,91" Content="游戏版本" FontSize="17" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="Black" HorizontalAlignment="Left" Width="100"/>
|
||||
<Button x:Name="StartGame" BorderBrush="#FF3299CC" Content="启动游戏" Template="{StaticResource CornerButton}" HorizontalAlignment="Right" Margin="0,0,10,10" Width="100" Height="46" VerticalAlignment="Bottom" FontSize="16" Click="StartGame_Click" IsEnabled="False"/>
|
||||
<Button x:Name="SelServer" BorderBrush="#FF3299CC" Content="选择服务器" Template="{StaticResource CornerButton}" Margin="20,0,0,10" Height="40" Width="100" FontSize="13" Click="StartGame_Click" VerticalAlignment="Bottom" HorizontalAlignment="Left" IsEnabled="False"/>-->
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Margin="20,60,20,20" Background="White" x:Name="ServerWindow" Visibility="Hidden">
|
||||
<!--Visibility="Hidden"-->
|
||||
<Grid HorizontalAlignment="Left" Width="400" Margin="20,20,0,20">
|
||||
<Grid Height="80" VerticalAlignment="Top" Margin="0,0,0,0">
|
||||
<Label Content="选择大区" Margin="155,20" FontSize="20" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
</Grid>
|
||||
<Grid Height="100" VerticalAlignment="Top" Margin="0,80,0,0" Name="GameArea">
|
||||
<Button Name="a0" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="30,30,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
<Button Name="a1" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="120,30,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
<Button Name="a2" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="215,30,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
<Button Name="a3" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="305,30,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
|
||||
<Button Name="a4" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="30,60,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
<Button Name="a5" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="120,60,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
<Button Name="a6" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="215,60,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
<Button Name="a7" BorderBrush="#FF3299CC" Content="X X大区" Template="{StaticResource CornerButton}" HorizontalAlignment="Left" Margin="305,60,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" Click="area_Click"/>
|
||||
</Grid>
|
||||
<Grid Height="285" VerticalAlignment="Top" Margin="10,185,10,0">
|
||||
<Grid Height="50" VerticalAlignment="Top" Margin="10,0,10,0">
|
||||
<Label Content="选择服务器" Margin="125,8" FontSize="20" VerticalContentAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
<Grid Margin="10,55,10,10" Name="GameServer">
|
||||
<Button Name="s0" Content="服务器1" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="50,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s1" Content="服务器2" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="150,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s2" Content="服务器3" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="252,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
|
||||
<Button Name="s3" Content="服务器4" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="50,80,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s4" Content="服务器5" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="150,80,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s5" Content="服务器6" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="252,80,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
|
||||
<Button Name="s6" Content="服务器7" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="50,120,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s7" Content="服务器8" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="150,120,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s8" Content="服务器9" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="252,120,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
|
||||
<Button Name="s9" Content="服务器10" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="50,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s10" Content="服务器11" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="150,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
<Button Name="s11" Content="服务器12" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Margin="252,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Click="server_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid HorizontalAlignment="Right" Width="300" Margin="0,20,20,20">
|
||||
<Grid Height="269" VerticalAlignment="Top">
|
||||
<Grid Height="40" VerticalAlignment="Top" Margin="10,10,10,0">
|
||||
<Label Content="服务器介绍" Margin="85,2" FontSize="20" VerticalContentAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
<Grid Height="200" VerticalAlignment="Bottom" Margin="10,0,10,10">
|
||||
<Label Name="serverinfo" Content="" Margin="50,35,50,35" FontSize="15"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid ShowGridLines="True" Height="200" VerticalAlignment="Bottom">
|
||||
<Label Content="服务器名称:" Margin="40,20,160,0" FontSize="15" HorizontalContentAlignment="Center" Height="30" VerticalAlignment="Top" />
|
||||
<Label Name="selserver" Content="" Margin="145,20,40,0" FontSize="15" HorizontalContentAlignment="Center" Height="30" VerticalAlignment="Top" />
|
||||
<Label Content="客户端版本:" Margin="40,50,160,0" FontSize="15" HorizontalContentAlignment="Center" Height="30" VerticalAlignment="Top" />
|
||||
<Label Name="needclient" Content="" Margin="145,50,40,0" FontSize="15" HorizontalContentAlignment="Center" Height="30" VerticalAlignment="Top" />
|
||||
<Label Content="在线人数:" Margin="40,80,160,0" FontSize="15" HorizontalContentAlignment="Center" Height="30" VerticalAlignment="Top" />
|
||||
<Label Name="online" Content="" Margin="145,80,40,0" FontSize="15" HorizontalContentAlignment="Center" Height="30" VerticalAlignment="Top" />
|
||||
<Button x:Name="StartGame" BorderBrush="#FF3299CC" Content="启动游戏" Template="{StaticResource CornerButton}" Margin="10,0,10,10" Height="64" VerticalAlignment="Bottom" FontSize="16" Click="StartGame_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Button Template="{StaticResource CornerButton}" Width="30" HorizontalAlignment="Right" Content="r" Background="#FFE05A5A" Height="30" VerticalAlignment="Top" FontFamily="Webdings" Click="close_Click" Margin="0,0,0,0" d:IsLocked="True" />
|
||||
</Grid>
|
||||
</Window>
|
||||
|
@ -150,37 +150,7 @@ namespace CTZLauncher
|
||||
|
||||
private void register_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
register.IsEnabled = false;
|
||||
if (username.Text.Length == 0 || password.Text.Length == 0)
|
||||
{
|
||||
MessageBox.Show("请输入账号密码!");
|
||||
return;
|
||||
}
|
||||
CTZAuthenticator auth = new CTZAuthenticator(username.Text, password.Text, serveraddress, serverport);
|
||||
try
|
||||
{
|
||||
if (auth.isRegistered())
|
||||
{
|
||||
MessageBox.Show("该用户名已注册 请更换用户名!");
|
||||
return;
|
||||
}
|
||||
if (auth.Register())
|
||||
{
|
||||
MessageBox.Show("注册成功!");
|
||||
auth.Login();
|
||||
ServerWindow.Visibility = System.Windows.Visibility.Visible;
|
||||
}
|
||||
else
|
||||
MessageBox.Show("注册失败!");
|
||||
}
|
||||
catch (ArgumentNullException ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
register.IsEnabled = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
@ -252,7 +222,7 @@ namespace CTZLauncher
|
||||
{
|
||||
if (option.Version == null)
|
||||
{
|
||||
MessageBoxResult result = MessageBox.Show("是否下载服务器所需要的客户端版本?", "缺少客户端", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
||||
MessageBoxResult result = MessageBox.Show("是否下载服务器所需要的客户端版本?", "缺少客户端", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
如果要利用文件和注册表虚拟化实现向后
|
||||
兼容性,则删除 requestedExecutionLevel 节点。
|
||||
-->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
<applicationRequestMinimum>
|
||||
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
|
||||
|
@ -7,14 +7,16 @@
|
||||
mc:Ignorable="d"
|
||||
Title="账号注册" Height="300" Width="300">
|
||||
<Grid>
|
||||
<TextBox x:Name="textBox" HorizontalAlignment="Left" Height="25" Margin="128,47,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
|
||||
<TextBox x:Name="textBox1" HorizontalAlignment="Left" Height="25" Margin="128,75,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
|
||||
<TextBox x:Name="textBox2" HorizontalAlignment="Left" Height="25" Margin="128,103,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
|
||||
<TextBox x:Name="username" HorizontalAlignment="Left" Height="25" Margin="128,47,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
|
||||
<TextBox x:Name="password" HorizontalAlignment="Left" Height="25" Margin="128,75,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
|
||||
<TextBox x:Name="pwdcfm" HorizontalAlignment="Left" Height="25" Margin="128,103,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
|
||||
<Label x:Name="label" Content="帐 号" HorizontalAlignment="Left" Margin="39,47,0,0" VerticalAlignment="Top"/>
|
||||
<Label x:Name="label1" Content="密 码" HorizontalAlignment="Left" Margin="39,75,0,0" VerticalAlignment="Top"/>
|
||||
<Label x:Name="label2" Content="确认密码" HorizontalAlignment="Left" Margin="39,103,0,0" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="textBox2_Copy" HorizontalAlignment="Left" Height="25" Margin="128,133,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
|
||||
<Label x:Name="label2_Copy" Content="邮 箱" HorizontalAlignment="Left" Margin="39,133,0,0" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="email" HorizontalAlignment="Left" Height="25" Margin="128,133,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
|
||||
<Label x:Name="label2_Copy" Content="邮 箱" HorizontalAlignment="Left" Margin="39,133,0,0" VerticalAlignment="Top"/>
|
||||
<Button Content="取消" HorizontalAlignment="Left" Margin="39,189,0,0" VerticalAlignment="Top" Width="75"/>
|
||||
<Button x:Name="reg" Content="注册" HorizontalAlignment="Left" Margin="173,189,0,0" VerticalAlignment="Top" Width="75" Click="reg_Click"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
|
@ -1,26 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace CTZLauncher
|
||||
{
|
||||
/// <summary>
|
||||
/// Window1.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class Window1 : Window
|
||||
{
|
||||
public Window1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
using KMCCC.Authentication;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace CTZLauncher
|
||||
{
|
||||
/// <summary>
|
||||
/// Window1.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class RegisterWindow : Window
|
||||
{
|
||||
string serveraddress;
|
||||
int serverport;
|
||||
public RegisterWindow(string serveraddress, int serverport)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.serveraddress = serveraddress;
|
||||
this.serverport = serverport;
|
||||
}
|
||||
|
||||
private void reg_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
reg.IsEnabled = false;
|
||||
if (username.Text.Length == 0 || password.Text.Length == 0)
|
||||
{
|
||||
MessageBox.Show("请输入账号密码!");
|
||||
return;
|
||||
}
|
||||
CTZAuthenticator auth = new CTZAuthenticator(username.Text, password.Text, serveraddress, serverport);
|
||||
try
|
||||
{
|
||||
if (auth.isRegistered())
|
||||
{
|
||||
MessageBox.Show("该用户名已注册 请更换用户名!");
|
||||
return;
|
||||
}
|
||||
if (auth.Register())
|
||||
{
|
||||
MessageBox.Show("注册成功!");
|
||||
Close();
|
||||
}
|
||||
else
|
||||
MessageBox.Show("注册失败!");
|
||||
}
|
||||
catch (ArgumentNullException ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
reg.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user