Избавление от легаси, Фикс лидерборда
This commit is contained in:
parent
40e46b0317
commit
5dd372a0ad
@ -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.14974451, a: 1}
|
||||
- _GlowColor: {r: 0.46582127, g: 0, b: 1, 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}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -40,7 +40,6 @@ public class SettingsActions : MonoBehaviour
|
||||
}
|
||||
|
||||
//Смены состояний
|
||||
public void EnterSpecialPrize() => gm.stateMachine.ChangeState(new EnterSpecialPrizeState(CurrentState));
|
||||
public void EnterPvePrice() => gm.stateMachine.ChangeState(new EnterPricePVEState(CurrentState));
|
||||
public void EnterPveRevengePrice() => gm.stateMachine.ChangeState(new EnterPricePVERevengeState(CurrentState));
|
||||
public void EnterPvpPrice() => gm.stateMachine.ChangeState(new EnterPricePVPState(CurrentState));
|
||||
@ -52,7 +51,6 @@ public class SettingsActions : MonoBehaviour
|
||||
public void ConfigurePulsesToResetDifficulty() => gm.stateMachine.ChangeState(new EnterPulsesToResetDifficulty(CurrentState));
|
||||
public void ConfigureValutaPerPulse() => gm.stateMachine.ChangeState(new EnterValutaPerImpulse(CurrentState));
|
||||
public void EnterValutaName() => gm.stateMachine.ChangeState(new EnterValutaNameState(CurrentState));
|
||||
public void QrTest() => gm.stateMachine.ChangeState(new CheckQrState(CurrentState));
|
||||
public void EnterIO_test() => gm.stateMachine.ChangeState(new IoTestState(IO_test, CurrentState));
|
||||
|
||||
//Панель2
|
||||
|
||||
@ -35,35 +35,4 @@ public class ContactsLabel : MonoBehaviour
|
||||
else
|
||||
label.text = "";
|
||||
}
|
||||
|
||||
/* static string ReadContactOrDefault()
|
||||
{
|
||||
string filePath = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
|
||||
"gameData",
|
||||
"contacts.txt");
|
||||
|
||||
try
|
||||
{
|
||||
if (!File.Exists(filePath))
|
||||
return "<не указано>";
|
||||
|
||||
// читаем весь текст как UTF-8
|
||||
string text = File.ReadAllText(filePath, Encoding.UTF8);
|
||||
|
||||
// если пусто или только пробелы/переводы строк — считаем пустым
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
return "<не указано>";
|
||||
|
||||
return text.Trim(); // уберём крайние переводы строк/пробелы
|
||||
}
|
||||
catch
|
||||
{
|
||||
// на любой ошибке ввода-вывода — безопасное значение
|
||||
return "<не указано>";
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ public class CheckLeadersFromMenuState : IState
|
||||
|
||||
//вкл
|
||||
lb.gameObject.SetActive(true);
|
||||
lb.Initialize(showContacts: false);
|
||||
lb.Initialize();
|
||||
SoundManager.instance.playSwitch();
|
||||
timeElapsed = 0;
|
||||
}
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CheckQrState : IState
|
||||
{
|
||||
float timer = 0;
|
||||
IState prevState;
|
||||
|
||||
public CheckQrState(IState prevState)
|
||||
{
|
||||
this.prevState = prevState;
|
||||
}
|
||||
|
||||
public void enter() => GameManager.instance.checkQrPanel.SetActive(true);
|
||||
|
||||
public void exit() => GameManager.instance.checkQrPanel.SetActive(false);
|
||||
public void update()
|
||||
{
|
||||
if (In.GetButtonDownAnyPlayer(PlayerAction.down))
|
||||
{
|
||||
//GameManager.instance.stateMachine.ChangeState(new SettingsState());
|
||||
GameManager.instance.stateMachine.ChangeState(prevState);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcfa1e8bd5399be4bb728fc77e661664
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,6 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
public class EnterNameState : IState
|
||||
{
|
||||
@ -53,8 +51,6 @@ public class EnterNameState : IState
|
||||
Debug.Log($"Записываю {name} {time} {moves}");
|
||||
record = new PlayerStatsRecord(name, time, moves);
|
||||
|
||||
|
||||
//gm.stateMachine.ChangeState(new ClearFieldState(true, CellState.Player1));
|
||||
gm.stateMachine.ChangeState(new LeaderboardState(record));
|
||||
|
||||
}
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EnterSpecialPrizeState : IState
|
||||
{
|
||||
TextInput textInput;
|
||||
GameManager gm;
|
||||
IState prevState;
|
||||
|
||||
public EnterSpecialPrizeState(IState prevState)
|
||||
{
|
||||
this.prevState = prevState;
|
||||
}
|
||||
|
||||
public void enter()
|
||||
{
|
||||
gm = GameManager.instance;
|
||||
|
||||
textInput = gm.specialPrizeInput;
|
||||
textInput.gameObject.SetActive(true);
|
||||
textInput.Initialize();
|
||||
}
|
||||
|
||||
public void exit() => textInput.gameObject.SetActive(false);
|
||||
|
||||
public void update()
|
||||
{
|
||||
int discreteDir = 0;
|
||||
if (In.GetButtonDown(ButtonPinMapping.left1)) discreteDir -= 1;
|
||||
if (In.GetButtonDown(ButtonPinMapping.right1)) discreteDir += 1;
|
||||
|
||||
int continiousDir = 0;
|
||||
if (In.GetButton(ButtonPinMapping.left2)) continiousDir -= 1;
|
||||
if (In.GetButton(ButtonPinMapping.right2)) continiousDir += 1;
|
||||
|
||||
textInput.SwitchSlot(discreteDir);
|
||||
textInput.SwitchLetter(continiousDir);
|
||||
|
||||
if (In.GetButtonDownAnyPlayer(PlayerAction.down))
|
||||
{
|
||||
PlayerPrefs.SetString("SpecialPrize", textInput.AcceptAndClose());
|
||||
|
||||
//переход
|
||||
//gm.stateMachine.ChangeState(new SettingsState());
|
||||
gm.stateMachine.ChangeState(prevState);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30d3d6d3b95dbb84eaf2e6d1177baef2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,55 +1,38 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
public class LeaderboardState : IState
|
||||
{
|
||||
bool showLastRecord = false;
|
||||
PlayerStatsRecord record;
|
||||
Leaderboard leaderboard;
|
||||
public LeaderboardState(PlayerStatsRecord record)
|
||||
{
|
||||
this.record = record;
|
||||
showLastRecord = true;
|
||||
}
|
||||
|
||||
public LeaderboardState()
|
||||
{
|
||||
//showLastRecord = false;
|
||||
showLastRecord = true;
|
||||
}
|
||||
|
||||
public void enter()
|
||||
{
|
||||
leaderboard = GameManager.instance.leaderboard;
|
||||
leaderboard.gameObject.SetActive(true);
|
||||
leaderboard.Initialize();
|
||||
|
||||
//ТУТ НАДО ПОМЕНЯТЬ ЛОГИКУ
|
||||
|
||||
bool showContacts = PlayerPrefs.GetInt("NeedSpecialPrize") == 1;
|
||||
leaderboard.Initialize(showContacts: showContacts);
|
||||
PlayerPrefs.SetInt("NeedSpecialPrize", 0);
|
||||
|
||||
if (showLastRecord)
|
||||
{
|
||||
PlayerStatsRecord lastRecord = GameManager.instance.StatsService.GetLatestRecord();
|
||||
leaderboard.DisplayCurrentPlayer(record);
|
||||
}
|
||||
|
||||
PlayerStatsRecord lastRecord = GameManager.instance.StatsService.GetLatestRecord();
|
||||
leaderboard.DisplayCurrentPlayer(record);
|
||||
}
|
||||
|
||||
public void exit()
|
||||
{
|
||||
leaderboard.ClearRowsText();
|
||||
|
||||
leaderboard.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
if (In.GetButtonDownAnyPlayer(PlayerAction.down))
|
||||
bool keepDownButton = In.GetButtonAnyPlayer(PlayerAction.down);
|
||||
float accelerationSign = keepDownButton ? 1 : -1f;
|
||||
leaderboard.accelerationY = Mathf.Abs(leaderboard.accelerationY) * accelerationSign;
|
||||
|
||||
if (In.GetButtonDownAnyPlayer(PlayerAction.left) && In.GetButtonDownAnyPlayer(PlayerAction.right))
|
||||
{
|
||||
//GameManager.instance.stateMachine.ChangeState(new FieldCleaner(true, CellState.Player1));
|
||||
FieldCleaner.Clear(true, CellState.Player1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -496,7 +496,6 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
PlayerPrefs.SetString("Serial", ExternalFilesGetter.GetSerial());
|
||||
|
||||
if (!PlayerPrefs.HasKey("SpecialPrize")) PlayerPrefs.SetString("SpecialPrize", "5000р");
|
||||
if (!PlayerPrefs.HasKey("Number")) PlayerPrefs.SetString("Number", "70000000000");
|
||||
if (!PlayerPrefs.HasKey("ValutaPerImpulse")) PlayerPrefs.SetInt("ValutaPerImpulse", 10);
|
||||
if (!PlayerPrefs.HasKey("ValutaName")) PlayerPrefs.SetString("ValutaName", "руб.");
|
||||
|
||||
@ -11,7 +11,6 @@ public class Leaderboard : MonoBehaviour
|
||||
[SerializeField] List<Transform> Rows;
|
||||
[SerializeField] Transform rankedRow;
|
||||
|
||||
[SerializeField] Transform specialPanel;
|
||||
[SerializeField] Transform rankedPanel;
|
||||
[SerializeField] GameObject instruction;
|
||||
|
||||
@ -53,30 +52,16 @@ public class Leaderboard : MonoBehaviour
|
||||
StopCoroutine(slideCoroutine);
|
||||
}
|
||||
|
||||
public void Initialize(bool showContacts)
|
||||
public void Initialize()
|
||||
{
|
||||
bool specialPrize = true;
|
||||
specialPrize = specialPrize & showContacts;
|
||||
|
||||
gm = GameManager.instance;
|
||||
|
||||
//Инициализация лэйаута
|
||||
specialPanel.gameObject.SetActive(specialPrize);
|
||||
if (specialPrize)
|
||||
{
|
||||
specialPanel.localPosition = specialPanelLocal;
|
||||
rankedPanel.localPosition = rankedPanelLocal;
|
||||
|
||||
tgQr.SetActive(PlayerPrefs.HasKey("Telegram"));
|
||||
whatsQr.SetActive(PlayerPrefs.HasKey("Number"));
|
||||
instruction.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
rankedPanel.localPosition = rankedPanelLocalOnly;
|
||||
instruction.SetActive(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
rankedPanel.localPosition = rankedPanelLocalOnly;
|
||||
instruction.SetActive(true);
|
||||
|
||||
|
||||
int totalRecords = gm.StatsService.GetTotalRecordsCount();
|
||||
int total = Mathf.Min(MaxRows, totalRecords);
|
||||
@ -94,14 +79,11 @@ public class Leaderboard : MonoBehaviour
|
||||
FillRow(i, topRecords[i]);
|
||||
}
|
||||
|
||||
//rankedRow.gameObject.SetActive(false);
|
||||
FillRow(rankedRow, gm.StatsService.GetLatestRecord());
|
||||
rankedRow.gameObject.SetActive(true);
|
||||
|
||||
if (!showContacts)
|
||||
{
|
||||
slideCoroutine = StartCoroutine(SlideCoroutine());
|
||||
}
|
||||
|
||||
slideCoroutine = StartCoroutine(SlideCoroutine());
|
||||
speedY = 0;
|
||||
|
||||
|
||||
|
||||
@ -98,7 +98,8 @@ public class QrTextInput : MonoBehaviour
|
||||
var sb = new StringBuilder();
|
||||
foreach (var slot in slots)
|
||||
{
|
||||
sb.Append(slot.GetText());
|
||||
|
||||
sb.Append(slot.GetText().Replace("", " "));
|
||||
}
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public class QrPanel : MonoBehaviour
|
||||
tex.filterMode = FilterMode.Point;
|
||||
var sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
|
||||
QrImage.sprite = sprite;
|
||||
Label.text = $"Âàø âûèãðûø: {qrPrize.PrizeText}";
|
||||
Label.text = qrPrize.PrizeText;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -44,7 +44,6 @@ public class CountersCollector : MonoBehaviour
|
||||
|
||||
// Другое
|
||||
new CounterData("Number", "Номер телефона", "<не указан>"),
|
||||
new CounterData("SpecialPrize", "Суперприз", "<не указан>")
|
||||
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user