private void HandleMapEditorCameraRotation()
        {
            if (!_isInMapEditorMode)
            {
                return;
            }
            var screenResolution = ScreenUtility.GetScreenResolution();

            if (Control.MouseButtons == MouseButtons.Right)
            {
                if (!_isRotatingMapEditorCamera)
                {
                    Cursor.Position = new Point((int)screenResolution.X / 2, (int)screenResolution.Y / 2);
                }
                var deltaCursorPosition = new Vector2(
                    Cursor.Position.X / screenResolution.X - 0.5f,
                    Cursor.Position.Y / screenResolution.Y - 0.5f
                    );
                _mapEditorCamera.Rotate(new Vector3(-deltaCursorPosition.Y, 0, -deltaCursorPosition.X));
                Cursor.Position            = new Point((int)screenResolution.X / 2, (int)screenResolution.Y / 2);
                _isRotatingMapEditorCamera = true;
            }
            else
            {
                if (_isRotatingMapEditorCamera)
                {
                    Cursor.Position = new Point((int)screenResolution.X / 2, (int)screenResolution.Y / 2);
                }
                Hud.ShowCursorThisFrame();
                _isRotatingMapEditorCamera = false;
            }
        }
Example #2
0
        protected override void LoadContent()
        {
            _textures    = new Texture2DCache(typeof(Textures));
            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    var sprite = StaticSprite.Acquire(_textures[(int)Textures.ColoredRect]);
                    sprite.LayerDepth             = 1;
                    sprite.RenderingExtent.Anchor = new Vector2(100 + i * 250, 100 + j * 250);
                    _sprites.Add(sprite);
                }
            }

            _viewportCenter            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4));
            _viewportCenter.LayerDepth = 0;
            _sprites.Add(_viewportCenter);

            ScreenUtility.InitGraphicsMode(800, 480, false);

            _viewport.ResetWithScreenSize(800, 480);

            _contentLoaded = true;
        }
Example #3
0
        private new void Awake()
        {
            base.Awake();
            MonoSingleton <UrlScheme> .Instance.Ensure();

            MonoSingleton <PaymentManager> .Instance.Ensure();

            MonoSingleton <NetworkError> .Instance.Ensure();

            if (SceneDummyStartup.mResolutionChanged)
            {
                return;
            }
            int   defaultScreenWidth  = ScreenUtility.DefaultScreenWidth;
            int   defaultScreenHeight = ScreenUtility.DefaultScreenHeight;
            float num1 = (float)defaultScreenWidth / (float)defaultScreenHeight;
            int   num2 = Mathf.Min(defaultScreenHeight, 750);
            int   w    = Mathf.FloorToInt(num1 * (float)num2);
            int   h    = num2;

            ScreenUtility.SetResolution(w, h);
            SceneDummyStartup.mResolutionChanged = true;
            Debug.Log((object)string.Format("Changing Resolution to [{0} x {1}] from [{2} x {3}]", new object[4]
            {
                (object)w,
                (object)h,
                (object)Screen.get_width(),
                (object)Screen.get_height()
            }));
        }
