Exemplo n.º 1
0
 public static void DrawUnityEvents(bool enabled, AnimBool showEvents, SerializedProperty unityEvent, string unityEventTitle, float width, float miniBarHeight)
 {
     if (QUI.GhostBar("Unity Events", enabled ? QColors.Color.Blue : QColors.Color.Gray, showEvents, width, miniBarHeight))
     {
         showEvents.target = !showEvents.target;
     }
     QUI.BeginHorizontal(width);
     {
         QUI.Space(8 * showEvents.faded);
         if (QUI.BeginFadeGroup(showEvents.faded))
         {
             QUI.SetGUIBackgroundColor(enabled ? AccentColorBlue : AccentColorGray);
             QUI.BeginVertical(width - 16);
             {
                 QUI.Space(2 * showEvents.faded);
                 QUI.PropertyField(unityEvent, new GUIContent()
                 {
                     text = unityEventTitle
                 }, width - 8);
                 QUI.Space(2 * showEvents.faded);
             }
             QUI.EndVertical();
             QUI.ResetColors();
         }
         QUI.EndFadeGroup();
     }
     QUI.EndHorizontal();
 }
        void DrawPageHeader(string title, QColor titleColor, string subtitle, QColor subtitleColor, QTexture iconQTexture)
        {
            QUI.Space(SPACE_2);
            QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Gray), WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth, WindowSettings.pageHeaderHeight);
            QUI.Space(-WindowSettings.pageHeaderHeight + (WindowSettings.pageHeaderHeight - WindowSettings.pageHeaderHeight * 0.8f) / 2);
            QUI.BeginHorizontal(WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth, WindowSettings.pageHeaderHeight * 0.8f);
            {
                QUI.Space((WindowSettings.pageHeaderHeight - WindowSettings.pageHeaderHeight * 0.8f));
                QUI.BeginVertical((WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth) / 2, WindowSettings.pageHeaderHeight * 0.8f);
                {
                    QUI.FlexibleSpace();
                    if (!title.IsNullOrEmpty())
                    {
                        QUI.Space(-SPACE_2);
                        QUI.SetGUIColor(titleColor.Color);
                        QUI.Label(title, PageHeaderTitleStyle, (WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth) / 2, 26);
                        QUI.ResetColors();
                    }

                    if (!subtitle.IsNullOrEmpty())
                    {
                        QUI.Space(-SPACE_2);
                        QUI.SetGUIColor(subtitleColor.Color);
                        QUI.Label(subtitle, PageHeaderSubtitleStyle, (WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth) / 2, 18);
                        QUI.ResetColors();
                    }
                    QUI.FlexibleSpace();
                }
                QUI.EndVertical();
                QUI.FlexibleSpace();
                QUI.DrawTexture(iconQTexture.texture, WindowSettings.pageHeaderHeight * 0.8f, WindowSettings.pageHeaderHeight * 0.8f);
                QUI.Space((WindowSettings.pageHeaderHeight - WindowSettings.pageHeaderHeight * 0.8f) / 2);
            }
            QUI.EndHorizontal();
        }
Exemplo n.º 3
0
        void DrawOrientation(float width)
        {
            QStyles.GetStyle(QStyles.GetStyleName(Style.GhostButton.Purple)).alignment = TextAnchor.MiddleRight;
            if (QUI.GhostButton("update orientation", QColors.Color.Purple, width, 32, 10))
            {
                UpdateOrientationInEditMode();
            }
            QStyles.GetStyle(QStyles.GetStyleName(Style.GhostButton.Purple)).alignment = TextAnchor.MiddleCenter;

            QUI.Space(-32);

            switch (orientationManager.CurrentOrientation)
            {
            case OrientationManager.Orientation.Landscape: QUI.DrawTexture(DUIResources.miniIconOrientationLandscape.texture, 160, 32); break;

            case OrientationManager.Orientation.Portrait: QUI.DrawTexture(DUIResources.miniIconOrientationPortrait.texture, 160, 32); break;

            case OrientationManager.Orientation.Unknown: QUI.DrawTexture(DUIResources.miniIconOrientationUnknown.texture, 160, 32); break;
            }

            QUI.Space(SPACE_2);

            QUI.SetGUIBackgroundColor(QUI.AccentColorPurple);
            QUI.PropertyField(onOrientationChange, true, new GUIContent("OnOrientationChange"), width);
            QUI.ResetColors();
        }
