Ejemplo n.º 1
0
    // At the end of the game show the player rankings/scores
    public void Run(GameObject[] Players)
    {
        // Add all the player objects to an arraylist
        ArrayList rankings = new ArrayList();

        for (int i = 0; i < Players.Length; i++)
        {
            rankings.Add(Players[i]);
        }
        for (int j = 0; j < Players.Length; j++)
        {
            // Calculate the highest remaining score and assign that player to the variable best
            GameObject best = (GameObject)rankings[0];
            for (int k = 0; k < rankings.Count; k++)
            {
                if (((GameObject)rankings[k]).GetComponent <PlayerController>().Score > best.GetComponent <PlayerController>().Score)
                {
                    best = Players[k];
                }
            }

            // 1st place gets assigned to the 1st podium, 2nd place to the 2nd podium and so on
            PlaceController placeCon = Podiums[j + Offset].GetComponent <PlaceController>();
            // Set the podiums score and colour to match the associated player
            placeCon.Score = best.GetComponent <PlayerController>().Score;
            placeCon.Player.GetComponent <Renderer>().material = best.GetComponent <Renderer>().material;
            // Show the podium on the screen
            placeCon.EndScreen();
            // Remove the player from the array list in order to calculate the next highest score
            rankings.Remove(best);
        }
    }
Ejemplo n.º 2
0
        public Services(IAcceptsOneControl viewFrame)
        {
            EventBus = new SimpleEventBus();
            IPresenterMapper presenterMapper = new PresenterMapper(this);
            PlaceController = new PlaceController(EventBus, presenterMapper, viewFrame);

            TestView = new TestView();
        }
            public void Send_Null_Should_Return_NoContentResult()
            {
                // When
                var result = PlaceController.GetPlaces(null);

                // Then
                Assert.IsType <BadRequestObjectResult>(result);
            }
Ejemplo n.º 4
0
 // Hide the podiums so the next game can happen
 public void Clear()
 {
     for (int j = 0; j < Podiums.Length; j++)
     {
         PlaceController placeCon = Podiums[j].GetComponent <PlaceController>();
         placeCon.Reposition();
     }
 }
Ejemplo n.º 5
0
 static PlaceImplementaion()
 {
     //Arrange
     baseController = new PlaceController
     {
         Request       = new HttpRequestMessage(),
         Configuration = new HttpConfiguration()
     };
 }
Ejemplo n.º 6
0
 public TripsModel(IStorage storage)
 {
     _trips = new TripController(storage);
     _photos = new PhotoController(storage);
     _places = new PlaceController(storage);
     _goals = new GoalController(storage);
     _goods = new GoodController(storage);
     _purchases = new PurchaseController(storage);
 }
Ejemplo n.º 7
0
        public Services(IAcceptsOneControl viewFrame)
        {
            EventBus = new SimpleEventBus();
            IPresenterMapper presenterMapper = new PresenterMapper(this);

            PlaceController = new PlaceController(EventBus, presenterMapper, viewFrame);

            TestView = new TestView();
        }
Ejemplo n.º 8
0
        public void GetPlaceContentTest()
        {
            int             GetPlaceById    = 1;
            PlaceController placeController = new PlaceController();

            var city   = placeController.GetPlaceById(GetPlaceById) as OkNegotiatedContentResult <Place>;
            var actual = city.Content;

            Assert.IsNotNull(actual);
        }
Ejemplo n.º 9
0
        public void GetPlaceActionTest()
        {
            int             cityId            = 1;
            int             numberOfTopPlaces = 4;
            PlaceController placeController   = new PlaceController();

            IHttpActionResult actual = placeController.GetTopPlacesByCityId(cityId, numberOfTopPlaces);

            Assert.That(actual, Is.TypeOf <OkNegotiatedContentResult <List <Place> > >());
        }
Ejemplo n.º 10
0
    void Start()
    {
        allTiles         = GetComponent <AllTiles>();
        _placeController = GetComponent <PlaceController>();

        for (int i = 0; i < buttons.Length; i++)
        {
            buttons[i].GetComponent <Image>().sprite = allTiles.tiles[i].sprite;
        }
    }
Ejemplo n.º 11
0
        public PlaceControllerTest()
        {
            var hostingEnvironment   = new Mock <IHostingEnvironment>();
            var projectRootDirectory = Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName).FullName;

            hostingEnvironment.Setup(m => m.ContentRootPath).Returns(projectRootDirectory);
            IPlaceRepository  = new DummyPlaceRepository(hostingEnvironment.Object);
            IPlaceService     = new PlaceService(IPlaceRepository);
            IModelTransformer = new ModelTransformer(hostingEnvironment.Object);
            PlaceController   = new PlaceController(IPlaceService, IModelTransformer);
        }
Ejemplo n.º 12
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this);
     }
     else
     {
         _instance = this;
     }
 }
