PageRenderTime 52ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/AwManaged/Scene/ActionInterpreter/ACAnimate.cs

http://awmanaged.codeplex.com
C# | 197 lines | 87 code | 25 blank | 85 comment | 0 complexity | 1fe926a9ae546ba25f600ed43301e960 MD5 | raw file
Possible License(s): MIT, CC-BY-SA-3.0
  1. /* **********************************************************************************
  2. *
  3. * Copyright (c) TCPX. All rights reserved.
  4. *
  5. * This source code is subject to terms and conditions of the Microsoft Public
  6. * License (Ms-PL). A copy of the license can be found in the license.txt file
  7. * included in this distribution.
  8. *
  9. * You must not remove this notice, or any other, from this software.
  10. *
  11. * **********************************************************************************/
  12. using SharedMemory;using System;
  13. using System.Collections.Generic;
  14. using AwManaged.Scene.ActionInterpreter.Interface;
  15. namespace AwManaged.Scene.ActionInterpreter
  16. {
  17. /// <summary>
  18. /// The animate command assigns an animation to the object. It is by far the most complex and probably least understood
  19. /// action command. For this reason, the following help pages have been added to address specific uses of the animate
  20. /// command:
  21. /// Application of a single texture
  22. /// Applying a sequence of textures
  23. /// Using the animate command as a timer
  24. /// </summary>
  25. public sealed class ACAnimate : IActionCommand
  26. {
  27. private readonly string _tag;
  28. private readonly string _mask;
  29. private readonly Model _model;
  30. private readonly string _animationName;
  31. private readonly int _imageCount;
  32. private readonly int _frameCount;
  33. private readonly long _frameDelay;
  34. private readonly List<int> _frameList;
  35. private readonly bool _isGLobal;
  36. /// <summary>
  37. /// The optional tag argument specifies the tag number of the polygon on the object to which the animation is applied.
  38. /// If omitted, the animation is applied to every polygon on the object.
  39. /// </summary>
  40. /// <value>
  41. /// <c>true</c> if this instance is G lobal; otherwise, <c>false</c>.
  42. /// </value>
  43. public bool IsGLobal
  44. {
  45. get { return _isGLobal; }
  46. }
  47. /// <summary>
  48. /// The optional framelist argument allows you to specify the order of images to be displayed in the animation. This
  49. /// argument must be specified if imagecount and framecount are different. The default frame list is 1 through
  50. /// imagecount.
  51. /// </summary>
  52. /// <value>The frame list.</value>
  53. public List<int> FrameList
  54. {
  55. get { return _frameList; }
  56. }
  57. /// <summary>
  58. /// The framedelay argument specifies the time in milliseconds between each frame of the animation. Note that low
  59. /// numbers for the framedelay may cause the animation to drop frames in order to keep up on slower systems. A
  60. /// framedelay of 0 means animate at the same rate as the browser's current frame rate. The framedelay argument is a
  61. /// 64-bit integer (max value: 18446744073709551615)
  62. /// </summary>
  63. /// <value>The frame delay.</value>
  64. public long FrameDelay
  65. {
  66. get { return _frameDelay; }
  67. }
  68. /// <summary>
  69. /// The framecount argument specifies the total number of frames in the animation sequence. Note this does not have to
  70. /// be the same as imagecount since a given image can be used more than once in an animation sequence.
  71. /// </summary>
  72. /// <value>The frame count.</value>
  73. public int FrameCount
  74. {
  75. get { return _frameCount; }
  76. }
  77. /// <summary>
  78. /// The imagecount argument specifies the total number of unique textures in the animation.
  79. /// </summary>
  80. /// <value>The image count.</value>
  81. public int ImageCount
  82. {
  83. get { return _imageCount; }
  84. }
  85. /// <summary>
  86. /// The animation-name argument specifies the base name of the textures to be used in the animation.
  87. /// </summary>
  88. /// <value>The name of the animation.</value>
  89. public string AnimationName
  90. {
  91. get { return _animationName; }
  92. }
  93. /// <summary>
  94. /// The object-name argument specifies the name of the object to apply the animation to. This argument must be
  95. /// specified. If the animation is to be applied to this object, specify the keyword me as the object name. Object
  96. /// names are assigned via the name command. The Animate command always requires the use of an object name, and will
  97. /// therefore recognize the name me as meaning the object on which the command is found.
  98. /// </summary
  99. /// <value>The model.</value>
  100. public Model Model
  101. {
  102. get { return _model; }
  103. }
  104. /// <summary>
  105. /// If mask is specified, the animation is masked, and Active Worlds will attempt to download and apply a
  106. /// corresponding mask file for each texture in the animation sequence. The nomask option explicitly specifies that
  107. /// textures applied by the animation are not to be masked. By default, animations are not masked. By default,
  108. /// animations are now not masked. If you have an animation that uses mask files to apply transparency to parts of the
  109. /// textures involved, you must now explicitly specify the mask option or all textures in the animation will be
  110. /// applied unmasked.
  111. /// </summary>
  112. /// <value>The mask.</value>
  113. public string Mask
  114. {
  115. get { return _mask; }
  116. }
  117. /// <summary>
  118. /// The optional tag argument specifies the tag number of the polygon on the object to which the animation is applied.
  119. /// If omitted, the animation is applied to every polygon on the object.
  120. /// </summary>
  121. /// <value>The tag.</value>
  122. public string Tag
  123. {
  124. get { return _tag; }
  125. }
  126. /// <summary>
  127. /// Initializes a new instance of the <see cref="ActionAnimate"/> class.
  128. /// </summary>
  129. /// <param name="tag">The tag.</param>
  130. /// <param name="mask">The mask.</param>
  131. /// <param name="model">The model.</param>
  132. /// <param name="animationName">Name of the animation.</param>
  133. /// <param name="imageCount">The image count.</param>
  134. /// <param name="frameCount">The frame count.</param>
  135. /// <param name="frameDelay">The frame delay.</param>
  136. /// <param name="frameList">The frame list.</param>
  137. /// <param name="isGLobal">if set to <c>true</c> [is G lobal].</param>
  138. public ACAnimate(string tag, string mask, Model model, string animationName, int imageCount, int frameCount, Int64 frameDelay, List<int> frameList, bool isGLobal)
  139. {
  140. _tag = tag;
  141. _mask = mask;
  142. _model = model;
  143. _animationName = animationName;
  144. _imageCount = imageCount;
  145. _frameCount = frameCount;
  146. _frameDelay = frameDelay;
  147. _frameList = frameList;
  148. _isGLobal = isGLobal;
  149. }
  150. public ACAnimate(){}
  151. #region IActionInterpreter<ActionAnimate> Members
  152. public ACAnimate FromString(string action)
  153. {
  154. throw new NotImplementedException();
  155. }
  156. #endregion
  157. #region ILiteralAction Members
  158. public string LiteralAction
  159. {
  160. get { return "animate"; }
  161. }
  162. public string LiteralPart { get; set; }
  163. #endregion
  164. #region ICommandGroups Members
  165. public System.Collections.Generic.IList<ICommandGroup> CommandGroups
  166. {
  167. get;
  168. set;
  169. }
  170. #endregion
  171. }
  172. }