public void SetColor(ePlayers player, eColors color)
 {
     if (players.ContainsKey(player))
     {
         players [player].Color = color;
     }
 }
示例#2
0
        public void GuessBtn_Click(Object sender, EventArgs e)
        {
            Button currentColorButton;
            int    numOfEmptyGuesses = 0;

            m_CurrentBtn = sender as Button;
            m_ColorSelectForm.DesignedButtonColor = m_CurrentBtn;
            m_ColorSelectForm.ShowDialog();
            EnableColorButtons();
            foreach (Button btnGuessButton in m_CurrentGuessButtons)
            {
                if (btnGuessButton.BackColor == Color.Gray)
                {
                    numOfEmptyGuesses++;
                }
                else
                {
                    eColors currentColor = convertToeColor(btnGuessButton.BackColor);
                    currentColorButton         = m_ColorSelectForm.getColorButton(currentColor);
                    currentColorButton.Enabled = false;
                    m_LastColors.Add(currentColor);
                }
            }
            if (numOfEmptyGuesses == 0)
            {
                SetGuessData(m_CurrentGuessButtons);
                Button getResultButton = m_Rows[m_TurnsCounter - 1].getGetResultButton();
                getResultButton.Enabled = true;
                if (m_TurnsCounter < m_MaxGuesses)
                {
                    m_CurrentGuessButtons = AddButtonListeners(m_TurnsCounter);
                }
            }
        }
示例#3
0
        private Pin[] GeneratePinGoalSequence()
        {
            Pin[] goalPinsSequence = new Pin[GameProperties.PinsSequenceLength];


            for (int i = 0; i < goalPinsSequence.Length; i++)
            {
                Random  randomizer  = new Random();
                int     colorNumber = randomizer.Next(m_NumberOfPinColors);
                eColors color       = (eColors)colorNumber;
                if (i > 0)
                {
                    while (!IsUniquePinColor(goalPinsSequence, color, i - 1))
                    {
                        colorNumber = randomizer.Next(m_NumberOfPinColors);
                        color       = (eColors)colorNumber;
                    }
                }

                goalPinsSequence[i] = new Pin(color);
                ////m_GoalSequence[i].Color = color;
            }

            return(goalPinsSequence);
        }
    public void ActivateColor(eColors color)
    {
        RemoveAllHandlers();

        colorToCell = color;

        OnEditField += ButtonColorFunction;
    }
示例#5
0
    public static Color GetColorByEnum(eColors color)
    {
        if (GetIdByEnum(color) == -1)
        {
            return(_colors[0]);
        }

        return(_colors[GetIdByEnum(color)]);
    }
示例#6
0
 public Car(eColors i_CarColor, eNumOfDoors i_NumOfDoors, HoldVehicleParams i_MyVehicle) : base(i_MyVehicle)
 {
     r_CarColor      = i_CarColor;
     r_CarNumOfDoors = i_NumOfDoors;
     if (i_MyVehicle.Wheels.Count > (int)eNumOfWheels.FourWheeledCar)
     {
         throw new ArgumentException(k_ErrNumOfWheels);
     }
 }
示例#7
0
 public ElectricCar(
     OwnerInfo i_Owner,
     string i_ModelName,
     string i_LicenseNumber,
     eColors i_Color,
     eNumberOfDoors i_NumOfDoors)
     : base(i_Owner, i_ModelName, i_LicenseNumber, k_MaxBatteryCapacity, i_Color, i_NumOfDoors, eEngineTypes.Electric)
 {
 }
 private void StartFlashing(eColors color1, eColors color2)
 {
     while (isLightFlashing)
     {
         notifier.SetColor(color1);
         Thread.Sleep(flashingInterval);
         notifier.SetColor(color2);
         Thread.Sleep(flashingInterval / 2);
     }
 }
