コード例 #1
0
 public PartialVariableListModel GetVariableListModel()
 {
     PartialVariableListModel vars = new PartialVariableListModel();
     ObservableCollection<PartialVariableModel> defs = new ObservableCollection<PartialVariableModel>();
     foreach (TreePartialVariableDefinition def in Definitions)
         defs.Add(def.GetVariableModel());
     vars.Definitions = defs;
     return vars;
 }
コード例 #2
0
ファイル: PreflopPartialWizard.cs プロジェクト: ddksaku/rzr
        public PartialVariableListModel LoadVariables(BetTreeNodeModel Node)
        {
            int numPlayers = Node.Snapshot.Active.Count(x => x);
            Variables = new PartialVariableListModel();
            ObservableCollection<PartialVariableModel> defs = new ObservableCollection<PartialVariableModel>();
            foreach (TreePartialVariableDefinition[] defSet in _variables)
            {
                foreach (TreePartialVariableDefinition defSingle in defSet)
                {
                    PartialVariableModel var = new PartialVariableModel() { Name = defSingle.ID, Variable = defSingle.Variable, Default = defSingle.Default };
                    ObservableCollection<PartialPlayerValueModel> players = new ObservableCollection<PartialPlayerValueModel>();
                    for (int i = 0; i < numPlayers; i++)
                        players.Add(new PartialPlayerValueModel() { Index = i });
                    var.Players = players;
                    defs.Add(var);
                }
            }

            Variables.Definitions = defs;
            return Variables;
        }
コード例 #3
0
ファイル: BetTreeModel.cs プロジェクト: ddksaku/rzr
        public void LoadPlayerValues(BetTreeNodeModel node, PartialVariableListModel variables)
        {
            List<PlayerModel> activePlayers = new List<PlayerModel>();
            int nextPlayer = (int)node.Snapshot.NextPlayer;
            for (int i = 0; i < node.Snapshot.Active.Length; i++)
            {
                int playerIndex = (i + nextPlayer) % node.Snapshot.Active.Length;
                if (node.Snapshot.Active[playerIndex])
                {
                    activePlayers.Add(Table.Seats[playerIndex].Player);
                }
            }

            foreach (PartialVariableModel model in variables.Definitions)
            {
                foreach (PartialPlayerValueModel player in model.Players)
                {
                    player.Player = activePlayers[player.Index];
                    VariableGroup group = player.Player.Container.Groups.First(x => x.Name == node.Snapshot.Round.ToString());
                    player.Value = new ValueModel();
                    player.Value.Value = model.Default;
                    player.Value.Variable = group.Variables.FirstOrDefault(x => x.Name == model.Variable);
                    if (player.Value.Variable == null)
                        player.Value.Value = model.Default;
                }
            }
        }