internal static bool CheckSign(PlayerCheck playerCheck) { var roomUrl = roomUrls[playerCheck.RoomIndex]; var check = CommonClass.Random.GetMD5HashFromStr(playerCheck.Key + roomUrl + CheckParameter); return(playerCheck.Check == check); }
public virtual void OnTriggerExit(Collider other) { interacter = other.gameObject.transform.root.gameObject; if (PlayerCheck.Check(interacter)) { UIManager.HideElements(); } }
private void Awake() { //找到GUI面板 this.command = transform.Find("ControlCanvas").GetComponent <InputCommand>(); //绑定组件上的Player脚本 this.player = transform.GetComponent <Player>(); //绑定组件上的Check脚本 this.playerCheck = transform.GetComponent <PlayerCheck>(); //将刚体组件取出来方便操作 rb = player.GetComponent <Rigidbody2D>(); //动画器绑定 anim = GetComponent <Animator>(); }
public virtual void OnTriggerEnter(Collider other) { IconSetup(); interacter = other.gameObject.transform.root.gameObject; if (PlayerCheck.Check(interacter)) { if (numOfOptions == 1) { SetUpOneOption(); } if (numOfOptions == 2) { SetupTwoOption(); } } }
internal string UpdatePlayer(PlayerCheck checkItem) { // try { bool success; lock (this.PlayerLock) { if (this._Players.ContainsKey(checkItem.Key)) { BaseInfomation.rm._Players[checkItem.Key].FromUrl = checkItem.FromUrl; BaseInfomation.rm._Players[checkItem.Key].WebSocketID = checkItem.WebSocketID; //BaseInfomation.rm._Players[checkItem.Key].others = new Dictionary<string, OtherPlayers>(); BaseInfomation.rm._Players[checkItem.Key].initializeOthers(); //this.sendPrometeState(checkItem.FromUrl, checkItem.WebSocketID); success = true; BaseInfomation.rm._Players[checkItem.Key].PromoteState = new Dictionary <string, int>() { { "mile", -1 }, { "business", -1 }, { "volume", -1 }, { "speed", -1 } }; BaseInfomation.rm._Players[checkItem.Key].Collect = -1; BaseInfomation.rm._Players[checkItem.Key].OpenMore++; BaseInfomation.rm._Players[checkItem.Key].clearUsedRoad(); } else { success = false; } } if (success) { return("ok"); } else { return("ng"); } } //catch //{ // return "ng"; //} }
internal string UpdatePlayer(PlayerCheck checkItem) { // try { bool success; lock (this.PlayerLock) { if (this._Players.ContainsKey(checkItem.Key)) { if (this._Players[checkItem.Key].playerType == RoleInGame.PlayerType.player) { var player = (Player)this._Players[checkItem.Key]; player.FromUrl = checkItem.FromUrl; player.WebSocketID = checkItem.WebSocketID; //BaseInfomation.rm._Players[checkItem.Key].others = new Dictionary<string, OtherPlayers>(); Program.rm._Players[checkItem.Key].initializeOthers(); //this.sendPrometeState(checkItem.FromUrl, checkItem.WebSocketID); success = true; player.PromoteState = new Dictionary <string, int>() { { "mile", -1 }, { "business", -1 }, { "volume", -1 }, { "speed", -1 } }; Program.rm._Players[checkItem.Key].CollectPosition = new Dictionary <int, int>() { { 0, -1 }, { 1, -1 }, { 2, -1 }, { 3, -1 }, { 4, -1 }, { 5, -1 }, { 6, -1 }, { 7, -1 }, { 8, -1 }, { 9, -1 }, { 10, -1 }, { 11, -1 }, { 12, -1 }, { 13, -1 }, { 14, -1 }, { 15, -1 }, { 16, -1 }, { 17, -1 }, { 18, -1 }, { 19, -1 }, { 20, -1 }, { 21, -1 }, { 22, -1 }, { 23, -1 }, { 24, -1 }, { 25, -1 }, { 26, -1 }, { 27, -1 }, { 28, -1 }, { 29, -1 }, { 30, -1 }, { 31, -1 }, { 32, -1 }, { 33, -1 }, { 34, -1 }, { 35, -1 }, { 36, -1 }, { 37, -1 } }; ((Player)Program.rm._Players[checkItem.Key]).OpenMore++; Program.rm._Players[checkItem.Key].clearUsedRoad(); Program.rm._Players[checkItem.Key] = player; } else { success = false; } } else { success = false; } } if (success) { return("ok"); } else { return("ng"); } } //catch //{ // return "ng"; //} }
public async Task <bool> PlayerCheck(string playlist, string userName, string token) { bool nothing = false; PlayerCheck playerCheck = new PlayerCheck(); HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); string url = "https://api.spotify.com/v1/me/player"; client.BaseAddress = new Uri(url); string urlParameters = ""; HttpResponseMessage response = client.GetAsync(urlParameters).Result; if (response.IsSuccessStatusCode) { var result = response.Content.ReadAsStringAsync().Result; string replacement = System.Text.RegularExpressions.Regex.Replace(result, @"\t|\n|\r", ""); JObject s = JObject.Parse(replacement); playerCheck = JsonConvert.DeserializeObject <PlayerCheck>(replacement); if (!playerCheck.is_playing) { // need device id string locationId = ""; using (RelayDJDevEntities db = new RelayDJDevEntities()) { string userId = User.Identity.GetUserId(); locationId = db.RelayOrders.Where(x => x.UserId == userId).SingleOrDefault().LocationId; } Location pulled = new Location(); using (RelayDJDevEntities db = new RelayDJDevEntities()) { pulled = db.Locations.Where(x => x.LocationId == locationId).FirstOrDefault(); } string locationdevicePull = pulled.LocationId + ":device"; string deviceId = (string)HttpContext.Cache[locationdevicePull]; // we need to get the play list content string thing = "{\"context_uri\":\"spotify:user:"******":playlist:" + playlist + "\",\"position_ms\":0}"; string urlpc = "https://api.spotify.com/v1/me/player/play" + "?device_id=" + deviceId; HttpClient clientpc = new HttpClient(); clientpc.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); clientpc.BaseAddress = new Uri(urlpc); var httpContent = new StringContent(thing, Encoding.UTF8, "application/json"); HttpResponseMessage responsepc = await clientpc.PutAsync(clientpc.BaseAddress.ToString(), httpContent); if (responsepc.IsSuccessStatusCode) { //play back has started. } } } return(nothing); }