Пример #1
0
        /// <summary>
        /// Creates a new hud
        /// </summary>
        /// <param name="layer"></param>
        public SpritesetHud(SceneLayer layer, PointsController controller, InputControllerState source)
            : base(layer)
        {
            _source     = source;
            _controller = controller;

            _cursorStandard = new Sprite(layer, "Graphics/Pointer-Standard");
            _cursorDelete   = new Sprite(layer, "Graphics/Pointer-Delete");

            _placingBlock  = new DataBlock(source.GridPosition, source.Type == BlockType.None ? BlockType.Normal : source.Type, null);
            _placingSprite = new SpriteBlock(layer, _placingBlock);

            _spriteLogo = new Sprite(layer, "Graphics/Logo")
            {
                Position = Vector2.UnitY * 40 + Vector2.UnitX * 50
            };
            _spriteHappyPoints = new Sprite(layer, "Graphics/Icon-HappyPoints")
            {
                Position = Vector2.UnitY * 40 + Vector2.UnitX * 520
            };
            _spriteTime = new Sprite(layer, "Graphics/Icon-Time")
            {
                Position = Vector2.UnitY * 40 + Vector2.UnitX * 1130
            };
        }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     gmi = GameManager.Instance;
     pc  = FindObjectOfType <PointsController>();
     LoadGame("Player");
     spawnCtrl = FindObjectOfType <SpawnerController>();
 }
Пример #3
0
    public void LeaveResults()
    {
        switch (PointsController.lastAction)
        {
        case "Harvest":
            SceneManager.LoadScene("Invest");
            break;

        case "Invest":
            SceneManager.LoadScene("MicroActions");
            break;

        case "MicroActions":
            if ((PointsController.totalGhgPoints >= PointsController.maxGhg)
                | (PointsController.spotsHit == 3))
            {
                PointsController.ChangeLastAction("EndGame");
                SceneManager.LoadScene("EndGame");
            }
            else
            {
                SceneManager.LoadScene("Map");
            }
            break;

        case "Scan":
            SceneManager.LoadScene("Harvest");
            break;

        case "EndGame":
            PointsController.ResetScores();
            SceneManager.LoadScene("LandingPage");
            break;
        }
    }
Пример #4
0
        public async void points_controller_post_should_return_accepted()
        {
            var busClientMock = new Mock <IBusClient>();
            var controller    = new PointsController(busClientMock.Object);
            var userId        = Guid.NewGuid();

            controller.ControllerContext = new ControllerContext
            {
                HttpContext = new DefaultHttpContext
                {
                    User = new ClaimsPrincipal(new ClaimsIdentity(
                                                   new Claim[]
                    {
                        new Claim(ClaimTypes.Name, userId.ToString())
                    }, "test"))
                }
            };

            var command = new CreatePoint
            {
                Id     = Guid.NewGuid(),
                UserId = userId
            };

            var result = await controller.Post(command);

            var contentResult = result as AcceptedResult;

            contentResult.Should().NotBeNull();
            contentResult.Location.Should().BeEquivalentTo("points/" + command.Id);
        }
Пример #5
0
        //called from js
        public async Task <GWTeam> GetPlayersTeam(int teamId, int currentGameWeekId)
        {
            List <Player> allPlayers = await GetAllPlayers();

            List <Team> allTeams = await GetAllTeams();

            List <Game> allGames = await GetAllGames();

            List <GWPlayer> allGwPlayers = await GetAllGwPlayers(currentGameWeekId);

            List <Game> gwGames = await GetGwGames(currentGameWeekId);

            GWTeam      gwTeam      = new GWTeam();
            EventStatus eventStatus = await GetEventStatus();

            var PointsController = new PointsController(_httpClient);

            gwTeam = await PointsController.PopulateGwTeam(gwTeam, currentGameWeekId, teamId);

            gwTeam = PointsController.AddPlayerSummaryDataToTeam(allPlayers, allTeams, allGames, gwTeam, teamId, currentGameWeekId);
            gwTeam = await PointsController.AddTransfersToGwTeam(allPlayers, gwTeam, teamId, currentGameWeekId);

            gwTeam.picks = PointsController.AddPlayerGameweekDataToTeam(gwGames, allGwPlayers, gwTeam.picks, currentGameWeekId);
            gwTeam       = PointsController.AddAutoSubs(gwTeam, gwTeam.picks, teamId, eventStatus, currentGameWeekId);
            gwTeam.picks = PointsController.AddEstimatedBonusToTeamPicks(gwTeam.picks, eventStatus);

            return(gwTeam);
        }
