private static bool CanDebug(LogType type, DebugLocation where) { if (GameService.DebugConfiguration == null) { return(false); } var can = false; switch (type) { case LogType.Normal: if (GameService.DebugConfiguration.EnableDebug) { can = true; } break; case LogType.Error: if (GameService.DebugConfiguration.EnableError) { can = true; } break; case LogType.Exception: if (GameService.DebugConfiguration.EnableException) { can = true; } break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } if (GameService.DebugConfiguration.DebugLocations == null) { return(can); } if (GameService.DebugConfiguration.DebugLocations.Contains(DebugLocation.All)) { return(can); } can &= GameService.DebugConfiguration.DebugLocations.ToList().Any(dl => dl == where); return(can); }
internal static void LogError(Type type, DebugLocation where, string callingMethod, Exception exception) { if (!CanDebug(LogType.Error, where)) { return; } var callingClass = type.Name; new Debug { LogTypeType = LogType.Error, Where = where, Data = GetTime() + " - [" + callingClass + ".cs" + " ▶ " + LogType.Error + " F:" + callingMethod + "] : " + exception }.Invoke(); }
internal static void LogError <TClass>(DebugLocation where, string callingMethod, string data) { if (!CanDebug(LogType.Error, where)) { return; } var callingClass = typeof(TClass).Name; new Debug { LogTypeType = LogType.Error, Where = where, Data = GetTime() + " - [" + callingClass + ".cs" + " ▶ " + LogType.Error + " F:" + callingMethod + "] : " + data }.Invoke(); }
internal static void LogNormal(Type type, DebugLocation where, string callingMethod, string data) { if (!CanDebug(LogType.Normal, where)) { return; } var callingClass = type.Name; new Debug { LogTypeType = LogType.Normal, Where = where, Data = GetTime() + " - [" + callingClass + ".cs" + " ▶ " + LogType.Normal + " F:" + callingMethod + "] : " + data }.Invoke(); }
internal static Exception LogException(this Exception exception, Type type, DebugLocation where, string callingMethod) { if (!CanDebug(LogType.Exception, where)) { return(exception); } var callingClass = type.Name; new Debug { LogTypeType = LogType.Exception, Exception = exception, Where = where, Data = GetTime() + " - [" + callingClass + ".cs" + " ▶ " + LogType.Exception + " F:" + callingMethod + "] : " + exception.Message }.Invoke(); return(exception); }
void WarpTo(DebugLocation loc) { if (!Application.isMobilePlatform) { if (m_debugCoords.ContainsKey(loc)) { SystemPositionService.Instance.DebugSetPosition(m_debugCoords[loc]); } if (MapController) { MapController.CenterMap(); } } m_currLocation = loc; #if DEBUG if (UseAnchorPosition) { UserLocationService.Instance.AnchorPosition = m_debugCoords[loc]; } #endif }