Exemplo n.º 4
0
        void DrawSettings(float width)
        {
            QUI.QToggle("Auto disable Button Clicks when an UIElement is in trasition", autoDisableButtonClicks);

            QUI.Space(SPACE_4);

            //CONTROLLER INPUT MODE
            QUI.BeginHorizontal(width);
            {
                if ((ControllerInputMode)backButtonInputMode.enumValueIndex == ControllerInputMode.None)
                {
                    QUI.SetGUIBackgroundColor(QUI.AccentColorRed);
                }
                QUI.QObjectPropertyField("'Back' button Input Mode", backButtonInputMode, 260, 20, false);
                QUI.ResetColors();
                QUI.Space(SPACE_2);
                if ((ControllerInputMode)backButtonInputMode.enumValueIndex != ControllerInputMode.None)
                {
                    QUI.QToggle("enable alternate inputs", enableBackButtonAlternateInputs);
                }
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
            if ((ControllerInputMode)backButtonInputMode.enumValueIndex != ControllerInputMode.None)
            {
                QUI.BeginHorizontal(width);
                {
                    if ((ControllerInputMode)backButtonInputMode.enumValueIndex == ControllerInputMode.KeyCode)
                    {
                        QUI.QObjectPropertyField("Key Code", backButtonKeyCode, width / 2 - 1, 20, false);
                        QUI.Space(SPACE_2);
                        GUI.enabled = enableBackButtonAlternateInputs.boolValue;
                        if (!enableBackButtonAlternateInputs.boolValue)
                        {
                            QUI.SetGUIBackgroundColor(QUI.AccentColorRed);
                        }
                        QUI.QObjectPropertyField("Alternate", backButtonKeyCodeAlt, width / 2 - 1, 20, false);
                        QUI.ResetColors();
                        GUI.enabled = true;
                    }
                    else if ((ControllerInputMode)backButtonInputMode.enumValueIndex == ControllerInputMode.VirtualButton)
                    {
                        QUI.QObjectPropertyField("Virtual Button", backButtonVirtualButtonName, width / 2 - 1, 20, false);
                        QUI.Space(SPACE_2);
                        GUI.enabled = enableBackButtonAlternateInputs.boolValue;
                        if (!enableBackButtonAlternateInputs.boolValue)
                        {
                            QUI.SetGUIBackgroundColor(QUI.AccentColorRed);
                        }
                        QUI.QObjectPropertyField("Alternate", backButtonVirtualButtonNameAlt, width / 2 - 1, 20, false);
                        QUI.ResetColors();
                        GUI.enabled = true;
                    }
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
            }
        }
Exemplo n.º 5
0
 public void SaveColors(bool resetColors = false)
 {
     tempColor           = GUI.color;
     tempContentColor    = GUI.contentColor;
     tempBackgroundColor = GUI.backgroundColor;
     if (resetColors)
     {
         QUI.ResetColors();
     }
 }
Exemplo n.º 6
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            switch (poolyDespawner.despawnAfter)
            {
            case PoolyDespawner.DespawnAfter.Time:
                DrawHeader(EZResources.editorHeaderPoolyDespawnerTime.texture, WIDTH_420, 42);
                DrawTime();
                break;

            case PoolyDespawner.DespawnAfter.SoundPlayed:
                DrawHeader(EZResources.editorHeaderPoolyDespawnerSoundPlayed.texture, WIDTH_420, 42);
                useRealTime.boolValue = false;
                DrawSound();
                break;

            case PoolyDespawner.DespawnAfter.EffectPlayed:
                DrawHeader(EZResources.editorHeaderPoolyDespawnerEffectPlayed.texture, WIDTH_420, 42);
                useRealTime.boolValue = false;
                DrawEffect();
                break;

            case PoolyDespawner.DespawnAfter.Collision:
                DrawHeader(EZResources.editorHeaderPoolyDespawnerCollider.texture, WIDTH_420, 42);
                useRealTime.boolValue = false;
                DrawCollision();
                break;

            case PoolyDespawner.DespawnAfter.Trigger:
                DrawHeader(EZResources.editorHeaderPoolyDespawnerTrigger.texture, WIDTH_420, 42);
                useRealTime.boolValue = false;
                DrawTrigger();
                break;

            case PoolyDespawner.DespawnAfter.Collision2D:
                DrawHeader(EZResources.editorHeaderPoolyDespawnerCollider2D.texture, WIDTH_420, 42);
                useRealTime.boolValue = false;
                DrawCollision2D();
                break;

            case PoolyDespawner.DespawnAfter.Trigger2D:
                DrawHeader(EZResources.editorHeaderPoolyDespawnerTrigger2D.texture, WIDTH_420, 42);
                useRealTime.boolValue = false;
                DrawTrigger2D();
                break;
            }
            QUI.Space(SPACE_4);
            QUI.SetGUIBackgroundColor(accentColorPurple);
            QUI.PropertyField(OnDespawn, new GUIContent("OnDespawn"), WIDTH_420);
            QUI.ResetColors();
            QUI.Space(SPACE_4);
            serializedObject.ApplyModifiedProperties();
            QUI.Space(SPACE_4);
        }
Exemplo n.º 7
0
        void DrawDefineSymbolsBuildTargetGroup(float width)
        {
            QUI.BeginVertical(width);
            {
                QUI.GhostTitle("BUILD TARGET GROUP", QColors.Color.Blue, width);
                QUI.Space(SPACE_4);
                QUI.BeginHorizontal(width);
                {
                    QUI.Space(SPACE_8);
                    if (QUI.GhostButton("Copy to Symbols Preset   >>>", QColors.Color.Blue, width - SPACE_8, 24))
                    {
                        presetSymbols.Clear();
                        presetSymbols.AddRange(symbols);
                    }
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                QUI.Space(SPACE_4);
                QUI.BeginHorizontal(width);
                {
                    QUI.Space(SPACE_8);
                    QUI.SetGUIBackgroundColor(EditorGUIUtility.isProSkin ? QColors.Blue.Color : QColors.BlueLight.Color);
                    selectedBuildTargetGroup = (BuildTargetGroup)EditorGUILayout.EnumPopup(selectedBuildTargetGroup, GUILayout.Width(width - SPACE_8 - (106 * selectedBuildTargetGroupIsTheActivePlatform.faded)));
                    QUI.ResetColors();
                    if (selectedBuildTargetGroupIsTheActivePlatform.faded > 0.05f)
                    {
                        QUI.Label("is the Active Platform", Style.Text.Small, 106 * selectedBuildTargetGroupIsTheActivePlatform.faded);
                    }
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();

                if (selectedBuildTargetGroup != previouslySelectedBuildTargetGroup)
                {
                    symbols = QUtils.GetScriptingDefineSymbolsForGroup(selectedBuildTargetGroup);
                    previouslySelectedBuildTargetGroup = selectedBuildTargetGroup;
                    Repaint();
                }

                QUI.Space(SPACE_8 + SPACE_16);

                QUI.BeginHorizontal(width);
                {
                    QUI.Space(SPACE_8);
                    DrawActiveSymbolsList(width - 26);
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
            }
            QUI.EndVertical();
        }
 void DrawEvents()
 {
     if (!triggerOnGameEvent.boolValue && !triggerOnButtonClick.boolValue && !triggerOnButtonDoubleClick.boolValue && !triggerOnButtonLongClick.boolValue)
     {
         return;
     }
     if (triggerOnGameEvent.boolValue && (!dispatchAll.boolValue && string.IsNullOrEmpty(gameEvent.stringValue)))
     {
         return;
     }
     if ((triggerOnButtonClick.boolValue || triggerOnButtonDoubleClick.boolValue || triggerOnButtonLongClick.boolValue) && (!dispatchAll.boolValue && string.IsNullOrEmpty(buttonName.stringValue)))
     {
         return;
     }
     SaveColors();
     QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color);
     QUI.PropertyField(onTriggerEvent, new GUIContent("On Trigger Event"), WIDTH_420);
     RestoreColors();
     QUI.ResetColors();
     if (QUI.Button(DUIStyles.GetStyle(showGameEvents.target ? DUIStyles.ButtonStyle.GameEvents : DUIStyles.ButtonStyle.GameEventsCollapsed), WIDTH_420, 18))
     {
         showGameEvents.target = !showGameEvents.target;
     }
     if (QUI.BeginFadeGroup(showGameEvents.faded))
     {
         SaveColors();
         QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color);
         QUI.BeginVertical(WIDTH_420);
         {
             QUI.Space(SPACE_2);
             QUI.DrawList(gameEvents, WIDTH_420, "Not sending any Game Event on trigger... Click [+] to start...");
             QUI.Space(SPACE_2);
         }
         QUI.EndVertical();
         RestoreColors();
     }
     QUI.EndFadeGroup();
 }
        void DrawEvents(float width)
        {
            if (!triggerOnGameEvent.boolValue && !triggerOnButtonClick.boolValue && !triggerOnButtonDoubleClick.boolValue && !triggerOnButtonLongClick.boolValue)
            {
                return;
            }
            if (triggerOnGameEvent.boolValue && (!dispatchAll.boolValue && string.IsNullOrEmpty(gameEvent.stringValue)))
            {
                return;
            }
            if ((triggerOnButtonClick.boolValue || triggerOnButtonDoubleClick.boolValue || triggerOnButtonLongClick.boolValue) && (!dispatchAll.boolValue && string.IsNullOrEmpty(buttonName.stringValue)))
            {
                return;
            }

            QUI.SetGUIBackgroundColor(AccentColorBlue);
            QUI.PropertyField(onTriggerEvent, new GUIContent("On Trigger Event"), width);
            QUI.ResetColors();

            QUI.Space(SPACE_4);

            QUI.DrawCollapsableList("Game Events", showGameEventsAnimBool, gameEvents.arraySize > 0 ? QColors.Color.Blue : QColors.Color.Gray, gameEvents, width, 18, "Not sending any Game Events on trigger... Click [+] to start...");
        }
Exemplo n.º 10
0
 /// <summary>
 /// Draws a list's line.
 /// </summary>
 /// <param name="list">Target list</param>
 /// <param name="index">Line index</param>
 /// <param name="readOnly">Should the line be editable? If FALSE it will draw a Label. If TRUE it will draw a TextField with - and + buttons</param>
 /// <param name="width">Width of the line</param>
 /// <returns></returns>
 string DrawListItem(List <string> list, int index, bool readOnly, float width, float height)
 {
     if (readOnly)
     {
         QUI.Label(list[index], Style.Text.Normal, width, height);
     }
     else
     {
         QUI.BeginHorizontal(width);
         {
             list[index] = EditorGUILayout.TextField(list[index], GUILayout.Width(width - 41), GUILayout.Height(height));
             if (index == 0 && string.IsNullOrEmpty(list[index]))
             {
             }
             else
             {
                 QUI.SetGUIBackgroundColor(QColors.RedLight.Color);
                 if (QUI.ButtonMinus())
                 {
                     list.Remove(list[index]);
                     QUI.ResetColors();
                     return("");
                 }
                 QUI.ResetColors();
                 QUI.Space(1);
                 QUI.SetGUIBackgroundColor(QColors.GreenLight.Color);
                 if (QUI.ButtonPlus())
                 {
                     list.Insert(index, "");
                 }
                 QUI.ResetColors();
             }
         }
         QUI.EndHorizontal();
     }
     return(list[index]);
 }
Exemplo n.º 11
0
        private void DrawMainSettings()
        {
            QUI.BeginHorizontal(WIDTH_420);
            {
                QUI.SetGUIBackgroundColor(AccentColorOrange);
                switch (autoStart.enumValueIndex)
                {
                case (int)PoolySpawner.AutoStart.Start:
                    tempContent.text = "自动产生:Start 调用  ";
                    break;

                case (int)PoolySpawner.AutoStart.OnSpawned:
                    tempContent.text = "自动产生:OnSpawned 调用";

                    break;

                case (int)PoolySpawner.AutoStart.Never:
                    tempContent.text = "不自动产生,使用代码产生 ";
                    break;
                }
                QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                QUI.Popup(autoStart, 86);
                QUI.FlexibleSpace();
                if (autoStart.enumValueIndex != (int)PoolySpawner.AutoStart.Never)
                {
                    tempContent.text = "延迟";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.PropertyField(spawnStartDelay, 40);
                    if (spawnStartDelay.floatValue < 0)
                    {
                        spawnStartDelay.floatValue = 0;
                    }
                    tempContent.text = "秒";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                }
                QUI.ResetColors();
            }
            QUI.EndHorizontal();
            QUI.Space(SPACE_4 * infoMessage["AutoStartNever"].show.faded);
            animBoolDespawnWhenFinished.target = autoStart.enumValueIndex == (int)PoolySpawner.AutoStart.OnSpawned;
            if (QUI.BeginFadeGroup(animBoolDespawnWhenFinished.faded))
            {
                QUI.BeginHorizontal(WIDTH_420);
                {
                    QUI.SetGUIBackgroundColor(AccentColorOrange);
                    QUI.Toggle(despawnWhenFinished);
                    QUI.ResetColors();
                    QUI.Label("调用“Despawn” 当完成发射", Style.Text.Normal, WIDTH_420);
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
            }
            QUI.EndFadeGroup();
            QUI.BeginHorizontal(WIDTH_420);
            {
                if (!spawnForever.boolValue)
                {
                    tempContent.text = "产生数量   ";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.SetGUIBackgroundColor(AccentColorOrange);
                    QUI.PropertyField(spawnCount, 90);
                    QUI.ResetColors();
                    if (spawnCount.intValue < 0)
                    {
                        spawnCount.intValue = 0;
                    }
                    QUI.FlexibleSpace();
                }
                QUI.SetGUIBackgroundColor(QColors.OrangeLight.Color);
                QUI.Toggle(spawnForever);
                QUI.ResetColors();
                tempContent.text = "是否一直循环产生";
                QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();

            // 固定间隔 还是随机间隔
            QUI.Space(SPACE_4 * infoMessage["SpawnForever"].show.faded);
            QUI.BeginHorizontal(WIDTH_420);
            {
                QUI.SetGUIBackgroundColor(AccentColorOrange);
                if (spawnAtRandomIntervals.boolValue)
                {
                    QUI.Toggle(spawnAtRandomIntervals);
                    tempContent.text = "随机产生:";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.Space(20);
                    tempContent.text = "Min";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.PropertyField(spawnAtRandomIntervalMinimum, 40);
                    if (spawnAtRandomIntervalMinimum.floatValue < 0)
                    {
                        spawnAtRandomIntervalMinimum.floatValue = 0;
                    }
                    QUI.Label("-", Style.Text.Normal, 8);
                    tempContent.text = "Max";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.PropertyField(spawnAtRandomIntervalMaximum, 40);
                    if (spawnAtRandomIntervalMaximum.floatValue < spawnAtRandomIntervalMinimum.floatValue)
                    {
                        spawnAtRandomIntervalMaximum.floatValue = spawnAtRandomIntervalMinimum.floatValue;
                    }
                    tempContent.text = "秒";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                }
                else
                {
                    tempContent.text = "Spawn Every";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.PropertyField(spawnInterval, 56);
                    tempContent.text = "秒";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.Space(45);
                    QUI.Toggle(spawnAtRandomIntervals);
                    tempContent.text = "使用随机时间间隔";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                }
                QUI.ResetColors();
            }
            QUI.EndHorizontal();

            if (useSpawnerAsSpawnLocation.boolValue ||
                (!useSpawnerAsSpawnLocation.boolValue && poolySpawner.spawnAt == PoolySpawner.SpawnAt.Transform))
            {
                QUI.SetGUIBackgroundColor(AccentColorOrange);
                QUI.BeginHorizontal(WIDTH_420);
                {
                    tempContent.text = "额外的 Spawn 设置";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                }
                QUI.EndHorizontal();

                QUI.BeginHorizontal(WIDTH_420);
                {
                    QUI.Space(SPACE_8);
                    QUI.Toggle(matchTransformRotation);
                    tempContent.text = "匹配 " + (useSpawnerAsSpawnLocation.boolValue ? "Spawner" : "Target") + " Transform Rotation";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                QUI.BeginHorizontal(WIDTH_420);
                {
                    QUI.Space(SPACE_8);
                    QUI.Toggle(matchTransformScale);
                    tempContent.text = "匹配 " + (useSpawnerAsSpawnLocation.boolValue ? "Spawner" : "Target") + " Transform Scale";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                QUI.BeginHorizontal(WIDTH_420);
                {
                    QUI.Space(SPACE_8);
                    QUI.Toggle(reparentUnderTransform);
                    tempContent.text = "重新设置父级 " + (useSpawnerAsSpawnLocation.boolValue ? "Spawner" : "Target") + " Transform";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                QUI.ResetColors();
            }
        }
Exemplo n.º 12
0
        private void DrawLocations()
        {
            QUI.BeginHorizontal(WIDTH_420);
            {
                QUI.SetGUIBackgroundColor(AccentColorBlue);
                QUI.BeginChangeCheck();
                QUI.Toggle(useSpawnerAsSpawnLocation);
                if (QUI.EndChangeCheck())
                {
                    HandleUtility.Repaint();
                    SceneView.RepaintAll();
                    Repaint();
                }
                QUI.ResetColors();
                if (useSpawnerAsSpawnLocation.boolValue && poolySpawner.spawnPositions != null && poolySpawner.spawnPositions.Count > 0)
                {
                    spawnPositions.ClearArray();
                    spawnPositions.InsertArrayElementAtIndex(0);
                    spawnPositions.GetArrayElementAtIndex(0).FindPropertyRelative("spawnPosition").vector3Value = new Vector3(0, 1, 0);

                    serializedObject.ApplyModifiedProperties();
                    HandleUtility.Repaint();
                    SceneView.RepaintAll();
                    Repaint();
                }
                if (useSpawnerAsSpawnLocation.boolValue && poolySpawner.spawnPoints != null && poolySpawner.spawnPoints.Count > 0)
                {
                    spawnPoints.ClearArray();
                    spawnPoints.InsertArrayElementAtIndex(0);

                    serializedObject.ApplyModifiedProperties();
                    HandleUtility.Repaint();
                    SceneView.RepaintAll();
                    Repaint();
                }
                QUI.Label("使用预制体的坐标作为产生点", Style.Text.Normal, 200);
            }
            QUI.EndHorizontal();
            if (useSpawnerAsSpawnLocation.boolValue)
            {
                return;
            }
            else
            {
                QUI.Space(-SPACE_4);
            }
            animBoolShowSpawnLocationsOptions.target = !useSpawnerAsSpawnLocation.boolValue;
            if (QUI.BeginFadeGroup(animBoolShowSpawnLocationsOptions.faded))
            {
                QUI.Space(SPACE_8);
                QUI.BeginVertical();
                {
                    QUI.Space(SPACE_4);
                    QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Blue), WIDTH_420, 20);
                    QUI.Space(-20);
                    QUI.BeginHorizontal(WIDTH_420);
                    {
                        QUI.Space(SPACE_4);
                        QUI.Label("SPAWN AT", Style.Text.Normal, 60);
                        QUI.SetGUIBackgroundColor(AccentColorBlue);
                        QUI.BeginChangeCheck();
                        {
                            QUI.Popup(spawnAt, 70);
                        }
                        if (QUI.EndChangeCheck())
                        {
                            Undo.RecordObject(poolySpawner, "SpawnAt Change");

                            spawnPositions.ClearArray();
                            spawnPositions.InsertArrayElementAtIndex(0);
                            spawnPositions.GetArrayElementAtIndex(0).FindPropertyRelative("spawnPosition").vector3Value = new Vector3(0, 1, 0);

                            spawnPoints.ClearArray();
                            spawnPoints.InsertArrayElementAtIndex(0);
                            serializedObject.ApplyModifiedProperties();
                        }
                        QUI.ResetColors();
                        QUI.FlexibleSpace();
                        if ((poolySpawner.spawnPositions != null && poolySpawner.spawnPositions.Count > 1 && poolySpawner.spawnAt == PoolySpawner.SpawnAt.Position) ||
                            (poolySpawner.spawnPoints != null && poolySpawner.spawnPoints.Count > 1 && poolySpawner.spawnAt == PoolySpawner.SpawnAt.Transform))
                        {
                            QUI.Label("Spawn Type", Style.Text.Normal, 68);
                            QUI.SetGUIBackgroundColor(AccentColorBlue);
                            QUI.Popup(locationSpawnType, 80, SpawnTypes);
                            QUI.ResetColors();
                        }
                        QUI.Space(SPACE_8);
                    }
                    QUI.EndHorizontal();
                    QUI.Space(SPACE_4);
                    switch (poolySpawner.spawnAt)
                    {
                    case PoolySpawner.SpawnAt.Position:
                        if (poolySpawner.spawnPositions == null || poolySpawner.spawnPositions.Count == 0)
                        {
                            poolySpawner.spawnPositions = new List <PoolySpawner.SpawnPosition> {
                                new PoolySpawner.SpawnPosition(new Vector3(0, 1, 0))
                            };
                        }
                        if (poolySpawner.spawnPositions.Count == 1 && poolySpawner.locationSpawnType == PoolySpawner.SpawnType.Random)
                        {
                            poolySpawner.locationSpawnType = PoolySpawner.SpawnType.Sequential;
                        }
                        for (int i = 0; i < poolySpawner.spawnPositions.Count; i++)
                        {
                            QUI.BeginHorizontal(WIDTH_420);
                            {
                                tempContent     = new GUIContent(i.ToString());
                                tempContentSize = QStyles.CalcSize(tempContent, Style.Text.Small);
                                QUI.Label(tempContent.text, Style.Text.Small, tempContentSize.x);
                                QUI.BeginChangeCheck();
                                Vector3 spawnPosition = poolySpawner.spawnPositions[i].spawnPosition;
                                QUI.SetGUIBackgroundColor(AccentColorBlue);
                                spawnPosition = QUI.Vector3(spawnPosition, (WIDTH_420 - SPACE_2 - tempContentSize.x - SPACE_8 - SPACE_16 - SPACE_4) - 240 * animBoolRandomSpawnLocation.faded);
                                QUI.ResetColors();
                                if (QUI.EndChangeCheck())
                                {
                                    Undo.RecordObject(poolySpawner, "Changed Spawn Position " + i);
                                    poolySpawner.spawnPositions[i].spawnPosition = spawnPosition;
                                    QUI.SetDirty(poolySpawner);
                                }
                                if (QUI.ButtonMinus())
                                {
                                    if (poolySpawner.spawnPositions.Count > 1)
                                    {
                                        Undo.RecordObject(poolySpawner, "Removed Spawn Position " + i);
                                        poolySpawner.spawnPositions.RemoveAt(i);
                                    }
                                    else if (poolySpawner.spawnPositions == null || poolySpawner.spawnPositions[0].spawnPosition != new Vector3(poolySpawner.transform.position.x, poolySpawner.transform.position.y + 1, poolySpawner.transform.position.z))
                                    {
                                        Undo.RecordObject(poolySpawner, "Reset Spawn Position");
                                        poolySpawner.spawnPositions = new List <PoolySpawner.SpawnPosition> {
                                            new PoolySpawner.SpawnPosition(new Vector3(poolySpawner.transform.position.x, poolySpawner.transform.position.y + 1, poolySpawner.transform.position.z))
                                        };
                                    }
                                    QUI.SetDirty(poolySpawner);
                                    QUI.ExitGUI();
                                }
                                animBoolRandomSpawnLocation.target = locationSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random;
                                if (poolySpawner.spawnPositions != null && poolySpawner.spawnPositions.Count > 1 && locationSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random)
                                {
                                    QUI.Space(SPACE_2);
                                    QUI.Label("weight", Style.Text.Small, 40 * animBoolRandomSpawnLocation.faded);
                                    QUI.Space(-SPACE_8);
                                    QUI.BeginChangeCheck();
                                    int spawnPositionWeight = poolySpawner.spawnPositions[i].weight;
                                    QUI.SetGUIBackgroundColor(AccentColorBlue);
                                    spawnPositionWeight = EditorGUILayout.IntSlider(spawnPositionWeight, 0, 100);
                                    QUI.ResetColors();
                                    if (QUI.EndChangeCheck())
                                    {
                                        Undo.RecordObject(poolySpawner, "Changed Weight Of Spawn Position " + i);
                                        poolySpawner.spawnPositions[i].weight = spawnPositionWeight;
                                    }
                                }
                                QUI.FlexibleSpace();
                                QUI.Space(SPACE_8);
                            }
                            QUI.EndHorizontal();
                            QUI.Space(1);
                        }
                        QUI.Space(SPACE_2);
                        QUI.BeginHorizontal(WIDTH_420);
                        {
                            QUI.FlexibleSpace();
                            if (QUI.ButtonPlus())
                            {
                                Undo.RecordObject(poolySpawner, "Added Spawn Position");
                                poolySpawner.spawnPositions.Add(new PoolySpawner.SpawnPosition(new Vector3(poolySpawner.transform.position.x, poolySpawner.transform.position.y + 1, poolySpawner.transform.position.z)));
                                QUI.SetDirty(poolySpawner);
                                QUI.ExitGUI();
                            }
                            QUI.Space(3 + 240 * animBoolRandomSpawnLocation.faded);
                        }
                        QUI.EndHorizontal();
                        break;

                    case PoolySpawner.SpawnAt.Transform:
                        if (poolySpawner.spawnPoints == null || poolySpawner.spawnPoints.Count == 0)
                        {
                            poolySpawner.spawnPoints = new List <PoolySpawner.SpawnPoint> {
                                new PoolySpawner.SpawnPoint(null)
                            };
                        }
                        if (poolySpawner.spawnPoints.Count == 1 && poolySpawner.locationSpawnType == PoolySpawner.SpawnType.Random)
                        {
                            poolySpawner.locationSpawnType = PoolySpawner.SpawnType.Sequential;
                        }
                        infoMessage["NoSpawnPoint"].show.target = !poolySpawner.HasSpawnPoints();
                        // 画框框提示
                        DrawInfoMessage("NoSpawnPoint", WIDTH_420 - 20);
                        for (int i = 0; i < poolySpawner.spawnPoints.Count; i++)
                        {
                            QUI.BeginHorizontal(WIDTH_420);
                            {
                                tempContent     = new GUIContent(i.ToString());
                                tempContentSize = QStyles.CalcSize(tempContent, Style.Text.Small);
                                QUI.Label(tempContent.text, Style.Text.Small, tempContentSize.x);
                                QUI.BeginChangeCheck();
                                Transform spawnPoint = poolySpawner.spawnPoints[i].spawnPoint;
                                QUI.SetGUIBackgroundColor(AccentColorBlue);
                                spawnPoint = (Transform)QUI.ObjectField(spawnPoint, typeof(Transform), true, (WIDTH_420 - SPACE_2 - tempContentSize.x - SPACE_8 - SPACE_16 - SPACE_4) - 240 * animBoolRandomSpawnLocation.faded);
                                QUI.ResetColors();
                                if (QUI.IsPersistent(spawnPoint))
                                {
                                    spawnPoint = poolySpawner.spawnPoints[i].spawnPoint;
                                }
                                if (QUI.EndChangeCheck())
                                {
                                    Undo.RecordObject(poolySpawner, "Changed Reference For Spawn Point Slot " + i);
                                    poolySpawner.spawnPoints[i].spawnPoint = spawnPoint;
                                    QUI.SetDirty(poolySpawner);
                                }
                                QUI.BeginVertical(16);
                                {
                                    QUI.Space(SPACE_2);
                                    if (QUI.ButtonMinus())
                                    {
                                        if (poolySpawner.spawnPoints.Count > 1)
                                        {
                                            Undo.RecordObject(poolySpawner, "Removed Spawn Point Slot " + i);
                                            poolySpawner.spawnPoints.RemoveAt(i);
                                        }
                                        else if (poolySpawner.spawnPoints == null || poolySpawner.spawnPoints[0].spawnPoint != null)
                                        {
                                            Undo.RecordObject(poolySpawner, "Reset Spawn Point Slot");
                                            poolySpawner.spawnPoints = new List <PoolySpawner.SpawnPoint> {
                                                new PoolySpawner.SpawnPoint(null)
                                            };
                                        }
                                        QUI.SetDirty(poolySpawner);
                                        QUI.ExitGUI();
                                    }
                                }
                                QUI.EndVertical();
                                animBoolRandomSpawnLocation.target = locationSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random;
                                if (poolySpawner.spawnPoints != null && poolySpawner.spawnPoints.Count > 1 && locationSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random)
                                {
                                    QUI.Space(SPACE_2);
                                    QUI.Label("weight", Style.Text.Small, 40);
                                    QUI.Space(-SPACE_8);
                                    QUI.BeginChangeCheck();
                                    int spawnPointWeight = poolySpawner.spawnPoints[i].weight;
                                    QUI.SetGUIBackgroundColor(AccentColorBlue);
                                    spawnPointWeight = EditorGUILayout.IntSlider(spawnPointWeight, 0, 100);
                                    QUI.ResetColors();
                                    if (QUI.EndChangeCheck())
                                    {
                                        Undo.RecordObject(poolySpawner, "Changed Weight Of Spawn Point " + i);
                                        poolySpawner.spawnPoints[i].weight = spawnPointWeight;
                                    }
                                }
                                QUI.FlexibleSpace();
                                QUI.Space(SPACE_8);
                            }
                            QUI.EndHorizontal();
                            QUI.Space(1);
                        }
                        QUI.Space(SPACE_2);
                        QUI.BeginHorizontal(WIDTH_420);
                        {
                            QUI.FlexibleSpace();
                            if (QUI.ButtonPlus())
                            {
                                Undo.RecordObject(poolySpawner, "Added Spawn Point Slot");
                                poolySpawner.spawnPoints.Add(new PoolySpawner.SpawnPoint(null));
                                QUI.SetDirty(poolySpawner);
                                QUI.ExitGUI();
                            }
                            QUI.Space(3 + 240 * animBoolRandomSpawnLocation.faded);
                        }
                        QUI.EndHorizontal();
                        break;
                    }
                }
                QUI.EndVertical();
            }
            QUI.EndFadeGroup();
        }
Exemplo n.º 13
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();
 }
Exemplo n.º 14
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);
 }
Exemplo n.º 15
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);
 }
