コード例 #1
0
        /// <summary>
        /// Initialise the given window using PropertyInitialsers and component
        /// widgets specified for this WidgetLookFeel.
        /// </summary>
        /// <param name="widget">
        /// Window based object to be initialised.
        /// </param>
        public void InitialiseWidget(Window widget)
        {
            // add new property definitions
            var pdc = new NamedDefinitionCollator <string, IPropertyDefinition>();

            AppendPropertyDefinitions(pdc);
            foreach (var pdi in pdc)
            {
                // add the property to the window
                widget.AddProperty((Property)pdi);
            }

            // add required child widgets
            var wcc = new NamedDefinitionCollator <string, WidgetComponent>();

            AppendChildWidgetComponents(wcc);
            foreach (var wci in wcc)
            {
                wci.Create(widget);
            }

            // add new property link definitions
            var pldc = new NamedDefinitionCollator <string, IPropertyDefinition>();

            AppendPropertyLinkDefinitions(pldc);
            foreach (var pldi in pldc)
            {
                // add the property to the window
                widget.AddProperty((Property)pldi);
            }
            // apply properties to the parent window
            var pic = new NamedDefinitionCollator <string, PropertyInitialiser>();

            AppendPropertyInitialisers(pic);
            foreach (var pi in pic)
            {
                pi.Apply(widget);
            }

            // setup linked events
            var eldc = new NamedDefinitionCollator <string, EventLinkDefinition>();

            AppendEventLinkDefinitions(eldc);
            foreach (var eldi in eldc)
            {
                eldi.InitialiseWidget(widget);
            }

            // create animation instances
            var ans = new HashSet <string>();

            AppendAnimationNames(ans);
            foreach (var ani in ans)
            {
                var instance = AnimationManager.GetSingleton().InstantiateAnimation(ani);

                d_animationInstances.Add(widget, instance);
                instance.SetTargetWindow(widget);
            }
        }
コード例 #2
0
        public AnimationDefinitionHandler(XMLAttributes attributes, string namePrefix)
        {
            _anim = null;

            var animName = namePrefix + attributes.GetValueAsString(NameAttribute);

            Logger.LogInsane(
                "Defining animation named: " +
                animName +
                "  Duration: " +
                attributes.GetValueAsString(DurationAttribute) +
                "  Replay mode: " +
                attributes.GetValueAsString(ReplayModeAttribute) +
                "  Auto start: " +
                attributes.GetValueAsString(AutoStartAttribute, "false"));

            _anim = AnimationManager.GetSingleton().CreateAnimation(animName);

            _anim.SetDuration(attributes.GetValueAsFloat(DurationAttribute));

            var replayMode = attributes.GetValueAsString(ReplayModeAttribute, ReplayModeLoop);

            if (replayMode == ReplayModeOnce)
            {
                _anim.SetReplayMode(Animation.ReplayMode.Once);
            }
            else if (replayMode == ReplayModeBounce)
            {
                _anim.SetReplayMode(Animation.ReplayMode.Bounce);
            }
            else
            {
                _anim.SetReplayMode(Animation.ReplayMode.Loop);
            }

            _anim.SetAutoStart(attributes.GetValueAsBool(AutoStartAttribute));
        }
コード例 #3
0
ファイル: System.cs プロジェクト: xdinos/SDL2Experiments
 /// <summary>
 /// call this to ensure system-level time based updates occur.
 /// </summary>
 /// <param name="timeElapsed"></param>
 /// <returns></returns>
 public bool InjectTimePulse(float timeElapsed)
 {
     AnimationManager.GetSingleton().AutoStepInstances(timeElapsed);
     return(true);
 }
コード例 #4
0
ファイル: Affector.cs プロジェクト: xdinos/SDL2Experiments
 /// <summary>
 /// Sets interpolator of this Affector
 /// <para>
 /// Interpolator has to be set for the Affector to work!
 /// </para>
 /// </summary>
 /// <param name="name"></param>
 public void SetInterpolator(string name)
 {
     _interpolator = AnimationManager.GetSingleton().GetInterpolator(name);
 }