コード例 #1
0
        public void RunTournament(IPairingsGenerator pg, List <TournamentTeam> teams, List <TournamentRound> rounds, bool allowTies, TournamentNameTable nameTable)
        {
            ITournamentVisualizer viz = null;

            if (nameTable != null)
            {
                viz = pg as ITournamentVisualizer;
            }

            while (true)
            {
                pg.LoadState(teams, rounds);
                TournamentRound newRound = pg.CreateNextRound(null);

                if (viz != null)
                {
                    var gfx = new SystemGraphics();
                    var q2  = viz.Measure(gfx, nameTable);
                    viz.Render(gfx, nameTable);
                }

                if (newRound == null)
                {
                    pg.LoadState(teams, rounds);
                    newRound = pg.CreateNextRound(null);
                    break;
                }

                if (allowTies)
                {
                    foreach (var pairing in newRound.Pairings)
                    {
                        foreach (var teamScore in pairing.TeamScores)
                        {
                            teamScore.Score = new HighestPointsScore(r.Next(20));
                        }
                    }
                }
                else
                {
                    foreach (var pairing in newRound.Pairings)
                    {
                        List <double> scoresUsed = new List <double>();
                        foreach (var teamScore in pairing.TeamScores)
                        {
                            double score;
                            do
                            {
                                score = r.NextDouble();
                            } while (scoresUsed.Where(s => s == score).Any());

                            teamScore.Score = new HighestPointsScore(score);
                        }
                    }
                }

                rounds.Add(newRound);
            }
        }
コード例 #2
0
ファイル: SystemManager.cs プロジェクト: Maxii/CodeEnv.Master
 protected override void Awake() {
     base.Awake();
     _orbitalPlane = gameObject.GetSafeFirstMonoBehaviourInChildren<OrbitalPlaneInputEventRouter>();
     _systemGraphics = gameObject.GetSafeMonoBehaviour<SystemGraphics>();
     _star = gameObject.GetSafeFirstMonoBehaviourInChildren<Star>();
     _planetsAndMoons = gameObject.GetSafeMonoBehavioursInChildren<FollowableItem>();
     _eventMgr = GameEventManager.Instance;
     _selectionMgr = SelectionManager.Instance;
 }
コード例 #3
0
        public ReactorSystemViewModel(ReactorSystem reactorSystem)
        {
            ReactorSystem     = reactorSystem;
            ReactorViewModels = new ObservableCollection <ReactorViewModel>();
            int i = 1;

            AssembliesList = new ObservableCollection <Assemblies>();
            foreach (var reactor in ReactorSystem.Reactors)
            {
                var reactorViewModel = new ReactorViewModel(reactor,
                                                            assemblies => AssembliesList.Add(assemblies), assemblies => AssembliesList.Remove(Assemblies));
                reactorViewModel.ReactorName = "Реактор " + i.ToString("D");
                reactorViewModel.AddGraphic(new FuelGraphic());
                reactorViewModel.AddGraphic(new SumFuelGraphic());
                i++;
                ReactorViewModels.Add(reactorViewModel);
            }

            _fuelAndResourceGraphic  = new FunctionalGraphic();
            ReactorSystem.DayPassed += _fuelAndResourceGraphic.GetData;
            SystemGraphics.Add(_fuelAndResourceGraphic);
            SelectedGraphic = _fuelAndResourceGraphic;
        }
コード例 #4
0
ファイル: OrbitalPlane.cs プロジェクト: Maxii/CodeEnv.Master
 protected override void Awake() {
     base.Awake();
     _systemManager = gameObject.GetSafeFirstMonoBehaviourInParents<SystemCreator>();
     _systemGraphics = gameObject.GetSafeFirstMonoBehaviourInParents<SystemGraphics>();
     __ValidateCtxObjectSettings();
 }