示例#1
0
            public CorrespondenceFact CreateFact(FactMemento memento)
            {
                LocalPlayer newFact = new LocalPlayer(memento);

                // Create a memory stream from the memento data.
                using (MemoryStream data = new MemoryStream(memento.Data))
                {
                    using (BinaryReader output = new BinaryReader(data))
                    {
                        newFact._index = (int)_fieldSerializerByType[typeof(int)].ReadData(output);
                    }
                }

                return newFact;
            }
示例#2
0
 // Results
 // Business constructor
 public LocalMove(
     LocalPlayer player
     ,int index
     ,int square
     )
 {
     InitializeResults();
     _player = new PredecessorObj<LocalPlayer>(this, RolePlayer, player);
     _index = index;
     _square = square;
 }
示例#3
0
 // Results
 // Business constructor
 public LocalOutcome(
     LocalGame game
     ,LocalPlayer winner
     ,int resigned
     )
 {
     InitializeResults();
     _game = new PredecessorObj<LocalGame>(this, RoleGame, game);
     _winner = new PredecessorOpt<LocalPlayer>(this, RoleWinner, winner);
     _resigned = resigned;
 }
示例#4
0
 public void DeclareWinner(LocalPlayer winner, bool resigned)
 {
     Community.AddFact(new LocalOutcome(this, winner, resigned ? 1 : 0));
 }