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; }
// Results // Business constructor public LocalMove( LocalPlayer player ,int index ,int square ) { InitializeResults(); _player = new PredecessorObj<LocalPlayer>(this, RolePlayer, player); _index = index; _square = square; }
// 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; }
public void DeclareWinner(LocalPlayer winner, bool resigned) { Community.AddFact(new LocalOutcome(this, winner, resigned ? 1 : 0)); }