public void SelectAction(ActionData action) { if (selectedTimeslot != -1) { if (action.actionType == ActionData.ActionType.TradingVotes && levelData.messageEnabled) { isSpeech = true; SpeechUi.SetActive(true); SpeechUi.GetComponentInChildren <Text>().text = "Speech"; Confirm.GetComponent <Button>().interactable = false; } else if (action.actionType == ActionData.ActionType.Research) { isSpeech = false; SpeechUi.SetActive(true); SpeechUi.GetComponentInChildren <Text>().text = "Talk to the Masses"; Confirm.GetComponent <Button>().interactable = false; SpeechContainer.SetActive(false); actionMessageTarget[selectedTimeslot] = -2; } else { currentSchedule[selectedTimeslot] = action; timeslots[selectedTimeslot].GetComponent <TimeSlotter>().SetAction(action); selectedTimeslot = -1; } } }
void Init(int start_hour, int end_hour) { selectedTimeslot = -1; for (int i = start_hour; i < end_hour; i++) { GameObject timeslot = Instantiate(timeslotPrefab, TimeslotContainer.transform); timeslot.GetComponent <TimeSlotter>().Init(i - start_hour, i, this); timeslots.Add(timeslot); currentSchedule.Add(null); actionDistrictTarget.Add(-1); actionMessageTarget.Add(-1); } for (int i = 0; i < actions.Count; i++) { GameObject actionslot = Instantiate(actionslotPrefab, ActionContainer.transform); actionslot.GetComponent <ActionSlotter>().Init(actions[i], this, Desc); actionslots.Add(actionslot); } for (int i = 0; i < resourceslots.Count; i++) { Instantiate(resourceslots[i], ResourceContainer.transform); } MoneySlider = GameObject.FindWithTag("Money"); InfluenceSlider = GameObject.FindWithTag("Influence"); if (levelData.advancedResourcesEnabled) { StressSlider = GameObject.FindWithTag("Stress"); CharismaSlider = GameObject.FindWithTag("Charisma"); } LayoutRebuilder.ForceRebuildLayoutImmediate(ActionContainer.GetComponent <RectTransform>()); if (isUsingDistricts) { miniMap = Instantiate(mapContainer, MapUi.transform.Find("Button")); bigMap = Instantiate(mapContainer, MapUi.transform.Find("Map Container")); miniMap.GetComponent <MapController>().setMini(); miniMap.GetComponent <MapController>().UpdateDistricts(districts); bigMap.GetComponent <MapController>().UpdateDistricts(districts); MapUi.SetActive(true); MapUi.GetComponentInChildren <MapButton>().Init(bigMap); SpeechUi.SetActive(true); for (int i = 0; i < campaignMessages.Count; i++) { GameObject messageslot = Instantiate(messageslotPrefab, SpeechContainer.transform) as GameObject; messageslot.GetComponent <MessageSlotter>().Init(campaignMessages[i], this, Desc, i); messageslots.Add(messageslot); } speechMap = Instantiate(mapContainer, SpeechUi.transform.Find("SpeechMap")); speechMap.GetComponent <MapController>().DisableDistricts(this); speechMap.GetComponent <MapController>().Buttonify(this); SpeechUi.SetActive(false); } }