Example #1
0
        public static void Run()
        {
            VrManager.WaitGetPoses();
            double realTime = Time.RealTime;

            LastFrameTime               = (float)(realTime - m_frameBeginTime);
            LastCpuFrameTime            = (float)(m_cpuEndTime - m_frameBeginTime);
            m_frameBeginTime            = realTime;
            Window.PresentationInterval = ((!VrManager.IsVrStarted) ? SettingsManager.PresentationInterval : 0);
            try
            {
                if (ExceptionManager.Error == null)
                {
                    while (m_urisToHandle.Count > 0)
                    {
                        Uri obj = m_urisToHandle[0];
                        m_urisToHandle.RemoveAt(0);
                        Program.HandleUri?.Invoke(obj);
                    }
                    PerformanceManager.Update();
                    MotdManager.Update();
                    MusicManager.Update();
                    ScreensManager.Update();
                    DialogsManager.Update();
                }
                else
                {
                    ExceptionManager.UpdateExceptionScreen();
                }
            }
            catch (Exception e)
            {
                ExceptionManager.ReportExceptionToUser(null, e);
                ScreensManager.SwitchScreen("MainMenu");
            }
            try
            {
                Display.RenderTarget = null;
                if (ExceptionManager.Error == null)
                {
                    ScreensManager.Draw();
                    PerformanceManager.Draw();
                    ScreenCaptureManager.Run();
                }
                else
                {
                    ExceptionManager.DrawExceptionScreen();
                }
                m_cpuEndTime = Time.RealTime;
            }
            catch (Exception e2)
            {
                ExceptionManager.ReportExceptionToUser(null, e2);
                ScreensManager.SwitchScreen("MainMenu");
            }
        }
