//Awake se carga primero que start, cuando comienza start awake ya esta cargado void Awake() { if (estadoApp == null) { estadoApp = this; //le decimos que no se destruya el objeto al cual hemos puesto este componente DontDestroyOnLoad(gameObject); } else if (estadoApp != this) { Destroy(gameObject); } }
public void AlRefrescar(EstadoApp unEstadoApp) { this.estadoApp = unEstadoApp; this.panelPrincipal.Controls.Clear(); switch (unEstadoApp) { case EstadoApp.EN_MENU_PRINCIPAL: this.panelPrincipal.Controls.Add(new UserControlMenuPrincipal(this)); break; case EstadoApp.EN_REGISTRO_DE_ALARMA_AUTOR: this.panelPrincipal.Controls.Add(new UserControlGestionAlarmaAutor(this)); break; case EstadoApp.EN_REGISTRO_DE_ENTIDAD: this.panelPrincipal.Controls.Add(new UserControlGestionEntidades(this)); break; case EstadoApp.EN_REGISTRO_DE_FRASE: this.panelPrincipal.Controls.Add(new UserControlGestionFrases(this)); break; case EstadoApp.EN_REGISTRO_DE_SENTIMIENTO: this.panelPrincipal.Controls.Add(new UserControlGestionSentimientos(this)); break; case EstadoApp.EN_REGISTRO_DE_SENTIMIENTO_POSITIVO: this.panelPrincipal.Controls.Add(new UserControlGestionSentimientosPositivos(this)); break; case EstadoApp.EN_REGISTRO_DE_SENTIMIENTO_NEGATIVO: this.panelPrincipal.Controls.Add(new UserControlGestionSentimientosNegativos(this)); break; case EstadoApp.EN_REGISTRO_REPORTE: this.panelPrincipal.Controls.Add(new UserControlGestionReportes(this)); break; case EstadoApp.EN_REGISTRO_REPORTE_ALARMA: this.panelPrincipal.Controls.Add(new UserControlGestionReportesAlarmas(this)); break; case EstadoApp.EN_REGISTRO_REPORTE_ANALISIS: this.panelPrincipal.Controls.Add(new UserControlGestionReportesAnalisis(this)); break; case EstadoApp.EN_REGISTRO_AUTOR: this.panelPrincipal.Controls.Add(new UserControlGestionAutores(this)); break; case EstadoApp.EN_REGISTRO_ALARMA: this.panelPrincipal.Controls.Add(new UserControlGestionAlarmas(this)); break; case EstadoApp.EN_REGISTRO_ALARMA_ENTIDAD: this.panelPrincipal.Controls.Add(new UserControlGestionAlarmaEntidad(this)); break; case EstadoApp.EN_REGISTRO_REPORTE_AUTORES: this.panelPrincipal.Controls.Add(new UserControlGestionReporteAutor(this)); break; case EstadoApp.EN_SALIR: this.Close(); break; default: this.Close(); break; } }