Esempio n. 1
0
    /// <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);
    }
Esempio n. 2
0
 public MainMenu(MenuCamera parent, SFManager sfmgr, SFMovieCreationParams cp)
     : base(sfmgr, cp)
 {
     this.parent = parent;
     SFMgr = sfmgr;
     this.SetFocus(false);
 }
Esempio n. 3
0
    //public void Start()
    //{
    //}

    /// <summary>
    /// During the Start function, the Scaleform Manager and internal Scaleform runtime is initialized, Gamepad is created and initialized.
    /// </summary>
    /// <returns></returns>
    public void SFAwake()
	{
		ShiftKeyDown = false;
		ControlKeyDown = false;
		AltKeyDown = false;
		
	//	DontDestroyOnLoad(this.gameObject);
        SFMgr = gameObject.AddComponent<SFManager>();
		SFMgr.Init(InitParams);
		if (SFMgr.IsSFInitialized())
		{
			GamePad = new SFGamepad(SFMgr);
			GamePad.Init();
			//SFMgr.InstallDelegates();
			InitParams.Print();
			SFMgr.SetNewViewport(0, 0, Screen.width, Screen.height);


			// Figure out if gamepad is connected.
			GamepadConnected = false;
#if !UNITY_WP8
			if (InputManager.GetJoystickNames().Length != 0)
			{
				GamepadConnected = true;
			}
#endif

		}
	}
 public RenderTextureDemo(SFManager sfmgr, SFMovieCreationParams cp)
     : base(sfmgr, cp)
 {
     SFMgr = sfmgr;
     this.SetFocus(true);
     instance = this;
 }
Esempio n. 5
0
    public ScaleformMovie(ScaleformLayer layer, SFManager sfmgr, SFMovieCreationParams creationParams)
        : base(sfmgr, creationParams)
    {
        Layer = layer;
        SFManager = sfmgr;

        SetFocus(true);
    }
Esempio n. 6
0
    /// <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);
    }
Esempio n. 7
0
    public ScaleformMovie(SFManager sfmgr, SFMovieCreationParams cp)
        : base(sfmgr, cp)
    {
        beginValues = new Value[3];
        moveValues = new Value[3];
        endValues = new Value[1];
        cancelValues = new Value[1];

        SetFocus(true);
    }
Esempio n. 8
0
    /// <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);
    }
Esempio n. 9
0
    /// <summary>
    /// The RenderTexture movie is created here. The movie is of movieClassType if one is specified, otherwise of type Movie.
    /// </summary>
    /// <param name="camera"></param>
    /// <param name="movieClassType"></param>
    /// <returns></returns>
    public bool CreateRenderMovie(SFCamera camera, Type movieClassType)
    {
#if (UNITY_3_5) && UNITY_STANDALONE_WIN
		if (SystemInfo.graphicsDeviceVersion[0] == 'D')
		{
			return false;
		}
#endif
        if (RenderTexture == null)
        {
            UnityEngine.Debug.Log("RenderTexture is null, failure to create RenderMovie. Check if you specified all the parameters properly.");
            return false;
        }
        if (RTTMovie == null || RTTMovie.MovieID == 0)
        {
            if (camera)
            {
                SFMovieCreationParams creationParams = SFCamera.CreateRTTMovieCreationParams(SwfName, 1, OriginX, OriginY, RenderTexture, ClearColor);
                creationParams.TheScaleModeType      = ScaleModeType.SM_ExactFit;
                creationParams.IsInitFirstFrame      = false;
                creationParams.IsAutoManageViewport  = false;
                // Has the user specified a movie subclass?
                if (movieClassType != null)
                {
                    SFManager sfMgr = camera.GetSFManager();
                    RTTMovie = Activator.CreateInstance(movieClassType, sfMgr, creationParams) as Movie;
                    if (RTTMovie != null)
                    {
                        RTTMovie.SetRTT(this);
                    }
                    return true;
                }
            }
        }
        return false;
    }
Esempio n. 10
0
    /// <summary>
    /// During the Start function, the Scaleform Manager and internal Scaleform runtime is initialized, Gamepad is created and initialized.
    /// </summary>
    /// <returns></returns>
    public IEnumerator Start()
    {
        //	DontDestroyOnLoad(this.gameObject);
        SFMgr = new SFManager(InitParams);
        if (SFMgr.IsSFInitialized())
        {
            GamePad = new SFGamepad(SFMgr);
            GamePad.Init();
            //SFMgr.InstallDelegates();
            InitParams.Print();
            SFMgr.SetNewViewport(0, 0, Screen.width, Screen.height);
        #if UNITY_STANDALONE || UNITY_EDITOR || UNITY_METRO
            GL.IssuePluginEvent(0);
        #elif UNITY_IPHONE  || UNITY_ANDROID
            UnityRenderEvent(0);
        #endif
            GL.InvalidateState();

            // Figure out if gamepad is connected.
            GamepadConnected = false;
        #if !UNITY_WP8
            if (Input.GetJoystickNames().Length != 0)
            {
                GamepadConnected = true;
            }
        #endif
            if (WhenToRender == RenderTime.EndOfFrame)
            {
                yield return StartCoroutine("CallPluginAtEndOfFrame");
            }
        }
    }
Esempio n. 11
0
 public SFGamepad(SFManager sfMgr)
 {
     SFMgr = sfMgr;
 }
Esempio n. 12
0
    protected void Start()
    {
        if (Application.isPlaying)
        {
            DontDestroyOnLoad(gameObject);
            SFMgr = new SFManager(InitParams);
            SFMgr.Init();
            // SFMgr.InstallDelegates();
            GL.IssuePluginEvent(0);
            GL.InvalidateState();

            Movie = new ScaleformMovie(SFMgr, createMovieCreationParams(FlashMovieFile));

            StartCoroutine(CallPluginAtEndOfFrames());
        }
    }
Esempio n. 13
0
 public SFGamepad(SFManager sfMgr)
 {
     SFMgr = sfMgr;
 }
    public void Start()
    {
        DontDestroyOnLoad(this.gameObject);
        SFMgr = new SFManager(InitParams);
        if (SFMgr.IsSFInitialized())
        {
            GamePad = new SFGamepad(SFMgr);
            GamePad.Init();
            //SFMgr.InstallDelegates();
            InitParams.Print();
        #if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
            GL.IssuePluginEvent(0);
        #elif UNITY_IPHONE  || UNITY_ANDROID
            UnityRenderEvent(0);
        #endif
            GL.InvalidateState();
        }

        // Figure out if gamepad is connected.
        GamepadConnected = false;
        if (Input.GetJoystickNames().Length != 0)
        {
            GamepadConnected = true;
        }
    }
Esempio n. 15
0
    protected virtual void Start()
    {
        if (!Application.isPlaying) return;

        SF_SetKey(Key.Key);

        //For GL based platforms - Sets a number to use for Unity specific texture management.  Adjust this number if
        //you start to experience black and/or missing textures.
        SF_SetTextureCount(500);

        DontDestroyOnLoad(this.gameObject);
        SFMgr = new SFManager(InitParams);
        if (SFMgr.IsSFInitialized())
        {
            InitParams.Print();
            GL.IssuePluginEvent(0);
            GL.InvalidateState();
        }

        Movie = createMovie();

        if (WhenToRender == RenderTime.EndOfFrame) StartCoroutine("CallPluginAtEndOfFrame");
    }