• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DataNew类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DataNew的典型用法代码示例。如果您正苦于以下问题:C# DataNew类的具体用法?C# DataNew怎么用?C# DataNew使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataNew类属于命名空间,在下文中一共展示了DataNew类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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.");
        }
开发者ID:sbarnabas,项目名称:OCTGN,代码行数:31,代码来源:GameTableLauncher.cs


示例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]);
     }
 }
开发者ID:haplo63,项目名称:OCTGN,代码行数:33,代码来源:Player.cs


示例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;
        }
开发者ID:Gravecorp,项目名称:OCTGN,代码行数:14,代码来源:Counter.cs


示例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();
 }
开发者ID:Cosworth32,项目名称:OCTGN,代码行数:9,代码来源:XmlSimpleValidate.cs


示例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;
 }
开发者ID:jonbonne,项目名称:OCTGN,代码行数:9,代码来源:DataGameViewModel.cs


示例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;
 }
开发者ID:rerbes,项目名称:OCTGN,代码行数:57,代码来源:Player.cs


示例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;
 }
开发者ID:rexperalta,项目名称:OCTGN,代码行数:11,代码来源:Create.cs


示例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;
 }
开发者ID:voidbeast,项目名称:OCTGN,代码行数:11,代码来源:Card.cs


示例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);
 }
开发者ID:haplo63,项目名称:OCTGN,代码行数:12,代码来源:SearchControl.xaml.cs


示例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");
 }
开发者ID:karlnp,项目名称:OCTGN,代码行数:52,代码来源:Player.cs


示例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;
 }
开发者ID:vanzeeaj,项目名称:OCTGN,代码行数:15,代码来源:Card.cs


示例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();
 }
开发者ID:octgn,项目名称:OCTGN,代码行数:16,代码来源:SearchControl.xaml.cs


示例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
开发者ID:rexperalta,项目名称:OCTGN,代码行数:16,代码来源:SearchControl.xaml.cs


示例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];
 }
开发者ID:digitalalchemy,项目名称:OCTGN,代码行数:17,代码来源:Card.cs


示例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);
 }
开发者ID:Cosworth32,项目名称:OCTGN,代码行数:20,代码来源:XmlSimpleValidate.cs


示例16: CardModelEventArgs

 public CardModelEventArgs(DataNew.Entities.Card model, RoutedEvent routedEvent, object source)
     : base(routedEvent, source)
 {
     CardModel = model;
 }
开发者ID:haplo63,项目名称:OCTGN,代码行数:5,代码来源:ChatControl.xaml.cs


示例17: GenerateColumns

 private void GenerateColumns(DataNew.Entities.Game game)
 {
     foreach (DataNew.Entities.PropertyDef prop in game.CustomProperties)
     {
         if (prop.Name == "Name") continue;
         resultsGrid.Columns.Add(new DataGridTextColumn
                                     {
                                         Binding = new Binding
                                                       {
                                                           Path = new PropertyPath(prop.Name),
                                                           Mode = BindingMode.OneTime
                                                       },
                                         Header = prop.Name
                                     });
     }
 }
开发者ID:haplo63,项目名称:OCTGN,代码行数:16,代码来源:SearchControl.xaml.cs


示例18: SetModel

 internal void SetModel(DataNew.Entities.Card model)
 {
     #if (DEBUG)
     Debug.WriteLine("SetModel event happened!");
     #endif
     bool processSwitches = false;
     if (Type.Model == null) processSwitches = true;//if there is no current model, we've built up unperformed Alternate Switches
     Type.Model = model;
     OnPropertyChanged("Picture");//This should be changed - the model is much more than just the picture.
     if (processSwitches) catchUpOnAlternateSwitches();
 }
开发者ID:voidbeast,项目名称:OCTGN,代码行数:11,代码来源:Card.cs


示例19: CreateCardMenuItems

        protected virtual List<Control> CreateCardMenuItems(Card card, DataNew.Entities.Group def)
        {
            var items = new List<Control>();
            if (!card.CanManipulate())
            {
                var item = new MenuItem { Header = card.Name, Background = card.Controller.TransparentBrush };
                item.SetResourceReference(StyleProperty, "MenuHeader");
                items.Add(item);

                item = new MenuItem { Header = "Take control" };
                item.Click += delegate { card.TakeControl(); };
                items.Add(item);
                return items;
            }
            else {
                var selection = Selection.ExtendToSelection(card);
                //actionFilter showCard = async (IGroupAction a) =>
                actionFilter showCard = (IGroupAction a) =>
                {
                    if (a.ShowIf != null)
                    {
                      //return await CallActionShowIf(a.ShowIf, selection);
                      return CallActionShowIf(a.ShowIf, selection);
                    }
                    return true;
                };
                var visibleActionsTasks = def.CardActions.Select(item => new { Item = item, PredTask = showCard.Invoke(item) }).ToList();
                //await TaskEx.WhenAll(visibleActionsTasks.Select(x => x.PredTask));
                //var visibleActions = visibleActionsTasks.Where(x => x.PredTask.Result).Select(x => x.Item).ToArray();
                var visibleActions = visibleActionsTasks.Where(x => x.PredTask).Select(x => x.Item).ToArray();
                var nCardActions = visibleActions.Length;

                if (nCardActions > 0 || group.Controller == null)
                {
                    var cardHeader = new MenuItem();
                    cardHeader.SetResourceReference(StyleProperty, "MenuHeader");
                    cardHeader.Header = card.Name;
                    cardHeader.Background = card.Controller.TransparentBrush;
                    items.Add(cardHeader);
                }
                if (nCardActions > 0)
                {
                    items.AddRange(visibleActions.Select(action => CreateActionMenuItem(action, CardActionClicked)));
                    if (group.Controller == null)
                        items.Add(new Separator());
                }
                if (group.Controller == null)
                    items.Add(CreateCardPassToItem());
            }
            if (!card.FaceUp)
            {
              var peekItem = new MenuItem { Header = "Peek", InputGestureText = "Ctrl+P" };
              peekItem.Click += delegate { ContextCard.Peek(); };
              items.Add(peekItem);
            }

            return items;
        }
开发者ID:jonbonne,项目名称:OCTGN,代码行数:58,代码来源:GroupControl.cs


示例20: StartOnlineGame

 void StartOnlineGame(DataNew.Entities.Game game, string name, string password)
 {
     var client = new Octgn.Site.Api.ApiClient();
     if (!client.IsGameServerRunning(Program.LobbyClient.Username, Program.LobbyClient.Password))
     {
         throw new UserMessageException("The game server is currently down. Please try again later.");
     }
     Program.CurrentOnlineGameName = name;
     // TODO: Replace this with a server-side check
     password = SubscriptionModule.Get().IsSubscribed == true ? password : String.Empty;
     Program.LobbyClient.BeginHostGame(game, name, password, game.Name, game.IconUrl, 
         typeof(Octgn.Server.Server).Assembly.GetName().Version,Specators);
 }
开发者ID:rexperalta,项目名称:OCTGN,代码行数:13,代码来源:HostGameSettings.xaml.cs



注:本文中的DataNew类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DataObject类代码示例发布时间:2022-05-24
下一篇:
C# DataModel类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap