Exemplo n.º 1
0
 public static TsAudioEventKeyParser CreateOld(string domainKey, string eventKeyString, NrCharInfoAdaptor charInfoAdaptor)
 {
     if (string.IsNullOrEmpty(domainKey))
     {
         return(null);
     }
     if (string.IsNullOrEmpty(eventKeyString))
     {
         return(null);
     }
     string[] array = eventKeyString.Split(TsAudioEventKeyParser.SEPARATOR, StringSplitOptions.RemoveEmptyEntries);
     if (array.Length != 2 && array.Length != 3)
     {
         return(null);
     }
     TsAudioEventKeyParser.parser.DomainKey   = domainKey;
     TsAudioEventKeyParser.parser.CategoryKey = array[0];
     TsAudioEventKeyParser.parser.AudioKey    = TsAudioEventKeyParser._QueryCharInfo(charInfoAdaptor, array[1]);
     TsAudioEventKeyParser.parser.BundleKey   = string.Empty;
     if (array.Length == 2)
     {
         TsAudioEventKeyParser.parser.BundleKey = string.Empty;
     }
     else if (array.Length == 3)
     {
         TsAudioEventKeyParser.parser.BundleKey = array[2];
     }
     return(TsAudioEventKeyParser.parser);
 }
    public virtual void OnEvent_Sound(string audioEventKey)
    {
        NrCharInfoAdaptor component = base.GetComponent <NrCharInfoAdaptor>();

        if (component == null && null != base.transform.parent)
        {
            component = base.transform.parent.GetComponent <NrCharInfoAdaptor>();
        }
        bool flag = false;

        if (component != null)
        {
            if (base.gameObject.tag == "Player")
            {
                flag = true;
            }
            else if (base.gameObject.transform.parent != null && base.gameObject.transform.parent.gameObject.tag == "Player")
            {
                flag = true;
            }
        }
        TsAudioEventKeyParser tsAudioEventKeyParser = TsAudioEventKeyParser.Create(audioEventKey, component);

        if (tsAudioEventKeyParser == null)
        {
            TsLog.LogWarning("Cannot Parsing~! check Count~! goName= " + base.gameObject.name, new object[0]);
        }
        else if (tsAudioEventKeyParser.CategoryKey != "FOOTSTEP" || flag)
        {
            if (!tsAudioEventKeyParser.HasBundleKey)
            {
                TsAudioManager.Container.RequestAudioClip(tsAudioEventKeyParser.DomainKey, tsAudioEventKeyParser.CategoryKey, tsAudioEventKeyParser.AudioKey, new PostProcPerItem(this._OnComplated_DownloadAudioWWW));
            }
            else
            {
                TsAudioManager.Container.RequestAudioClip(tsAudioEventKeyParser.DomainKey, tsAudioEventKeyParser.CategoryKey, tsAudioEventKeyParser.AudioKey, tsAudioEventKeyParser.BundleKey, new PostProcPerItem(this._OnComplated_DownloadAudioWWW));
            }
        }
    }