예제 #1
0
파일: BetTreeModel.cs 프로젝트: ddksaku/rzr
        protected BetTreeNodeModel LoadNode(BetTreeNodeModel parent, BetTreeNodeXml node, bool relative)
        {
            BetTreeNodeModel ret = Service.AddChild(this, parent);
            ret.LoadFromXml(node, relative);

            if (!ret.Snapshot.IsHandEnd)
                foreach (BetTreeNodeXml child in node.Children)
                    LoadNode(ret, child, relative);
            return ret;
        }
예제 #2
0
        public void LoadFromXml(BetTreeNodeXml xml, bool relative)
        {
            if (relative)
            {
                float pot = this.Snapshot.Bets.Sum();
                float amount = xml.MetaXml.BetXml.BetAmount * pot;
                if (this.Snapshot.CurrentPlayer != null)
                {
                    float remaining = this.Snapshot.Stacks[(int)this.Snapshot.CurrentPlayer] - this.Snapshot.Bets[(int)this.Snapshot.CurrentPlayer];
                    if (amount >= remaining)
                    {
                        amount = remaining;
                    }
                }
                xml.MetaXml.BetXml.BetAmount = amount;
            }

            this.Meta = xml.MetaXml.Name;
            this.IsDefault = xml.IsDefault;
            this.Data.LoadFromXml(xml.MetaXml);
            this.Info.LoadFromXml(xml.InfoXml);
            this.Save(null);
        }
예제 #3
0
 public BetTreeNodeXml SaveToXml()
 {
     BetTreeNodeXml ret = new BetTreeNodeXml();
     ret.IsDefault = this.IsDefault;
     ret.MetaXml = this.Data.SaveToXml();
     ret.InfoXml = this.Info.SaveToXml();
     foreach (BetTreeNodeModel child in Children)
         ret.Children.Add(child.SaveToXml());
     return ret;
 }
예제 #4
0
        private BetTreeNodeModel LoadNode(BetTreeNodeModel parent, BetTreeNodeXml node)
        {
            BetTreeNodeModel ret = Service.AddChild(Tree, parent);
            ret.LoadFromXml(node, true);

            if (!ret.Snapshot.IsHandEnd)
                foreach (BetTreeNodeXml child in node.Children)
                    LoadNode(ret, child);
            return ret;
        }