Exemplo n.º 16
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);
 }
Exemplo n.º 17
0
        private void DrawOnSpawnEvents()
        {
            QUI.Space(SPACE_8);
            QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Purple), WIDTH_420, 40);
            QUI.Space(-40);
            QUI.BeginHorizontal(WIDTH_420);
            {
                QUI.Space(SPACE_4);
                QUI.Label("回调事件", Style.Text.Title, 240, HEIGHT_16);
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
            QUI.BeginHorizontal(WIDTH_420);
            {
                QUI.Space(SPACE_8 + 3);
                QUI.Toggle(showOnSpawnStarted);
                QUI.Space(-SPACE_2);
                tempContent.text = "Started";
                QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x);


                QUI.Space(SPACE_8);

                QUI.Toggle(showOnSpawnStopped);
                QUI.Space(-SPACE_2);
                tempContent.text = "Stopped";
                QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x);

                QUI.Space(SPACE_8);

                QUI.Toggle(showOnSpawnPaused);
                QUI.Space(-SPACE_2);
                tempContent.text = "Paused";
                QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x);

                QUI.Space(SPACE_8);

                QUI.Toggle(showOnSpawnResumed);
                QUI.Space(-SPACE_2);
                tempContent.text = "Resumed";
                QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x);

                QUI.Space(SPACE_8);

                QUI.Toggle(showOnSpawnFinished);
                QUI.Space(-SPACE_2);
                tempContent.text = "Finished";
                QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x);

                QUI.Space(SPACE_8);

                QUI.ResetColors();
            }
            QUI.EndHorizontal();
            if (showOnSpawnStarted.boolValue || showOnSpawnPaused.boolValue || showOnSpawnFinished.boolValue)
            {
                QUI.Space(SPACE_4);
            }
            QUI.SetGUIBackgroundColor(AccentColorPurple);
            animBoolShowOnSpawnStarted.target = showOnSpawnStarted.boolValue;
            if (QUI.BeginFadeGroup(animBoolShowOnSpawnStarted.faded))
            {
                QUI.PropertyField(OnSpawnStarted, new GUIContent("OnSpawnStarted"), WIDTH_420 - 5);
            }
            QUI.EndFadeGroup();
            animBoolShowOnSpawnStopped.target = showOnSpawnStopped.boolValue;
            if (QUI.BeginFadeGroup(animBoolShowOnSpawnStopped.faded))
            {
                QUI.PropertyField(OnSpawnStopped, new GUIContent("OnSpawnStopped"), WIDTH_420 - 5);
            }
            QUI.EndFadeGroup();
            animBoolShowOnSpawnPaused.target = showOnSpawnPaused.boolValue;
            if (QUI.BeginFadeGroup(animBoolShowOnSpawnPaused.faded))
            {
                QUI.PropertyField(OnSpawnPaused, new GUIContent("OnSpawnPaused"), WIDTH_420 - 5);
            }
            QUI.EndFadeGroup();
            animBoolShowOnSpawnResumed.target = showOnSpawnResumed.boolValue;
            if (QUI.BeginFadeGroup(animBoolShowOnSpawnResumed.faded))
            {
                QUI.PropertyField(OnSpawnResumed, new GUIContent("OnSpawnResumed"), WIDTH_420 - 5);
            }
            QUI.EndFadeGroup();
            animBoolShowOnSpawnFinished.target = showOnSpawnFinished.boolValue;
            if (QUI.BeginFadeGroup(animBoolShowOnSpawnFinished.faded))
            {
                QUI.PropertyField(OnSpawnFinished, new GUIContent("OnSpawnfinished"), WIDTH_420 - 5);
            }
            QUI.EndFadeGroup();
            QUI.ResetColors();
        }
