private PositionSynchronization CreatePositionSynchronizationFrame(string id3v24FrameID, string id3v23FrameID, string id3v22FrameID, string property, Action validator)
        {
            PositionSynchronization positionSynchronization = new PositionSynchronization();

            Bind(id3v24FrameID, id3v23FrameID, id3v22FrameID, positionSynchronization, "TODO", property, validator);
            return(positionSynchronization);
        }
Exemple #2
0
        [SyncVar] public bool isWalking;                                // bools for synchronizing animations

        #endregion

        #region //======            MONOBEHAVIOURS           ======\\

        public override void Start()
        {
            base.Start();

            // UI
            nameText.text = Name.ToString();

            if (!isLocalPlayer)
            {
                onStartIfNotLocal.Invoke();
                return;
            }

            localPlayer = this;

            // camera
            m_Camera = Camera.main;
            m_Camera.GetComponentInParent <CameraController>().SetTarget(transform);

            // scripts
            positionSynchronization = GetComponent <PositionSynchronization>();
            weaponController        = GetComponent <WeaponController>();

            // indicator
            indicator         = Instantiate(indicatorPrefab, Vector3.zero, Quaternion.identity).transform;
            indicatorAnimator = indicator.GetComponent <Animator>();

            onStartIfLocal.Invoke();
            StartCoroutine(CheckTarget());

            // show inventory
            InventorySystem.Instance.Reset();
            foreach (var key in inventoryData.Keys)
            {
                InventorySystem.Instance.OnInventoryUpdate(key, inventoryData[key]);
            }

            foreach (var key in equipmentData.Keys)
            {
                EquipmentSystem.OnEquipmentUpdate(SyncIDictionary <EquipmentSlot, ItemData> .Operation.OP_ADD, key, equipmentData[key]);
            }

            inventoryData.Callback += OnInventoryUpdate;
            equipmentData.Callback += EquipmentSystem.OnEquipmentUpdate;

            UIStatsPanel.SetNameText(Name);
            EquipmentSystem.SetPlayer(this);

            InventorySystem.LoadToolbar();
        }
        /// <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");
        }