void IPlayerView.Init(IPlayerPresenter presenter, IPlayerModel player) { Reset(); _presenter = presenter; foreach (var playerStat in player.Stats) { var statView = Instantiate(_statPrefab, _panel.statsPanel); statView.Init(playerStat.Config.icon); statView.SetValue(playerStat.Value); _stats.Add(statView); } foreach (var playerBuff in player.Buffs) { var buff = playerBuff.Config; var buffView = Instantiate(_statPrefab, _panel.statsPanel); buffView.Init(buff.icon, buff.title); _buffs.Add(buffView); } }
public virtual void BindPlayerView(MobileNavigationTabType tabType, IPlayerView view) { _playerView = view; _playerView.OnViewDestroy = (view2) => { _playerPresenter.ViewDestroyed(); _playerPresenter = null; _playerView = null; }; _playerPresenter = Bootstrapper.GetContainer().Resolve<IPlayerPresenter>(); _playerPresenter.BindView(view); // Create sub views var playerMetadata = CreatePlayerMetadataView(); var loops = CreateLoopsView(); var markers = CreateMarkersView(); var timeShifting = CreateTimeShiftingView(); var pitchShifting = CreatePitchShiftingView(); _playerView.PushSubView(playerMetadata); _playerView.PushSubView(loops); _playerView.PushSubView(markers); _playerView.PushSubView(timeShifting); _playerView.PushSubView(pitchShifting); // Check if the Start Resume Playback view must be shown after startup if (_resumeCloudDeviceInfo != null) { Tracing.Log("MobileNavigationManager - BindPlayerView - showing Start Resume Playback view..."); var startResumePlaybackView = CreateStartResumePlaybackView(); PushDialogView(MobileDialogPresentationType.Overlay, "Resume Playback", _playerView, startResumePlaybackView); _resumeCloudDeviceInfo = null; } }
public virtual IMainView CreateMainView() { // The view invokes the OnViewReady action when the view is ready. This means the presenter can be created and bound to the view. Action<IBaseView> onViewReady = (view) => { _mainPresenter = Bootstrapper.GetContainer().Resolve<IMainPresenter>(); _mainPresenter.BindView((IMainView)view); _playerPresenter = Bootstrapper.GetContainer().Resolve<IPlayerPresenter>(); _playerPresenter.BindView((IPlayerView)view); _libraryBrowserPresenter = Bootstrapper.GetContainer().Resolve<ILibraryBrowserPresenter>(); _libraryBrowserPresenter.BindView((ILibraryBrowserView)view); _songBrowserPresenter = Bootstrapper.GetContainer().Resolve<ISongBrowserPresenter>(); _songBrowserPresenter.BindView((ISongBrowserView)view); _markersPresenter = Bootstrapper.GetContainer().Resolve<IMarkersPresenter>(); _markersPresenter.BindView((IMarkersView)view); _markerDetailsPresenter = Bootstrapper.GetContainer().Resolve<IMarkerDetailsPresenter>(new NamedParameterOverloads() { { "markerId", Guid.Empty } }); _markerDetailsPresenter.BindView((IMarkerDetailsView)view); _loopsPresenter = Bootstrapper.GetContainer().Resolve<ILoopsPresenter>(); _loopsPresenter.BindView((ILoopsView)view); _loopDetailsPresenter = Bootstrapper.GetContainer().Resolve<ILoopDetailsPresenter>(new NamedParameterOverloads() { { "loopId", Guid.Empty } }); _loopDetailsPresenter.BindView((ILoopDetailsView)view); _segmentDetailsPresenter = Bootstrapper.GetContainer().Resolve<ISegmentDetailsPresenter>(new NamedParameterOverloads() { { "segmentId", Guid.Empty } }); _segmentDetailsPresenter.BindView((ISegmentDetailsView)view); _timeShiftingPresenter = Bootstrapper.GetContainer().Resolve<ITimeShiftingPresenter>(); _timeShiftingPresenter.BindView((ITimeShiftingView)view); _pitchShiftingPresenter = Bootstrapper.GetContainer().Resolve<IPitchShiftingPresenter>(); _pitchShiftingPresenter.BindView((IPitchShiftingView)view); _updateLibraryPresenter = Bootstrapper.GetContainer().Resolve<IUpdateLibraryPresenter>(); _updateLibraryPresenter.BindView((IUpdateLibraryView)view); }; _mainView = Bootstrapper.GetContainer().Resolve<IMainView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } }); _mainView.OnViewDestroy = (view) => { _mainView = null; _mainPresenter.ViewDestroyed(); _mainPresenter = null; _playerPresenter.ViewDestroyed(); _playerPresenter = null; _libraryBrowserPresenter.ViewDestroyed(); _libraryBrowserPresenter = null; _songBrowserPresenter.ViewDestroyed(); _songBrowserPresenter = null; _markersPresenter.ViewDestroyed(); _markersPresenter = null; _markerDetailsPresenter.ViewDestroyed(); _markerDetailsPresenter = null; _loopsPresenter.ViewDestroyed(); _loopsPresenter = null; _loopDetailsPresenter.ViewDestroyed(); _loopDetailsPresenter = null; _segmentDetailsPresenter.ViewDestroyed(); _segmentDetailsPresenter = null; _timeShiftingPresenter.ViewDestroyed(); _timeShiftingPresenter = null; _pitchShiftingPresenter.ViewDestroyed(); _pitchShiftingPresenter = null; _updateLibraryPresenter.ViewDestroyed(); _updateLibraryPresenter = null; }; return _mainView; }