示例#9
0
 public void Flip()
 {
     if (m_Color == eColors.Black)
     {
         m_Color = eColors.White;
     }
     else
     {
         m_Color = eColors.Black;
     }
 }
        private void SetColor(eColors color)
        {
            if (notifier == null)
            {
                throw new BuildStatusLightUnavailableException();
            }

            // make sure any possibly (flashing) thread ends before setting new color
            StopFlashing();
            notifier.SetColor(color);
        }
示例#11
0
 public FuelCar(
     OwnerInfo i_Owner,
     string i_ModelName,
     string i_LicenseNumber,
     eColors i_Color,
     eNumberOfDoors i_NumOfDoors,
     eFuelTypes i_FuelType)
     : base(i_Owner, i_ModelName, i_LicenseNumber, k_FuelTankCapacity, i_Color, i_NumOfDoors, eEngineTypes.Fuel)
 {
     r_FuelType = i_FuelType;
 }
    public void EditCountOfOneTargetColor(eColors color, int newCountOfTargetColor)
    {
        if (newCountOfTargetColor > Constants.MaxCountOfOneTargetColor)
        {
            EditCountOfOneTargetColor(color, Constants.MaxCountOfOneTargetColor);

            return;
        }

        _level.profile.SetTargetCount(Constants.GetIdByEnum(color), newCountOfTargetColor);

        return;
    }
示例#13
0
 public Car(
     OwnerInfo i_Owner,
     string i_ModelName,
     string i_LicenseNumber,
     float i_MaxEnergyCapacity,
     eColors i_Color,
     eNumberOfDoors i_NumOfDoors,
     eEngineTypes i_EngineType)
     : base(i_Owner, i_ModelName, i_LicenseNumber, i_MaxEnergyCapacity, k_MaxAirPressure, k_NumberOfWheels, i_EngineType)
 {
     r_Color         = i_Color;
     r_NumberOfDoors = i_NumOfDoors;
 }
示例#14
0
        internal static int CountColors(List <eColors> io_Input, eColors i_Color)
        {
            int counter = 0;

            foreach (eColors currentColor in io_Input)
            {
                if (i_Color == currentColor)
                {
                    counter++;
                }
            }

            return(counter);
        }
示例#15
0
    public void Construct(int x, int y, eColors color, int gravity, bool isGenerator, int typeOfBlock, int typeOfJelly, int teleport, bool isSugarDrop, bool isActive)
    {
        this.x = x;

        this.y = y;

        _color = color;

        SetColorInCell(_color);

        _gravity = gravity;

        _gravityImage.transform.Rotate(new Vector3(0, 0, -90) * _gravity);

        _isGenerator = isGenerator;

        if (isGenerator)
        {
            _generatorImage.SetActive(true);
        }

        _textOfBlock.text = typeOfBlock.ToString();

        SetBlock(typeOfBlock);

        _typeOfJelly = typeOfJelly;

        _textOfJelly.text = TypeOfJellyInString(_typeOfJelly);

        _teleport = teleport;

        if (_teleport == 0)
        {
            _teleportText.text = "";
        }
        else
        {
            _teleportText.text = "T - " + teleport.ToString();
        }

        _isSugarDrop = isSugarDrop;

        if (_isSugarDrop)
        {
            _sugarDropImage.SetActive(true);
        }

        IsActive = isActive;
    }
