Example #1
0
        private void buttonCalculate_Click(object sender, EventArgs e)
        {
            decimal hours = Convert.ToDecimal(tbHours.Text);
            decimal Hours = Math.Ceiling(hours);       //double 16?

            if (rbGeneral.Checked)
            {
                //pt = ParkType.General;

                _obj           = new GenKioskWrap(Hours); //another constructor
                lblOutput.Text = _obj.FindParkingAmount().ToString();
            }
            if (rbStudent.Checked)
            {
                pt = ParkType.Student;

                _obj           = new StudKioskWrap(Hours);
                lblOutput.Text = _obj.FindParkingAmount().ToString();
            }

            if (rbStaff.Checked)
            {
                pt = ParkType.Staff;

                _obj           = new StaffKioskWrap(Hours);
                lblOutput.Text = _obj.FindParkingAmount().ToString();
            }
        }
Example #2
0
        private int visitants;         // Not base "occupants" which are homeless

        // Add building Component to the gameObject
        public static Park CreateComponent(GameObject where,
                                           ParkType parameter1,
                                           ParkSize parameter2,
                                           ParkVariation parameter3)
        {
            Park myC = where.AddComponent <Park>();

            myC.park_type      = parameter1;
            myC.park_size      = parameter2;
            myC.park_variation = parameter3;

            return(myC);
        }
 public Car(string ownerFullName, string licensePlate, ParkType type)
 {
     ParkingTypeDictionary = new Dictionary <ParkType, ParkTypeDetails>()
     {
         { ParkType.FrequentFlyer, new ParkTypeDetails("Frequent Flyer", 10) },
         { ParkType.General, new ParkTypeDetails("General", 5) },
         { ParkType.Valet, new ParkTypeDetails("Valet", 3) }
     };
     OwnerFullName = ownerFullName;
     LicensePlate  = licensePlate;
     ParkStart     = DateTime.Now;
     TotalAmtDue   = 0;
     UserType      = ParkingTypeDictionary[type].ParkTypeName;
     HourlyRate    = ParkingTypeDictionary[type].HourlyRate;
 }
Example #4
0
    private static int typeToPrice(ParkType pt)
    {
        switch (pt)
        {
        case ParkType.GATHER:
            return(0);

        case ParkType.STICK:
            return(75);

        case ParkType.RELAX:
            return(75);

        case ParkType.PICNIC:
            return(75);
        }
        return(9999);
    }
Example #5
0
    private static string typeToString(ParkType pt)
    {
        switch (pt)
        {
        case ParkType.GATHER:
            return("Search Park");

        case ParkType.STICK:
            return("Apport");

        case ParkType.RELAX:
            return("Relax");

        case ParkType.PICNIC:
            return("Have Picnic");
        }
        return("ERROR");
    }
Example #6
0
        private void Calculate_Click(object sender, EventArgs e)
        {
            if (generalRadioBtn.Checked)
            {
                parkType = ParkType.General;
            }
            if (staffRadiobtn.Checked)
            {
                parkType = ParkType.Staff;
            }
            if (studentRadioBtn.Checked)
            {
                parkType = ParkType.Student;
            }
            string pattern = @"^\d{1,5}?\.*?\d??$";

            if (!Regex.IsMatch(InputHours.Text, pattern))
            {
                MessageBox.Show("Invalid input", "oops");
                InputHours.Text = "";
            }
            else
            {
                switch (parkType)
                {
                case ParkType.General:
                    kiosk = new GenKioskWrap(Decimal.Parse(InputHours.Text));
                    break;

                case ParkType.Staff:
                    kiosk = new StaffKioskWrap(Decimal.Parse(InputHours.Text));
                    break;

                case ParkType.Student:
                    kiosk = new StudKioskWrap(Decimal.Parse(InputHours.Text));
                    break;
                }
                Charge.Text = kiosk.FindParkingAmount().ToString();
            }
        }
Example #7
0
    protected override void PopupChoiceMade(string m)
    {
        int buttonID = int.Parse(m);

        Debug.Log("Choice: " + buttonID);
        if (buttonID == 0)
        {
            if (PetKeeper.pet.currency > typeToPrice(typeOne))
            {
                PetKeeper.pet.takeCurrency(typeToPrice(typeOne));
                typeToExecute = typeOne;
                executeEffect();
            }
        }
        else
        {
            if (PetKeeper.pet.currency > typeToPrice(typeTwo))
            {
                PetKeeper.pet.takeCurrency(typeToPrice(typeTwo));
                typeToExecute = typeTwo;
                executeEffect();
            }
        }
    }
 private String ModificationText(EntityModification modification, ParkType protectedAreaType)
 {
     String result = String.Format(EntityModificationText[modification], protectedAreaType);
     return result;
 }
Example #9
0
    protected override void initPopup(GameObject popup)
    {
        int firstType = Random.Range(0, 4);

        if (PetKeeper.pet.currency < 75)
        {
            firstType = 0;
        }

        switch (firstType)
        {
        case 0:
            typeOne = ParkType.GATHER;
            break;

        case 1:
            typeOne = ParkType.PICNIC;
            break;

        case 2:
            typeOne = ParkType.RELAX;
            break;

        case 3:
            typeOne = ParkType.STICK;
            break;
        }

        int secondType = -1;

        do
        {
            secondType = Random.Range(0, 4);
            switch (secondType)
            {
            case 0:
                typeTwo = ParkType.GATHER;
                break;

            case 1:
                typeTwo = ParkType.PICNIC;
                break;

            case 2:
                typeTwo = ParkType.RELAX;
                break;

            case 3:
                typeTwo = ParkType.STICK;
                break;
            }
        } while (firstType == secondType);

        Button[] buttons = popup.GetComponentsInChildren <Button>();
        int      i       = 0;

        foreach (Button b in buttons)
        {
            if (i == 0)
            {
                b.transform.GetChild(0).GetComponent <Text>().text = typeToString(typeOne);
                b.transform.GetChild(2).GetComponent <Text>().text = "x " + typeToPrice(typeOne);
            }
            else
            {
                b.transform.GetChild(0).GetComponent <Text>().text = typeToString(typeTwo);
                b.transform.GetChild(2).GetComponent <Text>().text = "x " + typeToPrice(typeTwo);
            }
            i++;
        }
    }
Example #10
0
        private String ModificationText(EntityModification modification, ParkType protectedAreaType)
        {
            String result = String.Format(EntityModificationText[modification], protectedAreaType);

            return(result);
        }