private static void Main(string[] args) { var Port = 50051; Server server = new Server { Services = { PlayerSearch.BindService(new PlayerSearchServiceImpl()), //BuiltHelloDemoSrv.BindService(new HelloworldImpl()).Intercept( // new ServerCallContextInterceptor(ctx => // { // Console.WriteLine(ctx); // } // ) //), }, Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }, }; var s = PlayerSearch.Descriptor.FullName; var dsfs = PlayerSearchReflection.Descriptor; server.Start(); Console.WriteLine("PlayerSearch server listening on port " + Port); Console.WriteLine("Press any key to stop the server..."); Console.ReadKey(); server.ShutdownAsync().Wait(); Console.ReadLine(); }
/// <summary> /// Converts the specified object ID value into a managed player object. /// </summary> /// <param name="objectId">The object ID to convert.</param> /// <param name="playerSearch">Methods to use to resolve the player.</param> /// <returns>The associated player for this object, otherwise null.</returns> public static unsafe NwPlayer?ToNwPlayer(this uint objectId, PlayerSearch playerSearch = PlayerSearch.All) { if (objectId == NwObject.Invalid) { return(null); } CNWSPlayer?player = null; if (playerSearch.HasFlag(PlayerSearch.Controlled)) { player = LowLevel.ServerExoApp.GetClientObjectByObjectId(objectId); } if ((player == null || player.Pointer == IntPtr.Zero) && playerSearch.HasFlag(PlayerSearch.Login)) { CExoLinkedListInternal players = LowLevel.ServerExoApp.m_pcExoAppInternal.m_pNWSPlayerList.m_pcExoLinkedListInternal; for (CExoLinkedListNode node = players.pHead; node != null; node = node.pNext) { CNWSPlayer current = CNWSPlayer.FromPointer(node.pObject); if (current.m_oidPCObject == objectId) { player = current; break; } } } return(player != null && player.Pointer != IntPtr.Zero ? new NwPlayer(player) : null); }
public ActionResult <IEnumerable <PlayerDto> > Get([FromQuery] PlayerSearch playerSearch) { try { var players = _getPlayersCommand.Execute(playerSearch); return(Ok(players)); } catch (Exception e) { return(StatusCode(500, e.Message)); } }
public static PlayerSearch SearchPlayer(string PlayerNickname) { try { Setup(); } catch (Exception) { } string path = $"account/list/?application_id={APP_ID}&search={PlayerNickname}"; string responseString = ""; var response = Client.GetAsync(path).Result; if (response.IsSuccessStatusCode) { var responseContent = response.Content; responseString = responseContent.ReadAsStringAsync().Result; } PlayerSearch result = JsonConvert.DeserializeObject <PlayerSearch>(responseString); return(result); }
private bool UpdateUserPlayerIDAsync() { if (Program.Settings.UserID == 0 && !Program.Settings.Nickname.Equals("") && !Program.Settings.Server.Equals("")) { PlayerSearch PlayerImporter = WGAPI.SearchPlayer(Program.Settings.Nickname); if (PlayerImporter.Status.ToLower() == "ok") { Program.Settings.UserID = PlayerImporter.Player[0].ID; return(true); } else { MessageBox.Show("Unable to find a player with that nickname: " + Program.Settings.Nickname, "Error on Get User Info"); return(false); } } else { return(true); } }
public IEnumerable <PlayerDto> Execute(PlayerSearch request) { var query = Context.Players.AsQueryable(); if (request.PositionId != 0) { query = query.Where(p => p.PositionId == request.PositionId); } if (request.LastName != null) { query = query.Where(p => p.LastName.ToLower().Contains(request.LastName.ToLower())); } if (request.FirstName != null) { query = query.Where(p => p.FirstName.ToLower().Contains(request.FirstName.ToLower())); } if (request.Email != null) { query = query.Where(p => p.Email.ToLower().Contains(request.Email.ToLower())); } if (request.ClubId != 0) { query = query.Where(p => p.ClubId == request.ClubId); } if (request.CityId != 0) { query = query.Where(p => p.CityId == request.CityId); } return(query.Where(p => p.IsDeleted == false).Select(p => new PlayerDto { CityId = p.CityId, ClubId = p.ClubId, Email = p.Email, FirstName = p.FirstName, Id = p.Id, Image = p.Image, LastName = p.LastName, PositionId = p.PositionId })); }
protected void BindPlayerList() { //standard lookup try { PlayerController sysmgr = new PlayerController(); List <Player> info = null; info = sysmgr.Player_List(); info.Sort((x, y) => x.LastName.CompareTo(y.LastName)); PlayerSearch.DataSource = info; PlayerSearch.DataTextField = nameof(Player.PlayerName); PlayerSearch.DataValueField = nameof(Player.PlayerID); PlayerSearch.DataBind(); PlayerSearch.Items.Insert(0, "select..."); } catch (Exception ex) { //using the specialized error handling DataList control errormsgs.Add(GetInnerException(ex).ToString()); LoadMessageDisplay(errormsgs, "alert alert-danger"); } }
// STATUS [ July 15, 2019 ] : this works /// <summary> /// View instantiated PlayerSearch object /// </summary> /// <param name="playerLastName">todo: describe playerLastName parameter on ViewPlayerSearchModel</param> /// <remarks> /// See: https://appac.github.io/mlb-data-api-docs/#player-data-player-search-get /// </remarks> /// <returns> /// Instantiated PlayerSearch /// </returns> public List <PlayerSearch> ViewPlayerSearchModel(string playerLastName) { IRestResponse response = GetPlayerSearchModelPostmanResponse(playerLastName); JObject playerJObject = _apiInfrastructure.CreateModelJObject(response); JToken playerJToken = _apiInfrastructure.CreateModelJToken(playerJObject, "PlayerSearch"); int jTokenChildrenCount = playerJToken.Count <object>(); List <PlayerSearch> listOfPlayers = new List <PlayerSearch>(); PlayerSearch newPlayerSearchInstance = new PlayerSearch(); for (var counter = 0; counter < jTokenChildrenCount; counter++) { PlayerSearch playerSearchInstance = _apiInfrastructure.CreateInstanceOfModel ( playerJToken[counter], newPlayerSearchInstance, "PlayerSearch" ) as PlayerSearch; listOfPlayers.Add(playerSearchInstance); } return(listOfPlayers); }
// Update is called once per frame void Update() { switch (lifttype) { case LiftType.OneWay: ///一方通行のリフト ///現在自動的にスタートする状態 if (LiftTime < LiftRange / System.Math.Abs(LiftSpeed)) { LiftTime += Time.deltaTime; if (YLift) { rigidbody2D.velocity = new Vector2(0, LiftSpeed); } else if (XLift) { rigidbody2D.velocity = new Vector2(LiftSpeed, 0); } } else { rigidbody2D.velocity = new Vector2(0, 0); } break; case LiftType.Loop: ///ループするリフト if (LiftTime < LiftRange / System.Math.Abs(LiftSpeed)) { h += Time.deltaTime; if (h > stayTime) { LiftTime += Time.deltaTime; if (YLift) { rigidbody2D.velocity = new Vector2(0, LiftSpeed); } else if (XLift) { rigidbody2D.velocity = new Vector2(LiftSpeed, 0); } } else { rigidbody2D.velocity = new Vector2(0, 0); } } else if (LiftTime < (LiftRange * 2) / System.Math.Abs(LiftSpeed)) //折り返し { i += Time.deltaTime; if (i > stayTime) { LiftTime += Time.deltaTime; if (YLift) { rigidbody2D.velocity = new Vector2(0, LiftSpeed * (-1)); } else if (XLift) { rigidbody2D.velocity = new Vector2(LiftSpeed * (-1), 0); } } else { rigidbody2D.velocity = new Vector2(0, 0); } } else { rigidbody2D.transform.position = new Vector2(end_x, end_y); rigidbody2D.velocity = new Vector2(0, 0); LiftTime = 0; i = 0; h = 0; } break; case LiftType.Switch: //スイッチ式のリフト //現在はループと同じ if (LiftFlag == true) //リフトがオンでなければ動作しない { if (LiftTime < LiftRange / System.Math.Abs(LiftSpeed)) { h += Time.deltaTime; if (h > stayTime) { LiftTime += Time.deltaTime; if (YLift) { rigidbody2D.velocity = new Vector2(0, LiftSpeed); } else if (XLift) { rigidbody2D.velocity = new Vector2(LiftSpeed, 0); } } else { rigidbody2D.velocity = new Vector2(0, 0); } } else if (LiftTime < (LiftRange * 2) / System.Math.Abs(LiftSpeed)) //折り返し { i += Time.deltaTime; if (i > stayTime) { LiftTime += Time.deltaTime; if (YLift) { rigidbody2D.velocity = new Vector2(0, LiftSpeed * (-1)); } else if (XLift) { rigidbody2D.velocity = new Vector2(LiftSpeed * (-1), 0); } } else { rigidbody2D.velocity = new Vector2(0, 0); } } else { rigidbody2D.transform.position = new Vector2(end_x, end_y); rigidbody2D.velocity = new Vector2(0, 0); LiftTime = 0; h = 0; i = 0; } } else { rigidbody2D.velocity = new Vector2(0, 0); } break; case LiftType.Pressure: player = GameObject.Find("player"); PlayerControler PC = player.GetComponent <PlayerControler>(); PlayerSearch PS = player.GetComponentInChildren <PlayerSearch>(); if (LiftFlag == true) //リフトがオンでなければ動作しない { if (plessured == true && PC.isLifted == true) { plessureEvent = true; } if (plessureEvent == true) { if (LiftTime < LiftRange / System.Math.Abs(LiftSpeed)) { LiftTime += Time.deltaTime; if (YLift) { rigidbody2D.velocity = new Vector2(0, LiftSpeed); } else if (XLift) { rigidbody2D.velocity = new Vector2(LiftSpeed, 0); } } else if (LiftTime < (LiftRange * 2) / System.Math.Abs(LiftSpeed)) //折り返し { if (PS.plessureFlag == false) { LiftTime += Time.deltaTime; if (YLift) { rigidbody2D.velocity = new Vector2(0, LiftSpeed * (-1)); } else if (XLift) { rigidbody2D.velocity = new Vector2(LiftSpeed * (-1), 0); } } else { rigidbody2D.velocity = new Vector2(0, 0); } } else { rigidbody2D.transform.position = new Vector2(end_x, end_y); rigidbody2D.velocity = new Vector2(0, 0); LiftTime = 0; plessureEvent = false; } } else { rigidbody2D.velocity = new Vector2(0, 0); } } break; } }