Example #4
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);

            ScreenUtility.InitGraphicsMode(800, 480, false);

            var vertices = new List <Vector2>();

            vertices.Add(new Vector2(100, 100));
            vertices.Add(new Vector2(200, 100));
            vertices.Add(new Vector2(150, 150));

            _polygons[0] = new PolygonExtent();
            _polygons[0].Reset(vertices);
            _polygons[0].ReAnchor(_polygons[0].Center);

            vertices.Clear();
            vertices.Add(new Vector2(300, 300));
            vertices.Add(new Vector2(400, 300));
            vertices.Add(new Vector2(400, 400));
            vertices.Add(new Vector2(300, 400));

            _polygons[1] = new PolygonExtent();
            _polygons[1].Reset(vertices);
            _polygons[1].ReAnchor(_polygons[1].Center);

            vertices.Clear();
            vertices.Add(new Vector2(300, 300));
            vertices.Add(new Vector2(400, 300));
            vertices.Add(new Vector2(420, 400));
            vertices.Add(new Vector2(350, 450));
            vertices.Add(new Vector2(280, 400));

            _polygons[2] = new PolygonExtent();
            _polygons[2].Reset(vertices);
            _polygons[2].ReAnchor(_polygons[2].Center);

            vertices.Clear();
            Vector2 offset = new Vector2(300, 100);

            vertices.Add(offset + new Vector2(0, 0));
            vertices.Add(offset + new Vector2(50, 0));
            vertices.Add(offset + new Vector2(50, -50));
            vertices.Add(offset + new Vector2(100, -50));
            vertices.Add(offset + new Vector2(100, 0));
            vertices.Add(offset + new Vector2(150, 0));
            vertices.Add(offset + new Vector2(150, 50));
            vertices.Add(offset + new Vector2(100, 50));
            vertices.Add(offset + new Vector2(100, 100));
            vertices.Add(offset + new Vector2(50, 100));
            vertices.Add(offset + new Vector2(50, 50));
            vertices.Add(offset + new Vector2(0, 50));

            _polygons[3] = new PolygonExtent();
            _polygons[3].Reset(vertices);
            _polygons[3].ReAnchor(_polygons[3].Center);

            _contentLoaded = true;
        }
        /// <summary>
        /// 기본 생성자
        /// </summary>
        public ProcessesSetWindowPosFunctionStrategy()
        {
            PreventMoveSceenIndex = ScreenUtility.GetFirstScreenIndexAndExceptPrimaryScreenIndex();

            // explorer 프로세스에는
            // 윈도우탐색기, 작업표시줄 등 다수의 창이 존재하므로 해당 프로세스는 제외한다.
            // 윈도우에서 제공되는 프로세스에 대한 창을 제어하기 위해서는 관리자 권한이 필요하다.
            ExceptProcessNames.Add(Explorer.ProcessName);
        }
Example #6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!Directory.Exists("./Plugin"))
            {
                Directory.CreateDirectory("./Plugin");
            }

            ScreenUtility.PrintVisibleWindowHandles(2);

            IntPtr progman = Win32Api.FindWindow("Progman", null);
            IntPtr result  = IntPtr.Zero;

            Win32Api.SendMessageTimeout(progman,
                                        0x052C,
                                        new IntPtr(0),
                                        IntPtr.Zero,
                                        Win32Api.SendMessageTimeoutFlags.SMTO_NORMAL,
                                        1000,
                                        out result);

            ScreenUtility.PrintVisibleWindowHandles(2);

            IntPtr workerw = IntPtr.Zero;

            Win32Api.EnumWindows(new Win32Api.EnumWindowsProc((tophandle, topparamhandle) =>
            {
                IntPtr p = Win32Api.FindWindowEx(tophandle,
                                                 IntPtr.Zero,
                                                 "SHELLDLL_DefView",
                                                 IntPtr.Zero);

                if (p != IntPtr.Zero)
                {
                    // Gets the WorkerW Window after the current one.
                    workerw = Win32Api.FindWindowEx(IntPtr.Zero,
                                                    tophandle,
                                                    "WorkerW",
                                                    IntPtr.Zero);
                }

                return(true);
            }), IntPtr.Zero);

            SettingData.LoadSetting();

            Application.Run(new FormWallpaper(workerw));

            RegistryKey theCurrentMachine = Registry.CurrentUser;
            RegistryKey theControlPanel   = theCurrentMachine.OpenSubKey("Control Panel");
            RegistryKey theDesktop        = theControlPanel.OpenSubKey("Desktop");

            Win32Api.SystemParametersInfo(Win32Api.SPI_SETDESKWALLPAPER, 0, Convert.ToString(theDesktop.GetValue("Wallpaper")), Win32Api.SPIF_UPDATEINIFILE);
        }