Пример #6
0
    //effectiveness bar display
    //current progress


    void Awake()
    {
        initTierCircleCol = tier_circle_img.color;
        inactive          = new Color(1f, 1f, 1f, inactive_opacity);
        active            = new Color(1f, 1f, 1f, 1f);
        start_tier_color  = new Color(70 / 255.0f, 193 / 255.0f, 73 / 255.0f, 1f);
        diff_tier_color   = new Color(140 / 255.0f, 25 / 255.0f, 36 / 255.0f, 1f);
        Button[] buttons = this.GetComponentsInChildren <Button>();
        //Text[] textinp = this.GetComponentsInChildren<Text>();
        //tierTracker = textinp[1];
        //costText = textinp[0];
        costText.text = cost.ToString();
        plusButton    = buttons[0].GetComponent <Button>();
        minusButton   = buttons[1].GetComponent <Button>();
        SpriteRenderer[] spritelist = this.GetComponentsInChildren <SpriteRenderer>();
        //render = spritelist[2];
        //startsprite = render.sprite;
        //tier_circle = spritelist[3];
        //startcircle = tier_circle.sprite;
        //Debug.Log(tier_circle);
        pointsLeftText = GameObject.FindGameObjectWithTag("Points").GetComponent <PointsController>();

        /*resource = new Sprite[resourcecount];
         * for (int i = 0; i < resourcecount; i++)
         * {
         *  resource[i] = Resources.Load<Sprite>("Solutions/" + resourcename + (i + 1));
         * }*/
        plusButton.onClick.AddListener(PlusTaskOnClick);
        minusButton.onClick.AddListener(MinusTaskOnClick);
    }
Пример #7
0
 private void Start()
 {
     startSpread = false;
     InvokeRepeating("AutoGetMoney", 2f, pInfo.tgPro);
     SpawnCircle();
     pControl = FindObjectOfType <PointsController>();
 }
Пример #8
0
    // Use this for initialization
    void Start()
    {
        PointsControllerRef = GameObject.FindObjectOfType <PointsController>();

        List <GameObject> points = new List <GameObject>();

        for (int i = 0; i < spawnCount; i++)
        {
            GameObject p = Instantiate(point);

            p.name = "Point" + i;

            float x = Random.Range(-10.0f, 10.0f);
            float y = Random.Range(-10.0f, 10.0f);

            p.transform.position   = new Vector2(x, y);
            p.transform.localScale = 3.0f * Vector3.one;
            points.Add(p);
        }

        ch = new RandomIncrementalConvexHull(points.Select(p => (Vector2)p.transform.position).ToList());
        GameObject obj = new GameObject("Hull");

        Debug.Log("Current hull vertices: " + ch.hull.vertices.Count);
        foreach (Vector2 p in ch.hull.vertices.Select(x => (Vector2)x.position))
        {
            GameObject pointObject = Instantiate(point, obj.transform);
            pointObject.transform.position   = p;
            pointObject.transform.localScale = 3 * Vector3.one;
            pointObject.GetComponent <Point>().DisplayColor          = Color.red;
            pointObject.GetComponent <SpriteRenderer>().sortingOrder = 10;
        }

        //List<int> result = Algorithms.ConvexHullBasic(points);
        //for (int i = 0; i < result.Count; ++i)
        //{
        //    Vector2 a = points[result[i]].transform.position;
        //    Vector2 b = points[result[(i + 1) % result.Count]].transform.position;
        //    for (int j = 0; j < points.Count; ++j)
        //    {
        //        if (!(j == result[i] || j == result[(i + 1) % result.Count]))
        //        {
        //            Vector2 p = points[j].transform.position;
        //            if (Algorithms.isLeft(a, b, p))
        //            {
        //                Debug.Log("Failed on a: " + a + " b: " + b + " p: " + p);
        //            }
        //        }
        //    }

        //}

        //print(result.Count);

        //foreach (GameObject p in result.Select(x => points[x]))
        //{
        //    p.GetComponent<Point>().DisplayColor = Color.red;
        //    p.GetComponent<SpriteRenderer>().sortingOrder = 10;
        //}
    }
