-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored some things, added a new mode for solid color uncollected …
…items, fixed some bugs. Testing still needed.
- Loading branch information
1 parent
561d2f6
commit f9e7649
Showing
90 changed files
with
4,628 additions
and
2,737 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
namespace LMRItemTracker | ||
{ | ||
class ItemTextPanel : System.Windows.Forms.Panel | ||
{ | ||
private static System.Drawing.Size NO_AMMO_HEIGHT = new System.Drawing.Size(40, 40); | ||
private static System.Drawing.Size AMMO_HEIGHT = new System.Drawing.Size(40, 56); | ||
|
||
public TrackerBox Item { get; set; } | ||
public TrackerLabel Label { get; set; } | ||
public bool TreatAsAmmo { get; set; } | ||
|
||
public ItemTextPanel() | ||
{ | ||
Item = null; | ||
Label = null; | ||
TreatAsAmmo = false; | ||
} | ||
|
||
public void UpdateCount(bool isAdd) | ||
{ | ||
Label.UpdateCount(Label.Count + (isAdd ? 1 : -1)); | ||
Redraw(); | ||
} | ||
|
||
public void UpdateCount(int newCount) | ||
{ | ||
Label.UpdateCount(newCount); | ||
Redraw(); | ||
} | ||
|
||
public void ToggleState(bool isAdd) | ||
{ | ||
Item.ToggleState(isAdd); | ||
Redraw(); | ||
} | ||
|
||
public void Redraw() | ||
{ | ||
if (InvokeRequired) | ||
{ | ||
Invoke(new System.Action(() => | ||
{ | ||
UpdatePanel(); | ||
Item.Redraw(); | ||
Refresh(); | ||
})); | ||
} | ||
else | ||
{ | ||
UpdatePanel(); | ||
Item.Redraw(); | ||
Refresh(); | ||
} | ||
|
||
} | ||
|
||
private void UpdatePanel() | ||
{ | ||
if (TreatAsAmmo && !Properties.Settings.Default.ShowAmmoCount) | ||
{ | ||
Size = NO_AMMO_HEIGHT; | ||
} | ||
else if (Item.Collected) | ||
{ | ||
Size = AMMO_HEIGHT; | ||
Label.Visible = true; | ||
} | ||
else if (!"hide".Equals(Properties.Settings.Default.BackgroundMode)) | ||
{ | ||
Size = AMMO_HEIGHT; | ||
Label.Visible = !TreatAsAmmo; | ||
} | ||
else | ||
{ | ||
Size = NO_AMMO_HEIGHT; | ||
} | ||
|
||
if (!Item.Collected && "hide".Equals(Properties.Settings.Default.BackgroundMode)) | ||
{ | ||
Visible = false; | ||
} | ||
else | ||
{ | ||
Visible = true; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
using System; | ||
|
||
namespace LMRItemTracker | ||
{ | ||
class KeyFairyTrackerBox : System.Windows.Forms.PictureBox | ||
{ | ||
private bool miracleCollected; | ||
private bool mekuriCollected; | ||
|
||
public KeyFairyTrackerBox() | ||
{ | ||
miracleCollected = false; | ||
mekuriCollected = false; | ||
|
||
Paint += new System.Windows.Forms.PaintEventHandler(HandlePaint); | ||
} | ||
|
||
public void ToggleState(bool isCollected, bool isMiracle) | ||
{ | ||
if(isMiracle) | ||
{ | ||
miracleCollected = isCollected; | ||
} | ||
else | ||
{ | ||
mekuriCollected = isCollected; | ||
} | ||
Redraw(); | ||
} | ||
|
||
protected virtual void DetermineImage() | ||
{ | ||
if (miracleCollected && mekuriCollected) | ||
{ | ||
BackgroundImage = Properties.Resources.Icon_keyfairy; | ||
} | ||
else | ||
{ | ||
string mode = Properties.Settings.Default.BackgroundMode; | ||
if ("shaded".Equals(mode)) | ||
{ | ||
BackgroundImage = Properties.Resources.Icon_keyfairy_blank; | ||
} | ||
else if ("solid".Equals(mode)) | ||
{ | ||
BackgroundImage = Properties.Resources.Icon_keyfairy_solid; | ||
} | ||
else | ||
{ | ||
BackgroundImage = null; | ||
} | ||
} | ||
|
||
Visible = !"hide".Equals(Properties.Settings.Default.BackgroundMode) || (miracleCollected && mekuriCollected); | ||
} | ||
|
||
public void Redraw() | ||
{ | ||
if (InvokeRequired) | ||
{ | ||
Invoke(new System.Action(() => | ||
{ | ||
DetermineImage(); | ||
Refresh(); | ||
})); | ||
} | ||
else | ||
{ | ||
DetermineImage(); | ||
Refresh(); | ||
} | ||
} | ||
|
||
private void HandlePaint(object sender, System.Windows.Forms.PaintEventArgs e) | ||
{ | ||
if (InvokeRequired) | ||
{ | ||
Invoke(new Action(() => | ||
{ | ||
UpdateImage(e); | ||
})); | ||
} | ||
else | ||
{ | ||
UpdateImage(e); | ||
} | ||
} | ||
|
||
private void UpdateImage(System.Windows.Forms.PaintEventArgs e) | ||
{ | ||
if (!miracleCollected && !mekuriCollected && "solid".Equals(Properties.Settings.Default.BackgroundMode)) | ||
{ | ||
e.Graphics.Clear(Properties.Settings.Default.BackgroundColor); | ||
System.Drawing.Imaging.ImageAttributes imageAttributes = new System.Drawing.Imaging.ImageAttributes(); | ||
System.Drawing.Imaging.ColorMatrix colorMatrix = new System.Drawing.Imaging.ColorMatrix( | ||
new float[][]{ | ||
new float[] {0, 0, 0, 0, 0}, | ||
new float[] {0, 0, 0, 0, 0}, | ||
new float[] {0, 0, 0, 0, 0}, | ||
new float[] {0, 0, 0, 1, 0}, | ||
new float[] {Properties.Settings.Default.ItemColor.R / 255.0f, | ||
Properties.Settings.Default.ItemColor.G / 255.0f, | ||
Properties.Settings.Default.ItemColor.B / 255.0f, | ||
0, 1} | ||
}); | ||
|
||
imageAttributes.SetColorMatrix(colorMatrix); | ||
e.Graphics.DrawImage(Properties.Resources.Icon_keysword_solid, new System.Drawing.Rectangle(0, 0, 40, 40), 0, 0, 40, 40, System.Drawing.GraphicsUnit.Pixel, imageAttributes); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
using System; | ||
|
||
namespace LMRItemTracker | ||
{ | ||
class KeySwordTrackerBox : System.Windows.Forms.PictureBox | ||
{ | ||
private bool keySwordCollected; | ||
private bool mantrasRecited; | ||
|
||
public KeySwordTrackerBox() | ||
{ | ||
keySwordCollected = false; | ||
mantrasRecited = false; | ||
|
||
Paint += new System.Windows.Forms.PaintEventHandler(HandlePaint); | ||
} | ||
|
||
public void ToggleState(bool isCollected, bool isKeySword) | ||
{ | ||
if(isKeySword) | ||
{ | ||
keySwordCollected = isCollected; | ||
} | ||
else | ||
{ | ||
mantrasRecited = isCollected; | ||
} | ||
Redraw(); | ||
} | ||
|
||
public void Redraw() | ||
{ | ||
if (InvokeRequired) | ||
{ | ||
Invoke(new Action(() => | ||
{ | ||
DetermineImage(); | ||
Refresh(); | ||
})); | ||
} | ||
else | ||
{ | ||
DetermineImage(); | ||
Refresh(); | ||
} | ||
} | ||
|
||
private void DetermineImage() | ||
{ | ||
if (keySwordCollected && mantrasRecited) | ||
{ | ||
BackgroundImage = Properties.Resources.Icon_keysword_awakened; | ||
} | ||
else if (keySwordCollected) | ||
{ | ||
BackgroundImage = Properties.Resources.Icon_keysword; | ||
} | ||
else | ||
{ | ||
string mode = Properties.Settings.Default.BackgroundMode; | ||
if ("shaded".Equals(mode)) | ||
{ | ||
BackgroundImage = Properties.Resources.Icon_keysword_blank; | ||
} | ||
else if ("solid".Equals(mode)) | ||
{ | ||
BackgroundImage = Properties.Resources.Icon_keysword_solid; | ||
} | ||
else | ||
{ | ||
BackgroundImage = null; | ||
} | ||
} | ||
|
||
Visible = !"hide".Equals(Properties.Settings.Default.BackgroundMode) || keySwordCollected; | ||
} | ||
|
||
private void HandlePaint(object sender, System.Windows.Forms.PaintEventArgs e) | ||
{ | ||
if (InvokeRequired) | ||
{ | ||
Invoke(new Action(() => | ||
{ | ||
UpdateImage(e); | ||
})); | ||
} | ||
else | ||
{ | ||
UpdateImage(e); | ||
} | ||
} | ||
|
||
private void UpdateImage(System.Windows.Forms.PaintEventArgs e) | ||
{ | ||
if (!keySwordCollected && "solid".Equals(Properties.Settings.Default.BackgroundMode)) | ||
{ | ||
e.Graphics.Clear(Properties.Settings.Default.BackgroundColor); | ||
System.Drawing.Imaging.ImageAttributes imageAttributes = new System.Drawing.Imaging.ImageAttributes(); | ||
System.Drawing.Imaging.ColorMatrix colorMatrix = new System.Drawing.Imaging.ColorMatrix( | ||
new float[][]{ | ||
new float[] {0, 0, 0, 0, 0}, | ||
new float[] {0, 0, 0, 0, 0}, | ||
new float[] {0, 0, 0, 0, 0}, | ||
new float[] {0, 0, 0, 1, 0}, | ||
new float[] {Properties.Settings.Default.ItemColor.R / 255.0f, | ||
Properties.Settings.Default.ItemColor.G / 255.0f, | ||
Properties.Settings.Default.ItemColor.B / 255.0f, | ||
0, 1} | ||
}); | ||
|
||
imageAttributes.SetColorMatrix(colorMatrix); | ||
e.Graphics.DrawImage(Properties.Resources.Icon_keysword_solid, new System.Drawing.Rectangle(0, 0, 40, 40), 0, 0, 40, 40, System.Drawing.GraphicsUnit.Pixel, imageAttributes); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.