42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Crosstales.Radio.Model.Entry;
|
|
using UnityEngine;
|
|
|
|
namespace Crosstales.Radio.Provider
|
|
{
|
|
[HelpURLAttribute("https://www.crosstales.com/media/data/assets/radio/api/class_crosstales_1_1_radio_1_1_provider_1_1_radio_provider_resource.html")]
|
|
public class RadioProviderResource : BaseRadioProvider
|
|
{
|
|
[Tooltip("All source radio station entries.")]
|
|
[Header("Source Settings")]
|
|
public List<RadioEntryResource> Entries = new List<RadioEntryResource>();
|
|
|
|
public override List<BaseRadioEntry> RadioEntries
|
|
{
|
|
get
|
|
{
|
|
return Entries.Cast<BaseRadioEntry>().ToList();
|
|
}
|
|
}
|
|
|
|
protected override void init()
|
|
{
|
|
base.init();
|
|
foreach (RadioEntryResource entry in Entries)
|
|
{
|
|
if (entry != null && entry.EnableSource)
|
|
{
|
|
if (entry.Resource != null)
|
|
{
|
|
StartCoroutine(loadResource(addCoRoutine(), entry));
|
|
continue;
|
|
}
|
|
Debug.LogWarning(string.Concat(entry, ": resource field 'Resource' is null or empty!", Environment.NewLine, "Please add a valid resource."));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|