added challenges theme creator

This commit is contained in:
Asval
2019-08-03 01:21:29 +02:00
parent dceb8ecc90
commit 1440c67b78
12 changed files with 479 additions and 45 deletions

View File

@@ -61,9 +61,6 @@
<setting name="IconLanguage" serializeAs="String">
<value>English</value>
</setting>
<setting name="challengesDebug" serializeAs="String">
<value>False</value>
</setting>
<setting name="challengesWatermark" serializeAs="String">
<value />
</setting>
@@ -91,6 +88,18 @@
<setting name="UMParameters" serializeAs="String">
<value />
</setting>
<setting name="isChallengesTheme" serializeAs="String">
<value>False</value>
</setting>
<setting name="challengesBannerFileName" serializeAs="String">
<value />
</setting>
<setting name="challengesOpacity" serializeAs="String">
<value>1</value>
</setting>
<setting name="challengesColors" serializeAs="String">
<value>50,50,50</value>
</setting>
</FModel.Properties.Settings>
</userSettings>
<runtime>

View File

@@ -252,6 +252,7 @@
<Content Include="DLLs\csharp-wick.dll" />
<Content Include="DLLs\ScintillaNET FindReplaceDialog.dll" />
<Content Include="FModel.ico" />
<None Include="Resources\cTemplate.png" />
<None Include="Resources\LBolt64.png" />
<None Include="Resources\wTemplatev1.png" />
<None Include="Resources\wTemplateFv1.png" />
@@ -280,10 +281,6 @@
<None Include="Resources\reload64.png" />
<None Include="Resources\clipSize64.png" />
<None Include="Resources\dmg64.png" />
<None Include="Resources\Challenges_Slider.png" />
<None Include="Resources\T-Items-MTX-L.png" />
<None Include="Resources\T-FNBR-SeasonalXP-L.png" />
<None Include="Resources\T-FNBR-BattlePoints-L.png" />
<None Include="Resources\BurbankBigCondensed-Black.ttf" />
<None Include="Resources\BurbankBigCondensed-Bold.ttf" />
<None Include="Resources\T-Icon-Pets-64.png" />

View File

