Доработки анимации Awards

This commit is contained in:
Сергей Бондарь 2026-06-15 09:41:51 +03:00
parent aad232083b
commit ff2f05bace
28 changed files with 3016 additions and 3735 deletions

View File

@ -102,7 +102,7 @@ Material:
- _FaceColor: {r: 0.001517635, g: 0.006512091, b: 0.0018211621, a: 1}
- _GlowColor: {r: 0, g: 1, b: 0, a: 0.5}
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
- _OutlineColor: {r: 0, g: 1.0923874, b: 0.03148674, a: 1}
- _OutlineColor: {r: 0.33026448, g: 1.3307749, b: 0.09941315, a: 1}
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}

BIN
Assets/Art_victory_background.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ad41fad3efbe73e429b7500da5a67f14
guid: 59556bcb4a32866438900422064c60d3
TextureImporter:
internalIDToNameTable: []
externalObjects: {}

BIN
Assets/Gradient 1.png (Stored with Git LFS)

Binary file not shown.

BIN
Assets/Gradient 2.png (Stored with Git LFS)

Binary file not shown.

View File

@ -1,117 +0,0 @@
fileFormatVersion: 2
guid: cb244798f53c3f2489866e50999d2422
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Gradient.png (Stored with Git LFS)

Binary file not shown.

View File

@ -86,6 +86,7 @@ GameObject:
- component: {fileID: 6121119519676673602}
- component: {fileID: 5523692569909152760}
- component: {fileID: 2736682503672326015}
- component: {fileID: 5569081855027464498}
m_Layer: 5
m_Name: c1 (3)
m_TagString: Untagged
@ -150,6 +151,45 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &5569081855027464498
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 237900006655304929}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 53b090029497db44189a1e5a3eb48cc1, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::ImageBlinkerCurved
speed: 4
minAlpha: 0
maxAlpha: 1
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &262116687929867029
GameObject:
m_ObjectHideFlags: 0
@ -435,6 +475,7 @@ GameObject:
- component: {fileID: 9139651644040784066}
- component: {fileID: 1210885216614316605}
- component: {fileID: 3064785206510844867}
- component: {fileID: 4645830548831155213}
m_Layer: 5
m_Name: c1
m_TagString: Untagged
@ -499,6 +540,45 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &4645830548831155213
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3730608871843381565}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 53b090029497db44189a1e5a3eb48cc1, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::ImageBlinkerCurved
speed: 4
minAlpha: 0
maxAlpha: 1
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &6063758429801197639
GameObject:
m_ObjectHideFlags: 0
@ -561,6 +641,7 @@ GameObject:
- component: {fileID: 2904371954925331409}
- component: {fileID: 893702078982546685}
- component: {fileID: 1435041197998822170}
- component: {fileID: 6807260837436956628}
m_Layer: 5
m_Name: c1 (1)
m_TagString: Untagged
@ -625,6 +706,45 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &6807260837436956628
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6764317357873729328}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 53b090029497db44189a1e5a3eb48cc1, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::ImageBlinkerCurved
speed: 4
minAlpha: 0
maxAlpha: 1
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &6795994110757992481
GameObject:
m_ObjectHideFlags: 0
@ -703,6 +823,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 7663396241701243294}
- component: {fileID: 6986572081011980171}
m_Layer: 5
m_Name: RankView
m_TagString: Untagged
@ -731,6 +852,23 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: -32.8808}
m_SizeDelta: {x: 135.0524, y: 297.9138}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &6986572081011980171
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7042661695790052971}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c46a9054e7096e94cbfcb47cea973748, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::RankViewAwards
canvasGroup: {fileID: 1176477711274161006}
frame: {fileID: 6795994110757992481}
rankNameLabel: {fileID: 1739091710555712164}
rankCostLabel: {fileID: 4799297646292879861}
rankImage: {fileID: 4922071416389195276}
--- !u!1 &8462816744333625669
GameObject:
m_ObjectHideFlags: 0
@ -742,6 +880,7 @@ GameObject:
- component: {fileID: 7169574253161044453}
- component: {fileID: 7840630371423428341}
- component: {fileID: 2286982889021907121}
- component: {fileID: 5069631949204859647}
m_Layer: 5
m_Name: c1 (2)
m_TagString: Untagged
@ -806,3 +945,42 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &5069631949204859647
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8462816744333625669}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 53b090029497db44189a1e5a3eb48cc1, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::ImageBlinkerCurved
speed: 4
minAlpha: 0
maxAlpha: 1
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4

