FEAT: Просмотр счетчиков через сайт-панель

This commit is contained in:
_sega 2026-02-03 12:51:53 +03:00
parent 28c063505f
commit ba782a9a9d
9 changed files with 226 additions and 14 deletions

View File

@ -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: 1, b: 0.39179158, a: 1}
- _GlowColor: {r: 0, g: 1, b: 0.017659903, 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}

View File

@ -14008,6 +14008,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 27edee241c0fb934ebe299af31cf6c77, type: 3}
m_Name:
m_EditorClassIdentifier:
adminPasswordFallback: 1234
passwordFileName: admin_password.txt
settingActions: []
--- !u!4 &592995719
Transform:
m_ObjectHideFlags: 0
@ -14020,7 +14023,8 @@ Transform:
m_LocalPosition: {x: 4.206707, y: 5.733204, z: 5.57958}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 918736948}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &599592677
@ -25698,6 +25702,50 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 918319251}
m_CullTransparentMesh: 1
--- !u!1 &918736947
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 918736948}
- component: {fileID: 918736949}
m_Layer: 0
m_Name: CountersCollector
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &918736948
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 918736947}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 592995719}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &918736949
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 918736947}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c8335100aebab3444a89736e47c763b4, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &932301124
GameObject:
m_ObjectHideFlags: 0

View File

@ -29,7 +29,7 @@ public class SettingsActions : MonoBehaviour
public void ResetCoinsCounter()
{
PlayerPrefs.SetInt(PrizeSystem.key_startsNul, 0);
PlayerPrefs.SetInt(PrizeSystem.key_cashNul, 0);
RefreshUI();
}
public void ResetPrizes()
@ -89,8 +89,8 @@ public class SettingsActions : MonoBehaviour
{
string valutaName = PlayerPrefs.GetString("ValutaName", "руб.");
starts.text = STARTS_BASE + UNNULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_starts) + " " + valutaName;
startsNul.text = STARTS_BASE + NULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_startsNul) + " " + valutaName;
starts.text = STARTS_BASE + UNNULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_cash) + " " + valutaName;
startsNul.text = STARTS_BASE + NULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_cashNul) + " " + valutaName;
//prize.text = PRIZE_BASE + UNNULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_prizesgiven);
//prizeNul.text = PRIZE_BASE + NULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_prizesgivenNul);

View File

@ -41,8 +41,8 @@ public class FastCheckCounters : MonoBehaviour
}
void RefreshUI()
{
starts.text = STARTS_BASE + UNNULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_starts);
startsNul.text = STARTS_BASE + NULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_startsNul);
starts.text = STARTS_BASE + UNNULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_cash);
startsNul.text = STARTS_BASE + NULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_cashNul);
prize.text = PRIZE_BASE + UNNULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_prizesgiven);
prizeNul.text = PRIZE_BASE + NULLABLE + ": " + PlayerPrefs.GetInt(PrizeSystem.key_prizesgivenNul);

View File