Пример #9
0
    private void SpawnPoints(Vector2 position, int points, CandyColor candyColor)
    {
        PointsController point = Instantiate(m_pointsController, position, m_pointsController.transform.rotation) as PointsController;

        point.gameObject.transform.SetParent(gameObject.transform, false);
        point.SetUp(position, points, m_candyColor2RGBAColorDictonary[candyColor]);
    }
Пример #10
0
    void Start () 
    {
        pc = GameObject.Find("GLOBAL_SCRIPTS").GetComponent<PointsController>();

        capacity = 180;
        fillLevel = 0;
        overflowThreshold = capacity * 1.5f;
    }
Пример #11
0
 public void OnHomeButton()
 {
     deadMenuPanel.SetActive(false);
     mainMenuPanel.SetActive(true);
     Generate.DeleteElements();
     PointsController.ResetScore();
     Rotate.IsGameEnded = false;
 }
Пример #12
0
        private async Task <Result> GetUserTeamIfNotInRetrievedPage(Classic l, PointsController pointsController, List <Game> gwGames, List <Player> allPlayers, List <Team> allTeams, List <Game> allGames, List <GWPlayer> allGwPlayers, EventStatus eventStatus, int gameweekId, int topOfLeaguePointsTotal)
        {
            var userTeam = new Result();

            HttpClientHandler handler = new HttpClientHandler();

            var response = await _httpClient.GetAuthAsync(CreateHandler(handler), $"entry/{teamId}/");

            response.EnsureSuccessStatusCode();

            var content = await response.Content.ReadAsStringAsync();

            var leaguesJSON = JObject.Parse(content);

            JObject leaguesObject = (JObject)leaguesJSON["leagues"];
            Leagues leagues       = leaguesObject.ToObject <Leagues>();

            var selectedLeague = leagues.classic.Find(x => x.id == l.id);

            if (selectedLeague != null)
            {
                GWTeam gwTeam = new GWTeam();
                gwTeam = await pointsController.PopulateGwTeam(gwTeam, gameweekId, teamId);

                gwTeam = pointsController.AddPlayerSummaryDataToTeam(allPlayers, allTeams, allGames, gwTeam, teamId, gameweekId);
                gwTeam = await pointsController.AddTransfersToGwTeam(allPlayers, gwTeam, teamId, gameweekId);

                gwTeam.picks = pointsController.AddPlayerGameweekDataToTeam(gwGames, allGwPlayers, gwTeam.picks, gameweekId);
                gwTeam       = pointsController.AddAutoSubs(gwTeam, gwTeam.picks, teamId, eventStatus, gameweekId);
                userTeam.CompleteEntryHistory = await pointsController.GetCompleteEntryHistory(userTeam.CompleteEntryHistory, teamId);

                gwTeam.picks = pointsController.AddEstimatedBonusToTeamPicks(gwTeam.picks, eventStatus);
                var teamDetails = await pointsController.GetTeamInfo(teamId);

                gwTeam.OverallRank = (int)teamDetails.summary_overall_rank;

                foreach (var p in gwTeam.picks)
                {
                    CalculatePlayersYetToPlay(gwTeam, p);
                }

                //CalculateRankAndPFF(l);

                int gwpoints = pointsController.GetGameWeekPoints(gwTeam.picks, eventStatus);
                userTeam.Last5GwPoints   = userTeam.CompleteEntryHistory.GetLast5GwPoints(gwpoints);
                userTeam.total           = CalculatePlayerTotal(teamDetails, gwpoints);
                userTeam.PointsFromFirst = topOfLeaguePointsTotal - userTeam.total;
                userTeam.event_total     = gwpoints;
                userTeam.GWTeam          = gwTeam;
                userTeam.rank            = selectedLeague.entry_rank;
                userTeam.player_name     = teamDetails.player_first_name + ' ' + teamDetails.player_last_name;
                userTeam.entry_name      = teamDetails.name;

                return(userTeam);
            }

            return(null);
        }
