IConsole.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. using System.Drawing;
  2. using MinorShift.Emuera;
  3. using MinorShift.Emuera.GameProc;
  4. using MinorShift.Emuera.Sub;
  5. using NTERA.Game.Display;
  6. namespace NTERA.Interop
  7. {
  8. public interface IConsole
  9. {
  10. InputRequest CurrentRequest { get; }
  11. void GiveInput(string input);
  12. void PrintError(string message);
  13. void PrintSystemLine(string message);
  14. void DebugClearTraceLog();
  15. void DebugAddTraceLog(string message);
  16. void DebugRemoveTraceLog();
  17. bool RunERBFromMemory { get; }
  18. void PrintWarning(string message, ScriptPosition position, int level);
  19. void setStBar(string bar);
  20. void ReadAnyKey();
  21. void WaitInput(InputRequest request);
  22. void ResetStyle();
  23. void OutputLog(string log);
  24. bool noOutputLog { get; set; }
  25. void ThrowTitleError(bool something);
  26. void PrintBar();
  27. void PrintSingleLine(string line, bool something = false);
  28. void NewLine();
  29. void RefreshStrings(bool something);
  30. void SetWindowTitle(string title);
  31. bool IsRunning { get; }
  32. bool Enabled { get; }
  33. void ThrowError(bool playSound);
  34. void PrintErrorButton(string message, ScriptPosition position);
  35. void Write(string message);
  36. bool UseSetColorStyle { get; set; }
  37. void PrintC(string message, bool something);
  38. DisplayLineAlignment Alignment { get; set; }
  39. void deleteLine(int line);
  40. void PrintTemporaryLine(string line);
  41. bool updatedGeneration { get; set; }
  42. void PrintFlush(bool something);
  43. bool LastLineIsTemporary { get; }
  44. bool LastLineIsEmpty { get; }
  45. void ReloadErbFinished();
  46. bool MesSkip { get; }
  47. StringStyle StringStyle { get; set; }
  48. Color bgColor { get; set; }
  49. ConsoleRedraw Redraw { get; set; }
  50. bool EmptyLine { get; }
  51. string getStBar(string something);
  52. void PrintButton(string something, long something1);
  53. void PrintButton(string something, string something1);
  54. void PrintButtonC(string something, long something1, bool something2);
  55. void PrintButtonC(string something, string something1, bool something2);
  56. void PrintPlain(string message);
  57. void printCustomBar(string bar);
  58. bool UseUserStyle { get; set; }
  59. void Quit();
  60. void PrintHtml(string html, bool newline);
  61. void PrintImg(string img);
  62. void PrintShape(string shape, int[] param);
  63. void DebugPrint(string message);
  64. void DebugNewLine();
  65. void DebugClear();
  66. void ReadAnyKey(bool something, bool something2);
  67. void SetStringStyle(Color color);
  68. void SetStringStyle(FontStyle fontStyle);
  69. void SetBgColor(Color color);
  70. void SetToolTipColor(Color fc, Color bc);
  71. void SetToolTipDelay(int delay);
  72. void SetToolTipDuration(int duration);
  73. void SetFont(string font);
  74. void SetRedraw(long value);
  75. int NewButtonGeneration { get; }
  76. void UpdateGeneration();
  77. string GetWindowTitle();
  78. long LineCount { get; }
  79. string getDefStBar();
  80. bool IsTimeOut { get; }
  81. }
  82. public enum ConsoleRedraw
  83. {
  84. None = 0,
  85. Normal = 1
  86. }
  87. public enum DisplayLineAlignment
  88. {
  89. LEFT = 0,
  90. CENTER = 1,
  91. RIGHT = 2
  92. }
  93. /// <summary>
  94. /// 装飾付文字列(ConsoleStyledString)用のスタイル構造体
  95. /// </summary>
  96. public struct StringStyle
  97. {
  98. public StringStyle(Color color, FontStyle fontStyle, string fontname)
  99. {
  100. Color = color;
  101. ButtonColor = Config.FocusColor;
  102. ColorChanged = false;//こっちのパターンでは色変更を後で検知
  103. FontStyle = fontStyle;
  104. if (string.IsNullOrEmpty(fontname))
  105. Fontname = Config.FontName;
  106. else
  107. Fontname = fontname;
  108. }
  109. /// <summary>
  110. /// HTML用。ColorChangedを固定する。
  111. /// </summary>
  112. public StringStyle(Color color, bool colorChanged, Color buttonColor, FontStyle fontStyle, string fontname)
  113. {
  114. Color = color;
  115. ButtonColor = buttonColor;
  116. ColorChanged = colorChanged;
  117. FontStyle = fontStyle;
  118. if (string.IsNullOrEmpty(fontname))
  119. Fontname = Config.FontName;
  120. else
  121. Fontname = fontname;
  122. }
  123. public Color Color;
  124. public Color ButtonColor;
  125. public bool ColorChanged;
  126. public FontStyle FontStyle;
  127. public string Fontname;
  128. public override bool Equals(object obj)
  129. {
  130. if ((obj == null) || (!(obj is StringStyle)))
  131. return false;
  132. StringStyle ss = (StringStyle)obj;
  133. return ((Color == ss.Color) && (ButtonColor == ss.ButtonColor) && (ColorChanged == ss.ColorChanged) && (FontStyle == ss.FontStyle) && (Fontname.Equals(ss.Fontname, Config.SCIgnoreCase)));
  134. }
  135. public override int GetHashCode()
  136. {
  137. return Color.GetHashCode() ^ ButtonColor.GetHashCode() ^ ColorChanged.GetHashCode() ^ FontStyle.GetHashCode() ^ Fontname.GetHashCode();
  138. }
  139. public static bool operator ==(StringStyle x, StringStyle y)
  140. {
  141. return ((x.Color == y.Color) && (x.ButtonColor == y.ButtonColor) && (x.ColorChanged == y.ColorChanged) && (x.FontStyle == y.FontStyle) && (x.Fontname.Equals(y.Fontname, Config.SCIgnoreCase)));
  142. }
  143. public static bool operator !=(StringStyle x, StringStyle y)
  144. {
  145. return !(x == y);
  146. }
  147. }
  148. }