Пример #1
0
 public ResponseData Regeist(string key)
 {
     ScreenUtil.RegeistScreen(key);
     return(new ResponseData {
         Code = 200, Success = true, Data = "注册成功!"
     });
 }
Пример #2
0
        void UpdateSetting(PointerEventData obj)
        {
            Global.Ins.fps = _t30fps.isOn ? 30 : 60;

            if (_tLowQuality.isOn)
            {
                Global.Ins.quality = 0;
            }
            else if (_tMiddleQuality.isOn)
            {
                Global.Ins.quality = 1;
            }
            else if (_tHighQuality.isOn)
            {
                Global.Ins.quality = 2;
            }

            if (_tLowResolution.isOn)
            {
                Global.Ins.resolution     = 0;
                Global.Ins.resolutionSize = ScreenUtil.AdaptationResolution(Global.Ins.defaultResolution.x, Global.Ins.defaultResolution.y, 1280, 720, false);
            }
            else if (_tNormalResolution.isOn)
            {
                Global.Ins.resolution = 1;
            }
            else if (_tHighResolution.isOn)
            {
                Global.Ins.resolution = 2;
            }

            Global.Ins.RefreshConfig();
        }
Пример #3
0
        public ResponseData SetShowdown(string keys)
        {
            List <PlayControl> decives = new List <PlayControl>();

            if (keys == "all")
            {
                decives = ScreenUtil.GetAll();
            }
            else if (keys != "")
            {
                decives = ScreenUtil.GetDecives(keys.Split(','));
            }

            if (decives.Count > 0)
            {
                foreach (var item in decives)
                {
                    if (item.PlayLock)
                    {
                        item.PlayLock = false;
                        item.Type     = "showdown";
                    }
                }
            }
            return(new ResponseData {
                Code = 200, Success = true, Data = "控制关机成功!"
            });
        }
Пример #4
0
    /**
     * Loads the next level
     */
    public void loadNextLevel()
    {
        //Player games one life
        if (_lives < MAX_LIVES)
        {
            GUIStyle tempStyle = new GUIStyle(GUIManager.Instance.defaultStyle);
            tempStyle.alignment        = TextAnchor.MiddleCenter;
            tempStyle.normal.textColor = Color.green;
            GUIManager.Instance.addGUIItem(new GUIItem(ScreenUtil.ScreenWidth / 2, ScreenUtil.getPixelHeight(150),
                                                       "Gained Additional Ship!", tempStyle, 3));
            if (GameManager.Instance.enableSeebright)
            {
                GUIManager.Instance.addGUIItem(new GUIItem(3 * ScreenUtil.ScreenWidth / 2, ScreenUtil.getPixelHeight(150),
                                                           "Gained Additional Ship!", tempStyle, 3));
            }
            _lives++;
        }
        _currentLevelIndex++;
        Time.timeScale = 1.0f + 0.02f * _currentLevelIndex;
        //Loads new level
        Vector3 newLevelPosition =
            new Vector3((_currentLevelIndex + 1) * levels[_currentLevelIndex % levels.Count].gameObject.renderer.bounds.size.x * -6.0f, 0, 0);

        _currentLevelObject = (GameObject)Instantiate(levels[_currentLevelIndex % levels.Count], newLevelPosition,
                                                      Quaternion.Euler(-90, 0, 0));
        _currentLevel = _currentLevelObject.GetComponent <Level>();
        _currentLevel.load();
        EnemyManager.Instance.loadLevel();
        foreach (Player s in _currentPlayerShips)
        {
            s.loadNextLevel(_currentLevel);
        }
    }
