public void handle(GameEvent e, EventTiming t) { if (t == timing && filter(e)) { action(e); } }
public EventHandler(GameEventType t, EventAction e) { //todo(seba) don't think these are interned the way you'd hope filter = @v => v.type == t; action = e; timing = EventTiming.Main; }
public static string ToString(EventTiming value) { if (value == EventTiming.HS) { return("HS"); } else if (value == EventTiming.WAKE) { return("WAKE"); } else if (value == EventTiming.AC) { return("AC"); } else if (value == EventTiming.ACM) { return("ACM"); } else if (value == EventTiming.ACD) { return("ACD"); } else if (value == EventTiming.ACV) { return("ACV"); } else if (value == EventTiming.PC) { return("PC"); } else if (value == EventTiming.PCM) { return("PCM"); } else if (value == EventTiming.PCD) { return("PCD"); } else if (value == EventTiming.PCV) { return("PCV"); } else { throw new ArgumentException("Unrecognized EventTiming value: " + value.ToString()); } }
public bool CanPlayEvent(EventTiming timing) { if (!GameLogic.Get().m_mainGameUI.m_isActionEnable[PlayerAction.PlayCard]) { return(false); } foreach (var card in m_lstPlayerCards) { if (card.m_eventTiming == timing && m_resources >= card.m_cost && card.GetComponent <PlayerCardLogic>().CanTrigger()) { return(true); } } return(false); }
/// <summary> /// Initializes a new instance of the <see cref="FrameContainer"/> class. /// </summary> internal FrameContainer() { _frameBinder = new FrameBinder(this); _unknownFrames = new List <UnknownFrame>(); _id3v24SingleOccurrenceFrames = new Dictionary <string, IFrame>(); _id3v24MultipleOccurrenceFrames = new Dictionary <string, IBindingList>(); _id3v23SingleOccurrenceFrames = new Dictionary <string, IFrame>(); _id3v23MultipleOccurrenceFrames = new Dictionary <string, IBindingList>(); _id3v22SingleOccurrenceFrames = new Dictionary <string, IFrame>(); _id3v22MultipleOccurrenceFrames = new Dictionary <string, IBindingList>(); _id3v24FrameAliases = new Dictionary <string, string>(); _id3v23FrameAliases = new Dictionary <string, string>(); // Binding lists m_AttachedPictureList = new AttachedPictureBindingList(); m_UserDefinedUrlList = new UserDefinedUrlBindingList(); m_CommentsList = new CommentsBindingList(); m_iTunesCommentsList = new CommentsBindingList(); m_CommercialInfoUrlList = new UrlBindingList("WCOM", "WCOM", "WCM"); m_ArtistUrlList = new UrlBindingList("WOAR", "WOAR", "WAR"); m_UserDefinedTextList = new UserDefinedTextBindingList(); m_RelativeVolumeAdjustmentList = new RelativeVolumeAdjustmentBindingList(); m_UnsynchronizedLyricsList = new UnsynchronizedLyricsBindingList(); m_GeneralEncapsulatedObjectList = new GeneralEncapsulatedObjectBindingList(); m_UniqueFileIdentifierList = new UniqueFileIdentifierBindingList(); m_PrivateFrameList = new PrivateFrameBindingList(); m_PopularimeterList = new PopularimeterBindingList(); m_TermsOfUseList = new TermsOfUseBindingList(); m_LinkedInformationList = new LinkedInformationBindingList(); m_CommercialInfoList = new CommercialBindingList(); m_EncryptionMethodList = new EncryptionMethodBindingList(); m_GroupIdentificationList = new GroupIdentificationBindingList(); m_SignatureList = new SignatureBindingList(); m_AudioEncryptionList = new AudioEncryptionBindingList(); m_EncryptedMetaFrameList = new EncryptedMetaFrameBindingList(); m_SynchronizedLyricsList = new SynchronizedTextBindingList(); m_EqualizationList = new EqualizationListBindingList(); m_AudioTextList = new AudioTextBindingList(); // Add binding lists to multiple occurence frames dictionary AddMultipleOccurrenceFrame("APIC", "APIC", "PIC", m_AttachedPictureList); AddMultipleOccurrenceFrame("WXXX", "WXXX", "WXX", m_UserDefinedUrlList); AddMultipleOccurrenceFrame("COMM", "COMM", "COM", m_CommentsList); AddMultipleOccurrenceFrame(null, null, null, m_iTunesCommentsList); AddMultipleOccurrenceFrame("WCOM", "WCOM", "WCM", m_CommercialInfoUrlList); //"CommercialInfoUrl", new MethodInvoker(ValidateCommercialInfoUrl)); // TODO AddMultipleOccurrenceFrame("WOAR", "WOAR", "WAR", m_ArtistUrlList); AddMultipleOccurrenceFrame("TXXX", "TXXX", "TXX", m_UserDefinedTextList); AddMultipleOccurrenceFrame("RVA2", "RVAD", "RVA", m_RelativeVolumeAdjustmentList); AddMultipleOccurrenceFrame("USLT", "USLT", "ULT", m_UnsynchronizedLyricsList); AddMultipleOccurrenceFrame("GEOB", "GEOB", "GEO", m_GeneralEncapsulatedObjectList); AddMultipleOccurrenceFrame("UFID", "UFID", "UFI", m_UniqueFileIdentifierList); AddMultipleOccurrenceFrame("PRIV", "PRIV", null, m_PrivateFrameList); AddMultipleOccurrenceFrame("POPM", "POPM", "POP", m_PopularimeterList); AddMultipleOccurrenceFrame("USER", "USER", null, m_TermsOfUseList); AddMultipleOccurrenceFrame("LINK", "LINK", "LNK", m_LinkedInformationList); //"ArtistUrl", new MethodInvoker(ValidateArtistUrl)); // TODO AddMultipleOccurrenceFrame("AENC", "AENC", "CRA", m_AudioEncryptionList); AddMultipleOccurrenceFrame(null, null, "CRM", m_EncryptedMetaFrameList); // replaced in ID3v2.3 and ID3v2.4 with encryptable frames AddMultipleOccurrenceFrame("SYLT", "SYLT", "SLT", m_SynchronizedLyricsList); AddMultipleOccurrenceFrame("EQU2", "EQUA", "EQU", m_EqualizationList); // todo: not a multi-occur frame in 2.2/2.3 AddMultipleOccurrenceFrame("COMR", "COMR", null, m_CommercialInfoList); // todo: not a multi-occur in 2.3 AddMultipleOccurrenceFrame("ENCR", "ENCR", null, m_EncryptionMethodList); AddMultipleOccurrenceFrame("GRID", "GRID", null, m_GroupIdentificationList); AddMultipleOccurrenceFrame("SIGN", "SIGN", null, m_SignatureList); // todo: not in ID3v2.3 AddMultipleOccurrenceFrame("ATXT", "ATXT", null, m_AudioTextList); // Text frames m_Title = CreateTextFrame("TIT2", "TIT2", "TT2", "Title", null); m_Album = CreateTextFrame("TALB", "TALB", "TAL", "Album", null); m_EncodedByWho = CreateTextFrame("TENC", "TENC", "TEN", "EncodedByWho", null); m_Artist = CreateTextFrame("TPE1", "TPE1", "TP1", "Artist", null); m_AlbumArtist = CreateTextFrame("TPE2", "TPE2", "TP2", "AlbumArtist", null); // Note: TYER is not a valid frame in ID3v2.4, but many ID3v2.4 tags contain this frame anyway. // It's here to allow reading, but should not be written back (use TDRL instead). m_Year = CreateTextFrame("TYER", "TYER", "TYE", "Year", ValidateYear); // Note: TDAT is not a valid frame in ID3v2.4, but many ID3v2.4 tags contain this frame anyway. // It's here to allow reading, but should not be written back (use TDRC instead). m_DateRecorded = CreateTextFrame("TDAT", "TDAT", "TDA", "DateRecorded", ValidateDateRecorded); // Note: TIME is not a valid frame in ID3v2.4, but many ID3v2.4 tags contain this frame anyway. // It's here to allow reading, but should not be written back (use TDRC instead). m_TimeRecorded = CreateTextFrame("TIME", "TIME", "TIM", "TimeRecorded", ValidateTimeRecorded); m_Genre = CreateTextFrame("TCON", "TCON", "TCO", "Genre", null); m_Composer = CreateTextFrame("TCOM", "TCOM", "TCM", "Composer", null); m_OriginalArtist = CreateTextFrame("TOPE", "TOPE", "TOA", "OriginalArtist", null); m_Copyright = CreateTextFrame("TCOP", "TCOP", "TCR", "Copyright", ValidateCopyright); m_RemixedBy = CreateTextFrame("TPE4", "TPE4", "TP4", "RemixedBy", null); m_Publisher = CreateTextFrame("TPUB", "TPUB", "TPB", "Publisher", null); m_InternetRadioStationName = CreateTextFrame("TRSN", "TRSN", null, "InternetRadioStationName", null); m_InternetRadioStationOwner = CreateTextFrame("TRSO", "TRSO", null, "InternetRadioStationOwner", null); //m_Accompaniment = CreateTextFrame("TPE2", "TPE2", "TP2", "Accompaniment", null); m_Conductor = CreateTextFrame("TPE3", "TPE3", "TP3", "Conductor", null); m_Lyricist = CreateTextFrame("TEXT", "TEXT", "TXT", "Lyricist", null); m_OriginalLyricist = CreateTextFrame("TOLY", "TOLY", "TOL", "OriginalLyricist", null); m_TrackNumber = CreateTextFrame("TRCK", "TRCK", "TRK", "TrackNumber", ValidateTrackNumber); m_BPM = CreateTextFrame("TBPM", "TBPM", "TBP", "BPM", ValidateBPM); m_FileType = CreateTextFrame("TFLT", "TFLT", "TFT", "FileType", null); m_DiscNumber = CreateTextFrame("TPOS", "TPOS", "TPA", "DiscNumber", ValidateDiscNumber); m_EncoderSettings = CreateTextFrame("TSSE", "TSSE", "TSS", "EncoderSettings", null); m_ISRC = CreateTextFrame("TSRC", "TSRC", "TRC", "ISRC", ValidateISRC); // Note: TCMP/TCP is an unofficial frame. Used by iTunes and other taggers. m_IsPartOfCompilation = CreateTextFrame("TCMP", "TCMP", "TCP", "IsPartOfCompilation", null); // TDRL is not technically supported in ID3v2.3 m_ReleaseTimestamp = CreateTextFrame("TDRL", "TDRL", null, "ReleaseTimestamp", ValidateReleaseTimestamp); // TDRC is not technically supported in ID3v2.3 m_RecordingTimestamp = CreateTextFrame("TDRC", "TDRC", null, "RecordingTimestamp", ValidateRecordingTimestamp); // TDOR is not technically supported in ID3v2.3 m_OriginalReleaseTimestamp = CreateTextFrame("TDOR", "TDOR", null, "OriginalReleaseTimestamp", null /*todo:new MethodInvoker(ValidateOriginalReleaseTimestamp)*/); m_PlaylistDelayMilliseconds = CreateTextFrame("TDLY", "TDLY", "TDY", "PlaylistDelayMilliseconds", null); m_InitialKey = CreateTextFrame("TKEY", "TKEY", "TKE", "InitialKey", null /*TODO: new MethodInvoker(ValidateInitialKey)*/); // TDEN is not technically supported in ID3v2.3 m_EncodingTimestamp = CreateTextFrame("TDEN", "TDEN", null, "EncodingTimestamp", null /*TODO*/); // TDTG is not technically supported in ID3v2.3 m_TaggingTimestamp = CreateTextFrame("TDTG", "TDTG", null, "TaggingTimestamp", null /*TODO*/); m_ContentGroup = CreateTextFrame("TIT1", "TIT1", "TT1", "ContentGroup", null); // TMOO is not technically supported in ID3v2.3 m_Mood = CreateTextFrame("TMOO", "TMOO", null, "Mood", null); m_LengthMilliseconds = CreateTextFrame("TLEN", "TLEN", "TLE", "LengthMilliseconds", null); m_MediaType = CreateTextFrame("TMED", "TMED", "TMT", "MediaType", null); // TODO: technically not supported in ID3v2.4, but probably written by some impl. anyway m_FileSizeExcludingTag = CreateTextFrame(null, "TSIZ", "TSI", "FileSizeExcludingTag", null); // Not technically in ID3v2.4 m_OriginalReleaseYear = CreateTextFrame("TORY", "TORY", "TOR", "OriginalReleaseYear", null /*TODO*/); m_OriginalSourceTitle = CreateTextFrame("TOAL", "TOAL", "TOT", "OriginalSourceTitle", null); m_OriginalFileName = CreateTextFrame("TOFN", "TOFN", "TOF", "OriginalFileName", null); m_FileOwnerName = CreateTextFrame("TOWN", "TOWN", null, "FileOwnerName", null); // Not technically in ID3v2.4 m_RecordingDates = CreateTextFrame("TRDA", "TRDA", "TRD", "RecordingDates", null /*TODO*/); m_Subtitle = CreateTextFrame("TIT3", "TIT3", "TT3", "Subtitle", null); // Technically only supported in ID3v2.4, but some ID3v2.3 implementations use this frame m_AlbumSortOrder = CreateTextFrame("TSOA", "TSOA", null, "AlbumSortOrder", null); // Technically only supported in ID3v2.4, but some ID3v2.3 implementations use this frame m_ArtistSortOrder = CreateTextFrame("TSOP", "TSOP", null, "ArtistSortOrder", null); // Technically only supported in ID3v2.4, but some ID3v2.3 implementations use this frame m_TitleSortOrder = CreateTextFrame("TSOT", "TSOT", null, "TitleSortOrder", null); // Technically only supported in ID3v2.4, but some ID3v2.3 implementations use this frame m_ProducedNotice = CreateTextFrame("TPRO", "TPRO", null, "ProducedNotice", null /*todo - same as copyright validation*/); // Technically only supported in ID3v2.4, but some ID3v2.3 implementations use this frame m_SetSubtitle = CreateTextFrame("TSST", "TSST", null, "SetSubtitle", null); m_PodcastSeriesCategory = CreateTextFrame("TCAT", "TCAT", null, "SeriesCategory", null); m_PodcastEpisodeDescription = CreateTextFrame("TDES", "TDES", null, "EpisodeDescription", null); m_PodcastEpisodeUrl = CreateTextFrame("TGID", "TGID", null, "EpisodeUrl", null); m_PodcastFeedUrl = CreateTextFrame("WFED", "WFED", null, "PodcastFeedUrl", null); m_PositionSynchronization = CreatePositionSynchronizationFrame("POSS", "POSS", null, "PositionSynchronization", null); m_Ownership = CreateOwnershipFrame("OWNE", "OWNE", null, "Ownership", null); m_RecommendedBufferSize = CreateRecommendedBufferSizeFrame("RBUF", "RBUF", "BUF", "RecommendedBufferSize", null /*todo*/); m_InvolvedPersonList = CreateInvolvedPersonListFrame("TIPL", "IPLS", "IPL", "InvolvedPersonList", null /*TODO - needs validation?*/); m_Languages = CreateLanguageFrame("TLAN", "TLAN", "TLA", "Languages", null); m_MusicCDIdentifier = CreateMusicCDIdentifierFrame("MCDI", "MCDI", "MCI", "MusicCDIdentifier", null /*TODO?*/); m_EventTiming = CreateEventTimingFrame("ETCO", "ETCO", "ETC", "EventTiming", null /*TODO - needs validation?*/); m_MpegLookupTable = CreateMpegLookupTableFrame("MLLT", "MLLT", "MLL", "MpegLookupTable", null); m_Reverb = CreateReverbFrame("RVRB", "RVRB", "REV", "Reverb", null); m_SynchronizedTempoCodes = CreateSynchronizedTempoCodesFrame("SYTC", "SYTC", "STC", "SynchronizedTempoCodeList", null); m_SeekNextTag = CreateSeekFrame("SEEK", "SEEK", null, "SeekNextTag", null); // Technically only supported in ID3v2.4, but some ID3v2.3 implementations use this frame m_MusicianCreditsList = CreateMusicianCreditsListFrame("TMCL", "TMCL", null, "MusicianCreditsList", null); m_AudioSeekPointIndex = CreateAudioSeekPointIndexFrame("ASPI", "ASPI", null, "AudioSeekPointIndex", null); m_PlayCount = CreateFrame <PlayCount>("PCNT", "PCNT", "CNT", "PlayCount"); m_IsPodcast = CreateFrame <Podcast>("PCST", "PCST", "PCS", "Podcast"); // TODO: TYER->TDRL, TDAT,TIME->TDRC (in setters, not here) // URL frames m_CopyrightUrl = CreateUrlFrame("WCOP", "WCOP", "WCP", "CopyrightUrl", ValidateCopyrightUrl); m_AudioFileUrl = CreateUrlFrame("WOAF", "WOAF", "WAF", "AudioFileUrl", ValidateAudioFileUrl); m_AudioSourceUrl = CreateUrlFrame("WOAS", "WOAS", "WAS", "AudioSourceUrl", ValidateAudioSourceUrl); m_InternetRadioStationUrl = CreateUrlFrame("WORS", "WORS", null, "InternetRadioStationUrl", ValidateInternetRadioStationUrl); m_PaymentUrl = CreateUrlFrame("WPAY", "WPAY", null, "PaymentUrl", ValidatePaymentUrl); m_PublisherUrl = CreateUrlFrame("WPUB", "WPUB", "WPB", "PublisherUrl", ValidatePublisherUrl); // Frame aliases - handles incorrectly named frames // ID3v2.4 (Bad frame, Good frame) _id3v24FrameAliases.Add("RVAD", "RVA2"); _id3v24FrameAliases.Add("IPLS", "TIPL"); _id3v24FrameAliases.Add("EQUA", "EQU2"); // ID3v2.3 (Bad frame, Good frame) _id3v23FrameAliases.Add("RVA2", "RVAD"); _id3v23FrameAliases.Add("TIPL", "IPLS"); _id3v23FrameAliases.Add("EQU2", "EQUA"); }
public static bool TryParse(string value, out EventTiming result) { result = default(EventTiming); if( value=="HS") result = EventTiming.HS; else if( value=="WAKE") result = EventTiming.WAKE; else if( value=="AC") result = EventTiming.AC; else if( value=="ACM") result = EventTiming.ACM; else if( value=="ACD") result = EventTiming.ACD; else if( value=="ACV") result = EventTiming.ACV; else if( value=="PC") result = EventTiming.PC; else if( value=="PCM") result = EventTiming.PCM; else if( value=="PCD") result = EventTiming.PCD; else if( value=="PCV") result = EventTiming.PCV; else return false; return true; }
public static string ToString(EventTiming value) { if( value==EventTiming.HS ) return "HS"; else if( value==EventTiming.WAKE ) return "WAKE"; else if( value==EventTiming.AC ) return "AC"; else if( value==EventTiming.ACM ) return "ACM"; else if( value==EventTiming.ACD ) return "ACD"; else if( value==EventTiming.ACV ) return "ACV"; else if( value==EventTiming.PC ) return "PC"; else if( value==EventTiming.PCM ) return "PCM"; else if( value==EventTiming.PCD ) return "PCD"; else if( value==EventTiming.PCV ) return "PCV"; else throw new ArgumentException("Unrecognized EventTiming value: " + value.ToString()); }
protected virtual string FormatMessage(EventTiming timing) { return($"{timing.EventName,-70}{timing.Duration + " ms",15}{timing.TotalDuration + " ms",15}"); }
public void InitEventTiming(IList <SpecialEventTiming> serverEventTimingList) { if (this.m_eventTimings.Count > 0) { Debug.LogWarning("SpecialEventManager.InitEventTiming(): m_eventTimings was not empty; clearing it first"); this.m_eventTimings.Clear(); } DateTime now = DateTime.Now; bool flag = false; for (int i = 0; i < serverEventTimingList.Count; i++) { SpecialEventType type; SpecialEventTiming timing = serverEventTimingList[i]; try { type = EnumUtils.GetEnum <SpecialEventType>(timing.Event); } catch (ArgumentException exception) { Error.AddDevWarning("GetEnum Error", exception.Message, new object[0]); flag = true; continue; } if (this.m_eventTimings.ContainsKey(type)) { Debug.LogWarning(string.Format("SpecialEventManager.InitEventTiming duplicate entry for event {0} received", type)); flag = true; } else { DateTime?startTime = null; if (timing.HasStart) { if (timing.Start > 0L) { startTime = new DateTime?(now.AddSeconds((double)timing.Start)); } else { startTime = new DateTime?(now); } } DateTime?endTime = null; if (timing.HasEnd) { if (timing.End > 0L) { endTime = new DateTime?(now.AddSeconds((double)timing.End)); } else { endTime = new DateTime?(now); } } this.m_eventTimings[type] = new EventTiming(startTime, endTime); } } if (flag && ApplicationMgr.IsInternal()) { StringBuilder builder = new StringBuilder(); for (int j = 0; j < serverEventTimingList.Count; j++) { SpecialEventTiming timing2 = serverEventTimingList[j]; builder.Append("\n serverEvent=").Append(timing2.Event); builder.Append(" start=").Append(!timing2.HasStart ? "null" : timing2.Start.ToString()); builder.Append(" end=").Append(!timing2.HasEnd ? "null" : timing2.End.ToString()); } foreach (SpecialEventType type2 in this.m_eventTimings.Keys) { EventTiming timing3 = this.m_eventTimings[type2]; builder.Append("\n mgrEvent=").Append(type2); builder.Append(" start=").Append(!timing3.StartTime.HasValue ? "none" : timing3.StartTime.Value.ToString()); builder.Append(" end=").Append(!timing3.EndTime.HasValue ? "none" : timing3.EndTime.Value.ToString()); } Debug.LogWarning(string.Format("EventTiming dump: {0}", builder.ToString())); } }