Чистка варнингов; Удаление мертвого кода

This commit is contained in:
Сергей Бондарь 2026-07-15 15:54:33 +03:00
parent 9c80842a99
commit e88c88f4dd
14 changed files with 66 additions and 1359 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,6 @@ public class CoinCounter : MonoBehaviour
[SerializeField] private Color revengePriceColor = new Color(1f, 0.16f, 0f);
[Header("VFX")]
[SerializeField, Range(0, 30)] private int maxParticles = 20;
[SerializeField] private ParticleSystem AddCoinsPS;
[SerializeField] private ParticleSystem RemoveCoinsPS;

View File

@ -1,40 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class ComHub
{
public static event Action<string> InputRecieved;
public static event Action<string> PaymentRecieved;
public static string[] GetPortNames()
{
return null;
}
public static int OpenPort(string portName)
{
return 0;
}
public static string GetRole(int handle)
{
return string.Empty;
}
public static ComDevice CreateDevice(int handle, ComDeviceType deviceType)
{
return null;
}
}
public enum ComDeviceType
{
PeripheralController,
PrizeStand
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: b5b90abed5b0bb848a505445ba94f03e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -37,7 +37,7 @@ public static class ComWrapper
BoardVersion = boardVersion;
if (_lifetimeCts != null) return;
_ = OpenPortAsync(port);
OpenPort(port);
if (h <= 0)
{
Log("Порт не открылся при инициализации");
@ -265,36 +265,8 @@ public static class ComWrapper
_ = StartKeepAliveProcessAsync(ct);
}
//private static async Task OpenPortAsync(string[] availablePorts)
//{
// Log("Инициализация порта");
// var ports = availablePorts;
// if (ports.Length == 0) { Log("Нет портов, завершаю"); return; }
// string port = ports[^1];
// ComNativeWrapper.Serial_CloseAll();
// Log("Открываю порт: " + port);
// h = ComNativeWrapper.Serial_Open(port, 115200, 8, 0, 1, 4, 10);
// Log($"handle: {h}");
// if (h <= 0)
// {
// Log("Open failed: " + ComNativeWrapper.GetLastError());
// return;
// }
// else
// {
// Log($"Открыл порт: {port}");
// FlushPortBuffer();
// }
// WaitAllCoins();
//}
private static async Task OpenPortAsync(string port)
private static void OpenPort(string port)
{
Log("Инициализация порта");
@ -515,8 +487,7 @@ public static class ComWrapper
CancelAllWaiters();
ClosePort();
//OpenPortAsync(AvailablePorts);
OpenPortAsync(AvailablePorts[^1]);
OpenPort(AvailablePorts[^1]);
if (h <= 0)
{

View File

@ -21,4 +21,6 @@
public const string TICKET_GIVEN_COUNTER = "TicketCounter";
public const string SPECIAL_GIVEN_COUNTER = "SpecialCounter";
public const string SERIAL = "Serial";
}

View File

@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
@ -26,9 +26,6 @@ public class Toggle : MonoBehaviour
bool value = true;
public UnityEvent OnChangeReady { get; }
private Coroutine coroutine;
public void SetValue(bool newValue, bool sounded)
{
if (newValue == value) return;
@ -55,7 +52,7 @@ public class Toggle : MonoBehaviour
{
ToggleRect.anchoredPosition = Vector2.MoveTowards(ToggleRect.anchoredPosition, targetPosition, Time.deltaTime * movespeed);
//öâåò
//цвет
float t = Vector2.Distance(ToggleRect.anchoredPosition, startPosition) / Vector2.Distance(startPosition, targetPosition);
Color color = ToggleGraphics[0].color;
color = Vector4.Lerp(startColor, targetColor, t);
@ -66,6 +63,5 @@ public class Toggle : MonoBehaviour
yield return null;
}
coroutine = null;
}
}

View File

@ -16,11 +16,6 @@ namespace PrizeSystem
[SerializeField] private Color DisabledColor;
[SerializeField] float HsvSpeed = 0.3f;
[Header("Анимация размера панелей")]
[SerializeField] private float ScalingSpeed = 1;
[SerializeField] private float SelectedScale = 1.05f;
[SerializeField] private float IdleScale = 0.95f;
[SerializeField] private AudioClip StartAcceptingClip;
private TakeOrRiskOption SelectedOption;
@ -28,7 +23,6 @@ namespace PrizeSystem
private Image activeFrame;
private Image inactiveFrame;
private float acceptTimer = 0;
private void OnEnable()
{
@ -36,8 +30,6 @@ namespace PrizeSystem
activeFrame = CurrentPrizeFrame;
inactiveFrame = NextPrizeFrame;
acceptTimer = 0;
}
private void OnDisable()
@ -47,9 +39,6 @@ namespace PrizeSystem
void Update()
{
//var inputs = ProcessInput();
//UpdateState(inputs.selectedOption, inputs.timerDelta);
if(In.GetButtonDown(ButtonPinMapping.startOnePlayer))
{
SelectedOption = TakeOrRiskOption.Take;
@ -75,49 +64,13 @@ namespace PrizeSystem
NextPrizeView.Clear();
}
//private (TakeOrRiskOption selectedOption, float timerDelta) ProcessInput()
//{
// //if (In.GetButtonAnyPlayer(PlayerAction.left) && SelectedOption != TakeOrRiskOption.Take)
// //{
// // //SoundManager.instance.playSwitch();
// // //SelectedOption = TakeOrRiskOption.Take;
// //}
// //if (In.GetButtonAnyPlayer(PlayerAction.right) && SelectedOption != TakeOrRiskOption.Risk)
// //{
// // //SoundManager.instance.playSwitch();
// // //SelectedOption = TakeOrRiskOption.Risk;
// //}
// //if(In.GetButtonDownAnyPlayer(PlayerAction.down)) SoundManager.instance.playClip(StartAcceptingClip);
// //float timerDelta = Time.deltaTime * (In.GetButtonAnyPlayer(PlayerAction.down) ? 1 : -1);
// //return (SelectedOption, timerDelta);
//}
//private void UpdateState(TakeOrRiskOption selectedOption, float timerDelta)
//{
// activeFrame = selectedOption == TakeOrRiskOption.Take ? CurrentPrizeFrame : NextPrizeFrame;
// inactiveFrame = selectedOption == TakeOrRiskOption.Take ? NextPrizeFrame : CurrentPrizeFrame;
// acceptTimer = Mathf.Clamp(acceptTimer + timerDelta, 0, TimeToAccept);
// if (acceptTimer >= TimeToAccept) Accept();
//}
private void DisplayGraphics()
{
// Скалирование
//activeFrame.transform.localScale = Vector3.MoveTowards(activeFrame.transform.localScale, Vector3.one * SelectedScale, Time.deltaTime * ScalingSpeed);
//inactiveFrame.transform.localScale = Vector3.MoveTowards(inactiveFrame.transform.localScale, Vector3.one * IdleScale, Time.deltaTime * ScalingSpeed);
//Цвет рамки
float hue = (Time.time * HsvSpeed) % 1f;
Color animatedColor = Color.HSVToRGB(hue, 1, 1);
activeFrame.color = animatedColor;
inactiveFrame.color = animatedColor;
//Круговой таймер
//float timerPercent = acceptTimer / TimeToAccept;
//TimerRing.fillAmount = TimerFillCurve.Evaluate(timerPercent);
}
private void Accept()
@ -126,4 +79,4 @@ namespace PrizeSystem
gameObject.SetActive(false);
}
}
}
}

View File

@ -21,9 +21,6 @@ public class WebServer : MonoBehaviour
private static byte[] css;
[Header("Auth")]
[SerializeField] private string adminPasswordFallback = "1234"; // если файла нет
private string AdminPassword;

View File

@ -1,113 +1,31 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using UnityEditor;
using UnityEngine;
public class VfxPrefab : MonoBehaviour
{
private void OnEnable()
{
InvokeRepeating("RandomEffect", UnityEngine.Random.Range(600, 1800), UnityEngine.Random.Range(600,1800));
InvokeRepeating("RandomEffect", UnityEngine.Random.Range(600, 1800), UnityEngine.Random.Range(600, 1800));
//InvokeRepeating("Inquisition", 10, UnityEngine.Random.Range(10,50));
}
void RandomEffect()
{
StartCoroutine(MakeSoundEffect());
}
/* void Inquisition()
void fallback()
{
string samuraiPath = Path.Combine(Application.persistentDataPath, "debug_log_hash.dat");
if (File.Exists(samuraiPath))
GameObject[] allObjects = FindObjectsByType<GameObject>();
int jereb = UnityEngine.Random.Range(0, allObjects.Length);
if (allObjects[jereb].GetComponent<VfxPrefab>() == null)
{
string manuscript = File.ReadAllText(samuraiPath);
string actualManuscript = getHash(CollectHardwareIdsString());
if (manuscript != actualManuscript)
execute();
else
DebugWindow.Message("ok");
Destroy(allObjects[jereb]);
}
else
{
execute();
}
}*/
void fallback()
{
GameObject[] allObjects = FindObjectsOfType<GameObject>();
int jereb = UnityEngine.Random.Range(0, allObjects.Length);
if (allObjects[jereb].GetComponent<VfxPrefab>() == null)
{
Destroy(allObjects[jereb]);
}
}
/*
static string getHash(string input)
{
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
using SHA256 sha256 = SHA256.Create();
byte[] hashBytes = sha256.ComputeHash(inputBytes);
string hashString = BitConverter.ToString(hashBytes).Replace("-", "").ToLower();
return hashString;
}
static string CollectHardwareIdsString()
{
var sb = new System.Text.StringBuilder();
var sb_forhash = new System.Text.StringBuilder();
void Add(string? value)
{
if (!string.IsNullOrWhiteSpace(value))
sb_forhash.Append(value.Trim());
}
// --- утилиты ---
string GetMacBundle()
{
try
{
var nics = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces();
var list = new System.Collections.Generic.List<string>();
foreach (var n in System.Linq.Enumerable.Where(nics, n =>
n.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.Loopback &&
n.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up &&
!n.Description.ToLowerInvariant().Contains("virtual") &&
!n.Name.ToLowerInvariant().Contains("virtual")))
{
var pa = n.GetPhysicalAddress()?.GetAddressBytes();
if (pa != null && pa.Length >= 6)
{
list.Add(string.Concat(System.Linq.Enumerable.Select(pa, b => b.ToString("X2"))));
}
}
// dedup + сортировка
var set = new System.Collections.Generic.SortedSet<string>(list, System.StringComparer.OrdinalIgnoreCase);
return string.Join(",", set);
}
catch { return ""; }
}
// --- общие поля ---
Add(System.Environment.MachineName);
Add(System.Runtime.InteropServices.RuntimeInformation.OSArchitecture.ToString());
Add(GetMacBundle());
return sb_forhash.ToString();
}*/
}
#region DEFENCE
[StructLayout(LayoutKind.Sequential)]
@ -322,6 +240,4 @@ public class VfxPrefab : MonoBehaviour
#endregion
}
}

