Exemplo n.º 1
0
        void Start()
        {
            switch (Application.platform)
            {
            case RuntimePlatform.Android:
            case RuntimePlatform.IPhonePlayer:
                Screen.SetResolution(640, 960, true);
                break;

            default:
                Screen.SetResolution(640, 960, false);
                break;
            }

            Preload preload = GetComponent <Preload>();

            preload.onProgress += (float progress, long totalSize) =>
            {
                //转换为MB
                float totalMB  = totalSize / 1024 / 1024f;
                float loadedMB = totalMB * progress;
                textProgress.text = string.Format("{0}% [{1}MB/{2}MB]", (int)(progress * 100f), loadedMB.ToString("0.00"), totalMB.ToString("0.00"));

                //Log.I("Preload State:{0} Progress:{1} TotalSize:{2}", preload.CurrentState, progress, totalSize);
            };

            preload.onStateChange += (state) =>
            {
                textState.text = state.ToString();
            };

            //从这里启动Ppreload
            GetComponent <Preload>().StartPreload();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Preload and initialize objects that take a longer time to load. This way we create a more responsive application.
        /// </summary>
        private void ExecutePreloaders()
        {
            Preload preload =
                delegate()
            {
                try
                {
                    if (null != ApplicationModelConfiguration.Configuration)
                    {
                        var preloaders = ApplicationModelConfiguration.Configuration.Server.Environments[0].Preloaders;

                        foreach (Preloader preloader in preloaders)
                        {
                            try
                            {
                                // Grab the type that has the static method
                                Type type = Type.GetType(preloader.Type);

                                // Grab the specific static method
                                MethodInfo methodInfo = type.GetMethod(preloader.Method, BindingFlags.Static | BindingFlags.Public);

                                // Execute the method
                                methodInfo.Invoke(null, null);
                            }
                            finally { /* IGNORE */ }
                        }
                    }
                }
                finally { }
            };

            IAsyncResult result = preload.BeginInvoke(null, null);
        }
Exemplo n.º 3
0
        void Start()
        {
            //switch (Application.platform)
            //{
            //    case RuntimePlatform.Android:
            //    case RuntimePlatform.IPhonePlayer:
            //        Screen.SetResolution(640, 960, true);
            //        break;
            //    default:
            //        Screen.SetResolution(640, 960, false);
            //        break;
            //}

            SetProgress(0, 1);
            Preload preload = GetComponent <Preload>();

            preload.onProgress += SetProgress;

            preload.onStateChange += (state) =>
            {
                textState.text = state.ToString();
            };

            //从这里启动Ppreload
            GetComponent <Preload>().StartPreload();
        }
Exemplo n.º 4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Thread T = new Thread(() => {
                Preload PT = new Preload();
                PT.PreloadThings();
            });

            T.Start();
        }
        //void InitEvent()
        //{
        //    EventHandler<ModalPushedEventArgs> push = (obj, e) => m_preload.SetWaitModePage();

        //    Pixiv.App.Current.ModalPushed += push;

        //    EventHandler<ModalPoppedEventArgs> pop = (obj, e) => m_preload.SetNotWaitModePage();

        //    Pixiv.App.Current.ModalPopped += pop;

        //}

        void Start()
        {
            MainThread.BeginInvokeOnMainThread(() =>
            {
                m_preload = Preload.Create(InputData.CreateSelectFunc(), ConstInfo.PIXIVDATA_PRELOAD_COUNT, ConstInfo.SMALL_IMG_PERLOAD_COUNT, ConstInfo.SMALL_IMG_RESPONSE_SIZE, new TimeSpan(0, 0, ConstInfo.SMALL_IMG_TIMEOUT));

                var t = m_preload.While((data) => MainThread.InvokeOnMainThreadAsync(() => SetImage(data, InputData.AddItemTimeSpan)));

                Log.Write("reload", t);
            });
        }