21
Assets/RankViewAwards.cs Normal file
View File

@ -0,0 +1,21 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class RankViewAwards : MonoBehaviour
{
[SerializeField] private CanvasGroup canvasGroup;
[SerializeField] private GameObject frame;
[SerializeField] private TextMeshProUGUI rankNameLabel;
[SerializeField] private TextMeshProUGUI rankCostLabel;
[SerializeField] private Image rankImage;
public void Configure(float alpha, bool enableFrame, string rankName, int rankCost, Sprite rankSprite)
{
canvasGroup.alpha = alpha;
frame.SetActive(enableFrame);
rankNameLabel.text = rankName;
rankCostLabel.text = rankCost.ToString();
rankImage.sprite = rankSprite;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c46a9054e7096e94cbfcb47cea973748

File diff suppressed because it is too large Load Diff

View File

@ -579,8 +579,9 @@ MonoBehaviour:
VR_Camera: {fileID: 1518557138}
Screen_Camera: {fileID: 1655591480}
soundManager: {fileID: 1073889037}
rankSystem: {fileID: 3059976232421739781}
logging: 0
debugMode: 1
debugMode: 0
--- !u!4 &560058346
Transform:
m_ObjectHideFlags: 0
@ -1242,8 +1243,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::YawOnlyTracker
cameraTransform: {fileID: 1518557137}
sensitivity: 1.8
offset: 0
--- !u!114 &1518557141
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1448,6 +1447,71 @@ MonoBehaviour:
m_CameraFloorOffsetObject: {fileID: 2096496404}
m_RequestedTrackingOriginMode: 0
m_CameraYOffset: 0
--- !u!4 &2285316183503554233
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6416619293638325124}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1869.0173, y: 562.9156, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3059976232421739781
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6416619293638325124}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3f847cabc9d05bd49b1c3909b00060ec, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::RankSystem
Ranks:
- Name: "\u041C\u0430\u0442\u0440\u043E\u0441"
Sprite: {fileID: 21300000, guid: 62e127f2bb3a5444f99dcbb69af2f9e6, type: 3}
SpriteGreen: {fileID: 365868915, guid: 6bb31a2aa476a88469755034eb5ed517, type: 3}
RequiredScore: 0
- Name: "\u041C\u0438\u0447\u043C\u0430\u043D"
Sprite: {fileID: 21300000, guid: 3c5924ce0c08e704c824d94b167fc3ae, type: 3}
SpriteGreen: {fileID: 933645103, guid: 47a49785b6c355c4299b5c9d94aa37a2, type: 3}
RequiredScore: 300
- Name: "\u041B\u0435\u0439\u0442\u0435\u043D\u0430\u043D\u0442"
Sprite: {fileID: 21300000, guid: ef72149d22ca52c4299881eda8c5aade, type: 3}
SpriteGreen: {fileID: 729642460, guid: 7f0a4287ad50cdc4c98ecfa124734211, type: 3}
RequiredScore: 1200
- Name: "\u041A\u0430\u043F\u0438\u0442\u0430\u043D"
Sprite: {fileID: 21300000, guid: 4e23b69ce5a038c419ad12da9319e630, type: 3}
SpriteGreen: {fileID: -1654332952, guid: 4e1304730f090ea41ab9aaace50dc5a0, type: 3}
RequiredScore: 3000
- Name: "\u0410\u0434\u043C\u0438\u0440\u0430\u043B"
Sprite: {fileID: 21300000, guid: 0c88c44236fbf284e9b9b3e3023b5a8c, type: 3}
SpriteGreen: {fileID: 267601266, guid: 71740167a97bb1646bc483efe0e01fa9, type: 3}
RequiredScore: 5000
--- !u!1 &6416619293638325124
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2285316183503554233}
- component: {fileID: 3059976232421739781}
m_Layer: 0
m_Name: '[RankSystem]'
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
@ -1460,3 +1524,4 @@ SceneRoots:
- {fileID: 185848252}
- {fileID: 1456733152}
- {fileID: 1070121185}
- {fileID: 2285316183503554233}

View File