Exemplo n.º 18
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();
 }
Exemplo n.º 19
0
        void DrawPageAbout()
        {
            DrawPageHeader("About", QColors.Blue, "", QUI.IsProSkin ? QColors.UnityLight : QColors.UnityMild, DUIResources.pageIconAbout);
            QUI.Space(SPACE_16);
            QUI.DrawTexture(DUIResources.aboutVersion.texture, 400, 200);
            if (WindowSettings.CurrentPageContentWidth > WindowSettings.pageWidth - 230)
            {
                return;
            }
            QUI.Space(-56);
            QUI.BeginHorizontal(WindowSettings.CurrentPageContentWidth);
            {
                QUI.FlexibleSpace();
                QLabel.text  = DUIVersion.Instance.version;
                QLabel.style = Style.Text.Subtitle;
                QUI.SetGUIContentColor(QUI.AccentColorBlue);
                if (editVersion.target)
                {
                    newVersion = QUI.TextField(newVersion, 104);
                }
                else
                {
                    QUI.Label(QLabel);
                }
                QUI.ResetColors();
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
            QUI.Space(38);

#if dUI_SOURCE
            QUI.BeginHorizontal(WindowSettings.CurrentPageContentWidth);
            {
                QUI.FlexibleSpace();
                if (QUI.GhostButton(editVersion.target ? "Update Version" : "Edit Version", editVersion.target ? QColors.Color.Green : QColors.Color.Gray, 100))
                {
                    editVersion.target = !editVersion.target;
                    if (editVersion.target)
                    {
                        newVersion = DUIVersion.Instance.version;
                    }
                    else
                    {
                        DUIVersion.Instance.version = newVersion;
                        QUI.SetDirty(DUIVersion.Instance);
                        AssetDatabase.SaveAssets();
                    }
                }

                if (editVersion.faded > 0.2f)
                {
                    if (QUI.GhostButton("Cancel", QColors.Color.Red, 100))
                    {
                        editVersion.target = false;
                        newVersion         = "";
                    }
                }
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
#endif
            QUI.Space(SPACE_8);

            DrawNewsArticle("About DoozyUI",
                            "DoozyUI is a complete UI management system for Unity. " +
                            "It manipulates native Unity components and takes full advantage of their intended usage. " +
                            "This assures maximum compatibility with uGUI, best performance and makes the entire system have a predictable behaviour. " +
                            "Also, by working only with native components, the system will be compaible with any ohter asset that uses uGUI correctly. " +
                            "\n\n" +
                            "Easy to use and understand, given the user has some basic knowledge of how Unity's native UI solution (uGUI) works, DoozyUI has flexible components that can be configured in a lot of ways. " +
                            "Functionality and design go hand in hand in order to offer a pleasant user experience (UX) while using the system." +
                            "\n\n" +
                            "Starting with version 2.8, DoozyUI is officialy VR READY, being capable of handling with ease multiple Canvases set to World Space render mode. " +
                            "The system has been redesigned, from the core up, in order to accomodate a higher degree of flexibility that was needed in order for it to handle a lot of different use case scenarios." +
                            "\n\n" +
                            "The asset 'DoozyUI' has been released on the Unity Asset Store under the 'Doozy Entertainment' brand, owned by the Marlink Trading SRL company.",
                            WindowSettings.CurrentPageContentWidth);
        }
Exemplo n.º 20
0
        void DrawDefineSymbolsSymbolsPreset(float width)
        {
            QUI.BeginVertical(width);
            {
                QUI.GhostTitle("SYMBOLS PRESET", QColors.Color.Green, width);
                QUI.Space(SPACE_4);
                QUI.BeginHorizontal(width);
                {
                    QUI.Space(SPACE_8);
                    if (QUI.GhostButton("<<<   Copy to Build Target Group", QColors.Color.Green, width - SPACE_8, 24))
                    {
                        List <string> tempList = presetSymbols;
                        tempList = QUtils.CleanList(tempList);
                        presetSymbols.Clear();
                        presetSymbols.AddRange(tempList);
                        symbols.Clear();
                        symbols.AddRange(presetSymbols);
                        QUtils.SetScriptingDefineSymbolsForGroup(selectedBuildTargetGroup, symbols);
                        if (presetSymbols.Count == 0)
                        {
                            presetSymbols.Add("");
                        }
                    }
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                QUI.Space(SPACE_4);
                if (defineSymbolsNewPreset.value) //NEW PRESET
                {
                    QUI.BeginHorizontal(width);
                    {
                        QUI.Space(SPACE_8);
                        QUI.Label("Enter a new preset name...", Style.Text.Small, width - SPACE_8);
                    }
                    QUI.EndHorizontal();

                    QUI.Space(-SPACE_4);

                    QUI.BeginHorizontal(width);
                    {
                        QUI.Space(SPACE_8);
                        GUI.SetNextControlName("newPresetName");
                        newPresetName = QUI.TextField(newPresetName, EditorGUIUtility.isProSkin ? QColors.Green.Color : QColors.GreenLight.Color, (width - SPACE_8 - 16 - 2 - 16) * defineSymbolsNewPreset.faded);

                        //if the user hits Enter while either the key or value fields were being edited
                        bool keyboardReturnPressed = Event.current.isKey &&
                                                     Event.current.keyCode == KeyCode.Return &&
                                                     Event.current.type == EventType.KeyUp &&
                                                     (GUI.GetNameOfFocusedControl() == "newPresetName");

                        QUI.Space(-2);
                        if (QUI.ButtonOk() || keyboardReturnPressed)
                        {
                            newPresetName = newPresetName.Trim();
                            if (newPresetName.Equals(DEFAULT_PRESET_NAME))
                            {
                                QUI.DisplayDialog("Enter a new preset name", "You are trying to save a preset with the defaut preset name '" + DEFAULT_PRESET_NAME + "'. Please enter another preset name.", "Ok");
                            }
                            else if (string.IsNullOrEmpty(newPresetName))
                            {
                                QUI.DisplayDialog("Enter a new preset name", "You are trying to save a preset with no name. Please enter a name.", "Ok");
                            }
                            else if (Q.GetResource <DefineSymbols.DefineSymbolsPreset>(EZT.RESOURCES_PATH_DEFINE_SYMBOLS_PRESETS, newPresetName) != null)
                            {
                                if (QUI.DisplayDialog("Overwrite preset?", "There is a preset with the same name '" + newPresetName + "' in the presets list. Are you sure you want to overwrite it?", "Overwrite", "Cancel"))
                                {
                                    AssetDatabase.MoveAssetToTrash(EZT.RELATIVE_PATH_DEFINE_SYMBOLS_PRESETS + newPresetName + ".asset");
                                    SavePreset(presetSymbols, newPresetName);
                                    selectedPresetName = newPresetName;
                                    RefreshPresetNames();
                                    defineSymbolsNewPreset.target = false;
                                    newPresetName = "";
                                }
                            }
                            else
                            {
                                SavePreset(presetSymbols, newPresetName);
                                selectedPresetName = newPresetName;
                                RefreshPresetNames();
                                defineSymbolsNewPreset.target = false;
                                newPresetName = "";
                            }
                        }
                        QUI.Space(2);

                        //if the user hits Escape while either the key or value fields were being edited
                        bool keyboardEscapePressed = Event.current.isKey &&
                                                     Event.current.keyCode == KeyCode.Escape &&
                                                     Event.current.type == EventType.KeyUp &&
                                                     (GUI.GetNameOfFocusedControl() == "newPresetName");

                        if (QUI.ButtonCancel() || keyboardEscapePressed)
                        {
                            defineSymbolsNewPreset.target = false;
                            newPresetName = "";
                        }
                        QUI.FlexibleSpace();
                    }
                    QUI.EndHorizontal();
                    QUI.Space(5);
                }
                else //NORMAL VIEW
                {
                    QUI.BeginHorizontal(width);
                    {
                        QUI.Space(SPACE_8);
                        QUI.BeginChangeCheck();
                        QUI.SetGUIBackgroundColor(EditorGUIUtility.isProSkin ? QColors.Green.Color : QColors.GreenLight.Color);
                        selectedPresetIndex = EditorGUILayout.Popup(selectedPresetIndex, presets, GUILayout.Width(width - SPACE_8));
                        QUI.ResetColors();
                        if (QUI.EndChangeCheck())
                        {
                            Undo.RecordObject(this, "Select Preset");
                            selectedPresetName = presets[selectedPresetIndex];
                        }
                        QUI.FlexibleSpace();
                    }
                    QUI.EndHorizontal();

                    QUI.Space(SPACE_2);

                    if (loadedPresetName.Equals(selectedPresetName) || selectedPresetName.Equals(DEFAULT_PRESET_NAME))
                    {
                        QUI.BeginHorizontal(width);
                        {
                            QUI.Space(SPACE_8);
                            if (selectedPresetName.Equals(DEFAULT_PRESET_NAME))
                            {
                                if (QUI.GhostButton("Create a New Preset with current symbols", QColors.Color.Green, width - SPACE_8))
                                {
                                    defineSymbolsNewPreset.target = true;
                                    newPresetName = "";
                                }
                            }
                            else
                            {
                                if (QUI.GhostButton("NEW", QColors.Color.Green, ((width - SPACE_8) / 4) - SPACE_2))
                                {
                                    defineSymbolsNewPreset.target = true;
                                    newPresetName = "";
                                }
                                QUI.Space(SPACE_2);
                                if (QUI.GhostButton("RELOAD", QColors.Color.Green, ((width - SPACE_8) / 4) - SPACE_2))
                                {
                                    LoadPreset(selectedPresetName);
                                }
                                QUI.Space(SPACE_2);
                                if (QUI.GhostButton("SAVE", QColors.Color.Green, ((width - SPACE_8) / 4) - SPACE_2))
                                {
                                    SavePreset(presetSymbols, selectedPresetName);
                                }
                                QUI.Space(SPACE_2);
                                if (QUI.GhostButton("DELETE", QColors.Color.Red, ((width - SPACE_8) / 4) - SPACE_2))
                                {
                                    if (QUI.DisplayDialog("Delete preset?", "Are you sure you want to delete the '" + selectedPresetName + "' preset?", "Yes", "No"))
                                    {
                                        DeletePreset(selectedPresetName);
                                    }
                                }
                            }
                            QUI.FlexibleSpace();
                        }
                        QUI.EndHorizontal();
                    }
                    else
                    {
                        QUI.BeginHorizontal(width);
                        {
                            QUI.Space(SPACE_8);
                            if (QUI.GhostButton("Load Preset", QColors.Color.Green, width - SPACE_8))
                            {
                                LoadPreset(selectedPresetName);
                            }
                            QUI.FlexibleSpace();
                        }
                        QUI.EndHorizontal();
                    }
                }

                QUI.Space(-SPACE_8 - SPACE_4);
                DrawSelectedPresetsList(width);
            }
            QUI.EndVertical();
        }
        void DrawNewUISoundAndSearch(float width)
        {
            QUI.BeginHorizontal(width);
            {
                #region New UISound
                if (SearchPatternAnimBool.faded < 0.2f)
                {
                    if (QUI.GhostButton("New UISound", QColors.Color.Green, 100 * (1 - SearchPatternAnimBool.faded), 20, NewUISoundAnimBool.value) ||
                        DetectKeyCombo_Alt_N())
                    {
                        NewUISoundAnimBool.target = !NewUISoundAnimBool.target;
                        if (NewUISoundAnimBool.target)
                        {
                            NewUISoundName = "";
                            SearchPatternAnimBool.target = false;
                        }
                    }
                }

                if (NewUISoundAnimBool.target)
                {
                    SearchPatternAnimBool.target = false;
                    QUI.SetGUIBackgroundColor(QColors.GreenLight.Color);
                    QUI.SetNextControlName("NewUISoundName");
                    NewUISoundName = EditorGUILayout.TextField(NewUISoundName, GUILayout.Width((width - 149) * NewUISoundAnimBool.faded));
                    QUI.ResetColors();

                    if (!NewUISoundAnimBool.value && Event.current.type == EventType.Layout) //if NewUISoundAnimBool.target is true and NewUISoundAnimBool.value is false -> in transition -> select the text in the control
                    {
                        QUI.FocusControl("NewUISoundName");
                        QUI.FocusTextInControl("NewUISoundName");
                    }

                    if (QUI.ButtonOk() ||
                        (DetectKey_Return() && QUI.GetNameOfFocusedControl().Equals("NewUISoundName")))
                    {
                        if (NewUISoundName.IsNullOrEmpty())
                        {
                            EditorUtility.DisplayDialog("Info", "Cannot create an unnamed UISound. Try again.", "Ok");
                        }
                        else
                        {
                            if (DUIData.Instance.DatabaseUISounds.Contains(NewUISoundName))
                            {
                                EditorUtility.DisplayDialog("Info", "A UISound named '" + NewUISoundName + "' already exists in the database. Try again.", "Ok");
                            }
                            else
                            {
                                DUIData.Instance.DatabaseUISounds.CreateUISound(NewUISoundName, selectedUISoundsDatabaseFilter, null);
                                NewUISoundAnimBool.target = false;
                            }
                        }
                    }
                    QUI.Space(1);
                    if (QUI.ButtonCancel() ||
                        QUI.DetectKeyDown(Event.current, KeyCode.Escape))
                    {
                        NewUISoundName            = string.Empty;
                        NewUISoundAnimBool.target = false;
                    }
                }
                #endregion
                QUI.FlexibleSpace();
                #region Search
                if (SearchPatternAnimBool.value)
                {
                    NewUISoundAnimBool.target = false;
                    QUI.SetGUIBackgroundColor(QColors.OrangeLight.Color);
                    QUI.SetNextControlName("SearchPattern");
                    SearchPattern = EditorGUILayout.TextField(SearchPattern, GUILayout.Width((width - 104) * SearchPatternAnimBool.faded));
                    QUI.ResetColors();

                    if (SearchPatternAnimBool.target && Event.current.type == EventType.Layout) //if SearchPatternAnimBool.target is true and SearchPatternAnimBool.value is false -> in transition -> select the text in the control
                    {
                        QUI.FocusControl("SearchPattern");
                        QUI.FocusTextInControl("SearchPattern");
                    }
                }


                if (NewUISoundAnimBool.faded < 0.2f)
                {
                    if (QUI.GhostButton(SearchPatternAnimBool.value ? "Clear Search" : "Search", QColors.Color.Orange, 100 * (1 - NewUISoundAnimBool.faded), 20, SearchPatternAnimBool.value) ||
                        DetectKeyCombo_Alt_S() || //Toggle Search
                        (DetectKey_Escape() && SearchPatternAnimBool.target))   //Clear Search
                    {
                        SearchPatternAnimBool.target = !SearchPatternAnimBool.target;
                        if (SearchPatternAnimBool.target)
                        {
                            SearchPattern             = string.Empty;
                            NewUISoundAnimBool.target = false;
                        }
                    }
                }
                #endregion
            }
            QUI.EndHorizontal();
        }
Exemplo n.º 22
0
 private void DrawPrefabs()
 {
     // 先画个盒子,再提上去写文字
     QUI.Space(SPACE_8);
     QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Orange), WIDTH_420, 20);
     QUI.Space(-20);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Space(SPACE_4);
         QUI.Label("PREFAB" + ((poolySpawner.spawnPrefabs != null && poolySpawner.spawnPrefabs.Count > 1) ? "S" : "") + " TO SPAWN(拖预制体进来)", Style.Text.Normal, 200, HEIGHT_16);
         QUI.Space(SPACE_4);
         QUI.FlexibleSpace();
         if (poolySpawner.spawnPrefabs != null && poolySpawner.spawnPrefabs.Count > 1)
         {
             QUI.Label("Spawn Type", Style.Text.Normal, 68);
             QUI.SetGUIBackgroundColor(AccentColorOrange);
             QUI.Popup(prefabSpawnType, 80, SpawnTypes);
             QUI.ResetColors();
         }
         QUI.Space(SPACE_8);
     }
     QUI.EndHorizontal();
     QUI.Space(SPACE_4);
     if (poolySpawner.spawnPrefabs == null || poolySpawner.spawnPrefabs.Count == 0)
     {
         poolySpawner.spawnPrefabs = new List <PoolySpawner.SpawnPrefab> {
             new PoolySpawner.SpawnPrefab(null)
         };
     }
     if (poolySpawner.spawnPrefabs.Count == 1 && poolySpawner.prefabSpawnType == PoolySpawner.SpawnType.Random)
     {
         poolySpawner.prefabSpawnType = PoolySpawner.SpawnType.Sequential;
     }
     infoMessage["NoPrefabs"].show.target = !poolySpawner.HasPrefabs();
     // 画框框提示
     DrawInfoMessage("NoPrefabs", WIDTH_420 - 20);
     for (int i = 0; i < poolySpawner.spawnPrefabs.Count; i++)
     {
         QUI.Space(SPACE_2);
         QUI.BeginHorizontal(WIDTH_420);
         {
             tempContent     = new GUIContent(i.ToString());
             tempContentSize = QStyles.CalcSize(tempContent, Style.Text.Small);
             QUI.Label(tempContent.text, Style.Text.Small, tempContentSize.x);
             QUI.BeginChangeCheck();
             Transform prefabObject = poolySpawner.spawnPrefabs[i].prefab;
             QUI.SetGUIBackgroundColor(AccentColorOrange);
             prefabObject = (Transform)QUI.ObjectField(prefabObject, typeof(Transform), false, (WIDTH_420 - SPACE_2 - tempContentSize.x - SPACE_8 - SPACE_16) - 240 * animBoolSpawnRandomPrefab.faded);
             QUI.ResetColors();
             if (QUI.EndChangeCheck())
             {
                 Undo.RecordObject(poolySpawner, "Changed Value For Prefab Slot " + i);
                 poolySpawner.spawnPrefabs[i].prefab = prefabObject;
             }
             if (QUI.ButtonMinus())
             {
                 if (poolySpawner.spawnPrefabs.Count > 1)
                 {
                     Undo.RecordObject(poolySpawner, "Removed Prefab Slot " + i);
                     poolySpawner.spawnPrefabs.RemoveAt(i);
                 }
                 else if (poolySpawner.spawnPrefabs == null || poolySpawner.spawnPrefabs[0].prefab != null)
                 {
                     Undo.RecordObject(poolySpawner, "Reset Prefab Slot");
                     poolySpawner.spawnPrefabs = new List <PoolySpawner.SpawnPrefab> {
                         new PoolySpawner.SpawnPrefab(null)
                     };
                 }
                 QUI.SetDirty(poolySpawner);
                 QUI.ExitGUI();
             }
             animBoolSpawnRandomPrefab.target = prefabSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random;
             if (poolySpawner.spawnPrefabs != null && poolySpawner.spawnPrefabs.Count > 1 && prefabSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random)
             {
                 QUI.Space(SPACE_2);
                 QUI.Label("weight", Style.Text.Small, 50 * animBoolSpawnRandomPrefab.faded);
                 QUI.Space(-SPACE_8);
                 QUI.BeginChangeCheck();
                 int spawnPrefabWeight = poolySpawner.spawnPrefabs[i].weight;
                 QUI.SetGUIBackgroundColor(AccentColorOrange);
                 spawnPrefabWeight = EditorGUILayout.IntSlider(spawnPrefabWeight, 0, 100);
                 QUI.ResetColors();
                 if (QUI.EndChangeCheck())
                 {
                     Undo.RecordObject(poolySpawner, "Changed Weight Of Prefab " + i);
                     poolySpawner.spawnPrefabs[i].weight = spawnPrefabWeight;
                 }
             }
             QUI.FlexibleSpace();
         }
         QUI.EndHorizontal();
     }
     QUI.Space(SPACE_2);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.FlexibleSpace();
         if (QUI.ButtonPlus())
         {
             Undo.RecordObject(poolySpawner, "Added New Prefab Slot");
             poolySpawner.spawnPrefabs.Add(new PoolySpawner.SpawnPrefab(null));
             QUI.SetDirty(poolySpawner);
             QUI.ExitGUI();
         }
         QUI.Space(3 + 240 * animBoolSpawnRandomPrefab.faded);
     }
     QUI.EndHorizontal();
 }