Пример #5
0
        private static float GetTimeBlockWidth(Show show)
        {
            var result = HorizontalGap + TimeBorderGap; // Title Label Gap + Time Label Right Gap

            if (show != null)
            {
                var time = default(string);
                var font = default(UIFont);

                if (show.StartTime.HasValue)
                {
                    time = GetShowTimeText(show.StartTime);
                    font = GetShowStartTimeFont(show.Status);
                }
                else if (show.EndTime.HasValue)
                {
                    time = GetShowTimeText(show.EndTime);
                    font = GetShowEndTimeFont(show.Status);
                }

                var width = time != null
                    ? ScreenUtil.CalculateTextWidth(20, time, font) : 0f;

                result += width;
            }

            return(result);
        }
        private void SetNormalPositionFromMaximized(Point mousePoint)
        {
            var mouseScreenPoint = this.AssociatedObject.PointToScreen(mousePoint);
            var prevWidth        = this.AssociatedObject.ActualWidth;

            // Normal 상태에서 Mouse Pointer의 적절한 위치를 지정하기 위한 Left,Top 설정.
            this.AssociatedObject.Top         = mouseScreenPoint.Y - mousePoint.Y;
            this.AssociatedObject.WindowState = WindowState.Normal;

            // ActualWidth, ActualHeight는 이제 Normal의 Size를 가리킴.
            var bound = ScreenUtil.GetTotalScreenBound();

            var moveLeft = (mouseScreenPoint.X - mousePoint.X / prevWidth * this.AssociatedObject.ActualWidth) / ScreenUtil.GetCurrentMonitorDpi().X;

            // Screen 좌우 경계를 넘어가면 좌우 경계에 닿는 값을 Left로 지정.
            if (moveLeft < bound.Left)
            {
                moveLeft = bound.Left;
            }
            else if (moveLeft + this.AssociatedObject.ActualWidth > bound.Right)
            {
                moveLeft = bound.Right - this.AssociatedObject.ActualWidth;
            }

            this.AssociatedObject.Left = moveLeft;
        }
Пример #7
0
        private static float GetTextBlocksHeight(nfloat frameWidth, Show show,
                                                 bool showTime = true, bool includeLocation = false)
        {
            if (show == null)
            {
                return(0);
            }

            var titleHeight =
                !string.IsNullOrWhiteSpace(show.Title)
                ? ScreenUtil.CalculateTextHeight(
                    GetTitleBlockWidth(frameWidth, show, showTime),
                    show.Title,
                    Theme.ContentFont)
                : 0f;

            var locationHeight = includeLocation
                ? (titleHeight > 0 ? TextGap : 0f) + ShowLocationTextHeight
                : 0f;

            var showDescription   = GetShowDescription(show, !showTime);
            var descriptionHeight =
                !string.IsNullOrWhiteSpace(showDescription)
                ? (titleHeight > 0 ? TextGap : 0f) + ScreenUtil.CalculateTextHeight(
                    GetDescriptionBlockWidth(frameWidth),
                    showDescription,
                    Theme.VenueShowDescriptionFont)
                : 0f;

            var textHeight = VerticalBorder + titleHeight + locationHeight + descriptionHeight;

            return(textHeight);
        }
Пример #8
0
 /// <summary>
 /// This is called when the game should draw itself.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Draw(GameTime gameTime)
 {
     //TODO: Add your drawing code here
     GamePadEx.Update(gameTime);
     TouchPanelEx.Update(gameTime);
     ScreenUtil.Draw(gameTime, spriteBatch);
 }
Пример #9
0
    void SetScreen()
    {
#if UNITY_EDITOR
        Debug.Log("Unity Editor");

        if (ScreenUtil.isVertically(Screen.width, Screen.height))
        {
            mainCamera.orthographicSize = 4.3f;
        }

        if (SystemInfo.deviceModel.Contains("iPad"))
        {
            mainCamera.orthographicSize = 6.4f;
        }
#elif UNITY_IOS
        Debug.Log("Unity iPhone");

        if (ScreenUtil.isVertically(Screen.width, Screen.height))
        {
            mainCamera.orthographicSize = 4.3f;
        }

        if (SystemInfo.deviceModel.Contains("iPad"))
        {
            mainCamera.orthographicSize = 6.4f;
        }
#else
        Debug.Log("Any other platform");
#endif
    }
Пример #10
0
        private void captureByCanvasRect()
        {
            canvas.Children.Remove(rect);

            var dpi = ScreenUtil.GetDPI();
            var res = ScreenUtil.GetScreenResolution();

            // Capture
            Hide();
            var cap = ImageUtil.CaptureScreenshot(
                (int)(Canvas.GetLeft(rect) * dpi.X + Left),
                (int)(Canvas.GetTop(rect) * dpi.Y + Top),
                (int)(rect.Width * dpi.X + Left / dpi.X),
                (int)(rect.Height * dpi.Y + Top / dpi.Y)
                );

            Show();
            playShutterSound();

            switch (this.saveType)
            {
            case SaveType.DISK:
                cap.Save(DiskUtil.GenerateDiskFilePath(), ImageFormat.Png);
                break;

            case SaveType.CLIPBOARD:
                Clipboard.SetImage(ImageUtil.ConvertBitmapToBitmapSource(cap));
                break;
            }

            rect = null;
            Close();
        }
