1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2024-09-24 02:58:22 +02:00

update framework and add more button

This commit is contained in:
xpeng 2022-02-15 00:37:33 +01:00
parent 72c73e6e0c
commit 0565fbadbe
12 changed files with 227 additions and 86 deletions

19
.gitignore vendored
View File

@ -1,5 +1,5 @@
# Created by https://www.toptal.com/developers/gitignore/api/unity,visualstudiocode,visualstudio
# Edit at https://www.toptal.com/developers/gitignore?templates=unity,visualstudiocode,visualstudio
# Created by https://www.toptal.com/developers/gitignore/api/unity,visualstudio,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=unity,visualstudio,visualstudiocode
### Unity ###
# This .gitignore file should be placed at the root of your Unity project directory
@ -75,12 +75,12 @@ crashlytics-build.properties
/[Aa]ssets/[Ss]treamingAssets/aa/*
### VisualStudioCode ###
.vscode/*
.vscode/settings.json
.vscode/tasks.json
.vscode/launch.json
.vscode/extensions.json
.vscode/*.code-snippets
.vscode/
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
@ -183,6 +183,7 @@ StyleCopReport.xml
*_wpftmp.csproj
*.log
*.tlog
.vsconfig
*.vspscc
*.vssscc
.builds
@ -481,5 +482,5 @@ FodyWeavers.xsd
### VisualStudio Patch ###
# Additional files built by Visual Studio
# End of https://www.toptal.com/developers/gitignore/api/unity,visualstudiocode,visualstudio
# End of https://www.toptal.com/developers/gitignore/api/unity,visualstudio,visualstudiocode
Settings.json

Binary file not shown.

View File

@ -73,6 +73,6 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.9063317, g: 0.9063317, b: 0.9063317, a: 1}
- _Color: {r: 0.11320752, g: 0.11320752, b: 0.11320752, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -63,7 +63,7 @@ Material:
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Metallic: 0.063
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02

View File

@ -61,9 +61,9 @@ Material:
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _Glossiness: 0.105
- _GlossyReflections: 1
- _Metallic: 0
- _Metallic: 0.454
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02

View File

@ -2596,33 +2596,16 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 3300913674446824185, guid: ea6463ca199d52046962b69f2ab654ef, type: 3}
m_PrefabInstance: {fileID: 856927026}
m_PrefabAsset: {fileID: 0}
--- !u!114 &856927132
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
--- !u!1 &856927132 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1746076001426667529, guid: ea6463ca199d52046962b69f2ab654ef, type: 3}
m_PrefabInstance: {fileID: 856927026}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856927131}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 959162235c603d347af0fd284c7d339d, type: 3}
m_Name:
m_EditorClassIdentifier:
keyToPress: 13
--- !u!64 &856927133
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
--- !u!1 &856927133 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: -5841124433648222726, guid: ea6463ca199d52046962b69f2ab654ef, type: 3}
m_PrefabInstance: {fileID: 856927026}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856927131}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: -7726249702934650104, guid: ea6463ca199d52046962b69f2ab654ef, type: 3}
--- !u!1 &856927134 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: -3244494192881012207, guid: ea6463ca199d52046962b69f2ab654ef, type: 3}
@ -2655,6 +2638,146 @@ MeshCollider:
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 5127587611378854871, guid: ea6463ca199d52046962b69f2ab654ef, type: 3}
--- !u!1 &856927137 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: -1467160461494962064, guid: ea6463ca199d52046962b69f2ab654ef, type: 3}
m_PrefabInstance: {fileID: 856927026}
m_PrefabAsset: {fileID: 0}
--- !u!1 &856927138 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: -7937243374823538949, guid: ea6463ca199d52046962b69f2ab654ef, type: 3}
m_PrefabInstance: {fileID: 856927026}
m_PrefabAsset: {fileID: 0}
--- !u!114 &856927139
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856927131}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 959162235c603d347af0fd284c7d339d, type: 3}
m_Name:
m_EditorClassIdentifier:
keyToPress: 13
--- !u!65 &856927140
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856927131}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.00075010216, y: 0.0008630994, z: 0.0012382854}
m_Center: {x: -0.0000000023283064, y: -4.656613e-10, z: 0}
--- !u!114 &856927141
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856927132}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 959162235c603d347af0fd284c7d339d, type: 3}
m_Name:
m_EditorClassIdentifier:
keyToPress: 50
--- !u!65 &856927142
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856927132}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.020000005, y: 0.020000001, z: 0.019999996}
m_Center: {x: -0.000000059604645, y: 0, z: 0.000000014901161}
--- !u!114 &856927143
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856927133}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 959162235c603d347af0fd284c7d339d, type: 3}
m_Name:
m_EditorClassIdentifier:
keyToPress: 49
--- !u!65 &856927144
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856927133}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.020000005, y: 0.020000001, z: 0.019999996}
m_Center: {x: -0.000000059604645, y: 0.000000029802322, z: 0}
--- !u!114 &856927145
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856927137}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 959162235c603d347af0fd284c7d339d, type: 3}
m_Name:
m_EditorClassIdentifier:
keyToPress: 19
--- !u!65 &856927146
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856927137}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.020000005, y: 0.020000013, z: 0.02000001}
m_Center: {x: -0.000000059604645, y: -0.000000014901161, z: -0.000000029802322}
--- !u!114 &856927147
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856927138}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 959162235c603d347af0fd284c7d339d, type: 3}
m_Name:
m_EditorClassIdentifier:
keyToPress: 145
--- !u!65 &856927148
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856927138}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.020000005, y: 0.020000007, z: 0.020000001}
m_Center: {x: -0.000000059604645, y: 0.000000014901161, z: 0}
--- !u!1001 &903004875
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -1,15 +1,17 @@
using System;
using System.Runtime.InteropServices;
using UnityEngine;
using WindowsInput.Native;
public class ButtonToKey : MonoBehaviour
{
[DllImport("user32.dll")]
public static extern uint MapVirtualKey(uint uCode, uint uMapType);
[DllImport("user32.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);
public byte keyToPress;
public VirtualKeyCode keyToPress;
//public Light lightTarget;
//public UnityEditor.Experimental.TerrainAPI.VirtualKeyCode Keys;
void Start()
{

View File

@ -3,43 +3,27 @@ using UnityEngine;
using Newtonsoft.Json;
using Unity.XR.CoreUtils;
using uWindowCapture;
using WindowsInput.Native;
using System;
public class SettingsManager : MonoBehaviour
{
string JsonPath;
string JsonStr;
Settings Setting = new Settings();
Settings Setting = new Settings();
bool FocusChecked = true;
public GameObject LHandObj;
public GameObject RHandObj;
public GameObject ScreenObj;
public GameObject SmoothCameraObj;
public Camera SmoothCamera;
public GameObject XROriginObj;
public GameObject Button1Obj;
void Start()
{
JsonPath = Path.GetDirectoryName(Application.dataPath) + "/Settings.json";
Debug.Log(JsonPath);
if (!File.Exists (JsonPath))
{
Settings Setting = new Settings()
{
HandSize = 8f,
HandPositionX = 2f,
HandPositionY = -2f,
HandPositionZ = 7f,
PlayerHigh = 180f,
CaptureFrameRate = 90,
TouchRefreshRate = 90,
CameraSmooth = 0.1f,
CameraFOV = 85f,
HapticDuration = 0.15f,
HapticAmplitude = 1
};
JsonStr = JsonConvert.SerializeObject(Setting, Formatting.Indented);
Debug.Log(JsonStr);
File.AppendAllText(JsonPath, JsonStr);
}
else
{
JsonStr = File.ReadAllText(JsonPath);
Setting = JsonConvert.DeserializeObject<Settings>(JsonStr);
}
FirstStart();
UpdateFromFile();
}
bool FocusChecked = true;
void Update()
{
if (Input.GetKeyDown(KeyCode.F5) | !FocusChecked)
@ -56,13 +40,6 @@ public class SettingsManager : MonoBehaviour
if (!Application.isFocused)
FocusChecked=false;
}
public GameObject LHandObj;
public GameObject RHandObj;
public GameObject ScreenObj;
public GameObject SmoothCameraObj;
public Camera SmoothCamera;
public GameObject XROriginObj;
void UpdateFromFile()
{
LHandObj.transform.localScale = new Vector3(Setting.HandSize/100,Setting.HandSize/100,Setting.HandSize/100);
@ -82,9 +59,41 @@ public class SettingsManager : MonoBehaviour
RHandScp.amplitude = Setting.HapticAmplitude;
XROriginScp.CameraYOffset = Setting.PlayerHigh/100;
Time.fixedDeltaTime = 1/Setting.TouchRefreshRate;
ButtonToKey Button1Scp = Button1Obj.GetComponent<ButtonToKey>();
Button1Scp.keyToPress = (VirtualKeyCode)Enum.Parse(typeof(VirtualKeyCode), Setting.Button1);
}
void FirstStart()
{
JsonPath = Path.GetDirectoryName(Application.dataPath) + "/Settings.json";
Debug.Log(JsonPath);
if (!File.Exists (JsonPath))
{
Settings Setting = new Settings()
{
HandSize = 8f,
HandPositionX = 2f,
HandPositionY = -2f,
HandPositionZ = 7f,
PlayerHigh = 180f,
CaptureFrameRate = 90,
TouchRefreshRate = 90,
CameraSmooth = 0.1f,
CameraFOV = 85f,
HapticDuration = 0.15f,
HapticAmplitude = 1,
Button1 = "SCROLL"
};
JsonStr = JsonConvert.SerializeObject(Setting, Formatting.Indented);
Debug.Log(JsonStr);
File.AppendAllText(JsonPath, JsonStr);
}
else
{
JsonStr = File.ReadAllText(JsonPath);
Setting = JsonConvert.DeserializeObject<Settings>(JsonStr);
}
}
}
public class Settings
@ -100,4 +109,9 @@ public class Settings
public float CameraFOV { get; set; }
public float HapticDuration { get; set; }
public float HapticAmplitude { get; set; }
public string Button1 { get; set; }
//public string Button2 { get; set; }
//public string Button3 { get; set; }
//public string Button4 { get; set; }
}

View File

@ -2,14 +2,14 @@
"dependencies": {
"com.unity.collab-proxy": "1.15.7",
"com.unity.ide.rider": "2.0.7",
"com.unity.ide.visualstudio": "2.0.12",
"com.unity.ide.visualstudio": "2.0.14",
"com.unity.ide.vscode": "1.2.4",
"com.unity.nuget.newtonsoft-json": "2.0.2",
"com.unity.test-framework": "1.1.30",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.4.8",
"com.unity.ugui": "1.0.0",
"com.unity.xr.interaction.toolkit": "2.0.0-pre.6",
"com.unity.xr.interaction.toolkit": "2.0.0-pre.7",
"com.unity.xr.management": "4.2.1",
"com.unity.xr.openxr": "1.3.1",
"com.unity.modules.ai": "1.0.0",
@ -43,5 +43,6 @@
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
}
},
"scopedRegistries": []
}

View File

@ -27,7 +27,7 @@
"url": "https://packages.unity.com"
},
"com.unity.ide.visualstudio": {
"version": "2.0.12",
"version": "2.0.14",
"depth": 0,
"source": "registry",
"dependencies": {
@ -125,7 +125,7 @@
"url": "https://packages.unity.com"
},
"com.unity.xr.interaction.toolkit": {
"version": "2.0.0-pre.6",
"version": "2.0.0-pre.7",
"depth": 0,
"source": "registry",
"dependencies": {

View File

@ -1,2 +1,2 @@
m_EditorVersion: 2020.3.26f1
m_EditorVersionWithRevision: 2020.3.26f1 (7298b473bc1a)
m_EditorVersion: 2020.3.28f1
m_EditorVersionWithRevision: 2020.3.28f1 (f5400f52e03f)

View File

@ -4,7 +4,7 @@
QualitySettings:
m_ObjectHideFlags: 0
serializedVersion: 5
m_CurrentQuality: 2
m_CurrentQuality: 4
m_QualitySettings:
- serializedVersion: 2
name: Very Low
@ -230,7 +230,7 @@ QualitySettings:
PS4: 5
PSP2: 2
Stadia: 5
Standalone: 2
Standalone: 4
WebGL: 3
Windows Store Apps: 5
XboxOne: 5