public virtual void Startup(IModuleMain moduleMain) { if (moduleMain == null) { throw new ArgumentException("ModuleFacade : Startup : unknown data!"); } Debug.Log(String.Format("{0} : Startup : ", GetType())); this._eventDispatcher = new EventDispatcher <AppEvent> (); this._moduleMain = moduleMain; this.eventDispatcher.AddEventListener(AppEvent.CONNECT_MEDIATOR, this._ConnectMediatorHandler); this.eventDispatcher.AddEventListener(AppEvent.DISCONNECT_MEDIATOR, this._DisconnectMediatorHandler); Dictionary <string, Type> commandList = this._moduleMain.setupVO.commandList; foreach (KeyValuePair <string, Type> command in commandList) { if (!String.IsNullOrEmpty(command.Key) && command.Value != null) { RegisterCommand(command.Key, command.Value); } } if (this.HasCommand(NotificationType.STARTUP)) { SendNotification(NotificationType.STARTUP, moduleMain); } else { throw new Exception(String.Format("{0} : Startup : command STARTUP is not registered, failed starting application", GetType())); } }
public ApplicationProxy(string name, IModuleMain data = null) : base(name, data) { if (!(data is IModuleMain)) { Tracer.Echo(String.Format("{0} : invaild data object set : expecting IModuleMain ", this.ProxyName), this, 0xff0000); } this._host = data; }
public ApplicationMediator(string name, IModuleMain rootContainer = null) : base(name, rootContainer) { if (!(rootContainer is IModuleMain)) { Tracer.Echo(String.Format("{0} : invaild data object set : only IModuleMain is excepted ", this.MediatorName), this, 0xff0000); } else { _host = rootContainer; } }
public override bool Awake() { if (_instance == null) { base.Awake(); _instance = this; DontDestroyOnLoad(this); return(true); } else { Debug.Log(String.Format("{0} : Awake : being Destroyed", GetType())); Destroy(this.gameObject); } Debug.Log(String.Format("{0} : Awake : object has already been initialized!", GetType())); return(false); }