예제 #1
0
    public override void OnPickUp(PlayerItemPickUpData data)
    {
        // Get Item Reference
        ActiveItem activeItem = Item as ActiveItem;

        // Spawn Item
        if (Item.gameObject.IsPrefab())
        {
            activeItem = ItemDB.Inst.SpawnItem(Item.GetType()).GetComponent <ActiveItem>();
        }

        // Add To Inventory
        if (PlayerInventoryManager.inventory.TryUpgradeItem(activeItem.GetType()) ||
            PlayerInventoryManager.activeHotbar.TryUpgradeItem(activeItem.GetType()))
        {
            Destroy(activeItem.gameObject);
            goto EXIT;
        }

        if (PlayerInventoryManager.activeHotbar.TryAddItem(activeItem))
        {
            goto EXIT;
        }

        if (PlayerInventoryManager.inventory.TryAddItem(activeItem))
        {
            goto EXIT;
        }

        return;

EXIT:
        Destroy(gameObject);
    }
예제 #2
0
        private async Task NavigateToWorkspace(IWorkspace workspace)
        {
            // Break if the workspace is already active.
            if (ActiveItem != null && ActiveItem.GetType() == workspace.ViewModelType)
            {
                return;
            }

            await _navigator.NavigateToAsync(workspace.ViewModelType);
        }
예제 #3
0
 public void EditDocuments()
 {
     if (ActiveItem != null)
     {
         if (ActiveItem.GetType() != typeof(FolderListViewModel))
         {
             ActiveItem.TryClose();
         }
     }
     ActivateItem(new FolderListViewModel());
 }
예제 #4
0
 public void ShowDetails()
 {
     if (ActiveItem != null)
     {
         var vm = new DetailViewModel(
             string.Format("{0}: {1}", ActiveItem.GetType().Name, ActiveItem.DisplayName),
             ActiveItem.GetAsPropertyList()
             );
         var message = new OpenWindow(vm);
         eventAggregator.BeginPublishOnUIThread(message);
     }
 }
예제 #5
0
        public void OpenFamilyMemberTree()
        {
            OpenFamilyMemberTreeVisible  = false;
            CloseFamilyMemberTreeVisible = true;
            FamilyMemberMenuVisible      = true;

            if (ActiveItem != null)
            {
                if (ActiveItem.GetType() != typeof(FamilyMemberTreeViewModel))
                {
                    ActiveItem.TryClose();
                }
            }
            ActivateItem(new FamilyMemberTreeViewModel());
        }
        public void Handle(ActivateScreen message)
        {
            if (ActiveItem.GetType() == message.Screen.GetType())
            {
                return;
            }

            if (ActiveItem != mainViewModel)
            {
                DeactivateItem(ActiveItem, true);
            }

            Items.Add(message.Screen);
            ActivateItem(message.Screen);
        }
예제 #7
0
        public void Handle(Screen message)
        {
            Logger.Debug(String.Format("Showing screen [Type: {0}]", message.GetType()));

            if (ActiveItem != null)
            {
                Logger.Debug(String.Format("Deactivating screen [Type: {0}]", ActiveItem.GetType()));
                DeactivateItem(ActiveItem, true);
            }

            Logger.Debug(String.Format("Activating screen [Type: {0}]", message.GetType()));

            ActivateItem(message);

            Logger.Debug(String.Format("Active screen is [Type: {0}]", ActiveItem.GetType()));
        }
예제 #8
0
        public void OpenStudentList1()
        {
            OpenStudentList1Visible = false;
            OpenStudentList2Visible = true;
            CloseStudentListVisible = true;
            StudentMenuVisible      = true;

            if (ActiveItem != null)
            {
                if (ActiveItem.GetType() != typeof(StudentListViewModel))
                {
                    ActiveItem.TryClose();
                }
            }
            ActivateItem(new StudentListViewModel());
        }
예제 #9
0
 public void LoadSubSections( ActiveItem Item )
 {
     Type ItemType = Item.GetType();
     if ( ItemType == typeof( Topic ) )
     {
         Topic Tp = Item as Topic;
         int TopicIndex = ListData.IndexOf( Item ) + 1;
         if ( ListData.IndexOf( Tp.Collections[ 0 ] ) != -1 )
         {
             foreach ( Digests d in Tp.Collections )
                 ListData.Remove( d );
         }
         else
         {
             foreach ( Digests d in Tp.Collections )
                 ListData.Insert( TopicIndex, d );
         }
         NotifyChanged( "ListData" );
     }
     else if ( ItemType == typeof( Digests ) )
     {
         Digests D = Item as Digests;
         SetListName( D );
         DownloadCategoryXml( D );
     }
     else if( ItemType == typeof( Press ) )
     {
         Press P = Item as Press;
         OpenNavigationList( P );
     }
 }
