1
0
mirror of https://e.coding.net/circlecloud/CTZLauncher.git synced 2024-11-14 00:48:48 +00:00

获取服务器列表数据调试完成 提交更新...

This commit is contained in:
j502647092 2015-08-10 00:07:54 +08:00
parent b21b606132
commit a330fed217
4 changed files with 29 additions and 33 deletions

View File

@ -68,7 +68,8 @@ namespace KMCCC.Authentication
public string getServerList()
{
return http.Send(HttpMethod.GET, Address + ":" + Port + "/serverlist");
string sl = http.Send(HttpMethod.GET, Address + ":" + Port + "/serverlist");
return sl.Replace("\0","");
}
public bool getResult(string url)

View File

@ -206,7 +206,7 @@ namespace CityCraft
private string ParseResponse(byte[] responseBytes)
{
string responseStr = Encoding.UTF8.GetString(responseBytes);
string responseStr = Encoding.Default.GetString(responseBytes);
int splitindex = responseStr.IndexOf("\r\n\r\n");
if (splitindex > 0)
{

View File

@ -57,7 +57,7 @@
<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" />
<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" />
<TextBox x:Name="password" Template="{StaticResource CornerTextBox}" TextWrapping="Wrap" HorizontalContentAlignment="Center" FontFamily="微软雅黑" FontSize="20" Margin="30,104,30,0" Height="34" VerticalAlignment="Top" Tag="{}{&quot;areas&quot;:[{&quot;name&quot;:&quot;\u7eaf\u51c0\u5927\u533a&quot;,&quot;servers&quot;:[{&quot;name&quot;:&quot;\u5149\u677f\u5c0f\u9547&quot;,&quot;address&quot;:&quot;CityCraft.cn&quot;,&quot;port&quot;:25565,&quot;info&quot;:&quot;\u7eaf\u51c0\u670d\u52a1\u5668&quot;,&quot;version&quot;:&quot;1.8-Forge&quot;,&quot;url&quot;:&quot;CityCraft.cn&quot;}]},{&quot;name&quot;:&quot;\u6a21\u7ec4\u5927\u533a&quot;,&quot;servers&quot;:[{&quot;name&quot;:&quot;\u5149\u677f\u5c0f\u9547&quot;,&quot;address&quot;:&quot;CityCraft.cn&quot;,&quot;port&quot;:25573,&quot;info&quot;:&quot;MOD\u670d\u52a1\u5668: \u8c46\u8150 \u5bb6\u5177 &quot;,&quot;version&quot;:&quot;1.7.10-Forge&quot;,&quot;url&quot;:&quot;CityCraft.cn&quot;}]}]}" />
<Button x:Name="forget" Margin="217,106,33,0" Template="{StaticResource CornerButton}" Height="30" Content="?" VerticalAlignment="Top" Click="forget_Click" />
</Grid>
<Grid Margin="10,0,10,10" Height="50" VerticalAlignment="Bottom">
@ -116,36 +116,36 @@
<Label Content="选择大区" Margin="155,20" FontSize="20" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
</Grid>
<Grid Height="100" VerticalAlignment="Top" Margin="0,80,0,0" Name="GameArea">
<RadioButton Name="a1" Content="X X大区" Margin="30,30,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a2" Content="X X大区" Margin="120,30,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a3" Content="X X大区" Margin="215,30,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a4" Content="X X大区" Margin="305,30,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a0" Content="X X大区" Margin="30,30,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a1" Content="X X大区" Margin="120,30,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a2" Content="X X大区" Margin="215,30,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a3" Content="X X大区" Margin="305,30,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a5" Content="X X大区" Margin="30,60,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a6" Content="X X大区" Margin="120,60,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a7" Content="X X大区" Margin="215,60,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a8" Content="X X大区" Margin="305,60,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a4" Content="X X大区" Margin="30,60,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a5" Content="X X大区" Margin="120,60,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a6" Content="X X大区" Margin="215,60,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
<RadioButton Name="a7" Content="X X大区" Margin="305,60,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" Visibility="Hidden" Checked="area_Checked"/>
</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">
<RadioButton Name="s1" Content="服务器1" Margin="50,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s2" Content="服务器2" Margin="150,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s3" Content="服务器3" Margin="252,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s0" Content="服务器1" Margin="50,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s1" Content="服务器2" Margin="150,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s2" Content="服务器3" Margin="252,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s4" Content="服务器4" Margin="50,80,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s5" Content="服务器5" Margin="150,80,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked" />
<RadioButton Name="s6" Content="服务器6" Margin="252,80,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s3" Content="服务器4" Margin="50,80,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s4" Content="服务器5" Margin="150,80,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked" />
<RadioButton Name="s5" Content="服务器6" Margin="252,80,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s7" Content="服务器7" Margin="50,120,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s8" Content="服务器8" Margin="150,120,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s9" Content="服务器9" Margin="252,120,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s6" Content="服务器7" Margin="50,120,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s7" Content="服务器8" Margin="150,120,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s8" Content="服务器9" Margin="252,120,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s10" Content="服务器10" Margin="50,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s11" Content="服务器11" Margin="150,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s12" Content="服务器12" Margin="252,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s9" Content="服务器10" Margin="50,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s10" Content="服务器11" Margin="150,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
<RadioButton Name="s11" Content="服务器12" Margin="252,160,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="80" Visibility="Hidden" Checked="server_Checked"/>
</Grid>
</Grid>
</Grid>
@ -155,7 +155,7 @@
<Label Content="服务器介绍" Margin="85,2" FontSize="20" VerticalContentAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<Grid Height="200" VerticalAlignment="Bottom" Margin="10,0,10,10">
<Label Content="友爱" Margin="50,35,50,35"/>
<Label Content="" Margin="50,35,50,35"/>
</Grid>
</Grid>
<Grid HorizontalAlignment="Right" Width="300" ShowGridLines="True" Height="206" VerticalAlignment="Bottom">

View File

@ -32,7 +32,7 @@ namespace CTZLauncher
{
LauncherCore launcher = null;
LaunchOptions option = new LaunchOptions();
string serveraddress = "";
string serveraddress = "CityCraft.cn";
int serverport = 25580;
#region
@ -108,7 +108,7 @@ namespace CTZLauncher
DoubleAnimation dbAscending = new DoubleAnimation(0, 360, new Duration(TimeSpan.FromSeconds(0.75)));
dbAscending.RepeatBehavior = new RepeatBehavior(1);
rtf.BeginAnimation(RotateTransform.AngleProperty, dbAscending);
CTZServer areas = JsonMapper.ToObject<CTZServer>(auth.getServerList());
CTZServer areas = JsonMapper.ToObject<CTZServer>(auth.getServerList().ToLower());
LoadAreas(areas);
}
}
@ -167,17 +167,12 @@ namespace CTZLauncher
else
MessageBox.Show("注册失败!");
}
private void forget_Click(object sender, RoutedEventArgs e)
{
}
#endregion
#region
private void LoadAreas(CTZServer areas)
{
for (int i = 1; i <= areas.Areas.Count; i++)
for (int i = 0; i < areas.Areas.Count; i++)
{
Area area = areas.Areas[i];
RadioButton arearb = GameArea.FindName("a" + i) as RadioButton;
@ -189,7 +184,7 @@ namespace CTZLauncher
private void LoadServers(List<Server> servers)
{
for (int i = 1; i <= servers.Count; i++)
for (int i = 0; i < servers.Count; i++)
{
Server server = servers[i];
RadioButton serverrb = GameArea.FindName("s" + i) as RadioButton;