void Start()
    {
        GameObject ngameControllerObject = GameObject.FindWithTag("NormalGameController");

        if (ngameControllerObject != null)
        {
            ngameController = ngameControllerObject.GetComponent <NormalGameController>();
        }
        if (ngameController == null)
        {
            Debug.Log("Cannot find 'NormalGameController' script");
        }
    }
示例#2
0
        public void Sync()
        {
            Console.WriteLine("Synchronizacja stołów do gry normalnej");

            //Wyczytwanie stołow normalgamemode z bd
            using (ISession session = DatabaseSession.Open())
            {
                //Gry stołowe
                var _normalgamemodelist = session.QueryOver <NormalGameModel>().List();
                foreach (NormalGameModel gameModel in _normalgamemodelist)
                {
                    var realModel = gameModel.Unproxy(session);

                    NormalGameController gameController = new NormalGameController(realModel);

                    this.pokerServiceInstance.GameList.Get().Add(gameController);
                }

                //Turnieje
                var tournamentSitList = session.QueryOver <SitAndGoTournamentGameModel>().List();
                foreach (SitAndGoTournamentGameModel gameModel in tournamentSitList)
                {
                    var realModel = gameModel.Unproxy(session);
                    realModel.TournamentModel = realModel.TournamentModel.Unproxy(session);

                    TournamentGameController gameController = new TournamentGameController(realModel);

                    this.pokerServiceInstance.GameList.Get().Add(gameController);
                }

                var tournamentNormalList = session.QueryOver <NormalTournamentGameModel>().List();
                foreach (NormalTournamentGameModel gameModel in tournamentNormalList)
                {
                    var realModel = gameModel.Unproxy(session);
                    realModel.TournamentModel = realModel.TournamentModel.Unproxy(session);

                    TournamentGameController gameController = new TournamentGameController(realModel);

                    this.pokerServiceInstance.GameList.Get().Add(gameController);
                }

                foreach (IGameController controller in pokerServiceInstance.GameList.Get())
                {
                    var threadController = new Thread(new ThreadStart(controller.Worker));
                    threadController.IsBackground = true;
                    threadController.Start();
                }
            }
        }