示例#1
0
    public bool OperationIsBlocked(string operation)
    {
        int index = UIBlockerSettings.IndexOf(operation);

        if (index >= 0 && index < operationsBlocked.Length)
        {
            return(operationsBlocked[index]);
        }
        else
        {
            throw new System.IndexOutOfRangeException($"{nameof(UIBlockerMask)}: " +
                                                      $"No mask value could be found for the operations '{operation}'");
        }
    }
示例#2
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        if (property.propertyType == SerializedPropertyType.String || property.propertyType == SerializedPropertyType.Integer)
        {
            // Put in a prefix label
            position = EditorGUI.PrefixLabel(position, label);

            int selected;

            // Set the initially selected index based on the type of the property
            if (property.propertyType == SerializedPropertyType.String)
            {
                selected = Mathf.Max(UIBlockerSettings.IndexOf(property.stringValue), 0);
            }
            else
            {
                selected = property.intValue;
            }

            // Use a popup to update the selected value
            int oldIndent = EditorGUI.indentLevel;
            EditorGUI.indentLevel = 0;
            selected = EditorGUI.Popup(position, selected, UIBlockerSettings.BlockableOperations);
            EditorGUI.indentLevel = oldIndent;

            // Read the result of the popup back into the property
            if (property.propertyType == SerializedPropertyType.String)
            {
                property.stringValue = UIBlockerSettings.GetBlockablOperation(selected);
            }
            else
            {
                property.intValue = selected;
            }
        }
        else
        {
            EditorGUI.PropertyField(position, property, label, true);
        }
    }
示例#3
0
        /*
         * CUSTOM METHODS
         */
        private bool Progress()
        {
            // Advance by click only if the mouse button was pressed down and the ui is not blocking the dialogue
            bool advanceClick = Input.GetMouseButtonDown(0) && UIBlockerSettings.OperationIsAvailable("Dialogue");

            // Store the current selected game object
            GameObject currentSelectedGameObject = EventSystem.current.currentSelectedGameObject;
            // True if a typing UI object is currently selected
            bool typingUIObjectSelected = false;

            // If a game object is selected, then check to see if it has text selected on it
            if (currentSelectedGameObject)
            {
                InputField     selectedInput    = currentSelectedGameObject.GetComponent <InputField>();
                TMP_InputField selectedInputTMP = currentSelectedGameObject.GetComponent <TMP_InputField>();
                typingUIObjectSelected = selectedInput || selectedInputTMP;
            }

            // Only use the advance input if some typing UI object is not currently selected
            bool advanceInput = !typingUIObjectSelected && Input.GetButtonDown(AdvanceInput);

            // Progress if the advance button was clicked or the button in the input axes was just pressed
            return(advanceClick || advanceInput);
        }