예제 #1
0
 void DrawSpecialElements()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Special Elements", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 130);
         QUI.BeginChangeCheck();
         {
             QUI.DrawList(specialElements, 288, "No UIElement referenced...");
         }
         if (QUI.EndChangeCheck())
         {
             serializedObject.ApplyModifiedProperties();
             if (uiNotification.specialElements != null && uiNotification.specialElements.Length > 0)
             {
                 for (int i = 0; i < uiNotification.specialElements.Length; i++)
                 {
                     if (uiNotification.specialElements[i] != null)
                     {
                         uiNotification.specialElements[i].transform.SetParent(uiNotification.transform);
                         uiNotification.specialElements[i].name = DUI.DUISettings.UIElement_Inspector_RenameGameObjectPrefix + "Special Element " + i + DUI.DUISettings.UIElement_Inspector_RenameGameObjectSuffix;
                     }
                 }
             }
         }
     }
     QUI.EndHorizontal();
     if (specialElements.arraySize > 0)
     {
         QUI.Space(SPACE_8);
     }
 }
예제 #2
0
 void DrawButtons()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Notification Buttons", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 130);
         QUI.BeginChangeCheck();
         {
             QUI.DrawList(buttons, 288, "No UIButton referenced...");
         }
         if (QUI.EndChangeCheck())
         {
             serializedObject.ApplyModifiedProperties();
             if (uiNotification.buttons != null && uiNotification.buttons.Length > 0)
             {
                 for (int i = 0; i < uiNotification.buttons.Length; i++)
                 {
                     if (uiNotification.buttons[i] != null)
                     {
                         uiNotification.buttons[i].name = "Notification Button " + i;
                     }
                 }
             }
         }
     }
     QUI.EndHorizontal();
     if (buttons.arraySize > 0)
     {
         QUI.Space(SPACE_8);
     }
 }