Пример #13
0
 public void OnPlayButton()
 {
     deadMenuPanel.SetActive(false);
     Generate.DeleteElements();
     PointsController.ResetScore();
     Generate.GeneratePlatform(cube, redCube);
     Stick.IsPlayerAtTheEndOfPlatform = true;
     Rotate.IsGameEnded = false;
 }
Пример #14
0
        public void ApiGetPoints()
        {
            var acc = Mock.Of <IPointService>(a => a.GetPoints() == _manyPoints);
            var uow = Mock.Of <IUnitOfWork>(u => u.PointService == acc);
            PointsController controller = new PointsController(uow);
            var points = controller.GetPoints();

            Assert.IsTrue(points.EqualValues(_manyPoints));
        }
Пример #15
0
        public void Points_Get_All_StatusCode_200(int status)
        {
            PointsController controller = new PointsController(_pointRepository);

            IActionResult result = controller.GetPoints();

            int?actionResult = ((ObjectResult)result.Should().Subject).StatusCode;

            actionResult.Should().Be(status, $"StatusCode should be {status}");
        }
Пример #16
0
    // Use this for initialization
    void Start()
    {
        PointsControllerRef = GameObject.FindObjectOfType <PointsController>();

        ControlPanel          = transform.Find("Control Panel").GetComponent <RectTransform>();
        SpawnedPointsText     = ControlPanel.Find("Spawned Points Text").GetComponent <Text>();
        SpawnRandomInputField = ControlPanel.Find("Spawn Number").GetComponent <InputField>();
        ModelDropdown         = ControlPanel.Find("Model Dropdown").GetComponent <Dropdown>();
        ModelDropdown.AddOptions(PointsControllerRef.ModelPrefabs.Select(p => p.Name).ToList());
    }
Пример #17
0
 /// <summary>
 /// Creates a new sprite pea
 /// </summary>
 /// <param name="layer"></param>
 /// <param name="source"></param>
 /// <param name="pointsController"></param>
 public SpritePea(SceneLayer layer, DataPea source, PointsController pointsController)
     : base(layer)
 {
     _source                  = source;
     _pointsController        = pointsController;
     _source.OnJumpStarted   += new JumpEventHandler(_source_OnJumpStarted);
     _source.OnJumpCompleted += new JumpEventHandler(_source_OnJumpCompleted);
     _source.OnJumpFailed    += new JumpEventHandler(_source_OnJumpCompleted);
     _source.OnRevive        += new EventHandler(_source_OnRevive);
 }
Пример #18
0
        public void Points_Get_Id_StatusCode_404(int status)
        {
            PointsController controller = new PointsController(_pointRepository);

            IActionResult result = controller.GetPoint(100);

            int statusCode = ((NotFoundResult)result.Should().Subject).StatusCode;

            statusCode.Should().Be(status, $"StatusCode should be {status}");
        }
Пример #19
0
    void Start()
    {
        pc = GameObject.Find("GLOBAL_SCRIPTS").GetComponent<PointsController>();

        liquidCollider = Instantiate(GameObject.Find("liquid"));
        liquidCollider.SetActive(false);

        maxStabbings = 1;
        stabbedTimes = 0;
    }
