Example #1
0
        private void Awake()
        {
            gResources = Resources;

            Screen.width  = (int)(UE.Screen.width / Application.ScaleX);
            Screen.height = (int)(UE.Screen.height / Application.ScaleY);

            Graphics.ApiGraphics = ApiHolder.Graphics;

            // Enum + dictionary?
            GdiImages                       = new AppGdiImages();
            GdiImages.ArrowDown             = gResources.Images.ArrowDown.ToBitmap();
            GdiImages.ArrowLeft             = gResources.Images.ArrowLeft.ToBitmap();
            GdiImages.ArrowRight            = gResources.Images.ArrowRight.ToBitmap();
            GdiImages.ArrowUp               = gResources.Images.ArrowUp.ToBitmap();
            GdiImages.Circle                = gResources.Images.Circle.ToBitmap();
            GdiImages.Checked               = gResources.Images.Checked.ToBitmap();
            GdiImages.Close                 = gResources.Images.Close.ToBitmap();
            GdiImages.CurvedArrowDown       = gResources.Images.CurvedArrowDown.ToBitmap();
            GdiImages.CurvedArrowLeft       = gResources.Images.CurvedArrowLeft.ToBitmap();
            GdiImages.CurvedArrowRight      = gResources.Images.CurvedArrowRight.ToBitmap();
            GdiImages.CurvedArrowUp         = gResources.Images.CurvedArrowUp.ToBitmap();
            GdiImages.DateTimePicker        = gResources.Images.DateTimePicker.ToBitmap();
            GdiImages.DropDownRightArrow    = gResources.Images.DropDownRightArrow.ToBitmap();
            GdiImages.FormResize            = gResources.Images.FormResize.ToBitmap();
            GdiImages.NumericDown           = gResources.Images.NumericDown.ToBitmap();
            GdiImages.NumericUp             = gResources.Images.NumericUp.ToBitmap();
            GdiImages.RadioButton_Checked   = gResources.Images.RadioButton_Checked.ToBitmap();
            GdiImages.RadioButton_Hovered   = gResources.Images.RadioButton_Hovered.ToBitmap();
            GdiImages.RadioButton_Unchecked = gResources.Images.RadioButton_Unchecked.ToBitmap();
            GdiImages.TreeNodeCollapsed     = gResources.Images.TreeNodeCollapsed.ToBitmap();
            GdiImages.TreeNodeExpanded      = gResources.Images.TreeNodeExpanded.ToBitmap();

            GdiImages.Cursors.Default  = gResources.Images.Cursors.Default.ToBitmap();
            GdiImages.Cursors.HSplit   = gResources.Images.Cursors.HSplit.ToBitmap();
            GdiImages.Cursors.Hand     = gResources.Images.Cursors.Hand.ToBitmap();
            GdiImages.Cursors.Help     = gResources.Images.Cursors.Help.ToBitmap();
            GdiImages.Cursors.SizeAll  = gResources.Images.Cursors.SizeAll.ToBitmap();
            GdiImages.Cursors.SizeNESW = gResources.Images.Cursors.SizeNESW.ToBitmap();
            GdiImages.Cursors.SizeNS   = gResources.Images.Cursors.SizeNS.ToBitmap();
            GdiImages.Cursors.SizeNWSE = gResources.Images.Cursors.SizeNWSE.ToBitmap();
            GdiImages.Cursors.SizeWE   = gResources.Images.Cursors.SizeWE.ToBitmap();
            GdiImages.Cursors.VSplit   = gResources.Images.Cursors.VSplit.ToBitmap();

            lastWidth  = UE.Screen.width;
            lastHeight = UE.Screen.height;

            controller           = new Application();
            controller.Resources = GdiImages;
            controller.UpdatePaintClipRect();

            Control.uwfDefaultController = controller;

#if UNITY_EDITOR
            MouseHook.MouseUp += (sender, args) => Inspect(sender);
#endif
        }
        private void Awake()
        {
            ApiHolder.Graphics = new UnityGdi();
            ApiHolder.Input    = new UnityInput();
            ApiHolder.System   = new UnitySystem();
            ApiHolder.Timing   = new UnityTiming();

            gResources = Resources;

            Screen.width  = (int)(UE.Screen.width / Application.ScaleX);
            Screen.height = (int)(UE.Screen.height / Application.ScaleY);

            // Enum + dictionary?
            GdiImages                       = new AppGdiImages();
            GdiImages.ArrowDown             = gResources.Images.ArrowDown.ToBitmap();
            GdiImages.ArrowLeft             = gResources.Images.ArrowLeft.ToBitmap();
            GdiImages.ArrowRight            = gResources.Images.ArrowRight.ToBitmap();
            GdiImages.ArrowUp               = gResources.Images.ArrowUp.ToBitmap();
            GdiImages.Circle                = gResources.Images.Circle.ToBitmap();
            GdiImages.Checked               = gResources.Images.Checked.ToBitmap();
            GdiImages.Close                 = gResources.Images.Close.ToBitmap();
            GdiImages.CurvedArrowDown       = gResources.Images.CurvedArrowDown.ToBitmap();
            GdiImages.CurvedArrowLeft       = gResources.Images.CurvedArrowLeft.ToBitmap();
            GdiImages.CurvedArrowRight      = gResources.Images.CurvedArrowRight.ToBitmap();
            GdiImages.CurvedArrowUp         = gResources.Images.CurvedArrowUp.ToBitmap();
            GdiImages.DateTimePicker        = gResources.Images.DateTimePicker.ToBitmap();
            GdiImages.DropDownRightArrow    = gResources.Images.DropDownRightArrow.ToBitmap();
            GdiImages.FileDialogBack        = gResources.Images.FileDialogBack.ToBitmap();
            GdiImages.FileDialogFile        = gResources.Images.FileDialogFile.ToBitmap();
            GdiImages.FileDialogFolder      = gResources.Images.FileDialogFolder.ToBitmap();
            GdiImages.FileDialogRefresh     = gResources.Images.FileDialogRefresh.ToBitmap();
            GdiImages.FileDialogUp          = gResources.Images.FileDialogUp.ToBitmap();
            GdiImages.FormResize            = gResources.Images.FormResize.ToBitmap();
            GdiImages.NumericDown           = gResources.Images.NumericDown.ToBitmap();
            GdiImages.NumericUp             = gResources.Images.NumericUp.ToBitmap();
            GdiImages.RadioButton_Checked   = gResources.Images.RadioButton_Checked.ToBitmap();
            GdiImages.RadioButton_Hovered   = gResources.Images.RadioButton_Hovered.ToBitmap();
            GdiImages.RadioButton_Unchecked = gResources.Images.RadioButton_Unchecked.ToBitmap();
            GdiImages.TreeNodeCollapsed     = gResources.Images.TreeNodeCollapsed.ToBitmap();
            GdiImages.TreeNodeExpanded      = gResources.Images.TreeNodeExpanded.ToBitmap();

            GdiImages.Cursors.Default  = gResources.Images.Cursors.Default.ToBitmap();
            GdiImages.Cursors.Hand     = gResources.Images.Cursors.Hand.ToBitmap();
            GdiImages.Cursors.Help     = gResources.Images.Cursors.Help.ToBitmap();
            GdiImages.Cursors.HSplit   = gResources.Images.Cursors.HSplit.ToBitmap();
            GdiImages.Cursors.IBeam    = gResources.Images.Cursors.IBeam.ToBitmap();
            GdiImages.Cursors.SizeAll  = gResources.Images.Cursors.SizeAll.ToBitmap();
            GdiImages.Cursors.SizeNESW = gResources.Images.Cursors.SizeNESW.ToBitmap();
            GdiImages.Cursors.SizeNS   = gResources.Images.Cursors.SizeNS.ToBitmap();
            GdiImages.Cursors.SizeNWSE = gResources.Images.Cursors.SizeNWSE.ToBitmap();
            GdiImages.Cursors.SizeWE   = gResources.Images.Cursors.SizeWE.ToBitmap();
            GdiImages.Cursors.VSplit   = gResources.Images.Cursors.VSplit.ToBitmap();

            ApplicationResources.Images = GdiImages;
            ApplicationResources.Fonts  = new List <string>();

            if (Resources != null && Resources.Fonts != null)
            {
                for (int i = 0; i < Resources.Fonts.Count; i++)
                {
                    var font = Resources.Fonts[i];
                    if (font != null)
                    {
                        ApplicationResources.Fonts.Add(font.fontNames[0]);
                    }
                }
            }

            Cursors.images = GdiImages.Cursors;

            lastWidth  = UE.Screen.width;
            lastHeight = UE.Screen.height;

            controller           = new Application();
            controller.Resources = GdiImages;
            controller.UpdatePaintClipRect();

            Control.uwfDefaultController = controller;

#if UNITY_EDITOR
            MouseHook.MouseUp += (sender, args) => Inspect(sender);
#endif
        }