예제 #3
0
 void DrawEffects()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Notification Effects", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 130);
         QUI.BeginChangeCheck();
         {
             QUI.DrawList(effects, 288, "No UIEffect referenced...");
         }
         if (QUI.EndChangeCheck())
         {
             serializedObject.ApplyModifiedProperties();
             if (uiNotification.effects != null && uiNotification.effects.Length > 0)
             {
                 for (int i = 0; i < uiNotification.effects.Length; i++)
                 {
                     if (uiNotification.effects[i] != null)
                     {
                         uiNotification.effects[i].targetUIElement = uiNotification.notificationContainer;
                         uiNotification.effects[i].name            = "Notification Effect " + i;
                     }
                 }
             }
         }
     }
     QUI.EndHorizontal();
     if (effects.arraySize > 0)
     {
         QUI.Space(SPACE_8);
     }
 }
        void DrawUICanvases()
        {
            QUI.DrawTexture(DUIResources.headerUICanvasesDatabase.texture, 552, 64);
            float sectionWidth = PAGE_WIDTH - SIDE_BAR_SHADOW_WIDTH * 2;

            QUI.BeginHorizontal(sectionWidth);
            {
                QUI.Space(-22);
                QUI.BeginChangeCheck();
                {
                    DrawNamesList(DUI.CanvasNamesDatabase.data, sectionWidth + 22 + 12 - 100, "Add a new canvas name to get started...");
                }
                if (QUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(DUI.CanvasNamesDatabase);
                }
                QUI.Space(-12);
                if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonSortAtoZ), 100, 20))
                {
                    DUI.RefreshCanvasNamesDatabase();
                }
            }
            QUI.EndHorizontal();
            QUI.Space(16);
            if (DUI.CanvasNamesDatabase.Count == 0)
            {
                QUI.DrawTexture(DUIResources.pageImageEmptyDatabase.texture, 552, 256);
                return;
            }
        }
        void DrawButtonCategory(float width)
        {
            QUI.BeginHorizontal(width);
            {
                if (EditorApplication.isPlayingOrWillChangePlaymode)
                {
                    QLabel.text  = buttonCategory.stringValue;
                    QLabel.style = Style.Text.Help;
                    QUI.Label(QLabel);
                }
                else
                {
                    buttonCategoryIndex = DatabaseUIButtons.CategoryNameIndex(buttonCategory.stringValue); //set the index
                    QUI.BeginChangeCheck();
                    buttonCategoryIndex = EditorGUILayout.Popup(buttonCategoryIndex, DatabaseUIButtons.categoryNames.ToArray(), GUILayout.Width(width - 5));
                    if (QUI.EndChangeCheck())
                    {
                        buttonCategory.stringValue = DatabaseUIButtons.categoryNames[buttonCategoryIndex];
                        if (buttonCategory.stringValue == DUI.CUSTOM_NAME)
                        {
                            buttonNameIndex = -1;
                        }
                    }
                }

                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
        }
예제 #6
0
        void OnSceneGUI()
        {
            if (useSpawnerAsSpawnLocation.boolValue)
            {
                return;
            }
            switch (poolySpawner.spawnAt)
            {
            case PoolySpawner.SpawnAt.Position:
                if (poolySpawner.spawnPositions != null && poolySpawner.spawnPositions.Count > 0)
                {
                    for (int i = 0; i < poolySpawner.spawnPositions.Count; i++)
                    {
                        Handles.Label(new Vector3(poolySpawner.spawnPositions[i].spawnPosition.x + 0.05f,
                                                  poolySpawner.spawnPositions[i].spawnPosition.y - 0.05f,
                                                  poolySpawner.spawnPositions[i].spawnPosition.z),
                                      "产生的坐标位置 " + i + " " + poolySpawner.spawnPositions[i].spawnPosition);
                        QUI.BeginChangeCheck();
                        Vector3 updatedSpawnPosition = Handles.PositionHandle(poolySpawner.spawnPositions[i].spawnPosition, Quaternion.identity);
                        if (QUI.EndChangeCheck())
                        {
                            Undo.RecordObject(poolySpawner, "Changed Spawn Position " + i);
                            poolySpawner.spawnPositions[i].spawnPosition = updatedSpawnPosition.Round();
                        }
                        Handles.color = LineColor;
                        Handles.DrawDottedLine(poolySpawner.transform.position, poolySpawner.spawnPositions[i].spawnPosition, 4);
                        Handles.color = defaultHandlesColor;
                    }
                }
                break;

            case PoolySpawner.SpawnAt.Transform:
                if (poolySpawner.spawnPoints != null && poolySpawner.spawnPoints.Count > 0)
                {
                    for (int i = 0; i < poolySpawner.spawnPoints.Count; i++)
                    {
                        if (poolySpawner.spawnPoints[i].spawnPoint == null)
                        {
                            continue;
                        }
                        Handles.Label(new Vector3(poolySpawner.spawnPoints[i].spawnPoint.position.x + 0.05f,
                                                  poolySpawner.spawnPoints[i].spawnPoint.position.y - 0.05f,
                                                  poolySpawner.spawnPoints[i].spawnPoint.position.z),
                                      "产生的物体位置 " + i + " " + poolySpawner.spawnPoints[i].spawnPoint.position);
                        QUI.BeginChangeCheck();
                        Vector3 updatedSpawnPointPosition = Handles.PositionHandle(poolySpawner.spawnPoints[i].spawnPoint.position, Quaternion.identity);
                        if (QUI.EndChangeCheck())
                        {
                            Undo.RecordObject(poolySpawner, "Moved " + poolySpawner.spawnPoints[i].spawnPoint.name);
                            poolySpawner.spawnPoints[i].spawnPoint.position = updatedSpawnPointPosition.Round();
                        }
                        Handles.color = LineColor;
                        Handles.DrawDottedLine(poolySpawner.transform.position, poolySpawner.spawnPoints[i].spawnPoint.position, 4);
                        Handles.color = defaultHandlesColor;
                    }
                }
                break;
            }
        }
 void DrawGameEventOptions()
 {
     if (!triggerOnGameEvent.boolValue)
     {
         return;
     }
     buttonCategory.stringValue = DUI.DEFAULT_CATEGORY_NAME;
     buttonName.stringValue     = DUI.DEFAULT_BUTTON_NAME;
     ValiateUIButtonNameAndCategory();
     SaveColors();
     QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Listen for", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 58);
         QUI.PropertyField(triggerOnGameEvent, 12);
         QUI.Label("game event", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 70);
         QUI.Space(SPACE_8);
         QUI.BeginChangeCheck();
         {
             QUI.PropertyField(dispatchAll, 12);
         }
         if (QUI.EndChangeCheck())
         {
             if (triggerOnGameEvent.boolValue)
             {
                 gameEvent.stringValue = dispatchAll.boolValue ? DUI.DISPATCH_ALL : "";
             }
             else if (triggerOnButtonClick.boolValue || triggerOnButtonDoubleClick.boolValue || triggerOnButtonLongClick.boolValue)
             {
                 buttonName.stringValue = dispatchAll.boolValue ? DUI.DISPATCH_ALL : DUI.DEFAULT_BUTTON_NAME;
                 if (dispatchAll.boolValue)
                 {
                     buttonCategory.stringValue = DUI.DEFAULT_CATEGORY_NAME;
                 }
                 else
                 {
                     buttonCategory.stringValue = DUI.DEFAULT_CATEGORY_NAME;
                     buttonName.stringValue     = DUI.DEFAULT_BUTTON_NAME;
                     ValiateUIButtonNameAndCategory();
                 }
             }
         }
         QUI.Label("dispatch all", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 142);
     }
     QUI.EndHorizontal();
     if (dispatchAll.boolValue)
     {
         gameEvent.stringValue = ""; return;
     }
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Game Event", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 72);
         EditorGUILayout.DelayedTextField(gameEvent, GUIContent.none, GUILayout.Width(344));
     }
     QUI.EndHorizontal();
     RestoreColors();
 }
 void DrawMessage(float width)
 {
     QUI.BeginChangeCheck();
     QUI.QObjectPropertyField("Notification Message", message, width);
     if (QUI.EndChangeCheck())
     {
         serializedObject.ApplyModifiedProperties();
         if (uiNotification.message != null)
         {
             uiNotification.message.name = "Notification Message";
         }
     }
 }
 void DrawIcon(float width)
 {
     QUI.BeginChangeCheck();
     QUI.QObjectPropertyField("Notification Icon", icon, width);
     if (QUI.EndChangeCheck())
     {
         serializedObject.ApplyModifiedProperties();
         if (uiNotification.icon != null)
         {
             uiNotification.icon.name = "Notification Icon";
         }
     }
 }
예제 #10
0
 void DrawCanvasName()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Canvas Name", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), WIDTH_105);
         if (EditorApplication.isPlayingOrWillChangePlaymode)
         {
             QUI.Label(canvasName.stringValue, DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormalItalic));
         }
         else
         {
             if (customCanvasName.boolValue)
             {
                 QUI.PropertyField(canvasName, 240);
             }
             else
             {
                 QUI.BeginChangeCheck();
                 {
                     if (DUI.CanvasNamesDatabase == null || !DUI.CanvasNamesDatabase.Contains(canvasName.stringValue))
                     {
                         RefreshCanvasNames(true);
                     }
                     canvasNameIndex = EditorGUILayout.Popup(canvasNameIndex, DUI.CanvasNamesDatabase.ToArray(), GUILayout.Width(240));
                 }
                 if (QUI.EndChangeCheck())
                 {
                     canvasName.stringValue = DUI.CanvasNamesDatabase.data[canvasNameIndex];
                 }
             }
             QUI.Space(SPACE_4);
             QUI.BeginChangeCheck();
             {
                 QUI.PropertyField(customCanvasName, 12);
             }
             if (QUI.EndChangeCheck())
             {
                 if (!customCanvasName.boolValue)
                 {
                     ValidateUICanvasCanvasName();
                 }
             }
             QUI.Label("custom", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 50);
         }
     }
     QUI.EndHorizontal();
     QUI.Space(SPACE_4);
 }
 void DrawOverlay(float width)
 {
     QUI.BeginChangeCheck();
     QUI.QObjectPropertyField("Background Overlay", overlay, width);
     if (QUI.EndChangeCheck())
     {
         serializedObject.ApplyModifiedProperties();
         if (uiNotification.overlay != null)
         {
             uiNotification.overlay.transform.SetParent(uiNotification.transform);
             uiNotification.overlay.linkedToNotification = true;
             uiNotification.overlay.autoRegister         = false;
             uiNotification.overlay.name = DUI.DUISettings.UIElement_Inspector_RenameGameObjectPrefix + "Background Overlay" + DUI.DUISettings.UIElement_Inspector_RenameGameObjectSuffix;
         }
     }
 }