示例#16
0
    public void Start()
    {
        chip_1.onClick.AddListener(() => chipClicked(chip_1));
        chip_5.onClick.AddListener(() => chipClicked(chip_5));
        chip_10.onClick.AddListener(() => chipClicked(chip_10));
        chip_20.onClick.AddListener(() => chipClicked(chip_20));
        chip_50.onClick.AddListener(() => chipClicked(chip_50));
        chip_100.onClick.AddListener(() => chipClicked(chip_100));
        chip_500.onClick.AddListener(() => chipClicked(chip_500));
        chip_1000.onClick.AddListener(() => chipClicked(chip_1000));
        chip_5000.onClick.AddListener(() => chipClicked(chip_5000));
        spin.onClick.AddListener(() => Play());

        for (int i = 0; i < betPositions.Count; i++)
        {
            betPositionValues.Add(0);
            Button button = betPositions[i];
        }

        for (int i = 0; i <= 36; i++)
        {
            bool    setEven;
            eColors color = eColors.Green;

            if (i % 2 == 0)
            {
                setEven = true;
            }
            else
            {
                setEven = false;
            }

            if (i == 0)
            {
                color = eColors.Green;
            }
            else if (i == 1 || i == 3 || i == 5 || i == 7 || i == 9 || i == 12 || i == 14 || i == 16 || i == 18 || i == 19 || i == 21 || i == 23 || i == 25 || i == 27 || i == 30 || i == 32 || i == 34 || i == 36)
            {
                color = eColors.Red;
            }
            else
            {
                color = eColors.Black;
            }
            locations.Add(new Location(i, color, setEven));
        }
    }
示例#17
0
        internal void SetColor(String i_Color)
        {
            eColors o_Color;

            if (Enum.IsDefined(typeof(eColors), i_Color))
            {
                if (eColors.TryParse(i_Color, out o_Color))
                {
                    this.m_Color = o_Color;
                }
                else
                {
                    throw new ArgumentException("You can choose only Red, Silver, White or Black color to the car");
                }
            }
        }
示例#18
0
    // Update is called once per frame
    void Update()
    {
        if (_localent == null)     // an update frame is actually run once before start, so we need to nullcheck first
        {
            return;
        }
        var        ray = Camera.main.ScreenPointToRay(Input.mousePosition); // setup vars
        RaycastHit hit;

        if (Input.GetKeyUp(KeyCode.E))
        {
            if (Physics.Raycast(ray, out hit, 3.0f))                                           // raycast right in front of us
            {
                if (hit.collider.gameObject == gameObject && _localent.NextColor == RoomColor) //  make sure this is our next color
                {
                    if (_localent.ColorID != 3)                                                // make sure we haven't won
                    {
                        _localent.ColorID++;                                                   // setup for the next color
                    }
                    for (int i = _localent.SelectorBlocks.Length - 1; i >= 0; i--)             // for loop is much faster than foreach btw
                    {
                        GameObject block = _localent.SelectorBlocks [i];                       // loop
                        if (block.GetComponent <BlockController>().ID != _localent.ColorID)
                        {
                            continue;                                                      // continue loop if not color we want
                        }
                        Color   col     = block.GetComponent <Renderer> ().material.color; // get current block color
                        eColors nextCol = 0;                                               // loop through block colors
                        if (col == Color.red)
                        {
                            nextCol = eColors.kRed;
                        }
                        if (col == Color.blue)
                        {
                            nextCol = eColors.kBlue;
                        }
                        if (col == Color.green)
                        {
                            nextCol = eColors.kGreen;
                        }
                        _localent.NextColor = nextCol;         // set next color
                    }
                    GetComponent <AudioSource>().Play();
                }
            }
        }
    }
示例#19
0
        private bool IsUniquePinColor(Pin[] i_GoalPinSequence, eColors i_Color, int i_MaxIterator)
        {
            bool result   = true;
            int  iterator = 0;

            //// IN ORDER NOT TO USE i_MaxIterator:
            ////foreach (Pin currentPin in m_GoalSequence)
            ////{
            ////    if (!currentPin.Equals(null))
            ////    {
            ////        if (i_Color == currentPin.Color)
            ////        {
            ////            result = false;
            ////            break;
            ////        }
            ////    }
            ////    else
            ////    {
            ////        break;
            ////    }
            ////}


            foreach (Pin currentPin in i_GoalPinSequence)
            {
                if (iterator < i_MaxIterator)
                {
                    if (i_Color == currentPin.Color)
                    {
                        result = false;
                        break;
                    }
                    else
                    {
                        iterator++;
                    }
                }
                else
                {
                    break;
                }
            }

            return(result);
        }