예제 #10
0
        public void Handle(CommunicationObject message)
        {
            switch (message.Message)
            {
            case ApplicationWideEnums.MessageTypes.FullscreenOverlay:
                if (ActiveItem != null)
                {
                    if (ActiveItem.GetType() == typeof(FullscreenImageViewModel))
                    {
                        //ActivateItem(new FullscreenImageViewModel(true));
                        //ActivateItem(new FullscreenImageViewModel());
                        //Event.WindowSettings.PrsSettings.OverlaySettings.IsOverlayVisible = Visibility.Visible;
                        //_log.Info("fullscrnOLhandled");
                    }
                    if (ActiveItem.GetType() != typeof(FullscreenImageViewModel))
                    {
                        ActivateItem(new FullscreenImageViewModel(true));
                        ActivateItem(new FullscreenImageViewModel());
                        Event.WindowSettings.PrsSettings.OverlaySettings.IsOverlayVisible = Visibility.Visible;
                        _log.Info("fullscrnOLhandled");
                    }
                }
                break;

            case ApplicationWideEnums.MessageTypes.BoardOverview:
                if (ActiveItem != null)
                {
                    if (ActiveItem.GetType() != typeof(PlateOverlayViewModel))
                    {
                        ActivateItem(new FullscreenImageViewModel(true));
                        ActivateItem(new PlateOverlayViewModel());
                        Event.WindowSettings.PrsSettings.OverlaySettings.IsOverlayVisible = Visibility.Visible;
                        _log.Info("BoardOLhandled");
                    }
                }
                break;

            case ApplicationWideEnums.MessageTypes.LatestNumbers:
                if (ActiveItem != null)
                {
                    if (ActiveItem.GetType() != typeof(NumberBarViewModel))
                    {
                        ActivateItem(new FullscreenImageViewModel(true));
                        ActivateItem(new FixedNumberBarViewModel());
                        Event.WindowSettings.PrsSettings.OverlaySettings.IsOverlayVisible = Visibility.Visible;
                        _log.Info("latestnumolhandled");
                    }
                }
                break;

            case ApplicationWideEnums.MessageTypes.BingoHappened:
                if (ActiveItem != null)
                {
                    if (ActiveItem.GetType() != typeof(BingoScreenViewModel))
                    {
                        ActivateItem(new FullscreenImageViewModel(true));
                        ActivateItem(new BingoScreenViewModel());
                        Event.WindowSettings.PrsSettings.DockingPlace = Dock.Top;
                        Event.WindowSettings.PrsSettings.OverlaySettings.IsOverlayVisible = Visibility.Visible;

                        /* ALTERNATIVE BINGO
                         * FullscreenImageViewModel fvm = new FullscreenImageViewModel();
                         * ActivateItem(fvm);
                         * fvm.ShowBingo();
                         * _log.Info("bingohapndOLHandled");
                         */
                    }
                }
                break;

            case ApplicationWideEnums.MessageTypes.ClosePrez:
                TryClose();
                _log.Info("Prez closed.");
                break;

            case ApplicationWideEnums.MessageTypes.FullscreenOverlayBlank:
                if (ActiveItem != null)
                {
                    if (ActiveItem.GetType() == typeof(FullscreenImageViewModel))
                    {
                        var temp = ActiveItem as FullscreenImageViewModel;
                        if (temp != null)
                        {
                            if (!temp.IsBlank)
                            {
                                ActivateItem(new FullscreenImageViewModel(true));
                                _log.Info("fullscrnOLBlankhandled");
                            }
                        }
                    }
                    if (ActiveItem.GetType() != typeof(FullscreenImageViewModel))
                    {
                        ActivateItem(new FullscreenImageViewModel(true));
                        _log.Info("fullscrnOLhandled");
                    }
                }
                break;

            case ApplicationWideEnums.MessageTypes.Stopwatch:
                if (ActiveItem.GetType() != typeof(CountdowntimerBigScreenViewModel))
                {
                    ActivateItem(new CountdowntimerBigScreenViewModel());
                }
                break;
            }
        }