/// <summary> /// Opens the specified presenter. /// </summary> /// <param name="presenter">The presenter.</param> /// <param name="completed">Called when the open action is finished.</param> public virtual void Open(IPresenter presenter, Action <bool> completed) { if (presenter == null) { completed(false); return; } if (presenter.Equals(_currentPresenter)) { completed(true); return; } if (_currentPresenter != null) { _currentPresenter.Deactivate(); } presenter = EnsurePresenter(presenter); if (IsActive) { presenter.Activate(); } ChangeCurrentPresenterCore(presenter); completed(true); }
/// <summary> /// Activates this instance. /// </summary> public override void Activate() { if (!IsActive) { if (_currentPresenter != null) { _currentPresenter.Activate(); } OnActivate(); IsActive = true; } }
/// <summary> /// Opens the specified presenter. /// </summary> /// <param name="presenter">The presenter.</param> /// <param name="completed">Called when the open action is finished.</param> public virtual void Open(IPresenter presenter, Action <bool> completed) { if (presenter == null) { completed(false); return; } presenter = EnsurePresenter(presenter); if (IsActive) { presenter.Activate(); } completed(true); }
private void Awake() { ISerializer serializer = new JsonNetSerializer(); UdpClientInfo udpClientInfo = new UdpClientInfo { ServerIp = "127.0.0.1", ServerPort = 3000, ChannelId = 0 }; WorldData worldData = new WorldData(); IModelManagerClient modelManagerClient = new ModelManagerClient(worldData); IReplication worldReplication = new WorldReplication(worldData, serializer.GetCaster()); _client = new UdpClient(udpClientInfo); _networkManager = new NetworkManager(_client, serializer, modelManagerClient, worldReplication) { MillisecondsBetweenSendPacket = 1000 }; _presenterManager = new GamePresenter(_viewManager, modelManagerClient); _presenterManager.Activate(); }
/// <summary> /// Opens the specified presenter. /// </summary> /// <param name="presenter">The presenter.</param> /// <param name="completed">Called when the open action is finished.</param> public virtual void Open(IPresenter presenter, Action <bool> completed) { if (presenter == null) { completed(false); return; } if (presenter.Equals(_currentPresenter)) { completed(true); return; } Action successfulCompletion = () => { var node = presenter as IPresenterNode; if (node != null) { node.Parent = this; } if (IsInitialized) { presenter.Initialize(); } if (IsActive) { presenter.Activate(); } ChangeCurrentPresenterCore(presenter); completed(true); }; if (_currentPresenter != null) { CanShutdownPresenter( _currentPresenter, isSuccess => { if (!isSuccess) { completed(false); return; } _currentPresenter.Deactivate(); _currentPresenter.Shutdown(); var node = _currentPresenter as IPresenterNode; if (node != null) { node.Parent = null; } successfulCompletion(); }); } else { successfulCompletion(); } }
public void ActivateScreenFor <T>() where T : IPresenter { IPresenter presenter = ObjectFactory.GetInstance <T>(); presenter.Activate(); }
/// <summary> /// Opens the specified presenter. /// </summary> /// <param name="presenter">The presenter.</param> /// <param name="completed">Called when the open action is finished.</param> public virtual void Open(IPresenter presenter, Action<bool> completed) { if (presenter == null) { completed(false); return; } if (presenter.Equals(_currentPresenter)) { completed(true); return; } Action successfulCompletion = () => { var node = presenter as IPresenterNode; if (node != null) node.Parent = this; if (IsInitialized) presenter.Initialize(); if (IsActive) presenter.Activate(); ChangeCurrentPresenterCore(presenter); completed(true); }; if (_currentPresenter != null) { CanShutdownPresenter( _currentPresenter, isSuccess => { if (!isSuccess) { completed(false); return; } _currentPresenter.Deactivate(); _currentPresenter.Shutdown(); var node = _currentPresenter as IPresenterNode; if (node != null) node.Parent = null; successfulCompletion(); }); } else successfulCompletion(); }
/// <summary> /// Opens the specified presenter. /// </summary> /// <param name="presenter">The presenter.</param> /// <param name="completed">Called when the open action is finished.</param> public virtual void Open(IPresenter presenter, Action<bool> completed) { if (presenter == null) { completed(false); return; } if (presenter.Equals(_currentPresenter)) { completed(true); return; } if (_currentPresenter != null) _currentPresenter.Deactivate(); presenter = EnsurePresenter(presenter); if (IsActive) presenter.Activate(); ChangeCurrentPresenterCore(presenter); completed(true); }
/// <summary> /// Opens the specified presenter. /// </summary> /// <param name="presenter">The presenter.</param> /// <param name="completed">Called when the open action is finished.</param> public virtual void Open(IPresenter presenter, Action<bool> completed) { if (presenter == null) { completed(false); return; } presenter = EnsurePresenter(presenter); if (IsActive) presenter.Activate(); completed(true); }