示例#1
0
        /// <summary>
        /// Method called before window is shown for the first time (native RW method)
        /// </summary>
        public override void PreOpen()
        {
            timer.Restart();
            ConstructGui();


            Gui.AddImpliedConstraints();

            Gui.UpdateWindowGuide(initSize);


            Gui.UpdateScreenGuide(new Vector2(UI.screenWidth, UI.screenHeight) - MarginsSize());

            Gui.InRect = new Rect(Vector2.zero, initSize);
            Gui.UpdateLayoutIfNeeded();
            initSize          = Gui.Bounds.size;
            Gui.LayoutUpdated = () =>
            {
                //Log.Message($"CWindow new Gui size: {Gui.bounds.size}");
                InnerSize = Gui.Bounds.size;
            };

            timer.Stop();
            $"{this.GetType().Name}: gui constructed in: {((decimal)timer.Elapsed.Ticks) / 10000000:0.0000000}".Log();

            base.PreOpen();
        }