1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2024-11-30 13:44:28 +01:00

Add Custom Button Setting

This commit is contained in:
xpeng 2022-08-19 17:51:47 +02:00
parent 8a9fe6d33a
commit f11ff3b604
7 changed files with 5011 additions and 50 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ButtonSettingManager : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
using TMPro;
using WindowsInput.Native;
public class ButtonSettingManager : MonoBehaviour
{
public ButtonToKey Button;
TMP_Dropdown Dropdown;
void Start()
{
Dropdown = GetComponent<TMP_Dropdown>();
PopulateList();
GetKeyCode();
}
void GetKeyCode()
{
if (JsonConfig.HasKey(gameObject.name))
Dropdown.value = JsonConfig.GetInt(gameObject.name);
OnValueChanged(Dropdown.value);
}
public void OnValueChanged(int value)
{
Button.keyToPress = (VirtualKeyCode)Enum.GetValues(typeof(VirtualKeyCode)).GetValue(value);
}
void PopulateList()
{
string[] enumNames = Enum.GetNames(typeof(VirtualKeyCode));
List<string> keyNames = new List<string>(enumNames);
Dropdown.AddOptions(keyNames);
}
}

View File

@ -25,7 +25,7 @@ public class ValueManager : MonoBehaviour
public void ChangeValueContinue(float value) public void ChangeValueContinue(float value)
{ {
tempValue = value; tempValue = value;
Value += value; Value += Time.deltaTime * value;
tmp.text = String.Format("{0:F2}", Value); tmp.text = String.Format("{0:F2}", Value);
isPointerDown = true; isPointerDown = true;
} }

Binary file not shown.

Binary file not shown.

View File

@ -152,9 +152,7 @@ PlayerSettings:
- {fileID: 0} - {fileID: 0}
- {fileID: 0} - {fileID: 0}
- {fileID: 0} - {fileID: 0}
- {fileID: 6536100391545742739, guid: 55d1ec7a4296de343b6d3bb6f9a19731, type: 2}
- {fileID: 0} - {fileID: 0}
- {fileID: -6018045015233401694, guid: 3999ab811e936714280a476b3a032d86, type: 2}
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1 m_HolographicPauseOnTrackingLoss: 1