void PopulateRevenue() { float total = 0; foreach (var rev in gameRevenues) { total += rev; } for (int i = 0; i < financeReportRows.Length; i++) { if (i == 0) { financeReportRows[i].label.text = "Total Revenues"; financeReportRows[i].value.text = string.Format("${0:N0}", total); } else if (MarketManager.IsGameAvailable((GameType)(i - 1)) && GameManager.IsDepartmentExists(Departments.Finance)) { financeReportRows[i].label.text = string.Format("- {0}", MarketManager.GetGameNames((GameType)(i - 1))); financeReportRows[i].value.text = string.Format("({1}) ${0:N0}", gameRevenues[i - 1], gameSaleCount[i - 1]); } else { financeReportRows[i].label.text = ""; financeReportRows[i].value.text = ""; } } if (!GameManager.IsDepartmentExists(Departments.Finance)) { financeDeptMissingObject.SetActive(true); } expenseByDept.SetActive(false); }
void PopulatePrices(bool init = false) { for (int i = 0; i < pricesRows.Length; i++) { if (MarketManager.IsGameAvailable(i)) { pricesRows[i].gameName.transform.parent.gameObject.SetActive(true); pricesRows[i].gameName.text = string.Format("{0}", MarketManager.GetGameNames((GameType)i)); UpdatePricesUI(i); } else { pricesRows[i].gameName.transform.parent.gameObject.SetActive(false); } } }
void PopulateInitialRestock() { for (int i = 0; i < restockRows.Length; i++) { if (MarketManager.IsGameAvailable(i)) { restockRows[i].gameName.transform.parent.gameObject.SetActive(true); restockRows[i].gameName.text = string.Format("{0}", MarketManager.GetGameNames((GameType)i)); restockRows[i].stockText.text = string.Format("{0:N0}", Logistics.GetStock(i)); restockRows[i].priceText.text = "$0"; restockRows[i].stockSlider.value = 0; restockRows[i].stockSlider.maxValue = Logistics.GetCapacity() - Logistics.GetStock(i); } else { restockRows[i].gameName.transform.parent.gameObject.SetActive(false); } } }
// Update is called once per frame void Update() { if (exiting) { return; } if (!depts.ContainsKey(Departments.Logistics) || !depts.ContainsKey(Departments.Cashier) || !depts.ContainsKey(Departments.Showcase)) { Debug.LogError("Cannot load game: Department requirements not met\nRequired Logistics, Cashier and Showcase"); enabled = false; } if (canSpawnCustomer && !isSpawning) { t += Time.deltaTime; } if (t >= NetCustomerSpawnTime && canSpawnCustomer) { t = 0; isSpawning = true; StartCoroutine(SpawnTime()); } if (!mainMenuMode) { timeText.text = string.Format("{0:N0}:{1:00}", DaytimeManager.TimeHour, DaytimeManager.TimeMinute); stockTab.totalStocks.text = string.Format("{0:N0}/{1:N0}", Logistics.GetTotalStocks(), Logistics.GetCapacity()); stockTab.totalStocksBar.maxValue = Logistics.GetCapacity(); stockTab.totalStocksBar.value = Logistics.GetTotalStocks(); stockTab.totalStocksFill.color = Color.HSVToRGB((1 - (float)Logistics.GetTotalStocks() / Logistics.GetCapacity()) / 3.6f, 1, 1); for (int i = 0; i < 5; i++) { if (MarketManager.IsGameAvailable((GameType)i)) { stockTab.gameTitles[i].text = MarketManager.GetGameNames((GameType)i); stockTab.gameStocks[i].text = Logistics.GetStock(i).ToString("n0"); if (i > 0) { stockTab.separators[i - 1].SetActive(true); } } else { stockTab.gameTitles[i].text = ""; stockTab.gameStocks[i].text = ""; if (i > 0) { stockTab.separators[i - 1].SetActive(false); } } } //Input (touch) if (Time.timeScale != 0 && !EndDayManager.IsPanelOpen) { var touch = Input.touches; if (touch.Length == 1 && touch[0].deltaPosition.magnitude > 0.2f) { Vector3 delta = new Vector3(touch[0].deltaPosition.x, 0, touch[0].deltaPosition.y); cameraPivot.Translate(delta * -Time.deltaTime * 0.4f * panSensitivity); } else if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { ISelectable sel = hit.collider.GetComponent <ISelectable>(); if (sel != null && !(sel is Showcase)) { if (selected == null) { selectStatusAnim.Play("Open"); } DeselectAll(); selected = sel; selected.Select(); } else { if (selected != null) { selectStatusAnim.Play("Close"); } DeselectAll(); } } } } if (selected != null) { if (selected is Customer) { var selectedCustomer = selected as Customer; customerSelect.SetActive(true); departmentSelect.SetActive(false); customerSelectContents.NameText.text = selectedCustomer.custName; customerSelectContents.Text1Text.text = selectedCustomer.CurrentActionName + " " + (selectedCustomer.CurrentActionName == "Shopping" ? MarketManager.GetGameNames(selectedCustomer.GameDemand) : ""); customerSelectContents.Bar1Slider.maxValue = 100; customerSelectContents.Bar1Slider.value = selectedCustomer.Happiness; customerSelectContents.Progress1Slider.maxValue = selectedCustomer.MaxProgressTime; customerSelectContents.Progress1Slider.value = selectedCustomer.CurrentProgressTime; customerSelectContents.stat1.text = selectedCustomer.Visits.ToString("n0"); customerSelectContents.stat2.text = string.Format("${0:n0}", selectedCustomer.TotalSpendings); } else if (selected is DepartmentBase) { var selectedDept = selected as DepartmentBase; departmentSelect.SetActive(true); customerSelect.SetActive(false); departmentSelectContents.departmentName.text = selectedDept.departmentName; departmentSelectContents.trustBar.maxValue = 100; departmentSelectContents.trustBar.value = selectedDept.CurrentTrust; if (selected is Cashier || selected is CustomerService) { departmentSelectContents.workSpeedLbl.text = "Work Speed"; } else { departmentSelectContents.workSpeedValue.text = "Effectiveness"; } departmentSelectContents.workSpeedValue.text = string.Format("{0:N0}%", selectedDept.WorkSpeed * 100); } } } }