public override void OnInspectorGUI() { base.OnInspectorGUI(); if (GUILayout.Button("Refresh Values")) { EmailListing listing = target as EmailListing; listing.SetVisuals(); } }
public void AddEmail(EmailListing newListing) { _currentEmails.Add(newListing); _currentCaseNumber++; newListing.caseNumber = _currentCaseNumber; newListing.SetVisuals(); RectTransform newMailRect = newListing.gameObject.GetComponent <RectTransform>(); newMailRect.Translate(new Vector3(0, (newMailRect.rect.height) * -(_currentEmails.Count - 1), 0)); }
/// <summary> /// Create a new email based on the prefab provided. /// </summary> /// <param name="newListingPrefab"></param> public void NewEmail(GameObject newListingPrefab) { GameObject newEmail = Instantiate(newListingPrefab, _inboxTrans); EmailListing newListing = newEmail.GetComponent <EmailListing>(); _currentEmails.Add(newListing); _currentCaseNumber++; newListing.caseNumber = _currentCaseNumber; newListing.SetVisuals(); RectTransform newMailRect = newEmail.GetComponent <RectTransform>(); newMailRect.Translate(new Vector3(0, (newMailRect.rect.height) * -(_currentEmails.Count - 1), 0)); }
public void LogConnection() { List <EmailListingDictionary> _missionCases = FindObjectOfType <SaveManager>().GetComponent <SaveManager>().mailDictList; EmailListing preqmiss = null; foreach (var mission in _missionCases) { if (mission.listing.GetComponent <EmailListing>().listingPosition == prerequisiteMissionId) { preqmiss = mission.listing.GetComponent <EmailListing>(); } } }
/// <summary> /// Create a method when the player loads a save. /// </summary> /// <param name="newListingPrefab"></param> /// <param name="position"></param> /// <param name="status"></param> public void LoadEmail(GameObject newListingPrefab, EmailListingPosition position, int status) { GameObject newEmail = Instantiate(newListingPrefab, _inboxTrans); EmailListing newListing = newEmail.GetComponent <EmailListing>(); newListing.currentStatus = (EmailListing.CaseStatus)status; _currentEmails.Add(newListing); _currentCaseNumber++; newListing.caseNumber = _currentCaseNumber; newListing.SetVisuals(); RectTransform newMailRect = newEmail.GetComponent <RectTransform>(); newMailRect.offsetMax = new Vector2(newMailRect.offsetMax.x, position.GetOffsetMaxY()); newMailRect.offsetMin = new Vector2(newMailRect.offsetMin.x, position.GetOffsetMinY()); }