Example #2
0
 public override void Update()
 {
     if (base.Input.Tap.HasValue)
     {
         Widget widget = HitTestGlobal(base.Input.Tap.Value);
         if (widget != null && (widget == this || widget.IsChildWidgetOf(this)))
         {
             m_tapsCount++;
         }
     }
     if (m_tapsCount >= 5)
     {
         m_tapsCount = 0;
         MotdManager.ForceRedownload();
         AudioManager.PlaySound("Audio/UI/ButtonClick", 1f, 0f, 0f);
     }
     if (base.Input.IsKeyDownOnce(Key.PageUp))
     {
         GotoLine(m_currentLineIndex - 1);
     }
     if (base.Input.IsKeyDownOnce(Key.PageDown))
     {
         GotoLine(m_currentLineIndex + 1);
     }
     if (m_lines.Count > 0)
     {
         m_currentLineIndex %= m_lines.Count;
         double realTime = Time.RealTime;
         if (m_lastLineChangeTime == 0.0 || realTime - m_lastLineChangeTime >= (double)m_lines[m_currentLineIndex].Time)
         {
             GotoLine((m_lastLineChangeTime != 0.0) ? (m_currentLineIndex + 1) : 0);
         }
         float num  = 0f;
         float num2 = (float)(realTime - m_lastLineChangeTime);
         float num3 = (float)(m_lastLineChangeTime + (double)m_lines[m_currentLineIndex].Time - 0.33000001311302185 - realTime);
         SetWidgetPosition(position: new Vector2((!(num2 < num3)) ? (base.ActualSize.X * (1f - MathUtils.PowSign(MathUtils.Sin(MathUtils.Saturate(1.5f * num3) * (float)Math.PI / 2f), 0.33f))) : (base.ActualSize.X * (MathUtils.PowSign(MathUtils.Sin(MathUtils.Saturate(1.5f * num2) * (float)Math.PI / 2f), 0.33f) - 1f)), 0f), widget: m_containerWidget);
         m_containerWidget.Size = base.ActualSize;
     }
     else
     {
         m_containerWidget.Children.Clear();
     }
 }
        public LoadingScreen()
        {
            WidgetsManager.LoadWidgetContents((Widget)this.ScreenWidget, (object)this, ContentManager.Get <XElement>("Screens/LoadingScreen"));

            LabelWidget ExternalAssemblyInfo = new LabelWidget();

            ExternalAssemblyInfo.Text = "Powered By GScience Studio\n";
            //下列两行代码请勿随意删除
            ExternalAssemblyInfo.Text += "Author:" + Info.author + "\n";
            ExternalAssemblyInfo.Text += "Version:" + Info.version;

            ExternalAssemblyInfo.Color     = Color.LightBlue;
            ExternalAssemblyInfo.FontScale = 0.5f;
            this.ScreenWidget.Children.Add(ExternalAssemblyInfo);

            this.AddLoadAction((Action)(() => CommunityContentManager.Initialize()));
            this.AddLoadAction((Action)(() => MotdManager.Initialize()));
            this.AddLoadAction((Action)(() => LightingManager.Initialize()));
            this.AddLoadAction((Action)(() => StringsManager.LoadStrings()));
            this.AddLoadAction((Action)(() => TextureAtlasManager.LoadAtlases()));
            ReadOnlyList <ContentInfo> readOnlyList = ContentManager.List();

            // ISSUE: explicit reference operation
            using (ReadOnlyList <ContentInfo> .Enumerator enumerator = ((ReadOnlyList <ContentInfo>)@readOnlyList).GetEnumerator())
            {
                // ISSUE: explicit reference operation
                while (((ReadOnlyList <ContentInfo> .Enumerator)@enumerator).MoveNext())
                {
                    // ISSUE: explicit reference operation
                    ContentInfo localContentInfo = ((ReadOnlyList <ContentInfo> .Enumerator)@enumerator).Current;
                    this.AddLoadAction((Action)(() => ContentManager.Get((string)localContentInfo.Name)));
                }
            }
            this.AddLoadAction((Action)(() => DatabaseManager.LoadDatabase()));
            this.AddLoadAction((Action)(() => WorldsManager.Initialize()));
            this.AddLoadAction((Action)(() => BlocksTexturesManager.Initialize()));
            this.AddLoadAction((Action)(() => CharacterSkinsManager.Initialize()));
            this.AddLoadAction((Action)(() => FurniturePacksManager.Initialize()));
            this.AddLoadAction((Action)(() => BlocksManager.Initialize()));
            this.AddLoadAction((Action)(() => CraftingRecipesManager.Initialize()));
            this.AddLoadAction((Action)(() => GScienceStudio.InputManager.Initialize()));
        }
Example #4
0
        public LoadingScreen()
        {
            XElement node = ContentManager.Get <XElement>("Screens/LoadingScreen");

            LoadContents(this, node);
            AddLoadAction(delegate
            {
                VrManager.Initialize();
            });
            AddLoadAction(delegate
            {
                CommunityContentManager.Initialize();
            });
            AddLoadAction(delegate
            {
                MotdManager.Initialize();
            });
            AddLoadAction(delegate
            {
                LightingManager.Initialize();
            });
            AddLoadAction(delegate
            {
                StringsManager.LoadStrings();
            });
            AddLoadAction(delegate
            {
                TextureAtlasManager.LoadAtlases();
            });
            foreach (ContentInfo item in ContentManager.List())
            {
                ContentInfo localContentInfo = item;
                AddLoadAction(delegate
                {
                    ContentManager.Get(localContentInfo.Name);
                });
            }
            AddLoadAction(delegate
            {
                DatabaseManager.Initialize();
            });
            AddLoadAction(delegate
            {
                WorldsManager.Initialize();
            });
            AddLoadAction(delegate
            {
                BlocksTexturesManager.Initialize();
            });
            AddLoadAction(delegate
            {
                CharacterSkinsManager.Initialize();
            });
            AddLoadAction(delegate
            {
                FurniturePacksManager.Initialize();
            });
            AddLoadAction(delegate
            {
                BlocksManager.Initialize();
            });
            AddLoadAction(delegate
            {
                CraftingRecipesManager.Initialize();
            });
            AddLoadAction(delegate
            {
                MusicManager.CurrentMix = MusicManager.Mix.Menu;
            });
        }