@ -10165,71 +10165,6 @@ Transform:
- {fileID: 253928421}
m_Father: {fileID: 1514603878}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &591140603
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 591140605}
- component: {fileID: 591140604}
m_Layer: 0
m_Name: '[RankSystem]'
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &591140604
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 591140603}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3f847cabc9d05bd49b1c3909b00060ec, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::RankSystem
Ranks:
- Name: "\u041C\u0430\u0442\u0440\u043E\u0441"
Sprite: {fileID: 21300000, guid: 62e127f2bb3a5444f99dcbb69af2f9e6, type: 3}
SpriteGreen: {fileID: 365868915, guid: 6bb31a2aa476a88469755034eb5ed517, type: 3}
RequiredScore: 0
- Name: "\u041C\u0438\u0447\u043C\u0430\u043D"
Sprite: {fileID: 21300000, guid: 3c5924ce0c08e704c824d94b167fc3ae, type: 3}
SpriteGreen: {fileID: 933645103, guid: 47a49785b6c355c4299b5c9d94aa37a2, type: 3}
RequiredScore: 300
- Name: "\u041B\u0435\u0439\u0442\u0435\u043D\u0430\u043D\u0442"
Sprite: {fileID: 21300000, guid: ef72149d22ca52c4299881eda8c5aade, type: 3}
SpriteGreen: {fileID: 729642460, guid: 7f0a4287ad50cdc4c98ecfa124734211, type: 3}
RequiredScore: 1200
- Name: "\u041A\u0430\u043F\u0438\u0442\u0430\u043D"
Sprite: {fileID: 21300000, guid: 4e23b69ce5a038c419ad12da9319e630, type: 3}
SpriteGreen: {fileID: -1654332952, guid: 4e1304730f090ea41ab9aaace50dc5a0, type: 3}
RequiredScore: 3000
- Name: "\u0410\u0434\u043C\u0438\u0440\u0430\u043B"
Sprite: {fileID: 21300000, guid: 0c88c44236fbf284e9b9b3e3023b5a8c, type: 3}
SpriteGreen: {fileID: 267601266, guid: 71740167a97bb1646bc483efe0e01fa9, type: 3}
RequiredScore: 5000
--- !u!4 &591140605
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 591140603}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1404.3773, y: 209.15878, z: 642.2327}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &603210389
GameObject:
m_ObjectHideFlags: 0
@ -41522,7 +41457,6 @@ MonoBehaviour:
VrCanvas: {fileID: 328264234}
ScreenUI: {fileID: 1832249706}
vrUI: {fileID: 328264236}
RankSystem: {fileID: 591140604}
endgameAnimations: {fileID: 1901113855}
endgameAnimations1: {fileID: 1459415913}
cameraShaker: {fileID: 280953195}
@ -42894,7 +42828,6 @@ SceneRoots:
- {fileID: 2083402918}
- {fileID: 571227037}
- {fileID: 1623199034}
- {fileID: 591140605}
- {fileID: 314928456}
- {fileID: 1765129546}
- {fileID: 1441657668}

View File

