ServiceId.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. using System;
  2. namespace FF8
  3. {
  4. public interface IServices
  5. {
  6. T Service<T>(ServiceId<T> id);
  7. }
  8. public abstract class ServiceId<T>
  9. {
  10. public Boolean IsSupported => false;
  11. public T this[IServices services] => services.Service(this);
  12. }
  13. public static class ServiceId
  14. {
  15. public static ServiceId<IFieldService> Field { get; } = new FieldServiceId();
  16. public static ServiceId<IInteractionService> Interaction { get; } = new InteractionServiceId();
  17. public static ServiceId<IGlobalVariableService> Global { get; } = new GlobalVariableServiceId();
  18. public static ServiceId<IGameplayService> Gameplay { get; } = new GameplayServiceId();
  19. public static ServiceId<ISalaryService> Salary { get; } = new SalaryServiceId();
  20. public static ServiceId<IPartyService> Party { get; } = new PartyServiceId();
  21. public static ServiceId<IMovieService> Movie { get; } = new MovieServiceId();
  22. public static ServiceId<IMessageService> Message { get; } = new MessageServiceId();
  23. public static ServiceId<IMenuService> Menu { get; } = new MenuServiceId();
  24. public static ServiceId<IMusicService> Music { get; } = new MusicServiceId();
  25. public static ServiceId<ISoundService> Sound { get; } = new SoundServiceId();
  26. public static ServiceId<IRenderingService> Rendering { get; } = new RenderingServiceId();
  27. private sealed class FieldServiceId : ServiceId<IFieldService>, IFieldService
  28. {
  29. public EventEngine Engine => throw new NotSupportedException();
  30. public void FadeOn() => throw new NotSupportedException();
  31. public void FadeOff() => throw new NotSupportedException();
  32. public void FadeIn() => throw new NotSupportedException();
  33. public void FadeOut() => throw new NotSupportedException();
  34. public void PrepareGoTo(int fieldId) => throw new NotSupportedException();
  35. public void GoTo(int fieldId, Int32 walkmeshId) => throw new NotSupportedException();
  36. public void BindArea(Int32 areaId) => throw new NotSupportedException();
  37. }
  38. private sealed class InteractionServiceId : ServiceId<IInteractionService>, IInteractionService
  39. {
  40. public Int32 this[ScriptResultId id]
  41. {
  42. get => throw new NotSupportedException();
  43. set => throw new NotSupportedException();
  44. }
  45. public IAwaitable Wait(Int32 frameNumber) => throw new NotSupportedException();
  46. }
  47. private sealed class GlobalVariableServiceId : ServiceId<IGlobalVariableService>, IGlobalVariableService
  48. {
  49. public T Get<T>(GlobalVariableId<T> id) where T : unmanaged => throw new NotSupportedException();
  50. public void Set<T>(GlobalVariableId<T> id, T value) where T : unmanaged => throw new NotSupportedException();
  51. }
  52. private sealed class GameplayServiceId : ServiceId<IGameplayService>, IGameplayService
  53. {
  54. public Boolean IsUserControlEnabled
  55. {
  56. get => throw new NotSupportedException();
  57. set => throw new NotSupportedException();
  58. }
  59. public Boolean IsRandomBattlesEnabled
  60. {
  61. get => throw new NotSupportedException();
  62. set => throw new NotSupportedException();
  63. }
  64. public void ResetAllData() => throw new NotSupportedException();
  65. }
  66. private sealed class SalaryServiceId : ServiceId<ISalaryService>, ISalaryService
  67. {
  68. public Boolean IsSalaryEnabled
  69. {
  70. get => throw new NotSupportedException();
  71. set => throw new NotSupportedException();
  72. }
  73. public Boolean IsSalaryAlertEnabled
  74. {
  75. get => throw new NotSupportedException();
  76. set => throw new NotSupportedException();
  77. }
  78. }
  79. private sealed class PartyServiceId : ServiceId<IPartyService>, IPartyService
  80. {
  81. public Boolean IsPartySwitchEnabled
  82. {
  83. get => throw new NotSupportedException();
  84. set => throw new NotSupportedException();
  85. }
  86. public void AddPlayableCharacter(CharacterId characterId) => throw new NotSupportedException();
  87. public void RemovePlayableCharacter(CharacterId characterId) => throw new NotSupportedException();
  88. public void AddPartyCharacter(CharacterId characterId) => throw new NotSupportedException();
  89. public void RemovePartyCharacter(CharacterId characterId) => throw new NotSupportedException();
  90. public void ChangeCharacterState(CharacterId characterId, Boolean isSwitchable, Boolean isSelectable) => throw new NotSupportedException();
  91. public void ChangeParty(CharacterId characterId1, CharacterId characterId2, CharacterId characterId3) => throw new NotSupportedException();
  92. public FieldObject FindPartyCharacterObject(Int32 partyId) => throw new NotSupportedException();
  93. }
  94. private sealed class MovieServiceId : ServiceId<IMovieService>, IMovieService
  95. {
  96. public void PrepareToPlay(Int32 movieId, Boolean flag) => throw new NotSupportedException();
  97. public void Play() => throw new NotSupportedException();
  98. public void Wait() => throw new NotSupportedException();
  99. }
  100. private sealed class MessageServiceId : ServiceId<IMessageService>, IMessageService
  101. {
  102. public void Show(Int32 channel, Int32 messageId) => throw new NotSupportedException();
  103. public void Show(Int32 channel, Int32 messageId, Int32 posX, Int32 posY) => throw new NotSupportedException();
  104. public void Close(Int32 channel) => throw new NotSupportedException();
  105. public IAwaitable ShowDialog(Int32 channel, Int32 messageId, Int32 posX, Int32 posY) => throw new NotSupportedException();
  106. public IAwaitable ShowQuestion(Int32 channel, Int32 messageId, Int32 firstLine, Int32 lastLine, Int32 beginLine, Int32 cancelLine) => throw new NotSupportedException();
  107. public IAwaitable ShowQuestion(Int32 channel, Int32 messageId, Int32 firstLine, Int32 lastLine, Int32 beginLine, Int32 cancelLine, Int32 posX, Int32 posY) => throw new NotSupportedException();
  108. }
  109. private sealed class MenuServiceId : ServiceId<IMenuService>, IMenuService
  110. {
  111. public IAwaitable ShowEnterNameDialog(NamedEntity entity) => throw new NotSupportedException();
  112. }
  113. private sealed class MusicServiceId : ServiceId<IMusicService>, IMusicService
  114. {
  115. public void ChangeBattleMusic(MusicId musicId) => throw new NotSupportedException();
  116. public void LoadFieldMusic(MusicId musicId) => throw new NotSupportedException();
  117. public void PlayFieldMusic() => throw new NotSupportedException();
  118. public void ChangeMusicVolume(Int32 volume, Boolean flag) => throw new NotSupportedException();
  119. public void ChangeMusicVolume(Int32 volume, Boolean flag, Int32 transitionDuration) => throw new NotSupportedException();
  120. }
  121. private sealed class SoundServiceId : ServiceId<ISoundService>, ISoundService
  122. {
  123. public void PlaySound(Int32 fieldSoundIndex, Int32 pan, Int32 volume, Int32 channel) => throw new NotSupportedException();
  124. }
  125. private sealed class RenderingServiceId : ServiceId<IRenderingService>, IRenderingService
  126. {
  127. public Int32 BackgroundFPS
  128. {
  129. get => throw new NotSupportedException();
  130. set => throw new NotSupportedException();
  131. }
  132. public void AddScreenColor(RGBColor rgbColor) => throw new NotSupportedException();
  133. public void SubScreenColor(RGBColor rgbColor) => throw new NotSupportedException();
  134. public void AddScreenColorTransition(RGBColor rgbColor, RGBColor offset, Int32 transitionDuration) => throw new NotSupportedException();
  135. public void SubScreenColorTransition(RGBColor rgbColor, RGBColor offset, Int32 transitionDuration) => throw new NotSupportedException();
  136. public IAwaitable Wait() => throw new NotSupportedException();
  137. public void AnimateBackground(Int32 firstFrame, Int32 lastFrame) => throw new NotSupportedException();
  138. public void DrawBackground() => throw new NotSupportedException();
  139. }
  140. }
  141. }