public override void ShowGUI(List <ActionParameter> parameters) { if (AdvGame.GetReferences().settingsManager != null) { SettingsManager settingsManager = AdvGame.GetReferences().settingsManager; if (GUILayout.Button("Music Storage window")) { MusicStorageWindow.Init(); } if (settingsManager.musicStorages.Count == 0) { EditorGUILayout.HelpBox("Before a track can be selected, it must be added to the Music Storage window.", MessageType.Info); return; } musicAction = (MusicAction)EditorGUILayout.EnumPopup("Method:", (MusicAction)musicAction); string fadeLabel = "Transition time (s):"; if (musicAction == MusicAction.Play || musicAction == MusicAction.Crossfade) { GetTrackIndex(settingsManager.musicStorages.ToArray(), parameters); loop = EditorGUILayout.Toggle("Loop?", loop); isQueued = EditorGUILayout.Toggle("Queue?", isQueued); resumeIfPlayedBefore = EditorGUILayout.Toggle("Resume if played before?", resumeIfPlayedBefore); } else if (musicAction == MusicAction.Stop) { fadeLabel = "Fade-out time (s):"; } else if (musicAction == MusicAction.ResumeLastStopped) { resumeFromStart = EditorGUILayout.Toggle("Restart track?", resumeFromStart); } if (CanWaitComplete()) { willWaitComplete = EditorGUILayout.Toggle("Wait until track completes?", willWaitComplete); } fadeTimeParameterID = Action.ChooseParameterGUI(fadeLabel, parameters, fadeTimeParameterID, ParameterType.Float); if (fadeTimeParameterID < 0) { fadeTime = EditorGUILayout.Slider(fadeLabel, fadeTime, 0f, 10f); } if ((musicAction == MusicAction.Play || musicAction == MusicAction.Crossfade) && loop) { loopingOverlapTime = EditorGUILayout.Slider("Loop overlap time (s):", loopingOverlapTime, 0f, 10f); } if (!CanWaitComplete() || !willWaitComplete) { if (fadeTime > 0f && !isQueued) { willWait = EditorGUILayout.Toggle("Wait until transition ends?", willWait); } } } else { EditorGUILayout.HelpBox("A Settings Manager must be defined for this Action to function correctly. Please go to your Game Window and assign one.", MessageType.Warning); } AfterRunningOption(); }
public PlayMusicCommand(MusicAction _Music) { Music = _Music; }
private void moveBegin(Musician musician, MusicAction musicAction, BandMemberUI bandMemberUI) { musician.CurrentAction = musicAction; bandMemberUI.UpdateAction(); }
public async Task <IActionResult> CreateUser([FromBody] UserViewModel model) { if (await _context.Users.AnyAsync(s => s.Email == model.Email && s.IdReference == model.IdReference)) { var userExist = await _context.Users.Where(x => x.Email == model.Email).FirstOrDefaultAsync(); var client = new RestClient("https://www.googleapis.com"); var tokenRequest = new RestRequest("oauth2/v4/token", Method.POST); // tokenRequest.AddHeader("Host", "www.googleapis.com"); tokenRequest.AddHeader("Content-Type", "application/x-www-form-urlencoded"); tokenRequest.AddParameter("code", model.Refreshtoken); tokenRequest.AddParameter("client_id", GoogleOauthUtility.ClientId); tokenRequest.AddParameter("client_secret", GoogleOauthUtility.ClientSecret); tokenRequest.AddParameter("redirect_uri", "urn:ietf:wg:oauth:2.0:oob"); tokenRequest.AddParameter("grant_type", "authorization_code"); var response = client.Execute <AuthCodeResponse>(tokenRequest); userExist.Refreshtoken = response.Data.refresh_token; userExist.Accesstoken = response.Data.access_token; userExist.Token_type = response.Data.token_type; userExist.Expires_in = response.Data.expires_in; userExist.MirrorId = model.MirrorId; userExist.RoomNumber = model.RoomNumber; await _context.SaveChangesAsync(); return(Ok(userExist)); } else { var client = new RestClient("https://www.googleapis.com"); var tokenRequest = new RestRequest("oauth2/v4/token", Method.POST); // tokenRequest.AddHeader("Host", "www.googleapis.com"); tokenRequest.AddHeader("Content-Type", "application/x-www-form-urlencoded"); tokenRequest.AddParameter("code", model.Refreshtoken); tokenRequest.AddParameter("client_id", GoogleOauthUtility.ClientId); tokenRequest.AddParameter("client_secret", GoogleOauthUtility.ClientSecret); tokenRequest.AddParameter("redirect_uri", "urn:ietf:wg:oauth:2.0:oob"); tokenRequest.AddParameter("grant_type", "authorization_code"); var response = client.Execute <AuthCodeResponse>(tokenRequest); try { var user = new User() { Email = model.Email, Refreshtoken = response.Data.refresh_token, Expires_in = response.Data.expires_in, Accesstoken = response.Data.access_token, IdReference = model.IdReference, MirrorId = model.MirrorId, RoomNumber = model.RoomNumber }; await _context.Users.AddAsync(user); await _context.SaveChangesAsync(); var booleanTable = new BooleanTable() { Order = false, Status = true, Diary = true, Email = false, Sesion = true, Music = false, HotelService = false, StartNews = false, StartEmail = false, UserId = user.Id }; await _context.BooleanTables.AddAsync(booleanTable); await _context.SaveChangesAsync(); var lstGadgets = await _context.Gadgets.ToListAsync(); foreach (var item in lstGadgets) { var userGadget = new UserGadgets() { GadgetId = item.Id, UserId = user.Id, Order = item.StaticNumber, IsActive = true }; await _context.UserGadgets.AddAsync(userGadget); } var musicAction = new MusicAction() { UserId = user.Id, Action = "", MirrorId = model.MirrorId, MusicBool = false }; await _context.MusicActions.AddAsync(musicAction); await _context.SaveChangesAsync(); return(Ok(user)); } catch (Exception e) { throw e; } } }