@@ -57,7 +57,14 @@ namespace FModel.Forms
this.textBox3 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label7 = new System.Windows.Forms.Label();
this.button4 = new System.Windows.Forms.Button();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.label6 = new System.Windows.Forms.Label();
this.trackBar3 = new System.Windows.Forms.TrackBar();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.groupBox3.SuspendLayout();
@@ -69,6 +76,8 @@ namespace FModel.Forms
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.imgsPerRow)).BeginInit();
this.groupBox6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// groupBox3
@@ -140,9 +149,9 @@ namespace FModel.Forms
//
// OKButton
//
this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OKButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.OKButton.Location = new System.Drawing.Point(475, 434);
this.OKButton.Location = new System.Drawing.Point(475, 546);
this.OKButton.Name = "OKButton";
this.OKButton.Size = new System.Drawing.Size(97, 21);
this.OKButton.TabIndex = 15;
@@ -301,7 +310,7 @@ namespace FModel.Forms
//
// wPictureBox
//
this.wPictureBox.Image = global::FModel.Properties.Resources.wTemplate;
this.wPictureBox.Image = global::FModel.Properties.Resources.wTemplatev1;
this.wPictureBox.Location = new System.Drawing.Point(389, 19);
this.wPictureBox.Name = "wPictureBox";
this.wPictureBox.Size = new System.Drawing.Size(165, 165);
@@ -311,12 +320,13 @@ namespace FModel.Forms
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.checkBoxSaveAsMergeImages);
this.groupBox1.Controls.Add(this.imgsPerRow);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Location = new System.Drawing.Point(12, 375);
this.groupBox1.Location = new System.Drawing.Point(12, 487);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(560, 49);
this.groupBox1.TabIndex = 17;
@@ -377,32 +387,114 @@ namespace FModel.Forms
//
// groupBox6
//
this.groupBox6.Controls.Add(this.button3);
this.groupBox6.Controls.Add(this.button2);
this.groupBox6.Controls.Add(this.label7);
this.groupBox6.Controls.Add(this.button4);
this.groupBox6.Controls.Add(this.checkBox2);
this.groupBox6.Controls.Add(this.label6);
this.groupBox6.Controls.Add(this.trackBar3);
this.groupBox6.Controls.Add(this.pictureBox1);
this.groupBox6.Controls.Add(this.textBox6);
this.groupBox6.Controls.Add(this.label12);
this.groupBox6.Location = new System.Drawing.Point(12, 323);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(560, 46);
this.groupBox6.Size = new System.Drawing.Size(560, 158);
this.groupBox6.TabIndex = 19;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "Challenges";
this.groupBox6.Text = "Challenges Theme";
//
// button3
//
this.button3.Location = new System.Drawing.Point(102, 129);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(94, 23);
this.button3.TabIndex = 26;
this.button3.Text = "Choose Banner";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.Button3_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(199, 129);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(93, 23);
this.button2.TabIndex = 11;
this.button2.Text = "Open Image";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.Button2_Click);
//
// label7
//
this.label7.AutoSize = true;
this.label7.ForeColor = System.Drawing.Color.Red;
this.label7.Location = new System.Drawing.Point(89, 113);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(117, 13);
this.label7.TabIndex = 33;
this.label7.Text = "Banner Size: 1024x256";
//
// button4
//
this.button4.Location = new System.Drawing.Point(6, 129);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(93, 23);
this.button4.TabIndex = 31;
this.button4.Text = "Pick Color";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.Button4_Click);
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(448, 21);
this.checkBox2.Location = new System.Drawing.Point(6, 52);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(105, 17);
this.checkBox2.TabIndex = 27;
this.checkBox2.Text = "Draw Reward ID";
this.checkBox2.Size = new System.Drawing.Size(97, 17);
this.checkBox2.TabIndex = 30;
this.checkBox2.Text = "Custom Theme";
this.checkBox2.UseVisualStyleBackColor = true;
this.checkBox2.CheckedChanged += new System.EventHandler(this.CheckBox2_CheckedChanged);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(6, 82);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(46, 13);
this.label6.TabIndex = 28;
this.label6.Text = "Opacity:";
//
// trackBar3
//
this.trackBar3.Location = new System.Drawing.Point(58, 82);
this.trackBar3.Maximum = 1000;
this.trackBar3.Minimum = 1;
this.trackBar3.Name = "trackBar3";
this.trackBar3.Size = new System.Drawing.Size(234, 45);
this.trackBar3.TabIndex = 27;
this.trackBar3.TickFrequency = 25;
this.trackBar3.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBar3.Value = 1;
this.trackBar3.ValueChanged += new System.EventHandler(this.TrackBar3_ValueChanged);
//
// pictureBox1
//
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Image = global::FModel.Properties.Resources.cTemplate;
this.pictureBox1.Location = new System.Drawing.Point(298, 45);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(256, 107);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 10;
this.pictureBox1.TabStop = false;
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(74, 19);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(359, 20);
this.textBox6.Size = new System.Drawing.Size(480, 20);
this.textBox6.TabIndex = 8;
this.textBox6.TextChanged += new System.EventHandler(this.TextBox6_TextChanged);
//
// label12
//
@@ -417,7 +509,7 @@ namespace FModel.Forms
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 467);
this.ClientSize = new System.Drawing.Size(584, 579);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox4);
@@ -431,6 +523,7 @@ namespace FModel.Forms
this.Name = "Settings";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FModel Settings";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Settings_FormClosing);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);
@@ -445,6 +538,8 @@ namespace FModel.Forms
((System.ComponentModel.ISupportInitialize)(this.imgsPerRow)).EndInit();
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
@@ -476,11 +571,18 @@ namespace FModel.Forms
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.CheckBox checkBox_tryToOpen;
private System.Windows.Forms.CheckBox checkBoxSaveAsMergeImages;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TrackBar trackBar3;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Label label7;
}
}

View File

