Просмотр исходного кода

修复视频不能拖拽缩放功能

蓝色星空 1 год назад
Родитель
Сommit
1675098a07

+ 15 - 5
Assets/Prefab/Material/VideoUI.mat

@@ -2,18 +2,19 @@
 %TAG !u! tag:unity3d.com,2011:
 --- !u!21 &2100000
 Material:
-  serializedVersion: 6
+  serializedVersion: 8
   m_ObjectHideFlags: 0
   m_CorrespondingSourceObject: {fileID: 0}
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_Name: VideoUI
-  m_Shader: {fileID: 4800000, guid: fc66c90331fe8244d8a9850cdc745224, type: 3}
-  m_ShaderKeywords: 
+  m_Shader: {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
+  m_ValidKeywords: []
+  m_InvalidKeywords: []
   m_LightmapFlags: 4
   m_EnableInstancingVariants: 0
   m_DoubleSidedGI: 0
-  m_CustomRenderQueue: 1000
+  m_CustomRenderQueue: -1
   stringTagMap: {}
   disabledShaderPasses: []
   m_SavedProperties:
@@ -55,8 +56,10 @@ Material:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
+    m_Ints: []
     m_Floats:
     - _BumpScale: 1
+    - _ColorMask: 15
     - _Cutoff: 0.5
     - _DetailNormalMapScale: 1
     - _Distort: 0
@@ -76,9 +79,16 @@ Material:
     - _SmoothnessTextureChannel: 0
     - _SpecularHighlights: 1
     - _SrcBlend: 1
+    - _Stencil: 0
+    - _StencilComp: 8
+    - _StencilOp: 0
+    - _StencilReadMask: 255
+    - _StencilWriteMask: 255
     - _UVSec: 0
+    - _UseUIAlphaClip: 0
     - _ZWrite: 1
     m_Colors:
-    - _Color: {r: 1, g: 1, b: 1, a: 1}
+    - _Color: {r: 1, g: 1, b: 1, a: 0}
     - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
     - _MainColor: {r: 0.122641504, g: 0.122641504, b: 0.122641504, a: 1}
+  m_BuildTextureStacks: []

+ 20 - 4
Assets/Resources/Template/Prefab/Video.prefab

@@ -980,7 +980,7 @@ RectTransform:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 1856638061838950079}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
-  m_LocalPosition: {x: 0, y: 0, z: -0.001}
+  m_LocalPosition: {x: 0, y: 0, z: -0.005}
   m_LocalScale: {x: 0.2630543, y: 0.45, z: 2.6}
   m_ConstrainProportionsScale: 0
   m_Children:
@@ -1100,6 +1100,7 @@ GameObject:
   - component: {fileID: 8320199229358921942}
   - component: {fileID: 5579340848617264414}
   - component: {fileID: 4277880848986068514}
+  - component: {fileID: 175833524124856625}
   m_Layer: 0
   m_Name: Video
   m_TagString: Untagged
@@ -1241,6 +1242,21 @@ MonoBehaviour:
   canTwoHandScale: 0
   minScaleRatio: 0.5
   maxScaleRatio: 3
+--- !u!114 &175833524124856625
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 6134645586828692388}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: f2c924915f6be274b8af2986784ee2c1, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  boundingBox: {fileID: 8320199229358921942}
+  manipulationHandler: {fileID: 4277880848986068514}
+  obj_BoundingBox: {fileID: 0}
 --- !u!1 &6405407511848220291
 GameObject:
   m_ObjectHideFlags: 0
@@ -1951,7 +1967,7 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   m_Material: {fileID: 0}
   m_Color: {r: 1, g: 1, b: 1, a: 1}
-  m_RaycastTarget: 1
+  m_RaycastTarget: 0
   m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
   m_Maskable: 1
   m_OnCullStateChanged:
@@ -2213,7 +2229,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 0
+  m_IsActive: 1
 --- !u!4 &8554676593696482102
 Transform:
   m_ObjectHideFlags: 0
