OpcodeHelper.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #if !SERVER
  34. Log.ILog.Debug("zone: {0} {1}", zone, message);
  35. #endif
  36. }
  37. public static void LogMsg(ushort opcode, long actorId, object message)
  38. {
  39. if (!IsNeedLogMessage(opcode))
  40. {
  41. return;
  42. }
  43. //Log.ILog.Debug("actorId: {0} {1}", actorId, message);
  44. }
  45. }
  46. }