Exemplo n.º 23
0
        void DrawNews(float width)
        {
            if (News == null)
            {
                return;
            }

            QLabel.text  = !showAddNews.target ? "" : "New Article";
            QLabel.style = Style.Text.Title;
            QUI.BeginHorizontal(width, 16);
            {
                if (showAddNews.target)
                {
                    QUI.SetGUIColor(QUI.AccentColorBlue);
                }
                QUI.Label(QLabel);
                QUI.ResetColors();
#if dUI_SOURCE
                QUI.Space(width - QLabel.x - 104 - 100 * showAddNews.faded);
                if (QUI.GhostButton(showAddNews.target ? "Save" : "Add News", showAddNews.target ? QColors.Color.Green : QColors.Color.Gray, 100, showAddNews.target))
                {
                    showAddNews.target = !showAddNews.target;
                    if (!showAddNews.target)
                    {
                        News.articles.Add(new NewsArticleData(newNewsArticle));
                        QUI.SetDirty(News);
                        AssetDatabase.SaveAssets();
                    }
                    newNewsArticle.Reset();
                }
                if (showAddNews.faded > 0.2f)
                {
                    if (QUI.GhostButton("Cancel", QColors.Color.Red, 100 * showAddNews.faded, showAddNews.target))
                    {
                        showAddNews.target = false;
                        newNewsArticle.Reset();
                    }
                }
#else
                QUI.FlexibleSpace();
#endif
            }
            QUI.EndHorizontal();
            QUI.Space(SPACE_2);
            if (QUI.BeginFadeGroup(showAddNews.faded))
            {
                QUI.BeginVertical(width);
                {
                    QUI.Space(SPACE_4 * showAddNews.faded);
                    QUI.DrawLine(QColors.Color.Blue, width);
                    QUI.Space(SPACE_4 * showAddNews.faded);
                    QUI.SetGUIBackgroundColor(QUI.AccentColorBlue);
                    QUI.BeginHorizontal(width);
                    {
                        QLabel.text  = "Title";
                        QLabel.style = Style.Text.Normal;
                        QUI.Label(QLabel);
                        newNewsArticle.title = QUI.TextField(newNewsArticle.title, width - QLabel.x - 8);
                    }
                    QUI.EndHorizontal();
                    QUI.Space(SPACE_2 * showAddNews.faded);
                    QUI.BeginHorizontal(width);
                    {
                        QLabel.text  = "Content";
                        QLabel.style = Style.Text.Normal;
                        QUI.Label(QLabel);
                        newNewsArticle.content = EditorGUILayout.TextArea(newNewsArticle.content, GUILayout.Width(width - QLabel.x - 8));
                    }
                    QUI.EndHorizontal();
                    QUI.ResetColors();
                    QUI.Space(SPACE_4 * showAddNews.faded);
                    QUI.DrawLine(QColors.Color.Blue, width);
                    QUI.Space(SPACE_16 * showAddNews.faded);
                }
                QUI.EndVertical();
            }
            QUI.EndFadeGroup();

            if (News.articles.Count == 0)
            {
                //QLabel.text = "There are no news...";
                //QLabel.style = Style.Text.Help;
                //QUI.Label(QLabel);
                return;
            }

            QUI.Space(SPACE_2);

            for (int i = 0; i < News.articles.Count; i++)
            {
#if dUI_SOURCE
                DrawNewsArticle(News.articles, i, News, true, width);
#else
                DrawNewsArticle(News.articles, i, News, false, width);
#endif
                QUI.Space(9 + 4);
            }
        }
 void DrawEvents(float width)
 {
     if (QUI.GhostBar("Unity Events", IsAnyEventUsed ? QColors.Color.Blue : QColors.Color.Gray, showEvents, width, MiniBarHeight))
     {
         showEvents.target = !showEvents.target;
     }
     QUI.BeginHorizontal(width);
     {
         QUI.Space(SPACE_8 * showEvents.faded);
         if (QUI.BeginFadeGroup(showEvents.faded))
         {
             QUI.BeginVertical(width - SPACE_16);
             {
                 QUI.Space(SPACE_2 * showEvents.faded);
                 QUI.SetGUIBackgroundColor(IsUsingOnDrawerOpened ? QUI.AccentColorBlue : QUI.AccentColorGray);
                 QUI.PropertyField(OnDrawerOpened, new GUIContent()
                 {
                     text = "OnDrawerOpened"
                 }, width - 8);
                 QUI.ResetColors();
                 QUI.Space(SPACE_2 * showEvents.faded);
                 QUI.SetGUIBackgroundColor(IsUsingOnDrawerClosed ? QUI.AccentColorBlue : QUI.AccentColorGray);
                 QUI.PropertyField(OnDrawerClosed, new GUIContent()
                 {
                     text = "OnDrawerClosed"
                 }, width - 8);
                 QUI.ResetColors();
                 QUI.Space(SPACE_4 * showEvents.faded);
                 QUI.SetGUIBackgroundColor(IsUsingOnDrawerIsOpening ? QUI.AccentColorBlue : QUI.AccentColorGray);
                 QUI.PropertyField(OnDrawerIsOpening, new GUIContent()
                 {
                     text = "OnDrawerIsOpening"
                 }, width - 8);
                 QUI.ResetColors();
                 QUI.Space(SPACE_2 * showEvents.faded);
                 QUI.SetGUIBackgroundColor(IsUsingOnDrawerIsClosing ? QUI.AccentColorBlue : QUI.AccentColorGray);
                 QUI.PropertyField(OnDrawerIsClosing, new GUIContent()
                 {
                     text = "OnDrawerIsClosing"
                 }, width - 8);
                 QUI.ResetColors();
                 QUI.Space(SPACE_4 * showEvents.faded);
                 QUI.SetGUIBackgroundColor(IsUsingOnDrawerBeginDrag ? QUI.AccentColorBlue : QUI.AccentColorGray);
                 QUI.PropertyField(OnDrawerBeginDrag, new GUIContent()
                 {
                     text = "OnDrawerBeginDrag"
                 }, width - 8);
                 QUI.ResetColors();
                 QUI.Space(SPACE_2 * showEvents.faded);
                 QUI.SetGUIBackgroundColor(IsUsingOnDrawerEndDrag ? QUI.AccentColorBlue : QUI.AccentColorGray);
                 QUI.PropertyField(OnDrawerEndDrag, new GUIContent()
                 {
                     text = "OnDrawerEndDrag"
                 }, width - 8);
                 QUI.ResetColors();
                 QUI.Space(SPACE_8 * showEvents.faded);
             }
             QUI.EndVertical();
             QUI.ResetColors();
         }
         QUI.EndFadeGroup();
     }
     QUI.EndHorizontal();
 }