示例#20
0
        public void SetCarAdditionalParams(string i_LicenseNumber, int i_VehicleColor, int i_NumOfDoors)
        {
            GarageVehicle garageVehicle = VehiclesInGarage[i_LicenseNumber];

            eColors color      = checkIfValidColorParam(i_VehicleColor);
            eDoors  numOfDoors = checkIfValidDoorsParam(i_NumOfDoors);

            if (garageVehicle.Vehicle is FuelCar)
            {
                FuelCar fuelCar = garageVehicle.Vehicle as FuelCar;
                fuelCar.CarDetails.VehicleColor = color;
                fuelCar.CarDetails.NumOfDoors   = numOfDoors;
            }
            else if (garageVehicle.Vehicle is ElectricCar)
            {
                ElectricCar electricCar = garageVehicle.Vehicle as ElectricCar;
                electricCar.CarDetails.VehicleColor = color;
                electricCar.CarDetails.NumOfDoors   = numOfDoors;
            }
        }
示例#21
0
 private Color convertToColor(eColors i_Color)
 {
     if (i_Color.ToString().Equals("Green"))
     {
         return(Color.Green);
     }
     if (i_Color.ToString().Equals("Blue"))
     {
         return(Color.Blue);
     }
     if (i_Color.ToString().Equals("Yellow"))
     {
         return(Color.Yellow);
     }
     if (i_Color.ToString().Equals("Brown"))
     {
         return(Color.Brown);
     }
     if (i_Color.ToString().Equals("Green"))
     {
         return(Color.Green);
     }
     if (i_Color.ToString().Equals("Purple"))
     {
         return(Color.Purple);
     }
     if (i_Color.ToString().Equals("Turquoise"))
     {
         return(Color.Turquoise);
     }
     if (i_Color.ToString().Equals("Red"))
     {
         return(Color.Red);
     }
     if (i_Color.ToString().Equals("white"))
     {
         return(Color.White);
     }
     return(Color.Black);
 }
 public System.Windows.Forms.Button getColorButton(eColors color)
 {
     if (color.ToString().Equals("Purple"))
     {
         return(PurpleButton);
     }
     else if (color.ToString().Equals("Blue"))
     {
         return(BlueButton);
     }
     else if (color.ToString().Equals("Red"))
     {
         return(RedButton);
     }
     else if (color.ToString().Equals("Yellow"))
     {
         return(YellowButton);
     }
     else if (color.ToString().Equals("White"))
     {
         return(WhiteButton);
     }
     else if (color.ToString().Equals("Turquoise"))
     {
         return(TurquoiseButton);
     }
     else if (color.ToString().Equals("Brown"))
     {
         return(BrownButton);
     }
     else if (color.ToString().Equals("Green"))
     {
         return(GreenButton);
     }
     return(null);
 }
示例#23
0
 public Location(int val, eColors color, bool even)
 {
     this.val    = val;
     this.even   = even;
     this._color = color;
 }
