Доработки TakeOrRisk

This commit is contained in:
se_ga 2026-04-02 12:39:04 +03:00
parent 61791e69ea
commit f1df0b2530
3 changed files with 144 additions and 6 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: 1, g: 0.42956585, b: 0, a: 1}
- _GlowColor: {r: 0, g: 0.8390024, 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}

View File

@ -34851,6 +34851,97 @@ MonoBehaviour:
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &1128241430
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1128241431}
- component: {fileID: 1128241434}
- component: {fileID: 1128241433}
- component: {fileID: 1128241432}
m_Layer: 5
m_Name: Image.1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1128241431
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1128241430}
m_LocalRotation: {x: 0, y: 0, z: -0.7071068, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2145516838883521660}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -90}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 50, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1128241432
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1128241430}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b5c5eb049fac9ad4abb6fe960d3429b6, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::ButtonTester
active: 1
button: 2
fadeTime: 0.1
--- !u!114 &1128241433
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1128241430}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
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_Sprite: {fileID: 21300000, guid: e2e62195d0338f2489f389664ec84938, type: 3}
m_Type: 0
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 &1128241434
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1128241430}
m_CullTransparentMesh: 1
--- !u!1 &1132796410
GameObject:
m_ObjectHideFlags: 0
@ -63099,6 +63190,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3052718489904343810}
- {fileID: 1128241431}
- {fileID: 3880825460768675321}
m_Father: {fileID: 8103669389208551850}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -68109,7 +68201,7 @@ GameObject:
- component: {fileID: 3146362536925492841}
- component: {fileID: 7490941115531949196}
m_Layer: 5
m_Name: Image
m_Name: TimerRing
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -68162,7 +68254,7 @@ RectTransform:
m_GameObject: {fileID: 2818249828079342868}
m_LocalRotation: {x: 0, y: 0, z: -0.7071068, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 0.75958, y: 0.75958, z: 0.75958}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2145516838883521660}
@ -68211,12 +68303,12 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: e2e62195d0338f2489f389664ec84938, type: 3}
m_Type: 0
m_Sprite: {fileID: 21300000, guid: 0dfe5d9c522efda49b6c41dd260adc54, type: 3}
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillAmount: 0
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
@ -74874,6 +74966,31 @@ MonoBehaviour:
NextPrizeFrame: {fileID: 1501477561599320377}
DisabledColor: {r: 0.16981131, g: 0.16981131, b: 0.16981131, a: 1}
HSV_speed: 0.3
TimerRing: {fileID: 3146362536925492841}
timerFillCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 2
outSlope: 2
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!114 &7987471542231822866
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -10,12 +10,17 @@ public class TakeOrRiskPanel : MonoBehaviour
[SerializeField] private Color DisabledColor;
[SerializeField] float HSV_speed = 2;
[SerializeField] private Image TimerRing;
[SerializeField] private AnimationCurve timerFillCurve;
private Image activeFrame;
private Image inactiveFrame;
private int index = 0;
private float acceptTimer = 0;
private void OnEnable()
{
activeFrame = CurrentPrizeFrame;
@ -29,7 +34,14 @@ public class TakeOrRiskPanel : MonoBehaviour
// добавить скалирование
//подсветку на кнопку принять
ProcessInput();
DisplayGraphics();
}
private void ProcessInput()
{
if (In.GetButtonAnyPlayer(PlayerAction.left)) index = 0;
if (In.GetButtonAnyPlayer(PlayerAction.right)) index = 1;
if (index == 0)
@ -44,9 +56,18 @@ public class TakeOrRiskPanel : MonoBehaviour
}
acceptTimer += Time.deltaTime * (In.GetButtonAnyPlayer(PlayerAction.down) ? 1 : -1);
acceptTimer = Mathf.Clamp01(acceptTimer);
}
private void DisplayGraphics()
{
float hue = (Time.time * HSV_speed) % 1f;
activeFrame.color = Color.HSVToRGB(hue, 1, 1);
inactiveFrame.color = DisabledColor;
TimerRing.fillAmount = timerFillCurve.Evaluate(acceptTimer);
}
}