public void DisplayQuestDetails()
{
// early out if not visible
if (!isDetailsflyoutVisible) {
return;
}
GUILayout.BeginArea(detailsBox, Styles.roundDarkBox); {
if (m_currentlySelectedQuest == null) {
GUILayout.Label("No quest selected.", Styles.largeTextLight);
}
else {
// title
GUILayout.BeginHorizontal(); {
GUILayout.Label(m_currentlySelectedQuest.Name, Styles.largeTextLight);
GUILayout.FlexibleSpace();
GUILayout.Label(string.Format("({0} QP)", m_currentlySelectedQuest.PointValue), Styles.largeTextHighlighted);
} GUILayout.EndHorizontal();
Styles.DrawLine(
GUIStyles.LineDirection.Horizontal,
GUIStyles.LineColor.Highlighted
);
// progress
GUILayout.BeginHorizontal(); {
GUILayout.Label (string.Format("Progress: {0:0%}", m_currentlySelectedQuest.Progress), Styles.mediumTextLight);
GUILayout.Box("", Styles.roundDarkBox, GUILayout.Width(200f), GUILayout.Height(20f));
if (Event.current.type == EventType.Repaint) {
m_progressBarBackground = GUILayoutUtility.GetLastRect();
}
Rect fill = m_progressBarBackground;
fill.x += Styles.roundDarkBox.padding.left;
fill.y += Styles.roundDarkBox.padding.top;
fill.height -= Styles.roundDarkBox.padding.top + Styles.roundDarkBox.padding.bottom;
fill.width = (fill.width-Styles.roundDarkBox.padding.top-Styles.roundDarkBox.padding.bottom);
fill.width *= m_currentlySelectedQuest.Progress;
GUI.DrawTexture(fill, progressBarFillTex);
} GUILayout.EndHorizontal();
// description
GUILayout.BeginHorizontal(); {
GUILayout.Label ("Description: ", Styles.mediumTextLight);
m_questDescriptionScrollPosition = GUILayout.BeginScrollView(
m_questDescriptionScrollPosition,
GUILayout.Width(m_progressBarBackground.width)
); {
GUILayout.Label(m_currentlySelectedQuest.Description, Styles.mediumTextLight);
} GUILayout.EndScrollView();
} GUILayout.EndHorizontal();
// objectives
Styles.DrawLine(
GUIStyles.LineDirection.Horizontal,
GUIStyles.LineColor.Medium
);
GUILayout.Label("Objectives:", Styles.mediumTextLight);
System.Collections.Generic.List<IObjective> objectives = m_currentlySelectedQuest.GetObjectives();
GUILayout.BeginHorizontal(); {
m_objectivesBoxScrollPosition = GUILayout.BeginScrollView(
m_objectivesBoxScrollPosition,
false, true,
GUILayout.Width(detailsBox.width*0.5f)
); {
for (int i=0; i<objectives.Count; ++i) {
GUILayout.BeginHorizontal(); {
// completion icon
GUILayout.Box(
objectives[i].IsComplete()?completeIcon:incompleteIcon,
Styles.empty4,
GUILayout.Width(m_completionIconSize), GUILayout.Height(m_completionIconSize)
);
// selector button
if (GUILayout.Button(
objectives[i].Name,
m_currentlySelectedObjectiveIndex==i?Styles.smallButtonFocused:Styles.smallButton)
) {
m_currentlySelectedObjectiveIndex = i;
}
} GUILayout.EndHorizontal();
}
} GUILayout.EndScrollView();
// objective description
GUILayout.Label(objectives[m_currentlySelectedObjectiveIndex].Description, Styles.mediumTextLight);
} GUILayout.EndHorizontal();
}
}
GUILayout.EndArea();
}