コード例 #1
0
        void Start()
        {
            rigibody = GetComponent <Rigidbody>();
            UI       = FindObjectOfType <CarUI>();
            StartCoroutine(FindBall());

            currentBoost    = maxBoostEnergy;
            currentCarAccel = carNormalAccel;
            dist            = GetComponentInChildren <Collider>().bounds.extents.y;

            if (isLocalPlayer)
            {
                var camera = FindObjectOfType <CameraFollow>();
                camera.Player = this.transform;
                ballArrow.SetActive(true);
                startPosition = transform.position;
            }
            else
            {
                ballArrow.SetActive(false);
                GetComponent <AudioSource>().enabled = true;
            }
            SetCarColor();
            SetCarName();
        }
コード例 #2
0
        public void AddCar(CarUI carUI)
        {
            Car car = new Car()
            {
                Name     = carUI.Name,
                Price    = carUI.Price,
                Status   = carUI.Status,
                Engine   = ConvertToEngine(carUI.Engine),
                Gearbox  = ConvertTOGearbox(carUI.Gearbox),
                Interior = ConvertTOInterior(carUI.Interior),
                Exterior = ConvertTOExterior(carUI.Exterior)
            };

            _WCF.AddCar(car);
        }
コード例 #3
0
        public CarUI ConvertToCarUI(Car car)
        {
            CarUI carUI = new CarUI()
            {
                Id       = car.Id,
                Name     = car.Name,
                Price    = car.Price,
                Status   = car.Status,
                Engine   = ConvertToEngineUI(car.Engine),
                Gearbox  = ConvertToGearBoxUI(car.Gearbox),
                Interior = ConvertToInteriorUI(car.Interior),
                Exterior = ConvertToExteriorUI(car.Exterior)
            };

            return(carUI);
        }
コード例 #4
0
 private void EndModifyCar(object sender, RoutedEventArgs e)
 {
     if (decimal.TryParse(CarPrice.Text, out decimal price))
     {
         CarUI carUI = new CarUI()
         {
             Name     = CarName.Text,
             Price    = price,
             Engine   = CarEngine.SelectedItem as EngineUI,
             Gearbox  = CarGearbox.SelectedItem as GearboxUI,
             Interior = CarInterior.SelectedItem as InteriorUI,
             Exterior = CarExterior.SelectedItem as ExteriorUI,
             Id       = id
         };
         Methods.ModifyCar(carUI);
     }
 }
コード例 #5
0
        private void AddCar(object sender, RoutedEventArgs e)
        {
            decimal.TryParse(CarPrice.Text, out decimal price);
            string name = CarName.Text;

            if (CarEngine.SelectedIndex >= 0 && CarGearbox.SelectedIndex >= 0 && CarInterior.SelectedIndex >= 0 && CarExterior.SelectedIndex >= 0 && price >= 0)
            {
                EngineUI   engineUI   = CarEngine.SelectedItem as EngineUI;
                GearboxUI  gearboxUI  = CarGearbox.SelectedItem as GearboxUI;
                InteriorUI interiorUI = CarInterior.SelectedItem as InteriorUI;
                ExteriorUI exteriorUI = CarExterior.SelectedItem as ExteriorUI;
                CarUI      carUI      = new CarUI()
                {
                    Engine = engineUI, Exterior = exteriorUI, Gearbox = gearboxUI, Interior = interiorUI, Name = name, Price = price, Status = "Not Sold"
                };
                Methods.AddCar(carUI);
            }
        }
コード例 #6
0
        static void Main(string[] args)
        {
            // carManager is from business layer
            // UI sends data access layer reference to carManager
            // carManager uses DAL methods fo manipulate data

            //CarManager carManager = new CarManager(new InMemoryCarDal());
            MainUI     mainUI     = new MainUI();
            BrandUI    brandUI    = new BrandUI();
            CarUI      carUI      = new CarUI();
            UserUI     userUI     = new UserUI();
            CustomerUI customerUI = new CustomerUI();
            RentalUI   rentalUI   = new RentalUI();


            List <IUserInterface> userInterfaces = new List <IUserInterface> {
                brandUI, carUI, userUI, customerUI, rentalUI
            };

            mainUI.Show(userInterfaces);
        }
コード例 #7
0
 /// <summary>
 /// A media button was pressed on the status bar
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void statusBar_OnMediaButtonPressed(object sender, CarUI.MediaButton e)
 {
     switch (e)
     {
         case CarUI.MediaButton.Back:
             //Back button
             Session.CurMusicQueue.PreviousSong();
             break;
         case CarUI.MediaButton.Forward:
             //Forward button
             Session.CurMusicQueue.NextSong();
             break;
         case CarUI.MediaButton.Pause:
             //Pause button
             Session.CurMusicQueue.Pause();
             break;
         case CarUI.MediaButton.Play:
             Session.CurMusicQueue.Play();
             //Play button
             break;
         case CarUI.MediaButton.RepeatOn:
             Session.CurMusicQueue.Repeat = true;
             //Repeat button
             break;
         case CarUI.MediaButton.RepeatOff:
             Session.CurMusicQueue.Repeat = false;
             //Repeat button
             break;
         case CarUI.MediaButton.ShuffleOn:
             Session.CurMusicQueue.Shuffle = true;
             //Shuffle button
             break;
         case CarUI.MediaButton.ShuffleOff:
             Session.CurMusicQueue.Shuffle = false;
             //Shuffle button
             break;
     }
 }
コード例 #8
0
        /// <summary>
        /// The music player's state changed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void musicPlayer_OnStateChanged(object sender, CarUI.PlayerState e)
        {
            //Update the cover art
            if (e == CarUI.PlayerState.Opened)
            {
                coverArt.UpdateCoverArt(Session.CurMusicQueue.NowPlaying.CoverArt);
                statusBar.NowPlayingChanged(Session.CurMusicQueue.NowPlaying.Name);
            }

            //Notify the status bar of the change
            statusBar.StateChanged(e);
        }