Exemple #1
0
    public void RenameClick(bool removeOnCancel, UnityAction confirmCallback = null, bool keepObjectLocked = false)
    {
        InteractiveObject selectedObject = SelectorMenu.Instance.GetSelectedObject();

        if (selectedObject is null)
        {
            return;
        }

        if (!SelectorMenu.Instance.gameObject.activeSelf) //other menu/dialog opened
        {
            SetActiveSubmenu(LeftMenuSelection.Utility);  //close all other opened menus/dialogs and takes care of red background of buttons
        }

        UpdateVisibility(false, true);
        SelectorMenu.Instance.gameObject.SetActive(false);
        if (removeOnCancel)
        {
            RenameDialog.Init(selectedObject, UpdateVisibility, true, () => selectedObject.Remove(), confirmCallback, keepObjectLocked);
        }
        else
        {
            RenameDialog.Init(selectedObject, UpdateVisibility, false, null, confirmCallback, keepObjectLocked);
        }
        RenameDialog.Open();
    }