Example #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="targetScreenIndex">타겟이 되는 스크린 인덱스</param>
        /// <exception cref="System.InvalidOperationException"></exception>
        public MultiScreen(int targetScreenIndex)
        {
            if (Screen.AllScreens.Length == 1)
            {
                throw new InvalidOperationException("Screen.AllScreens.Length==1");
            }

            if (!ScreenUtility.IsValidIndex(targetScreenIndex))
            {
                throw new ArgumentException(nameof(targetScreenIndex));
            }

            TargetScreenIndex      = targetScreenIndex;
            TargetScreenBoundsSize = Size.Empty;
        }
Example #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="targetScreenBoundsSize">타겟이 되는 스크린 사이즈(Bounds)</param>
        public MultiScreen(Size targetScreenBoundsSize)
        {
            if (Screen.AllScreens.Length == 1)
            {
                throw new InvalidOperationException("Screen.AllScreens.Length==1");
            }

            if (!ScreenUtility.EqualsScreenBoundsSize(targetScreenBoundsSize))
            {
                throw new ArgumentException(nameof(targetScreenBoundsSize));
            }

            TargetScreenBoundsSize = targetScreenBoundsSize;
            TargetScreenIndex      = InvalidScreenIndex;
        }
        public override void Draw()
        {
            var screenResolution = ScreenUtility.GetScreenResolution();
            var normalizedSize   = new Vector2(
                AbsoluteSize.X / screenResolution.X,
                AbsoluteSize.Y / screenResolution.Y
                );
            var normalizedPositionOffset = new Vector2(
                normalizedSize.X / 2,
                normalizedSize.Y
                );
            var normalizedPosition = NormalizedScreenPosition + normalizedPositionOffset;

            NativeUtility.DrawRectangle(normalizedPosition, normalizedSize, Color);
        }
        Rect SimulateSafeArea()
        {
            SimulatingDevice = DeviceUnknown;
            if (!simulatesSafeArea)
            {
                return(Screen.safeArea);
            }

            if (ScreenUtility.IsIPhoneXResolution())
            {
                SimulatingDevice = DeviceIPhoneX;
                return(ScreenUtility.GetSafeArea(true));
            }

            return(Screen.safeArea);
        }
Example #11
0
    void Spawner()
    {
        int randomSpawnPosIndex = Random.Range(0, 4);

        //Probability for monster 1 to 20.
        obstacleRandomIndex = Random.Range(0, 20);

        int obstacleIndex;

        if (obstacleRandomIndex >= 1)
        {
            obstacleIndex = 0;
        }
        else
        {
            obstacleIndex = 1;
        }

        Instantiate(obstaclePrefab[obstacleIndex], ScreenUtility.GetRandomPos()[randomSpawnPosIndex], Quaternion.identity);
    }
Example #12
0
 private void ButtonMouseMovePrevent_Click(object sender, EventArgs e)
 {
     if (_isMultiScreen)
     {
         if (_mouseManager == null)
         {
             int preventMoveScreenIndex = ScreenUtility.GetFirstScreenIndexAndExceptPrimaryScreenIndex();
             IMouseFunctionStrategy functionStrategy = new MousePreventMoveScreenFunctionStrategy(preventMoveScreenIndex);
             _mouseManager = new MouseManager(functionStrategy);
             _mouseManager.StartWorkerThread();
             _ButtonMouseMovePrevent.Text = "마우스 이동 제어 정지";
         }
         else
         {
             _mouseManager.StopWorkerThread();
             _mouseManager = null;
             _ButtonMouseMovePrevent.Text = "마우스 이동 제어 시작";
         }
     }
 }
