Architecture - StepanoidTeam/powerGrid GitHub Wiki
[allowedPhases='auction'] [checkPlayersTurn]//проверяет чей ход/является ли игрок текущим AuctionPhaseController
Game.CurrentPhase =4
Game.Auction.Buy Game.Build.BuildTown
class Phase{ bool isAllDone(){ return users.all(u=>u.isDone); }; Done(user){ user.isDone = true; if(isAllDone){ this.Resolve(true);//NextPhase } } }
class BuildPhase:Phase{ BuildTown(User, DataModel){
} }
[buildPhase,AuctionPhase,BureaucracyPhase];
do(buildPhase).do(AuctionPhase).do(....) // SERVER phases = setColors, //once baseMoney, //once
cyclePhases //once { build, auction, burokrat, }//until end
endGame, //once
var SetColorsPromise = new Promise(function(resolve) {
function setColorForPlayer(player){ if(players.all(p=>p.isDone){ allPlayersGotColors(); }
}
while(allDone){ resolve(); }
function allPlayersGotColors(){ resolve(); }
})
setColorsPromise.then(initMoneyPromise)