@@ -1,16 +1,22 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.IO;
using System.Windows.Forms;
using FModel.Properties;
namespace FModel.Forms
{
//refactor asap
public partial class Settings : Form
{
private static string _paKsPathBefore;
private static string _outputPathBefore;
private static string _oldLanguage;
private static Color headerColor;
private static Bitmap bmp;
private static Graphics g;
public Settings()
{
@@ -25,7 +31,6 @@ namespace FModel.Forms
checkBox1.Checked = Properties.Settings.Default.rarityNew;
textBox6.Text = Properties.Settings.Default.challengesWatermark;
checkBox2.Checked = Properties.Settings.Default.challengesDebug;
if (string.IsNullOrWhiteSpace(textBox6.Text))
{
textBox6.Text = "{Bundle_Name} Generated using FModel & JohnWickParse - {Date}";
@@ -50,6 +55,16 @@ namespace FModel.Forms
trackBar1.Value = Properties.Settings.Default.wOpacity;
trackBar2.Value = Properties.Settings.Default.wSize;
button3.Enabled = Properties.Settings.Default.isChallengesTheme;
button4.Enabled = Properties.Settings.Default.isChallengesTheme;
checkBox2.Checked = Properties.Settings.Default.isChallengesTheme;
trackBar3.Enabled = Properties.Settings.Default.isChallengesTheme;
trackBar3.Value = Properties.Settings.Default.challengesOpacity;
string[] colorParts = Properties.Settings.Default.challengesColors.Split(',');
headerColor = Color.FromArgb(255, Int32.Parse(colorParts[0]), Int32.Parse(colorParts[1]), Int32.Parse(colorParts[2]));
if (File.Exists(Properties.Settings.Default.challengesBannerFileName)) { drawChallengeTemplate(headerColor, true); }
else { pictureBox1.Image = Resources.cTemplate; }
//FEATURED
checkBox8.Checked = Properties.Settings.Default.loadFeaturedImage;
if (File.Exists(Properties.Settings.Default.wFilename))
@@ -101,8 +116,10 @@ namespace FModel.Forms
MessageBox.Show(@"Please, restart FModel to apply your new output path", @"FModel Output Path Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
Properties.Settings.Default.challengesDebug = checkBox2.Checked;
Properties.Settings.Default.challengesWatermark = textBox6.Text;
Properties.Settings.Default.isChallengesTheme = checkBox2.Checked;
Properties.Settings.Default.challengesOpacity = trackBar3.Value;
Properties.Settings.Default.challengesColors = headerColor.R + "," + headerColor.G + "," + headerColor.B;
Properties.Settings.Default.tryToOpenAssets = checkBox_tryToOpen.Checked;
@@ -129,6 +146,7 @@ namespace FModel.Forms
}
Properties.Settings.Default.Save(); //SAVE
bmp.Dispose();
Close();
}
@@ -256,5 +274,181 @@ namespace FModel.Forms
wPictureBox.Image = bmp;
}
}
private void Button2_Click(object sender, EventArgs e)
{
if (pictureBox1.Image != null)
{
var newForm = new Form();
PictureBox pb = new PictureBox();
pb.Dock = DockStyle.Fill;
pb.Image = pictureBox1.Image;
pb.SizeMode = PictureBoxSizeMode.Zoom;
newForm.Size = pictureBox1.Image.Size;
newForm.Icon = Resources.FModel;
newForm.Text = ThePak.CurrentUsedItem;
newForm.StartPosition = FormStartPosition.CenterScreen;
newForm.Controls.Add(pb);
newForm.Show();
}
}
private void CheckBox2_CheckedChanged(object sender, EventArgs e)
{
button3.Enabled = checkBox2.Checked;
button4.Enabled = checkBox2.Checked;
trackBar3.Enabled = checkBox2.Checked;
if (!checkBox2.Checked)
{
pictureBox1.Image = Resources.cTemplate;
}
else { drawChallengeTemplate(headerColor, File.Exists(Properties.Settings.Default.challengesBannerFileName)); }
}
private void Button4_Click(object sender, EventArgs e)
{
ColorDialog MyDialog = new ColorDialog();
MyDialog.FullOpen = true;
MyDialog.AnyColor = true;
if (MyDialog.ShowDialog() == DialogResult.OK)
{
headerColor = MyDialog.Color;
drawChallengeTemplate(headerColor, File.Exists(Properties.Settings.Default.challengesBannerFileName));
}
MyDialog.Dispose();
}
private void drawChallengeTemplate(Color headerColor, bool isBanner = false)
{
bmp = new Bitmap(1024, 410);
g = Graphics.FromImage(bmp);
g.TextRenderingHint = TextRenderingHint.AntiAlias;
g.SmoothingMode = SmoothingMode.HighQuality;
#region header
if (isBanner)
{
if (File.Exists(Properties.Settings.Default.challengesBannerFileName))
{
g.FillRectangle(new SolidBrush(headerColor), new Rectangle(0, 0, bmp.Width, 256));
Image banner = Image.FromFile(Properties.Settings.Default.challengesBannerFileName);
var opacityImage = ImageUtilities.SetImageOpacity(banner, (float)trackBar3.Value / 1000);
g.DrawImage(ImageUtilities.ResizeImage(opacityImage, 1024, 256), 0, 0);
}
}
else
{
g.FillRectangle(new SolidBrush(headerColor), new Rectangle(0, 0, bmp.Width, 256));
}
GraphicsPath gp = new GraphicsPath();
gp.StartFigure();
gp.AddLine(0, 256, bmp.Width, 256);
gp.AddLine(bmp.Width, 256, bmp.Width, 241);
gp.AddLine(bmp.Width, 241, bmp.Width / 2 + 25, 236);
gp.AddLine(bmp.Width / 2 + 25, 236, bmp.Width / 2 + 35, 249);
gp.AddLine(bmp.Width / 2 + 35, 249, 0, 241);
gp.CloseFigure();
g.FillPath(new SolidBrush(ControlPaint.Light(headerColor)), gp);
GraphicsPath p = new GraphicsPath();
Pen myPen = new Pen(ControlPaint.Light(headerColor, (float)0.2), 3);
myPen.LineJoin = LineJoin.Round; //needed to avoid spikes
p.AddString(
"{LAST FOLDER HERE}",
Properties.Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1],
(int)FontStyle.Regular, 30,
new Point(30, 70),
FontUtilities.leftString
);
g.DrawPath(myPen, p);
g.FillPath(new SolidBrush(ControlPaint.Dark(headerColor, (float)0.05)), p);
g.DrawString("{BUNDLE DISPLAY NAME HERE}", new Font(Properties.Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1], 40), new SolidBrush(Color.White), new Point(25, 105));
g.FillRectangle(new SolidBrush(ControlPaint.Dark(headerColor, (float)0.1)), new Rectangle(0, 256, bmp.Width, bmp.Height));
#endregion
#region quest background
int theY = 290;
g.FillRectangle(new SolidBrush(Color.FromArgb(50, headerColor.R, headerColor.G, headerColor.B)), new Rectangle(25, theY, bmp.Width - 50, 70));
gp = new GraphicsPath();
gp.StartFigure();
gp.AddLine(32, theY + 5, 29, theY + 67);
gp.AddLine(29, theY + 67, bmp.Width - 160, theY + 62);
gp.AddLine(bmp.Width - 160, theY + 62, bmp.Width - 150, theY + 4);
gp.CloseFigure();
g.FillPath(new SolidBrush(Color.FromArgb(50, headerColor.R, headerColor.G, headerColor.B)), gp);
g.FillRectangle(new SolidBrush(headerColor), new Rectangle(60, theY + 47, 500, 7));
gp = new GraphicsPath();
gp.StartFigure();
gp.AddLine(39, theY + 35, 45, theY + 32);
gp.AddLine(45, theY + 32, 48, theY + 37);
gp.AddLine(48, theY + 37, 42, theY + 40);
gp.CloseFigure();
g.FillPath(new SolidBrush(headerColor), gp);
#endregion
#region watermark
string text = textBox6.Text;
if (string.IsNullOrWhiteSpace(text))
{
text = "{Bundle_Name} Generated using FModel & JohnWickParse - {Date}";
}
if (text.Contains("{Bundle_Name}"))
{
text = text.Replace("{Bundle_Name}", "{BUNDLE DISPLAY NAME HERE}");
}
if (text.Contains("{Date}"))
{
text = text.Replace("{Date}", DateTime.Now.ToString("dd/MM/yyyy"));
}
g.DrawString(text, new Font(FontUtilities.pfc.Families[0], 15), new SolidBrush(Color.FromArgb(150, 255, 255, 255)), new Point(bmp.Width - 10, 210), FontUtilities.rightString);
#endregion
pictureBox1.Image = bmp;
}
private void Button3_Click(object sender, EventArgs e)
{
OpenFileDialog theDialog = new OpenFileDialog();
theDialog.Title = @"Choose your banner";
theDialog.Multiselect = false;
theDialog.Filter = @"PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg|DDS Files (*.dds)|*.dds|All Files (*.*)|*.*";
if (theDialog.ShowDialog() == DialogResult.OK)
{
Properties.Settings.Default.challengesBannerFileName = theDialog.FileName;
Properties.Settings.Default.Save();
drawChallengeTemplate(headerColor, File.Exists(Properties.Settings.Default.challengesBannerFileName));
}
}
private void TrackBar3_ValueChanged(object sender, EventArgs e)
{
drawChallengeTemplate(headerColor, File.Exists(Properties.Settings.Default.challengesBannerFileName));
pictureBox1.Refresh();
}
private void TextBox6_TextChanged(object sender, EventArgs e)
{
drawChallengeTemplate(headerColor, File.Exists(Properties.Settings.Default.challengesBannerFileName));
}
private void Settings_FormClosing(object sender, FormClosingEventArgs e)
{
bmp.Dispose();
}
}
}