예제 #12
0
 void DrawTargetUIElement()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Target UIElement", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 126);
         QUI.BeginChangeCheck();
         {
             QUI.PropertyField(targetUIElement, 290);
         }
         if (QUI.EndChangeCheck())
         {
             serializedObject.ApplyModifiedProperties();
             RenameGameObject();
         }
     }
     QUI.EndHorizontal();
     QUI.Space(-SPACE_2);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Space(130);
         QUI.Label("Element Category", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmall), 100);
         if (uiEffect.targetUIElement != null)
         {
             QUI.Label(uiEffect.targetUIElement.elementCategory, DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmallItalic), 190);
         }
         else
         {
             QUI.Label(MISSING_UIELEMENT, DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmallItalic), 190);
         }
     }
     QUI.EndHorizontal();
     QUI.Space(-SPACE_4);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Space(130);
         QUI.Label("Element Name", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmall), 100);
         if (uiEffect.targetUIElement != null)
         {
             QUI.Label(uiEffect.targetUIElement.elementName, DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmallItalic), 190);
         }
         else
         {
             QUI.Label(MISSING_UIELEMENT, DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmallItalic), 190);
         }
     }
     QUI.EndHorizontal();
 }
        void DrawListenSelector(float width)
        {
            GUI.enabled = false; //disable gui interractions

            QUI.BeginHorizontal(width);
            {
                GUI.enabled = !triggerOnButtonClick.boolValue && !triggerOnButtonDoubleClick.boolValue && !triggerOnButtonLongClick.boolValue;
                QUI.BeginChangeCheck();
                QUI.QToggle("game event", triggerOnGameEvent);
                if (QUI.EndChangeCheck())
                {
                    if (triggerOnGameEvent.boolValue && !dispatchAll.boolValue) //if game event has been selected and dispatch all is disabled -> select the text field
                    {
                        QUI.FocusTextInControl("gameEvent");
                    }
                    if (!triggerOnGameEvent.boolValue) //if game event has been disabled -> reset game event string
                    {
                        gameEvent.stringValue = dispatchAll.boolValue ? DUI.DISPATCH_ALL : string.Empty;
                    }
                }

                GUI.enabled = false;
                QUI.Space(SPACE_8);

                GUI.enabled = !triggerOnGameEvent.boolValue && !triggerOnButtonDoubleClick.boolValue && !triggerOnButtonLongClick.boolValue;
                QUI.QToggle("button click", triggerOnButtonClick);

                GUI.enabled = false;
                QUI.Space(SPACE_8);

                GUI.enabled = !triggerOnGameEvent.boolValue && !triggerOnButtonClick.boolValue && !triggerOnButtonLongClick.boolValue;
                QUI.QToggle("double click", triggerOnButtonDoubleClick);

                GUI.enabled = false;
                QUI.Space(SPACE_8);

                GUI.enabled = !triggerOnGameEvent.boolValue && !triggerOnButtonClick.boolValue && !triggerOnButtonDoubleClick.boolValue;
                QUI.QToggle("long click", triggerOnButtonLongClick);

                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();

            GUI.enabled = true; //enable gui interractions
        }
 void DrawButtonName()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Button Name", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), WIDTH_105);
         if (EditorApplication.isPlayingOrWillChangePlaymode)
         {
             QUI.Label(buttonName.stringValue, DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormalItalic));
         }
         else
         {
             if (buttonCategory.stringValue.Equals(DUI.CUSTOM_NAME))
             {
                 EditorGUILayout.DelayedTextField(buttonName, GUIContent.none);
             }
             else
             {
                 if (DUI.GetUIButtonNames(DUI.UIButtonCategories[buttonCategoryIndex]).Count == 0)
                 {
                     QUI.Label(buttonName.stringValue, DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormalItalic), 90);
                     QUI.FlexibleSpace();
                     QUI.Label("(Empty Category)", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmallItalic), 86);
                 }
                 else
                 {
                     QUI.BeginChangeCheck();
                     {
                         if (!DUI.UIButtonCategoryExists(buttonCategory.stringValue))
                         {
                             RefreshButtonNameAndCategory(true);
                         }
                         buttonNameIndex = EditorGUILayout.Popup(buttonNameIndex, DUI.GetUIButtonNames(buttonCategory.stringValue).ToArray());
                     }
                     if (QUI.EndChangeCheck())
                     {
                         buttonName.stringValue = DUI.GetUIButtonNames(buttonCategory.stringValue)[buttonNameIndex];
                     }
                 }
             }
         }
     }
     QUI.EndHorizontal();
     QUI.Space(SPACE_4);
 }
        void DrawNotificationContainer(float width)
        {
            QUI.BeginChangeCheck();
            QUI.QObjectPropertyField("Notification Container", notificationContainer, width);
            if (QUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                if (uiNotification.notificationContainer != null)
                {
                    uiNotification.notificationContainer.transform.SetParent(uiNotification.transform);
                    uiNotification.notificationContainer.linkedToNotification = true;
                    uiNotification.notificationContainer.autoRegister         = false;
                    uiNotification.notificationContainer.name = DUI.DUISettings.UIElement_Inspector_RenameGameObjectPrefix + "Notification Container" + DUI.DUISettings.UIElement_Inspector_RenameGameObjectSuffix;
                }
            }

            infoMessage["MissingNotificationContainer"].show.target = notificationContainer.objectReferenceValue == null;
            DrawInfoMessage("MissingNotificationContainer", width);
        }
 void DrawButtons(float width)
 {
     QUI.BeginChangeCheck();
     QUI.QObjectList("Notification Buttons", buttons, "No UIButtons referenced...", showNotificationButtons, width, BarHeight);
     if (QUI.EndChangeCheck())
     {
         serializedObject.ApplyModifiedProperties();
         if (uiNotification.buttons != null && uiNotification.buttons.Length > 0)
         {
             for (int i = 0; i < uiNotification.buttons.Length; i++)
             {
                 if (uiNotification.buttons[i] != null)
                 {
                     uiNotification.buttons[i].name = "Notification Button " + i;
                 }
             }
         }
     }
 }