@ -1,218 +0,0 @@
using Cysharp.Threading.Tasks;
using Lights;
using Periscope;
using System;
using System.Collections.Generic;
using System.Threading;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class AwardsController : MonoBehaviour
{
[Header("Boot")]
[SerializeField] private Canvas canvas;
[SerializeField] private Canvas vrCanvas;
[SerializeField] private float timeout = 100;
[SerializeField] private string menuSceneName = "MenuOneRegime";
[SerializeField] private string gameplaySceneName = "Gameplay";
[Header("Анимация счетчиков")]
[SerializeField] private List<AwardsShipCounter> shipCounters;
[Header("Анимация счета")]
[SerializeField] private TextMeshProUGUI scoreLabel;
[SerializeField] private float scorePerSecond = 200;
[SerializeField] private float maxDuration = 3;
[SerializeField] private AudioClip click;
[SerializeField] private AudioClip type;
[Header("Анимация ранга")]
[SerializeField] private Image RankImage;
[SerializeField] private TextMeshProUGUI RankLabel;
[SerializeField] private GameObject rankAnimation;
[SerializeField] private float rankAnimationTime = 4f;
[Header("Инструкция")]
[SerializeField] private float targetY = -20f;
[SerializeField] private AnimationCurve animationCurve;
//[SerializeField] private float animationMoveDuration = 1;
[SerializeField] private RectTransform instructionPanel;
[SerializeField] private AwardsInstruction instruction;
[Header("Таймер")]
[SerializeField] private TextMeshProUGUI TimerLabel;
[SerializeField] private GameObject TimerGO;
private bool polling = false;
private CancellationTokenSource timerCts;
async void Start()
{
if (!BootstrapperState.MainBootstraped)
{
SceneLoader.LoadScene("Bootstrap");
return;
}
Setup();
Debug.Log($"ScoreModel OK: {G.ScoreModel != null}");
foreach (var shipCounter in shipCounters)
{
if (shipCounter.ShowScore(G.ScoreModel))
await UniTask.Delay(1000);
}
await DisplayScore(G.ScoreModel.Score);
rankAnimation.SetActive(true);
await UniTask.Delay(TimeSpan.FromSeconds(rankAnimationTime));
//напечатать ранг
await DisplayRankName();
//показать ui
await ShowInstruction();
//Запустить поллинг
polling = true;
//Запустить таймер
timerCts = new CancellationTokenSource();
ShowTimer();
WaitTimeoutNExit(timerCts.Token).Forget();
}
private void Update()
{
if (!polling) return;
if (In.GetButtonDown(InSignal.DownRight))
{
CancelToken();
SceneLoader.LoadScene(menuSceneName);
}
if (In.GetButtonDown(InSignal.UpRight))
{
bool payed = WalletManager.TryTakeMoney(SettingsManager.GetInt(SettingKey.RevengePrice, 10));
if (payed)
{
CountersSystem.Increment(CountersSystem.CounterType.TotalStarts);
CountersSystem.Increment(CountersSystem.CounterType.StartsFromRevenge);
CancelToken();
SceneLoader.LoadScene(gameplaySceneName);
}
}
}
private void CancelToken()
{
timerCts?.Cancel();
timerCts?.Dispose();
timerCts = null;
}
private void Setup()
{
canvas.worldCamera = CamerasManager.Screen_Camera;
vrCanvas.worldCamera = CamerasManager.VR_Camera;
rankAnimation.SetActive(false);
instruction.Init();
HideTimer();
RankImage.sprite = G.Rank.Sprite;
PeriscopeManager.MoveUpToEnd();
LightSystem.SetAllIndicators(1);
}
private async UniTask DisplayScore(int score)
{
if (score == 0)
{
await UniTask.Delay(1000);
scoreLabel.text = score.ToString("D4");
return;
}
float duration = Mathf.Min((float)score / scorePerSecond, maxDuration);
Debug.Log("Score duration " + duration);
float displayedScore = 0;
while (displayedScore != score)
{
float delta = score / duration * Time.deltaTime;
displayedScore = displayedScore + delta;
displayedScore = Mathf.Min(displayedScore, score);
scoreLabel.text = ((int)displayedScore).ToString("D4");
SoundManager.PlayUi(click);
await UniTask.Yield(PlayerLoopTiming.Update);
}
scoreLabel.text = score.ToString("D4");
}
private async UniTask ShowInstruction()
{
float t = 0;
float startY = instructionPanel.anchoredPosition.y;
while (t < 1)
{
t += Time.deltaTime;
t = Mathf.Min(t, 1);
float y = Mathf.LerpUnclamped(startY, targetY, animationCurve.Evaluate(t));
instructionPanel.anchoredPosition = new Vector2(instructionPanel.anchoredPosition.x, y);
await UniTask.Yield(PlayerLoopTiming.Update);
}
}
private async UniTask WaitTimeoutNExit(CancellationToken token)
{
float timerest = timeout;
while (!token.IsCancellationRequested)
{
UpdateTimer(timerest);
await UniTask.Delay(1000, cancellationToken: token);
timerest -= 1;
if (timerest <= 0)
{
SceneLoader.LoadScene(menuSceneName);
break;
}
}
Debug.Log("Таймер убит");
}
private async UniTask DisplayRankName()
{
string rankName = G.Rank.Name;
RankLabel.text = "";
for (int i = 0; i < rankName.Length; i++)
{
RankLabel.text += rankName[i];
SoundManager.PlayUi(type);
await UniTask.Delay(150);
}
}
private void ShowTimer()
{
TimerGO.SetActive(true);
UpdateTimer(timeout);
}
private void HideTimer() => TimerGO.SetActive(false);
private void UpdateTimer(float seconds)
{
TimerLabel.text = TimeSpan.FromSeconds(seconds).ToString(@"mm\:ss");
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: f17ad2d2a59ae094f96cb26437b74684

View File

@ -1,7 +1,10 @@
using Cysharp.Threading.Tasks;
using RR.UI;
using System;
using System.Collections.Generic;
using System.Threading;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
@ -10,7 +13,7 @@ public class AwardsController2 : MonoBehaviour
[Header("Boot")]
[SerializeField] private Canvas canvas;
[SerializeField] private Canvas vrCanvas;
[SerializeField] private float timeout = 100;
[SerializeField] private float timeout = 120;
[SerializeField] private string menuSceneName = "MenuOneRegime";
[SerializeField] private string gameplaySceneName = "Gameplay";
@ -21,26 +24,61 @@ public class AwardsController2 : MonoBehaviour
[Header("Счетчики")]
[SerializeField] private List<AwardsShipCounter> shipCounters;
[SerializeField] private List<AwardsShipCounter> shipCountersVR;
//
[SerializeField] private CanvasGroup destroyedEnemiesCG;
[SerializeField] private CanvasGroup destroyedEnemiesVR;
[SerializeField] AudioClip soundExplosion;
[SerializeField] AudioClip soundShoot;
[Header("Счет")]
[SerializeField] private CanvasGroup scoreCG;
[SerializeField] private CanvasGroup scoreVR;
[SerializeField] private CounterTMP scoreCounter;
[SerializeField] private CounterTMP scoreCounterVR;
[Header("Ранг")]
[SerializeField] private CanvasGroup rankPanelCG;
[SerializeField] private CanvasGroup rankPanelVR;
[SerializeField] private CanvasGroup rankViewCG;
[SerializeField] private CanvasGroup rankViewVR;
[SerializeField] private CanvasGroup ranksTableCG;
[SerializeField] private Image rankImage;
[SerializeField] private Image rankImageVR;
[SerializeField] private TextMeshProUGUI rankLabel;
[SerializeField] private TextMeshProUGUI rankLabelVR;
[SerializeField] private List<RankViewAwards> rankViews;
[Header("До след ранга")]
[SerializeField] private CanvasGroup ToNextRankCG;
[SerializeField] private TextMeshProUGUI ToNextRankScore;
private bool shouldEnableToNextRank = false;
[Header("Инфо панель")]
[SerializeField] private CanvasGroup InfoPanelCG;
[SerializeField] TextMeshProUGUI timerLabel;
[SerializeField] TextMeshProUGUI balanceLabel;
[SerializeField] TextMeshProUGUI continueLabel;
[SerializeField] private CanvasGroup ExitCG;
[SerializeField] private CanvasGroup ContinueCG;
[SerializeField] InputController inputController;
private CancellationTokenSource cts;
private bool Freeplay => SettingsManager.GetBool(SettingKey.Freeplay, false);
private int PriceContinue => SettingsManager.GetInt(SettingKey.RevengePrice, 10);
[SerializeField] Image BgImage;
[SerializeField] private Sprite goodBg;
[SerializeField] private Sprite badBg;
[SerializeField] AudioSource scoreSound;
private void Start()
{
if (!BootstrapperState.MainBootstraped)
@ -48,6 +86,8 @@ public class AwardsController2 : MonoBehaviour
SceneLoader.LoadScene("Bootstrap");
return;
}
Init();
@ -64,28 +104,71 @@ public class AwardsController2 : MonoBehaviour
private void Init()
{
ranksTableCG.alpha = 0;
destroyedEnemiesCG.alpha = 0;
SetBackgroundByReason(G.EndGameChecker.lastReason);
destroyedEnemiesCG.alpha = 0; destroyedEnemiesVR.alpha = 0;
//инит счетчики
foreach (var shipCounter in shipCounters)
{
shipCounter.SetAlpha(0);
shipCounter.ShowScore(G.ScoreModel);
}
foreach (var shipCounter in shipCountersVR)
{
shipCounter.SetAlpha(0);
shipCounter.ShowScore(G.ScoreModel);
}
scoreCG.alpha = 0;
scoreCounter.SetCount(0);
scoreVR.alpha = 0;
scoreCounter.SetCount(0); scoreCounterVR.SetCount(0);
rankPanelCG.alpha = 0;
rankPanelVR.alpha = 0;
rankViewCG.alpha = 0;
rankViewVR.alpha = 0;
rankImage.sprite = G.Rank.SpriteGreen;
rankImageVR.sprite = G.Rank.SpriteGreen;
rankLabel.text = G.Rank.Name; rankLabelVR.text = G.Rank.Name;
//до след ранга
shouldEnableToNextRank = RankSystem.Instance.HasNextRank(G.ScoreModel.Score);
if (shouldEnableToNextRank)
{
ToNextRankScore.text = RankSystem.Instance.ScoreToNextRank(G.ScoreModel.Score).ToString() + " очков";
}
ToNextRankCG.alpha = 0;
//ини таблицы рангов
ranksTableCG.alpha = 0;
int actualRankIndex = RankSystem.Instance.GetActualRankIndex(G.ScoreModel.Score);
for (int i = 0; i < rankViews.Count; i++)
{
RankSystem.RankInfo rankInfo = RankSystem.Instance.Ranks[i];
float alpha = i > actualRankIndex ? 0.2f : 1f;
bool enableFrame = i == actualRankIndex;
rankViews[i].Configure(alpha, enableFrame, rankInfo.Name, rankInfo.RequiredScore, rankInfo.SpriteGreen);
}
InfoPanelCG.alpha = 0;
canvas.worldCamera = CamerasManager.Screen_Camera;
vrCanvas.worldCamera = CamerasManager.VR_Camera;
}
private void SetBackgroundByReason(EndGameConditionChecker.EndgameReason reason)
{
if (reason == EndGameConditionChecker.EndgameReason.Death)
BgImage.sprite = badBg;
else
BgImage.sprite = goodBg;
}
private async UniTask Process(CancellationToken ct)
{
await ShowLinesAndTitle(1, ct);
@ -95,7 +178,16 @@ public class AwardsController2 : MonoBehaviour
await UniTask.Delay(2000, cancellationToken: ct);
if(shouldEnableToNextRank)
LerpAlpha(0, 1,1, ToNextRankCG, ct).Forget();
RanksAndDestroyedAnimation(ct).Forget();
InstructionsAnimation(ct).Forget();
InitInfoPanel();
await LerpAlpha(0, 1, 1, InfoPanelCG, ct);
ActivateControls();
StartExitByTimerProcess(ct).Forget();
}
@ -122,30 +214,33 @@ public class AwardsController2 : MonoBehaviour
private async UniTask ShowDestroyedEnemies(CancellationToken ct)
{
SoundManager.PlayUi(soundExplosion);
destroyedEnemiesCG.alpha = 1;
destroyedEnemiesCG.alpha = 1; destroyedEnemiesVR.alpha = 1;
foreach (var shipCounter in shipCounters)
for (int i = 0; i < shipCounters.Count; i++)
{
await UniTask.Delay(500, cancellationToken: ct);
SoundManager.PlayUi(soundShoot);
shipCounter.SetAlpha(1);
shipCounters[i].SetAlpha(1); shipCountersVR[i].SetAlpha(1);
}
}
private async UniTask ShowScore(CancellationToken ct)
{
await LerpAlpha(0, 1, 5, scoreCG, ct);
LerpAlpha(0, 1, 5, scoreVR, ct).Forget(); await LerpAlpha(0, 1, 5, scoreCG, ct);
await UniTask.Delay(1000, cancellationToken: ct);
await scoreCounter.AnimateScoreChange(0, G.ScoreModel.Score);
scoreSound.Play();
scoreCounterVR.AnimateScoreChange(0, G.ScoreModel.Score).Forget(); await scoreCounter.AnimateScoreChange(0, G.ScoreModel.Score);
scoreSound.Stop();
}
private async UniTask ShowRank(CancellationToken ct)
{
await LerpAlpha(0, 1, 5, rankPanelCG, ct);
LerpAlpha(0, 1, 5, rankPanelVR, ct).Forget(); await LerpAlpha(0, 1, 5, rankPanelCG, ct);
await UniTask.Delay(1000, cancellationToken: ct);
//звук тут
rankViewCG.alpha = 1;
SoundManager.PlayUi(soundShoot);
rankViewCG.alpha = 1; rankViewVR.alpha = 1;
}
private async UniTask RanksAndDestroyedAnimation(CancellationToken ct)
@ -158,32 +253,91 @@ public class AwardsController2 : MonoBehaviour
await LerpAlpha(1, 0, 1, descendingGroup, ct);
await LerpAlpha(0, 1, 1, ascendingGroup, ct);
await UniTask.Delay(3000, cancellationToken: ct);
if(!ct.IsCancellationRequested)
if (!ct.IsCancellationRequested)
{
(descendingGroup, ascendingGroup) = (ascendingGroup, descendingGroup);
}
}
}
private async UniTask ShowControls(CancellationToken ct)
private async UniTask InstructionsAnimation(CancellationToken ct)
{
//
var descendingGroup = ContinueCG;
var ascendingGroup = ExitCG;
ActivateControls();
StartExitByTimerProcess(ct).Forget();
while (!ct.IsCancellationRequested)
{
await LerpAlpha(1, 0, 1, descendingGroup, ct);
await LerpAlpha(0, 1, 1, ascendingGroup, ct);
await UniTask.Delay(3000, cancellationToken: ct);
if (!ct.IsCancellationRequested)
{
(descendingGroup, ascendingGroup) = (ascendingGroup, descendingGroup);
}
}
}
private void ActivateControls()
{
inputController.Init(startPolling: true);
}
public void InitInfoPanel()
{
UpdateTimer(timeout);
UpdateBalance(WalletManager.Balance);
WalletManager.OnBalanceChanged += UpdateBalance;
balanceLabel.enabled = !Freeplay;
if (Freeplay)
{
continueLabel.text = $"Продолжить\n ";
}
else
{
int price = PriceContinue;
continueLabel.text = $"Продолжить\n{price} {GetValutaPluralized(price)}";
}
}
private async UniTask StartExitByTimerProcess(CancellationToken ct)
{
while(timeout > 0 && !ct.IsCancellationRequested)
{
UpdateTimer(timeout);
timeout -= 1;
await UniTask.Delay(1000, cancellationToken:ct);
}
if(!ct.IsCancellationRequested)
{
ExitMenu();
}
}
public void ExitMenu()
{
cts?.Cancel();
cts?.Dispose();
cts = null;
WalletManager.OnBalanceChanged -= UpdateBalance;
SceneLoader.LoadScene(menuSceneName);
}
public void Resume()
{
if(Freeplay || WalletManager.TryTakeMoney(PriceContinue))
{
cts?.Cancel();
cts?.Dispose();
cts = null;
WalletManager.OnBalanceChanged -= UpdateBalance;
SceneLoader.LoadScene(gameplaySceneName);
}
}
//Helpers
private async UniTask LerpAlpha(float from, float to, float speed, CanvasGroup cg, CancellationToken ct)
@ -191,7 +345,7 @@ public class AwardsController2 : MonoBehaviour
float t = 0;
while (t < 1 && !ct.IsCancellationRequested)
{
t += Time.deltaTime * speed;
t += Time.deltaTime * speed;
t = Mathf.Min(t, 1);
cg.alpha = Mathf.Lerp(from, to, t);
@ -199,4 +353,18 @@ public class AwardsController2 : MonoBehaviour
}
cg.alpha = to;
}
}
private string GetValutaPluralized(int balance)
=> SettingsManager.GetString(SettingKey.Valuta, "руб.") == "руб." ? PluralizeUtil.Rubles(balance) : PluralizeUtil.Tokens(balance);
private void UpdateTimer(float timerest)
{
TimeSpan time = TimeSpan.FromSeconds(timerest);
timerLabel.text = $"выход в меню через:\n {time.ToString(@"mm\:ss")}";
}
private void UpdateBalance(int balance)
{
balanceLabel.text = $"баланс:\n{balance} {GetValutaPluralized(WalletManager.Balance)}";
}
}

