/// <summary> /// Helper function to initialize creation parameters for overlay movies. /// </summary> /// <param name="swfName">String corresponding to the flash movie that will be rendered to a texture.</param> /// <param name="depth">Used to sort multiple, overlapping movies in rendering order, so that movies with a lower depth are rendered first.</param> /// <param name="swfBytes">Used to support loading a swfFile from memory. swfBytes is the memory buffer corresponding to the swfFile. /// <code> using (FileStream fileStream = new FileStream("Assets/StreamingAssets/Demo1.swf", FileMode.Open, FileAccess.Read)) /// { /// using (BinaryReader reader = new BinaryReader(fileStream)) /// { /// swfBytes = reader.ReadBytes((int)fileStream.Length); /// } /// }</code></param> /// <param name="bgColor">Only the alpha part of the background color is used to set the transparency for the swf background. The color part is ignored for now.</param> /// <param name="overrideBackgroundColor">Ignored for now.</param> /// <example>Here is the sample code to create swfBytes: /// <code> { /// using (BinaryReader reader = new BinaryReader(fileStream)) /// { /// swfBytes = reader.ReadBytes((int)fileStream.Length); /// } /// } /// </code> /// </example> /// <returns></returns> public static SFMovieCreationParams CreateMovieCreationParams(string swfName, int depth, Byte[] swfBytes, Color32 bgColor, bool overrideBackgroundColor) { int ox = 0; int oy = 0; int width = 0; int height = 0; GetViewport(ref ox, ref oy, ref width, ref height); Int32 length = 0; IntPtr pDataUnManaged = IntPtr.Zero; if (swfBytes != null) length = swfBytes.Length; if (length > 0) { pDataUnManaged = new IntPtr(); pDataUnManaged = Marshal.AllocCoTaskMem((int)length); Marshal.Copy(swfBytes, 0, pDataUnManaged, (int)length); } String swfPath = SFManager.GetScaleformContentPath() + swfName; return new SFMovieCreationParams(swfPath, depth, ox, oy, width, height, pDataUnManaged, length, false, bgColor, overrideBackgroundColor, ScaleModeType.SM_ShowAll, true); }
/// <summary> /// Helper function to initialize creation parameters for RenderTexture movies. /// </summary> /// <param name="swfName">String corresponding to the flash movie that will be rendered to a texture.</param> /// <param name="depth">Used to sort multiple, overlapping movies in rendering order, so that movies with a lower depth are rendered first.</param> /// <param name="RTToX">The offset for the render texture movie viewport. </param> /// <param name="RTToY">The offset for the render texture movie viewport.</param> /// <param name="texture">The rendertexture.</param> /// <param name="clearColor">Specifies the color used to clear the render texture before rendering the movie. </param> /// <returns></returns> public static SFMovieCreationParams CreateRTTMovieCreationParams(string swfName, int depth, int RTToX, int RTToY, RenderTexture texture, Color32 clearColor) { // Used for Android only Int32 length = 0; IntPtr pDataUnManaged = IntPtr.Zero; String SwfPath = SFManager.GetScaleformContentPath() + swfName; return new SFMovieCreationParams(SwfPath, depth, RTToX, RTToY, texture.width, texture.height, pDataUnManaged, length, false, texture, clearColor, true, ScaleModeType.SM_ShowAll, true); }
/// <summary> /// Helper function to initialize creation parameters for overlay movies. /// </summary> /// <param name="swfName">String corresponding to the flash movie that will be rendered to a texture.</param> /// <param name="depth">Used to sort multiple, overlapping movies in rendering order, so that movies with a lower depth are rendered first. See the layering demo for an example.</param> /// <param name="bgColor">Only the alpha part of the background color is used to set the transparency for the swf background. The color part is ignored for now.</param> /// <param name="overrideBackgroundColor">Ignored for now.</param> /// <returns></returns> public static SFMovieCreationParams CreateMovieCreationParams(string swfName, int depth, Color32 bgColor, bool overrideBackgroundColor) { Int32 length = 0; int ox = 0; int oy = 0; int width = 0; int height = 0; IntPtr pDataUnManaged = IntPtr.Zero; String swfPath = SFManager.GetScaleformContentPath() + swfName; GetViewport(ref ox, ref oy, ref width, ref height); return new SFMovieCreationParams(swfPath, depth, ox, oy, width, height, pDataUnManaged, length, false, bgColor, overrideBackgroundColor, ScaleModeType.SM_ShowAll, true); }