Esempio n. 1
0
    void UpdateLeftHeader(bool forceUpdate = false)
    {
        bool needsLayoutUpdate = false;

        windowHeaderUI.undoImage.color = userMain.UndoAvailable() ? enabledButtonColor : disabledButtonColor;
        windowHeaderUI.redoImage.color = userMain.RedoAvailable() ? enabledButtonColor : disabledButtonColor;

        bool canEdit = userMain.CanEdit();

        if (canEdit != prevCanEdit || forceUpdate)
        {
            windowHeaderUI.buildButtonObject.SetActive(userMain.CanEdit());
            windowHeaderUI.playButtonObject.SetActive(userMain.CanEdit());
            windowHeaderUI.playOnlyObject.SetActive(!userMain.CanEdit() && !GameBuilderApplication.IsStandaloneExport);
            needsLayoutUpdate = true;
            prevCanEdit       = canEdit;
        }

        bool actorsEditable = editMain.ActorsEditable();

        if (actorsEditable != prevActorsEditable || forceUpdate)
        {
            windowHeaderUI.deleteButton.gameObject.SetActive(actorsEditable);
            windowHeaderUI.cameraFocusToggle.gameObject.SetActive(actorsEditable);
            windowHeaderUI.copyButton.gameObject.SetActive(actorsEditable);
            needsLayoutUpdate  = true;
            prevActorsEditable = actorsEditable;
        }

        windowHeaderUI.fileSubmenu.gameObject.SetActive(!GameBuilderApplication.IsStandaloneExport);

        windowHeaderUI.systemToggle.isOn = userMain.systemMenu.IsOpen();
        windowHeaderUI.saveToggle.isOn   = saveMenu.IsOpen()
#if USE_STEAMWORKS
                                           || workshopInfo.IsOpen()
#endif
        ;

#if USE_PUN
        windowHeaderUI.multiplayerToggle.isOn = multiplayerGameMenu.IsOpen();
#endif
        if (editMain.ActorsEditable())
        {
            windowHeaderUI.cameraFocusToggle.isOn = editMain.GetCameraFollowingActor();
        }
        windowHeaderUI.worldVisualsToggle.isOn = worldSettings.GetIsOpen();

        bool showWorkshop = ShowWorkshopInfo();
        windowHeaderUI.saveButtonImage.enabled     = !showWorkshop;
        windowHeaderUI.workshopButtonImage.enabled = showWorkshop;
        saveTooltip.SetDescription(showWorkshop ? WORKSHOP_TOOLTIP : SAVE_TOOLTIP);

        windowHeaderUI.leftMenuRight.GetComponent <RectTransform>().GetWorldCorners(tempWorldCorners);
        float maxWidth = tempWorldCorners[2].x;
        if (maxWidth != prevMaxWidth)
        {
            needsLayoutUpdate = true;
            prevMaxWidth      = maxWidth;
        }

        if (needsLayoutUpdate)
        {
            UpdateSubmenuPositions();
            StartCoroutine(AlignSettingsMenus());
        }
    }