make button config functionable; better button sound

This commit is contained in:
xpeng
2022-10-06 22:38:29 +02:00
parent c506e0572b
commit 5b1ef6cde6
16 changed files with 464 additions and 24 deletions
@@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ButtonSettingManager : MonoBehaviour
{
public ButtonType buttonType;
private PanelButton panelButton;
void Start()
{
panelButton = GetComponent<PanelButton>();
ConfigManager.onConfigChanged += ApplyConfig;
ConfigManager.EnsureInitialization();
ApplyConfig();
}
void ApplyConfig()
{
switch (buttonType)
{
case ButtonType.Test:
panelButton.key = ConfigManager.config.TestKey;
break;
case ButtonType.Service:
panelButton.key = ConfigManager.config.ServiceKey;
break;
case ButtonType.Coin:
panelButton.key = ConfigManager.config.CoinKey;
break;
case ButtonType.Custom:
panelButton.key = ConfigManager.config.CustomKey;
break;
}
}
public enum ButtonType
{
Test = 0,
Service = 1,
Coin = 2,
Custom = 3,
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 03d77b3507ce3cb48bc8b62891a50d96
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -6,7 +6,8 @@
"GUID:6055be8ebefd69e48b49212b09b47b2f",
"GUID:2dcfcfc00d4ac7749bb60698b85f1dc2",
"GUID:fe685ec1767f73d42b749ea8045bfe43",
"GUID:75469ad4d38634e559750d17036d5f7c"
"GUID:75469ad4d38634e559750d17036d5f7c",
"GUID:e9ef0e10f8c2b264e9705f57f028b9e8"
],
"includePlatforms": [],
"excludePlatforms": [],
+16
View File
@@ -0,0 +1,16 @@
{
"name": "Essential",
"rootNamespace": "",
"references": [
"GUID:6055be8ebefd69e48b49212b09b47b2f"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e9ef0e10f8c2b264e9705f57f028b9e8
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+4 -3
View File
@@ -85,10 +85,11 @@ public class TouchManager : MonoBehaviour
ReadHead(ComL, 0);
if (ComR.IsOpen)
ReadHead(ComR, 1);
//if (Input.GetKeyDown(KeyCode.M)) //this is a touch test code
//following are touch test code
//if (Input.GetKeyDown(KeyCode.M))
//StartCoroutine(TouchTest(true));
if (Input.GetKeyDown(KeyCode.M) && StartUp)
SendTouchState();
//if (Input.GetKeyDown(KeyCode.M) && StartUp)
//SendTouchState();
}
private void SendTouchState()