Пример #11
0
        private static float GetImageVerticalHeight(nfloat frameWidth)
        {
            var result = ScreenUtil.GetProportionalHeight(
                new CGSize(DefaultImageVerticalWidth, DefaultImageVerticalHeight), frameWidth);

            return((float)Math.Ceiling(result));
        }
Пример #12
0
        private void StartCaptureScreen(SocketSession session)
        {
            int sleepValue = 1000;
            int fpsValue   = 1;

            while (true)
            {
                if (!_isRunning)
                {
                    return;
                }
                fpsValue   = _request.fps;
                sleepValue = 1000 / fpsValue;
                for (int i = 0; i < fpsValue; i++)
                {
                    ResponseStartGetScreen resp = new ResponseStartGetScreen();
                    try
                    {
                        resp.SetImage(ScreenUtil.CaptureScreen2(), ImageFormat.Jpeg);
                    }
                    catch (Exception ex)
                    {
                        resp.Result  = false;
                        resp.Message = ex.Message;
                        resp.Detail  = ex.StackTrace;
                    }
                    session.Send(ePacketType.PACKET_START_CAPTURE_SCREEN_RESPONSE, resp);
                    Thread.Sleep(sleepValue);
                }
            }
        }
Пример #13
0
 /// <summary>
 /// Allows the game to run logic such as updating the world,
 /// checking for collisions, gathering input, and playing audio.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Update(GameTime gameTime)
 {
     // TODO: Add your update logic here
     base.Update(gameTime);
     GamePadEx.Update(gameTime);
     TouchPanelEx.Update(gameTime);
     ScreenUtil.Update(gameTime);
 }
Пример #14
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //TODO: use this.Content to load your game content here
            ScreenUtil.Show(ScreenUtil.CurrentScreen ?? new SplashScreen(this));
        }
Пример #15
0
 public Bounds GetCachedCameraBounds(bool force_to_refresh)
 {
     if (force_to_refresh)
     {
         cached_bounds_ = ScreenUtil.CalculateOrthographicBounds(camera);
     }
     return(cached_bounds_);
 }
Пример #16
0
 void Update()
 {
     SpawnX = ScreenUtil.GetRightScreenBorderX(cam) + 1;
     if (latest.transform.position.x <= tileWidth)
     {
         SpawnBackground(latest.transform.position.x + tileWidth);
     }
 }
Пример #17
0
 // Start is called before the first frame update
 private void Start()
 {
     cam    = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
     SpawnX = ScreenUtil.GetRightScreenBorderX(cam) + 1;
     SpawnBackground(-tileWidth);
     SpawnBackground(0);
     SpawnBackground(tileWidth);
 }
Пример #18
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            ScreenUtil.Show(new Splash(this));
            //GamePadEx.KeyboardPlayerIndex = PlayerIndex.One;
            GamePadEx.KeyboardPlayerIndexEx = PlayerIndexEx.Auto;

            base.Initialize();
        }
Пример #19
0
    private void SetUpWalls()
    {
        var bounds = ScreenUtil.GetScreenBounds(this);

        _leftWall.transform.position   = new Vector3(bounds.xMin, 0, 0);
        _rightWall.transform.position  = new Vector3(bounds.xMax, 0, 0);
        _topWall.transform.position    = new Vector3(0, bounds.yMax, 0);
        _bottomWall.transform.position = new Vector3(0, bounds.yMin, 0);
    }
Пример #20
0
        public override void Dismiss()
        {
            this._transform.DTAnchoredPositionTo(ScreenUtil.ConvertRelativeCoord(new Vector2(0.0f, -1.0f)), 1.5f)
            .SetCompletionHandler(this.EndDismiss)
            .SetEaseType(EaseType.ExpoOut)
            .Start();

            base.Dismiss();
        }
Пример #21
0
    void OnDrawGizmos()
    {
        Bounds b = ScreenUtil.GetVisibleBounds();

        b.Expand(BufferRoom);

        Gizmos.color = Color.green;
        Gizmos.DrawWireCube(b.center, b.extents * 2.0f);
    }
Пример #22
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //TODO: use this.Content to load your game content here
            BitmapFont.LoadedFonts = BitmapFont.LoadFromTextureAtlas(Content, "titleAndFonts");
            ScreenUtil.Show(ScreenUtil.CurrentScreen ?? new SplashScreen(this));
        }
Пример #23
0
    //-----------------------------------------------------------------------------
    void Update()
    {
        Bounds screen = ScreenUtil.GetVisibleBounds();

        screen.size += bounds.size * 2.0f;
        if (!screen.Contains(transform.position))
        {
            GameObject.Destroy(gameObject);
        }
    }
