本文整理汇总了C#中ChannelType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ChannelType.ToString方法的具体用法?C# ChannelType.ToString怎么用?C# ChannelType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChannelType
的用法示例。
在下文中一共展示了ChannelType.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetChannelLevel
/// <summary>
/// Get the DB attenuation of the channel.
/// </summary>
/// <param name="channeltype">Channeltype.</param>
public float GetChannelLevel(ChannelType channeltype)
{
ChannelInfo chInfo = null;
channelInfos.TryGetValue(channeltype.ToString(), out chInfo);
if(chInfo != null)
{
// !!! check with Andrea whether to return defaultDBLevel OR settedDBLevel
return (chInfo.settedDBLevel);
}
else
{
Debug.LogError("Channelinfo not found");
return 0.0f;
}
}
示例2: BuildRecordingBaseFilePath
public static string BuildRecordingBaseFilePath(string format, string channelDisplayName, ChannelType channelType, string scheduleName,
string title, string programTitle, string subTitle, string episodeNumberDisplay, int? episodeNumber, int? seriesNumber, DateTime startTime, string category)
{
LimitLength(ref title, 80);
LimitLength(ref programTitle, 80);
LimitLength(ref scheduleName, 80);
LimitLength(ref subTitle, 80);
format = MakeValidPath(format).Replace(":", String.Empty).TrimStart('\\').TrimStart('/').TrimEnd('\\').TrimEnd('/');
StringBuilder result = new StringBuilder(format);
ReplaceFormatVariable(result, "%%CHANNEL%%", channelDisplayName);
ReplaceFormatVariable(result, "%%CHANNELTYPE%%", channelType.ToString());
ReplaceFormatVariable(result, "%%TVCHANNEL%%", channelDisplayName); // For backwards compatibility.
ReplaceFormatVariable(result, "%%SCHEDULE%%", scheduleName);
ReplaceFormatVariable(result, "%%TITLE%%", title);
ReplaceFormatVariable(result, "%%LONGTITLE%%", programTitle);
ReplaceFormatVariable(result, "%%EPISODETITLE%%", String.IsNullOrEmpty(subTitle) ? "#" : subTitle);
ReplaceFormatVariable(result, "%%EPISODENUMBERDISPLAY%%", String.IsNullOrEmpty(episodeNumberDisplay) ? "#" : episodeNumberDisplay);
ReplaceFormatVariable(result, "%%EPISODENUMBER%%", episodeNumber.HasValue ? episodeNumber.ToString() : "#");
ReplaceFormatVariable(result, "%%EPISODENUMBER2%%", episodeNumber.HasValue ? episodeNumber.Value.ToString("00") : "00");
ReplaceFormatVariable(result, "%%EPISODENUMBER3%%", episodeNumber.HasValue ? episodeNumber.Value.ToString("000") : "000");
ReplaceFormatVariable(result, "%%SERIES%%", seriesNumber.HasValue ? seriesNumber.ToString() : "#");
ReplaceFormatVariable(result, "%%SERIES2%%", seriesNumber.HasValue ? seriesNumber.Value.ToString("00") : "00");
ReplaceFormatVariable(result, "%%DATE%%", startTime.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
ReplaceFormatVariable(result, "%%YEAR%%", startTime.ToString("yyyy", CultureInfo.InvariantCulture));
ReplaceFormatVariable(result, "%%MONTH%%", startTime.ToString("MM", CultureInfo.InvariantCulture));
ReplaceFormatVariable(result, "%%DAY%%", startTime.ToString("dd", CultureInfo.InvariantCulture));
ReplaceFormatVariable(result, "%%DAYOFWEEK%%", startTime.ToString("ddd", CultureInfo.CurrentCulture));
ReplaceFormatVariable(result, "%%HOURS%%", startTime.ToString("HH", CultureInfo.InvariantCulture));
ReplaceFormatVariable(result, "%%HOURS12%%", startTime.ToString("hhtt", CultureInfo.InvariantCulture));
ReplaceFormatVariable(result, "%%MINUTES%%", startTime.ToString("mm", CultureInfo.InvariantCulture));
ReplaceFormatVariable(result, "%%CATEGORY%%", String.IsNullOrEmpty(category) ? "#" : category);
return result.ToString().Replace(".\\", "\\").Replace("./", "/");
}
示例3: Play
/// <summary>
/// Play the specified audioClip on specified channel type. This function is meant to be used for single sound occurences.
/// Use default level will set the attenuation to its default level.
/// </summary>
/// <param name="audioClip">Audio clip.</param>
/// <param name="clipName">Clip name.</param>
/// <param name="channeltype">Channeltype.</param>
public void Play(AudioClip audioClip, ChannelType channeltype, AudioClipInfo clipInfo)
{
GameObject go = new GameObject("GameSound");
go.tag = channeltype.ToString();
go.transform.SetParent(gameObject.transform, false);
AudioSource source = go.AddComponent<AudioSource>();
source.playOnAwake = false;
source.clip = audioClip;
float lvl = 0.0f;
ChannelInfo chInfo = null;
channelInfos.TryGetValue(channeltype.ToString(), out chInfo);
if(chInfo != null)
{
lvl = clipInfo.useDefaultDBLevel ? chInfo.defaultDBLevel : chInfo.settedDBLevel;
}
else
{
Debug.LogError("Channel info not found");
}
audioMixer.SetFloat(channeltype.ToString(),lvl);
source.outputAudioMixerGroup = chInfo.audioMixerGroup;
source.loop = clipInfo.isLoop;
source.PlayDelayed(clipInfo.delayAtStart);
playingList.Add(go);
}
示例4: Stop
/// <summary>
/// Stop all the clips being played in a particular channel.
/// </summary>
/// <param name="channel">Channel.</param>
public void Stop(ChannelType channel)
{
GameObject[] soundsInChannel = GameObject.FindGameObjectsWithTag(channel.ToString());
for (int i = 0; i < soundsInChannel.Length; i++) {
if(soundsInChannel[i].GetComponent<AudioSource>().isPlaying)
{
soundsInChannel[i].GetComponent<AudioSource>().Stop();
}
}
}
示例5: SetChannelLevel
/// <summary>
/// Sets the DB attenuation of the channel.
/// </summary>
/// <param name="channeltype">Channeltype.</param>
/// <param name="value">Value.</param>
public void SetChannelLevel(ChannelType channeltype, float value)
{
ChannelInfo chInfo = null;
channelInfos.TryGetValue(channeltype.ToString(), out chInfo);
if(chInfo != null)
{
chInfo.settedDBLevel = value;
}
else
{
Debug.LogError("Channelinfo not found");
}
}