Фикс хоппера
This commit is contained in:
parent
8ac679cd64
commit
451f200a34
@ -11349,7 +11349,7 @@ Material:
|
||||
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
|
||||
- _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _GlowColor: {r: 0, g: 0.38125563, b: 1, a: 1}
|
||||
- _GlowColor: {r: 1, g: 0.4387267, b: 0, a: 1}
|
||||
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
|
||||
- _OutlineColor: {r: 0.554717, g: 0.554717, b: 0.554717, a: 1}
|
||||
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
|
||||
@ -60444,7 +60444,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &1929306719
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -62778,7 +62778,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2011670932
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -59,7 +59,7 @@ public class SettingsActions : MonoBehaviour
|
||||
{
|
||||
if(SettingsManager.GetBool("Prizing", false))
|
||||
{
|
||||
PrizeSystemManager.GivePrize(PrizeUtils.CreatePrize(CountablePrizeType.Hopper, 1));
|
||||
PrizeSystemManager.GivePrize(new CountablePrize(CountablePrizeType.Hopper, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -37,10 +37,7 @@ public class COMinput : InputSource
|
||||
|
||||
// Загружаем конфигурацию пинов
|
||||
LoadPinMappingConfiguration();
|
||||
|
||||
//ОБЯЗАТЕЛЬНЫЙ БЛОК
|
||||
ComWrapper.InputRecieved += UpdateInputState;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -302,9 +299,6 @@ public class COMinput : InputSource
|
||||
// Обновляет состояния инпута когда приходит новый ввод с платы. Дергается событием.
|
||||
private void UpdateInputState(string input)
|
||||
{
|
||||
//DebugWindow.Message($"В инпут пришло: {input}");
|
||||
// Будем принимать в нативном формате by Pasha. 0 - нажато 1 - не нажато (чтобы преобразовывать циклом)
|
||||
// В параметр приходит строка вида "1111011111011111"
|
||||
input = input.Substring(0, PIN_COUNT);
|
||||
for (int i = 0; i < input.Length; i++)
|
||||
{
|
||||
@ -336,7 +330,9 @@ public class COMinput : InputSource
|
||||
|
||||
if (prizeSensorPin < input.Length && input[prizeSensorPin] == sensorPositive)
|
||||
{
|
||||
Logger.Instance.Log($"Считано положительное значени датчика приза ({sensorPositive}). Устанавливаю значение 1 в буфер");
|
||||
PlayerPrefs.SetInt("PrizeGivenBuffer", 1);
|
||||
Logger.Instance.Log($"Установлено значение буфера {PlayerPrefs.GetInt("PrizeGivenBuffer")}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public static class ComWrapper
|
||||
if (h <= 0) return;
|
||||
try
|
||||
{
|
||||
int w = ComNativeWrapper.Serial_WriteStringUTF8(h, message, 1); //w-количество записаных символов в порт. можно обработать
|
||||
int w = ComNativeWrapper.Serial_WriteStringUTF8(h, message, 1);
|
||||
}
|
||||
catch { logger?.Log($"Ошибка отправки строкового сигнала. {message}"); }
|
||||
}
|
||||
|
||||
@ -122,8 +122,10 @@ namespace PrizeSystem
|
||||
|
||||
//=========================== privates ===========================//
|
||||
#region Приватные методы
|
||||
private string StartHopperCommand => ComWrapper.BoardVersion switch { 1 => "303", 2 => "301", _ => "303" };
|
||||
private string StopHopperCommand => ComWrapper.BoardVersion switch { 1 => "302", 2 => "300", _ => "302" };
|
||||
//private string StartHopperCommand => ComWrapper.BoardVersion switch { 1 => "303", 2 => "301", _ => "303" };
|
||||
//private string StopHopperCommand => ComWrapper.BoardVersion switch { 1 => "302", 2 => "300", _ => "302" };
|
||||
private string StartHopperCommand => "303";
|
||||
private string StopHopperCommand => "302";
|
||||
private IEnumerator PrizingProcess(int amount, CountablePrizeType Type)
|
||||
{
|
||||
if (prizing)
|
||||
@ -133,7 +135,7 @@ namespace PrizeSystem
|
||||
}
|
||||
prizing = true;
|
||||
|
||||
Debug.Log($"Выдача приза {Type}. Количество: {amount}");
|
||||
Logger.Instance.Log($"Выдача приза {Type}. Количество: {amount}");
|
||||
bool atLeastOnePrize = false;
|
||||
|
||||
for (int i = 0; i < amount; i++)
|
||||
@ -146,18 +148,19 @@ namespace PrizeSystem
|
||||
|
||||
|
||||
|
||||
Debug.Log($"Включаю мотор хоппера: {StartHopperCommand}");
|
||||
Logger.Instance.Log($"Включаю мотор хоппера: {StartHopperCommand}");
|
||||
ComWrapper.Send(StartHopperCommand);//включаем мотор
|
||||
float startTime = Time.time;
|
||||
bool success = false;
|
||||
|
||||
PlayerPrefs.SetInt("PrizeGivenBuffer", 0);//подготовка буфера
|
||||
Logger.Instance.Log($"Буфер подготовлен. Значение: {PlayerPrefs.GetInt("PrizeGivenBuffer")}");
|
||||
|
||||
while (Time.time - startTime < timeout)
|
||||
{
|
||||
if (PlayerPrefs.GetInt("PrizeGivenBuffer", 0) == 1)
|
||||
{
|
||||
Debug.Log("Считан приз");
|
||||
Logger.Instance.Log($"Считан приз. Значение буфера {PlayerPrefs.GetInt("PrizeGivenBuffer")}");
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user