View File

@@ -165,13 +165,13 @@ namespace FModel
}
await Task.Run(() => {
FontUtilities.SetFont();
Utilities.SetOutputFolder();
FillWithPaKs();
AddToUI.checkAndAddDynamicKeys();
Utilities.colorMyPaks(loadOneToolStripMenuItem);
Utilities.SetFolderPermission(App.DefaultOutputPath);
Utilities.CreateDefaultFolders();
FontUtilities.SetFont();
});
MyScintilla.SetScintillaStyle(scintilla1);

View File

@@ -14,7 +14,7 @@ namespace FModel
public static int theY { get; set; }
public static Graphics toDrawOn { get; set; }
public static JToken myItem { get; set; }
public static Color headerColor { get; set; }
private static Color headerColor { get; set; }
/// <summary>
/// get a random color in case DisplayStyle doesn't exist in drawBackground()
@@ -52,7 +52,15 @@ namespace FModel
JToken displayStyle = myBundle["DisplayStyle"];
if (displayStyle != null)
{
headerColor = BundleInfos.getSecondaryColor(myBundle);
if (Settings.Default.isChallengesTheme)
{
string[] colorParts = Settings.Default.challengesColors.Split(',');
headerColor = Color.FromArgb(255, Int32.Parse(colorParts[0]), Int32.Parse(colorParts[1]), Int32.Parse(colorParts[2]));
}
else
{
headerColor = BundleInfos.getSecondaryColor(myBundle);
}
JToken customBackground = displayStyle["CustomBackground"];
JToken displayImage = displayStyle["DisplayImage"];
@@ -70,8 +78,22 @@ namespace FModel
{
challengeIcon = new Bitmap(bmpTemp);
}
toDrawOn.DrawImage(challengeIcon, new Point(0, 0));
toDrawOn.FillRectangle(new SolidBrush(Color.FromArgb(175, headerColor.R, headerColor.G, headerColor.B)), new Rectangle(0, 0, myBitmap.Width, 256));
toDrawOn.FillRectangle(new SolidBrush(headerColor), new Rectangle(0, 0, myBitmap.Width, 256));
if (Settings.Default.isChallengesTheme)
{
if (File.Exists(Settings.Default.challengesBannerFileName))
{
Image banner = Image.FromFile(Settings.Default.challengesBannerFileName);
var opacityImage = ImageUtilities.SetImageOpacity(banner, (float)Settings.Default.challengesOpacity / 1000);
toDrawOn.DrawImage(ImageUtilities.ResizeImage(opacityImage, 1024, 256), 0, 0);
}
}
else
{
var opacityImage = ImageUtilities.SetImageOpacity(challengeIcon, (float)0.3);
toDrawOn.DrawImage(opacityImage, new Point(0, 0));
}
}
}
}
@@ -88,14 +110,59 @@ namespace FModel
{
challengeIcon = new Bitmap(bmpTemp);
}
toDrawOn.FillRectangle(new SolidBrush(headerColor), new Rectangle(0, 0, myBitmap.Width, 256));
if (Settings.Default.isChallengesTheme)
{
if (File.Exists(Settings.Default.challengesBannerFileName))
{
Image banner = Image.FromFile(Settings.Default.challengesBannerFileName);
var opacityImage = ImageUtilities.SetImageOpacity(banner, (float)Settings.Default.challengesOpacity / 1000);
toDrawOn.DrawImage(ImageUtilities.ResizeImage(opacityImage, 1024, 256), 0, 0);
}
}
toDrawOn.DrawImage(ImageUtilities.ResizeImage(challengeIcon, 256, 256), new Point(0, 0));
}
}
else { toDrawOn.FillRectangle(new SolidBrush(headerColor), new Rectangle(0, 0, myBitmap.Width, 256)); }
else
{
toDrawOn.FillRectangle(new SolidBrush(headerColor), new Rectangle(0, 0, myBitmap.Width, 256));
if (Settings.Default.isChallengesTheme)
{
if (File.Exists(Settings.Default.challengesBannerFileName))
{
Image banner = Image.FromFile(Settings.Default.challengesBannerFileName);
var opacityImage = ImageUtilities.SetImageOpacity(banner, (float)Settings.Default.challengesOpacity / 1000);
toDrawOn.DrawImage(ImageUtilities.ResizeImage(opacityImage, 1024, 256), 0, 0);
}
}
}
}
}
else
{
if (Settings.Default.isChallengesTheme)
{
string[] colorParts = Settings.Default.challengesColors.Split(',');
headerColor = Color.FromArgb(255, Int32.Parse(colorParts[0]), Int32.Parse(colorParts[1]), Int32.Parse(colorParts[2]));
}
else
{
headerColor = getRandomColor();
}
toDrawOn.FillRectangle(new SolidBrush(headerColor), new Rectangle(0, 0, myBitmap.Width, 256));
if (Settings.Default.isChallengesTheme)
{
if (File.Exists(Settings.Default.challengesBannerFileName))
{
Image banner = Image.FromFile(Settings.Default.challengesBannerFileName);
var opacityImage = ImageUtilities.SetImageOpacity(banner, (float)Settings.Default.challengesOpacity / 1000);
toDrawOn.DrawImage(ImageUtilities.ResizeImage(opacityImage, 1024, 256), 0, 0);
}
}
}
else { headerColor = getRandomColor(); toDrawOn.FillRectangle(new SolidBrush(headerColor), new Rectangle(0, 0, myBitmap.Width, 256)); }
GraphicsPath gp = new GraphicsPath();
gp.StartFigure();
@@ -160,7 +227,7 @@ namespace FModel
JToken bundleCompletionRewards = myBundle["BundleCompletionRewards"];
if (bundleCompletionRewards != null)
{
theY += 50;
theY += 35;
JArray bundleCompletionRewardsArray = bundleCompletionRewards.Value<JArray>();
foreach (JToken token in bundleCompletionRewardsArray)
{

View File

@@ -187,6 +187,13 @@ namespace FModel
Properties.Settings.Default.UMFilename = string.Empty;
Properties.Settings.Default.UMWatermark = false;
}
if (!string.IsNullOrEmpty(Properties.Settings.Default.challengesBannerFileName) &&
!File.Exists(Properties.Settings.Default.challengesBannerFileName))
{
Properties.Settings.Default.challengesBannerFileName = string.Empty;
Properties.Settings.Default.isChallengesTheme = false;
}
}
}
}

