public void ReInit(ItemTrait material, int amount) { currentAmount = amount; materialType = material; foreach (var element in Elements) { string nameBeforeIndex = element.name.Split('~')[0]; switch (nameBeforeIndex) { case "MaterialName": ((NetUIElement <string>)element).SetValueServer(CraftingManager.MaterialSheetData[material].displayName + ":"); break; case "MaterialAmount": ((NetUIElement <string>)element).SetValueServer(currentAmount + " cm3"); amountLabel = element as NetLabel; break; case "OneSheetButton": buttonOne = element as NetInteractiveButton; break; case "TenSheetButton": buttonTen = element as NetInteractiveButton; break; case "FiftySheetButton": buttonFifty = element as NetInteractiveButton; break; } } UpdateButtonVisibility(); }
/// <summary> /// Opens popup locally. Whole interaction cycle look like this: /// 1. Client opens Popup and sets currenty edited field on the server. /// 2. Client confirms edit in popup, popup closes locally. /// 3. Server sets fields with values from popup. /// </summary> public void OpenPopup(NetLabel fieldToEdit) { popupWindow.SetActive(true); if (fieldToEdit != null) { popupWindowEditField.text = fieldToEdit.Value; } }
public void OpenPopup(NetLabel fieldToEdit) { //Previously we set entryPage only server-side, but popup is opening client-side if (entryPage == null) { entryPage = GetComponentInParent <GUI_SecurityRecordsEntryPage>(); } entryPage.OpenPopup(fieldToEdit); }
public void UpdateIdText(NetLabel labelToSet) { var IdCard = console.IdCard; if (IdCard) { labelToSet.SetValue = $"{IdCard.RegisteredName}, {IdCard.JobType.ToString()}"; } else { labelToSet.SetValue = "********"; } }
public void UpdateIdText(NetLabel labelToSet) { var IdCard = console.IdCard; if (IdCard) { labelToSet.SetValueServer($"{IdCard.RegisteredName}, {IdCard.GetJobTitle()}"); } else { labelToSet.SetValueServer("********"); } }
/// <summary> /// Set Editing field for crime entry. /// </summary> public void SetEditingField(NetLabel fieldToEdit, SecurityRecordCrime crimeToEdit) { currentlyEditingField = fieldToEdit; currentlyEditingCrime = crimeToEdit; }
/// <summary> /// Set field to edit in popup. /// Used for info entry (name, age, etc.) /// </summary> public void SetEditingField(NetLabel fieldToEdit) { currentlyEditingField = fieldToEdit; }
public void SetEditingField(NetLabel fieldToEdit) { entryPage.SetEditingField(fieldToEdit, crime); }