예제 #17
0
 void DrawIcon()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Notification Icon", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 130);
         QUI.BeginChangeCheck();
         {
             QUI.PropertyField(icon, 281);
         }
         if (QUI.EndChangeCheck())
         {
             serializedObject.ApplyModifiedProperties();
             if (uiNotification.icon != null)
             {
                 uiNotification.icon.name = "Notification Icon";
             }
         }
     }
     QUI.EndHorizontal();
 }
 void DrawEffects(float width)
 {
     QUI.BeginChangeCheck();
     QUI.QObjectList("Notification Effects", effects, "No UIEffects referenced...", showNotificationEffects, width, BarHeight);
     if (QUI.EndChangeCheck())
     {
         serializedObject.ApplyModifiedProperties();
         if (uiNotification.effects != null && uiNotification.effects.Length > 0)
         {
             for (int i = 0; i < uiNotification.effects.Length; i++)
             {
                 if (uiNotification.effects[i] != null)
                 {
                     uiNotification.effects[i].targetUIElement = uiNotification.notificationContainer;
                     uiNotification.effects[i].name            = "Notification Effect " + i;
                 }
             }
         }
     }
 }
 void DrawSpecialElements(float width)
 {
     QUI.BeginChangeCheck();
     QUI.QObjectList("Special Elements", specialElements, "No UIElements referenced...", showSpecialElements, width, BarHeight);
     if (QUI.EndChangeCheck())
     {
         serializedObject.ApplyModifiedProperties();
         if (uiNotification.specialElements != null && uiNotification.specialElements.Length > 0)
         {
             for (int i = 0; i < uiNotification.specialElements.Length; i++)
             {
                 if (uiNotification.specialElements[i] != null)
                 {
                     uiNotification.specialElements[i].transform.SetParent(uiNotification.transform);
                     uiNotification.specialElements[i].name = DUI.DUISettings.UIElement_Inspector_RenameGameObjectPrefix + "Special Element " + i + DUI.DUISettings.UIElement_Inspector_RenameGameObjectSuffix;
                 }
             }
         }
     }
 }
        void DrawPerformDatabaseUpgrade(float width)
        {
            QUI.BeginHorizontal(width);
            {
                QLabel.text  = "Find";
                QLabel.style = Style.Text.Button;
                if (QUI.GhostButton(QLabel.text, QColors.Color.Gray, QLabel.x + 16, 18))
                {
                    // Load object
                    UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(DUI.RELATIVE_PATH_VERSION + "DUIVersion" + ".asset", typeof(UnityEngine.Object));

                    // Select the object in the project folder
                    Selection.activeObject = obj;

                    // Also flash the folder yellow to highlight it
                    EditorGUIUtility.PingObject(obj);
                }

                QUI.Space(SPACE_2);

                QLabel.text  = "DoozyUI " + Internal.DUIVersion.Instance.version;
                QLabel.style = Style.Text.Button;
                QUI.Label(QLabel);

                QUI.Space(SPACE_2);

                QLabel.text  = "Perform Database Upgrade";
                QLabel.style = Style.Text.Button;
                QUI.BeginChangeCheck();
                Internal.DUIVersion.Instance.performDatabaseUpgrade = QUI.QToggle("Perform Database Upgrade", Internal.DUIVersion.Instance.performDatabaseUpgrade);
                if (QUI.EndChangeCheck())
                {
                    QUI.SetDirty(Internal.DUIVersion.Instance);
                    AssetDatabase.SaveAssets();
                }


                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
        }
예제 #21
0
 void DrawOverlay()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Background Overlay", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 130);
         QUI.BeginChangeCheck();
         {
             QUI.PropertyField(overlay, 281);
         }
         if (QUI.EndChangeCheck())
         {
             serializedObject.ApplyModifiedProperties();
             if (uiNotification.overlay != null)
             {
                 uiNotification.overlay.transform.SetParent(uiNotification.transform);
                 uiNotification.overlay.linkedToNotification = true;
                 uiNotification.overlay.autoRegister         = false;
                 uiNotification.overlay.name = DUI.DUISettings.UIElement_Inspector_RenameGameObjectPrefix + "Background Overlay" + DUI.DUISettings.UIElement_Inspector_RenameGameObjectSuffix;
             }
         }
     }
     QUI.EndHorizontal();
 }
