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(); }
public void before() { gc = GameCenter.GameCenterFactory.getInstance(); us = TexasHoldemSystem.userSystemFactory.getInstance(); us.register("user", "123"); us.login("user", "123"); }
// 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(); } }
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(); }
// Use this for initialization private void Awake() { GamePlayMgr.Instance.Init(); LocalizeMgr.Instance.Init(); ThemeMgr.Instance.Init(); gameCenter = GetComponent <GameCenter>(); }
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("Ожидающий игрок вышел!"); } }
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); } } }
void Start() { instance = this; stateMachine.Start(); if (isPlatform) { } }
void Awake() { if (!instantiated) { instance = this; instantiated = true; } }
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"); } }
public async Task <ActionResult> PostRemoveFaction([FromQuery] string userId, [FromQuery] bool canChangeAgain) { if (await GameCenter.RemoveFaction(userId, canChangeAgain)) { return(Ok()); } return(BadRequest()); }
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(); }
public GameCenter GetGameCenter() { GameCenter gameCenter = null; var xmlLoader = new XmlLoader(); gameCenter = xmlLoader.GetXml <GameCenter>(GameCenterXmlUrl); return(gameCenter); }
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()); }
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); }
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()); }
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); }
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); }
public PlayersController( GameDBContext context, IActionContextAccessor aca, IHubContext <ChatHub> hubContext, GameCenter gameCenter) { _context = context; _accessor = aca; _hubContext = hubContext; _gamecenter = gameCenter; }
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(); }
private void Awake() { if (Instance == null) { Instance = this; } else { DestroyImmediate(gameObject); } }
public void UpdateScore(int _score) { if (_score > playerSave.highscore) { #if UNITY_IOS GameCenter.PostScoreToLeaderBoard(_score); #endif playerSave.highscore = _score; SaveData(); } }
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(); }
// Use this for initialization void Awake() { if (instance != null) { Destroy(this.gameObject); } else { instance = this; DontDestroyOnLoad(this.gameObject); } }
public static GameCenter GetInstance() { if (!instance) { instance = FindObjectOfType(typeof(GameCenter)) as GameCenter; if (!instance) { Debug.Log("No GameCenter!!"); } } return(instance); }
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); }
void Awake() { instance = this; if (gameCenter != null) { GameCenter game = gameCenter.GetComponent <GameCenter>(); if (game != null) { isDebug = game.isDevelopmentPattern; } } }
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); }
private void ExitFromGame() { if (_gameLogic == null) { GameCenter.OutTheGame(this); } else { _gameLogic.EarlyGameOver(this); _gameLogic = null; _gameService.UpdateStatistic(Id, 1, 2); } }
void Awake() { if (instanceRef == null) { instanceRef = this; DontDestroyOnLoad(this); InicializarControladoras(); } else { Destroy(this.gameObject); } controladoraGUI.Awake (); controladoraSonidos.Awake (); }