예제 #1
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);
 }
예제 #2
0
        void DrawTrigger2D()                               // 2D触碰后消失
        {
            QUI.SetGUIBackgroundColor(accentColorPurple);
            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, 30);
                }
                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, 50);
                    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, 130);

                QUI.Space(3);
                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, 46);
                QUI.Space(3);
                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, 40);
                QUI.Space(3);
                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("仅和 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();
        }
예제 #3
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);
 }
예제 #4
0
 void DrawEffect()                                  // 粒子特效结束后消失
 {
     QUI.SetGUIBackgroundColor(accentColorPurple);
     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();
         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 对象 ->  没找到", 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 + " 秒", 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 + " 秒", 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 + " 秒", Style.Text.Normal, WIDTH_420);
         }
         QUI.EndHorizontal();
         QUI.BeginHorizontal(WIDTH_420);
         {
             QUI.Label("需要额外增加时间", 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(" 秒", 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("开始到消失总时间长: " + poolyDespawner.pSystemTotalDuration + " 秒", Style.Text.Normal, WIDTH_420);
         }
         QUI.EndHorizontal();
         infoMessage["poolyDespawner.pSystem"].show.target = false;
     }
     QUI.ResetColors();
     DrawInfoMessage("poolyDespawner.pSystem", WIDTH_420);
 }