public override void Startup() { Matrix toScreenSpace = Matrix.Identity; toScreenSpace.M11 = 2 / 1024.0f; toScreenSpace.M22 = 2 / 768.0f; toScreenSpace.M41 = -1; toScreenSpace.M42 = -1; var cam = new Camera { PostWorldMatrix = toScreenSpace, Position = Vector3.UnitZ, IsPerspective = false, ViewportWidth = 2, ViewportHeight = -2 }; cam.Dirty(); Root = new UI.TransformNode { Transform = cam.WorldToProjectionMatrix, Dispatcher = GameApp.Service<UIManager>().Root }; var pageStyle = new Style.PageStyle(GameApp.Service<Styler>().GetPageStyle("Deck")); pageStyle.Initialize(); TextRenderer.FontDescriptor m_msgFont = new TextRenderer.FontDescriptor("Microsoft YaHei", 16); m_textFormatOptions = new Graphics.TextRenderer.FormatOptions(m_msgFont); }
public override void Startup() { var device = GameApp.Instance.GraphicsDevice; var resourceMgr = GameApp.Service<ResourceManager>(); m_buttonFace = new Graphics.TexturedQuad(resourceMgr.Acquire<Graphics.VirtualTexture>("atlas:Textures/UI/InGame/Atlas0$Button")); m_buttonFaceDisabled = new Graphics.TexturedQuad(resourceMgr.Acquire<Graphics.VirtualTexture>("atlas:Textures/UI/InGame/Atlas0$ButtonDisable")); var buttonFmtOptions = new TextRenderer.FormatOptions(new TextRenderer.FontDescriptor("Microsoft YaHei", 16)); m_buttonTexts[MessageBox.ButtonOK] = GameApp.Service<TextRenderer>().FormatText("确定", buttonFmtOptions); m_buttonTexts[MessageBox.ButtonCancel] = GameApp.Service<TextRenderer>().FormatText("取消", buttonFmtOptions); m_buttonTexts[MessageBox.ButtonYes] = GameApp.Service<TextRenderer>().FormatText("是", buttonFmtOptions); m_buttonTexts[MessageBox.ButtonNo] = GameApp.Service<TextRenderer>().FormatText("否", buttonFmtOptions); var digitFmtOptions = new TextRenderer.FormatOptions(new TextRenderer.FontDescriptor("Constantia", 36)); 10.Repeat(i => m_digits[i] = GameApp.Service<TextRenderer>().FormatText(i.ToString(), digitFmtOptions)); m_signs[0] = GameApp.Service<TextRenderer>().FormatText("+", digitFmtOptions); m_signs[1] = GameApp.Service<TextRenderer>().FormatText("-", digitFmtOptions); m_okCancelTexts[NumberSelector.ButtonOK] = GameApp.Service<TextRenderer>().FormatText("确定", buttonFmtOptions); m_okCancelTexts[NumberSelector.ButtonCancel] = GameApp.Service<TextRenderer>().FormatText("取消", buttonFmtOptions); m_upButtonFace = new Graphics.TexturedQuad(resourceMgr.Acquire<Graphics.VirtualTexture>("atlas:Textures/UI/InGame/Atlas0$Up")); m_downButtonFace = new Graphics.TexturedQuad(resourceMgr.Acquire<Graphics.VirtualTexture>("atlas:Textures/UI/InGame/Atlas0$Down")); m_leftButtonFace = new Graphics.TexturedQuad(resourceMgr.Acquire<Graphics.VirtualTexture>("atlas:Textures/UI/InGame/Atlas0$LeftArrow")); m_rightButtonFace = new Graphics.TexturedQuad(resourceMgr.Acquire<Graphics.VirtualTexture>("atlas:Textures/UI/InGame/Atlas0$RightArrow")); m_msgFont = new TextRenderer.FontDescriptor("Microsoft YaHei", 32); }