예제 #22
0
 void DrawSound()
 {
     QUI.SetGUIBackgroundColor(accentColorPurple);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Despawn After", Style.Text.Normal, 86);
         QUI.BeginChangeCheck();
         QUI.PropertyField(despawnAfter, 100);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.despawnAfter = (PoolyDespawner.DespawnAfter)despawnAfter.enumValueIndex;
                 }
             }
         }
         QUI.FlexibleSpace();
         QUI.BeginChangeCheck();
         QUI.Toggle(playOnSpawn);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.playOnSpawn = playOnSpawn.boolValue;
                 }
             }
         }
         QUI.Label("Play On Spawn", Style.Text.Normal, 84);
     }
     QUI.EndHorizontal();
     if (poolyDespawner.aSource == null)
     {
         QUI.Label("AudioSource: Not Found", Style.Text.Normal, WIDTH_420);
         infoMessage["poolyDespawner.aSource"].show.target      = true;
         infoMessage["poolyDespawner.aSource.clip"].show.target = false;
     }
     else if (poolyDespawner.aSource.clip == null)
     {
         QUI.Label("AudioSource: " + poolyDespawner.aSource.gameObject.name, Style.Text.Normal, WIDTH_420);
         QUI.Label("AudioClip: Not Found", Style.Text.Normal, WIDTH_420);
         infoMessage["poolyDespawner.aSource"].show.target      = false;
         infoMessage["poolyDespawner.aSource.clip"].show.target = true;
     }
     else
     {
         QUI.Label("AudioSource: " + poolyDespawner.aSource.gameObject.name, Style.Text.Normal, WIDTH_420);
         QUI.Label("AudioClip: " + poolyDespawner.aSource.clip.name, Style.Text.Normal, WIDTH_420);
         QUI.Label("Duration: " + poolyDespawner.aSource.clip.length + " seconds", Style.Text.Normal, WIDTH_420);
         infoMessage["poolyDespawner.aSource"].show.target      = false;
         infoMessage["poolyDespawner.aSource.clip"].show.target = false;
     }
     QUI.ResetColors();
     DrawInfoMessage("poolyDespawner.aSource", WIDTH_420);
     DrawInfoMessage("poolyDespawner.aSource.clip", WIDTH_420);
 }
예제 #23
0
        //————————————————————————————————————

        private void XiaoShiType()                         // 消失类型
        {
            QUI.Label("消失类型    ", Style.Text.Normal, 50);
            QUI.BeginChangeCheck();
            QUI.PropertyField(despawnAfter, 120);
        }
예제 #24
0
 void DrawTrigger()                                 // 3D触碰后消失
 {
     QUI.SetGUIBackgroundColor(QColors.PurpleLight.Color);
     QUI.BeginHorizontal(WIDTH_420);
     {
         XiaoShiType();
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.despawnAfter = (PoolyDespawner.DespawnAfter)despawnAfter.enumValueIndex;
                 }
             }
         }
         QUI.FlexibleSpace();
         if (!orDespawnAfterTime.boolValue)
         {
             QUI.BeginChangeCheck();
             QUI.Toggle(orDespawnAfterTime);
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.orDespawnAfterTime = orDespawnAfterTime.boolValue;
                     }
                 }
             }
             QUI.Label("延时", Style.Text.Normal, 50);
         }
         else
         {
             QUI.BeginChangeCheck();
             QUI.Toggle(orDespawnAfterTime);
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.orDespawnAfterTime = orDespawnAfterTime.boolValue;
                     }
                 }
             }
             QUI.Label("延时", Style.Text.Normal, 30);
             QUI.BeginChangeCheck();
             QUI.PropertyField(duration, 40);
             if (duration.floatValue <= 0)
             {
                 duration.floatValue = 0;
             }
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.duration = duration.floatValue;
                     }
                 }
             }
             QUI.Label("秒", Style.Text.Normal, 50);
         }
     }
     QUI.EndHorizontal();
     QUI.ResetColors();
     infoMessage["duration.floatValue"].show.target = duration.floatValue <= 0 && orDespawnAfterTime.boolValue;
     DrawInfoMessage("duration.floatValue", WIDTH_420);
     QUI.SetGUIBackgroundColor(accentColorPurple);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("接触后,“消失”在那调用:", Style.Text.Normal, 138);
         QUI.Space(SPACE_8);
         QUI.BeginChangeCheck();
         QUI.Toggle(despawnOnTriggerEnter);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.despawnOnTriggerEnter = despawnOnTriggerEnter.boolValue;
                 }
             }
         }
         QUI.Label("Enter", Style.Text.Normal, 34);
         QUI.Space(SPACE_8);
         QUI.BeginChangeCheck();
         QUI.Toggle(despawnOnTriggerStay);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.despawnOnTriggerStay = despawnOnTriggerStay.boolValue;
                 }
             }
         }
         QUI.Label("Stay", Style.Text.Normal, 28);
         QUI.Space(SPACE_8);
         QUI.BeginChangeCheck();
         QUI.Toggle(despawnOnTriggerExit);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.despawnOnTriggerExit = despawnOnTriggerExit.boolValue;
                 }
             }
         }
         QUI.Label("Exit", Style.Text.Normal, 24);
         QUI.FlexibleSpace();
     }
     QUI.EndHorizontal();
     QUI.Space(SPACE_4);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.PropertyField(onlyWithTag, 12);
         QUI.Label("仅和 tag 碰撞", Style.Text.Normal, 120);
         QUI.BeginChangeCheck();
         targetTag.stringValue = EditorGUILayout.TagField(targetTag.stringValue);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.targetTag = targetTag.stringValue;
                 }
             }
         }
         QUI.Space(SPACE_4);
     }
     QUI.EndHorizontal();
     QUI.ResetColors();
 }
