[ADD] new constructor for user
This commit is contained in:
@@ -5,6 +5,7 @@ using System.ComponentModel;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using SharedClientServer;
|
using SharedClientServer;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Client
|
namespace Client
|
||||||
{
|
{
|
||||||
@@ -58,5 +59,10 @@ namespace Client
|
|||||||
get { return _lobbies; }
|
get { return _lobbies; }
|
||||||
set { _lobbies = value; }
|
set { _lobbies = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnHostButtonClick()
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Click host button");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,9 @@
|
|||||||
<ComboBoxItem Content="ORANGE"/>
|
<ComboBoxItem Content="ORANGE"/>
|
||||||
<ComboBoxItem Content="PURPLE"/>
|
<ComboBoxItem Content="PURPLE"/>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<Label Content="{Binding Username}" Grid.Column="1" HorizontalAlignment="Center" Margin="0,12,0,0" VerticalAlignment="Top" Grid.Row="1"/>
|
|
||||||
|
<Label Grid.Row="3" Name="testLabel" FontSize="15" VerticalAlignment="Center"/>
|
||||||
|
<Label Content="place username here" Grid.Column="1" HorizontalAlignment="Center" Margin="0,12,0,0" VerticalAlignment="Top" Grid.Row="1"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@@ -66,7 +68,7 @@
|
|||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="50"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Button Name="joinButton" Grid.Row="0" Content="join a selected lobby" Click="Button_Click" Width="200" Height="40" HorizontalAlignment="Left" Margin="10, 0, 0, 0"/>
|
<Button Name="joinButton" Grid.Row="0" Content="join a selected lobby" Click="Button_Click" Width="200" Height="40" HorizontalAlignment="Left" Margin="10, 0, 0, 0"/>
|
||||||
<Button Name="hostButton" Grid.Row="1" Content="host a new lobby" Command="{Binding ...}" Width="200" Height="40" HorizontalAlignment="left" Margin="10, 0, 0, 0"/>
|
<Button Name="hostButton" Grid.Row="1" Content="host a new lobby" Command="{Binding Path=OnHostButtonClick}" Width="200" Height="40" HorizontalAlignment="left" Margin="10, 0, 0, 0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ namespace Client
|
|||||||
if(lobbySelected != null)
|
if(lobbySelected != null)
|
||||||
{
|
{
|
||||||
testLabel.Content = lobbySelected.ID;
|
testLabel.Content = lobbySelected.ID;
|
||||||
usernameTextbox.IsEnabled = false;
|
|
||||||
colorSelection.IsEnabled = false;
|
colorSelection.IsEnabled = false;
|
||||||
joinButton.IsEnabled = false;
|
joinButton.IsEnabled = false;
|
||||||
hostButton.IsEnabled = false;
|
hostButton.IsEnabled = false;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace Server.Models
|
|||||||
private byte[] buffer = new byte[1024];
|
private byte[] buffer = new byte[1024];
|
||||||
private byte[] totalBuffer = new byte[1024];
|
private byte[] totalBuffer = new byte[1024];
|
||||||
private int totalBufferReceived = 0;
|
private int totalBufferReceived = 0;
|
||||||
|
public User user;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -17,6 +17,13 @@ namespace SharedClientServer
|
|||||||
_host = host;
|
_host = host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public User(string username)
|
||||||
|
{
|
||||||
|
_username = username;
|
||||||
|
_score = 0;
|
||||||
|
_host = false;
|
||||||
|
}
|
||||||
|
|
||||||
public string Username
|
public string Username
|
||||||
{
|
{
|
||||||
get { return _username; }
|
get { return _username; }
|
||||||
|
|||||||
Reference in New Issue
Block a user