public void Initialize() { Delete_Button.gameObject.SetActive(Deletable); FieldInfo[] properties = Data.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic); foreach (FieldInfo info in properties) { if (!Data.Is_Editable(info)) { continue; } Edit_Field field; if (info.FieldType.IsEnum) { field = Instantiate(edit_field_enum_prefab, transform).GetComponent <Edit_Field_Enum>(); } else if (info.FieldType == typeof(List <string>)) { field = Instantiate(edit_field_list_prefab, transform).GetComponent <Edit_Field_List>(); } else { switch (info.FieldType.ToString().ToLower()) { case "system.datetime": field = Instantiate(edit_field_date_prefab, transform).GetComponent <Edit_Field_DateTime>(); break; default: field = Instantiate(edit_field_text_prefab, transform).GetComponent <Edit_Field_Text>(); break; } } field.Initialize(info); } Delete_Button.transform.SetAsLastSibling(); }
static System.Collections.IEnumerator Redirect(Data_struct data) { while (Database_Handler.Data_List_Get(data.Database_Handler_Type()).Count == 0) { yield return(null); } yield return(null); List <Data_struct> data_list = Database_Handler.Data_List_Get(data.Database_Handler_Type()); Data_struct chosen_data = data_list.Find(x => x.Id == data.Id); if (!chosen_data.Equals(Activator.CreateInstance(chosen_data.GetType()))) { Database_Handler.Selected_Data = chosen_data; switch ((Notification_Sender.Redirect_Type)Enum.Parse(typeof(Notification_Sender.Redirect_Type), data.GetType().ToString())) { case Notification_Sender.Redirect_Type.Calendar_Event: Menu.Singleton.Load_Scene_Menu_Item(Menu.Menu_item.Events_details); break; case Notification_Sender.Redirect_Type.News_Entry: Menu.Singleton.Load_Scene_Menu_Item(Menu.Menu_item.News_details); break; case Notification_Sender.Redirect_Type.Poll: if (((Poll)chosen_data).Votable_Type == Votable_Type.Multiple_Single_Select) { Menu.Singleton.Load_Scene_Menu_Item(Menu.Menu_item.Poll_details_single); } else { Menu.Singleton.Load_Scene_Menu_Item(Menu.Menu_item.Poll_details_multi); } break; } } }