Beispiel #1
0
 public void DeleteGroup(DOTweenPlayer dtp_player, int i_pos)
 {
     if (_src.AllGroups != null && _src.AllGroups.Length > i_pos)
     {
         DOTweenPlayer.DOTGroup[] new_list = new DOTweenPlayer.DOTGroup[_src.AllGroups.Length - 1];
         for (int i = 0, k = 0; i < _src.AllGroups.Length; i++)
         {
             if (i != i_pos)
             {
                 new_list[k] = _src.AllGroups[i];
                 k          += 1;
             }
         }
         _src.AllGroups = new_list;
     }
 }
Beispiel #2
0
        //Vector2 srcPos;

        public override void OnInspectorGUI()
        {
            EditorGUIUtils.SetGUIStyles(null);
            EditorGUIUtility.labelWidth = 80f;
            EditorGUIUtils.InspectorLogo();
            GUILayout.Label("Custom Player", EditorGUIUtils.sideLogoIconBoldLabelStyle);

            //VisualManagerPreset preset = this._src.preset;
            //this._src.preset = (VisualManagerPreset)EditorGUILayout.EnumPopup("Preset", this._src.preset, new GUILayoutOption[0]);
            //if (preset != this._src.preset)
            //{
            //    VisualManagerPreset preset2 = this._src.preset;
            //    if (preset2 == VisualManagerPreset.PoolingSystem)
            //    {
            //        this._src.onEnableBehaviour = OnEnableBehaviour.RestartFromSpawnPoint;
            //        this._src.onDisableBehaviour = OnDisableBehaviour.Rewind;
            //    }
            //}

            if (GUILayout.Button("Register"))
            {
                if (Application.isPlaying)
                {
                    return;
                }
                RegisterAll(_src, false);
            }

            if (GUILayout.Button("Register Children"))
            {
                if (Application.isPlaying)
                {
                    return;
                }
                RegisterAll(_src, true);
            }

            GUILayout.Space(6f);
            int to_delete = -1;

            if (_src.AllGroups != null && _src.AllGroups.Length > 0)
            {
                //srcPos = GUILayout.BeginScrollView(srcPos);
                GUILayout.BeginVertical();

                for (int i = 0; i < _src.AllGroups.Length; i++)
                {
                    //GUILayout.BeginArea
                    DOTweenPlayer.DOTGroup dg_item = _src.AllGroups[i];

                    GUILayout.Space(6f);

                    GUILayout.BeginVertical("Button");

                    EditorGUILayout.LabelField("Group ID : " + dg_item.ID);
                    EditorGUILayout.LabelField("Count : " + dg_item.AllComps.Length);

                    OnEnableBehaviour_My  onEnableBehaviour  = dg_item.onEnableBehaviour;
                    OnDisableBehaviour_My onDisableBehaviour = dg_item.onDisableBehaviour;

                    if (GUILayout.Button("X", GUILayout.Width(20)))
                    {
                        to_delete = i;
                    }
                    dg_item.onEnableBehaviour = (OnEnableBehaviour_My)EditorGUILayout.EnumPopup(new GUIContent("On Enable", "Eventual actions to perform when this gameObject is activated"),
                                                                                                dg_item.onEnableBehaviour, new GUILayoutOption[0]);
                    dg_item.onDisableBehaviour = (OnDisableBehaviour_My)EditorGUILayout.EnumPopup(new GUIContent("On Disable", "Eventual actions to perform when this gameObject is deactivated"),
                                                                                                  dg_item.onDisableBehaviour, new GUILayoutOption[0]);

                    GUILayout.Space(6f);

                    if (!Application.isPlaying)
                    {
                        GUILayout.BeginHorizontal();

                        //bool b_autoPlay = false;
                        //bool b_autoKill = false;

                        //for (int k = 0; k < dg_item.AllComps.Length; k++)
                        //{
                        //    if (dg_item.AllComps[k].autoPlay)
                        //    {
                        //        b_autoPlay = true;
                        //        break;
                        //    }
                        //}

                        //for (int k = 0; k < dg_item.AllComps.Length; k++)
                        //{
                        //    if (dg_item.AllComps[k].autoKill)
                        //    {
                        //        b_autoKill = true;
                        //        break;
                        //    }
                        //}

                        //EditorGUI.BeginChangeCheck();
                        //b_autoPlay = DeGUILayout.ToggleButton(b_autoPlay, new GUIContent("AutoPlay", "If selected, the tween will play automatically"));
                        //if (EditorGUI.EndChangeCheck())
                        //{
                        //    ToggleAutoPlay(_src, i, b_autoPlay);
                        //}

                        //EditorGUI.BeginChangeCheck();
                        //b_autoKill = DeGUILayout.ToggleButton(b_autoKill, new GUIContent("AutoKill", "If selected, the tween will be killed when it completes, and won't be reusable"));
                        //if (EditorGUI.EndChangeCheck())
                        //{
                        //    ToggleAutoPlay(_src, i, b_autoPlay);
                        //}


                        if (GUILayout.Button("AutoPlay"))
                        {
                            ToggleAutoPlay(_src, i, true);
                        }
                        if (GUILayout.Button("X AutoPlay"))
                        {
                            ToggleAutoPlay(_src, i, false);
                        }
                        if (GUILayout.Button("AutoKill"))
                        {
                            ToggleAutoKill(_src, i, true);
                        }
                        if (GUILayout.Button("X AutoKill"))
                        {
                            ToggleAutoKill(_src, i, false);
                        }

                        GUILayout.EndHorizontal();
                    }
                    else
                    {
                        GUILayout.BeginHorizontal();
                        if (GUILayout.Button("Play"))
                        {
                            _src.Play(dg_item.ID);
                        }
                        if (GUILayout.Button("Pause"))
                        {
                            _src.Pause(dg_item.ID);
                        }
                        if (GUILayout.Button("Rewind"))
                        {
                            _src.Rewind(dg_item.ID);
                        }
                        if (GUILayout.Button("Restart"))
                        {
                            _src.Restart(dg_item.ID);
                        }
                        GUILayout.EndHorizontal();
                    }
                    GUILayout.EndVertical();

                    if (to_delete != -1)
                    {
                        DeleteGroup(this._src, to_delete);
                        to_delete = -1;
                        break;
                    }
                }
                //GUILayout.EndScrollView();
                GUILayout.EndVertical();
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(this._src);
            }
        }