public void setUp()
        {
            db = new PeLImpl();
            for (int i = 0; i < 4; i++)
            {
                db.RegisterUser("test" + i, "" + i, "email" + i, null);
            }
            db.EditUserById(db.getUserByName("test0").id, null, null, null, null, 1000, 10, false);
            db.EditUserById(db.getUserByName("test1").id, null, null, null, null, 0, 15, false);
            db.EditUserById(db.getUserByName("test2").id, null, null, null, null, 700, 20, false);
            db.EditUserById(db.getUserByName("test3").id, null, null, null, null, 1500, 25, false);


            var userDummies = new List <SystemUser>
            {
                db.getUserByName("test0"),
                db.getUserByName("test1"),
                db.getUserByName("test2"),
                db.getUserByName("test3")
            };

            Random rnd = new Random();

            foreach (SystemUser u in userDummies)
            {
                u.rank = rnd.Next(0, 999999);
            }
            center = GameCenter.getGameCenter();
            center.maintainLeagues(userDummies);
            sl = new SLImpl();
        }
Example #2
0
 public void before()
 {
     gc = GameCenter.GameCenterFactory.getInstance();
     us = TexasHoldemSystem.userSystemFactory.getInstance();
     us.register("user", "123");
     us.login("user", "123");
 }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.Q))
        {
            theSoildStart.Init(10, 1);
            theSoildStart.Init(10, 2);
            theSoildStart.Init(10, 3);
            theSoildStart.Init(10, 4);
            ShowListCount();
            theSoildStart.ShowPoorCount();
        }
        if (Input.GetKeyUp(KeyCode.W))
        {
            GameObject a = GameObject.Find("Cube1");
            GameCenter.mGameCenter().SoildDie(a);
            a = GameObject.Find("Cube2");
            GameCenter.mGameCenter().SoildDie(a);
            a = GameObject.Find("Cube3");
            GameCenter.mGameCenter().SoildDie(a);
            a = GameObject.Find("Cube4");
            GameCenter.mGameCenter().SoildDie(a);

            ShowListCount();
            theSoildStart.ShowPoorCount();
        }
    }
Example #4
0
        public UserBridge(GameCenter gc, SystemControl sys, LogControl log, ReplayManager replay)
        {
            var ses = new SessionIdHandler();

            _gameService = new GameServiceHandler(gc, sys, log, replay, ses);
            _userService = new UserServiceHandler(gc, sys);
        }
        public void SetUp()
        {
            db = new PeLImpl();
            for (int i = 0; i < 4; i++)
            {
                db.RegisterUser("test" + i, "" + i, "email" + i, null);
            }
            db.EditUserById(db.getUserByName("test0").id, null, null, null, null, 1000, 10, false);
            db.EditUserById(db.getUserByName("test1").id, null, null, null, null, 0, 15, false);
            db.EditUserById(db.getUserByName("test2").id, null, null, null, null, 700, 20, false);
            db.EditUserById(db.getUserByName("test3").id, null, null, null, null, 1500, 25, false);


            var userList = new List <SystemUser>
            {
                db.getUserByName("test0"),
                db.getUserByName("test1"),
                db.getUserByName("test2"),
                db.getUserByName("test3")
            };

            center = GameCenter.getGameCenter();

            sl = new SLImpl();
        }
Example #6
0
 // Use this for initialization
 private void Awake()
 {
     GamePlayMgr.Instance.Init();
     LocalizeMgr.Instance.Init();
     ThemeMgr.Instance.Init();
     gameCenter = GetComponent <GameCenter>();
 }
Example #7
0
        private async void SearchAnyGamersAsync()
        {
            string str = await GameCenter.ConnectAsync(this);

            if (str != "")
            {
                if (str == "Have gamer")
                {
                    Writer.Write("1-11");
                    Writer.Write(_gameLogic.FirstGamer != this ? _gameLogic.FirstGamer.Name : _gameLogic.SecondGamer.Name);
                    Writer.Write(_gameLogic.FirstGamer == this ? _gameLogic.FirstGamerSymbol : _gameLogic.SecondGamerSymbol);
                    Console.WriteLine("X0!");
                }
                else if (str == "Have not gamer")
                {
                    Writer.Write("2-11");
                    Console.WriteLine("Никто не хочет пока играть!");
                }
                Writer.Flush();
            }
            else
            {
                Console.WriteLine("Ожидающий игрок вышел!");
            }
        }