Exemplo n.º 25
0
        void InitDefineSymbols()
        {
            defineSymbolsNewPreset = new AnimBool(false, Repaint);

            selectedBuildTargetGroup           = QUtils.GetActiveBuildTargetGroup();
            previouslySelectedBuildTargetGroup = selectedBuildTargetGroup;

            selectedBuildTargetGroupIsTheActivePlatform = new AnimBool(selectedBuildTargetGroup == QUtils.GetActiveBuildTargetGroup(), Repaint);

            if (symbols == null)
            {
                symbols = new List <string>();
            }
            else
            {
                symbols.Clear();
            }
            symbols = QUtils.GetScriptingDefineSymbolsForGroup(selectedBuildTargetGroup);
            if (presetSymbols == null)
            {
                presetSymbols = new List <string>();
            }
            else
            {
                presetSymbols.Clear();
            }
            presetSymbols.AddRange(symbols);

            presetSymbolsReordableList = new ReorderableList(presetSymbols, typeof(string), true, false, false, false)
            {
                showDefaultBackground         = false,
                drawElementBackgroundCallback = (rect, index, active, focused) => { }
            };
            presetSymbolsReordableList.drawElementCallback = (rect, index, active, focused) =>
            {
                if (index == presetSymbolsReordableList.list.Count)
                {
                    return;
                }
                float width          = WindowSettings.CurrentPageContentWidth / 2;
                int   dragBumbWidth  = 0;
                int   buttonWidth    = 16;
                int   textFieldWidth = (int)width - 20 - buttonWidth - 2 - buttonWidth;
                rect.x += dragBumbWidth;
                QUI.SetGUIBackgroundColor(EditorGUIUtility.isProSkin ? QColors.Green.Color : QColors.GreenLight.Color);
                presetSymbolsReordableList.list[index] = EditorGUI.TextField(new Rect(rect.x, rect.y, textFieldWidth, EditorGUIUtility.singleLineHeight), (string)presetSymbolsReordableList.list[index]);
                QUI.ResetColors();
                rect.x += textFieldWidth;
                rect.x += 2;
                rect.y -= 1;
                if (QUI.ButtonMinus(rect))
                {
                    if (index == 0 && presetSymbolsReordableList.list.Count == 1) //is this the last list entry?
                    {
                        presetSymbolsReordableList.list[index] = "";              //yes --> add an empty entry
                    }
                    else
                    {
                        presetSymbolsReordableList.list.Remove(presetSymbolsReordableList.list[index]); //no --> remove the entry
                    }
                }
                rect.x += buttonWidth;
                rect.x += 2;
                if (QUI.ButtonPlus(rect))
                {
                    presetSymbolsReordableList.list.Insert(index, ""); //add a new empty entry
                }
            };

            selectedPresetName = DEFAULT_PRESET_NAME;
            loadedPresetName   = selectedPresetName;
            RefreshPresetNames();
        }