Exemplo n.º 6
0
        public void Start()
        {
            T = new Thread(() =>
            {
                if (ConfUCS.IsConsoleMode)
                {
                    Console.Title = ConfUCS.UnivTitle;
                }
                this.CancelEvent(); // N00b proof

                /* ASCII Art centered */
                Console.WriteLine(@" 
_________  .__                   .__     
\_   ___ \ |  |  _____     ______|  |__  
/    \  \/ |  |  \__  \   /  ___/|  |  \ 
\     \____|  |__ / __ \_ \___ \ |   Y  \
 \______  /|____/(____  //____  >|___|  /
        \/            \/      \/      \/ 
__________                        .__           
\______   \  ____  ___.__._____   |  |    ____  
 |       _/ /  _ \<   |  |\__  \  |  |  _/ __ \ 
 |    |   \(  <_> )\___  | / __ \_|  |__\  ___/ 
 |____|_  / \____/ / ____|(____  /|____/ \___  >
        \/         \/          \/            \/ 
  _________               .__         
 /   _____/______ _____   |__|  ____  
 \_____  \ \____ \\__  \  |  | /    \ 
 /        \|  |_> >/ __ \_|  ||   |  \
/_______  /|   __/(____  /|__||___|  /
        \/ |__|        \/          \/ 
");

                Console.WriteLine("Starting the server...");
                Preload PT = new Preload();
                PT.PreloadThings();
                ControlTimer.StartPerformanceCounter();
                Console.WriteLine(string.Empty);
                Debugger.SetLogLevel(int.Parse(ConfigurationManager.AppSettings["loggingLevel"]));
                Logger.SetLogLevel(int.Parse(ConfigurationManager.AppSettings["loggingLevel"]));
                NetworkThread.Start();
                MemoryThread.Start();
                ConfUCS.UnivTitle = "Ultrapowa Clash Server " + ConfUCS.VersionUCS + " | " + "ONLINE";
                if (ConfUCS.IsConsoleMode)
                {
                    CommandParser.ManageConsole();
                }
            });
            T.SetApartmentState(ApartmentState.STA);
            T.Start();
        }
Exemplo n.º 7
0
        void Start()
        {
            Preload preload = GetComponent <Preload>();

            preload.onProgress += (float progress) =>
            {
                textProgress.text = string.Format("{0}%", (int)(progress * 100f));
            };

            preload.onStateChange += (string state) =>
            {
                textState.text = state;
            };
        }
Exemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     duLieu = new DuLieuNguoiChoi();
     Global = this;
     duLieu = (DuLieuNguoiChoi)XuLyFile <DuLieuNguoiChoi>(Application.streamingAssetsPath, "DuLieuNguoiChoi.xml", duLieu);
     for (int i = 0; i < duLieu.tuongDaCo.Length; i++)
     {
         if (duLieu.tuongDaCo[i] == 1)
         {
             vitriTuongDangCo.Add(i);
         }
     }
     UnityEngine.SceneManagement.SceneManager.LoadScene("MainMenu");
 }
Exemplo n.º 9
0
        public void Start()
        {
            T = new Thread(() =>
            {
                if (ConfUCS.IsConsoleMode)
                {
                    Console.Title = ConfUCS.UnivTitle;
                }
                CancelEvent(); //N00b proof

                /* ASCII Art centered */
                Console.WriteLine(
                    @"
                    888     888  .d8888b.   .d8888b.  
                    888     888 d88P  Y88b d88P  Y88b 
                    888     888 888    888 Y88b.      
                    888     888 888         ""Y888b.   
                    888     888 888            ""Y88b. 
                    888     888 888    888       ""888 
                    Y88b. .d88P Y88b  d88P Y88b  d88P 
                     ""Y88888P""   ""Y8888P""   ""Y8888P""  
                  ");

                Console.WriteLine("Ultrapowa Clash Server");
                Console.WriteLine("Visit www.ultrapowa.com | www.shard.site");
                Console.WriteLine("Starting the server...");
                Preload PT = new Preload();
                PT.PreloadThings();
                ControlTimer.StartPerformanceCounter();
                Console.WriteLine("");
                Debugger.SetLogLevel(int.Parse(ConfigurationManager.AppSettings["loggingLevel"]));
                Logger.SetLogLevel(int.Parse(ConfigurationManager.AppSettings["loggingLevel"]));
                NetworkThread.Start();
                MemoryThread.Start();
                ConfUCS.UnivTitle = "Ultrapowa Clash Server " + ConfUCS.VersionUCS + " | " + "ONLINE";
                if (ConfUCS.IsConsoleMode)
                {
                    CommandParser.ManageConsole();
                }
            });
            T.SetApartmentState(ApartmentState.STA);
            T.Start();
        }
Exemplo n.º 10
0
 public static void AddPreload(this SupportPreloadAttribute tag, Preload preload)
 {
     tag.AddAttribute("preload", preload.LiteralValue());
 }
Exemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     m_Instance             = this;
     m_LoadingScene.enabled = true;
 }
Exemplo n.º 12
0
 override protected void Awake()
 {
     base.Awake();
     Preload.Preloading();
 }
Exemplo n.º 13
0
 public static HTMLBuilder <X, Y> Preload <X, Y>(this HTMLBuilder <X, Y> builder, Preload preload)
     where X : Tag, SupportPreloadAttribute
     where Y : HTMLBuilder
 {
     builder.CurrentTag.AddPreload(preload);
     return(builder);
 }
Exemplo n.º 14
0
 private void OnEnable()
 {
     _target = target as Preload;
     _vo     = _target.runtimeCfg;
 }
Exemplo n.º 15
0
 public PreloadTask(GadgetContext context, Preload preload, String key)
 {
     this.context = context;
     this.preload = preload;
     this.key     = key;
 }