public virtual IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { // model-level validation if (SongName == "blah" && AlbumName == "meh") { yield return(new ValidationResult("Combined song name and album name cannot be blah and meh")); yield return(new ValidationResult("*", new[] { "SongName", "AlbumName" })); } else { // model-level validation if (SongName[0] != AlbumName[0]) { yield return(new ValidationResult("Song name and album name must start with same letter")); yield return(new ValidationResult("*", new[] { "AlbumName", "SongName" })); } // inline style if (!SongName.ToUpper().Contains("LOVE")) { yield return(new ValidationResult("Song name must have a word love", new[] { "SongName" })); } // property, but asterisk style if (!AlbumName.ToUpper().Contains("GREAT")) { yield return(new ValidationResult("Album name must have a word great")); yield return(new ValidationResult("*", new[] { "AlbumName" })); } } }
private async void PeriodicInfoDownload(object sender, object e) { var httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0"); httpClient.DefaultRequestHeaders.Add("accept-encoding", "gzip, deflate"); try { var response = await httpClient.GetAsync(StreamInfo.InfoUrl); if (response.IsSuccessStatusCode) { var nowPlaying = ExtractSongName(response.Content.ReadAsStringAsync().Result); SongName = nowPlaying; var elements = SongName.Split('-'); if (elements.Length == 3) { Artist = elements[0].Trim(); Album = elements[1].Trim(); Song = elements[2].Trim(); } else if (elements.Length == 2) { Artist = elements[0].Trim(); Album = string.Empty; Song = elements[1].Trim(); } UpdateLiveTile(); } } catch (Exception) { } }
public void AddSong(string Name) { BaseSong NewSong = MediaPlayer.Instance.NewSong(); int Index = Name.IndexOf("^"); String SongName, AristName; if (Index > 0) { SongName = Name.Substring(0, Index); AristName = Name.Substring(Index + 1, Name.Length - Index - 1); } else { SongName = Name; AristName = "Unknown artist"; } SongName = SongName.Replace('$', '\''); NewSong.FileName = Name; NewSong.Name = Name; NewSong.SongName = SongName; NewSong.ArtistName = AristName; NewSong.AlwaysLoaded = false; NewSong.LoadSong_IfNotLoaded(NewSong.FileName); SongList.Add(NewSong); }
decimal TimeLeftOnSong(BardComponent brdComp, SongName song, decimal timer) { if (brdComp.Song == song) { return(Math.Max(0, brdComp.SongDuration - (timer - brdComp.SongStart))); } return(0); }
void ResetCount(SongName sName) { count = 0; foreach (GameObject text in textToTurnOff) { text.SetActive(true); } }
void StartCycling(SongName songName) { Debug.Log("Starting the cycle."); StartCoroutine(CycleXTile()); StartCoroutine(CycleYTile()); StartCoroutine(CycleXOffset()); StartCoroutine(CycleYOffset()); }
public void StartASong(SongName whichSongName) { StartSongEvent?.Invoke(whichSongName); PlaybackSpeedChangeEvent(currentPlaybackSpeed); DavisDnBSongStart.Post(gameObject, (uint)AkCallbackType.AK_MusicSyncBar, EveryMeasure); Debug.Log("Started Wizard Song!"); songPlaying = true; chargeLevel = 0f; }
public override object Default(string name = null) { if (_kouContext.Set <PluginArcaeaSong>().IsNullOrEmptySet()) { return("曲库为空"); //BUG 更新后无法进行判断是否为空 } if (SystemExpand.All(string.IsNullOrWhiteSpace, name, ChartConstant, SongName, SongArtist, ChartDesigner, RatingClass, Rating, NotesCount, JacketDesigner, SongLength, SongBPM)) { return("嗯?"); } if (SongName.IsNullOrWhiteSpace()) { SongName = name; } List <PluginArcaeaSong> satisfiedSongs = GetSatisfiedSong(); if (satisfiedSongs.IsNullOrEmptySet()) { return("找不到符合条件的歌曲"); } return(satisfiedSongs.ToAutoPageSetString()); //else if (satisfiedSongs.Count == 1) //{ // return satisfiedSongs.First().ToString(FormatType.Detail); //} //else //{ // if (Count == -1) Count = 10; // Count = Count.LimitInRange(1, 20); // string result = ""; // if (All) // { // Count = Count.LimitInRange(7); // for (int i = 0; i < Count && i < satisfiedSongs.Count; i++) // { // result += $"-------{AutoFormatSong(satisfiedSongs[i])}\n"; // } // } // else // { // for (int i = 0; i < Count && i < satisfiedSongs.Count; i++) // { // result += $"{satisfiedSongs[i].ToString(FormatType.Brief)}\n"; // } // } // result += satisfiedSongs.Count - Count > 0 ? $"还有{satisfiedSongs.Count - Count}个结果..." : null; // return result.Trim(); //} }
private void GetData() { string s = FileOperation.FileToString(GroupPath + @"\beatmapInfo.bmi", EncodingType.UTF8); string[] spString = s.Split('#')[1].Split('\n'); SongName = spString[1].Substring(6); SongName = SongName.Substring(0, SongName.Length - 1); Artist = spString[2].Substring(8); Artist = Artist.Substring(0, Artist.Length - 1); Author = spString[3].Substring(8); Author = Author.Substring(0, Author.Length - 1); BPM = int.Parse(spString[4].Substring(5)); }
public void TutorialBehaviour(SongName songName) { switch (songName) { case SongName.PaperclipSwarm: stageOnePassed = false; windupComboOngoing = false; NewMeasureEvent += PaperclipSwarmTutorial; StereoRail_AudioManager.Instance.tutorialPreventingDrop = true; StereoRail_AudioManager.Instance.tutorialActive = true; break; } }
private void ShowBrowser() { UploadAsset.Hide(); FileDialogName.Hide(); FileDialogOpen.Hide(); SongInfo.Hide(); SongName.Hide(); AuthorInfo.Hide(); AuthorName.Hide(); ProgressDisplay.Hide(); DownloadAll.Hide(); Download.Hide(); ListInfo.Hide(); Browser.Show(); }
private void UploadButton_Click(object sender, EventArgs e) { ShowBrowser(); Browser.Hide(); try { FileDialogName.Show(); FileDialogOpen.Show(); SongInfo.Show(); SongName.Show(); AuthorInfo.Show(); AuthorName.Show(); UploadAsset.Show(); label1.Text = "Upload Audio"; } catch { Console.WriteLine("Failure."); } }
private void ChooseSongToStart(SongName song) { switch (song) { case SongName.PaperclipSwarm: startLevelEvent.Post(gameObject, (uint)AkCallbackType.AK_MusicSyncBar, DelayMeasureCheck); break; default: break; } currentState = MusicState.Groove; currentStateText.text = "Current State: Groove"; nextState = MusicState.Groove; nextStateText.text = "Next State: Groove"; //startLevelEvent.Post(this.gameObject, (uint)AkCallbackType.AK_MusicSyncBar, DelayMeasureCheck); grooveManager.GrooveMeasure(); Debug.Log("Started Level Music ideally"); StartCoroutine(BriefWindupBanTimer()); }
void SongIsPlaying(SongName sName) { songPlaying = true; }
void ResetMinMaxIntensity(SongName songName) { currentMinIntensity = startMinIntensity; currentMaxIntensity = startMaxIntensity; reaktionIntensity = currentMinIntensity; }
void SongStart(SongName sName) { songPlaying = true; }
void ResetMinMaxIntensity(SongName songName) { currentMinIntensity = startMinIntensity; currentMaxIntensity = startMaxIntensity; rend.sharedMaterial.SetColor("_EmissionColor", currentDropColor * currentMinIntensity); }
public static void Play(SongName song) { if (loaded && enabled && (currentSong != song || MediaPlayer.State != MediaState.Playing)) { MediaPlayer.Stop(); currentSong = song; if (Songs.ContainsKey(song)) { MediaPlayer.Play(Songs[song]); } // MediaPlayer.Volume = 0.6f; MediaPlayer.IsRepeating = true; } }
void StartFadeOut(SongName songName) { StartCoroutine(FadeOut()); }
bool IsSongActive(BardComponent brdComp, SongName song) { return(brdComp.Song == song); }
public string getFileName() { return(Singer.Trim() + "-" + SongName.Trim() + ".mp3"); }
void MakeUnavailable(SongName songName) { readyToChangeScene = false; StopAllCoroutines(); StartCoroutine(FadeToTransparent()); }
public static void StartASong(SongName whichSongName) { StartSongEvent?.Invoke(whichSongName); }
void TurnOnText(SongName songName) { gestureText.SetActive(true); gesturePassed = false; boxChangedSuccessfully = false; }
public string getMergeKey() { return(Singer.Replace(" ", "") + SongName.Replace(" ", "")); }
/// <summary> /// 获取满足当前条件的歌曲 /// </summary> /// <param name="ratingList"></param> /// <param name="ratingClass"></param> /// <returns></returns> public List <PluginArcaeaSong> GetSatisfiedSong(List <string> ratingList = null, PluginArcaeaSong.RatingClass ratingClass = PluginArcaeaSong.RatingClass.Random) { if (_kouContext.Set <PluginArcaeaSong>().IsNullOrEmptySet()) { return(null); } //处理限定难度信息 if (ratingList.IsNullOrEmptySet()) { MultiSelectionHelper.TryGetMultiSelections(Rating, out ratingList, @"^(11|10|[1-9])\+?$"); } //处理限定难度类型信息 Regex regex = new Regex("(,|,)?(ftr|pst|prs|byd|byn|future|past|present|beyond|all)(,|,)?", RegexOptions.IgnoreCase | RegexOptions.RightToLeft); if (!SongName.IsNullOrEmpty() && regex.IsMatch(SongName)) //若是歌名上包含难度信息则取出来 { RatingClass = SongName.Match("(ftr|pst|prs|byd|byn|future|past|present|beyond|all)", RegexOptions.IgnoreCase | RegexOptions.RightToLeft); SongName = regex.Replace(SongName, "", 1).Trim(); } if (!RatingClass.IsNullOrEmpty())//RatingClass属性优先级比该函数中的ratingClss优先级大 { if (!Enum.TryParse(RatingClass, out ratingClass)) { if (PluginArcaeaSong.RatingClassNameList.ContainsKey(RatingClass.ToLower())) { ratingClass = PluginArcaeaSong.RatingClassNameList[RatingClass.ToLower()]; } } } //设定难度类型默认值为FTR if (ratingList.IsNullOrEmptySet() && RatingClass.IsNullOrWhiteSpace() && NotesCount.IsNullOrWhiteSpace() && ChartConstant.IsNullOrWhiteSpace() && Rating.IsNullOrWhiteSpace()) //不指定难度类型则默认是future难度,后面是不默认ftr { ratingClass = PluginArcaeaSong.RatingClass.Future; } //处理歌名信息 if (!SongName.IsNullOrWhiteSpace()) { SongName = SongName.Trim().ToLower(); string songEnID = _kouContext.Set <PluginArcaeaSongAnotherName>().FirstOrDefault(s => s.AnotherName == SongName)?.SongEnId; if (songEnID != null) { SongEnID = songEnID; SongName = null; } } //将需要用到的过滤器放到过滤容器里 FilterContainer <PluginArcaeaSong> filterContainer = new FilterContainer <PluginArcaeaSong>(); //使用默认ModelFilter filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.SongTitle), SongName, FilterType.Default, SortType.Ascending);//增加Song_title字段的默认filter filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.SongEnId), SongEnID, FilterType.Exact); if (ratingClass != PluginArcaeaSong.RatingClass.Random) { filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.ChartRatingClass), ratingClass, FilterType.SupportValueDefault); } filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.SongArtist), SongArtist, FilterType.Default, SortType.Ascending); filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.ChartDesigner), ChartDesigner, FilterType.Default, SortType.Ascending); filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.JacketDesigner), JacketDesigner, FilterType.Default, SortType.Ascending); filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.ChartAllNotes), NotesCount, FilterType.Default, SortType.StringAuto); filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.ChartConstant), ChartConstant, FilterType.Default, SortType.StringAuto); filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.SongLength), SongLength, FilterType.Default, SortType.StringAuto); filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.SongBpm), SongBPM, FilterType.Interval, SortType.StringAuto); filterContainer.ActivateAutoModelFilter(); //加入自定义的filter if (!ratingList.IsNullOrEmptySet()) { filterContainer.Add(FilterContainer <PluginArcaeaSong> .Convert(PluginArcaeaSong.RatingNumFilter), ratingList); } //开始筛选 var selectedList = _kouContext.Set <PluginArcaeaSong>().ToList(); selectedList = selectedList.Where(song => filterContainer.StartFilter(song)).ToList(); var sorter = filterContainer.GetModelSorter();//若有sorter则排序 if (sorter != null) { selectedList.Sort(sorter); } return(selectedList); }