UCON.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. namespace OpenVIII.Fields.Scripts.Instructions
  3. {
  4. /// <summary>
  5. /// Enables user control. See UCOFF for details.
  6. /// </summary>
  7. internal sealed class UCON : JsmInstruction
  8. {
  9. public UCON()
  10. {
  11. }
  12. public UCON(Int32 parameter, IStack<IJsmExpression> stack)
  13. : this()
  14. {
  15. }
  16. public override String ToString()
  17. {
  18. return $"{nameof(UCON)}()";
  19. }
  20. public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
  21. {
  22. sw.Format(formatterContext, services)
  23. .StaticType(nameof(IGameplayService))
  24. .Property(nameof(IGameplayService.IsUserControlEnabled))
  25. .Assign(true)
  26. .Comment(nameof(UCON));
  27. }
  28. public override IAwaitable TestExecute(IServices services)
  29. {
  30. ServiceId.Gameplay[services].IsUserControlEnabled = true;
  31. return DummyAwaitable.Instance;
  32. }
  33. }
  34. }