本文整理汇总了C#中Func.Random方法的典型用法代码示例。如果您正苦于以下问题:C# Func.Random方法的具体用法?C# Func.Random怎么用?C# Func.Random使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func.Random方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Application
/// <summary>
/// This is a javascript application.
/// </summary>
/// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
public Application(IApp page)
{
Console.WriteLine("loading GIR");
page.talk.style.transition = "opacity 0.1s linear";
page.idle.style.Opacity = 1;
page.talk.style.Opacity = 0;
// why wait for frame?
Native.window.requestAnimationFrame +=
delegate
{
IHTMLAudio snd = null;
Console.WriteLine("loading first sound");
snd = new guidancechip();
//Console.WriteLine("calling audio load");
//snd.load();
Console.WriteLine("preparing play");
var play_disabled = false;
Func<IHTMLAudio> random_snd =
delegate
{
var a = new Func<IHTMLAudio>[] {
()=>new blend_in(),
()=>new cant_see(),
()=>new data_canister_not_yet_full(),
()=>new did_you_know_that(),
()=>new do_di(),
()=>new excellent(),
()=>new free_will(),
()=>new guidancechip(),
()=>new information_center(),
//()=>//new it_is_broken(),
()=>new knowledge_fills_me(),
()=>new not_acceptable(),
()=>new observing(),
()=>new open_the_door(),
()=>new praise_me(),
()=>new right_away_sir(),
()=>new require_access(),
()=>new television_is_stupid(),
()=>new the_master(),
()=>new stupidity_is_enemey(),
()=>new where_is_my_mouth(),
//()=>//new who_is_it(),
()=>new yes_sir(),
()=>new yes_sir2(),
()=>new yes_sir3(),
()=>new yes_i_didnt_like_it(),
()=>new you_are_an_intruder(),
()=>new you_must_be_terminated(),
};
return a.Random()();
};
#region play
Action play = async delegate
{
if (play_disabled)
{
// what if connection breaks and audio never finishes?
// Caused by: libcore.io.ErrnoException: sendto failed: EPIPE (Broken pipe)
//at libcore.io.Posix.sendtoBytes(Native Method)
//at libcore.io.Posix.sendto(Posix.java:151)
//at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:177)
//at libcore.io.IoBridge.sendto(IoBridge.java:473)
//... 29 more
Console.WriteLine("play disabled.");
return;
}
// invader.zim.[5x01].gir.goes.crazy.and.stuff
play_disabled = true;
Console.WriteLine("play!");
//.........这里部分代码省略.........