Example #13
0
        private void ButtonStartAndStopScreenCapture_Click(object sender, EventArgs e)
        {
            if (_isMultiScreen)
            {
                if (_imageCapture == null)
                {
                    _imageCapture = new ImageCapture(ScreenUtility.GetFirstScreenIndexAndExceptPrimaryScreenIndex());
                    _imageCapture.CreateImageCapture += ScreenImageCapture_CreateScreenImageCapture;
                    _imageCapture.Start();

                    _ButtonStartAndStopScreenCapture.Text = "스크린 캡쳐 정지";
                }
                else
                {
                    _imageCapture.Stop();
                    _imageCapture.CreateImageCapture -= ScreenImageCapture_CreateScreenImageCapture;
                    _imageCapture = null;

                    _ButtonStartAndStopScreenCapture.Text = "스크린 캡쳐 시작";
                }
            }
        }
Example #14
0
        public ImageCapture(int targetScreenIndex, int interval = 500)
        {
            if (!ScreenUtility.IsValidIndex(targetScreenIndex))
            {
                throw new ArgumentException(nameof(targetScreenIndex) + " 값 범위는 0-" + (Screen.AllScreens.Length - 1) + " 입니다.");
            }

            if (!(interval >= 500 && interval <= 3000))
            {
                throw new ArgumentException(nameof(interval) + " 값 범위는 500-3000 입니다.");
            }

            TargetScreenIndex = targetScreenIndex;
            TargetScreen      = new MultiScreen(TargetScreenIndex).TargetScreen;
            if (TargetScreen == null)
            {
                throw new InvalidOperationException("TargetScreen 이 null 입니다.");
            }

            TargetScreenBoundsSize = Size.Empty;
            _interval = interval;
        }
Example #15
0
        public ImageCapture(Size targetScreenBoundsSize, int interval = 500)
        {
            if (!ScreenUtility.EqualsScreenBoundsSize(targetScreenBoundsSize))
            {
                throw new ArgumentException(nameof(targetScreenBoundsSize));
            }

            if (!(interval >= 500 && interval <= 3000))
            {
                throw new ArgumentException(nameof(interval) + " 값 범위는 500-3000 입니다.");
            }

            TargetScreenBoundsSize = targetScreenBoundsSize;
            TargetScreen           = new MultiScreen(TargetScreenBoundsSize).TargetScreen;
            if (TargetScreen == null)
            {
                throw new InvalidOperationException("TargetScreen 이 null 입니다.");
            }

            TargetScreenIndex = InvalidScreenIndex;
            _interval         = interval;
        }
Example #16
0
    public void PowerUpSpawner()
    {
        int randomIndex = Random.Range(0, 4);

        GameObject[] randomPowerUp = { shieldPowerUp, destroyAllPowerUp };
        int          powerUpIndex;
        int          randomPowerUpIndex = Random.Range(0, 10);

        if (randomPowerUpIndex < 2)
        {
            powerUpIndex = 1;
        }
        else
        {
            powerUpIndex = 0;
        }

        if (Time.time > nextPowerUp)
        {
            float randomInterval = Random.Range(8, 54);
            nextPowerUp = Time.time + randomInterval;
            Instantiate(randomPowerUp[powerUpIndex], ScreenUtility.GetRandomPos()[randomIndex], Quaternion.identity);
        }
    }
Example #17
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);

            ScreenUtility.InitGraphicsMode(800, 480, false);

            _circles[0] = new CircularExtent();
            _circles[0].Reset(new Vector2(100, 100), 50);
            _circles[0].ReAnchor(_circles[0].Center);

            _circles[1] = new CircularExtent();
            _circles[1].Reset(new Vector2(300, 300), 50);
            _circles[1].ReAnchor(_circles[1].Center);

            _circles[2] = new CircularExtent();
            _circles[2].Reset(new Vector2(400, 350), 100);
            _circles[2].ReAnchor(_circles[2].Center);

            _circles[3] = new CircularExtent();
            _circles[3].Reset(new Vector2(300, 100), 75);
            _circles[3].ReAnchor(_circles[3].Center);

            _contentLoaded = true;
        }