View File

@@ -140,6 +140,16 @@ namespace FModel.Properties {
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap cTemplate {
get {
object obj = ResourceManager.GetObject("cTemplate", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>

View File

@@ -241,4 +241,7 @@
<data name="wTemplatev1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\wTemplatev1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="cTemplate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cTemplate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -227,18 +227,6 @@ namespace FModel.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool challengesDebug {
get {
return ((bool)(this["challengesDebug"]));
}
set {
this["challengesDebug"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
@@ -346,5 +334,53 @@ namespace FModel.Properties {
this["UMParameters"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool isChallengesTheme {
get {
return ((bool)(this["isChallengesTheme"]));
}
set {
this["isChallengesTheme"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string challengesBannerFileName {
get {
return ((string)(this["challengesBannerFileName"]));
}
set {
this["challengesBannerFileName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("1")]
public int challengesOpacity {
get {
return ((int)(this["challengesOpacity"]));
}
set {
this["challengesOpacity"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("50,50,50")]
public string challengesColors {
get {
return ((string)(this["challengesColors"]));
}
set {
this["challengesColors"] = value;
}
}
}
}

View File

@@ -53,9 +53,6 @@
<Setting Name="IconLanguage" Type="System.String" Scope="User">
<Value Profile="(Default)">English</Value>
</Setting>
<Setting Name="challengesDebug" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="challengesWatermark" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
@@ -83,5 +80,17 @@
<Setting Name="UMParameters" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="isChallengesTheme" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="challengesBannerFileName" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="challengesOpacity" Type="System.Int32" Scope="User">
<Value Profile="(Default)">1</Value>
</Setting>
<Setting Name="challengesColors" Type="System.String" Scope="User">
<Value Profile="(Default)">50,50,50</Value>
</Setting>
</Settings>
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB