本文整理汇总了C#中DataNew类的典型用法代码示例。如果您正苦于以下问题:C# DataNew类的具体用法?C# DataNew怎么用?C# DataNew使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataNew类属于命名空间,在下文中一共展示了DataNew类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartLocalGame
void StartLocalGame(DataNew.Entities.Game game, string name, string password)
{
var hs = new HostedGame(HostPort, game.Id, game.Version, game.Name, name, null, new User(Prefs.Nickname + "@" + AppConfig.ChatServerPath), true);
if (!hs.StartProcess())
{
throw new UserMessageException("Cannot start local game. You may be missing a file.");
}
Program.LobbyClient.CurrentHostedGamePort = HostPort;
Program.GameSettings.UseTwoSidedTable = HostGame.UseTwoSidedTable;
Program.IsHost = true;
Program.GameEngine = new GameEngine(game, Prefs.Nickname, password,true);
var ip = IPAddress.Parse("127.0.0.1");
for (var i = 0; i < 5; i++)
{
try
{
Program.Client = new Octgn.Networking.ClientSocket(ip, HostPort);
Program.Client.Connect();
return;
}
catch (Exception e)
{
Log.Warn("Start local game error", e);
if (i == 4) throw;
}
Thread.Sleep(2000);
}
throw new UserMessageException("Cannot start local game. You may be missing a file.");
}
示例2: Player
// C'tor for global items
internal Player(DataNew.Entities.Game g)
{
var globalDef = g.GlobalPlayer;
// Register the lPlayer
all.Add(this);
// Init fields
_name = "Global";
Id = 0;
PublicKey = 0;
if (GlobalVariables == null)
{
// Create global variables
GlobalVariables = new Dictionary<string, string>();
foreach (var varD in g.Player.GlobalVariables)
GlobalVariables.Add(varD.Name, varD.Value);
}
// Create counters
_counters = new Counter[0];
if (globalDef.Counters != null)
_counters = globalDef.Counters.Select(x => new Counter(this, x)).ToArray();
// Create global's lPlayer groups
// TODO: This could fail with a run-time exception on write, make it safe
// I don't know if the above todo is still relevent - Kelly Elton - 3/18/2013
if (globalDef.Groups != null)
{
var tempGroups = globalDef.Groups.ToArray();
_groups = new Group[tempGroups.Length + 1];
_groups[0] = _hand;
for (int i = 1; i < IndexedGroups.Length; i++)
_groups[i] = new Pile(this, tempGroups[i - 1]);
}
}
示例3: Counter
private int _state; // Value of this counter
#endregion Fields
#region Constructors
public Counter(Player player, DataNew.Entities.Counter def)
{
_player = player;
_state = def.Start;
_name = def.Name;
_id = def.Id;
_defintion = def;
}
示例4: CheckXml
public void CheckXml(DataNew.Entities.Game game)
{
XmlSetParser xmls = xml_set;
if (game.Id.ToString() != xmls.game())
{
throw new Exception("Error! Wrong game specified in xml");
}
xmls.check();
}
示例5: DataGameViewModel
public DataGameViewModel(DataNew.Entities.Game game)
{
Id = game.Id;
Name = game.Name;
Version = game.Version;
CardBackUri = game.GetCardBackUri();
//FullPath = game.FullPath;
IsSelected = false;
}
示例6: Player
// C'tor
internal Player(DataNew.Entities.Game g, string name, byte id, ulong pkey, bool spectator, bool local)
{
_spectator = spectator;
SetupPlayer(Spectator);
// Init fields
_name = name;
Id = id;
PublicKey = pkey;
if (Spectator == false)
{
// Register the lPlayer
all.Add(this);
//Create the color brushes
SetPlayerColor(id);
// Create counters
_counters = new Counter[0];
if (g.Player.Counters != null)
_counters = g.Player.Counters.Select(x => new Counter(this, x)).ToArray();
// Create variables
Variables = new Dictionary<string, int>();
foreach (var varDef in g.Variables.Where(v => !v.Global))
Variables.Add(varDef.Name, varDef.Default);
// Create global variables
GlobalVariables = new Dictionary<string, string>();
foreach (var varD in g.Player.GlobalVariables)
GlobalVariables.Add(varD.Name, varD.Value);
// Create a hand, if any
if (g.Player.Hand != null)
_hand = new Hand(this, g.Player.Hand);
// Create groups
_groups = new Group[0];
if (g.Player.Groups != null)
{
var tempGroups = g.Player.Groups.ToArray();
_groups = new Group[tempGroups.Length + 1];
_groups[0] = _hand;
for (int i = 1; i < IndexedGroups.Length; i++)
_groups[i] = new Pile(this, tempGroups[i - 1]);
}
// Raise the event
if (PlayerAdded != null) PlayerAdded(null, new PlayerEventArgs(this));
Ready = false;
OnPropertyChanged("All");
OnPropertyChanged("AllExceptGlobal");
OnPropertyChanged("Count");
minHandSize = 250;
}
else
{
spectators.Add(this);
SetPlayerColor(id);
OnPropertyChanged("Spectators");
Ready = true;
}
CanKick = local == false&& Program.IsHost;
}
示例7: CreateCard
public CreateCard(Player owner, int id,bool faceUp, DataNew.Entities.Card model, int x, int y,
bool deletesWhenLeavesGroup)
{
_owner = owner;
_id = id;
_faceUp = faceUp;
_deletesWhenLeavesGroup = deletesWhenLeavesGroup;
_model = model;
_x = x;
_y = y;
}
示例8: Card
internal Card(Player owner, int id, ulong key, CardDef def, DataNew.Entities.Card model, bool mySecret)
: base(owner)
{
_id = id;
Type = new CardIdentity(id) {Alias = false, Key = key, Model = model, MySecret = mySecret};
// var _definition = def;
All.Add(id, this);
_alternateOf = null;
numberOfSwitchWithAlternatesNotPerformed = 0;
_isAlternateImage = false;
}
示例9: SearchControl
public SearchControl(DataNew.Entities.Game game)
{
Game = game;
InitializeComponent();
filtersList.ItemsSource =
Enumerable.Repeat<object>("First", 1).Union(
Enumerable.Repeat<object>(new SetPropertyDef(Game.Sets()), 1).Union(
game.AllProperties().Where(p => !p.Hidden)));
GenerateColumns(game);
//resultsGrid.ItemsSource = game.SelectCards(null).DefaultView;
UpdateDataGrid(game.AllCards().ToDataTable(Game).DefaultView);
}
示例10: Player
// C'tor
internal Player(DataNew.Entities.Game g, string name, byte id, ulong pkey)
{
all.CollectionChanged += (sender, args) =>
{
allExceptGlobal.Clear();
foreach (var p in all.ToArray().Where(x=>x != Player.GlobalPlayer))
{
allExceptGlobal.Add(p);
}
};
State = PlayerState.Connected;
// Init fields
_name = name;
Id = id;
PublicKey = pkey;
// Register the lPlayer
Application.Current.Dispatcher.Invoke(new Action(()=>all.Add(this)));
//Create the color brushes
SetPlayerColor(id);
// Create counters
_counters = new Counter[0];
if (g.Player.Counters != null)
_counters = g.Player.Counters.Select(x =>new Counter(this, x) ).ToArray();
// Create variables
Variables = new Dictionary<string, int>();
foreach (var varDef in g.Variables.Where(v => !v.Global))
Variables.Add(varDef.Name, varDef.Default);
// Create global variables
GlobalVariables = new Dictionary<string, string>();
foreach (var varD in g.Player.GlobalVariables)
GlobalVariables.Add(varD.Name, varD.Value);
// Create a hand, if any
if (g.Player.Hand != null)
_hand = new Hand(this, g.Player.Hand);
// Create groups
_groups = new Group[0];
if (g.Player.Groups != null)
{
var tempGroups = g.Player.Groups.ToArray();
_groups = new Group[tempGroups.Length + 1];
_groups[0] = _hand;
for (int i = 1; i < IndexedGroups.Length; i++)
_groups[i] = new Pile(this, tempGroups[i - 1]);
}
// Raise the event
if (PlayerAdded != null) PlayerAdded(null, new PlayerEventArgs(this));
Ready = false;
OnPropertyChanged("All");
OnPropertyChanged("AllExceptGlobal");
OnPropertyChanged("Count");
}
示例11: Card
internal Card(Player owner, int id, ulong key, DataNew.Entities.Card model, bool mySecret)
: base(owner)
{
_id = id;
Type = new CardIdentity(id) {Key = key, Model = model.Clone() , MySecret = mySecret};
// var _definition = def;
lock (All)
{
if (All.ContainsKey(id)) All[id] = this;
else All.Add(id, this);
}
_alternateOf = null;
numberOfSwitchWithAlternatesNotPerformed = 0;
_isAlternateImage = false;
}
示例12: SearchControl
public SearchControl(DataNew.Entities.Game game, DeckBuilderWindow deckWindow)
{
_deckWindow = deckWindow;
NumMod = "";
Game = game;
InitializeComponent();
filtersList.ItemsSource =
Enumerable.Repeat<object>("First", 1).Union(
Enumerable.Repeat<object>(new SetPropertyDef(Game.Sets().Where(x => x.Hidden == false)), 1).Union(
game.AllProperties().Where(p => !p.Hidden)));
GenerateColumns(game);
//resultsGrid.ItemsSource = game.SelectCards(null).DefaultView;
UpdateDataGrid(game.AllCards(true).ToDataTable(Game).DefaultView);
FileName = "";
UpdateCount();
}
示例13: SearchControl
public SearchControl(DataNew.Entities.Game game, DeckBuilderWindow deckWindow)
{
_deckWindow = deckWindow;
NumMod = "";
Game = game;
InitializeComponent();
filtersList.ItemsSource =
Enumerable.Repeat<object>("First", 1).Union(
Enumerable.Repeat<object>(new SetPropertyDef(Game.Sets()), 1).Union(
game.AllProperties().Where(p => !p.Hidden)));
GenerateColumns(game);
//resultsGrid.ItemsSource = game.SelectCards(null).DefaultView;
UpdateDataGrid(game.AllCards().ToDataTable(Game).DefaultView);
FileName = "";
UpdateCount();
}//Why are we populating the list on load? I'd rather wait until the search is run with no parameters (V)_V
示例14: Card
internal Card(Player owner, int id, DataNew.Entities.Card model, bool mySecret, string cardsize)
: base(owner)
{
_id = id;
Type = new CardIdentity(id) { Model = model.Clone() };
// var _definition = def;
lock (All)
{
if (All.ContainsKey(id)) All[id] = this;
else All.Add(id, this);
}
_alternateOf = null;
numberOfSwitchWithAlternatesNotPerformed = 0;
_isAlternateImage = false;
_cardMoved = false;
Size = Program.GameEngine.Definition.CardSizes[cardsize];
}
示例15: CheckVerboseXml
public void CheckVerboseXml(Windows.ChangeSetsProgressDialog wnd, int max, DataNew.Entities.Game game)
{
XmlSetParser xmls = xml_set;
wnd.UpdateProgress(1, max, "Parsing retrieved xml...", false);
xmls.check();
if (game.Id.ToString() != xmls.game())
{
wnd.UpdateProgress(10, 10, string.Format("Error! Wrong game specified in xml"), false);
return;
}
wnd.UpdateProgress(2, max, "Name: " + xmls.name(), false);
wnd.UpdateProgress(3, max, "Game: " + xmls.game(), false);
wnd.UpdateProgress(4, max, "UUID: " + xmls.uuid(), false);
wnd.UpdateProgress(5, max, "Version: " + xmls.version(), false);
wnd.UpdateProgress(6, max, "Date: " + xmls.date(), false);
wnd.UpdateProgress(7, max, "Link: " + xmls.link(), false);
wnd.UpdateProgress(8, max, "Login: " + xmls.user(), false);
wnd.UpdateProgress(9, max, "Password: " + xmls.password(), false);
wnd.UpdateProgress(10, 10, string.Format("Xml seems ok"), false);
}