Esempio n. 1
0
        void SubmitScore(int level)
        {
            BackgroundHTTPWorker_Initialise(LeaderBoardAPICall.AddScore);
            LeaderBoardClient LittleTiggyLBClient = new LeaderBoardClient();

            LittleTiggyLBClient.APICall    = LeaderBoardAPICall.AddScore;
            LittleTiggyLBClient.name       = playerName;
            LittleTiggyLBClient.score      = level;
            LittleTiggyLBClient.difficulty = gameDifficulty.ToString();

            BackgroundHTTPWorker.RunWorkerAsync(LittleTiggyLBClient);
        }
Esempio n. 2
0
        void leaderBoardUpdate(GameTime gameTime)
        {
            // Call LeaderBoardAPI GetScores method on new thread via BG worker
            if (!bGetScoresRequested && !LittleTiggy.bDisableNetworkCalls)
            {
                BackgroundHTTPWorker_Initialise(LeaderBoardAPICall.GetScores);
                LeaderBoardClient LittleTiggyLBClient = new LeaderBoardClient();
                LittleTiggyLBClient.APICall = LeaderBoardAPICall.GetScores;
                BackgroundHTTPWorker.RunWorkerAsync(LittleTiggyLBClient);
                bGetScoresRequested = true;
            }


            resetButtonHover();
            MouseState mouseState = Mouse.GetState();

            mouseXY = new Vector2(mouseState.X, mouseState.Y);
            TouchCollection touchCollection = TouchPanel.GetState();
            Vector2         touchXY         = new Vector2(0, 0);

            float elementPositionY = (float)menuItemSpaceDistance * menuScaleFactor;

            if (mouseState.LeftButton == ButtonState.Pressed)
            {
                touchXY = new Vector2(mouseState.X, mouseState.Y);
            }
            else if (touchCollection.Count > 0)
            {
                touchXY = new Vector2(touchCollection[0].Position.X, touchCollection[0].Position.Y);
            }

            Rectangle mouseRectangle  = new Rectangle((int)mouseXY.X, (int)mouseXY.Y, 2, 2);
            Rectangle touchRectangle  = new Rectangle((int)touchXY.X, (int)touchXY.Y, 1, 1);
            Rectangle rectangleGoBack = new Rectangle(menuButtonXOffset, (int)(elementPositionY), 600, 150);

            if (mouseXY.X != 0 && mouseXY.Y != 0)
            {
                if (rectangleGoBack.Intersects(mouseRectangle))
                {
                    menuButtonHover[0] = true;
                }
            }

            if (touchXY.X != 0 && touchXY.Y != 0)
            {
                if (rectangleGoBack.Intersects(touchRectangle) == true)
                {
                    LittleTiggy.menuSound.Play();
                    gameState = GameState.menu;
                }
            }
        }