当前位置: 首页>>代码示例>>C#>>正文


C# Func.Random方法代码示例

本文整理汇总了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!");

//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:Application.cs


注:本文中的Func.Random方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。