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] }); } } }
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); }
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] }); } } }
public ScreenManager(Game G, SpriteFont SprFontBig, SpriteFont SprFontSmall) { m_G = G; m_SprFontBig = SprFontBig; m_SprFontSmall = SprFontSmall; GraphicsDevice.VertexDeclaration = new VertexDeclaration(GraphicsDevice, VertexPositionNormalTexture.VertexElements); GraphicsDevice.RenderState.CullMode = CullMode.None; 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); GameFacade.OnContentLoaderReady += new BasicEventHandler(GameFacade_OnContentLoaderReady); }