Ejemplo n.º 13
0
        public void GetDomainByNameReturnDataOk()
        {
            _placeRepositoryMock.Setup(x => x.Get(It.IsAny <string>())).Returns(new Place());

            _placeController = new PlaceController(_placeRepositoryMock.Object);

            var response = _placeController.GetDomainByName("Tokyo");

            var okResult = response as OkObjectResult;

            Assert.IsNotNull(okResult);
            Assert.AreEqual((int)HttpStatusCode.OK, okResult.StatusCode);
        }
Ejemplo n.º 14
0
            public void Send_No_Valid_PlaceName_Should_Return_NoContentResult()
            {
                // Given
                var placesList = new PlacesPostModel {
                    PlaceNames = new List <string>()
                    {
                        "KiwiLand", "AussieLand"
                    }
                };

                // When
                var result = PlaceController.GetPlaces(placesList);

                // Then
                Assert.IsType <NoContentResult>(result);
            }
Ejemplo n.º 15
0
    private void Start()
    {
        statsController = GetComponent <StatsController>();
        placeController = GetComponent <PlaceController>();
        allTiles        = GetComponent <AllTiles>();

        tilemap          = GameObject.FindGameObjectWithTag("Tilemap").GetComponent <Tilemap>();
        cameraFollow     = GameObject.FindGameObjectWithTag("MCamera").GetComponent <CameraController>();
        healthController = GameObject.FindGameObjectWithTag("Health Controller").GetComponent <HealthController>();
        gameController   = GameObject.FindGameObjectWithTag("Game Controller").GetComponent <GameController>();

        if (gameController.actualMode == GameController.SceneMode.Editor)
        {
            isEditor = true;
        }
        StartCoroutine(ShowMessage("Click ESC to quit.", 4f));
    }
Ejemplo n.º 16
0
            public void Send_Valid_PlaceName_Should_Return_OkObjectResult_With_A_List_Of_PlaceViewModels()
            {
                // Given
                var placesList = new PlacesPostModel {
                    PlaceNames = new List <string>()
                    {
                        "New_York_City", "Tokyo"
                    }
                };

                // When
                var result = PlaceController.GetPlaces(placesList);

                // Then
                var okResult = Assert.IsType <OkObjectResult>(result);

                Assert.IsType <List <PlaceViewModel> >(okResult.Value);
            }
Ejemplo n.º 17
0
            public void Send_Only_1_PlaceName_Should_Return_OkObjectResult_With_A_List_Of_Only_1_PlaceViewModel()
            {
                // Given
                var placesList = new PlacesPostModel {
                    PlaceNames = new List <string>()
                    {
                        "New_York_City", "AussieLand"
                    }
                };

                // When
                var result = PlaceController.GetPlaces(placesList);

                // Then
                var okResult = Assert.IsType <OkObjectResult>(result);

                Assert.IsType <List <PlaceViewModel> >(okResult.Value);
                var placeViewModels = (List <PlaceViewModel>)okResult.Value;

                Assert.True(placeViewModels.Count == 1);
            }
Ejemplo n.º 18
0
 public void Initialize()
 {
     foreach (var place in _placeService.GetItemList())
     {
         _placeService.Delete(place.Id);
     }
     _placeService.Save();
     _mockTrack  = new Mock <IService <Track> >();
     _mockUser   = new Mock <IService <User> >();
     _controller = new PlaceController(_mockUser.Object, _placeService, _mockTrack.Object);
     place1      = new Place()
     {
         Name = "firstPlaceName", Description = "fisrstPlaceDescription"
     };
     place2 = new Place()
     {
         Name = "secondPlaceName", Description = "secondPlaceDescription"
     };
     //   place3 = new Place() { Name = "thridPlaceName", Description = "thridPlaceDescription", };
     _placeService.Create(place1);
     _placeService.Create(place2);
     _placeService.Save();
 }
Ejemplo n.º 19
0
 protected void dvDataSource_Updating(object sender, ObjectDataSourceMethodEventArgs e)
 {
     Broker.DataAccess.Place p = e.InputParameters["newEntity"] as Broker.DataAccess.Place;
     PlaceController.ValidateUpdateCode(p.ID, p.Code);
 }
Ejemplo n.º 20
0
 private void Start()
 {
     testSave = GameObject.FindGameObjectWithTag("TestSave").GetComponent <PlaceController>();
 }
Ejemplo n.º 21
0
        public PlaceControllerTest()
        {
            _placeRepository = A.Fake <IPlaceRepository>();

            _placeController = new PlaceController(_placeRepository);
        }
Ejemplo n.º 22
0
 protected void dvDataSource_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
 {
     Broker.DataAccess.Place p = e.InputParameters["entityToInsert"] as Broker.DataAccess.Place;
     PlaceController.ValidateInsertCode(p.Code);
 }