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); } }
public void UpdateMapUi() { if (mapui == null) { GameObject findmap = GameObject.Find("Mapui"); if (findmap != null && findmap.GetComponent <MapUi>() != null) { mapui = findmap.GetComponent <MapUi>(); } } if (mapui != null) { int count = 0; while (count < rooms.childCount) { mapui.SetRoomImage(count, rooms.GetChild(count).GetComponent <Room>()); count++; } } }
// Start is called before the first frame update void Start() { options.GetComponent <Options>().Start(); levelData = DataPassedToMainGame.level_data; if (levelData == null) { levelData = testLevelData; } timeslots = new List <GameObject>(); currentSchedule = new List <ActionData>(); actionslots = new List <GameObject>(); campaignMessages = new List <CampaignMessage>(); actionDistrictTarget = new List <int>(); actionMessageTarget = new List <int>(); switch (DataPassedToMainGame.diff) { case 0: randomDialogueEvents = levelData.NormalEvents; break; case 1: randomDialogueEvents = levelData.HardcoreEvents; break; } likeVoteGain = levelData.likeVoteGain; dislikeVoteGain = levelData.dislikeVoteGain; neutralVoteGain = levelData.neutralVoteGain; actions = levelData.actionSlots; days = levelData.days; campaignMessages = levelData.campaignMessages; resourceslots = levelData.resources; forVotesCount = levelData.forVotesStart; totalVotesCount = levelData.totalVotes; defaultBackground = levelData.defaultBackground; int districtCount = levelData.districtNames.Count; isUsingDistricts = levelData.districtNames.Count > 0; if (isUsingDistricts) { mapContainer = levelData.mapContainer; schedulingUi.Add(MapUi); districts = new List <District>(); List <int> msgIndexes = Enumerable.Range(0, levelData.campaignMessages.Count).ToList(); for (int i = 0; i < districtCount; i++) { districts.Add(new District(msgIndexes, 1, 1)); districts[i].name = levelData.districtNames[i]; districts[i].forVotesCount = forVotesCount; districts[i].totalVotesCount = totalVotesCount; } forVotesCount *= districtCount; totalVotesCount *= districtCount; } Init(levelData.startTime, levelData.endTime); if (levelData.introductionDialogue != null) { DisableSchedulingUi(); Desc.GetComponent <EventExecuter>().ExecuteEventDialogue( levelData.introductionDialogue, makeCurrentStatistics(), ResumeSchedulingRedirect ); } else { Reset(); } if (DataPassedToMainGame.tutorial) { switch (levelData.level) { case 1: tutorial = Instantiate(tutorialPrefabs[0], tutorialBox); tutorial.GetComponent <Tutorial>().Init(levelData.level, this, greyBG); break; case 2: tutorial = Instantiate(tutorialPrefabs[1], tutorialBox); tutorial.GetComponent <Tutorial>().Init(levelData.level, this, greyBG, MapUi.GetComponentInChildren <MapButton>(), SpeechUi); break; } } }