예제 #1
0
파일: Progress.cs 프로젝트: HzrdIRL/ECO
    // Update is called once per frame
    void Update()
    {
        //Progress Seasons
        if (GameManager.instance.dialogStage >= (int)DialogueStages.ActivatedSpring)
        {
            PanelSpring.SetActive(true);
        }
        if (GameManager.instance.dialogStage >= (int)DialogueStages.ActivatedSummer)
        {
            PanelSummer.SetActive(true);
        }
        if (GameManager.instance.dialogStage >= (int)DialogueStages.ActivatedAutumn)
        {
            PanelAutumn.SetActive(true);
        }
        if (GameManager.instance.dialogStage >= (int)DialogueStages.ActivatedWinter)
        {
            PanelWinter.SetActive(true);
        }

        //ProgressBar
        if (bioMatterHub.bioMatter >= 100)
        {
            ProgressBar1.SetActive(true);
        }
        else
        {
            ProgressBar1.SetActive(false);
        }
        if (bioMatterHub.bioMatter >= 200)
        {
            ProgressBar2.SetActive(true);
        }
        else
        {
            ProgressBar2.SetActive(false);
        }
        if (bioMatterHub.bioMatter >= 300)
        {
            ProgressBar3.SetActive(true);
        }
        else
        {
            ProgressBar3.SetActive(false);
        }
        if (bioMatterHub.bioMatter >= 400)
        {
            ProgressBar4.SetActive(true);
        }
        else
        {
            ProgressBar4.SetActive(false);
        }
        if (bioMatterHub.bioMatter >= 500)
        {
            ProgressBar5.SetActive(true);
            if (GameManager.instance.dialogStage >= (int)DialogueStages.ActivatedWinter && !GameManager.instance.gameIsOver)
            {
                GameManager.instance.dialogue.endGame();
                GameManager.instance.gameIsOver = true;
            }
        }
        else
        {
            ProgressBar5.SetActive(false);
        }
    }
예제 #2
0
        public void startrun4()
        {
            OnRun++;
            sd4.Visibility = System.Windows.Visibility.Visible;
            sp4.Visibility = System.Windows.Visibility.Visible;

            this.Height += 74;
            ProcessStartInfo startUWG = new ProcessStartInfo();

            //startUWG.FileName = "C:\\Users\\anakano\\Documents\\Research\\UWG2.1\\For_Installer\\UWGv2.0.exe";
            startUWG.FileName = "UWGEngine.exe";
            //make sure there is space in between each of the four inputs and that folder extension ends with \\
            startUWG.Arguments = ep + "\\ " + ef4 + " " + xp4 + "\\ " + xf4 + " " + rp + "\\ " + rf4 + " " + mon + " " + day + " " + dur;
            //startUWG.Arguments = this.epwPath + this.epwFileName + this.xmlPath + this.xmlFilename;
            startUWG.UseShellExecute        = false;
            startUWG.CreateNoWindow         = true;
            startUWG.RedirectStandardOutput = true;
            double maxx = System.Convert.ToDouble(dur);

            ProgressBar4.Maximum = System.Convert.ToDouble(dur);
            UWGs4  = Process.Start(startUWG);
            UWGst4 = 1;
            UWGs4.EnableRaisingEvents = true;
            UWGs4.Exited += new EventHandler(onClose);
            StreamReader UWGreader = UWGs4.StandardOutput;

            new Thread(() =>
            {
                String UWGreaderst;
                int value = 0;
                while (!UWGreader.EndOfStream)
                {
                    UWGreaderst = UWGreader.ReadLine();
                    this.Dispatcher.Invoke(new Action(() =>
                    {
                        if (UWGreaderst == "le")
                        {
                            ProgressBar4.IsIndeterminate = false;
                            RunningInfo4.Text            = "Loading EPW file...";
                            DoubleAnimation ani          = new DoubleAnimation(maxx, TimeSpan.FromSeconds(15));
                            ProgressBar4.BeginAnimation(ProgressBar.ValueProperty, ani);
                        }
                        if (UWGreaderst == "lx")
                        {
                            RunningInfo4.Text    = "Loading XML file...";
                            DoubleAnimation ani1 = new DoubleAnimation(0, TimeSpan.FromSeconds(0));
                            ProgressBar4.BeginAnimation(ProgressBar.ValueProperty, ani1);
                            DoubleAnimation ani2 = new DoubleAnimation(maxx, TimeSpan.FromSeconds(15));
                            ProgressBar4.BeginAnimation(ProgressBar.ValueProperty, ani2);
                        }
                        if (UWGreaderst == "start")
                        {
                            DoubleAnimation ani1 = new DoubleAnimation(0, TimeSpan.FromSeconds(0));
                            ProgressBar4.BeginAnimation(ProgressBar.ValueProperty, ani1);
                            ProgressBar4.Value = 0;
                            RunningInfo4.Text  = "Generating Day " + System.Convert.ToString(1) + "...";
                        }
                        if (UWGreaderst == "+")
                        {
                            value++;
                            ProgressBar4.Visibility = System.Windows.Visibility.Visible;
                            //                   ProgressBar.Value = value;
                            DoubleAnimation ani = new DoubleAnimation(value, TimeSpan.FromSeconds(.5));
                            ProgressBar4.BeginAnimation(ProgressBar.ValueProperty, ani);
                            if (value == System.Convert.ToDouble(dur))
                            {
                                value = value - 1;
                            }
                            RunningInfo4.Text = "Generating Day " + System.Convert.ToString(value + 1) + "...";
                        }
                        if (UWGreaderst == "end")
                        {
                            RunningInfo4.Text = "Writing new EPW file";
                        }
                        if (UWGreaderst == "over")
                        {
                            UWGst4            = 0;
                            RunningInfo4.Text = "Generating finished!";
                            System.IO.File.Delete(System.IO.Path.Combine(ep, ef4));
                        }
                    }));
                }
            }).Start();
        }