Example #8
0
        public async Task InitializeAndPost()
        {
            GameCenter.StartTracking(this);

            driverTimer.Start();

            // Make sure to post this status before we handle any cancellations.
            await PostStatus(driverTimer.Interval);

            // Delay running the OnRide___Canceled() methods until this method finishes.
            using (var delay = new DelayedActions())
            {
                // TODO handle request changes properly
                offer.Changed += OnRideOfferCanceled;

                delay.Run(() => offer.Canceled.RunWhenFired(OnRideOfferCanceled));
                offer.PendingRideMade(this);

                foreach (UserRideRequest rr in requests)
                {
                    // TODO handle request changes properly
                    rr.Changed += OnRideRequestCanceled;

                    delay.Run(() => rr.Canceled.RunWhenFired(OnRideRequestCanceled));
                    rr.PendingRideMade(this);
                }
            }
        }
Example #9
0
 void Start()
 {
     instance = this;
     stateMachine.Start();
     if (isPlatform)
     {
     }
 }
Example #10
0
 void Awake()
 {
     if (!instantiated)
     {
         instance     = this;
         instantiated = true;
     }
 }
Example #11
0
        public void ExitRoom(string player)
        {
            if (player == null)
            {
                var e = new Exception("Can not exit from room, player is invalid");
                Logger.Log(Severity.Exception, e.Message);
                throw e;
            }

            var found = false;

            foreach (var p in Players)
            {
                if (p.Name.Equals(player))
                {
                    found = true;
                }
            }
            if (!found)
            {
                var e = new Exception("Can not exit from room, player is not found");
                Logger.Log(Severity.Exception, e.Message);
                throw e;
            }

            for (var i = 0; i < Players.Count; i++)
            {
                if (Players[i].Name.Equals(player))
                {
                    Players[i].User.ChipsAmount += Players[i].ChipsAmount;
                    for (var j = 0; j < Players[i].User.Notifications.Count; j++)
                    {
                        if (Players[i].User.Notifications[j].Item1 == Name)
                        {
                            Players[i].User.Notifications.Remove(Players[i].User.Notifications[j]);
                        }
                    }
                    if (!IsOn)
                    {
                        Players.Remove(Players[i]);
                    }
                    else
                    {
                        Players[i].Exit = true;
                        Fold(Players[i]);
                    }

                    break;
                }
            }

            if (Players.Count == 0)
            {
                GameCenter.GetGameCenter().DeleteRoom(Name);
                Logger.Log(Severity.Action, "Last player exited, room closed");
            }
        }
Example #12
0
        public async Task <ActionResult> PostRemoveFaction([FromQuery] string userId, [FromQuery] bool canChangeAgain)
        {
            if (await GameCenter.RemoveFaction(userId, canChangeAgain))
            {
                return(Ok());
            }

            return(BadRequest());
        }
Example #13
0
        public GameBridge(GameCenter gc, SystemControl sys, LogControl log, ReplayManager replay)
        {
            _gameCenter = gc;
            var ses = new SessionIdHandler();

            _gameService  = new GameServiceHandler(gc, sys, log, replay, ses);
            _userService  = new UserServiceHandler(gc, sys);
            _logDbHandler = new LogsOnlyForTest();
        }
Example #14
0
        public GameCenter GetGameCenter()
        {
            GameCenter gameCenter = null;

            var xmlLoader = new XmlLoader();

            gameCenter = xmlLoader.GetXml <GameCenter>(GameCenterXmlUrl);

            return(gameCenter);
        }
Example #15
0
        public async Task <ActionResult> PostFaction([FromQuery] string userId, [FromQuery] string factionName)
        {
            if (await GameCenter.SetFaction(userId, factionName))
            {
                return(Ok());
            }

            //TODO get more detail about why it failed (bad faction name?)
            return(BadRequest());
        }
Example #16
0
 public GameServiceHandler(GameCenter gc, SystemControl sys, LogControl log,
                           ReplayManager replay, SessionIdHandler sidHandler)
 {
     _gameCenter    = gc;
     _systemControl = sys;
     _logControl    = log;
     _replayManager = replay;
     //new MessageEventHandler(gc, sys, log, replay, sidHandler);
     _proxyDb = new GameDataProxy(_gameCenter);
 }
Example #17
0
        public async Task <ActionResult> PostRating([FromQuery] string userId, [FromQuery] double rating)
        {
            //TODO make sure the user trying to give the rating has done something with the user worthy of a rating (got a ride from them).
            //TODO maybe don't post the game info everytime. Like a driver might get a lot of incoming ratings, no need to post everytime.
            if (await GameCenter.GiveRating(userId, rating, true))
            {
                return(Ok());
            }

            return(BadRequest());
        }
Example #18
0
        private Spectetor GetSpecFromXML(SpecXML p, GameCenter gc)
        {
            Spectetor toRet = new Spectetor(p.roomId);

            toRet.user = gc.GetSysControl().GetUserWithId(p.userId);
            if (toRet.user == null)
            {
                return(null);
            }
            return(toRet);
        }
