add additional tab; fix config panel occlusion bug
This commit is contained in:
@@ -20,10 +20,10 @@ public class ButtonSettingManager : MonoBehaviour
|
||||
|
||||
public enum ButtonType
|
||||
{
|
||||
Test = 0,
|
||||
Service = 1,
|
||||
Coin = 2,
|
||||
Custom = 3,
|
||||
TestKeyBind = 0,
|
||||
ServiceKeyBind = 1,
|
||||
CoinKeyBind = 2,
|
||||
CustomKeyBind = 3,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public class Config
|
||||
public int CoinKeyBind = 31;
|
||||
public int CustomKeyBind = 170;
|
||||
public bool FlatShadedRing = false;
|
||||
public bool DynamicProbe = true;
|
||||
public bool PostProcess = true;
|
||||
public int AntiAliasing = 0;
|
||||
public string batFileLocation = "";
|
||||
|
||||
@@ -24,11 +24,11 @@ public class ConfigManager : MonoBehaviour
|
||||
{
|
||||
onConfigChanged += EnsureInitialization;
|
||||
onConfigChanged += SaveFile;
|
||||
ConfigPanelComponents = GetConfigPanelComponents();
|
||||
EnsureInitialization();
|
||||
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
EnsureInitialization();
|
||||
AddListenerToWidget(ConfigPanelComponents);
|
||||
onConfigChanged?.Invoke();
|
||||
}
|
||||
@@ -37,6 +37,7 @@ public class ConfigManager : MonoBehaviour
|
||||
if (hasInitialized)
|
||||
return;
|
||||
LoadFile();
|
||||
ConfigPanelComponents = GetConfigPanelComponentsStatic();
|
||||
UpdateConfigPanelFromConfig(ref ConfigPanelComponents);
|
||||
hasInitialized = true;
|
||||
}
|
||||
@@ -88,6 +89,7 @@ public class ConfigManager : MonoBehaviour
|
||||
|
||||
public static GameObject GetConfigPanelWidget(string configKeyName)
|
||||
{
|
||||
EnsureInitialization();
|
||||
foreach (var item in ConfigPanelComponents)
|
||||
{
|
||||
if (item.ConfigKeyName == configKeyName)
|
||||
@@ -109,6 +111,13 @@ public class ConfigManager : MonoBehaviour
|
||||
return _configPanelComponents;
|
||||
}
|
||||
|
||||
private static List<ConfigPanelComponent> GetConfigPanelComponentsStatic()
|
||||
{
|
||||
var _configPanelComponents = new List<ConfigPanelComponent>();
|
||||
_configPanelComponents = GameObject.FindObjectOfType<ConfigManager>().GetConfigPanelComponents();
|
||||
return _configPanelComponents;
|
||||
}
|
||||
|
||||
private void AddListenerToWidget(List<ConfigPanelComponent> _configPanelComponents)
|
||||
{
|
||||
foreach (var configPanelComponent in _configPanelComponents)
|
||||
@@ -151,7 +160,7 @@ public class ConfigManager : MonoBehaviour
|
||||
valueManager.onValueChanged.AddListener(delegate
|
||||
{
|
||||
var field = config.GetType().GetField(configPanelComponent.ConfigKeyName);
|
||||
field.SetValue(config, valueManager.Value);
|
||||
field.SetValue(config, valueManager.value);
|
||||
onConfigChanged?.Invoke();
|
||||
});
|
||||
}
|
||||
@@ -160,38 +169,32 @@ public class ConfigManager : MonoBehaviour
|
||||
|
||||
private static void UpdateConfigPanelFromConfig(ref List<ConfigPanelComponent> _configPanelComponents)
|
||||
{
|
||||
|
||||
foreach (var configPanelComponent in _configPanelComponents)
|
||||
{
|
||||
Debug.Log(configPanelComponent.ConfigKeyName);
|
||||
var componentObject = configPanelComponent.Widget;
|
||||
if (componentObject.GetComponent<TMP_Dropdown>() != null)
|
||||
{
|
||||
var dropdown = componentObject.GetComponent<TMP_Dropdown>();
|
||||
var field = config.GetType().GetField(configPanelComponent.ConfigKeyName);
|
||||
dropdown.value = (int)field.GetValue(config);
|
||||
dropdown.onValueChanged?.Invoke(dropdown.value);
|
||||
}
|
||||
else if (componentObject.GetComponent<Toggle>() != null)
|
||||
{
|
||||
var toggle = componentObject.GetComponent<Toggle>();
|
||||
var field = config.GetType().GetField(configPanelComponent.ConfigKeyName);
|
||||
toggle.isOn = (bool)field.GetValue(config);
|
||||
toggle.onValueChanged?.Invoke(toggle.isOn);
|
||||
}
|
||||
else if (componentObject.GetComponent<Slider>() != null)
|
||||
{
|
||||
var slider = componentObject.GetComponent<Slider>();
|
||||
var field = config.GetType().GetField(configPanelComponent.ConfigKeyName);
|
||||
slider.value = (float)field.GetValue(config);
|
||||
slider.onValueChanged?.Invoke(slider.value);
|
||||
}
|
||||
else if (componentObject.GetComponent<ValueManager>() != null)
|
||||
{
|
||||
var valueManager = componentObject.GetComponent<ValueManager>();
|
||||
var field = config.GetType().GetField(configPanelComponent.ConfigKeyName);
|
||||
valueManager.Value = (float)field.GetValue(config);
|
||||
valueManager.onValueChanged?.Invoke();
|
||||
valueManager.value = (float)field.GetValue(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PlayerSettingManager : MonoBehaviour
|
||||
RHandTransform.localPosition = new Vector3(RHandTransform.localPosition.x, RHandTransform.localPosition.y, value);
|
||||
});
|
||||
heightManager.onValueChanged.AddListener(delegate {
|
||||
height = heightManager.Value;
|
||||
height = heightManager.value;
|
||||
});
|
||||
sizeSlider.onValueChanged.Invoke(sizeSlider.value);
|
||||
xSlider.onValueChanged.Invoke(xSlider.value);
|
||||
|
||||
@@ -17,11 +17,13 @@ public class SpectatorManager : MonoBehaviour
|
||||
var modeWidget = ConfigManager.GetConfigPanelWidget("SpectatorMode");
|
||||
var fovWidget = ConfigManager.GetConfigPanelWidget("SpectatorFOV");
|
||||
var fpsWidget = ConfigManager.GetConfigPanelWidget("SpectatorFPS");
|
||||
var smoothWidget = ConfigManager.GetConfigPanelWidget("SpectatorSmooth");
|
||||
|
||||
|
||||
var modeDropdown = modeWidget.GetComponent<TMP_Dropdown>();
|
||||
var fovSlider = fovWidget.GetComponent<Slider>();
|
||||
var fpsDropdown = fpsWidget.GetComponent<TMP_Dropdown>();
|
||||
var smoothSlider = smoothWidget.GetComponent<Slider>();
|
||||
|
||||
modeDropdown.onValueChanged.AddListener((int value) => {
|
||||
if (SpectatorCam == null || cameraSmooth == null || SpectatorFPTarget == null || SpectatorTPTarget == null)
|
||||
@@ -60,9 +62,14 @@ public class SpectatorManager : MonoBehaviour
|
||||
Application.targetFrameRate = int.Parse(fpsString.Remove(0, 3));
|
||||
});
|
||||
|
||||
smoothSlider.onValueChanged.AddListener((float value) => {
|
||||
cameraSmooth.smoothSpeed = value;
|
||||
});
|
||||
|
||||
modeDropdown.onValueChanged?.Invoke(modeDropdown.value);
|
||||
fovSlider.onValueChanged?.Invoke(fovSlider.value);
|
||||
fpsDropdown.onValueChanged?.Invoke(fpsDropdown.value);
|
||||
smoothSlider.onValueChanged?.Invoke(smoothSlider.value);
|
||||
|
||||
ApplyTPCamTransform();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ using TMPro;
|
||||
public class ValueManager : MonoBehaviour
|
||||
{
|
||||
TMP_Text tmp;
|
||||
public float Value
|
||||
public float value
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -40,7 +40,7 @@ public class ValueManager : MonoBehaviour
|
||||
public void ChangeValueContinue(float __value)
|
||||
{
|
||||
tempValue = __value;
|
||||
Value += Time.deltaTime * __value;
|
||||
value += Time.deltaTime * __value;
|
||||
isPointerDown = true;
|
||||
}
|
||||
public void PointerState(bool state)
|
||||
@@ -49,7 +49,7 @@ public class ValueManager : MonoBehaviour
|
||||
}
|
||||
public void ResetValue()
|
||||
{
|
||||
Value = 0;
|
||||
value = 0;
|
||||
}
|
||||
public void UpdateText()
|
||||
{
|
||||
|
||||
@@ -12,11 +12,11 @@ public class DropdownPopulateList : MonoBehaviour
|
||||
[ExecuteAlways]
|
||||
void Awake()
|
||||
{
|
||||
Dropdown = GetComponent<TMP_Dropdown>();
|
||||
PopulateList();
|
||||
}
|
||||
void PopulateList()
|
||||
{
|
||||
Dropdown = GetComponent<TMP_Dropdown>();
|
||||
Dropdown.ClearOptions();
|
||||
List<string> keyNames = new List<string>();
|
||||
switch (ListType)
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class TabManager : MonoBehaviour
|
||||
{
|
||||
public GameObject Tab1Object;
|
||||
public GameObject Tab2Object;
|
||||
public Button DefautTabButton;
|
||||
public List<GameObject> Tabs = new List<GameObject>();
|
||||
|
||||
[ExecuteAlways]
|
||||
void Start()
|
||||
{
|
||||
OnFirstTabClick();
|
||||
DefautTabButton.onClick?.Invoke();
|
||||
}
|
||||
public void OnFirstTabClick()
|
||||
|
||||
public void OnTabClicked(GameObject tab)
|
||||
{
|
||||
Tab1Object.SetActive(true);
|
||||
Tab2Object.SetActive(false);
|
||||
}
|
||||
public void OnSecondTabClick()
|
||||
{
|
||||
Tab1Object.SetActive(false);
|
||||
Tab2Object.SetActive(true);
|
||||
foreach (GameObject t in Tabs)
|
||||
t.SetActive(false);
|
||||
tab.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ public class IPCManager : MonoBehaviour
|
||||
EnsureInitialization();
|
||||
byte[] bytes = new byte[1920];
|
||||
IPCManager.sharedBufferAccessor.ReadArray<byte>(244, bytes, 0, 1920);
|
||||
if (bytes[3] == 0)
|
||||
return null;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ public class LightManager : MonoBehaviour
|
||||
if (IPCManager.sharedBuffer != null)
|
||||
{
|
||||
GetTextureFromBytes(IPCManager.GetLightData());
|
||||
CheckIPCState();
|
||||
if (!isIPCIdle)
|
||||
UpdateLED();
|
||||
}
|
||||
@@ -55,13 +54,14 @@ public class LightManager : MonoBehaviour
|
||||
isIPCIdle = true;
|
||||
}
|
||||
}
|
||||
private void CheckIPCState()
|
||||
private void CheckIPCState(byte[] data)
|
||||
{
|
||||
if (RGBColor2D.GetPixel(0 , 0).a == 1)
|
||||
isIPCIdle = false;
|
||||
else
|
||||
if (data[3] == 0)
|
||||
isIPCIdle = true;
|
||||
else
|
||||
isIPCIdle = false;
|
||||
}
|
||||
|
||||
private void UpdateLED()
|
||||
{
|
||||
int index = 0;
|
||||
@@ -79,8 +79,12 @@ public class LightManager : MonoBehaviour
|
||||
}
|
||||
void GetTextureFromBytes(byte[] bytes)
|
||||
{
|
||||
RGBColor2D.LoadRawTextureData(bytes);
|
||||
RGBColor2D.Apply();
|
||||
if (bytes != null && bytes.Length == 1920)
|
||||
{
|
||||
CheckIPCState(bytes);
|
||||
RGBColor2D.LoadRawTextureData(bytes);
|
||||
RGBColor2D.Apply();
|
||||
}
|
||||
}
|
||||
public void UpdateFadeLight(int Area, bool State)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user