예제 #25
0
 void DrawTime()
 {
     QUI.SetGUIBackgroundColor(accentColorPurple);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Despawn After", Style.Text.Normal, 86);
         QUI.BeginChangeCheck();
         QUI.PropertyField(despawnAfter, 100);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.despawnAfter = (PoolyDespawner.DespawnAfter)despawnAfter.enumValueIndex;
                 }
             }
         }
         QUI.FlexibleSpace();
         QUI.Label("Auto Start", Style.Text.Normal, 60);
         QUI.BeginChangeCheck();
         QUI.PropertyField(autoStart, 100);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.autoStart = (PoolyDespawner.AutoStart)autoStart.enumValueIndex;
                 }
             }
         }
     }
     QUI.EndHorizontal();
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Duration", Style.Text.Normal, 52);
         QUI.BeginChangeCheck();
         QUI.PropertyField(duration, 40);
         if (duration.floatValue <= 0)
         {
             duration.floatValue = 0;
         }
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.duration = duration.floatValue;
                 }
             }
         }
         QUI.Space(SPACE_8);
         QUI.BeginChangeCheck();
         QUI.Toggle(useRealTime);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.useRealTime = useRealTime.boolValue;
                 }
             }
         }
         QUI.Label("use RealTime instead of GameTime", Style.Text.Normal);
         QUI.FlexibleSpace();
     }
     QUI.EndHorizontal();
     QUI.ResetColors();
     infoMessage["duration.floatValue"].show.target = duration.floatValue <= 0;
     DrawInfoMessage("duration.floatValue", WIDTH_420);
 }
        void DrawTargetCanvas(float width)
        {
            QUI.BeginHorizontal(width);
            {
                tempFloat = width - 72; //background width
                QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Gray), tempFloat, 20);
                QUI.Space(-tempFloat);
                QUI.Space(SPACE_4);

                QLabel.text  = "Canvas Name";
                QLabel.style = Style.Text.Small;
                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                {
                    QUI.Space(1);
                    QUI.Label(QLabel);
                }
                QUI.EndVertical();

                if (EditorApplication.isPlayingOrWillChangePlaymode)
                {
                    GUI.enabled = false;
                }

                tempFloat = width - QLabel.x - 92; //field width

                if (customTargetCanvasName.boolValue)
                {
                    QUI.PropertyField(targetCanvasName, tempFloat);

                    if (Event.current.isKey &&
                        (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.Escape) &&
                        Event.current.type == EventType.KeyUp)   //if the Enter or Escape key have been pressed
                    {
                        customTargetCanvasName.boolValue = false;
                    }
                }
                else
                {
                    ValidateCanvasName();
                    QUI.BeginChangeCheck();
                    canvasNameIndex = EditorGUILayout.Popup(canvasNameIndex, DatabaseUICanvases.ToArray(), GUILayout.Width(tempFloat));
                    if (QUI.EndChangeCheck())
                    {
                        Undo.RecordObject(target, "UpdateCanvasName");
                        targetCanvasName.stringValue = DUIData.Instance.DatabaseUICanvases[canvasNameIndex];
                    }
                }
                QUI.Space(SPACE_4);
                QLabel.text  = "custom";
                QLabel.style = Style.Text.Normal;
                QUI.BeginChangeCheck();
                QUI.BeginVertical(QLabel.x + 28, 18);
                {
                    QUI.Space(1);
                    QUI.QToggle("custom", customTargetCanvasName);
                }
                QUI.EndVertical();
                if (QUI.EndChangeCheck())
                {
                    if (!customTargetCanvasName.boolValue)
                    {
                        ValidateCanvasName();
                    }
                }

                GUI.enabled = true;
            }
            QUI.EndHorizontal();

            infoMessage["EmptyTargetCanvasName"].show.target = string.IsNullOrEmpty(targetCanvasName.stringValue);
            DrawInfoMessage("EmptyTargetCanvasName", width);
        }
        void DrawButtonName(float width)
        {
            QUI.BeginHorizontal(width);
            {
                if (EditorApplication.isPlayingOrWillChangePlaymode)
                {
                    QLabel.text  = buttonName.stringValue;
                    QLabel.style = Style.Text.Help;
                    QUI.Label(QLabel);
                }
                else
                {
                    if (buttonCategory.stringValue.Equals(DUI.CUSTOM_NAME))
                    {
                        QUI.PropertyField(buttonName, width - 5);
                    }
                    else
                    {
                        if (!DatabaseUIButtons.ContainsCategoryName(buttonCategory.stringValue)) //the category does not exist -> reset category and name
                        {
                            QUI.DisplayDialog("Info",
                                              "Button category has been reset to the default '" + DUI.UNCATEGORIZED_CATEGORY_NAME + "' value." +
                                              "\n\n" +
                                              "Button name has been reset to the default '" + DUI.DEFAULT_BUTTON_NAME + "' value.",
                                              "Ok");                                                                                          //inform the dev that becuase he did not add the name to the database, it has been reset to its default value
                            buttonCategory.stringValue = DUI.UNCATEGORIZED_CATEGORY_NAME;                                                     //reset the category
                            buttonCategoryIndex        = DatabaseUIButtons.CategoryNameIndex(buttonCategory.stringValue);                     //set the index
                            buttonName.stringValue     = DUI.DEFAULT_BUTTON_NAME;                                                             //reset the name
                            buttonNameIndex            = DatabaseUIButtons.ItemNameIndex(buttonCategory.stringValue, buttonName.stringValue); //set the index
                        }
                        else if (!DatabaseUIButtons.Contains(buttonCategory.stringValue, buttonName.stringValue))                             //category does not contain the set name -> ask de dev is it should be added
                        {
                            if (QUI.DisplayDialog("Action Required",
                                                  "The name '" + buttonName.stringValue + "' was not found in the '" + buttonCategory.stringValue + "' category." +
                                                  "\n\n" +
                                                  "Do you want to add it to the database?",
                                                  "Yes",
                                                  "No"))                                                                                       //ask the dev if he wants to add this name to the database
                            {
                                DatabaseUIButtons.GetCategory(buttonCategory.stringValue).AddItemName(buttonName.stringValue, true);           //add the item name to the database and save
                                buttonNameIndex = DatabaseUIButtons.ItemNameIndex(buttonCategory.stringValue, buttonName.stringValue);         //set the index
                            }
                            else if (!DatabaseUIButtons.GetCategory(buttonCategory.stringValue).IsEmpty())                                     //select the first item in the category because it's not empty
                            {
                                buttonNameIndex        = 0;                                                                                    //set the index
                                buttonName.stringValue = DatabaseUIButtons.GetCategory(buttonCategory.stringValue).itemNames[buttonNameIndex]; //get the name
                            }
                            else //reset category and name
                            {
                                QUI.DisplayDialog("Info",
                                                  "Button category has been reset to the default '" + DUI.UNCATEGORIZED_CATEGORY_NAME + "' value." +
                                                  "\n\n" +
                                                  "Button name has been reset to the default '" + DUI.DEFAULT_BUTTON_NAME + "' value.",
                                                  "Ok");                                                                                          //inform the dev that becuase he did not add the name to the database, it has been reset to its default value
                                buttonCategory.stringValue = DUI.UNCATEGORIZED_CATEGORY_NAME;                                                     //reset the category
                                buttonCategoryIndex        = DatabaseUIButtons.CategoryNameIndex(buttonCategory.stringValue);                     //set the index
                                buttonName.stringValue     = DUI.DEFAULT_BUTTON_NAME;                                                             //reset the name
                                buttonNameIndex            = DatabaseUIButtons.ItemNameIndex(buttonCategory.stringValue, buttonName.stringValue); //set the index
                            }
                        }
                        else //category contains the set name -> get its index
                        {
                            buttonNameIndex = DatabaseUIButtons.ItemNameIndex(buttonCategory.stringValue, buttonName.stringValue); //set the index
                        }
                        QUI.BeginChangeCheck();
                        buttonNameIndex = EditorGUILayout.Popup(buttonNameIndex, DatabaseUIButtons.GetCategory(buttonCategory.stringValue).itemNames.ToArray(), GUILayout.Width(width - 5));
                        if (QUI.EndChangeCheck())
                        {
                            buttonName.stringValue = DatabaseUIButtons.GetCategory(buttonCategory.stringValue).itemNames[buttonNameIndex];
                        }
                    }
                }

                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
            QUI.Space(SPACE_4);
        }
예제 #28
0
 void DrawEffect()
 {
     QUI.SetGUIBackgroundColor(accentColorPurple);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Despawn After", Style.Text.Normal, 86);
         QUI.BeginChangeCheck();
         QUI.PropertyField(despawnAfter, 100);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.despawnAfter = (PoolyDespawner.DespawnAfter)despawnAfter.enumValueIndex;
                 }
             }
         }
         QUI.FlexibleSpace();
         QUI.BeginChangeCheck();
         QUI.Toggle(playOnSpawn);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.playOnSpawn = playOnSpawn.boolValue;
                 }
             }
         }
         QUI.Label("Play On Spawn", Style.Text.Normal, 84);
     }
     QUI.EndHorizontal();
     if (poolyDespawner.pSystem == null)
     {
         QUI.Label("ParticleSystem: Not Found", Style.Text.Normal, WIDTH_420);
         infoMessage["poolyDespawner.pSystem"].show.target = true;
     }
     else
     {
         QUI.Label("ParticleSystem: " + poolyDespawner.pSystem.gameObject.name, Style.Text.Normal, WIDTH_420);
         QUI.BeginHorizontal(WIDTH_420);
         {
             QUI.BeginChangeCheck();
             QUI.PropertyField(useParticleSystemDuration, 12);
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.useParticleSystemDuration = useParticleSystemDuration.boolValue;
                     }
                 }
             }
             QUI.Label("Duration: " + poolyDespawner.pSystem.main.duration + " seconds", Style.Text.Normal, WIDTH_420 - 12);
         }
         QUI.EndHorizontal();
         QUI.BeginHorizontal(WIDTH_420);
         {
             QUI.BeginChangeCheck();
             QUI.PropertyField(useParticleSystemStartDelay, 12);
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.useParticleSystemStartDelay = useParticleSystemStartDelay.boolValue;
                     }
                 }
             }
             QUI.Label("Start Delay: " + poolyDespawner.pSystem.main.startDelay.constant + " seconds", Style.Text.Normal, WIDTH_420);
         }
         QUI.EndHorizontal();
         QUI.BeginHorizontal(WIDTH_420);
         {
             QUI.BeginChangeCheck();
             QUI.PropertyField(useParticleSystemStartLifetime, 12);
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.useParticleSystemStartLifetime = useParticleSystemStartLifetime.boolValue;
                     }
                 }
             }
             QUI.Label("Start Lifetime: " + poolyDespawner.pSystem.main.startLifetime.constant + " seconds", Style.Text.Normal, WIDTH_420);
         }
         QUI.EndHorizontal();
         QUI.BeginHorizontal(WIDTH_420);
         {
             QUI.Label("Extra Time", Style.Text.Normal, 65);
             QUI.BeginChangeCheck();
             QUI.PropertyField(extraTime, 40);
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.extraTime = extraTime.floatValue;
                     }
                 }
             }
             QUI.Label("seconds", Style.Text.Normal, 50);
         }
         QUI.EndHorizontal();
         QUI.Space(SPACE_2);
         QUI.Button(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Purple), WIDTH_420, 20);
         QUI.Space(-20);
         QUI.BeginHorizontal(WIDTH_420);
         {
             QUI.Space(2);
             QUI.Label("Total Duration until despawn: " + poolyDespawner.pSystemTotalDuration + " seconds", Style.Text.Normal, WIDTH_420);
         }
         QUI.EndHorizontal();
         infoMessage["poolyDespawner.pSystem"].show.target = false;
     }
     QUI.ResetColors();
     DrawInfoMessage("poolyDespawner.pSystem", WIDTH_420);
 }
        void DrawGameEventOptions(float width)
        {
            if (!triggerOnGameEvent.boolValue)
            {
                return;
            }

            buttonCategory.stringValue = DUI.UNCATEGORIZED_CATEGORY_NAME;
            buttonName.stringValue     = DUI.DEFAULT_BUTTON_NAME;

            QUI.BeginHorizontal(width);
            {
                if (dispatchAll.boolValue)                //if dispatchAll is enabled -> set game event to empty and disable the field
                {
                    gameEvent.stringValue = string.Empty; //set game event as an empty string
                    GUI.enabled           = false;        //disable gui
                }

                QLabel.text  = "Game Event";
                QLabel.style = Style.Text.Normal;
                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                {
                    QUI.Label(QLabel);
                    QUI.Space(SPACE_2);
                }
                QUI.EndVertical();

                tempFloat = QLabel.x;          //save label width

                QLabel.text  = "dispatch all"; //create and calculate a new label
                QLabel.style = Style.Text.Normal;

                tempFloat += QLabel.x; //add the second label width
                tempFloat += 12;       //add the size of a toggle
                tempFloat += 8;        //add space (4 to left and 4 to right)
                tempFloat += 24;

                QUI.SetNextControlName("gameEvent");
                EditorGUILayout.DelayedTextField(gameEvent, GUIContent.none, GUILayout.Width(width - tempFloat));

                GUI.enabled = true; //enable gui in case it was disabled by dispatch all

                QUI.BeginChangeCheck();
                QUI.QToggle("dispatch all", dispatchAll);
                if (QUI.EndChangeCheck())
                {
                    if (triggerOnGameEvent.boolValue)
                    {
                        gameEvent.stringValue = dispatchAll.boolValue ? DUI.DISPATCH_ALL : string.Empty;
                        if (!dispatchAll.boolValue)
                        {
                            QUI.FocusTextInControl("gameEvent");
                        }
                    }
                    else if (triggerOnButtonClick.boolValue || triggerOnButtonDoubleClick.boolValue || triggerOnButtonLongClick.boolValue)
                    {
                        buttonName.stringValue = dispatchAll.boolValue ? DUI.DISPATCH_ALL : DUI.DEFAULT_BUTTON_NAME;
                        if (dispatchAll.boolValue)
                        {
                            buttonCategory.stringValue = DUI.UNCATEGORIZED_CATEGORY_NAME;
                        }
                        else
                        {
                            buttonCategory.stringValue = DUI.UNCATEGORIZED_CATEGORY_NAME;
                            buttonName.stringValue     = DUI.DEFAULT_BUTTON_NAME;
                            ValidateButtonCategoryAndButtonName();
                        }
                    }
                }
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();

            infoMessage["SetGameEvent"].show.target = triggerOnGameEvent.boolValue && string.IsNullOrEmpty(gameEvent.stringValue) && !dispatchAll.boolValue;
            DrawInfoMessage("SetGameEvent", GlobalWidth);

            infoMessage["DispatchAllGameEvents"].show.target = dispatchAll.boolValue;
            DrawInfoMessage("DispatchAllGameEvents", width);
        }
예제 #30
0
 void DrawTrigger2D()
 {
     QUI.SetGUIBackgroundColor(accentColorPurple);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Despawn After", Style.Text.Normal, 86);
         QUI.BeginChangeCheck();
         QUI.PropertyField(despawnAfter, 100);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.despawnAfter = (PoolyDespawner.DespawnAfter)despawnAfter.enumValueIndex;
                 }
             }
         }
         QUI.FlexibleSpace();
         if (!orDespawnAfterTime.boolValue)
         {
             QUI.BeginChangeCheck();
             QUI.Toggle(orDespawnAfterTime);
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.orDespawnAfterTime = orDespawnAfterTime.boolValue;
                     }
                 }
             }
             QUI.Label("Or Despawn After Time", Style.Text.Normal, 126);
         }
         else
         {
             QUI.BeginChangeCheck();
             QUI.Toggle(orDespawnAfterTime);
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.orDespawnAfterTime = orDespawnAfterTime.boolValue;
                     }
                 }
             }
             QUI.Label("Or Despawn After", Style.Text.Normal, 106);
             QUI.BeginChangeCheck();
             QUI.PropertyField(duration, 40);
             if (duration.floatValue <= 0)
             {
                 duration.floatValue = 0;
             }
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.duration = duration.floatValue;
                     }
                 }
             }
             QUI.Label("seconds", Style.Text.Normal, 50);
         }
     }
     QUI.EndHorizontal();
     QUI.ResetColors();
     infoMessage["duration.floatValue"].show.target = duration.floatValue <= 0 && orDespawnAfterTime.boolValue;
     DrawInfoMessage("duration.floatValue", WIDTH_420);
     QUI.SetGUIBackgroundColor(accentColorPurple);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Despawn OnTrigger2D", Style.Text.Normal, 130);
         QUI.Space(SPACE_8);
         QUI.BeginChangeCheck();
         QUI.Toggle(despawnOnTriggerEnter2D);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.despawnOnTriggerEnter2D = despawnOnTriggerEnter2D.boolValue;
                 }
             }
         }
         QUI.Label("Enter2D", Style.Text.Normal, 50);
         QUI.Space(SPACE_8);
         QUI.BeginChangeCheck();
         QUI.Toggle(despawnOnTriggerStay2D);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.despawnOnTriggerStay2D = despawnOnTriggerStay2D.boolValue;
                 }
             }
         }
         QUI.Label("Stay2D", Style.Text.Normal, 42);
         QUI.Space(SPACE_8);
         QUI.BeginChangeCheck();
         QUI.Toggle(despawnOnTriggerExit2D);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.despawnOnTriggerExit2D = despawnOnTriggerExit2D.boolValue;
                 }
             }
         }
         QUI.Label("Exit2D", Style.Text.Normal, 40);
         QUI.FlexibleSpace();
     }
     QUI.EndHorizontal();
     QUI.Space(SPACE_4);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.PropertyField(onlyWithTag, 12);
         QUI.Label("Trigger Only By Tag", Style.Text.Normal, 114);
         QUI.BeginChangeCheck();
         targetTag.stringValue = EditorGUILayout.TagField(targetTag.stringValue);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.targetTag = targetTag.stringValue;
                 }
             }
         }
         QUI.Space(SPACE_4);
     }
     QUI.EndHorizontal();
     QUI.ResetColors();
 }