Example #19
0
        private void Init()
        {
            logs    = new LogControl();
            sc      = new SystemControl(logs);
            replays = new ReplayManager();
            sender  = new SessionIdHandler();


            games       = new GameCenter(sc, logs, replays, sender);
            userService = new UserServiceHandler(games, sc);
        }
Example #20
0
 public PlayersController(
     GameDBContext context,
     IActionContextAccessor aca,
     IHubContext <ChatHub> hubContext,
     GameCenter gameCenter)
 {
     _context    = context;
     _accessor   = aca;
     _hubContext = hubContext;
     _gamecenter = gameCenter;
 }
Example #21
0
 public ServerEventHandler(SessionIdHandler sidHandler, TcpClient socket, GameCenter game, SystemControl sys,
                           LogControl log, ReplayManager replay, ICommunicationHandler comm)
 {
     _socket           = socket;
     _gameService      = new GameServiceHandler(game, sys, log, replay, sidHandler);
     _userService      = new UserServiceHandler(game, sys);
     _commHandler      = comm;
     _sessionIdHandler = sidHandler;
     _security         = new SecurityHandler();
     _replayService    = new ReplayHandler(replay);
 }
 public void Clear()
 {
     GameCenter.ClearAll();
     UserManager.Clear();
     Leagues.Clear();
     Players.Clear();
     Rooms.Clear();
     Users.Clear();
     PlayerToRoom.Clear();
     RoomToLeague.Clear();
 }
Example #23
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         DestroyImmediate(gameObject);
     }
 }
Example #24
0
    public void UpdateScore(int _score)
    {
        if (_score > playerSave.highscore)
        {
#if UNITY_IOS
            GameCenter.PostScoreToLeaderBoard(_score);
#endif
            playerSave.highscore = _score;
            SaveData();
        }
    }
Example #25
0
 public MessageEventHandler(GameCenter gc, SystemControl sys, LogControl log,
                            ReplayManager replay, SessionIdHandler sidHandler)
 {
     _gameCenter              = gc;
     _system                  = sys;
     _logs                    = log;
     _replays                 = replay;
     this._sidHandler         = sidHandler;
     _parser                  = new ParserImplementation();
     _userIdToEventHandlerMap = new ConcurrentDictionary <int, IEventHandler>();
     _commHandler             = CommunicationHandler.GetInstance();
 }
Example #26
0
    // Use this for initialization

    void Awake()
    {
        if (instance != null)
        {
            Destroy(this.gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(this.gameObject);
        }
    }
Example #27
0
 public static GameCenter GetInstance()
 {
     if (!instance)
     {
         instance = FindObjectOfType(typeof(GameCenter)) as GameCenter;
         if (!instance)
         {
             Debug.Log("No GameCenter!!");
         }
     }
     return(instance);
 }
Example #28
0
        private Player GetPlayerFromXML(PlayerXML p, GameCenter gc)
        {
            Player toRet = new Player(p.name, p.TotalChip, p.roomId, p.RoundChipBet, p.isPlayerActive, p._firstCard,
                                      p._secondCard, p.PlayedAnActionInTheRound, p._publicCards);

            toRet.user = gc.GetSysControl().GetUserWithId(p.userId);
            if (toRet.user == null)
            {
                return(null);
            }
            return(toRet);
        }
Example #29
0
 void Awake()
 {
     instance = this;
     if (gameCenter != null)
     {
         GameCenter game = gameCenter.GetComponent <GameCenter>();
         if (game != null)
         {
             isDebug = game.isDevelopmentPattern;
         }
     }
 }
Example #30
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.SteelBlue);

            var viewMatrix = camera.Transform;

            spriteBatch.Begin(samplerState: SamplerState.PointClamp, transformMatrix: viewMatrix);
            GameCenter.Draw(spriteBatch);
            spriteBatch.End();
            UIManager.DrawUI();

            base.Draw(gameTime);
        }
Example #31
0
 private void ExitFromGame()
 {
     if (_gameLogic == null)
     {
         GameCenter.OutTheGame(this);
     }
     else
     {
         _gameLogic.EarlyGameOver(this);
         _gameLogic = null;
         _gameService.UpdateStatistic(Id, 1, 2);
     }
 }
Example #32
0
    void Awake()
    {
        if (instanceRef == null)
        {
            instanceRef = this;
            DontDestroyOnLoad(this);
            InicializarControladoras();
        }
        else
        {
            Destroy(this.gameObject);
        }

        controladoraGUI.Awake ();
        controladoraSonidos.Awake ();
    }