public void CloseAllMainMenuStates(bool closeBottomBar)
    {
        switch (currentMainMenuState)
        {
        case MainMenuState.viewingPosters:
            break;

        case MainMenuState.browsingStrains:
            StopBrowsingStrains(closeBottomBar);
            break;

        case MainMenuState.browsingBongs:
            StopBrowsingBongs(closeBottomBar);
            break;

        case MainMenuState.creatingNewSavegame:
            windowController.CancelCreatingNewSavegame();
            break;

        case MainMenuState.viewingSavegames:
            windowController.CancelViewingSavegames();
            break;

        case MainMenuState.viewingCompany:
            windowController.CancelViewingCompany();
            break;
        }
    }
예제 #2
0
    void Update()
    {
        if (!controller.manager.canInteract)
        {
            return;
        }
        if (gameObject.activeSelf)
        {
            Ray          ray  = mainCamera.ScreenPointToRay(Input.mousePosition);
            RaycastHit[] hits = Physics.RaycastAll(ray);
            bool         createNewBuildingButtonHit     = false;
            bool         mouseClickRegistered           = false;
            bool         mouseClickedOnActiveInputField = false;
            foreach (RaycastHit hit in hits)
            {
                //print(hit.transform.name);
                bool hitSmallButton = hit.transform.name.Equals(createNewBuildingButton.name);
                bool hitBigButton   = hit.transform.name.Equals(createNewBuildingExpandedButton.name);
                if ((hitSmallButton || hitBigButton) && !creatingNewBuilding && !loadingDifferentBuilding)
                {
                    if (hitSmallButton)
                    {
                        //saveGamesUI_createNewSavegamesExpandedButton.MouseOver();
                    }
                    MouseOverCreateNewBuildingButton();
                    createNewBuildingButtonHit = true;
                    if (Input.GetMouseButtonUp(0))
                    {
                        ViewingCompanyOffScreen();
                        CreateNewBuildingOnScreen();
                        //controller.StartCreatingNewCompany();
                        //createNewBuildingExpandedButton.OffScreen();
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.name.Equals(goBackButton.name))
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        if (choosingNewBuildingLogo)
                        {
                            ChooseLogoUIOffScreen();
                            CreateNewBuildingOnScreen();
                        }
                        else if (creatingNewBuilding)
                        {
                            CancelCreatingNewBuilding();
                        }
                        else if (loadingDifferentBuilding)
                        {
                            LoadDifferentBuildingUIOffScreen();
                            int buildingNumberToLoad = 0;
                            if (currentDispensary != null)
                            {
                                buildingNumberToLoad = currentDispensary.buildingNumber;
                                ViewingCompanyOnScreen(currentDispensary.dispensaryNumber, buildingNumberToLoad);
                            }
                            else if (currentSupplier != null)
                            {
                                buildingNumberToLoad = currentSupplier.buildingNumber;
                                ViewingCompanyOnScreen(currentSupplier.supplierNumber, buildingNumberToLoad);
                            }
                            else
                            {
                                ViewingCompanyOnScreen(0, 0);
                            }
                        }
                        else
                        {
                            controller.CancelViewingCompany();
                        }
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.name.Equals(loadDifferentBuildingButton.name))
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        ViewingCompanyOffScreen();
                        LoadDifferentBuildingUIOnScreen();
                        // Change UI to show list of dispensaries and grow ops for this company
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.name.Equals(loadBuildingButton.name))
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        LoadDispensary();
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.name.Equals(newBuildingNameInputField.name))
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        ActivateNewBuildingNameInputField();
                        mouseClickRegistered = true;
                        if (newBuildingNameInputFieldActive)
                        {
                            mouseClickedOnActiveInputField = true;
                        }
                    }
                }
                else if (hit.transform.name.Equals(finishCreatingNewBuildingButton.name))
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        FinishCreatingNewBuilding();
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.name.Equals(newBuilding_dispensaryButton.name))
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        dispensaryToggledOn  = true;
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.name.Equals(newBuilding_supplierButton.name))
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        dispensaryToggledOn  = false;
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.tag == "DispensaryButton")
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        currentDispensary = null;
                        currentSupplier   = null;
                        Dispensary_s dispensaryToLoad = currentCompany.GetDispensary(hit.transform.name);
                        currentDispensary = dispensaryToLoad;
                        currentSupplier   = null;
                        print(currentDispensary.dispensaryName);
                        LoadDifferentBuildingUIOffScreen();
                        print("Dispensary number clicked on: " + currentDispensary.dispensaryNumber);
                        ViewingCompanyOnScreen(currentDispensary.dispensaryNumber, currentDispensary.buildingNumber);
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.tag == "SupplierButton")
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        currentDispensary = null;
                        currentSupplier   = null;
                        Supplier_s supplierToLoad = currentCompany.GetSupplier(hit.transform.name);
                        currentDispensary = null;
                        currentSupplier   = supplierToLoad;
                        print(currentSupplier.supplierName);
                        LoadDifferentBuildingUIOffScreen();
                        print("Supplier number clicked on: " + currentSupplier.supplierNumber);
                        ViewingCompanyOnScreen(currentSupplier.supplierNumber, currentSupplier.buildingNumber);
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.name.Equals(newBuildingChooseLogoButton.name))
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        CreateNewBuildingOffScreen();
                        ChooseLogoUIOnScreen();
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.name.Equals(right_chooseLogoButton.name))
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        if (currentlySelectedDisplayedLogo != null)
                        {
                            NewBuildingChooseLogo(currentlySelectedDisplayedLogo.logo.ID);
                            ChooseLogoButtonsPanelOffScreen();
                            ChooseLogoUIOffScreen();
                            CreateNewBuildingOnScreen();
                        }
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.name.Equals(right_cancelChoosingLogoButton.name))
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        mouseClickRegistered = true;
                        ChooseLogoButtonsPanelOffScreen();
                    }
                }
                else if (hit.transform.name.Equals(chooseLogoRightArrow.name))
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        ChooseLogo_GoRight();
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.name.Equals(chooseLogoLeftArrow.name))
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        ChooseLogo_GoLeft();
                        mouseClickRegistered = true;
                    }
                }
                else if (hit.transform.tag == "LogoDisplayButton")
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        string[] logoNameSplit = hit.transform.name.Split(' ');
                        int      logoIndex     = -1;
                        if (int.TryParse(logoNameSplit[1], out logoIndex))
                        {
                            Logo thisLogo = controller.manager.db.GetLogo(logoIndex);
                            foreach (DisplayedLogo logo in logosBeingDisplayed)
                            {
                                if (logo.logo.ID == thisLogo.ID)
                                {
                                    if (chooseLogoButtonsPanelOnScreen)
                                    {
                                        StartCoroutine(ChooseLogoButtonsPanelRefresh(logo));
                                    }
                                    else
                                    {
                                        ChooseLogoButtonsPanelOnScreen(logo);
                                    }
                                }
                            }
                        }
                        mouseClickRegistered = true;
                    }
                }

                if (mouseClickRegistered && anyInputFieldActive && !mouseClickedOnActiveInputField)
                {
                    DeactivateAllInputFields();
                }
            }
            if (!createNewBuildingButtonHit)
            {
                MouseLeftCreateNewBuildingButton();
            }
        }
        if (dispensaryToggledOn)
        {
            newBuildingNameInputFieldTitleText.text = "Dispensary Name";
            newBuilding_dispensaryButton.SetInactive();
            newBuilding_supplierButton.SetActive();
        }
        else
        {
            newBuildingNameInputFieldTitleText.text = "Supplier Name";
            newBuilding_supplierButton.SetInactive();
            newBuilding_dispensaryButton.SetActive();
        }
    }