Commit 2a3185e2 authored by JiangWanZhi's avatar JiangWanZhi

在录屏的后面再加一段视频

parent aeeede9d
fileFormatVersion: 2
guid: e45a3af7ef9d4344b99500c5e1728e6f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 17071c12ce7156840be9ee4c265f1450
VideoClipImporter:
externalObjects: {}
serializedVersion: 2
frameRange: 0
startFrame: -1
endFrame: -1
colorSpace: 0
deinterlace: 0
encodeAlpha: 0
flipVertical: 0
flipHorizontal: 0
importAudio: 1
targetSettings: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MyVideo
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 100
m_Height: 100
m_AntiAliasing: 1
m_MipCount: -1
m_DepthStencilFormat: 94
m_ColorFormat: 8
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
m_ShadowSamplingMode: 2
fileFormatVersion: 2
guid: a9bae581aa5b50343b384e88e1c25bb7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8400000
userData:
assetBundleName:
assetBundleVariant:
/* namespace NatSuite.Examples
* NatCorder {
* Copyright (c) 2020 Yusuf Olokoba
*/
namespace NatSuite.Examples {
using UnityEngine; using UnityEngine;
using System.Collections;
using Recorders; using Recorders;
using Recorders.Clocks; using Recorders.Clocks;
using Recorders.Inputs; using Recorders.Inputs;
using UnityEditor; using UnityEditor;
using UnityEngine.UI;
using static UnityEngine.GraphicsBuffer;
using UnityEngine.Rendering.Universal;
using System.IO; using System.IO;
using UnityEngine.Android; using UnityEngine.Android;
...@@ -72,8 +63,8 @@ namespace NatSuite.Examples { ...@@ -72,8 +63,8 @@ namespace NatSuite.Examples {
float y = targetpos.GetComponent<RectTransform>().sizeDelta.y; float y = targetpos.GetComponent<RectTransform>().sizeDelta.y;
val = (float)Screen.width / x; val = (float)Screen.width / x;
//cam.targetTexture = new RenderTexture((int)x, (int)y, 24, RenderTextureFormat.ARGB32);
cam.targetTexture = new RenderTexture((int)x, (int)y, 24, RenderTextureFormat.ARGB32);
transform.position = new Vector3(targetpos.position.x, targetpos.position.y, transform.position.z); transform.position = new Vector3(targetpos.position.x, targetpos.position.y, transform.position.z);
//cam.orthographicSize = 5f / val + 0.9f; //cam.orthographicSize = 5f / val + 0.9f;
...@@ -114,7 +105,6 @@ namespace NatSuite.Examples { ...@@ -114,7 +105,6 @@ namespace NatSuite.Examples {
recorder = null; recorder = null;
Test();
} }
public async void StopRecording () public async void StopRecording ()
...@@ -141,18 +131,6 @@ namespace NatSuite.Examples { ...@@ -141,18 +131,6 @@ namespace NatSuite.Examples {
GameEndPanel.Instance.ShareMp4_Path = path; GameEndPanel.Instance.ShareMp4_Path = path;
OnReplay(path); OnReplay(path);
} }
private void Test()
{
Debug.Log($"测试创建");
string path = "/storage/emulated/0/XYZ";
if (!Directory.Exists(path))
{
Debug.Log("不在");
Directory.CreateDirectory(path);
}
Debug.Log("完成");
}
private void OnReplay(string path) private void OnReplay(string path)
{ {
string destination = ""; string destination = "";
......
This diff is collapsed.
...@@ -2,9 +2,12 @@ using NatSuite.Examples; ...@@ -2,9 +2,12 @@ using NatSuite.Examples;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine; using UnityEngine;
using UnityEngine.Device; using UnityEngine.Device;
using UnityEngine.UI; using UnityEngine.UI;
using UnityEngine.Video;
using Debug = UnityEngine.Debug;
using SystemInfo = UnityEngine.SystemInfo; using SystemInfo = UnityEngine.SystemInfo;
public class GameEndPanel : MonoBehaviour public class GameEndPanel : MonoBehaviour
...@@ -32,6 +35,12 @@ public class GameEndPanel : MonoBehaviour ...@@ -32,6 +35,12 @@ public class GameEndPanel : MonoBehaviour
public GameObject[] sHow_OnRecorder; //在录屏的时候显示的节点 public GameObject[] sHow_OnRecorder; //在录屏的时候显示的节点
public GameObject[] nOtShow_OnRecorder; //在录屏的时候不显示的节点 public GameObject[] nOtShow_OnRecorder; //在录屏的时候不显示的节点
public GameObject WaterMask_Canvas; //水印画布
public VideoPlayer ADVideo; //加在后面的水印视频
public GameObject WaterMarks; //录屏加的水印
public Transform WaterMarks_Pos; //水印的位置
public float WaitWaterMaskVideo_Time; //等水印视频播完的时间
[HideInInspector] [HideInInspector]
public string ShareMp4_Path; public string ShareMp4_Path;
private void Awake() private void Awake()
...@@ -50,16 +59,7 @@ public class GameEndPanel : MonoBehaviour ...@@ -50,16 +59,7 @@ public class GameEndPanel : MonoBehaviour
RegisterEvent(true); RegisterEvent(true);
IsRecorder(false); IsRecorder(false);
} WaterMask_Canvas.SetActive(false);
private void Update()
{
if (Input.GetKeyDown(KeyCode.S)) //测试把图片移到结束界面下来
{
BG.SetActive(true);
MovePic();
}
} }
public void OpenPanel() public void OpenPanel()
...@@ -108,12 +108,23 @@ public class GameEndPanel : MonoBehaviour ...@@ -108,12 +108,23 @@ public class GameEndPanel : MonoBehaviour
StartCoroutine(DelayToStop()); StartCoroutine(DelayToStop());
} }
IEnumerator DelayToStop() IEnumerator DelayToStop()
{ {
yield return new WaitForSeconds(1); yield return new WaitForSeconds(1); //这里是等图片的效果播完
ADVideo.Play();
ADVideo.transform.GetComponent<RectTransform>().sizeDelta = new Vector2(GameMgr.Ins.md.png.width, GameMgr.Ins.md.png.height);
ADVideo.transform.position = Mask.transform.position;
ADVideo.transform.localScale = GameMgr.Ins.GetComponent<ScaleToImage>().target.localScale;
yield return new WaitForSeconds(WaitWaterMaskVideo_Time); //这里等个两秒,等录屏后面的视频播完再停止录屏
ADVideo.Stop();
WaterMarks.SetActive(false);
replayCam.StopRecording(); replayCam.StopRecording();
IsRecorder(false); IsRecorder(false);
WaterMask_Canvas.SetActive(false);
} }
private void CreateItem() //创建列表item private void CreateItem() //创建列表item
...@@ -148,21 +159,12 @@ public class GameEndPanel : MonoBehaviour ...@@ -148,21 +159,12 @@ public class GameEndPanel : MonoBehaviour
yield return new WaitForEndOfFrame(); yield return new WaitForEndOfFrame();
new NativeShare().AddFile(ShareMp4_Path).Share(); new NativeShare().AddFile(ShareMp4_Path).Share();
//new NativeShare().AddFile(ShareMp4_Path)
// .SetSubject("Subject goes here").SetText("Hello world!").SetUrl("https://github.com/yasirkula/UnityNativeShare")
// .SetCallback((result, shareTarget) => Debug.Log("Share result: " + result + ", selected app: " + shareTarget))
// .Share();
// Share on WhatsApp only, if installed (Android only)
//if( NativeShare.TargetExists( "com.whatsapp" ) )
// new NativeShare().AddFile( filePath ).AddTarget( "com.whatsapp" ).Share();
} }
private void RePlayVideo_Btn_Click() private void RePlayVideo_Btn_Click()
{ {
Debug.Log("点击回放动画"); Debug.Log("点击回放动画");
//GameMgr.Ins.RePlay(); GameMgr.Ins.RePlay();
} }
...@@ -170,8 +172,12 @@ public class GameEndPanel : MonoBehaviour ...@@ -170,8 +172,12 @@ public class GameEndPanel : MonoBehaviour
{ {
Debug.Log("点击保存视频 ,开始录屏了"); Debug.Log("点击保存视频 ,开始录屏了");
GameMgr.Ins.RePlay(); GameMgr.Ins.RePlay();
WaterMask_Canvas.SetActive(true);
WaterMarks.SetActive(true);
WaterMarks.transform.position = WaterMarks_Pos.transform.position;
replayCam.StartRecording(); replayCam.StartRecording();
IsRecorder(true); IsRecorder(true);
} }
...@@ -222,18 +228,6 @@ public class GameEndPanel : MonoBehaviour ...@@ -222,18 +228,6 @@ public class GameEndPanel : MonoBehaviour
{ {
//Debug.Log("11111 点击测试显示开屏广告按钮"); //Debug.Log("11111 点击测试显示开屏广告按钮");
MaxSDKManager.Instance.ShowAdByType(AdType.OpenApp,"点击测试显示开屏广告按钮"); MaxSDKManager.Instance.ShowAdByType(AdType.OpenApp,"点击测试显示开屏广告按钮");
texts[0] = "设备模型:" + SystemInfo.deviceModel;
texts[1] = "设备名称:" + SystemInfo.deviceName;
texts[2] = "设备类型:" + SystemInfo.deviceType;
texts[3] = "设备唯一标识符:" + SystemInfo.deviceUniqueIdentifier;
texts[4] = "操作系统:" + SystemInfo.operatingSystem;
foreach (var item in texts)
{
Debug.Log($"11111 {item}");
}
} }
} }
...@@ -11,7 +11,7 @@ TagManager: ...@@ -11,7 +11,7 @@ TagManager:
- -
- Water - Water
- UI - UI
- - Video
- -
- -
- -
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment