Danro/Assets/Scripts/Settings/_sega/SettingsCombination.cs
Danil Iarosh 98d5285b46 feat(logging): add advanced logging example with file output
- Created AdvancedLoggingExample class demonstrating composite and file loggers
- Implemented multi-file logging setup with separate error and full logs
- Added game event and performance logging methods
- Included key input handling for log operations (flush, clear)
- Setup proper resource disposal on application quit
2025-11-07 14:12:50 +03:00

159 lines
4.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using RR.Game2D.Core.Managers;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class SettingsCombination : MonoBehaviour
{
GameManager gm;
float resetStartsTimer = 0;
float resetGivenPrizesTimer = 0;
float setNumber = 0;
float telegram = 0;
float timeToReset = 5;
string PRIZE_BASE = "Счетчик призов ";
string STARTS_BASE = "Внесено монет ";
string NULLABLE = "(обнуляемый)";
string UNNULLABLE = "(глобальный)";
public TextMeshProUGUI starts, startsNul, prize, prizeNul;
public Image startsTimerImage, prizeTimerImage, numberImage, telegramImage;
void OnEnable()
{
gm = GameManager.Instance;
RefreshUI();
}
void Update()
{
//сброс монет
bool condition = In.GetButton(ButtonPinMapping.left1) &&
In.GetButton(ButtonPinMapping.right1) &&
In.GetButton(ButtonPinMapping.left2) &&
In.GetButton(ButtonPinMapping.right2);
if (condition)
{
resetStartsTimer += Time.deltaTime;
startsTimerImage.fillAmount = resetStartsTimer / timeToReset;
if (resetStartsTimer >= timeToReset)
{
ResetStarts();
resetStartsTimer = 0;
}
return;
}
else
{
resetStartsTimer -= Time.deltaTime;
resetStartsTimer = Mathf.Clamp(resetStartsTimer, 0, 5);
startsTimerImage.fillAmount = 0;
}
//телега
condition = In.GetButton(ButtonPinMapping.left1) &&
In.GetButton(ButtonPinMapping.right1) &&
/*In.GetButton(ButtonPinMapping.left2) &&*/
In.GetButton(ButtonPinMapping.right2);
if (condition)
{
telegram += Time.deltaTime;
telegramImage.fillAmount = telegram / timeToReset;
if (telegram >= timeToReset)
{
//Тут надо зайти в ввод номера
telegram = 0;
// gm.stateMachine.ChangeState(new EnterTelegramState());
//GetNumber();
}
return;
}
else
{
telegram -= Time.deltaTime;
telegram = Mathf.Clamp(setNumber, 0, 5);
telegramImage.fillAmount = 0;
}
//выданные призы
condition = In.GetButton(ButtonPinMapping.left1) &&
In.GetButton(ButtonPinMapping.left2);
if (condition)
{
resetGivenPrizesTimer += Time.deltaTime;
prizeTimerImage.fillAmount = resetGivenPrizesTimer / timeToReset;
if (resetGivenPrizesTimer >= timeToReset)
{
ResetPrizes();
resetGivenPrizesTimer = 0;
}
return;
}
else
{
resetGivenPrizesTimer -= Time.deltaTime;
resetGivenPrizesTimer = Mathf.Clamp(resetGivenPrizesTimer, 0, 5);
prizeTimerImage.fillAmount = 0;
}
//условие захода в ввод номера
condition = In.GetButton(ButtonPinMapping.right1) &&
In.GetButton(ButtonPinMapping.right2);
if (condition)
{
setNumber += Time.deltaTime;
numberImage.fillAmount = setNumber / timeToReset;
if (setNumber >= timeToReset)
{
//Тут надо зайти в ввод номера
setNumber = 0;
GetNumber();
}
return;
}
else
{
setNumber -= Time.deltaTime;
setNumber = Mathf.Clamp(setNumber, 0, 5);
numberImage.fillAmount = 0;
}
}
void ResetStarts()
{
PlayerPrefs.SetInt(PrizeSystem.key_startsNul, 0);
RefreshUI();
}
void ResetPrizes()
{
PlayerPrefs.SetInt(PrizeSystem.key_prizesgivenNul, 0);
RefreshUI();
}
void GetNumber()
{
// GameManager.instance.stateMachine.ChangeState(new GetNumberState());
}
void RefreshUI()
{
starts.text = STARTS_BASE + UNNULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_starts);
startsNul.text = STARTS_BASE + NULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_startsNul);
prize.text = PRIZE_BASE + UNNULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_prizesgiven);
prizeNul.text = PRIZE_BASE + NULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_prizesgivenNul);
}
}