View File

@ -26,6 +26,9 @@ public class MainBootstrap : MonoBehaviour
[Header("Sound manager")]
[SerializeField] private SoundManager soundManager;
[Header("Системы")]
[SerializeField] private RankSystem rankSystem;
[Header("Отладка")]
[SerializeField] private bool logging;
[SerializeField] private bool debugMode;
@ -157,6 +160,9 @@ public class MainBootstrap : MonoBehaviour
In.Initialize(In.GetInputSourceByType(InputType));
soundManager.Initialize();
rankSystem.Initialize();
DontDestroyOnLoad(rankSystem);
#endregion
Log("Главный загрузчик отработал");

View File

@ -7,6 +7,7 @@ using Lights;
public class EndGameConditionChecker : IDisposable
{
public event Action<EndgameReason> OnEndGameCondition;
public EndgameReason lastReason;
private bool _isDisposed = false;
private float startTime;
@ -79,6 +80,7 @@ public class EndGameConditionChecker : IDisposable
{
if (_isDisposed) return;
Dispose();
lastReason = reason;
OnEndGameCondition?.Invoke(reason);
}

View File

@ -10,6 +10,7 @@ public class GameSessionTerminator
{
OnTerminate?.Invoke(reason);
LightSystem.Ef_End();
RankSystem.Instance.UnsubscribeOnScore();
EndGameAnimation().Forget();
}

View File

@ -20,7 +20,7 @@ public class GameplayBootstrap : MonoBehaviour
[SerializeField] private VrUI vrUI;
[SerializeField] private RankSystem RankSystem;
//[SerializeField] private RankSystem RankSystem;
[SerializeField] private EndgameAnimationsStarter endgameAnimations;
[SerializeField] private EndgameAnimationsStarter endgameAnimations1;
@ -74,7 +74,7 @@ public class GameplayBootstrap : MonoBehaviour
foreach (var s in Spawners)
s.Initialize();
RankSystem.Initialize();
//RankSystem.Initialize();
endgameAnimations.Init();
endgameAnimations1.Init();
@ -85,5 +85,7 @@ public class GameplayBootstrap : MonoBehaviour
LightSystem.Ef_Start();
inputController.Init(startPolling: true);
RankSystem.Instance.SubscribeOnScore();
}
}

