Exemplo n.º 1
0
 protected virtual void Awake()
 {
     ((UIBehaviour)this).Awake();
     GameUtility.SetNeverSleep();
     if (!Application.get_isPlaying())
     {
         return;
     }
     MyCriManager.Setup(false);
     this.mMoviePlayer = (CriManaPlayer)((Component)this).GetComponent <CriManaPlayer>();
     if (!Object.op_Inequality((Object)this.mMoviePlayer, (Object)null))
     {
         return;
     }
     if (!GameUtility.Config_UseAssetBundles.Value)
     {
         this.mMoviePlayer.set_moviePath(AssetManager.GetLocalizedObjectName("StreamingAssets/" + MyCriManager.GetLoadFileName(this.mMoviePlayer.get_moviePath()), false).Replace("StreamingAssets/", string.Empty));
     }
     else
     {
         this.mMoviePlayer.set_moviePath(MyCriManager.GetLoadFileName(AssetManager.GetLocalizedObjectName("StreamingAssets/" + this.mMoviePlayer.get_moviePath(), false).Replace("StreamingAssets/", string.Empty)));
     }
 }
Exemplo n.º 2
0
 private void OnEnable()
 {
     this.source = (CriManaPlayer)base.target;
 }
    void OnGUI()
    {
        if (Scene_00_SampleList.ShowList == true) {
            return;
        }

        Scene_00_GUI.BeginGui("01/SampleMain");

        /* UIスキンの設定 */
        GUI.skin = Scene_00_SampleList.uiSkin;

        GUILayout.BeginArea(new Rect(Screen.width - 416, 70 , 400, 32 * 6));

        if (this.showBindCpkButton == false) {
            if (this.installRequest[0] == null) {
                if (this.lockInstallButton == false) {
                    if (Scene_00_GUI.Button("Install CPK File")) {
                        /* CPKファイルを上書きするのでインストールの前にCPKをアンバインドしておく */
                        this.UnbindCpk();
                        /* CPKファイルのインストール処理開始 */
                        StartCoroutine(this.Install(this.remoteCpkPath, this.localCpkPath, 0));
                    }
                }
            } else {
                /* インストールのリクエストから進捗状況を取得してアプリの画面表示に反映 */
                float progress = this.installRequest[0].progress;
                GUILayout.Label("Installing... " + (int)(progress * 100) + "%");
                GUILayout.Box("", GUILayout.Width(400 * progress + 10), GUILayout.Height(8));
            }
        }

        if (this.showBindCpkButton == true) {
            if (this.lockBindCpkButton == false) {
                GUILayout.Label("Loaded CPK File");
                if (Scene_00_GUI.Button(((this.bindId > 0) ? "*" : " ") + " Bind CPK File")) {
                    /* ローカルCPKファイルのバインド処理を開始 */
                    StartCoroutine(this.BindCpk(this.localCpkPath, 1));
                }
                if (this.bindId <= 0) {
                    GUI.enabled = false;
                    Scene_00_GUI.Button("Play");
                }
                GUI.enabled = true;

            } else {
                Scene_00_GUI.Button("Binding...");
            }
        }

        if (this.bindId > 0) {
            /* 本サンプルではムービーの再生開始時に CriManaPlayer を AddComponent して、 */
            /* ムービーの再生終了時か Stop ボタンが押された際に Destroy します。 */
            if (moviePlayer == null) {
                /* Play ボタン処理 */
                if (Scene_00_GUI.Button("Play")) {
                    this.lockInstallButton = true;
                    /* movieObject に CriManaPlayer を AddComponent */
                    moviePlayer = movieObject.AddComponent<CriManaPlayer>();
                    /* バインダとファイル名を設定 */
                    moviePlayer.SetFile(binder, movieFilename);
                    /* 再生開始 */
                    moviePlayer.Play();
                }
            }
            else {
                switch (this.moviePlayer.status) {
                case CriManaPlayer.Status.Playing:
                    /* Stop ボタン処理 */
                    if (Scene_00_GUI.Button("Stop")) {
                        moviePlayer.Stop();
                    }
                break;
                case CriManaPlayer.Status.PlayEnd:
                    /* 再生が終了した場合にも Stop する */
                    moviePlayer.Stop();
                break;
                case CriManaPlayer.Status.Stop:
                    /* CriManaPlayer を Destroy */
                    Destroy(moviePlayer);
                    this.lockInstallButton = false;
                break;
                }
            }
        }

        GUILayout.Space(8);

        /* シーンをリセット */
        if (Scene_00_GUI.Button("Reset")) {
            this.reset();
        }

        GUILayout.EndArea();

        Scene_00_GUI.EndGui();
    }
