Поправил временные диапазоны чтобы не было дат из будущего

This commit is contained in:
_sega 2026-01-16 15:46:12 +03:00
parent be02b4720b
commit 3fd5c1a8ef
11 changed files with 430 additions and 44 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.33392012, g: 1, b: 0, a: 1}
- _GlowColor: {r: 0.79440284, g: 1, 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}

View File

@ -12370,7 +12370,8 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
excludedIds: []
excludedIds:
- PasswordOnSettings
viewProvider: {fileID: 581100738}
SettingsContent: {fileID: 1092824966}
GeneralOffset: {x: 0, y: 0}
@ -12443,6 +12444,8 @@ MonoBehaviour:
prefab: {fileID: 2411643208637742630, guid: ffadea15cbb760944a0da2c4cc5997d9, type: 3}
- id: DisplayNoPrizes
prefab: {fileID: 1804015508813908771, guid: cdc2db675d691d3438e213fc716e5ae6, type: 3}
- id: PasswordOnSettings
prefab: {fileID: 1804015508813908771, guid: cdc2db675d691d3438e213fc716e5ae6, type: 3}
--- !u!114 &581100739
MonoBehaviour:
m_ObjectHideFlags: 0
@ -12526,6 +12529,8 @@ MonoBehaviour:
descriptionPrefab: {fileID: 7265677761729542613, guid: f1b38f94252bdb949a1235fa032e73da, type: 3}
- id: DisplayNoPrizes
descriptionPrefab: {fileID: 7265677761729542613, guid: 00a1bdf8cf92f60439bc2e7b62d53e51, type: 3}
- id: PasswordOnSettings
descriptionPrefab: {fileID: 7265677761729542613, guid: 2fd63316851eaa84d9771255e07e69cf, type: 3}
defaultDescription: {fileID: 7265677761729542613, guid: 3da6c849967083641b4128baeb7ab2cd, type: 3}
--- !u!114 &581100740
MonoBehaviour:
@ -12556,6 +12561,8 @@ MonoBehaviour:
IconPrefab: {fileID: 4694825826381118814, guid: 4de5e8c413469c449bedbd39f074110c, type: 3}
- Name: "\u0421\u0447\u0435\u0442\u0447\u0438\u043A\u0438 \u0438 \u0441\u0431\u0440\u043E\u0441\u044B"
IconPrefab: {fileID: 4694825826381118814, guid: a728c96cb10ae5c42901b45e76a8ccba, type: 3}
- Name: "\u0421\u0435\u0440\u0432\u0438\u0441"
IconPrefab: {fileID: 4694825826381118814, guid: a728c96cb10ae5c42901b45e76a8ccba, type: 3}
defaultIcon: {fileID: 4694825826381118814, guid: 612cb682b003c2e47b1b19691392af69, type: 3}
--- !u!1 &583807441
GameObject:
@ -23090,6 +23097,94 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 875450963}
m_CullTransparentMesh: 1
--- !u!1 &876049767
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 876049768}
- component: {fileID: 876049770}
- component: {fileID: 876049769}
- component: {fileID: 876049771}
m_Layer: 5
m_Name: PasswordCatcher
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &876049768
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 876049767}
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: 1122363135}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &876049769
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 876049767}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &876049770
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 876049767}
m_CullTransparentMesh: 1
--- !u!225 &876049771
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 876049767}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!1 &876915625
GameObject:
m_ObjectHideFlags: 0
@ -32722,6 +32817,7 @@ RectTransform:
- {fileID: 438536881}
- {fileID: 1603925512}
- {fileID: 1614501703}
- {fileID: 876049768}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}

View File

@ -263,9 +263,10 @@ public class MenuState : IState
void OpenMenu()
{
animationEnded = false;
gm.menuOpened = true;
gm.StartCoroutine(openMenuAnimation());
subState = MenuSubStates.Choosing;
}
@ -388,9 +389,12 @@ public class MenuState : IState
animationEnded = true;
gm.botScale.gameObject.SetActive(false);
gm.Player1Scale.gameObject.SetActive(false);
gm.Player2Scale.gameObject.SetActive(false);
}
//это было в конце корутины открытия меню
//gm.botScale.gameObject.SetActive(false);
//gm.Player1Scale.gameObject.SetActive(false);
//gm.Player2Scale.gameObject.SetActive(false);// это не через шкала менеджер делается?
//СДЕЛАЛ метод для выключения таймеров в менеджере
}

View File

@ -11,42 +11,42 @@ public class MenuUi : MonoBehaviour
[Header("Верхний блок")]
[SerializeField] RectTransform TopContainer;
private Vector2 TopMenuPosition;
[SerializeField] Vector2 TopGameplayOffset;
[SerializeField] Vector2 TopGameplayOffset = new Vector2(0, 1000);
[Header("Нижний блок")]
[SerializeField] RectTransform BottomContainer;
private Vector2 BottomMenuPosition;
[SerializeField] Vector2 BottomGameplayOffset;
[SerializeField] Vector2 BottomGameplayOffset =new Vector2(0, -1000);
[Header("Режим на одного")]
[SerializeField] RectTransform PveContainer;
private Vector2 PveMenuPosition;
[SerializeField] Vector2 PveGameplayOffset;
[SerializeField] Vector2 PveGameplayOffset = new Vector2(-2000, 0);
[Header("Режим на двоих")]
[SerializeField] RectTransform PvpContainer;
private Vector2 PvpMenuPosition;
[SerializeField] Vector2 PvpGameplayOffset;
[SerializeField] Vector2 PvpGameplayOffset = new Vector2(2000, 0);
[Header("Надпись призы закончились")]
[SerializeField] RectTransform PrizesOut;
private Vector2 PrizesOutMenuPosition;
[SerializeField] Vector2 PrizesOutGameplayOffset;
[SerializeField] Vector2 PrizesOutGameplayPosition;
[SerializeField] Vector2 PrizesOutGameplayOffset = new Vector2(-2000, -409+70);
[SerializeField] Vector2 PrizesOutGameplayPosition = new Vector2(0, -409);
private Vector2 PrizesOutMenuSizeDelta;
[SerializeField] Vector2 PrizesOutGameplaySizeDelta;
[SerializeField] Vector2 PrizesOutGameplaySizeDelta = new Vector2(660, 100);
[Header("Счетчик монет")]
[SerializeField] Transform CoinCounter;
private Vector2 CoinCounterMenuPosition;
[SerializeField] Vector2 CoinCounterGameplayPosition;
[SerializeField] Vector2 CoinCounterGameplayPosition = new Vector3(-8.964f, 3.6f);
[Header("Доска")]
[SerializeField] Transform Board;
private Vector2 BoardMenuPosition;
[SerializeField] Vector2 BoardGameplayPosition;
[SerializeField] Vector2 BoardGameplayPosition = new Vector2(0, -0.5f);
private bool _cached = false;
@ -54,7 +54,7 @@ public class MenuUi : MonoBehaviour
bool Menu;
bool Gameplay;
float last_t = 0;
void InitializeIfNeed()
@ -82,7 +82,7 @@ public class MenuUi : MonoBehaviour
public void OpenMenu()
{
InitializeIfNeed();
StopAllCoroutines();
}
public void CloseMenu()
@ -94,7 +94,7 @@ public class MenuUi : MonoBehaviour
IEnumerator OpenGameplayAnim()
{
float t;
float t = last_t;
//ШАГ 1. ПРЯЧЕМ МЕНЮ
t = 0;
@ -112,7 +112,6 @@ public class MenuUi : MonoBehaviour
BottomContainer.anchoredPosition = Vector2.Lerp(BottomMenuPosition, BottomMenuPosition + BottomGameplayOffset, t);
PrizesOut.anchoredPosition = Vector2.Lerp(PrizesOutMenuPosition, PrizesOutMenuPosition + PrizesOutGameplayOffset, t);
PrizesOut.sizeDelta = Vector2.Lerp(PrizesOutMenuSizeDelta, PrizesOutGameplaySizeDelta, t);
CoinCounter.localPosition = Vector2.Lerp(CoinCounterMenuPosition, CoinCounterGameplayPosition, t);
@ -122,6 +121,8 @@ public class MenuUi : MonoBehaviour
//ШАГ 1. Показываем доску
t = 0;
PrizesOut.sizeDelta = PrizesOutGameplaySizeDelta;
while (t < 1)
{
t += Time.deltaTime * 2;//скорость надо высчитывать
@ -145,49 +146,31 @@ public class MenuUi : MonoBehaviour
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);
//монетка
//float startDistance = Vector3.Distance(coinPanel.position, sCoin);
//while (Vector3.Distance(coinPanel.position, sCoin) > 0.01f)
//{
// float coinspeed = startDistance * Time.deltaTime * 2;
// coinPanel.localPosition = Vector3.MoveTowards(coinPanel.localPosition, sCoin, coinspeed);
// yield return null;
//}
//coinPanel.localPosition = sCoin;
//label2.localPosition = Vector3.Lerp(sLabel2, eLabel2, t);
//SmallPrizesOut.sizeDelta = Vector2.Lerp(sSmallPrizesOutSize, eSmallPrizesOutSize, t);
PrizesOut.anchoredPosition = Vector2.Lerp(PrizesOutMenuPosition + PrizesOutGameplayOffset, PrizesOutMenuPosition, t);
yield return null;
}
//animationEnded = true;
//gm.botScale.gameObject.SetActive(false);
//gm.Player1Scale.gameObject.SetActive(false);
//gm.Player2Scale.gameObject.SetActive(false);
}

View File

@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PasswordCatcher : MonoBehaviour
{
CanvasGroup canvasGroup;
bool passwordForSettings;
private void Start()
{
canvasGroup.alpha = 0;
passwordForSettings = SettingsManager.GetBool("PasswordOnSettings", false);
SettingsManager.OnSettingsChanged.AddListener(ApplySettings);
}
void ApplySettings()
{
if (NeedToSetPassword())
{
//состояние зайти в установку пароля
}
}
bool NeedToSetPassword()
{
bool passwordForSettingsNewValue = SettingsManager.GetBool("PasswordOnSettings", false);
return false;
}
}

View File

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

View File

@ -0,0 +1,178 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &334621903248152329
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4641018153116856876}
- component: {fileID: 7974557143938056251}
- component: {fileID: 3186854818972227115}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4641018153116856876
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 334621903248152329}
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: 4639762839304224986}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 10, y: -10}
m_SizeDelta: {x: -20, y: -20}
m_Pivot: {x: 0, y: 1}
--- !u!222 &7974557143938056251
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 334621903248152329}
m_CullTransparentMesh: 1
--- !u!114 &3186854818972227115
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 334621903248152329}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "-\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C
\u043D\u0430 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438. \u041F\u0440\u0438
\u0432\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0438 \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u0435\u0442\u0441\u044F
\u043F\u0430\u043D\u0435\u043B\u044C \u0432\u0432\u043E\u0434\u0430 \u043F\u0430\u0440\u043E\u043B\u044F.
\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438 \u0437\u0430\u043F\u043E\u043C\u043D\u0438\u0442\u0435.\n-\u041F\u0440\u0438
\u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438 \u043F\u0430\u0440\u043E\u043B\u044C
\u043E\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044F."
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 3f10bbcf486189d4f95b8de6dc2e2177, type: 2}
m_sharedMaterial: {fileID: 4262305343556741190, guid: 3f10bbcf486189d4f95b8de6dc2e2177, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 20
m_fontSizeBase: 20
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 16
m_fontSizeMax: 64
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &7265677761729542613
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4639762839304224986}
m_Layer: 5
m_Name: PasswordOnSettings
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4639762839304224986
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7265677761729542613}
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:
- {fileID: 4641018153116856876}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 820, y: 160}
m_Pivot: {x: 0.5, y: 0.5}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2fd63316851eaa84d9771255e07e69cf
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -266,6 +266,14 @@ public class SettingsManager : MonoBehaviour
cycling: false,
value: false));
//от 16.01.2026
settings.Add(new Setting(id: "PasswordOnSettings",
alias: "Вход в настройки по паролю",
group: "Сервис",
type: SettingType.Bool,
cycling: false,
value: false));
return settings;
}

View File

@ -333,7 +333,7 @@ public class PlayerStatsService : IDisposable
}
public static DateTime GetRandomDateTimeInRange()
/* public static DateTime GetRandomDateTimeInRange()
{
System.Random random = new System.Random();
@ -350,5 +350,67 @@ public class PlayerStatsService : IDisposable
return new DateTime(randomDay.Year, randomDay.Month, randomDay.Day,
randomHour, randomMinute, randomSecond);
}*/
public static DateTime GetRandomDateTimeInRange()
{
System.Random random = new System.Random();
DateTime now = DateTime.Now;
// Максимальная дата/время: {сейчас} - 5 часов
DateTime maxDateTime = now.AddHours(-5);
// Если время maxDateTime выходит за рамки 11-17 часов, корректируем
if (maxDateTime.Hour < 11)
{
// Если меньше 11 утра, смещаем на предыдущий день 17:00
maxDateTime = maxDateTime.Date.AddDays(-1).AddHours(17);
}
else if (maxDateTime.Hour > 17)
{
// Если больше 17:00, устанавливаем на сегодня 17:00
maxDateTime = maxDateTime.Date.AddHours(17);
}
// Минимальная дата: 5 дней назад от maxDateTime
DateTime minDateTime = maxDateTime.AddDays(-5);
// Корректируем minDateTime, чтобы он тоже был в диапазоне 11-17 часов
if (minDateTime.Hour < 11)
{
minDateTime = minDateTime.Date.AddHours(11);
}
else if (minDateTime.Hour > 17)
{
minDateTime = minDateTime.Date.AddHours(17);
}
// Генерируем случайные даты в диапазоне с учетом часов 11-17
List<DateTime> validDates = new List<DateTime>();
// Перебираем все дни в диапазоне
for (DateTime date = minDateTime.Date; date <= maxDateTime.Date; date = date.AddDays(1))
{
// Для каждого дня добавляем только часы с 11 до 17
for (int hour = 11; hour <= 17; hour++)
{
DateTime candidate = date.AddHours(hour).AddMinutes(random.Next(0, 60)).AddSeconds(random.Next(0, 60));
// Проверяем, что время находится в нашем диапазоне
if (candidate >= minDateTime && candidate <= maxDateTime)
{
validDates.Add(candidate);
}
}
}
// Если есть подходящие даты, возвращаем случайную
if (validDates.Count > 0)
{
return validDates[random.Next(validDates.Count)];
}
// Если нет подходящих дат (очень узкий диапазон), возвращаем minDateTime
return minDateTime;
}
}

View File

@ -54,6 +54,12 @@ public class TimerManager : MonoBehaviour
}
}
public void DisableAllTimers()
{
player1Timer.gameObject.SetActive(false);
player2Timer.gameObject.SetActive(false);
}
void StartTimer(CellState player)
{
if (player == CellState.Player1)