Example #18
0
        public virtual void ModifyCanvasScaler()
        {
            if (!modifyCanvasScaler)
            {
                return;
            }

            if (!component.isRootCanvas)
            {
                return;
            }

            var canvasScaler = UnityUtility.GetComponent <CanvasScaler>(gameObject);

            if (canvasScaler != null)
            {
                canvasScaler.enabled = false;

                canvasScaler.uiScaleMode = ScaleMode;

                if (canvasScaler.uiScaleMode == CanvasScaler.ScaleMode.ScaleWithScreenSize)
                {
                    canvasScaler.referenceResolution = ReferenceResolution;
                    canvasScaler.screenMatchMode     = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight;

                    var screenSize = ScreenUtility.GetSize();

                    var currentAspectRatio   = (float)screenSize.x / screenSize.y;
                    var referenceAspectRatio = canvasScaler.referenceResolution.x / canvasScaler.referenceResolution.y;

                    canvasScaler.matchWidthOrHeight = currentAspectRatio < referenceAspectRatio ? 0 : 1;
                }

                canvasScaler.enabled = true;
            }
        }
 /// <summary>
 /// 주 모니터 스크린 여부값을 반환합니다.
 /// <para><paramref name="index"/> 값은 1부터 시작합니다.</para>
 /// </summary>
 /// <param name="index"></param>
 /// <returns></returns>
 public bool IsMainScreen(int index)
 {
     return(index == (ScreenUtility.GetPrimaryScreenIndex() + 1));
 }
        void OnGUI()
        {
            ValidateOrientation();

            if (!ScreenUtility.IsIPhoneXResolution())
            {
                return;
            }

            var tex  = new Texture2D(1, 1);
            var safe = GetEmulatedSafeAreaOnIPhoneX();

            if (viewsUnsafeArea)
            {
                var unsafes = new Rect[] {
                    new Rect(0, 0, Screen.width, safe.y),
                    new Rect(0, safe.y, safe.x, safe.height),
                    new Rect(safe.xMax, safe.y, Screen.width - safe.xMax, safe.height),
                    new Rect(0, safe.yMax, Screen.width, Screen.height - safe.yMax)
                };
                foreach (var area in unsafes)
                {
                    DrawRect(tex, area, color);
                }
            }

            if (viewsFrame)
            {
                var   min           = Mathf.Min(Screen.width, Screen.height);
                float homebarWidth  = min;
                float homebarHeight = 16;

                switch (orientation)
                {
                case DeviceOrientation.Portrait:
                {
                    var notchWidth  = Screen.width * 0.55f;
                    var notchHeight = safe.yMin * 2 / 3;
                    var notch       = new Rect((Screen.width - notchWidth) / 2, 0, notchWidth, notchHeight);
                    DrawRect(tex, notch, color);

                    homebarWidth = min * 0.45f;
                    break;
                }

                case DeviceOrientation.LandscapeRight:
                {
                    var notchWidth  = Screen.height * 0.55f;
                    var notchHeight = safe.xMin * 2 / 3;
                    var notch       = new Rect(0, (Screen.height - notchWidth) / 2, notchHeight, notchWidth);
                    DrawRect(tex, notch, color);

                    homebarWidth = min * 0.6f;
                    break;
                }

                case DeviceOrientation.LandscapeLeft:
                {
                    var notchWidth  = Screen.height * 0.55f;
                    var notchHeight = (Screen.width - safe.xMax) * 2 / 3;
                    var notch       = new Rect(Screen.width - notchHeight, (Screen.height - notchWidth) / 2, notchHeight, notchWidth);
                    DrawRect(tex, notch, color);

                    homebarWidth = min * 0.6f;
                    break;
                }
                }
                {
                    DrawRect(tex, new Rect((Screen.width - homebarWidth) / 2, Screen.height - homebarHeight * 2, homebarWidth, homebarHeight), color);

                    var corner = min / 12f;
                    var diff   = new Vector2(-1, -1) / 2 * corner;
                    DrawLine(
                        tex,
                        Vector2.right * corner + diff,
                        Vector2.up * corner + diff,
                        color,
                        corner
                        );
                    diff = new Vector2(1, -1) / 2 * corner;
                    DrawLine(
                        tex,
                        Vector2.right * Screen.width + Vector2.left * corner + diff,
                        Vector2.right * Screen.width + Vector2.up * corner + diff,
                        color,
                        corner
                        );
                    diff = new Vector2(-1, 1) / 2 * corner;
                    DrawLine(
                        tex,
                        Vector2.up * Screen.height + Vector2.right * corner + diff,
                        Vector2.up * Screen.height + Vector2.down * corner + diff,
                        color,
                        corner
                        );
                    diff = new Vector2(1, 1) / 2 * corner;
                    DrawLine(
                        tex,
                        new Vector2(Screen.width, Screen.height) + Vector2.left * corner + diff,
                        new Vector2(Screen.width, Screen.height) + Vector2.down * corner + diff,
                        color,
                        corner
                        );
                }
            }
        }
        Rect GetEmulatedSafeAreaOnIPhoneX()
        {
            var safe = ScreenUtility.GetSafeArea(true);

            return(new Rect(safe.x, Screen.height - safe.yMax, safe.width, safe.height));
        }