@@ -2389,7 +2405,7 @@ RectTransform:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8654540562372780374}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
-  m_LocalPosition: {x: 0, y: 0, z: 0.0004}
+  m_LocalPosition: {x: 0, y: 0, z: 0.005}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children: []

+ 8 - 0
Assets/Scripts/Blue/Patch.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 51e3f410849c08747862b66c35fe28d6
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Assets/Scripts/Blue/Patch/Video.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: e1aa64ef20169eb4aba24fe663ebce38
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 17 - 0
Assets/Scripts/Blue/Patch/Video/Patch_VideoCommand.cs

@@ -0,0 +1,17 @@
+using Blue;
+
+public struct Patch_VideoCommand : ICommand
+{
+    private bool set;
+    public Patch_VideoCommand(bool set)
+    {
+        this.set = set;
+    }
+    public void OnExcute()
+    {
+        this.SendEvent<Patch_VideoEvent>(new Patch_VideoEvent()
+        {
+            set = this.set
+        });
+    }
+}

+ 11 - 0
Assets/Scripts/Blue/Patch/Video/Patch_VideoCommand.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9d8d0fb8588b9a248a26dc389bcb9b16
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 45 - 0
Assets/Scripts/Blue/Patch/Video/Patch_VideoController.cs

@@ -0,0 +1,45 @@
+using System.Collections;
+using System.Collections.Generic;
+using Blue;
+using SC.XR.Unity.Module_InputSystem;
+using UnityEngine;
+
+public class Patch_VideoController : AbstractController
+{
+    [SerializeField] private BoundingBox boundingBox;
+    [SerializeField] private ManipulationHandler manipulationHandler;
+    [SerializeField] private GameObject obj_BoundingBox;
+    void Start()
+    {
+        this.RegisterEvent<Patch_VideoEvent>(e=>
+        {
+            if(e.set)
+            {
+                if(obj_BoundingBox!=null)
+                {
+                    obj_BoundingBox.SetActive(true);
+                    manipulationHandler.enabled = true;
+                }
+                else
+                {
+                    boundingBox.enabled = true;
+                    manipulationHandler.enabled = true;
+                    StartCoroutine(GetBoundingBox());
+                }
+            }
+            else
+            {
+                obj_BoundingBox.SetActive(false);
+                boundingBox.enabled = false;
+                manipulationHandler.enabled = false;
+            }
+        });
+    }
+
+    private IEnumerator GetBoundingBox()
+    {
+        yield return null;
+        if(transform.Find("BoundingBox").gameObject!=null)
+            obj_BoundingBox = transform.Find("BoundingBox").gameObject;
+    }
+}

+ 11 - 0
Assets/Scripts/Blue/Patch/Video/Patch_VideoController.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f2c924915f6be274b8af2986784ee2c1
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 6 - 0
Assets/Scripts/Blue/Patch/Video/Patch_VideoEvent.cs

@@ -0,0 +1,6 @@
+using Blue;
+
+public class Patch_VideoEvent : IEvent
+{
+    public bool set;
+}

+ 11 - 0
Assets/Scripts/Blue/Patch/Video/Patch_VideoEvent.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 67a2d4c81a069024e945e24048bc6c28
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 0
Assets/Scripts/UI/GameManager.cs

@@ -427,6 +427,7 @@ public class GameManager : MonoSingleton<GameManager>
             m_EditorCanvas.eulerAngles = new Vector3(0, OpenXRCamera.Instance.head.eulerAngles.y, 0);
 
             CommandSystem.Instance.Send( new EditorSettingCommand(true){ } );
+            CommandSystem.Instance.Send( new Patch_VideoCommand(true){ } );
         }
         else
         {
@@ -442,6 +443,7 @@ public class GameManager : MonoSingleton<GameManager>
                 SpoitIndex = -1;
             }
             CommandSystem.Instance.Send( new EditorSettingCommand(false){ } );
+            CommandSystem.Instance.Send( new Patch_VideoCommand(false){ } );
         }
 
     }