Ejemplo n.º 1
0
 public static void CancelAnimation(this ViewBase vb)
 {
     if (vb.animationRoutine != null)
     {
         AnimationDispatcher.Stop(vb.animationRoutine);
         vb.animationRoutine = null;
     }
 }
    /// <summary>
    /// Function that registers data to the dataBinder and dataBinder list, and the generates the list of prefabs accordingly and binds the data to the data binder
    /// Both the dataBinder and the dataBinder list use the same json data in this example but target different nodes within
    /// </summary>
    /// <param name="json">JSON data to pass to the dataBinder elements</param>
    /// <returns></returns>
    private IEnumerator ChangeData(JSONNode json, bool playAnimation = true)
    {
        //Generates a list of dataBinders based on the json provided
        m_dataList.GenerateList(json);

        //Registers the json data provided to the dataBinder
        m_dataBinder.RegisterData(json);

        //Plays the animation for the chart wipe and waits for half of the animation before yielding
        if (playAnimation)
        {
            yield return(StartCoroutine(AnimationDispatcher.TriggerAnimation(m_chartWipe, "Play", 0.5f)));
        }

        //Bind the new data to all databinder components tied to the dataBinder
        m_dataBinder.BindData();
    }
Ejemplo n.º 3
0
 public static void FadeTo(this ViewBase vb, float target, Action callback = null, float fadeTime = AnimationDefaults.FadeTime)
 {
     vb.CancelAnimation();
     vb.animationRoutine = AnimationDispatcher.DispatchCoroutine(vb.FadeRoutine(target, fadeTime, callback));
 }