コード例 #1
0
        private void BtnEiUpdate_Click(object sender, EventArgs e)
        {
            Enabled = false;
            var tmp = btnEiUpdate.Text;

            btnEiUpdate.Text = "Updating ...";
            btnEiUpdate.Update();
            DialogResult res         = DialogResult.OK;
            var          progressBar = new LoadingBar("EI Update", (ct, invok, progress) =>
            {
                do
                {
                    try
                    {
                        EliteInsights.Update(initState,
                                             new Progress <double>(p => progress.Report(new ProgressMessage(p, "Update EI"))),
                                             ct).Wait();
                    }
                    catch (OperationCanceledException ex)
                    {
                        Logger.Error("Manual EI update failed");
                        Logger.LogException(ex);
                        res = MessageBox.Show("EI uppdate failed.\nMessage:\n" + ex.Message, "Error - EI Update", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    }
                } while (res == DialogResult.Retry);
            });

            progressBar.ShowDialog(this);
            btnEiUpdate.Text = tmp;
            Enabled          = true;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: bger0327/CostCutterTest
 private void  StopLoadingBar()
 {
     LoadingBar.AssociatedControl = null;
     LoadingBar.Visible           = false;
     LoadingBar.StopWaiting();
     LoadingBar.ResetWaiting();
 }
コード例 #3
0
        public static void ActuallyDoStuff(string path)
        {
            try
            {
                // start by creating the loading bar
                LoadingBar loadingBar = new LoadingBar(MainForm.instance);

                // then the background worker
                BackgroundWorker pleaseSpareMyLife = new BackgroundWorker();
                pleaseSpareMyLife.WorkerReportsProgress = true;
                pleaseSpareMyLife.ProgressChanged      += loadingBar.ReportProgress;
                pleaseSpareMyLife.DoWork += DoStuff;

                // run
                pleaseSpareMyLife.RunWorkerAsync(new SetupArgs(path, loadingBar));
            }
            catch (Exception ex)
            {
                ExceptionMessage.New(ex, true, "OneShot ModLoader will now close.");

                if (MainForm.instance.InvokeRequired)
                {
                    MainForm.instance.Invoke(new Action(() => MainForm.instance.Close()));
                }
                else
                {
                    MainForm.instance.Close();
                }
            }
        }
コード例 #4
0
    public void FinishLevel()
    {
        //CHARGE MAIN LEVEL
        LoadingBar lbar = GetComponent <LoadingBar>();

        lbar.startLoad(1);
    }
コード例 #5
0
        private IEnumerator AsyncLoadOtherScene()
        {
            string         sceneName = GetSceneName(EnumSceneType.LoadingScene);
            AsyncOperation oper      = Application.LoadLevelAsync(sceneName);

            yield return(oper);

            // message send
            if (oper.isDone)
            {
                UIManager.Instance.OpenUI(EnumUIType.PanelLoading);
                LoadingBar loadingBar = UIManager.Instance.GetUI <LoadingBar>(EnumUIType.PanelLoading);
                if (!SceneManager.Instance.IsRegisterScene(ChangeSceneType))
                {
                    Debug.LogError("没有注册次场景! " + ChangeSceneType.ToString());
                }
                loadingBar.Load(ChangeSceneType);
                loadingBar.LoadingComplete += SceneLoadCompleted;
                //GameObject go = UIManager.Instance.GetUIObject
                //GameObject go = GameObject.Find("LoadingScenePanel");
                //LoadingSceneUI loadingSceneUI = go.GetComponent<LoadingSceneUI>();
                //BaseScene scene = CurrentScene;
                //if (null != scene)
                //{
                //    scene.CurrentScendId = ChangeSceneId;
                //}
                //// 检测是否注册该场景
                //if (!SceneManager.Instance.IsRegisterScene(ChangeSceneId))
                //{
                //    Debug.LogError("没有注册次场景! " + ChangeSceneId.ToString());
                //}
                //loadingSceneUI.Load(ChangeSceneId);
                //loadingSceneUI.LoadCompleted += SceneLoadCompleted;
            }
        }
コード例 #6
0
        public void LoadMods(string modsDirectory)
        {
            List <string> modDirectories = Directory.GetDirectories(modsDirectory).ToList();

            LoadingBar.Load(modDirectories.Map(modDirectory => {
                ModInfo modInfo   = null;
                Assembly assembly = null;

                return(new Task($"Загружаем моды: мод из папки {modDirectory}", () => {
                    MyConsole.MoveCursorDown(3);
                    LoadingBar.Load(
                        new Task($"Загружаем JSON для мода из папки {modDirectory}...", () => {
                        string modJSON = $"{modDirectory}/mod.json";
                        modInfo = JsonConvert.DeserializeObject <ModInfo>(File.ReadAllText(modJSON));
                        modInfo.modDirectory = modDirectory;
                    }),
                        new Task(() => $"Загружаем код для мода '{modInfo.name}'", () => {
                        assembly = Assembly.LoadFrom($"{modDirectory}/{modInfo.dllName}");
                    }),
                        new Task(() => $"Инициализируем мод '{modInfo.name}...'", () => {
                        Type modDescriptorType = assembly.GetType(modInfo.descriptorClass);
                        ConstructorInfo modDescriptorConstructor = modDescriptorType.GetConstructor(new[] { typeof(ModInfo) });
                        var modDescriptor = (ModDescriptor)modDescriptorConstructor.Invoke(new[] { modInfo });
                        modDescriptors.Add(modDescriptor);

                        MyConsole.MoveCursorDown(3);
                        modDescriptor.OnLoadBy(this);
                        MyConsole.MoveCursorUp(3);
                    })
                        );
                    MyConsole.MoveCursorUp(3);
                }));
            }));
        }
コード例 #7
0
        public async void AuthenticationModalClosed()
        {
            if (!string.IsNullOrEmpty(App.ReddeTT.Code))
            {
                LoadingLabel.Text = "Getting token...";
                await LoadingBar.ProgressTo(0.5, 750, Easing.Linear);

                var tokenTask = App.ReddeTT.GetToken(App.ReddeTT.Code);
                await tokenTask.ContinueWith(async task1 =>
                {
                    if (App.ReddeTT.IsAuthenticated)
                    {
                        var userTask = App.ReddeTT.GetCurrentUser();
                        await userTask.ContinueWith(task2 =>
                        {
                            Device.BeginInvokeOnMainThread(async() => {
                                LoadingLabel.Text = "Done!";
                                await LoadingBar.ProgressTo(1.0, 750, Easing.Linear);
                                await Task.Delay(500);

                                Application.Current.MainPage = new NavigationPage(new BasicInitPage())
                                {
                                    BarBackgroundColor = Color.FromHex("#e74c3c"),
                                    BarTextColor       = Color.White
                                };
                            });
                        });
                    }
                });
            }
            else
            {
                await Navigation.PushModalAsync(new AuthenticationPage(), true);
            }
        }
コード例 #8
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            Mainpage    = this;
            App.ReddeTT = new API.ReddeTT();
            if (!App.ReddeTT.IsAuthenticated)
            {
                LoadingLabel.Text = "Authenticating...";
                await LoadingBar.ProgressTo(0.2, 750, Easing.Linear);

                await Navigation.PushModalAsync(new AuthenticationPage(), true);
            }
            else
            {
                if (App.ReddeTT.IsExpired)
                {
                    LoadingLabel.Text = "Getting refresh token...";
                    await LoadingBar.ProgressTo(0.5, 750, Easing.Linear);

                    var tokenTask = App.ReddeTT.RefreshAccessToken();
                    await tokenTask.ContinueWith(task =>
                    {
                        GetUserData();
                    });
                }
                else
                {
                    GetUserData();
                }
            }
        }
コード例 #9
0
ファイル: Main.cs プロジェクト: dmitmel/ASCIIWars
        static void DoLoading()
        {
            Task[] realTasks =
            {
                new Task("Загружаем ассеты...",                () => {
                    Assets = new AssetContainer("assets");
                }),
                new Task("Загружаем классическую кампанию...", () => {
                    MyConsole.MoveCursorDown(3);
                    Campaigns.Add(Campaign.LoadFrom(Assets,    "classic-campaign"));
                    MyConsole.MoveCursorUp(3);
                }),
                new Task("Загружаем моды...",                  () => {
                    MyConsole.MoveCursorDown(3);
                    ModLoader.LoadMods("mods");
                    MyConsole.MoveCursorUp(3);
                })
            };

#if DEBUG
            LoadingBar.Load(realTasks);
#else
            Task[] funnyTasks = FunnyTasksLoader.Load();
            Task[] allTasks   = realTasks.Concat(funnyTasks).ToArray();
            LoadingBar.Load(allTasks);
#endif
        }
コード例 #10
0
ファイル: SceneMove.cs プロジェクト: AnsirH/ElementMagician
    IEnumerator ChangeScene(string sceneName)
    {
        canvasAnim.SetTrigger("Fade_Out");

        yield return(new WaitForSeconds(1.5f));

        LoadingBar.LoadScene(sceneName);
    }
コード例 #11
0
 private void Loadings()
 {
     LoadingBar.Value = 0;
     Loading.Show();
     LoadingBar.Show();
     loadingText.Show();
     Timer.Start();
 }
コード例 #12
0
ファイル: ChummerTest.cs プロジェクト: Stexinator/chummer5a
        public void Test02_LoadContent()
        {
            Debug.WriteLine("Unit test initialized for: Test02_LoadContent()");
            try
            {
                bool blnTemp = Utils.IsUnitTestForUI;
                try
                {
                    Utils.IsUnitTestForUI = true;
                    // Attempt to cache all XML files that are used the most.
                    using (LoadingBar frmLoadingBar = Program.CreateAndShowProgressBar(Application.ProductName, Utils.BasicDataFileNames.Count))
                    {
                        List <Task> lstCachingTasks = new List <Task>(Utils.MaxParallelBatchSize);
                        int         intCounter      = 0;
                        foreach (string strLoopFile in Utils.BasicDataFileNames)
                        {
                            // ReSharper disable once AccessToDisposedClosure
                            lstCachingTasks.Add(Task.Run(() => CacheCommonFile(strLoopFile, frmLoadingBar)));
                            if (++intCounter != Utils.MaxParallelBatchSize)
                            {
                                continue;
                            }
                            Utils.RunWithoutThreadLock(() => Task.WhenAll(lstCachingTasks));
                            lstCachingTasks.Clear();
                            intCounter = 0;
                        }

                        Utils.RunWithoutThreadLock(() => Task.WhenAll(lstCachingTasks));

                        async Task CacheCommonFile(string strFile, LoadingBar frmLoadingBarInner)
                        {
                            // Load default language data first for performance reasons
                            if (!GlobalSettings.Language.Equals(
                                    GlobalSettings.DefaultLanguage, StringComparison.OrdinalIgnoreCase))
                            {
                                await XmlManager.LoadXPathAsync(strFile, null, GlobalSettings.DefaultLanguage);
                            }
                            await XmlManager.LoadXPathAsync(strFile);

                            await frmLoadingBarInner.PerformStepAsync(
                                Application.ProductName,
                                LoadingBar.ProgressBarTextPatterns.Initializing);
                        }
                    }
                }
                finally
                {
                    Utils.IsUnitTestForUI = blnTemp;
                }

                _lstCharacters.Capacity = GetTestCharacters().ToList().Count; // Dummy command used purely to initialize CharacterList
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
コード例 #13
0
 // Use this for initialization
 void Start()
 {
     Camera.transform.position = new Vector3(0.0f, 1.0f, 0.0f);
     Bar = GetComponent <LoadingBar>();
     Bar.OnReachMaximum += Bar_OnReachMaximum;
     tower = new List <GameObject>();
     RebuildTower();
     test = true;
 }
コード例 #14
0
ファイル: LoadSceneMgr.cs プロジェクト: 737871854/FireMen2
 public void Init(GameObject load)
 {
     if (load == null)
     {
         Debug.LogError("There is not LoadScene");
         return;
     }
     m_bar = load.AddComponent <LoadingBar>();
     GameObject.DontDestroyOnLoad(load);
 }
コード例 #15
0
 // Start is called before the first frame update
 void Start()
 {
     loadingBar = GetComponentInChildren <LoadingBar>();
     myRenderer = GetComponentInChildren <SpriteRenderer>();
     if (loadingBar == null || myRenderer == null)
     {
         throw new System.Exception("Task not set up properly");
     }
     loadingBar.gameObject.SetActive(false);
 }
コード例 #16
0
 public MainWindow(
     GeneralMenu generalMenu,
     JobsMenu jobsMenu,
     OutputWindow outputWindow,
     LoadingBar loadingBar)
 {
     this.generalMenu  = generalMenu;
     this.jobsMenu     = jobsMenu;
     this.outputWindow = outputWindow;
     this.loadingBar   = loadingBar;
 }
コード例 #17
0
        public override void Initialize()
        {
            ScreenTimer = new Timer(5);
            AddtoList(ScreenTimer);

            WrapperState State = new WrapperState(0, 1, 0, Vector2.Zero, Color.White, Vector2.Zero);

            loadingBar = new LoadingBar(State, @"Screens/LoadingScreen/LoadingBackGround", @"Screens/LoadingScreen/LoadingCover");
            AddtoList(loadingBar);

            base.Initialize();
        }
コード例 #18
0
        protected override void OnEnvironmentClose()
        {
            Application.UserInterfaceManager.UserInteractionDisabled = true;
            var loadingBar = new LoadingBar("Closing Export Environment...");

            loadingBar.SetProgress(new ProgressUpdate("Saving Robot Data...", 3, 5));
            loadingBar.Show();
            RobotDataManager.SaveRobotData(OpenAssemblyDocument);
            loadingBar.Close();
            Application.UserInterfaceManager.UserInteractionDisabled = false;

            if (!RobotDataManager.wasForceQuit)
            {
                var exportResult = MessageBox.Show(new Form {
                    TopMost = true
                },
                                                   "The robot configuration has been saved to your assembly document.\nWould you like to export your robot to Synthesis?",
                                                   "Robot Configuration Complete",
                                                   MessageBoxButtons.YesNo);

                if (exportResult == DialogResult.Yes)
                {
                    UnsupportedComponentsForm.CheckUnsupportedComponents(RobotDataManager.RobotBaseNode.ListAllNodes());
                    if (ExportForm.PromptExportSettings(RobotDataManager))
                    {
                        if (RobotDataManager.ExportRobot())
                        {
                            AnalyticsUtils.LogEvent("Export", "Succeeded");
                            if (Instance.AddInSettingsManager.OpenSynthesis)
                            {
                                SynthesisUtils.OpenSynthesis(RobotDataManager.RobotName);
                            }
                        }
                        else
                        {
                            AnalyticsUtils.LogEvent("Export", "Cancelled");
                        }
                    }
                }
            }

            // Re-enable disabled components
            if (disabledAssemblyOccurrences != null)
            {
                InventorUtils.EnableComponents(disabledAssemblyOccurrences);
            }
            disabledAssemblyOccurrences = null;

            advancedJointEditor.DestroyDockableWindow();
            guideManager.DestroyDockableWindow();
            jointViewKey.DestroyDockableWindow();
            AnalyticsUtils.EndSession();
        }
コード例 #19
0
 /// <summary>
 ///  Adds a LoadingBar service to the specified Microsoft.Extensions.DependencyInjection.IServiceCollection.
 /// </summary>
 /// <param name="services">The Microsoft.Extensions.DependencyInjection.IServiceCollection to add the service to.</param>
 public static void AddLoadingBar(this IServiceCollection services, Action <LoadingBarOptions> configure)
 {
     services.AddHttpClientInterceptor();
     services.TryAddSingleton(sp =>
     {
         var loadingBar = new LoadingBar(
             sp.GetService <HttpClientInterceptor>(),
             sp.GetService <IJSRuntime>());
         configure?.Invoke(loadingBar.Options);
         return(loadingBar);
     });
 }
コード例 #20
0
 private void Start()
 {
     //Make sure it's only one (singleton)
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance == this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
コード例 #21
0
 public void Print(IList<TrackData> allData)
 {
     var numberOfTracks = allData.Count;
     InitialiseGraphics(numberOfTracks);
     var lb = new LoadingBar("Rendering", numberOfTracks);
     lb.Start();
     for (int track = 0; track < numberOfTracks; track++)
     {
         RenderTrackSwatch(allData[track], track);
         lb.Next();
     }
     SaveSwatchToFile();
 }
コード例 #22
0
ファイル: Form2.cs プロジェクト: Ahmadkz/VP-Project
//===============================Progress bar function=======================================//

        private void LoadingBar_Click(object sender, EventArgs e)
        {
            Form3 obj4 = new Form3();

            LoadingBar.Increment(8);
            label1.Text = "LOADING  " + LoadingBar.Value.ToString() + "%";
            if (LoadingBar.Value == LoadingBar.Maximum)
            {
                time.Stop();
                obj4.Show();
                this.Close();
            }
        }
コード例 #23
0
ファイル: AllAnalysis.cs プロジェクト: EJLarcs/chromesthesia
 public void Analyse(IOutputType outputType)
 {
     int maxTrackId = int.Parse(ConfigurationManager.AppSettings["NumTracks"]);
     var allData = new List<TrackData>();
     var loadingBar = new LoadingBar("Fetching Data", maxTrackId);
     loadingBar.Start();
     for (int trackId = 0; trackId < maxTrackId; trackId++)
     {
         allData.Add(ParseApi.GetResultsFor(trackId));
         loadingBar.Next();
     }
     outputType.Print(allData);
 }
コード例 #24
0
ファイル: MapScreen.cs プロジェクト: jaycin/OmniRax-TD
        protected override void LoadContent()
        {
            content = GameRef.Content;
            base.LoadContent();
            previewMap   = new Dictionary <int, Texture2D>();
            previewTower = new Dictionary <int, Texture2D>();

            previewMap.Add(0, content.Load <Texture2D>(@"MapParts\Map1_2"));
            previewTower.Add(0, content.Load <Texture2D>(@"Towers\TowerIdleFire"));
            previewTower.Add(1, content.Load <Texture2D>(@"Towers\Lt"));
            Overlay    = content.Load <Texture2D>(@"UI Content\MapScreen\MapScreenOverLay");
            objManager = new ObjectManager(base.menuFont);
            //stagePreview = new StageBox(content.Load<Texture2D>(@"UI Content\Login\StartMenuBackRound"), new Rectangle(100, 100, GameRef.ScreenRectangle.Width - 200, GameRef.ScreenRectangle.Height - 200)
            //, previewMap, previewTower, "JARRYD PLACE TEXT HERE",content.Load<SpriteFont>(@"Fonts\Descriptionfont"),0,objManager);
            texExit   = content.Load <Texture2D>(@"Ui Content\GamePlay\Exit");
            statusBar = content.Load <Texture2D>(@"UI Content\Buttons_2");

            pbExit = new PictureBox(texExit, new Rectangle(GameRef.ScreenRectangle.Width - texExit.Width / 2 - 70, 0, 70, 70), 1, 1, 1);
            pbExit.obj_Selected  += new EventHandler(pbExit_obj_Selected);
            pbExit.obj_MouseOver += new EventHandler(pbExit_obj_MouseOver);
            pbExit.obj_Leave     += new EventHandler(pbExit_obj_Leave);
            backgroundImage       = content.Load <Texture2D>(@"UI Content\MapScreen\EnterNameMap");
            startButton           = content.Load <Texture2D>(@"UI Content\BoxStart");

            Xblock = content.Load <Texture2D>(@"UI Content\back");


            loadBar                = new LoadingBar(statusBar, 3, 1, new Vector2(GameRef.ScreenRectangle.Width / 2 - statusBar.Width / 2, GameRef.ScreenRectangle.Height - statusBar.Height * 2), 1);
            loadBar.Visable        = false;
            cPlotPosition          = new PlotPosition();
            cPlotPosition.Position = new List <Vector2>();

            LoadPlotPostion();

            pbOverlay = new PictureBox(Overlay, GameRef.ScreenRectangle, 1, 1, 0);

            objManager.AddLst.Add(new PictureBox(backgroundImage, new Rectangle(0, 0, GameRef.ScreenRectangle.Width, GameRef.ScreenRectangle.Height - 30), 0));
            objManager.AddLst.Add(pbOverlay);
            objManager.AddLst.Add(pbExit);
            objManager.AddLst.Add(loadBar);



            placeLock       = false;
            plotTexture     = false;
            DevelopmentMode = false;

            keepUpdating = new Task(new Action(LoadingScreen));

            AddPlots();
        }
コード例 #25
0
        protected override void OnEnvironmentOpen()
        {
            AnalyticsUtils.StartSession();

            Application.UserInterfaceManager.UserInteractionDisabled = true;
            var loadingBar = new LoadingBar("Loading Export Environment...");

            loadingBar.SetProgress(new ProgressUpdate("Preparing UI Managers...", 1, 10));
            loadingBar.Show();
            HighlightManager.EnvironmentOpening(OpenAssemblyDocument);

            // Disable non-jointed components
            disabledAssemblyOccurrences = new List <ComponentOccurrence>();
            disabledAssemblyOccurrences.AddRange(InventorUtils.DisableUnconnectedComponents(OpenAssemblyDocument));

            loadingBar.SetProgress(new ProgressUpdate("Loading Robot Skeleton...", 2, 10));
            // Load robot skeleton and prepare UI
            RobotDataManager = new RobotDataManager();
            if (!RobotDataManager.LoadRobotSkeleton(new Progress <ProgressUpdate>(loadingBar.SetProgress)))
            {
                loadingBar.Close();
                Application.UserInterfaceManager.UserInteractionDisabled = false;
                InventorUtils.ForceQuitExporter(OpenAssemblyDocument);
                return;
            }

            if (RobotDataManager.wasForceQuit)
            {
                return;
            }

            loadingBar.SetProgress(new ProgressUpdate("Loading Joint Data...", 7, 10));
            RobotDataManager.LoadRobotData(OpenAssemblyDocument);

            loadingBar.SetProgress(new ProgressUpdate("Initializing UI...", 8, 10));
            // Create dockable window UI
            var uiMan = Application.UserInterfaceManager;

            advancedJointEditor.CreateDockableWindow(uiMan);
            jointViewKey.Init(uiMan);
            guideManager.Init(uiMan);

            guideManager.Visible = AddInSettingsManager.ShowGuide;

            loadingBar.SetProgress(new ProgressUpdate("Loading Robot Skeleton...", 9, 10));
            // Load skeleton into joint editors
            advancedJointEditor.LoadRobot(RobotDataManager);
            jointEditorForm.LoadRobot(RobotDataManager);
            loadingBar.Close();
            Application.UserInterfaceManager.UserInteractionDisabled = false;
        }
コード例 #26
0
ファイル: EditView.cs プロジェクト: sando87/PingPong
    IEnumerator LoadingProcess(string filename)
    {
        LoadingBar loading = LoadingBar.Show(true);
        //loading.SetProgress(0);
        string url = "file://" + filename;

        using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.MPEG))
        {
            yield return(www.SendWebRequest());

            //loading.SetProgress(0.3f);

            if (www.isNetworkError)
            {
                Debug.Log(www.error);
            }
            else
            {
                AudioClip audioClip = DownloadHandlerAudioClip.GetContent(www);
                mAudioSrc.clip   = audioClip;
                mAudioSrc.volume = 0.5f;

                //loading.SetProgress(0.5f);
                yield return(null);

                // DetectBPM(audioClip);
                IEnumDetectBPM detector = new IEnumDetectBPM(audioClip);
                yield return(detector);

                int bpm = detector.BPM;
                //loading.SetProgress(0.7f);

                float start = 0.5f;
                float end   = audioClip.length;
                mPanelBpmDelay.transform.Find(OBJECT_NAME_BPM).GetComponent <InputField>().text   = bpm.ToString();
                mPanelBpmDelay.transform.Find(OBJECT_NAME_START).GetComponent <InputField>().text = start.ToString();
                mPanelBpmDelay.transform.Find(OBJECT_NAME_END).GetComponent <InputField>().text   = end.ToString();
                mCustomTP.Initialize(bpm, start, end);
                mCustomTP.CreateRandomTPs(false);

                mPanelBpmDelay.SetActive(true);
                mPanelTPs.SetActive(true);
                mPanelFunctions.SetActive(true);

                yield return(null);
                //loading.SetProgress(1.0f);
            }
        }
        loading.Hide();
    }
コード例 #27
0
    // Use this for initialization
    void Start()
    {
        bar = this;
        slider = gameObject.GetComponent<UISlider>();
        label = gameObject.GetComponentInChildren<UILabel>();
        sprites = gameObject.GetComponentsInChildren<UISprite>();

        background.alpha = 0;
        label.text = "";
        foreach(UISprite obj in sprites)
        {
            obj.alpha = 0f;
        }
    }
コード例 #28
0
 void UpdateUI(float progress)
 {
     foreach (var LoadingBar in LoadingBarList)
     {
         if (LoadingBar.GetComponent <Image>() != null)
         {
             LoadingBar.GetComponent <Image>().fillAmount = progress;
         }
         else if (LoadingBar.GetComponent <Text>() != null)
         {
             LoadingBar.GetComponent <Text>().text = (int)(progress * 100) + " %";
         }
     }
 }
コード例 #29
0
        /// <summary>
        /// Creates a scene in the current project that acts as a loading scene until assetbundles are
        /// downloaded from the CDN. Takes in a loadingScreenImagePath, a path to the image shown in the loading scene,
        /// and an assetbundle URL. Replaces the current loading scene with a new one if it exists.
        /// </summary>
        public static void GenerateScene(string assetBundleUrl, string loadingScreenImagePath)
        {
            if (string.IsNullOrEmpty(assetBundleUrl))
            {
                throw new ArgumentException("AssetBundle URL text field cannot be null or empty.");
            }

            if (!File.Exists(loadingScreenImagePath))
            {
                throw new FileNotFoundException(string.Format("Loading screen image file cannot be found: {0}",
                                                              loadingScreenImagePath));
            }

            // Removes the loading scene if it is present, otherwise does nothing.
            EditorSceneManager.CloseScene(SceneManager.GetSceneByName(Path.GetFileNameWithoutExtension(SceneName)),
                                          true);

            var loadingScreenScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Additive);

            var loadingScreenGameObject = new GameObject(CanvasName);

            AddImageToScene(loadingScreenGameObject, loadingScreenImagePath);

            AddScript(loadingScreenGameObject);

            LoadingBar.AddComponent(loadingScreenGameObject);

            bool saveOk = EditorSceneManager.SaveScene(loadingScreenScene, SceneFilePath);

            if (!saveOk)
            {
                // Not a fatal issue. User can attempt to resave this scene.
                var warningMessage = string.Format("Issue while saving scene {0}.",
                                                   SceneName);

                Debug.LogWarning(warningMessage);

                DialogHelper.DisplayMessage(SaveErrorTitle, warningMessage);
            }
            else
            {
                //TODO: investigate GUI Layout errors that occur when moving this to DialogHelper
                if (EditorUtility.DisplayDialog("Change Scenes in Build",
                                                "Would you like to replace any existing Scenes in Build with the loading screen scene?", "Yes",
                                                "No"))
                {
                    SetMainSceneInBuild(SceneFilePath);
                }
            }
        }
コード例 #30
0
        public void Analyse(IOutputType outputType)
        {
            int maxTrackId = int.Parse(ConfigurationManager.AppSettings["NumTracks"]);
            var allData    = new List <TrackData>();
            var loadingBar = new LoadingBar("Fetching Data", maxTrackId);

            loadingBar.Start();
            for (int trackId = 0; trackId < maxTrackId; trackId++)
            {
                allData.Add(ParseApi.GetResultsFor(trackId));
                loadingBar.Next();
            }
            outputType.Print(allData);
        }
コード例 #31
0
        public void Print(IList <TrackData> allData)
        {
            var numberOfTracks = allData.Count;

            InitialiseGraphics(numberOfTracks);
            var lb = new LoadingBar("Rendering", numberOfTracks);

            lb.Start();
            for (int track = 0; track < numberOfTracks; track++)
            {
                RenderTrackSwatch(allData[track], track);
                lb.Next();
            }
            SaveSwatchToFile();
        }
コード例 #32
0
 public void ShowProgressNonModal(bool show)
 {
     if (show)
     {
         UIApplication.SharedApplication.InvokeOnMainThread(() => {
             LoadingBar.Show();
         });
     }
     else
     {
         UIApplication.SharedApplication.InvokeOnMainThread(() => {
             LoadingBar.Hide();
         });
     }
 }
コード例 #33
0
    // Use this for initialization
    void Start()
    {
        texts.Add(GameObject.Find(gameObject.name + "/Panel/Canvas/Provider").GetComponent <Text>());
        texts.Add(GameObject.Find(gameObject.name + "/Panel/Canvas/Latitude").GetComponent <Text>());
        texts.Add(GameObject.Find(gameObject.name + "/Panel/Canvas/Longitude").GetComponent <Text>());
        texts.Add(GameObject.Find(gameObject.name + "/Panel/Canvas/Altitude").GetComponent <Text>());
        texts.Add(GameObject.Find(gameObject.name + "/Panel/Canvas/Time").GetComponent <Text>());
        texts.Add(GameObject.Find(gameObject.name + "/Panel/Canvas/Status").GetComponent <Text>());
        texts.Add(GameObject.Find(gameObject.name + "/Panel/Canvas Right/DistanceWalked").GetComponent <Text>());
        texts.Add(GameObject.Find(gameObject.name + "/Panel/Canvas Right/CameraPosition").GetComponent <Text>());
        texts.Add(GameObject.Find(gameObject.name + "/Panel/Canvas Right/MagneticSensor").GetComponent <Text>());

        locationProvider = ARLocationProvider.Instance;

        accuracyBar = GameObject.Find(gameObject.name + "/Panel/Canvas/LoadingBar").GetComponent <LoadingBar>();
    }