Example #22
0
 /// <summary>
 /// 마우스 이동 방지 기본 생성자
 /// </summary>
 /// <exception cref="InvalidOperationException">모니터가 1개 일경우 발생함</exception>
 /// <exception cref="ArgumentException">preventMoveScreenIndex 값이 유효하지 않을경우</exception>
 public MousePreventMoveScreenFunctionStrategy()
     : this(ScreenUtility.GetFirstScreenIndexAndExceptPrimaryScreenIndex())
 {
 }
Example #23
0
        private void StartInternalWork()
        {
            Toolkit.TraceWriteLine("특정 스크린 마우스 이동 방지를 시작합니다.");

            _oldMousePoint.Clear();
            _isStartMouseWork = true;

            Screen primaryScreen = Screen.PrimaryScreen;
            Screen preventScreen = Screen.AllScreens[_preventMoveScreenIndex];
            Point  useCurrentPt  = Point.Empty;

            try
            {
                while (_isStartMouseWork)
                {
                    Thread.Sleep(Interval);

                    MousePoint mousePoint = MouseNative.GetCursorPoint();
                    if (!mousePoint.IsEmpty)
                    {
                        useCurrentPt.X = mousePoint.X;
                        useCurrentPt.Y = mousePoint.Y;

                        _oldMousePoint.Push(useCurrentPt);

                        // 오래된 좌표 삭제
                        if (_oldMousePoint.Count >= _oldMousePointClear)
                        {
                            Stack <Point> reversePoints = new Stack <Point>();
                            int           count         = 0;
                            foreach (Point point in _oldMousePoint.Reverse())
                            {
                                bool isBreak = (_autoOldMousePointClear) ? !preventScreen.Bounds.Contains(point) : count >= _lessThanOldMousePointClear;
                                if (isBreak)
                                {
                                    break;
                                }
                                reversePoints.Push(point);
                                count++;
                            }

                            _oldMousePoint.Clear();
                            _oldMousePoint = reversePoints;

                            string text = String.Format("오래된 마우스 좌표를 삭제하였습니다. 삭제개수:{0}", count);
                            Toolkit.TraceWriteLine(text);
                        }

                        // 특정 스크린에 좌표가 오기전의 좌표를 찾는다.
                        Point lastPreventScreenOutsidePoint = Point.Empty;
                        foreach (Point point in _oldMousePoint)
                        {
                            if (!preventScreen.Bounds.Contains(point))
                            {
                                lastPreventScreenOutsidePoint = point;
                                break;
                            }
                        }

                        int x = lastPreventScreenOutsidePoint.X;
                        int y = lastPreventScreenOutsidePoint.Y;

                        // 비어 있을 경우 주 모니터 중앙으로
                        if (lastPreventScreenOutsidePoint.IsEmpty)
                        {
                            Point primaryCenterPoint = ScreenUtility.GetPrimaryScreenBoundsCenterPoint();
                            x = primaryCenterPoint.X;
                            y = primaryCenterPoint.Y;
                        }

                        if (preventScreen.Bounds.Contains(useCurrentPt))
                        {
                            MouseNative mouseNative = new MouseNative();
                            mouseNative.SetCursorPoint(x, y);

                            mouseNative.MouseEvent(MouseEventFlags.MOVE);

                            mouseNative.SetCursorPoint(x, y);

                            string text = String.Format("{0} 스크린으로 마우스가 넘어갔습니다. 마우스 이동 처리를 시작합니다.", preventScreen.Bounds.ToString());
                            Toolkit.TraceWriteLine(text);
                            text = String.Format("마우스를 (X={0}, Y={1}) 좌표로 이동을 완료하였습니다.", x, y);
                            Toolkit.TraceWriteLine(text);

                            if (IsSetMouseCursorPointAfterOldPointClear)
                            {
                                _oldMousePoint.Clear();
                                _oldMousePoint.Push(new Point(x, y));

                                Toolkit.TraceWrite("기존에 있는 모든 좌표를 삭제하고 마지막 이동한 좌표를 추가합니다.");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Toolkit.DebugWriteLine(ex);
            }
        }
Example #24
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);

            ScreenUtility.InitGraphicsMode(800, 480, false);

            var circle = new CircularExtent();

            circle.Reset(new Vector2(100, 100), 50);
            circle.ReAnchor(circle.Center);
            _extents[0] = circle;

            circle = new CircularExtent();
            circle.Reset(new Vector2(300, 300), 75);
            circle.ReAnchor(circle.Center);
            _extents[1] = circle;

            var vertices = new List <Vector2>();

            vertices.Add(new Vector2(300, 300));
            vertices.Add(new Vector2(400, 300));
            vertices.Add(new Vector2(420, 400));
            vertices.Add(new Vector2(350, 450));
            vertices.Add(new Vector2(280, 400));

            var poly = new PolygonExtent();

            poly.Reset(vertices);
            poly.ReAnchor(poly.Center);
            _extents[2] = poly;

            vertices.Clear();
            Vector2 offset = new Vector2(300, 100);

            vertices.Add(offset + new Vector2(0, 0));
            vertices.Add(offset + new Vector2(50, 0));
            vertices.Add(offset + new Vector2(50, -50));
            vertices.Add(offset + new Vector2(100, -50));
            vertices.Add(offset + new Vector2(100, 0));
            vertices.Add(offset + new Vector2(150, 0));
            vertices.Add(offset + new Vector2(150, 50));
            vertices.Add(offset + new Vector2(100, 50));
            vertices.Add(offset + new Vector2(100, 100));
            vertices.Add(offset + new Vector2(50, 100));
            vertices.Add(offset + new Vector2(50, 50));
            vertices.Add(offset + new Vector2(0, 50));

            poly = new PolygonExtent();
            poly.Reset(vertices);
            poly.ReAnchor(poly.Center);
            _extents[3] = poly;

            var composite = new CompositeExtent();

            var child1 = new CircularExtent();

            child1.Reset(new Vector2(50, 50), 50);
            child1.ReAnchor(circle.Center);

            vertices = new List <Vector2>();

            vertices.Add(new Vector2(100, 100));
            vertices.Add(new Vector2(200, 100));
            vertices.Add(new Vector2(200, 200));
            vertices.Add(new Vector2(100, 200));

            var child2 = new PolygonExtent();

            child2.Reset(vertices);
            child2.ReAnchor(poly.Center);

            composite.Add(child1);
            composite.Add(child2);

            _extents[4]    = composite;
            _contentLoaded = true;
        }
Example #25
0
 /// <summary>
 /// 保存异常截图
 /// </summary>
 private static void Save()
 {
     ScreenUtility.Save();
 }