@ -69,8 +69,8 @@ public class ComWrapper : MonoBehaviour
PlayerPrefs.SetInt("CoinsCount", Balance);
//Счетчики выручки
PlayerPrefs.SetInt(PrizeSystem.key_starts, PlayerPrefs.GetInt(PrizeSystem.key_starts) + recieved);
PlayerPrefs.SetInt(PrizeSystem.key_startsNul, PlayerPrefs.GetInt(PrizeSystem.key_startsNul) + recieved);
PlayerPrefs.SetInt(PrizeSystem.key_cash, PlayerPrefs.GetInt(PrizeSystem.key_cash) + recieved);
PlayerPrefs.SetInt(PrizeSystem.key_cashNul, PlayerPrefs.GetInt(PrizeSystem.key_cashNul) + recieved);
if (SettingsManager.GetString("BaseBotDifficulty", "Фиксированная") == "Повышенная")
{

View File

@ -17,8 +17,8 @@ public class PrizeSystem : MonoBehaviour
[SerializeField] Notification prizeNotification;
public static string key_starts = "STARTS";
public static string key_startsNul = "STARTSNUL";
public static string key_cash = "STARTS";
public static string key_cashNul = "STARTSNUL";
public static string key_prizesgiven = "PRIZESGIVEN";
public static string key_prizesgivenNul = "PRIZESGIVENNUL";
@ -190,8 +190,8 @@ public class PrizeSystem : MonoBehaviour
void InitCounters()
{
if (!PlayerPrefs.HasKey(key_starts)) PlayerPrefs.SetInt(key_starts, 0);
if (!PlayerPrefs.HasKey(key_startsNul)) PlayerPrefs.SetInt(key_startsNul, 0);
if (!PlayerPrefs.HasKey(key_cash)) PlayerPrefs.SetInt(key_cash, 0);
if (!PlayerPrefs.HasKey(key_cashNul)) PlayerPrefs.SetInt(key_cashNul, 0);
}
private void SoundNotificationIfNeeds()

View File

@ -0,0 +1,99 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using UnityEngine;
public class CountersCollector : MonoBehaviour
{
public static ConcurrentDictionary<string, string> Counters = new();
void Awake()
{
InvokeRepeating("Refresh", 0, 5);
}
private static readonly CounterData[] _counterConfigs =
{
// Призовые счетчики глобальные
new CounterData(PrizeSystem.HopperPrizeCounter, "Хоппер", 0),
new CounterData(PrizeSystem.TicketPrizeCounter, "Тикетник", 0),
new CounterData(PrizeSystem.MarblesPrizeCounter, "Марблс", 0),
new CounterData(PrizeSystem.SpecialPrizeCounter, "Суперприз", 0),
// Призовые счетчики обнуляемые
new CounterData($"{PrizeSystem.HopperPrizeCounter}Nullable", "Хоппер (обнуляемый)", 0),
new CounterData($"{PrizeSystem.TicketPrizeCounter}Nullable", "Тикетник (обнуляемый)", 0),
new CounterData($"{PrizeSystem.MarblesPrizeCounter}Nullable", "Марблс (обнуляемый)", 0),
new CounterData($"{PrizeSystem.SpecialPrizeCounter}Nullable", "Суперприз (обнуляемый)", 0),
// Выручка
new CounterData(PrizeSystem.key_cash, "Выручка", 0),
new CounterData(PrizeSystem.key_cashNul, "Выручка (обнуляемый)", 0),
// Остаток призов
new CounterData(KeyVault.PRIZES_AVAILABLE, "Остаток призов", 0),
// Цены
new CounterData("PricePVP", "Цена на двоих", 10),
new CounterData("PricePVE", "Цена против бота", 10),
new CounterData("PriceRevenge", "Цена реванша", 10),
// Расчеты
new CounterData("ValutaName", "Название валюты", "руб."),
new CounterData("ValutaPerImpulse", "Валюта за импульс", 10),
// Другое
new CounterData("Number", "Номер телефона", "<не указан>"),
new CounterData("SpecialPrize", "Суперприз", "<не указан>")
};
void Refresh()
{
Counters.Clear();
foreach (var config in _counterConfigs)
{
AddCounter(config);
}
}
void AddCounter(CounterData counterData)
{
string value = counterData.Type == SettingType.Int
? PlayerPrefs.GetInt(counterData.PrefsKey, counterData.DefaultIntValue).ToString()
: PlayerPrefs.GetString(counterData.PrefsKey, counterData.DefaultStringValue);
Counters[counterData.Alias] = value;
}
struct CounterData
{
public string PrefsKey;
public string Alias;
public SettingType Type;
public string DefaultStringValue;
public int DefaultIntValue;
/// <summary> Конструктор для строковых счетчиков </summary>
public CounterData(string prefsKey, string alias, string defaultValue)
{
PrefsKey = prefsKey;
Alias = alias;
Type = SettingType.String;
DefaultStringValue = defaultValue;
DefaultIntValue = 0;
}
/// <summary> Конструктор для целочисленных счетчиков </summary>
public CounterData(string prefsKey, string alias, int defaultValue)
{
PrefsKey = prefsKey;
Alias = alias;
Type = SettingType.Int;
DefaultStringValue = string.Empty;
DefaultIntValue = defaultValue;
}
}
}

View File

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

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
@ -76,6 +77,10 @@ public class HtmlBuilder
sb.AppendLine("<h1>Настройки фишки</h1>");
// === БЛОК: АКТИВНЫЕ ПАРАМЕТРЫ (CountersCollector.Counters) ===
sb.AppendLine(GetActiveCountersBlock());
// === БЛОК: НАСТРОЙКИ ===
sb.AppendLine(@"
<details class='block' open>
@ -398,6 +403,55 @@ public class HtmlBuilder
return res;
}
private static string GetActiveCountersBlock()
{
var sb = new StringBuilder();
sb.AppendLine(@"
<details class='block'>
<summary class='block-title'>Активные параметры</summary>
<div class='block-body'>
<div class='panel'>
<h2>Активные параметры</h2>
");
// CountersCollector.Counters : ConcurrentDictionary<string,string>
var dict = CountersCollector.Counters;
if (dict == null || dict.IsEmpty)
{
sb.AppendLine("<div class='status'>Нет данных</div>");
}
else
{
// Стабильный вывод: снимок + сортировка по ключу
var items = dict.ToArray()
.OrderBy(kv => kv.Key ?? "", StringComparer.Ordinal);
foreach (var kv in items)
{
string key = kv.Key ?? "";
string val = kv.Value ?? "";
sb.AppendLine(@"
<div class='form-group'>");
sb.AppendLine($" <label>{Escape(key)}</label>");
sb.AppendLine($" <div class='status'>{Escape(val)}</div>");
sb.AppendLine("</div>");
}
}
sb.AppendLine(@"
</div>
</div>
</details>
");
return sb.ToString();
}
private static string Escape(string s)
{
if (string.IsNullOrEmpty(s)) return "";