Пример #1
0
 /// <summary>
 /// Loads the Loop Animations Preset that is set to load at runtime and performs the inital setup of the loop animations.
 /// </summary>
 /// <param name="forced"></param>
 void InitLoopAnimations(bool forced = false)
 {
     if (loopAnimationsArePlaying)
     {
         return;
     }
     if (loadLoopAnimationsPresetAtRuntime)
     {
         Loop presetLoop = UIAnimatorUtil.GetLoop(loopAnimationsPresetCategoryName, loopAnimationsPresetName);
         if (presetLoop != null)
         {
             loopAnimations = presetLoop.Copy();
         }
     }
     if (loopAnimations == null || !loopAnimations.Enabled)
     {
         return;
     }
     ResetRectTransform();
     UIAnimator.SetupLoops(RectTransform, startPosition, startRotation, startScale, startAlpha, loopAnimations,
                           null, null,
                           null, null,
                           null, null,
                           null, null,
                           LOOP_ANIMATIONS_ID, true, forced);
     if (loopAnimations.autoStart)
     {
         loopAnimationsArePlaying = true;
     }
 }
Пример #2
0
 /// <summary>
 /// Loads the animation values of all Punch Presets that are set to load at runtime.
 /// </summary>
 void LoadRuntimePunchPresets()
 {
     if (loadOnPointerEnterPunchPresetAtRuntime)
     {
         Punch presetPunch = UIAnimatorUtil.GetPunch(onPointerEnterPunchPresetCategory, onPointerEnterPunchPresetName);
         if (presetPunch != null)
         {
             onPointerEnterPunch = presetPunch.Copy();
         }
     }
     if (loadOnPointerExitPunchPresetAtRuntime)
     {
         Punch presetPunch = UIAnimatorUtil.GetPunch(onPointerExitPunchPresetCategory, onPointerExitPunchPresetName);
         if (presetPunch != null)
         {
             onPointerExitPunch = presetPunch.Copy();
         }
     }
     if (loadOnClickPunchPresetAtRuntime)
     {
         Punch presetPunch = UIAnimatorUtil.GetPunch(onClickPunchPresetCategory, onClickPunchPresetName);
         if (presetPunch != null)
         {
             onClickPunch = presetPunch.Copy();
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Loads the Loop Animations Preset that is set to load at runtime and performs the inital setup of the loop animations.
 /// </summary>
 /// <param name="forced"></param>
 void InitLoopAnimations(bool forced = false)
 {
     if (loopAnimationsArePlaying)
     {
         return;
     }
     if (loadLoopAnimationsPresetAtRuntime)
     {
         Loop presetLoop = UIAnimatorUtil.GetLoop(loopAnimationsPresetCategoryName, loopAnimationsPresetName);
         if (presetLoop != null)
         {
             bool autoStart = loopAnimations.autoStart;    //save the autoStart setting from the inspector (the value set by the developer)
             loopAnimations           = presetLoop.Copy(); //load the preset settings
             loopAnimations.autoStart = autoStart;         //override the autoStart setting (that the preset came with) so that autoStart is set to the value the developer set it to
         }
     }
     if (loopAnimations == null || !loopAnimations.Enabled)
     {
         return;
     }
     ResetRectTransform();
     UIAnimator.SetupLoops(RectTransform, startPosition, startRotation, startScale, startAlpha, loopAnimations,
                           null, null,
                           null, null,
                           null, null,
                           null, null,
                           LOOP_ANIMATIONS_ID, true, forced);
     if (loopAnimations.autoStart)
     {
         PlayLoopAnimations();
     }
 }
Пример #4
0
 /// <summary>
 /// Loads the Out Animations Preset that is set to load at runtime.
 /// </summary>
 void LoadRuntimeOutAnimationsPreset()
 {
     if (loadOutAnimationsPresetAtRuntime)
     {
         Anim presetAnimation = UIAnimatorUtil.GetOutAnim(outAnimationsPresetCategoryName, outAnimationsPresetName);
         if (presetAnimation != null)
         {
             outAnimations = presetAnimation.Copy();
         }
     }
 }
Пример #5
0
 /// <summary>
 /// Loads the In Animations Preset that is set to load at runtime.
 /// </summary>
 void LoadRuntimeInAnimationsPreset()
 {
     if (loadInAnimationsPresetAtRuntime)
     {
         Anim presetAnimation = UIAnimatorUtil.GetInAnim(inAnimationsPresetCategoryName, inAnimationsPresetName);
         if (presetAnimation != null)
         {
             inAnimations = presetAnimation.Copy();
         }
     }
 }
 private void RefreshPunchesAnimatorPresets(bool forcedRefresh = false)
 {
     if (UIAnimatorUtil.PunchDataPresetsDatabase == null || forcedRefresh)
     {
         EditorUtility.DisplayProgressBar("Reloading Data", "Refreshing the - Punch - Animator Presets...", 0.5f);
         UIAnimatorUtil.RefreshPunchDataPresetsDatabase();
     }
     EditorUtility.DisplayProgressBar("Reloading Data", "Quick cleanup...", 0.75f);
     PunchesAnimatorPresetsAnimBool = new Dictionary <string, AnimBool>();
     foreach (string category in UIAnimatorUtil.PunchDataPresetsDatabase.Keys)
     {
         PunchesAnimatorPresetsAnimBool.Add(category, new AnimBool(selectedAnimatorPreset == AnimatorPreset.Punches && category.Equals(openedAnimatorPresetCategory)));
     }
     openedAnimatorPresetCategory = "";
     selectedAnimatorPresetName   = "";
     EditorUtility.ClearProgressBar();
 }
Пример #7
0
        void DrawPresetList(string category, AnimatorPreset presetType, List <string> list, float width, string emptyMessage = "List is empty...")
        {
            QUI.Space(2);
            if (list.Count == 0)
            {
                if (SearchPatternAnimBool.value)
                {
                    QUI.Label("No matching names found in this category!", DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelSmallItalic));
                }
                else
                {
                    QUI.BeginHorizontal(width);
                    {
                        QUI.Space(22);
                        QUI.Label(emptyMessage, DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelSmallItalic), width - 60);
                        //if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonPlus), 20, 20))
                        //{
                        //    list.Add("");
                        //}
                    }
                    QUI.EndHorizontal();
                }
                return;
            }

            QUI.BeginVertical(width);
            {
                bool matchFoundInThisCategory = false;
                for (int i = 0; i < list.Count; i++)
                {
                    QUI.BeginHorizontal(width);
                    {
                        if (SearchPatternAnimBool.target)//a search pattern has been entered in the search box
                        {
                            try
                            {
                                if (!Regex.IsMatch(list[i], SearchPattern, RegexOptions.IgnoreCase))
                                {
                                    QUI.EndHorizontal();
                                    continue; //this does not match the search pattern --> we do not show this name it
                                }
                            }
                            catch (Exception)
                            {
                            }
                            matchFoundInThisCategory = true;
                        }
                        QUI.Space(20);
                        if (!SearchPatternAnimBool.value)
                        {
                            if (list[i].Equals(selectedAnimatorPresetName))
                            {
                                SaveColors();
                                QUI.SetGUIColor(DUIColors.BlueLight.Color);
                                QUI.DrawTexture(DUIResources.backgroundGrey230.texture, (width - 55 - 100), 20);
                                QUI.Space(-20);
                                QUI.Label(list[i], DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelNormal), (width - 55 - 100) * (1 - SearchPatternAnimBool.faded));
                                QUI.Space(-7);
                                QUI.DrawTexture(DUIResources.pageButtonSelect.active, 100, 20);
                                QUI.Space(-20);
                                QUI.Space(100);
                                RestoreColors();
                            }
                            else
                            {
                                if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.ButtonBar), (width - 55 - 100), 20))
                                {
                                    SelectedAnimatorPreset(list[i]);
                                }
                                QUI.Space(-(width - 55 - 100));
                                QUI.Label(list[i], DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelNormal), (width - 55 - 100) * (1 - SearchPatternAnimBool.faded));
                                QUI.Space(-7);
                                if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonSelect), 100 * (1 - SearchPatternAnimBool.faded), 20))
                                {
                                    SelectedAnimatorPreset(list[i]);
                                }
                            }
                            QUI.Space(1);
                            if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonMinus), 20 * (1 - SearchPatternAnimBool.faded), 20))
                            {
                                if (EditorUtility.DisplayDialog("Delete the '" + list[i] + "' preset?", "Are you sure you want to proceed?\nOperation cannot be undone!", "Yes", "Cancel"))
                                {
                                    switch (presetType)
                                    {
                                    case AnimatorPreset.InAnimations: UIAnimatorUtil.DeleteInAnimPreset(openedAnimatorPresetCategory, list[i]); RefreshInAnimationsAnimatorPresets(true); break;

                                    case AnimatorPreset.OutAnimations: UIAnimatorUtil.DeleteOutAnimPreset(openedAnimatorPresetCategory, list[i]); RefreshOutAnimationsAnimatorPresets(true); break;

                                    case AnimatorPreset.Loops: UIAnimatorUtil.DeleteLoopPreset(openedAnimatorPresetCategory, list[i]); RefreshLoopsAnimatorPresets(true); break;

                                    case AnimatorPreset.Punches: UIAnimatorUtil.DeletePunchPreset(openedAnimatorPresetCategory, list[i]); RefreshPunchesAnimatorPresets(true); break;
                                    }
                                    openedAnimatorPresetCategory = category;
                                }
                            }
                        }
                        QUI.FlexibleSpace();
                    }
                    QUI.EndHorizontal();
                    QUI.Space(2);
                }

                if (SearchPatternAnimBool.target)
                {
                    if (!matchFoundInThisCategory) //if a search pattern is active and no valid names were found for this category we let the developer know
                    {
                        QUI.Label("No matching names found in this category!", DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelSmallItalic));
                    }
                }
                //else //because a search pattern is active, we do no give the developer the option to create a new name
                //{
                //    QUI.BeginHorizontal(width);
                //    {
                //        QUI.Space(width - 34);
                //        if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonPlus), 20, 20))
                //        {
                //            list.Add("");
                //        }
                //        QUI.Space(2);
                //    }
                //    QUI.EndHorizontal();
                //}
            }
            QUI.EndVertical();
        }