Esempio n. 1
0
        public void CbOnBtnHireEmployeeClicked()
        {
            if (!uiHolder.StateController.GameManager.MasterLoader.PlayerScoreModel.IsEnoughCash(employeeHireCost))
            {
                btnHireEmployee.interactable = false;
                if (enoughCashCheckCorouting == null)
                {
                    enoughCashCheckCorouting = StartCoroutine(CheckForEnoughCash());
                }
                return;
            }

            UiHolder.StateController.GameManager.MasterLoader.PlayerScoreModel.DeductCash((decimal)employeeHireCost);
            UiHolder.ReloadPlayerScoreInHeaderUI();

            if (department != null && department.CanAddDoctor())
            {
                Management.Doctor.Core.DoctorType doctorType = uiHolder.StateController.GameManager.WhichDoctor(department.DepartmentType);
                uiHolder.StateController.GameManager.SpawnDoctor(doctorType, uiHolder.StateController);
                sliderStaffHire.value = department.GetDoctorAvailibilityPercent();
                uiHolder.StateController.HospitalManager.HospitalBuilding.SaveGameDataWithStaffHiring(department.DepartmentType);

                UiHolder.StateController.GameAudioManager.PlaySound(Audio.AudioType.UPGRADE_BTN_CLICKED);
                UpdateStaffCost(department);
            }
            else if (paymentDepartment != null && paymentDepartment.CanAddStaff())
            {
                if (paymentDepartment.DepartmentType == Hospital.Core.DepartmentType.CONSULTATION_FEES)
                {
                    UiHolder.StateController.GameManager.SpawnCashierInConsulationDepartment(UiHolder.StateController);
                }
                else
                {
                    UiHolder.StateController.GameManager.SpawnCashierInPharmacyDepartment(UiHolder.StateController);
                }
                sliderStaffHire.value = paymentDepartment.GetStaffPercentage();
                uiHolder.StateController.HospitalManager.HospitalBuilding.SaveGameDataWithStaffHiring(paymentDepartment.DepartmentType);

                UiHolder.StateController.GameAudioManager.PlaySound(Audio.AudioType.UPGRADE_BTN_CLICKED);
                UpdateStaffCost(paymentDepartment);
            }
            UpdateStaffUI();
            saveNeeded = true;
        }
Esempio n. 2
0
        public void LoadDepartmentData(Management.Hospital.PaymentDepartment _paymentDepartment)
        {
            saveNeeded        = false;
            paymentDepartment = _paymentDepartment;
            if (paymentDepartment == null)
            {
                Debug.LogError("Ui_Department: base departent is null in");
                return;
            }
            panelHireStaff.SetActive(true);
            hospitalDepartmentData       = uiHolder.StateController.GameManager.MasterLoader.HospitalDepartmentSaveModel.GetData(paymentDepartment.DepartmentType);
            departmentStaffAndSalaryData = Arch.Json.JsonReader.LoadJson <Management.Hospital.Json.DepartmenStaffAndSalarytData>
                                               (uiHolder.StateController.HospitalJsonDataScriptable.DepartmentStaffAndSalaryJson.text);

            txtDepartmentTitle.text = paymentDepartment.DeaprtmentUpgradeJson.department;
            txtBaseIncomeValue.text = paymentDepartment.DeaprtmentUpgradeJson.base_income.ToString();

            LoadNextUpgradeData(paymentDepartment);

            sliderStaffHire.value = paymentDepartment.GetStaffPercentage();

            UpdateStaffCost((Management.Hospital.BaseDepartment)paymentDepartment);
        }