View File

@ -5,31 +5,55 @@ using UnityEngine;
public class RankSystem : MonoBehaviour
{
public static event Action<RankInfo> OnNewRank;
[SerializeField] private List<RankInfo> Ranks;
public List<RankInfo> Ranks;
private RankInfo currentRank;
private bool initialized = false;
public static RankSystem Instance;
public void Initialize()
{
if(Ranks == null || Ranks.Count == 0)
if (Ranks == null || Ranks.Count == 0)
{
Debug.LogError("Ранги не заданы", this);
return;
}
SortRanks();
Instance = this;
Ranks.Sort();
currentRank = Ranks[0];
G.Rank = currentRank;
G.ScoreModel.OnUpdate += Refresh;
Refresh(G.ScoreModel);
initialized = true;
}
public void SubscribeOnScore()
{
G.Rank = currentRank;
Refresh(G.ScoreModel);
G.ScoreModel.OnUpdate += Refresh;
}
public void UnsubscribeOnScore()
{
if (G.ScoreModel != null)
G.ScoreModel.OnUpdate -= Refresh;
}
public void ResetSystem()
{
UnsubscribeOnScore();
Initialize();
}
private void Refresh(ScoreModel model)
{
RankInfo RankByScore = GetActualRank(model.Score);
int score = model.Score;
Refresh(score);
}
if(RankByScore != currentRank)
private void Refresh(int score)
{
RankInfo RankByScore = GetActualRank(score);
if (RankByScore != currentRank)
{
currentRank = RankByScore;
G.Rank = currentRank;
@ -37,9 +61,12 @@ public class RankSystem : MonoBehaviour
}
}
private void OnDestroy()
{
if (!initialized) return;
UnsubscribeOnScore();
G.ScoreModel.OnUpdate -= Refresh;
}
@ -56,11 +83,38 @@ public class RankSystem : MonoBehaviour
return Ranks[0];
}
private void SortRanks()
public int GetActualRankIndex(int score)
{
Ranks.Sort();
for (int i = Ranks.Count - 1; i >= 0; i--)
{
if (score >= Ranks[i].RequiredScore)
{
return i;
}
}
return 0;
}
public bool HasNextRank(int score)
{
int nextRankIndex = GetActualRankIndex(score) + 1;
return nextRankIndex < Ranks.Count;
}
public int ScoreToNextRank(int score)
{
int currentIndex = GetActualRankIndex(score);
int nextRankIndex = currentIndex + 1;
if (nextRankIndex < Ranks.Count)
{
return Ranks[nextRankIndex].RequiredScore - score;
}
return 0;
}
[Serializable]
public class RankInfo : IComparable<RankInfo>
{

View File

@ -29,5 +29,6 @@ public class MainMenuBootstrapOneRegime : MonoBehaviour
LightSystem.SetAllIndicators(1);
inputController.Init(startPolling: true);
RankSystem.Instance.ResetSystem();
}
}

BIN
Assets/kupyuryi-pereschityivayut--byistro.mp3 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: cb0f0dbb23b672d4e99bd7f6c51944f1
AudioImporter:
externalObjects: {}
serializedVersion: 8
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/statistics_periscope.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ca0e8aad25e75db4cbe75907c336042c
guid: bcc07327105234b4c9e0453bbf2e1500
TextureImporter:
internalIDToNameTable: []
externalObjects: {}