示例#24
0
 private static char ConvertColorToChar(eColors i_Color)
 {
     return((char)((int)'A' + (int)i_Color));
 }
        public static eTypeOfVeichle AddVeichleToGarage()
        {
            string        phoneNumber, fullName;
            string        licenceID, model, tiresModel;
            float         currentGazAmountOrHoursLeftForBattery, tiresCurrentPressure, capacity = 0;
            int           intColor, intDoorsType, readTypeOfVeicle, intLicenceType;
            bool          conrainsIsDanger = false;
            eColors       color            = eColors.Gray;
            eDoorsType    doorType         = eDoorsType.Two;
            eLiecenceType liecenceType     = eLiecenceType.A;
            Garage        garage           = new Garage();

            Console.Clear();
            readTypeOfVeicle = int.Parse(addVeichleChoice());
            Console.WriteLine("Please enter licence id of the car:");
            licenceID = Console.ReadLine();
            if (!Garage.IsLicenceIDExistInGarage(licenceID))
            {
                Console.WriteLine("Please enter your full name");
                fullName = Console.ReadLine();
                Console.WriteLine("Please enter your phone number");
                phoneNumber = Console.ReadLine();
                Console.WriteLine("Please enter Model of the car");
                model = Console.ReadLine();
                do
                {
                    if ((eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelCar ||                               //1
                        (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelMotorCycle ||                        //3
                        (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.Truck)                                   //5
                    {
                        Console.WriteLine("Please enter current gas amount of the car (numeric)");
                    }
                    else                                                                                            //2,4
                    {
                        Console.WriteLine("Please enter current hours lefft for battery of the car (numeric)");
                    }
                } while (!float.TryParse(Console.ReadLine(), out currentGazAmountOrHoursLeftForBattery));
                Console.WriteLine("please enter Tires Model of the car");
                tiresModel = Console.ReadLine();
                do
                {
                    Console.WriteLine("Please enter Tires Current pressure of the car (numeric)");
                } while (!float.TryParse(Console.ReadLine(), out tiresCurrentPressure));
                if ((eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelCar ||                           //1
                    (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.ElectricCar)                         //2
                {
                    do
                    {
                        Console.WriteLine("Please enter Color of the car\ngrey->1, green->2, white->3 , red->4");
                    } while (!(int.TryParse(Console.ReadLine(), out intColor) && intColor >= 1 && intColor <= 4));
                    color = (eColors)intColor;
                }
                else if ((eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelMotorCycle ||                   //3
                         (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.ElectricMotorCycle)                 //4
                {
                    do
                    {
                        Console.WriteLine("Please enter licence type of the car\nA->1, A1->2, B1->3 , B2->4");
                    } while (!(int.TryParse(Console.ReadLine(), out intLicenceType) && intLicenceType >= 1 && intLicenceType <= 4));
                    liecenceType = (eLiecenceType)intLicenceType;
                }
                else                                                                                            //5
                {
                    string read;
                    do
                    {
                        Console.WriteLine("Please enter Does contains danger matirials(Y/N)");
                        read = Console.ReadLine();
                    } while (!(read == "y" || read == "Y" || read == "n" || read == "N"));
                    conrainsIsDanger = read == "Y" || read == "y";
                }
                if ((eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelCar ||                           //1
                    (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.ElectricCar)                         //2
                {
                    do
                    {
                        Console.WriteLine("Please enter doors type of the car(between 2-5)");
                    } while (!((int.TryParse(Console.ReadLine(), out intDoorsType)) && intDoorsType >= 2 && intDoorsType <= 5));
                    doorType = (eDoorsType)(intDoorsType - 1);
                }
                else                                                                                        //3,4,5
                {
                    do
                    {
                        Console.WriteLine("Please enter engine capacity of the car(cc)");
                    } while (!(float.TryParse(Console.ReadLine(), out capacity)));
                }
                try
                {
                    if ((eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelCar ||                               //1
                        (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.ElectricCar)                             //2
                    {
                        garage.AddCarAndFillWithDetails((eTypeOfVeichle)readTypeOfVeicle, licenceID,
                                                        model, currentGazAmountOrHoursLeftForBattery, tiresModel, tiresCurrentPressure,
                                                        color, doorType);
                        Console.WriteLine("added a new car is succeess");
                        Console.WriteLine("for exit to main menu press any key");
                        Console.ReadLine();
                    }
                    else if ((eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelMotorCycle ||                       //3
                             (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.ElectricMotorCycle)                     //4
                    {
                        garage.AddMotorAndFillWithDetails((eTypeOfVeichle)readTypeOfVeicle,
                                                          licenceID, model, currentGazAmountOrHoursLeftForBattery,
                                                          tiresModel, tiresCurrentPressure, liecenceType, capacity);
                        Console.WriteLine("added a new motorecycle is succeess");
                        Console.WriteLine("for exit to main menu press any key");
                        Console.ReadLine();
                    }
                    else                                                                                                //5
                    {
                        garage.AddTruckAndFillWithDetails(eTypeOfVeichle.Truck, licenceID,
                                                          model, currentGazAmountOrHoursLeftForBattery, tiresModel,
                                                          tiresCurrentPressure, conrainsIsDanger, capacity);
                        Console.WriteLine("added a new truck is succeess");
                    }
                    garage.AddCustomer(fullName, phoneNumber, licenceID);
                    Console.WriteLine("for exit to main menu press any key");
                    Console.ReadLine();
                }
                catch (ValueOutOfRangeException ex)
                {
                    Console.WriteLine();
                    Console.WriteLine();
                    Console.WriteLine(ex.Message);
                    Console.WriteLine("added a new car/motorcycle/truck is failed.\nto try again press any key");
                    Console.ReadLine();
                    //System.Threading.Thread.Sleep(1500);
                    return(AddVeichleToGarage());
                }
            }
            else
            {
                Console.WriteLine("The Licence ID is exists");
                Console.WriteLine("for exit to main menu press any key");
                Console.ReadLine();
            }
            System.Threading.Thread.Sleep(1500);
            return((eTypeOfVeichle)readTypeOfVeicle);
        }
示例#26
0
    // Use this for initialization
    void Start()
    {
        if (SelectorBlocks != null)           // make sure we have blocks set
        {
            for (int i = 3 - 1; i >= 0; i--)  // loop through the blocks
            {
                GameObject go = SelectorBlocks [i];
                go.name = "ColorBlock_" + i;                    // setting name for debug reasons
                int randomcolor = Random.Range(min: 0, max: 3); // get random number
                switch (randomcolor)                            // go through our random colors
                {
                case (int)eColors.kRed:
                    go.GetComponent <Renderer> ().material.color = Color.red;
                    break;

                case (int)eColors.kBlue:
                    go.GetComponent <Renderer> ().material.color = Color.blue;
                    break;

                case (int)eColors.kGreen:
                    go.GetComponent <Renderer> ().material.color = Color.green;
                    break;
                }

                BlockController bc = go.AddComponent <BlockController> ();                // we have to do something stupid here
                bc.ID = i;                                                                // since we cant use static classes

                if (i != 0)
                {
                    continue;
                }
                ColorID   = 0;
                NextColor = (eColors)randomcolor;             // set our next color
            }
        }

        if (FogObjects == null)
        {
            return;                                             // This was something I was working on but decided to scratch it due to preformance issues. It's basically never used or called
        }
        {
            for (int i = 0; i < FogObjects.Length; i++)
            {
                GameObject go = FogObjects [i];
                for (int k = 0; k < go.transform.childCount; k++)
                {
                    ParticleSystem Ps          = go.transform.GetChild(k).transform.GetChild(0).GetComponent <ParticleSystem> ();
                    var            main        = Ps.main;
                    int            randomcolor = Random.Range(0, 3);
                    Color          mincol      = Color.white;
                    Color          maxcol      = Color.white;
                    ParticleSystem.MinMaxGradient tempStartcolor = new ParticleSystem.MinMaxGradient();
                    switch (randomcolor)
                    {
                    case (int)eColors.kRed:
                        ColorUtility.TryParseHtmlString("FFA1A114", out mincol);
                        ColorUtility.TryParseHtmlString("BC561E20", out maxcol);

                        break;

                    case (int)eColors.kBlue:
                        ColorUtility.TryParseHtmlString("FFA1A114", out mincol);
                        ColorUtility.TryParseHtmlString("BC561E20", out maxcol);
                        break;

                    case (int)eColors.kGreen:
                        ColorUtility.TryParseHtmlString("FFA1A114", out mincol);
                        ColorUtility.TryParseHtmlString("BC561E20", out maxcol);
                        break;
                    }
                    tempStartcolor.colorMin = mincol;
                    tempStartcolor.colorMin = maxcol;
                    main.startColor         = tempStartcolor;
                }
            }
        }
    }
示例#27
0
 public Pin(eColors i_Color)
 {
     m_Color = i_Color;
 }
示例#28
0
        public static eTypeOfVeichle AddVeichleToGarageMenu()
        {
            string        phoneNumber, fullName;
            string        licenceID, model;
            float         currentGazAmountOrHoursLeftForBattery, capacity = 0;
            int           intColor, intDoorsType, readTypeOfVeicle, intLicenceType;
            bool          conrainsIsDanger = false;
            List <Tire>   tire             = new List <Tire>();
            eColors       color            = eColors.Gray;
            eDoorsType    doorType         = eDoorsType.Two;
            eLiecenceType liecenceType     = eLiecenceType.A;
            Garage        garage           = new Garage();

            Console.Clear();
            readTypeOfVeicle = int.Parse(addVeichleChoice());
            Console.WriteLine("Please enter licence id of the car:");
            licenceID = Console.ReadLine();

            if (!Garage.IsLicenceIDExistInGarage(licenceID))
            {
                do
                {
                    Console.WriteLine("Please enter your full name.(only letters)");
                    fullName = Console.ReadLine();
                } while (string.IsNullOrWhiteSpace(fullName) || isStringContainsNumsOrSigns(fullName));
                do
                {
                    Console.WriteLine("Please enter your phone number(numbers only no spaces)");
                    phoneNumber = Console.ReadLine();
                } while (string.IsNullOrWhiteSpace(phoneNumber) || !isStringContainsOnlyNumerics(phoneNumber));

                Console.WriteLine("Please enter Model of the car");
                model = Console.ReadLine();
                do
                {
                    if ((eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelCar ||
                        (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelMotorCycle ||
                        (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.Truck)
                    {
                        Console.WriteLine("Please enter current gas amount of the car (Numeric)");
                    }
                    else
                    {
                        Console.WriteLine("Please enter current hours lefft for battery of the car (numeric)");
                    }
                } while (!float.TryParse(Console.ReadLine(), out currentGazAmountOrHoursLeftForBattery));
                initTires(out tire, (eTypeOfVeichle)readTypeOfVeicle);
                if ((eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelCar ||
                    (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.ElectricCar)
                {
                    do
                    {
                        Console.WriteLine(
                            @"Please enter Color of the car
1. grey
2. green
3. white
4. red");
                    } while (!(int.TryParse(Console.ReadLine(), out intColor) && intColor >= 1 && intColor <= 4));
                    color = (eColors)intColor;
                }
                else if ((eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelMotorCycle ||   //3
                         (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.ElectricMotorCycle) //4
                {
                    do
                    {
                        Console.WriteLine(
                            @"Please enter licence type of the car
1. A
2. A1
3. B1
4. B2");
                    } while (!(int.TryParse(Console.ReadLine(), out intLicenceType) && intLicenceType >= 1 && intLicenceType <= 4));
                    liecenceType = (eLiecenceType)intLicenceType;
                }
                else                                                                            //5
                {
                    string read;
                    do
                    {
                        Console.WriteLine("Please enter Does contains danger matirials(Y/N)");
                        read = Console.ReadLine();
                    } while (!(read == "y" || read == "Y" || read == "n" || read == "N"));
                    conrainsIsDanger = read == "Y" || read == "y";
                }

                if ((eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelCar ||
                    (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.ElectricCar)
                {
                    do
                    {
                        Console.WriteLine("Please enter doors type of the car(between 2-5)");
                    } while (!((int.TryParse(Console.ReadLine(), out intDoorsType)) && intDoorsType >= 2 && intDoorsType <= 5));
                    doorType = (eDoorsType)(intDoorsType - 1);
                }
                else
                {
                    do
                    {
                        Console.WriteLine("Please enter engine capacity of the car(cc)");
                    } while (!(float.TryParse(Console.ReadLine(), out capacity)));
                }

                try
                {
                    if ((eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelCar ||
                        (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.ElectricCar)
                    {
                        garage.AddCarAndFillWithDetails((eTypeOfVeichle)readTypeOfVeicle,
                                                        licenceID,
                                                        model,
                                                        currentGazAmountOrHoursLeftForBattery,
                                                        tire,
                                                        color,
                                                        doorType);
                        Console.WriteLine("added a new car is succeess");
                    }
                    else if ((eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.FuelMotorCycle ||
                             (eTypeOfVeichle)readTypeOfVeicle == eTypeOfVeichle.ElectricMotorCycle)
                    {
                        garage.AddMotorAndFillWithDetails(
                            (eTypeOfVeichle)readTypeOfVeicle,
                            licenceID,
                            model,
                            currentGazAmountOrHoursLeftForBattery,
                            tire,
                            liecenceType,
                            (int)capacity);
                        Console.WriteLine("added a new motorecycle is succeess");
                    }
                    else
                    {
                        garage.AddTruckAndFillWithDetails(
                            eTypeOfVeichle.Truck,
                            licenceID,
                            model,
                            currentGazAmountOrHoursLeftForBattery,
                            tire,
                            conrainsIsDanger,
                            capacity);
                        Console.WriteLine("added a new truck is succeess");
                    }

                    garage.AddCustomer(fullName, phoneNumber, licenceID);
                    Console.WriteLine("for exit to main menu press any key");
                    Console.ReadLine();
                }
                catch (ValueOutOfRangeException ex)
                {
                    Console.WriteLine(
                        @"


{0}
added a new car/motorcycle/truck is failed.
for try again press any key", ex.Message);
                    Console.ReadLine();
                    AddVeichleToGarageMenu();
                }
            }
            else
            {
                Garage.ChangeStatusOfVehicleIfExists(licenceID, eVeichileStatus.FIXING);
                Console.WriteLine(
                    @"The Licence ID is exists - changing the status vehicle to fixing
for exit to main menu press any key");
                Console.ReadLine();
            }

            return((eTypeOfVeichle)readTypeOfVeicle);
        }
示例#29
0
 public Disc(eColors i_Color, Point i_Location)
 {
     m_Color    = i_Color;
     r_Location = i_Location;
 }
示例#30
0
        public void AddCarAndFillWithDetails(eTypeOfVeichle i_TypeOfVeichile, string i_LicenceID, string i_VehicleModel, float i_EngineCurrentEnergy, List <Tire> i_Tires, eColors i_Color, eDoorsType i_DoorType)
        {
            switch (i_TypeOfVeichile)
            {
            case eTypeOfVeichle.FuelCar:
            case eTypeOfVeichle.ElectricCar:
                if (Vehicles == null)
                {
                    Vehicles = new List <Vehicle>();
                }

                if (Cars == null)
                {
                    Cars = new List <Car>();
                }

                Car car = VeichileFactory.CreateCar(i_TypeOfVeichile);
                car.LicenceID            = i_LicenceID;
                car.Model                = i_VehicleModel;
                car.Engine.CurrentEnergy = i_EngineCurrentEnergy;
                car.Tires                = i_Tires;
                car.Colors               = i_Color;
                car.DoorType             = i_DoorType;
                Cars.Add(car);
                Vehicles.Add(car);
                break;
            }
        }
示例#31
0
    public void SetColorInCell(eColors color)
    {
        GetComponent <Image>().color = Constants.GetColorByEnum(color);

        _color = color;
    }
示例#32
0
 public static int GetIdByEnum(eColors color)
 {
     return((int)color);
 }