Exemplo n.º 1
0
    private static AudioObject CreateAudioObject(int id)
    {
        AudioCfg config = audioCfgLoader.GetConfig(id);

        if (config == null)
        {
            DebugLogger.LogErrorFormat("[AudioManager]:Failed to find config of audio {0}", id);
            return(null);
        }

        AudioObject audioObj = new AudioObject(config, Instance.transform);

        return(audioObj);
    }
Exemplo n.º 2
0
    public AudioObject(AudioCfg config, Transform root)
    {
        this.config = config;
        AudioID     = config.ID;
        gameObject  = new GameObject(config.ID.ToString());
        Disable();
        transform = gameObject.transform;
        transform.SetParent(root);
        audioSource = gameObject.AddComponent <AudioSource>();
        audioSource.outputAudioMixerGroup = AudioManager.GetMixerGroup((AudioGroupTypes)config.Priority);
        audioSource.volume       = config.Volume;
        audioSource.loop         = config.Loop == 1;
        audioSource.dopplerLevel = 0;
        assetBundlePath          = string.Format("audio/{0}.bundle", config.AssetName.ToLower());

        LoadAsset();
    }
Exemplo n.º 3
0
    public static IEnumerator Load()
    {
        ResourceLoadTask task = new ResourceLoadTask();

        task.path = "cfg";
        task.name = "tile.csv";
        yield return(ResourceLoader.LoadAssetAsync(task));

        TileCfg.load((task.asset as TextAsset).bytes);

        task.name = "resources.csv";
        yield return(ResourceLoader.LoadAssetAsync(task));

        ResourcesCfg.load((task.asset as TextAsset).bytes);

        task.name = "prefab.csv";
        yield return(ResourceLoader.LoadAssetAsync(task));

        PrefabCfg.load((task.asset as TextAsset).bytes);

        task.name = "prefabType.csv";
        yield return(ResourceLoader.LoadAssetAsync(task));

        PrefabTypeCfg.load((task.asset as TextAsset).bytes);

        task.name = "audio.csv";
        yield return(ResourceLoader.LoadAssetAsync(task));

        AudioCfg.load((task.asset as TextAsset).bytes);

        task.name = "frameAnimation.csv";
        yield return(ResourceLoader.LoadAssetAsync(task));

        FrameAnimationCfg.load((task.asset as TextAsset).bytes);
        task.name = "characterSprite.csv";
        yield return(ResourceLoader.LoadAssetAsync(task));

        CharacterSpriteCfg.load((task.asset as TextAsset).bytes);
        task.name = "unitType.csv";
        yield return(ResourceLoader.LoadAssetAsync(task));

        UnitTypeCfg.load((task.asset as TextAsset).bytes);
    }
Exemplo n.º 4
0
    public AudioObject(AudioCfg audioCfg, Transform root)
    {
        this.audioCfg = audioCfg;
        AudioID       = audioCfg.ID;
        gameObject    = new GameObject(audioCfg.ID.ToString());
        Disable();
        transform = gameObject.transform;
        transform.SetParent(root);

        audioTarget = new AudioTarget();

        audioSource = gameObject.AddComponent <AudioSource>();
        audioSource.outputAudioMixerGroup = AudioManager.GetMixerGroup((AudioGroupTypes)audioCfg.Priority);
        audioSource.volume       = audioCfg.Volume;
        audioSource.loop         = audioCfg.Loop;
        audioSource.dopplerLevel = 0;

        assetBundleName    = string.Format(audioBundlePath, audioCfg.AssetName.ToLower());
        assetLoadOperation = AssetLoadManager.LoadAssetAsync(assetBundleName, audioCfg.AssetName, typeof(AudioClip));
    }
Exemplo n.º 5
0
 private void OnReadRow(AudioCfg row)
 {
     m_data[row.ID] = row;
 }
Exemplo n.º 6
0
 private void OnReadRow(AudioCfg obj)
 {
     m_data[obj.ID] = obj;
 }