Пример #24
0
        /// <summary>
        /// Draw the selection rectangle
        /// </summary>
        private void OnGUI()
        {
            if (!isSelecting)
            {
                return;
            }
            var rect = ScreenUtil.GetScreenRect(selectionStart, Input.mousePosition);

            DrawUtil.DrawScreenBorderedRect(rect, 2, SelectionBorderColor, SelectionFillColor);
        }
Пример #25
0
        // PRAGMA MARK - Public Interface
        public override void Show()
        {
            this._transform.anchoredPosition = ScreenUtil.ConvertRelativeCoord(new Vector2(0.0f, 1.0f));
            this._transform.DTAnchoredPositionTo(ScreenUtil.ConvertRelativeCoord(new Vector2(0.0f, 0.0f)), 1.5f)
            .SetCompletionHandler(this.EndShow)
            .SetEaseType(EaseType.BounceOut)
            .Start();

            base.Show();
        }
Пример #26
0
    /*
     * Shows current scrore and multiplier on top left corner of screen
     */
    void OnGUI()
    {
        //Buffer needed incase Seebright is enabled
        float buffer = GameManager.Instance.enableSeebright ? ScreenUtil.getPixelHeight(50) : 0;

        GUIManager.DrawLabel(new Rect(buffer, buffer, 0, 0), CurrentScore.ToString(), style);
        GUI.color = Color.blue;
        GUIManager.DrawLabel(new Rect(buffer, buffer + style.fontSize, ScreenUtil.ScreenWidth, ScreenUtil.ScreenHeight),
                             "Multiplier : " + CurrentMultiplier.ToString(), style);
    }
Пример #27
0
 public void Tick()
 {
     _bullets.ForEach(bullet =>
     {
         if (!ScreenUtil.WorldPositionIsInView(bullet.transform.position) || bullet.DespawnPending)
         {
             Destroy(bullet);
         }
     });
 }
Пример #28
0
    /**
     * Draws the HighScore menu
     */
    private void drawHighScore()
    {
        Color prev = GUI.color;

        GUI.color = Color.magenta;
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(100),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "High Scores", style);
        GUI.color = prev;
        GUI.color = Color.green;
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2,
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "1)   " + PlayerPrefs.GetInt("highscorePos" + 1), style);
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(70),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "2)   " + PlayerPrefs.GetInt("highscorePos" + 2), style);
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(140),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "3)   " + PlayerPrefs.GetInt("highscorePos" + 3), style);
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(210),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "4)   " + PlayerPrefs.GetInt("highscorePos" + 4), style);
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(280),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "5)   " + PlayerPrefs.GetInt("highscorePos" + 5), style);

        //Back Button
        GUI.color = Color.white;
        GUI.SetNextControlName("0");
        if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2,
                                ScreenUtil.ScreenHeight - ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(200), style.fontSize), new GUIContent("Back", "0"), style))
        {
            _displayHighScore = false;
        }
        if (GUI.tooltip == "0")
        {
            _highlightStyle.normal = style.hover;
        }
        if (GameManager.Instance.enableSeebright)
        {
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2 + ScreenUtil.ScreenWidth,
                                ScreenUtil.ScreenHeight - ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(200), style.fontSize), "Back", _highlightStyle);
        }
        _highlightStyle.normal = style.normal;
        //Joystick Menu Navigation
        _focusID = ManageFocus(_focusID, 0);
        if (GameManager.Instance.enableSeebright && SBRemote.remoteStatus)
        {
            if (SBRemote.GetButtonDown(SBRemote.BUTTON_SELECT))
            {
                if (_focusID < 0)
                {
                    return;
                }
                else if (_focusID == 0)
                {
                    _displayHighScore = false;
                }
            }
        }
    }
Пример #29
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

            //TODO: Add your drawing code here
            spriteBatch.Begin(transformMatrix: ScreenUtil.TransformationMatrix);
            ScreenUtil.Draw(gameTime, spriteBatch);
            spriteBatch.End();

            base.Draw(gameTime);
        }
Пример #30
0
 void Start()
 {
     //Implements singleton
     if (_instance != null)
     {
         Debug.LogError("Can't initialize more than one instance of GUI Manager!");
     }
     defaultStyle.fontSize = (int)ScreenUtil.getPixelHeight(defaultStyle.fontSize);
     _instance             = this;
     _items = new List <GUIItem>();
 }