public void sendBounty(BasePlayer player, Bounty bounty) { #if DEBUG player.ChatMessage($"sendBounty: {bounty.placerName} -> {bounty.targetName}"); #endif closeBounty(player); GuiContainer c = new GuiContainer(this, "bountyPreview"); //template Rectangle templatePos = new Rectangle(623, 26, 673, 854, resX, resY, true); c.addImage("template", templatePos, "bounty_template", GuiContainer.Layer.hud, FadeIn: FadeIn, FadeOut: FadeOut); //targetName Rectangle targetNamePos = new Rectangle(680, 250, 560, 65, resX, resY, true); int fontsize = guiCreator.getFontsizeByFramesize(bounty.targetName.Length, targetNamePos); GuiText targetNameText = new GuiText(bounty.targetName, fontsize); c.addText("targetName", targetNamePos, GuiContainer.Layer.hud, targetNameText, FadeIn, FadeOut); //image if (config.showSteamImage) { Rectangle imagePos = new Rectangle(828, 315, 264, 264, resX, resY, true); c.addImage("image", imagePos, bounty.targetID.ToString(), GuiContainer.Layer.hud, FadeIn: FadeIn, FadeOut: FadeOut); } //reward Rectangle rewardPos = new Rectangle(680, 579, 560, 53, resX, resY, true); string reward = $"{bounty.rewardAmount} {bounty.reward.info.displayName.english}"; GuiText rewardText = new GuiText(reward, guiCreator.getFontsizeByFramesize(reward.Length, rewardPos)); c.addText("reward", rewardPos, GuiContainer.Layer.hud, rewardText, FadeIn, FadeOut); //reason Rectangle reasonPos = new Rectangle(680, 681, 560, 53, resX, resY, true); GuiText reasonText = new GuiText(bounty.reason, 14); c.addText("reason", reasonPos, GuiContainer.Layer.hud, reasonText, FadeIn, FadeOut); //placerName Rectangle placerNamePos = new Rectangle(680, 771, 560, 36, resX, resY, true); GuiText placerNameText = new GuiText(bounty.placerName, guiCreator.getFontsizeByFramesize(bounty.placerName.Length, placerNamePos)); c.addText("placerName", placerNamePos, GuiContainer.Layer.hud, placerNameText, FadeIn, FadeOut); //exitButton Rectangle closeButtonPos = new Rectangle(1296, 52, 60, 60, resX, resY, true); c.addButton("close", closeButtonPos, GuiContainer.Layer.hud, darkRed, FadeIn, FadeOut, new GuiText("X", 24, lightRed), blur: GuiContainer.Blur.medium); c.display(player); //button if (bounty.hunt != null) { huntButton(player, bounty, huntErrorType.huntActive); } else { huntButton(player, bounty); } }
public void customGameTip(BasePlayer player, string text, float duration = 0, gametipType type = gametipType.gametip) { GuiTracker.getGuiTracker(player).destroyGui(this, "gameTip"); GuiContainer container = new GuiContainer(this, "gameTip"); switch (type) { case gametipType.gametip: //container.addImage("gametip", new Rectangle(375, 844, 1170, 58, 1920, 1080, true), "bgTex", GuiContainer.Layer.overall, new GuiColor("#25639BF0"), 0.5f, 1); container.addPlainPanel("gametip", new Rectangle(375, 844, 1170, 58, 1920, 1080, true), GuiContainer.Layer.overall, new GuiColor("#25639BF4"), 0.5f, 1, GuiContainer.Blur.greyout); container.addText("gametip_txt", new Rectangle(433, 844, 1112, 58, 1920, 1080, true), GuiContainer.Layer.overall, new GuiText(text, 20, new GuiColor("#FFFFFFD9")), 0.5f, 1); container.addImage("gametip_icon", new Rectangle(375, 844, 58, 58, 1920, 1080, true), "gameTipIcon", GuiContainer.Layer.overall, new GuiColor("#FFFFFFD9"), 0.5f, 1); break; case gametipType.warning: container.addPlainPanel("gametip", new Rectangle(375, 844, 1170, 58, 1920, 1080, true), GuiContainer.Layer.overall, new GuiColor("#DED502F0"), 0.5f, 1); container.addText("gametip_txt", new Rectangle(433, 844, 1112, 58, 1920, 1080, true), GuiContainer.Layer.overall, new GuiText(text, 20, new GuiColor("#000000D9")), 0.5f, 1); container.addImage("gametip_icon", new Rectangle(375, 844, 58, 58, 1920, 1080, true), "warning_alpha", GuiContainer.Layer.overall, new GuiColor("#FFFFFFD9"), 0.5f, 1); break; case gametipType.error: //container.addImage("gametip", new Rectangle(375, 844, 1170, 58, 1920, 1080, true), "bgTex", GuiContainer.Layer.overall, new GuiColor("#BB0000F0"), 0.5f, 1); container.addPlainPanel("gametip", new Rectangle(375, 844, 1170, 58, 1920, 1080, true), GuiContainer.Layer.overall, new GuiColor("#BB0000F0"), 0.5f, 1, GuiContainer.Blur.greyout); container.addText("gametip_txt", new Rectangle(433, 844, 1112, 58, 1920, 1080, true), GuiContainer.Layer.overall, new GuiText(text, 20, new GuiColor("#FFFFFFD9")), 0.5f, 1); container.addImage("gametip_icon", new Rectangle(375, 844, 58, 58, 1920, 1080, true), "white_cross", GuiContainer.Layer.overall, new GuiColor("#FFFFFFD9"), 0.5f, 1); break; } if (duration != 0) { Timer closeTimer = timer.Once(duration, () => { GuiTracker.getGuiTracker(player).destroyGui(this, container); }); container.timers.Add(closeTimer); } container.display(player); }
private void SendSVSelector(int s, int v) { GuiContainer c = new GuiContainer(PluginInstance, "SVSelector", "SVPicker"); int baseX = 595; int baseY = 315; double width = 525d / (satRes + 1); double height = 375d / (valueRes + 1); Rectangle pos = new Rectangle(baseX + s * width, baseY + v * height, 75, 75, resX, resY, true); GuiColor color = new GuiColor(Hue, Saturation, Value, 1); c.addImage("selected", pos, "circle", layer, color, fadeIn, fadeOut); c.display(Player); }
private void SendHueSelector(int i) { GuiContainer c = new GuiContainer(PluginInstance, "HueSelector", "HuePicker"); int baseX = 603; int y = 722; double width = 700d / hueRes; double hueIncrement = 360d / hueRes; Rectangle pos = new Rectangle(baseX + i * width, y, 50, 50, resX, resY, true); GuiColor color = new GuiColor(i * hueIncrement, 1, 1, 1); c.addImage("selected", pos, "circle", layer, color, fadeIn, fadeOut); c.display(Player); }
public void sendCreator(BasePlayer player) { #if DEBUG player.ChatMessage($"sendCreator"); #endif BountyBP bp = new BountyBP(); GuiContainer c = new GuiContainer(this, "bountyCreator"); //template Rectangle templatePos = new Rectangle(623, 26, 673, 854, resX, resY, true); c.addImage("template", templatePos, "bounty_template", GuiContainer.Layer.hud, FadeIn: FadeIn, FadeOut: FadeOut); //targetName Rectangle targetNamePos = new Rectangle(680, 250, 100, 53, resX, resY, true); Rectangle targetNamePosInput = new Rectangle(780, 250, 460, 53, resX, resY, true); c.addText("targetNameHeader", targetNamePos, GuiContainer.Layer.hud, new GuiText("Target:", 20), FadeIn, FadeOut); Action <BasePlayer, string[]> targetNameCB = (p, a) => { if (a.Length < 1) { return; } BasePlayer target = findPlayer(a[0], player); if (target == null) { Effect.server.Run(errorSound, player.transform.position); creatorButton(player, createErrorType.missingTarget, bp); return; } bp.target = target; GuiTracker.getGuiTracker(player).destroyGui(this, c, "targetName"); int fontsize = guiCreator.getFontsizeByFramesize(target.displayName.Length, targetNamePosInput); GuiText targetNameText = new GuiText(target.displayName, fontsize); GuiContainer c2 = new GuiContainer(this, "tfound", "bountyCreator"); c2.addText("targetName", targetNamePosInput, GuiContainer.Layer.hud, targetNameText, FadeIn, FadeOut); c2.display(player); Effect.server.Run(successSound, player.transform.position); //image if (config.showSteamImage) { GetSteamUserData(target.userID, (ps) => { guiCreator.registerImage(this, target.userID.ToString(), ps.avatarfull, () => { Rectangle imagePos = new Rectangle(828, 315, 264, 264, resX, resY, true); GuiContainer c3 = new GuiContainer(this, "image", "bountyCreator"); c3.addImage("image", imagePos, target.userID.ToString(), GuiContainer.Layer.hud, FadeIn: FadeIn, FadeOut: FadeOut); c3.display(player); player.ChatMessage("sent image"); }); }); } }; c.addInput("targetName", targetNamePosInput, targetNameCB, GuiContainer.Layer.hud, panelColor: new GuiColor("white"), text: new GuiText("", 20, new GuiColor("black")), FadeOut: FadeOut, FadeIn: FadeIn); //reward ItemDefinition itemDefinition = ItemManager.FindItemDefinition(config.currency); Rectangle rewardPosInput = new Rectangle(828, 579, 132, 53, resX, resY, true); Rectangle rewardPosCurrency = new Rectangle(970, 579, 122, 53, resX, resY, true); Action <BasePlayer, string[]> rewardCB = (p, a) => { if (a.Length < 1) { return; } int reward = 0; if (!int.TryParse(a[0], out reward)) { Effect.server.Run(errorSound, player.transform.position); creatorButton(player, createErrorType.badReward, bp); return; } if (reward < config.minReward) { Effect.server.Run(errorSound, player.transform.position); creatorButton(player, createErrorType.badReward, bp); return; } if (player.inventory.GetAmount(itemDefinition.itemid) < reward) { Effect.server.Run(errorSound, player.transform.position); creatorButton(player, createErrorType.cantAfford, bp); return; } bp.reward = reward; GuiTracker.getGuiTracker(player).destroyGui(this, c, "reward"); GuiContainer c2 = new GuiContainer(this, "rewardok", "bountyCreator"); c2.addText("reward", rewardPosInput, GuiContainer.Layer.hud, new GuiText(reward.ToString(), 24, align: TextAnchor.MiddleRight), FadeIn, FadeOut); c2.display(player); Effect.server.Run(successSound, player.transform.position); }; c.addInput("reward", rewardPosInput, rewardCB, GuiContainer.Layer.hud, panelColor: new GuiColor("white"), text: new GuiText("", 22, new GuiColor("black")), FadeOut: FadeOut, FadeIn: FadeIn); c.addText("rewardCurrency", rewardPosCurrency, GuiContainer.Layer.hud, new GuiText(itemDefinition.displayName.english, 24, new GuiColor("black"), TextAnchor.MiddleLeft), FadeIn, FadeOut); //reason Rectangle reasonPos = new Rectangle(680, 681, 100, 53, resX, resY, true); Rectangle reasonPosInput = new Rectangle(780, 681, 460, 53, resX, resY, true); c.addText("reasonHeader", reasonPos, GuiContainer.Layer.hud, new GuiText("Reason:", 20), FadeIn, FadeOut); Action <BasePlayer, string[]> reasonCB = (p, a) => { if (a.Length < 1) { return; } StringBuilder sb = new StringBuilder(); foreach (string s in a) { sb.Append($"{s} "); } bp.reason = sb.ToString().Trim(); }; c.addInput("reason", reasonPosInput, reasonCB, GuiContainer.Layer.hud, panelColor: new GuiColor("white"), text: new GuiText("", 14, new GuiColor("black")), FadeOut: FadeOut, FadeIn: FadeIn); //placerName Rectangle placerNamePos = new Rectangle(680, 771, 560, 36, resX, resY, true); GuiText placerNameText = new GuiText(player.displayName, guiCreator.getFontsizeByFramesize(player.displayName.Length, placerNamePos)); c.addText("placerName", placerNamePos, GuiContainer.Layer.hud, placerNameText, FadeIn, FadeOut); //exitButton Rectangle closeButtonPos = new Rectangle(1296, 52, 60, 60, resX, resY, true); c.addButton("close", closeButtonPos, GuiContainer.Layer.hud, darkRed, FadeIn, FadeOut, new GuiText("X", 24, lightRed), blur: GuiContainer.Blur.medium); c.display(player); //button creatorButton(player, bp: bp); }