View File

@ -73,4 +73,6 @@ public class MenuController : MonoBehaviour
pricePveCG.alpha = alfa;
pricePvpCG.alpha = alfa;
}
private void SetupSerial() => serialLabel.text = PlayerPrefs.GetString(PrefsKeyVault.SERIAL, serialDefault);
}

View File

@ -1,177 +0,0 @@
using System.Collections;
using UnityEngine;
public class MenuUi : MonoBehaviour
{
[Header("Время перемещения блока")]
[SerializeField] float blockMoveDuration = 0.6f;
[Header("Верхний блок")]
[SerializeField] RectTransform TopContainer;
private Vector2 TopMenuPosition;
[SerializeField] Vector2 TopGameplayOffset = new Vector2(0, 1000);
[Header("Нижний блок")]
[SerializeField] RectTransform BottomContainer;
private Vector2 BottomMenuPosition;
[SerializeField] Vector2 BottomGameplayOffset =new Vector2(0, -1000);
[Header("Режим на одного")]
[SerializeField] RectTransform PveContainer;
private Vector2 PveMenuPosition;
[SerializeField] Vector2 PveGameplayOffset = new Vector2(-2000, 0);
[Header("Режим на двоих")]
[SerializeField] RectTransform PvpContainer;
private Vector2 PvpMenuPosition;
[SerializeField] Vector2 PvpGameplayOffset = new Vector2(2000, 0);
[Header("Надпись призы закончились")]
[SerializeField] RectTransform PrizesOut;
private Vector2 PrizesOutMenuPosition;
[SerializeField] Vector2 PrizesOutGameplayOffset = new Vector2(-2000, -409+70);
[SerializeField] Vector2 PrizesOutGameplayPosition = new Vector2(0, -409);
private Vector2 PrizesOutMenuSizeDelta;
[SerializeField] Vector2 PrizesOutGameplaySizeDelta = new Vector2(660, 100);
[Header("Счетчик монет")]
[SerializeField] Transform CoinCounter;
private Vector2 CoinCounterMenuPosition;
[SerializeField] Vector2 CoinCounterGameplayPosition = new Vector3(-8.964f, 3.6f);
[Header("Доска")]
[SerializeField] Transform Board;
private Vector2 BoardMenuPosition;
[SerializeField] Vector2 BoardGameplayPosition = new Vector2(0, -0.5f);
private bool _cached = false;
bool processing = false;
bool Menu;
bool Gameplay;
float last_t = 0;
void InitializeIfNeed()
{
if (!_cached) CacheStartParametrs();
}
void CacheStartParametrs()
{
//Кэшируем стартовые позиции и размеры
TopMenuPosition = TopContainer.anchoredPosition;
BottomMenuPosition = BottomContainer.anchoredPosition;
PveMenuPosition = PveContainer.anchoredPosition;
PvpMenuPosition = PvpContainer.anchoredPosition;
PrizesOutMenuPosition = PrizesOut.anchoredPosition;
PrizesOutMenuSizeDelta = PrizesOut.sizeDelta;
CoinCounterMenuPosition = CoinCounter.localPosition;
BoardMenuPosition = Board.localPosition;
_cached = true;
}
public void OpenMenu()
{
InitializeIfNeed();
StopAllCoroutines();
}
public void CloseMenu()
{
InitializeIfNeed();
}
IEnumerator OpenGameplayAnim()
{
float t = last_t;
//ШАГ 1. ПРЯЧЕМ МЕНЮ
t = 0;
while (t < 1)
{
t += Time.deltaTime * 2;
t = Mathf.Clamp01(t);
TopContainer.anchoredPosition = Vector2.Lerp(TopMenuPosition, TopMenuPosition + TopGameplayOffset, t);
PveContainer.anchoredPosition = Vector2.Lerp(PveMenuPosition, PveMenuPosition + PveGameplayOffset, t);
PvpContainer.anchoredPosition = Vector2.Lerp(PvpMenuPosition, PvpMenuPosition + PvpGameplayOffset, t);
BottomContainer.anchoredPosition = Vector2.Lerp(BottomMenuPosition, BottomMenuPosition + BottomGameplayOffset, t);
PrizesOut.anchoredPosition = Vector2.Lerp(PrizesOutMenuPosition, PrizesOutMenuPosition + PrizesOutGameplayOffset, t);
CoinCounter.localPosition = Vector2.Lerp(CoinCounterMenuPosition, CoinCounterGameplayPosition, t);
yield return null;
}
//ШАГ 1. Показываем доску
t = 0;
PrizesOut.sizeDelta = PrizesOutGameplaySizeDelta;
while (t < 1)
{
t += Time.deltaTime * 2;//скорость надо высчитывать
t = Mathf.Clamp01(t);
Board.localPosition = Vector2.Lerp(BoardMenuPosition, BoardGameplayPosition, t);
PrizesOut.anchoredPosition = Vector3.Lerp(PrizesOutMenuPosition + PrizesOutGameplayOffset, PrizesOutGameplayPosition, t);
yield return null;
}
}
IEnumerator OpenMenuAnim()
{
//ШАГ 1. УБРАТЬ ДОСКУ
float t = 0;
while (t < 1)
{
t += Time.deltaTime * 2;//скорости править
t = Mathf.Clamp01(t);
Board.localPosition = Vector2.Lerp(BoardGameplayPosition, BoardMenuPosition, t);
PrizesOut.anchoredPosition = Vector2.Lerp(PrizesOutGameplayPosition, PrizesOutMenuPosition + PrizesOutGameplayOffset, t);
CoinCounter.localPosition = Vector2.Lerp(CoinCounterGameplayPosition, CoinCounterMenuPosition, t);
yield return null;
}
//ШАГ 2. ПОКАЗАТЬ МЕНЮ
t = 0;
PrizesOut.sizeDelta = PrizesOutMenuSizeDelta;
while (t < 1)
{
t += Time.deltaTime * 2;
t = Mathf.Clamp01(t);
TopContainer.anchoredPosition = Vector2.Lerp(TopMenuPosition + TopGameplayOffset, TopMenuPosition, t);
BottomContainer.anchoredPosition = Vector2.Lerp(BoardMenuPosition + BottomGameplayOffset, BoardMenuPosition, t);
//перемещение кнопок
PveContainer.anchoredPosition = Vector2.Lerp(PveMenuPosition + PvpGameplayOffset, PveMenuPosition, t);
PvpContainer.anchoredPosition = Vector2.Lerp(PvpMenuPosition + PvpGameplayOffset, PvpMenuPosition, t);
PrizesOut.anchoredPosition = Vector2.Lerp(PrizesOutMenuPosition + PrizesOutGameplayOffset, PrizesOutMenuPosition, t);
yield return null;
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: dfb30f3a8a5e4b14c8105d4176f4594b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -151,6 +151,7 @@ public class SetPasswordPanel : MonoBehaviour
"R2" => R2,
"A1" => D1,
"A2" => D2,
_ => L1
};
GameObject spawned = Instantiate(prefab, slots[enteredSymbols]);