蓝色星空 1 year ago
parent
commit
f05cde9967

+ 1 - 0
Assets/Resources/BlueUserConfig.txt

@@ -0,0 +1 @@
+{"BlueUserType":"NingYuan","Auto":false,"ERNIEBot":false}

+ 7 - 0
Assets/Resources/BlueUserConfig.txt.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: f46b90203dcd8984c85dbd1ddd124ee4
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Assets/StreamingAssets/BlueUserListConfig.txt → Assets/Resources/BlueUserListConfig.txt


+ 0 - 0
Assets/StreamingAssets/BlueUserListConfig.txt.meta → Assets/Resources/BlueUserListConfig.txt.meta


+ 49 - 2
Assets/Resources/Template/Prefab/Video.prefab

@@ -1101,6 +1101,7 @@ GameObject:
   - component: {fileID: 5579340848617264414}
   - component: {fileID: 4277880848986068514}
   - component: {fileID: 175833524124856625}
+  - component: {fileID: 4948651655336917687}
   m_Layer: 0
   m_Name: Video
   m_TagString: Untagged
@@ -1256,6 +1257,52 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   boundingBox: {fileID: 8320199229358921942}
   manipulationHandler: {fileID: 4277880848986068514}
+--- !u!114 &4948651655336917687
+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: b3ba789618d29764280b4afcd4513b22, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  scaleType: 0
+  duration: 0.3
+  scaleRatio: 0.2
+  PositionAnimation: 0
+  forwardRatio: 0.05
+  onClick:
+    m_PersistentCalls:
+      m_Calls:
+      - m_Target: {fileID: 1721331326262511666}
+        m_TargetAssemblyTypeName: VideoPlayBtn, Assembly-CSharp
+        m_MethodName: PlayVideo
+        m_Mode: 1
+        m_Arguments:
+          m_ObjectArgument: {fileID: 0}
+          m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+          m_IntArgument: 0
+          m_FloatArgument: 0
+          m_StringArgument: 
+          m_BoolArgument: 0
+        m_CallState: 2
+  onEnter:
+    m_PersistentCalls:
+      m_Calls: []
+  onDown:
+    m_PersistentCalls:
+      m_Calls: []
+  onUp:
+    m_PersistentCalls:
+      m_Calls: []
+  onExit:
+    m_PersistentCalls:
+      m_Calls: []
+  initScale: {x: 0, y: 0, z: 0}
+  initPosition: {x: 0, y: 0, z: 0}
 --- !u!1 &6405407511848220291
 GameObject:
   m_ObjectHideFlags: 0
@@ -2518,7 +2565,7 @@ BoxCollider:
   m_GameObject: {fileID: 8654540562372780374}
   m_Material: {fileID: 0}
   m_IsTrigger: 0
-  m_Enabled: 1
+  m_Enabled: 0
   serializedVersion: 2
   m_Size: {x: 1.8, y: 0.8, z: 0.01}
   m_Center: {x: 0, y: 0, z: 0}
@@ -2529,7 +2576,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8654540562372780374}
-  m_Enabled: 1
+  m_Enabled: 0
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: b3ba789618d29764280b4afcd4513b22, type: 3}
   m_Name: 

+ 24 - 9
Assets/Scripts/Blue/Editor/EditorUser.cs

@@ -6,7 +6,6 @@ using UnityEngine;
 
 public static class EditorUser
 {
-
     [MenuItem("用户/Blue/自动定位", false)]
     static void BlueAutoImmersalSet()
     {
@@ -85,8 +84,8 @@ public static class EditorUser
 
     private static void WriteUserListConfig(string UserName)
     {
-        string folderPath = Application.dataPath + "/StreamingAssets";
-        string filePath = Application.dataPath + "/StreamingAssets" + "/BlueUserListConfig.txt";
+        string folderPath = Application.dataPath + "/Resources";
+        string filePath = folderPath + "/BlueUserListConfig.txt";
 
         if (!Directory.Exists(folderPath))
             Directory.CreateDirectory(folderPath);
@@ -111,9 +110,10 @@ public static class EditorUser
     private static BlueUserConfig mBlueUserConfig;
     private static void WriteUserConfig(BlueUserType blueUserType)
     {
-        string filePath = Application.dataPath + "/StreamingAssets" + "/BlueUserConfig.txt";
-        string filePathList = Application.dataPath + "/StreamingAssets" + "/BlueUserListConfig.txt";
-        string jsonString = File.ReadAllText(filePathList);
+        string filePathRes = Application.dataPath + "/Resources" + "/BlueUserConfig.txt";
+        string filePathStr = Application.dataPath + "/StreamingAssets" + "/BlueUserConfig.txt";
+        string filePathList = Application.dataPath + "/Resources" + "/BlueUserListConfig.txt";
+        string jsonString = Resources.Load<TextAsset>("BlueUserListConfig").text;
         List<BlueUserConfig> BlueUserListConfig = JsonConvert.DeserializeObject<List<BlueUserConfig>>(jsonString);
         foreach(var BlueUserConfig in BlueUserListConfig)
         {
@@ -127,12 +127,27 @@ public static class EditorUser
                 };
             }
         }
+
         string jsonData = JsonConvert.SerializeObject(mBlueUserConfig);
-        if (File.Exists(filePath))
-            File.WriteAllText(filePath, jsonData);
+        if (File.Exists(filePathRes))
+            File.WriteAllText(filePathRes, jsonData);
         else
         {
-            FileStream file = new FileStream(filePath, FileMode.Create);
+            FileStream file = new FileStream(filePathRes, FileMode.Create);
+            byte[] bts = System.Text.Encoding.UTF8.GetBytes(jsonData);
+            file.Write(bts, 0, bts.Length);
+            if (file != null)
+            {
+                file.Flush();
+                file.Close();
+                file.Dispose();
+            }
+        }
+        if (File.Exists(filePathStr))
+            File.WriteAllText(filePathStr, jsonData);
+        else
+        {
+            FileStream file = new FileStream(filePathStr, FileMode.Create);
             byte[] bts = System.Text.Encoding.UTF8.GetBytes(jsonData);
             file.Write(bts, 0, bts.Length);
             if (file != null)