private void Save() { string gun = id.ToString() + "_gun"; string car = id.ToString() + "_car"; string name = id.ToString() + "_name"; PlayerPrefs.SetInt(gun, gunIndex); PlayerPrefs.SetInt(car, carIndex); PlayerPrefs.SetString(name, displayName); }
private void Reconnect() { if (State != WebsocketState.Disconnected) { Debug.Log("cant reconnect - not disconnected"); } var retryCounter = 0; do { retryCounter++; try { base.connect(_serverAddress); var cmd = new Command("ID", PlayerId.ToString()); sendCommand(cmd); State = WebsocketState.GameStarted; return; } catch (System.Exception ex) { Debug.Log("Reconnect Error: " + ex + "\nretry nr " + retryCounter); } } while (retryCounter <= 3); State = WebsocketState.Failed; }
public void Init() { string g = id.ToString() + "_gun"; string c = id.ToString() + "_car"; string name = id.ToString() + "_name"; int gunIndex = PlayerPrefs.GetInt(g); int carIndex = PlayerPrefs.GetInt(c); string displayName = PlayerPrefs.GetString(name); car = cars.carChoices[carIndex]; gun = guns.gunChoices[gunIndex]; carView.sprite = car.image; gunView.sprite = gun.image; fowardSpeed = car.speed; }
public async Task GivenPlayerExists(Table table) { var player = table.CreateInstance <TestPlayerDto>(); _existingPlayerId = player.PlayerId; _testFixture.MockNextRandomId(_existingPlayerId.ToString()); await _testFixture.MockPlayerExists(player); }
public void GivenIHaveCreatePlayerRequest(Table table) { _request = GetPlayer(table); var playerId = new PlayerId("player1"); _testFixture.MockNextRandomId(playerId.ToString()); _expectedPlayer = new Player(_testFixture.CurrentTenant, new Version("<some-version>"), playerId, _request.FirstName, _request.LastName); }
public virtual void WriteXml(XmlWriter writer) { writer.WriteAttributeString("id", Id.ToString()); writer.WriteAttributeString("type", Type.GetXmlAttributeName()); writer.WriteAttributeString("timestamp", Timestamp.ToString("s")); if (PlayerId.HasValue) { writer.WriteAttributeString("playerId", PlayerId.ToString()); } }
public void UpdateScore(PlayerId playerID, float score) { var id = (int)playerID - 1; if (id < 0 || id >= scoreText.Length) { return; } scoreText[id].text = playerID.ToString() + ": " + score; }
public override void WriteXml(XmlWriter writer) { base.WriteXml(writer); writer.WriteAttributeString("timestamp", Timestamp.ToString("s")); if (PlayerId.HasValue) { writer.WriteAttributeString("playerId", PlayerId.ToString()); } }
public async Task GivenPlayerExists(Table table) { var player = _transform.GetInstance <TestPlayerDto>(table); _existingPlayerId = player.Id; _testFixture.MockNextRandomId(_existingPlayerId.ToString()); _originalPlayer = player; var created = await _testFixture.MockPlayerExists(player); // We need that because in integration tests Version might be created by the storage, thus it will be different from originally set _originalPlayer.Version = created.Version; }
/// <summary> /// Queues an action targeted at a WorldEntity by moving along the given move path. /// <para>Will attempt to perform the action at the end of the move path.</para> /// </summary> /// <param name="entityId">The id of the WorldEntity to perform the action on.</param> /// <param name="ownerId">The id of the owner of the WorldEntity to perform the action on.</param> /// <param name="action">The name of the action to perform. Import PlayerActionConstants for the complete /// list of actions.</param> /// <param name="movePath">The path of Coordinates to follow to the target destination.</param> public void QueueAction(int entityId, string ownerId, string action, IEnumerable <Coordinate> movePath) { SetMovePath(movePath); // Action is targeting self, is invalid if (entityId == Entity.Id || PlayerId.ToString() == ownerId) { return; } _targetEntityId = entityId; _targetOwnerId = ownerId; _actionName = action; }
public static void AddBannedPlayer(PlayerId playerId, string playerName, int banDueTime) { if (BannedPlayerManagerCustomGameServer._bannedPlayers.ContainsKey(playerId)) { lock (BannedPlayerManagerCustomGameServer._bannedPlayersWriteLock) { StreamWriter streamWriter = new StreamWriter("bannedUsers.txt", true); streamWriter.WriteLine(playerId.ToString() + "\t" + playerName); streamWriter.Close(); } } BannedPlayerManagerCustomGameServer._bannedPlayers[playerId] = new BannedPlayerManagerCustomGameServer.BannedPlayer() { PlayerId = playerId, BanDueTime = banDueTime, PlayerName = playerName }; }
//returns the playerid username first_name last_name public override string ToString() { return(PlayerId.ToString().PadRight(6) + Username.PadRight(30) + FirstName.PadRight(30) + LastName.PadRight(30)); }
public PlayerEntity(TenantId tenant, PlayerId id) { PartitionKey = tenant.ToString(); RowKey = id.ToString(); }
public void SetVotedNum(PlayerId playerId, int votedNum) { var player = playerArray.First(p => p.IdText.text == playerId.ToString()); player.SetVotedNum(votedNum); }
public void WhenITryToSendPOSTRequestToPlayerControllerEndPoint() { ServiceLayerMockingHelper.MockPlayerCommandsForHttpStatus201(Container); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromPasswordChanged] = await MemberApiProxy.ChangePasswordAsync(new ChangePasswordRequest() { OldPassword = LoggedInPlayerMetadata.Password, NewPassword = TestDataGenerator.GetRandomString(), Username = LoggedInPlayerMetadata.Username })); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromPersonalInfoChanged] = await MemberApiProxy.ChangePersonalInfoAsync(new ChangePersonalInfoRequest() { PlayerId = PlayerId, FirstName = TestDataGenerator.GetRandomString(), LastName = TestDataGenerator.GetRandomString(), Email = TestDataGenerator.GetRandomEmail(), CurrencyCode = "CAD", DateOfBirth = DateTime.UtcNow.AddYears(-30).ToString("yyyy/MM/dd"), Gender = "Male", Title = "Mr", CountryCode = TestDataGenerator.GetRandomCountryCode(), MailingAddressCity = TestDataGenerator.GetRandomString(), MailingAddressLine1 = TestDataGenerator.GetRandomString(), MailingAddressPostalCode = TestDataGenerator.GetRandomNumber(1000).ToString(), PhoneNumber = TestDataGenerator.GetRandomPhoneNumber(), AccountAlertEmail = false, AccountAlertSms = true, MarketingAlertEmail = true, MarketingAlertPhone = false, MarketingAlertSms = false })); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromContactInfoChanged] = await MemberApiProxy.ChangeContactInfoAsync(new ChangeContactInfoRequest() { PlayerId = PlayerId, MailingAddressCity = TestDataGenerator.GetRandomString(), PhoneNumber = TestDataGenerator.GetRandomPhoneNumber(false), CountryCode = LoggedInPlayerMetadata.Country, MailingAddressLine1 = TestDataGenerator.GetRandomString(), MailingAddressPostalCode = TestDataGenerator.GetRandomNumber(1000).ToString() })); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromSelfExclusion] = await MemberApiProxy.SelfExclude(new SelfExclusionRequest() { Option = (int)PlayerEnums.SelfExclusion._1Year, PlayerId = PlayerId })); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromTimeOut] = await MemberApiProxy.TimeOut(new TimeOutRequest() { PlayerId = PlayerId, Option = (int)PlayerEnums.TimeOut.Month })); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromChangedSecurityQuestion] = await MemberApiProxy.ChangeSecurityQuestionAsync(new ChangeSecurityQuestionRequest() { Id = PlayerId.ToString(), SecurityAnswer = TestDataGenerator.GetRandomString(), SecurityQuestionId = LoggedInPlayerMetadata.SecurityQuestion })); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromMobilePhoneVerification] = await MemberApiProxy.VerificationCodeAsync(new VerificationCodeRequest())); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromMobilePhoneVerified] = await MemberApiProxy.VerifyMobileAsync(new VerifyMobileRequest())); }
public void SetVote(PlayerId from, PlayerId to) { var player = playerArray.First(p => p.IdText.text == from.ToString()); player.SetVoteTo(); }
public ImageIdentifier(PlayerId playerId) { this.ImageTypeCode = ImageIdentifierType.MultiplayerAvatar; this.Id = playerId.ToString(); this.AdditionalArgs = ""; }
// Update is called once per frame void Update() { // 右ボタンが押された場合、カーソルを右に動かす。 // 選択肢の端を超えた場合、反対側へカーソルを移動させる if (Input.GetButtonDown(playerId.ToString() + " Right")) { currentSelected++; if (currentPhase == Phase.Phase1 && currentSelected > maxSelectPhase1 - 1) { currentSelected = 0; } else if (currentPhase == Phase.Phase2 && currentSelected > maxSelectPhase2 - 1) { currentSelected = 0; } MoveCursorObjectToSelectedObject(); } else if (Input.GetButtonDown(playerId.ToString() + " Left")) { select.transform.position -= new Vector3(0.6f, 0, 0); currentSelected--; if (currentPhase == Phase.Phase1 && currentSelected < 0) { currentSelected = maxSelectPhase1 - 1; } else if (currentPhase == Phase.Phase2 && currentSelected < 0) { currentSelected = maxSelectPhase2 - 1; } MoveCursorObjectToSelectedObject(); } // 決定ボタンが押された場合、次のフェーズへ進める。 if (Input.GetButtonDown(playerId.ToString() + " Dicision")) { if (currentPhase == Phase.Phase1) { currentPhase++; SetLocalPositionToPoolPositionByName("Phase1 select"); switch (currentSelected) { case 0: SetLocalPositionToZeroByName("Phase2 Act select"); selectedAction += 16; break; case 1: SetLocalPositionToZeroByName("Phase2 Appeal select"); selectedAction += 32; break; case 2: SetLocalPositionToZeroByName("Phase2 Jummer select"); selectedAction += 64; break; default: break; } // 子オブジェクト中からローカルポジションが親オブジェクトの原点のものを取得し、選択肢の数を取得する Transform o = this.GetComponentsInChildren <Transform>() .Where(obj => obj.transform.localPosition == Vector3.zero && obj.transform != this.transform) .First(); maxSelectPhase2 = o.transform.GetComponentsInChildren <Transform>() .Where(obj => obj.transform != o.transform && obj.name.Contains("Select")) .ToArray() .Length; manager.SendMessage("PlayDrawSound"); // カーソルを選択中の選択肢の上に配置する MoveCursorObjectToSelectedObject(); } else if (currentPhase == Phase.Phase2) { InstantiateWaitText(); } } if (Input.GetButtonDown(playerId.ToString() + " Cancel")) { if (currentPhase == Phase.Phase2) { manager.SendMessage("PlayDrawSound"); currentPhase = Phase.Phase1; currentSelected = 0; string currentPhaseObjName = GetComponentsInChildren <Transform>() .Where(obj => obj.transform.localPosition == Vector3.zero) .First() .name; SetLocalPositionToPoolPositionByName(currentPhaseObjName); SetLocalPositionToZeroByName("Phase1 select"); MoveCursorObjectToSelectedObject(); } } }
public override string ToString() { return(PlayerId.ToString() + " " + GamerTag + " " + FirstName + " " + SecondName + " " + XP.ToString()); }
public string TopPlayers() { return(PlayerId.ToString().PadRight(16) + Username.PadRight(25) + Score); }
public Task SendGameUpdatesAsync(PlayerId playerId, IEnumerable <GameUpdated> updates) { return(SendUpdatesToGroupAsync(playerId.ToString(), updates)); }
public EitherAsync <Error, Player> Get(TenantId tenant, PlayerId id) { return(PerformStorageOperation(_options.PlayersTable, tableRef => { var getOperation = TableOperation.Retrieve <PlayerEntity>(tenant.ToString(), id.ToString()); EitherAsync <Error, TableResult> getResult = tableRef.ExecuteAsync(getOperation); return getResult.Match <Either <Error, Player> >( tableResult => tableResult.Result switch { PlayerEntity playerEntity => _playerFactory.Create( _mapper.Map <PlayerEntity, PlayerFactoryDto>(playerEntity)), _ => Error.NotFound() },
public override string ToString() { return("(" + PlayerId.ToString() + ") " + PlayerName + " (" + (int)AiType + " - " + AiConfigStr + ")"); }