add tooltip for stats

tip for stats name(show long name), stats value(seconds, show how long it means)
This commit is contained in:
pokecal
2017-03-13 14:28:06 +09:00
parent 5cf36df360
commit 1e4c4b8f53

View File

@@ -40,7 +40,7 @@ public SAV_Trainer7()
Loading = false;
}
private readonly ToolTip Tip1 = new ToolTip(), Tip2 = new ToolTip();
private readonly ToolTip Tip1 = new ToolTip(), Tip2 = new ToolTip(), Tip3 = new ToolTip();
private readonly bool Loading;
private bool MapUpdated;
private bool editing;
@@ -391,6 +391,7 @@ private void changeStat(object sender, EventArgs e)
int offset = SAV.getRecordOffset(index);
L_Offset.Text = "Offset: 0x" + offset.ToString("X3");
updateTip(index, true);
editing = false;
}
private void changeStatVal(object sender, EventArgs e)
@@ -398,6 +399,38 @@ private void changeStatVal(object sender, EventArgs e)
if (editing) return;
int index = CB_Stats.SelectedIndex;
SAV.setRecord(index, (int)NUD_Stat.Value);
updateTip(index, false);
}
private void updateTip(int index, bool updateStats)
{
switch (index)
{
case 2: // Storyline Completed Time
int seconds = (int)(CAL_AdventureStartDate.Value - new DateTime(2000, 1, 1)).TotalSeconds;
seconds -= seconds % 86400;
seconds += (int)(CAL_AdventureStartTime.Value - new DateTime(2000, 1, 1)).TotalSeconds;
Tip3.SetToolTip(NUD_Stat, dateval2str(SAV.getRecord(index), seconds));
break;
default:
Tip3.RemoveAll();
break;
}
if (updateStats)
{
string tip = "";
if (RecordList.TryGetValue(index, out tip))
Tip3.SetToolTip(CB_Stats, tip);
}
}
private string dateval2str(int value, int refval = -1)
{
string tip = "";
if (value >= 86400)
tip += (value / 86400) + "d ";
tip += new DateTime(0).AddSeconds(value).ToString("HH:mm:ss");
if (refval >= 0)
tip += Environment.NewLine + "Date: " + new DateTime(2000, 1, 1).AddSeconds(refval + value).ToString();
return tip;
}
private void B_GenTID_Click(object sender, EventArgs e)