Пример #20
0
        public void Points_Get_Id_StatusCode_400(int status)
        {
            IPointRepository pointRepository = null;
            PointsController controller      = new PointsController(pointRepository);

            IActionResult result = controller.GetPoint(1);

            int?statusCode = ((BadRequestObjectResult)result.Should().Subject).StatusCode;

            statusCode.Should().Be(status, $"StatusCode should be {status}");
        }
Пример #21
0
 public WinLoseController(GameObject winScreen, GameObject loseScreen,
                          InputHandlingBlocker inputHandlingBlocker, AudioSource sceneMusicSource,
                          NextFightController nextFightController, PointsController pointsController)
 {
     _winScreen            = winScreen;
     _loseScreen           = loseScreen;
     _inputHandlingBlocker = inputHandlingBlocker;
     _sceneMusicSource     = sceneMusicSource;
     _nextFightController  = nextFightController;
     _pointsController     = pointsController;
 }
    void Start()
    {
        bs = boardObject.GetComponent <Board_Generating> ();
        pc = pointsController.GetComponent <PointsController> ();


        timeToPrompt = 3.0f;
        candies      = bs.candies;
        candiesPos   = bs.candiesPos;
        StartCoroutine("WaitForBoardsReady");
    }
Пример #23
0
    //When collide with other object
    void OnTriggerEnter2D(Collider2D other)
    {
        //Collide with points
        if (other.gameObject.tag == "point")
        {
            Player.Instance.Points += 10;

            PointsController po = other.gameObject.GetComponent <PointsController> ();
            //Reset the point object
            if (po != null)
            {
                po.Reset();
            }

            AudioSource asrc = other.gameObject.GetComponent <AudioSource> ();
            //Play collection sound
            if (asrc != null)
            {
                asrc.Play();
            }
        }         //Collide with ememy
        else if (other.gameObject.tag == "enemy")
        {
            Player.Instance.Health -= 1;

            EnemyController en = other.gameObject.GetComponent <EnemyController> ();
            //Show explosion and reset enemy
            if (en != null)
            {
                GameObject ex = Instantiate(explosion);
                ex.transform.position = en.transform.position;
                en.Reset();
            }
            //
            AudioSource asrc = other.gameObject.GetComponent <AudioSource> ();
            //Play explosion sound
            if (asrc != null)
            {
                asrc.Play();
            }
        }
        else if (other.gameObject.tag == "power")
        {
            //Points add 15
            Player.Instance.Points += 15;
            //Health add 1
            Player.Instance.Health += 1;
            //hide power object
            other.gameObject.SetActive(false);
            //Increase plane speed
            PlaneController plane = gameObject.GetComponent <PlaneController> ();
            plane.PowerUpSpeed();
        }
    }
Пример #24
0
        public override void HandleAdditionalInfo(StringBuilder Builder)
        {
            Builder.AppendLine();
            var PointText = LanguageManager.Get("m.point");

            foreach (var Point in PointsController.GetPoints())
            {
                var Color = Point.CurrentTeam?.ColorFormat ?? Globals.FORMAT_WHITE;

                Builder.Append(Color).Append(PointText).Append(' ').AppendLine(Point.Name);
            }
        }
Пример #25
0
 public static void GenerateNextPlatformTrigger(GameObject myWall, GameObject platformTrigger, float high, AudioSource audio)
 {
     if (myWall.transform.position.x + high <= endPlatform)
     {
         NextPlatformTrigger(platformTrigger);
     }
     if (myWall.transform.position.x + high <= startPlatform + lengthOfPlatform / 2 + 1 && myWall.transform.position.x + high >= startPlatform + lengthOfPlatform / 2)
     {
         PointsController.ChangeScore();
         audio.Play();
     }
 }