Exemplo n.º 4
0
    void OnGUI()
    {
        if (Scene_00_SampleList.ShowList == true) {
            return;
        }

        Scene_00_GUI.BeginGui("01/SampleMain");

        /* UIスキンの設定 */
        GUI.skin = Scene_00_SampleList.uiSkin;

        GUILayout.BeginArea(new Rect(Screen.width - 466, 70 , 450, 32* 4));

        if (this.lockBindCpkButton == false) {
            if (Scene_00_GUI.Button(((this.bindId > 0) ? "*" : " ") + " Bind CPK File")) {
                /* ローカルCPKファイルのバインド処理を開始 */
                StartCoroutine(this.BindCpk(this.localCpkFilePath, 1));
            }
        } else {
            Scene_00_GUI.Button("Binding...");
        }

        if (this.bindId > 0) {
            /* 本サンプルではムービーの再生開始時に CriManaPlayer を AddComponent して、 */
            /* ムービーの再生終了時か Stop ボタンが押された際に Destroy します。 */
            if (moviePlayer == null) {
                /* Play ボタン処理 */
                if (Scene_00_GUI.Button("Play")) {
                        /* movieObject に CriManaPlayer を AddComponent */
                        moviePlayer = movieObject.AddComponent<CriManaPlayer>();
                        /* バインダとファイル名を設定 */
                        moviePlayer.SetFile(binder, movieFilename);
                        /* 再生開始 */
                        moviePlayer.Play();
                    }
            }
            else {
                switch (this.moviePlayer.status) {
                case CriManaPlayer.Status.Playing:
                    /* Stop ボタン処理 */
                    if (Scene_00_GUI.Button("Stop")) {
                        moviePlayer.Stop();
                    }
                break;
                case CriManaPlayer.Status.PlayEnd:
                    /* 再生が終了した場合にも Stop する */
                    moviePlayer.Stop();
                break;
                case CriManaPlayer.Status.Stop:
                    /* CriManaPlayer を Destroy */
                    Destroy(moviePlayer);
                break;
                }
            }
        } else {
            GUI.enabled = false;
            Scene_00_GUI.Button("Play");
        }
        GUI.enabled = true;

        GUILayout.Space(8);

            /* シーンをリセット */
        if (Scene_00_GUI.Button("Reset")) {
            this.reset();
        }

        GUILayout.EndArea();

        Scene_00_GUI.EndGui();
    }
		public override bool UpdateTexture(UnityEngine.Material material, int playerId, out CriManaPlayer.FrameInfo frameInfo)
		{
			bool updated = CriManaPlugin.criManaUnityPlayer_UpdateTextureYuvaByID(
						 playerId,
						 (uint)m_Texture_y[texIndex].GetNativeTextureID(),
						 (uint)m_Texture_u[texIndex].GetNativeTextureID(),
						 (uint)m_Texture_v[texIndex].GetNativeTextureID(),
						 (uint)m_Texture_a[texIndex].GetNativeTextureID(),
						 out frameInfo
				);
			if (updated) {
				// Set the writtern texture as the target
				material.SetTexture("Texture_y", m_Texture_y[texIndex]);
				material.SetTexture("Texture_u", m_Texture_u[texIndex]);
				material.SetTexture("Texture_v", m_Texture_v[texIndex]);
				material.SetTexture("Texture_a", m_Texture_a[texIndex]);
				// Switch the write index of texture to the next
				texIndex = (texIndex + 1) % texNumber;
			}
			return updated;
		}
		public override bool UpdateTexture(UnityEngine.Material material, int playerId, out CriManaPlayer.FrameInfo frameInfo)
		{
			bool updated = CriManaPlugin.criManaUnityPlayer_UpdateTexture(
						 playerId,
						 m_PixelsHandle[texIndex].AddrOfPinnedObject(),
						 out frameInfo
				);
			if (updated) {
				m_Texture[texIndex].SetPixels32(m_Pixels[texIndex], 0);
				m_Texture[texIndex].Apply();
				// Set the writtern texture as the target
				material.mainTexture = m_Texture[texIndex];
				// Switch the write index of texture to the next
				texIndex = (texIndex + 1) % texNumber;
			}
			return updated;
		}
		public abstract bool UpdateTexture(UnityEngine.Material material, int playerId, out CriManaPlayer.FrameInfo frameInfo);