OpcodeHelper.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System.Collections.Generic;
  2. namespace ET
  3. {
  4. public static class OpcodeHelper
  5. {
  6. private static readonly HashSet<ushort> ignoreDebugLogMessageSet = new HashSet<ushort>
  7. {
  8. OuterOpcode.C2G_Ping,
  9. OuterOpcode.G2C_Ping,
  10. };
  11. private static bool IsNeedLogMessage(ushort opcode)
  12. {
  13. if (ignoreDebugLogMessageSet.Contains(opcode))
  14. {
  15. return false;
  16. }
  17. return true;
  18. }
  19. public static bool IsOuterMessage(ushort opcode)
  20. {
  21. return opcode < OpcodeRangeDefine.OuterMaxOpcode;
  22. }
  23. public static bool IsInnerMessage(ushort opcode)
  24. {
  25. return opcode >= OpcodeRangeDefine.InnerMinOpcode;
  26. }
  27. public static void LogMsg(int zone, ushort opcode, object message)
  28. {
  29. if (!IsNeedLogMessage(opcode))
  30. {
  31. return;
  32. }
  33. Game.ILog.Debug("zone: {0} {1}", zone, message);
  34. }
  35. public static void LogMsg(ushort opcode, long actorId, object message)
  36. {
  37. if (!IsNeedLogMessage(opcode))
  38. {
  39. return;
  40. }
  41. Game.ILog.Debug("actorId: {0} {1}", actorId, message);
  42. }
  43. }
  44. }