/// Display an error message to the user, related to an action taken
/// by the specified controller.
public static void Error(InputManager.ControllerName controller,
string msg,
System.Object detail = null)
{
// If our singleton instances haven't been assigned, defer the error.
if (m_Instance == null || ControllerConsoleScript.m_Instance == null)
{
DeferError(controller, msg, detail);
}
else
{
Debug.LogErrorFormat("User-visible error: {0}\nDetail: {1}", msg, detail);
// In the future, maybe use color or something instead of prepending ERROR
string card = string.Format("ERROR: {0}", msg);
float cardPop = 1.0f + InfoCardAnimation.s_NumCards * 0.2f;
m_Instance.CreateInfoCardAtController(controller, card, cardPop, false);
ControllerConsoleScript.m_Instance.AddNewLine(msg, true);
if (detail != null)
{
string detailStr = detail.ToString();
if (detailStr.Length > CONTROLLER_DETAIL_MAX_LENGTH)
{
detailStr = detailStr.Substring(0, CONTROLLER_DETAIL_MAX_LENGTH - 3) + " ...";
}
ControllerConsoleScript.m_Instance.AddNewLine(detailStr, false);
}
}
}
/// Display an error message to the user, related to an action taken
/// by the specified controller.
public static void Error(InputManager.ControllerName controller,
string msg,
System.Object detail = null)
{
// If our singleton instances haven't been assigned, defer the error.
if (m_Instance == null || ControllerConsoleScript.m_Instance == null)
{
DeferError(controller, msg, detail);
}
else
{
Debug.LogErrorFormat("User-visible error: {0}\nDetail: {1}", msg, detail);
// In the future, maybe use color or something instead of prepending ERROR
string card = string.Format("ERROR: {0}", msg);
float cardPop = 1.0f + InfoCardAnimation.s_NumCards * 0.2f;
m_Instance.CreateInfoCardAtController(controller, card, cardPop, false);
ControllerConsoleScript.m_Instance.AddNewLine(msg, true);
if (detail != null)
{
string detailStr = detail.ToString();
if (detailStr.Length > CONTROLLER_DETAIL_MAX_LENGTH)
{
detailStr = detailStr.Substring(0, CONTROLLER_DETAIL_MAX_LENGTH - 3) + " ...";
}
ControllerConsoleScript.m_Instance.AddNewLine(detailStr, false);
}
}
}