HIDE.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. namespace OpenVIII.Fields.Scripts.Instructions
  3. {
  4. /// <summary>
  5. /// Hides this entity's model on the field. See also SHOW.
  6. /// </summary>
  7. internal sealed class HIDE : JsmInstruction
  8. {
  9. public HIDE()
  10. {
  11. }
  12. public HIDE(Int32 parameter, IStack<IJsmExpression> stack)
  13. : this()
  14. {
  15. }
  16. public override String ToString()
  17. {
  18. return $"{nameof(HIDE)}()";
  19. }
  20. public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
  21. {
  22. sw.Format(formatterContext, services)
  23. .Property(nameof(FieldObject.Model))
  24. .Method(nameof(FieldObjectModel.Hide))
  25. .Comment(nameof(HIDE));
  26. }
  27. public override IAwaitable TestExecute(IServices services)
  28. {
  29. FieldObject currentObject = ServiceId.Field[services].Engine.CurrentObject;
  30. currentObject.Model.Hide();
  31. return DummyAwaitable.Instance;
  32. }
  33. }
  34. }