Пример #26
0
        public async Task ShouldGetPoint_A_BadRequestWithInvalidModel()
        {
            // Arrange
            var controller = new PointsController(MockCreator.GetMockPointsService(Guid.Empty.ToString()), MockCreator.GetMockAccountsService());

            // Act
            var result = await controller.GetPointByIdAsync(Guid.Empty, new CancellationToken());

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(BadRequestObjectResult));
        }
Пример #27
0
        public void CreateGet_ReturnsAnEmptyViewResult()
        {
            // Arrange
            var mockRepo   = new Mock <IPointsRepository>();
            var controller = new PointsController(mockRepo.Object);

            // Act
            var result = controller.Create();

            // Assert
            Assert.IsType <ViewResult>(result);
        }
Пример #28
0
        public void ApiGetPointById()
        {
            long             id         = 7;
            var              acc        = Mock.Of <IPointService>(a => a.GetPoint(id) == _samplePoint1);
            var              uow        = Mock.Of <IUnitOfWork>(u => u.PointService == acc);
            PointsController controller = new PointsController(uow);
            var              response   = controller.GetPoint(id);
            var              result     = response as OkNegotiatedContentResult <PointDto>;
            var              point      = result.Content;

            Assert.IsTrue(point.EqualValues(_samplePoint1));
        }
Пример #29
0
 private void OnClick(GameObject go)
 {
     if (go.GetComponent <Character>().GetIsHited() == false && go.GetComponent <Character>().GetIsShowing() == true)
     {
         Character character = go.GetComponent <Character>();
         character.SetIsHited(true);
         character.GetCharacterAnimation().GoTo(Character.STATE_HITED);
         SoundManager.PlaySoundByName(SoundConstants.SFX_CORRECT_HIT);
         //CharacterManager.Instance.HideCharacter(character);
         PointsController.AddPoints(PointsController.GetPointsToAdd());
     }
 }
Пример #30
0
        public async Task EditPost_ReturnsANotFoundResult_WhenIdIsDifferentFromPointId()
        {
            // Arrange
            var mockRepo   = new Mock <IPointsRepository>();
            var controller = new PointsController(mockRepo.Object);

            // Act
            var result = await controller.Edit(2, GetTestPoints()[0]);

            // Assert
            Assert.IsType <NotFoundResult>(result);
        }
Пример #31
0
 void OnMouseDown()
 {
     if (GetIsHited() == false && GetIsShowing() == true)
     {
         SetIsHited(true);
         GetCharacterAnimation().GoTo(Character.STATE_HITED);
         SoundManager.PlaySoundByName(SoundConstants.SFX_CORRECT_HIT);
         //CharacterManager.Instance.HideCharacter(character);
         PointsController.AddPoints(PointsController.GetPointsToAdd());
         FindObjectOfType <IndexController>().AddObjectToLIstByIndex(GetCharacterAnimation().GetState(Character.STATE_HITED).gameObject, GetIndex());
     }
 }
Пример #32
0
        public async Task DetailsGet_ReturnsNotFound_WhenIdIsNull()
        {
            // Arrange
            var mockRepo   = new Mock <IPointsRepository>();
            var controller = new PointsController(mockRepo.Object);

            // Act
            var result = await controller.Details(null);

            // Assert
            Assert.IsType <NotFoundResult>(result);
        }
Пример #33
0
    void Awake () 
    {
		sceneController = GameObject.Find ("GLOBAL_SCRIPTS").GetComponent<SceneController> ();
        pc = GameObject.Find("GLOBAL_SCRIPTS").GetComponent<PointsController>();
		string keyName = Application.loadedLevelName + "-" + gameObject.name;

		if (sceneController.tableObjectPositions.ContainsKey (keyName))
		{			
			Vector2 objectPos = sceneController.tableObjectPositions [keyName];
			gameObject.GetComponent<Rigidbody2D> ().position = objectPos;
		} 
    }
Пример #34
0
 void Start () 
 {
     pc = GameObject.Find("GLOBAL_SCRIPTS").GetComponent<PointsController>();
     text = gameObject.GetComponent<Text>();
 }