void DrawKDRWindow(BasePlayer player) { UIObject ui = new UIObject(); string panel = ui.AddPanel("panel1", 0.0132382892057026, 0.0285714285714286, 0.958248472505092, 0.874285714285714, new UIColor(0.501960784313725, 0.501960784313725, 0.501960784313725, 1), true, "Overlay"); ui.AddText("list", 0.0626992561105207, 0.250544662309368, 0.83740701381509, 0.697167755991285, new UIColor(0, 1, 1, 1), GetTopList(), 20, panel, 7); ui.AddText("label4", 0.390148777895855, 0.163398692810458, 0.18384697130712, 0.0610021786492375, new UIColor(0, 0, 0, 1), "K/D Ratio", 24, panel, 7); ui.AddText("label3", 0.223358129649309, 0.163398692810458, 0.188097768331562, 0.0610021786492375, new UIColor(0, 0, 0, 1), "Deaths", 24, panel, 7); ui.AddText("label2", 0.0541976620616366, 0.163398692810458, 0.16365568544102, 0.0610021786492375, new UIColor(0, 0, 0, 1), "Kills", 24, panel, 7); ui.AddText("label1", 0.552444208289054, 0.163398692810458, 0.197662061636557, 0.0610021786492375, new UIColor(0, 0, 0, 1), "Player Name", 24, panel, 7); string close = ui.AddButton("button1", 0.872476089266737, 0.0479302832244009, 0.0924548352816153, 0.0915032679738562, new UIColor(1, 0, 0, 1), "", panel, panel); ui.AddText("button1_Text", 0, 0, 1, 1, new UIColor(0.93, 23, 23, 0.9), "Close", 18, close, 3); //old alignment //ignore this //string panel = ui.AddPanel("panel1", 0.0132382892057026, 0.0285714285714286, 0.958248472505092, 0.874285714285714, new UIColor(0.501960784313725, 0.501960784313725, 0.501960784313725, 1), true, "Overlay"); //ui.AddText("list", 0.0626992561105207, 0.250544662309368, 0.83740701381509, 0.697167755991285, new UIColor(0, 1, 1, 1), GetTopList(), 20, panel, 7); //ui.AddText("label4", 0.390148777895855, 0.163398692810458, 0.0924548352816153, 0.0610021786492375, new UIColor(0, 0, 0, 1), "K/D Ratio", 24, panel, 7); //ui.AddText("label3", 0.223358129649309, 0.163398692810458, 0.0786397449521785, 0.0610021786492375, new UIColor(0, 0, 0, 1), "Deaths", 24, panel, 7); //ui.AddText("label2", 0.0541976620616366, 0.163398692810458, 0.0478214665249734, 0.0610021786492375, new UIColor(0, 0, 0, 1), "Kills", 24, panel, 7); //ui.AddText("label1", 0.552444208289054, 0.163398692810458, 0.126461211477152, 0.0610021786492375, new UIColor(0, 0, 0, 1), "Player Name", 24, panel, 7); //string close = ui.AddButton("button1", 0.872476089266737, 0.0479302832244009, 0.0924548352816153, 0.0915032679738562, new UIColor(1, 0, 0, 1), "", panel, panel); //ui.AddText("button1_Text", 0, 0, 1, 1, new UIColor(0.93, 23, 23, 0.9), "Close", 18, close, 3); ui.Draw(player); UsedUI.Add(ui); }
void UICoreMessage(BasePlayer player, string message, float timeout = SimpleUI_HideTimer) { float fadeIn = 0.1f; UIObject ui = new UIObject(); //make sure there aren't leftover msgs //ui.Destroy(player, "DeathNotice"); //ui.Destroy(player, "DeathNotice_DropShadow"); ui.AddText("DeathNotice_DropShadow", SimpleUI_Left + 0.001, SimpleUI_Top + 0.001, SimpleUI_MaxWidth, SimpleUI_MaxHeight, shadowColor, StripTags(message), SimpleUI_FontSize, "Hud", 3, fadeIn, fadeIn); ui.AddText("DeathNotice", SimpleUI_Left, SimpleUI_Top, SimpleUI_MaxWidth, SimpleUI_MaxHeight, noticeColor, message, SimpleUI_FontSize, "Hud", 3, fadeIn, fadeIn); ui.Draw(player); timer.Once(timeout, () => { ui.Destroy(player); }); }
void UIMessage(BasePlayer player, string message) { bool replaced = false; float fadeIn = 0.2f; Timer playerTimer; timers.TryGetValue(player, out playerTimer); if (playerTimer != null && !playerTimer.Destroyed) { playerTimer.Destroy(); fadeIn = 0.1f; replaced = true; } UIObject ui = new UIObject(); ui.AddText("DeathNotice_DropShadow", SimpleUI_Left + 0.001, SimpleUI_Top + 0.001, SimpleUI_MaxWidth, SimpleUI_MaxHeight, deathNoticeShadowColor, StripTags(message), SimpleUI_FontSize, "Hud.Under", 3, fadeIn, 0.2f); ui.AddText("DeathNotice", SimpleUI_Left, SimpleUI_Top, SimpleUI_MaxWidth, SimpleUI_MaxHeight, deathNoticeColor, message, SimpleUI_FontSize, "Hud.Under", 3, fadeIn, 0.2f); ui.Destroy(player); if (replaced) { timer.Once(0.1f, () => { ui.Draw(player); timers[player] = timer.Once(SimpleUI_HideTimer, () => ui.Destroy(player)); }); } else { ui.Draw(player); timers[player] = timer.Once(SimpleUI_HideTimer, () => ui.Destroy(player)); } }
void DrawCrosshair(BasePlayer player) { string crosshair = GetConfig("+", "Crosshair", "Symbol"); int size = GetConfig(20, "Crosshair", "Size"); float red = GetConfig(1f, "Color", "Red"); float green = GetConfig(0f, "Color", "Green"); float blue = GetConfig(0f, "Color", "Blue"); float alpha = GetConfig(1f, "Color", "Alpha"); UIObject ui = new UIObject(); ui.AddText("Crosshair", 0.475, 0.475, 0.05, 0.05, new UIColor(red, green, blue, alpha), crosshair, size, "Hud.Under", 3); ui.Draw(player); }
void DrawKDRWindow(BasePlayer player) { UIObject ui = new UIObject(); string panel = ui.AddPanel("panel1", 0.0132382892057026, 0.0285714285714286, 0.958248472505092, 0.874285714285714, new UIColor(0, 0, 0, 1), true, "Overlay"); ui.AddText("label8", 0.675876726886291, 0.248366013071895, 0.272051009564293, 0.718954248366013, new UIColor(1, 1, 1, 1), GetNames(), 24, panel, 7); ui.AddText("label7", 0.483528161530287, 0.248366013071895, 0.0563230605738576, 0.718954248366013, new UIColor(1, 1, 1, 1), GetKDRs(), 24, panel, 6); ui.AddText("label6", 0.269925611052072, 0.248366013071895, 0.0456960680127524, 0.718954248366013, new UIColor(1, 1, 1, 1), GetDeaths(), 24, panel, 6); ui.AddText("label5", 0.0786397449521785, 0.248366013071895, 0.0456960680127524, 0.718954248366013, new UIColor(1, 1, 1, 1), GetTopKills(), 24, panel, 6); string close = ui.AddButton("button1", 0.849096705632306, 0.0326797385620915, 0.124335812964931, 0.0871459694989107, new UIColor(1, 0, 0, 1), "", panel, panel); ui.AddText("button1_Text", 0, 0, 1, 1, new UIColor(0, 0, 0, 1), "Close", 19, close, 3); ui.AddText("label4", 0.470775770456961, 0.163398692810458, 0.0935175345377258, 0.0610021786492375, new UIColor(1, 0, 0, 1), "K/D Ratio", 24, panel, 7); ui.AddText("label3", 0.260361317747078, 0.163398692810458, 0.0722635494155154, 0.0610021786492375, new UIColor(1, 0, 0, 1), "Deaths", 24, panel, 7); ui.AddText("label2", 0.0786397449521785, 0.163398692810458, 0.0467587672688629, 0.0610021786492375, new UIColor(1, 0, 0, 1), "Kills", 24, panel, 7); ui.AddText("label1", 0.675876726886291, 0.163398692810458, 0.125398512221041, 0.0610021786492375, new UIColor(1, 0, 0, 1), "Player Name", 24, panel, 7); ui.Draw(player); UsedUI.Add(ui); }
void DrawKDRWindow(BasePlayer player) { UIObject ui = new UIObject(); string panel = ui.AddPanel("panel1", 0.0192382892057026, 0.0285714285714286, 0.958248472505092, 0.874285714285714, new UIColor(0, 0, 0, 0.9), true, "Overlay"); ui.AddText("label8", 0.785876726886291, 0.248366013071895, 0.072051009564293, 0.718954248366013, new UIColor(1, 1, 1, 0.5), GetKDRs(), 20, panel, 7); ui.AddText("label7", 0.603528161530287, 0.248366013071895, 0.0763230605738576, 0.718954248366013, new UIColor(255, 0, 0, 0.4), GetDeaths(), 20, panel, 7); ui.AddText("label6", 0.369925611052072, 0.248366013071895, 0.0756960680127524, 0.718954248366013, new UIColor(0, 255, 0, 0.3), GetTopKills(), 20, panel, 7); ui.AddText("label5", 0.0786397449521785, 0.248366013071895, 0.3756960680127524, 0.718954248366013, new UIColor(1, 1, 1, 0.5), GetNames(), 20, panel, 7); string close = ui.AddButton("button1", 0.849096705632306, 0.0326797385620915, 0.124335812964931, 0.0871459694989107, new UIColor(1, 0, 0, 0), "", panel, panel); ui.AddText("button1_Text", 0, 0, 1, 1, new UIColor(1, 0, 0, 1), "Fermer", 19, close, 3); ui.AddText("label4", 0.590775770456961, 0.163398692810458, 0.0935175345377258, 0.0610021786492375, new UIColor(128, 0, 0, 1), "<color=#850606>Morts</color>", 24, panel, 7); ui.AddText("label3", 0.360361317747078, 0.163398692810458, 0.1722635494155154, 0.0610021786492375, new UIColor(166, 24, 40, 1), "<color=#008000>Éliminations</color>", 24, panel, 7); ui.AddText("label2", 0.0786397449521785, 0.163398692810458, 0.3767587672688629, 0.0610021786492375, new UIColor(1, 0, 0, 1), "<color=#C0C0C0>Nom du joueur</color>", 24, panel, 7); ui.AddText("label1", 0.775876726886291, 0.163398692810458, 0.125398512221041, 0.0610021786492375, new UIColor(1, 0, 0, 1), "<color=#C0C0C0>E/M Ratio</color>", 24, panel, 7); ui.AddText("label0", 0.355876726886291, 0.045398692810458, 0.305398512221041, 0.0610021786492375, new UIColor(1, 1, 1, 1), "<color=blue>Rust</color> France <color=red>Infinity™</color> <color=#af8700>Stats</color>", 33, panel, 7); ui.Draw(player); UsedUI.Add(ui); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); screenMatrix.Translation = new Vector3(0f); if (screenShakeDuration > 0) { screenShakeDuration--; ShakeScreen(); } //BlendState Alpha Blend: Any transparent pixels in the image will blend with whatever's under them (As well as partially-transparent pixels) //SamplerState Point Clamp: No blur effects are added, things drawn in this batch will keep their pixelated effect //DepthStencilState None: Doesn't use the depth stencil (Which keeps track of the depth of pixels in the screen, useful for 3D) //RasterizerState Cull Counter Clockwise: As far as I know, gets 3D points and converts them into shapes then pixels for easy image representation GraphicsDevice.SetRenderTarget(renderTarget); GraphicsDevice.Clear(Color.Black); _spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, screenMatrix); switch (gameState) { case GameStates.GameState_Title: parallax.Draw(_spriteBatch); mainUI.Draw(_spriteBatch); break; case GameStates.GameState_Playing: parallax.Draw(_spriteBatch); VisualEffect[] backgroundEffectsClone = backgroundEffects.ToArray(); Projectile[] activeProjectilesClone = activeProjectiles.ToArray(); CollisionBody[] activeEntitiesClone = activeEntities.ToArray(); VisualEffect[] activeEffectsClone = activeEffects.ToArray(); UIObject[] activeUIClone = activeUI.ToArray(); foreach (VisualEffect backgroundEffect in backgroundEffectsClone) { backgroundEffect.Draw(_spriteBatch); } foreach (Projectile projectile in activeProjectilesClone) { projectile.Draw(_spriteBatch); } foreach (CollisionBody entity in activeEntitiesClone) { entity.Draw(_spriteBatch); } foreach (VisualEffect effect in activeEffectsClone) { effect.Draw(_spriteBatch); } foreach (UIObject ui in activeUIClone) { ui.Draw(_spriteBatch); } break; case GameStates.GameState_Paused: break; case GameStates.GameState_GameOver: _spriteBatch.DrawString(mainFont, "Score: " + gameScore, new Vector2(270f, 680f), Color.White); break; } if (fadeProgress > 0) { _spriteBatch.Draw(fadeOutTexture, new Rectangle(0, 0, desiredResolutionWidth, desiredResolutionHeight), Color.White * fadeProgress); } if (debugValue != "") { Vector2 position = new Vector2(desiredResolutionWidth, desiredResolutionHeight) - (mainFont.MeasureString(debugValue) * 0.4f); _spriteBatch.DrawString(mainFont, debugValue, position, Color.White, 0f, Vector2.Zero, 0.4f, SpriteEffects.None, 0f); } _spriteBatch.End(); GraphicsDevice.SetRenderTarget(null); GraphicsDevice.Clear(Color.Black); _spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, shaderManager.activeScreenShader); _spriteBatch.Draw(renderTarget, Vector2.Zero, Color.White); _spriteBatch.End(); }