Utility for performing animations on UIElements
상속: IUIProcess
예제 #1
0
        public UITweenInstance(UITween owner, object obj, float duration, Dictionary <string, float> args, EaseFunction ease)
        {
            this.m_Owner        = owner;
            this.m_EaseFunction = ease;
            this.m_Object       = obj;
            /** Convert secs into ticks **/
            this.m_Duration = new TimeSpan(0, 0, 0, 0, (int)(duration * 1000.0f)).Ticks;

            var clazz = obj.GetType();

            m_Fields = new List <UITweenInstanceField>();
            foreach (var key in args.Keys)
            {
                var prop = clazz.GetMember(key)[0];
                if (prop is FieldInfo)
                {
                    m_Fields.Add(new UITweenInstanceField_ForField(prop as FieldInfo, obj)
                    {
                        End = (float)args[key]
                    });
                }
                else if (prop is PropertyInfo)
                {
                    m_Fields.Add(new UITweenInstanceField_ForProperty(prop as PropertyInfo, obj)
                    {
                        End = (float)args[key]
                    });
                }
            }
        }
예제 #2
0
 public UITweenInstanceMembers(UITween owner, object obj, float duration, Dictionary <string, float> args, EaseFunction ease)
 {
     Owner        = owner;
     TargetObject = obj;
     Duration     = duration;
     Arguments    = args;
     Ease         = ease;
 }
예제 #3
0
        public UITween Queue(UITweenQueueTypes type, Action finalAction, params UITweenInstanceMembers[] instances)
        {
            UITween lastTween = this;
            bool    appended  = false;

            for (var count = 0; count < instances.Length; count++)
            {
                if (type.Equals(UITweenQueueTypes.AppendedSynchronous) && !appended)
                {
                    appended  = true;
                    lastTween = EnQueue(instances[count], UITweenQueueTypes.Sequential, finalAction);
                }
                else
                {
                    lastTween = EnQueue(instances[count], type, finalAction);
                }
            }
            return(lastTween);
        }
예제 #4
0
        public UILayer(Microsoft.Xna.Framework.Game G, SpriteFont SprFontBig, SpriteFont SprFontSmall)
        {
            fpsStopwatch = new Stopwatch();
            fpsStopwatch.Start();

            m_G = G;
            m_SprFontBig = SprFontBig;
            m_SprFontSmall = SprFontSmall;

            m_WorldMatrix = Matrix.Identity;
            m_ViewMatrix = Matrix.CreateLookAt(Vector3.Right * 5, Vector3.Zero, Vector3.Forward);
            m_ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.Pi / 4.0f,
                    (float)GraphicsDevice.PresentationParameters.BackBufferWidth /
                    (float)GraphicsDevice.PresentationParameters.BackBufferHeight,
                    1.0f, 100.0f);

            TextStyle.DefaultTitle = new TextStyle {
                Font = GameFacade.MainFont,
                Size = 10,
                Color = new Color(255,249,157),
                SelectedColor = new Color(0x00, 0x38, 0x7B),
                SelectionBoxColor = new Color(255, 249, 157)
            };

            TextStyle.DefaultButton = new TextStyle
            {
                Font = GameFacade.MainFont,
                Size = 10,
                Color = new Color(255, 249, 157),
                SelectedColor = new Color(0x00, 0x38, 0x7B),
                SelectionBoxColor = new Color(255, 249, 157)
            };

            TextStyle.DefaultLabel = new TextStyle
            {
                Font = GameFacade.MainFont,
                Size = 10,
                Color = new Color(255, 249, 157),
                SelectedColor = new Color(0x00, 0x38, 0x7B),
                SelectionBoxColor = new Color(255, 249, 157)
            };

            Tween = new UITween();
            this.AddProcess(Tween);

            inputManager = new InputManager();
            mainUI = new UIContainer();
            dialogContainer = new UIContainer();
            mainUI.Add(dialogContainer);

            // Create a new SpriteBatch, which can be used to draw textures.
            SpriteBatch = new UISpriteBatch(GraphicsDevice, 3);

            GameFacade.OnContentLoaderReady += new BasicEventHandler(GameFacade_OnContentLoaderReady);
            m_G.GraphicsDevice.DeviceReset += new EventHandler<EventArgs>(GraphicsDevice_DeviceReset);
        }
예제 #5
0
        public UITweenInstance(UITween owner, object obj, float duration, Dictionary<string, float> args, EaseFunction ease)
        {
            this.m_Owner = owner;
            this.m_EaseFunction = ease;
            this.m_Object = obj;
            /** Convert secs into ticks **/
            this.m_Duration = new TimeSpan(0, 0, 0, 0, (int)(duration * 1000.0f)).Ticks;

            var clazz = obj.GetType();

            m_Fields = new List<UITweenInstanceField>();
            foreach (var key in args.Keys)
            {
                var prop = clazz.GetMember(key)[0];
                if(prop is FieldInfo){
                    m_Fields.Add(new UITweenInstanceField_ForField(prop as FieldInfo, obj)
                    {
                        End = (float)args[key]
                    });
                }
                else if (prop is PropertyInfo)
                {
                    m_Fields.Add(new UITweenInstanceField_ForProperty(prop as PropertyInfo, obj)
                    {
                        End = (float)args[key]
                    });
                }
            }
        }