Выход из игры по нажатию и1 или и2. Только перед первым ходом. Деньги возвращает на счетчики не влияет

This commit is contained in:
_sega 2026-01-14 12:47:33 +03:00
parent 2681a69a3d
commit f9f21daf83
10 changed files with 429 additions and 27 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.06446934, g: 0, b: 1, a: 1}
- _GlowColor: {r: 1, g: 0, b: 0.49600172, 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

@ -2386,6 +2386,101 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: -380}
m_SizeDelta: {x: 1496.1613, y: 224.65833}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &111727726
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 111727727}
- component: {fileID: 111727730}
- component: {fileID: 111727729}
- component: {fileID: 111727728}
m_Layer: 0
m_Name: btn image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &111727727
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 111727726}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.1455, y: 2.1455, z: 2.1455}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1304043906}
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.5}
m_SizeDelta: {x: 1, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &111727728
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 111727726}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5793ef5705258b41b327430fe3c351e, type: 3}
m_Name:
m_EditorClassIdentifier:
material: {fileID: 0}
speed: 4
min: 1.8
max: 2
scaleSpeed: 5
rotateSpeed: 0
angularAmpliude: 0
--- !u!114 &111727729
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 111727726}
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: 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: a640cc94f9689af4bbf5ca46685dfd85, 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 &111727730
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 111727726}
m_CullTransparentMesh: 1
--- !u!1 &111974049
GameObject:
m_ObjectHideFlags: 0
@ -2595,6 +2690,141 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 128539489}
m_CullTransparentMesh: 1
--- !u!1 &137582303
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 137582304}
- component: {fileID: 137582306}
- component: {fileID: 137582305}
m_Layer: 0
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &137582304
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 137582303}
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: 1304043906}
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.473}
m_SizeDelta: {x: 3, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &137582305
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 137582303}
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: "\u041D\u0430\u0437\u0430\u0434 \u0432 \u043C\u0435\u043D\u044E<br>(\u043A\u0440\u0435\u0434\u0438\u0442\u044B
\u0432\u0435\u0440\u043D\u0443\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: 0.3
m_fontSizeBase: 0.3
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 16
m_fontSizeMax: 64
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: -50
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!222 &137582306
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 137582303}
m_CullTransparentMesh: 1
--- !u!1 &139861217
GameObject:
m_ObjectHideFlags: 0
@ -5550,6 +5780,7 @@ MonoBehaviour:
stepX: 1.215
stepY: 1.24
startY: 5
moveMade: 0
chipXSpeed: 50
chipYSpeed: 0
chipAcceleration: 200
@ -25723,7 +25954,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -8.401, y: -1.41}
m_AnchoredPosition: {x: -8.966, y: -1.41}
m_SizeDelta: {x: 3, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1039507332
@ -35449,6 +35680,97 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1298865402}
m_CullTransparentMesh: 1
--- !u!1 &1304043905
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1304043906}
- component: {fileID: 1304043908}
- component: {fileID: 1304043907}
- component: {fileID: 1304043909}
m_Layer: 0
m_Name: Back to menu button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1304043906
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1304043905}
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: 111727727}
- {fileID: 137582304}
m_Father: {fileID: 1551328425}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -8.966, y: 0.306}
m_SizeDelta: {x: 3, y: 2}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!225 &1304043907
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1304043905}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 0
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!223 &1304043908
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1304043905}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 500331691
m_SortingOrder: 22
m_TargetDisplay: 0
--- !u!114 &1304043909
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1304043905}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5aff4130243041642870d5eface590f6, type: 3}
m_Name:
m_EditorClassIdentifier:
appearSpeed: 100
appearDelay: 2
disappearSpeed: 7
disappearDelay: 0
--- !u!1 &1308992265
GameObject:
m_ObjectHideFlags: 0
@ -44548,6 +44870,7 @@ Transform:
- {fileID: 2097140892}
- {fileID: 492468474}
- {fileID: 1039507331}
- {fileID: 1304043906}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1556574614

View File

@ -0,0 +1,53 @@
using System.Collections;
using UnityEditor.Tilemaps;
using UnityEngine;
[RequireComponent(typeof(CanvasGroup))]
public class BackToMenuButton : MonoBehaviour
{
[Header("Появление")]
[SerializeField] float appearSpeed = 100;
[SerializeField] float appearDelay = 2;
[Header("Растворение")]
[SerializeField] float disappearSpeed = 1;
[SerializeField] float disappearDelay = 0;
CanvasGroup canvasGroup;
GameManager gm;
bool ActualState = false;
void Start()
{
canvasGroup = GetComponent<CanvasGroup>();
gm = GameManager.instance;
ActualState = gm.moveMade;
}
void Update()
{
if (ActualState != gm.moveMade)
{
ActualState = gm.moveMade;
StopAllCoroutines();
StartCoroutine(changeState());
}
}
IEnumerator changeState()
{
//actualState true значит что ход сделан и надо убрать надпись
float speed = ActualState ? disappearSpeed : appearSpeed;
float delay = ActualState ? disappearDelay : appearDelay;
float targetAlpha = ActualState ? 0 : 1;
yield return new WaitForSeconds(delay);
while (canvasGroup.alpha != targetAlpha)
{
canvasGroup.alpha = Mathf.MoveTowards(canvasGroup.alpha, targetAlpha, Time.deltaTime * speed);
yield return null;
}
canvasGroup.alpha = targetAlpha;
}
}

View File

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

View File

@ -100,11 +100,15 @@ public class MenuState : IState
CharacterController.HideCharacter();
CharacterController.I.SetAllCharactersPrizeAvailable(true);
DualAvatarController.Instance.KillCharacters();
DifficultyManager.instance.ResetDifficulty();
gm.player1score = 0;
gm.player2score = 0;
gm.vsBotScore = 0;
gm.moveMade = false;
}
public void exit() { }

View File

@ -158,27 +158,24 @@ public class PositioningState : IState
else
canMove = false;
//pdeb
bool playerButtonPressed = In.GetButtonDown(ButtonPinMapping.startOnePlayer) || In.GetButtonDown(ButtonPinMapping.startTwoPlayers);
if (action || playerButtonPressed)
if (action)
{
if (canMove && GameManager.fieldModel.getHeight(gm.currentColumnIndex) != -1)
{
float delayBeforeStartFalling = 0;
if (gm.gameMode == GameMode.pve)
{
gm.vsBotMoves += 1;
gm.stateMachine.ChangeState(new ChipFallingState(startDelay: 0));
}
if (gm.gameMode == GameMode.pvp && action)
if (gm.gameMode == GameMode.pvp)
{
AvatarEventBus.Instance.OnTurnEnd?.Invoke(gm.currentPlayer);
float delay = DualAvatarController.Instance.CurrentAvatar.ChipSpawnTime;
gm.stateMachine.ChangeState(new ChipFallingState(startDelay: delay));
//добавить ожидание пока анимация завершится. чтобы еще не сломать ниче
delayBeforeStartFalling = DualAvatarController.Instance.CurrentAvatar.ChipSpawnTime;
}
gm.moveMade = true;
gm.stateMachine.ChangeState(new ChipFallingState(startDelay: delayBeforeStartFalling));
}
else
{
@ -186,6 +183,12 @@ public class PositioningState : IState
}
}
bool exitPressed = In.GetButtonDown(ButtonPinMapping.startOnePlayer) || In.GetButtonDown(ButtonPinMapping.startTwoPlayers);
if (exitPressed && !gm.moveMade)
{
gm.stateMachine.ChangeState(new ClearFieldState(toMenu: true, CellState.Player1));
ComWrapper.ReturnCredits(gm.gameMode);
}
}

View File

@ -36,16 +36,7 @@ public class StartRoundState : IState
}
gm.stateMachine.ChangeState(new StartTurnState());
//try
//{
//}
//catch(Exception e)
//{
// DebugWindow.Message(e.ToString());
//}
}
catch (Exception e)
{

View File

@ -394,6 +394,8 @@ public class GameManager : MonoBehaviour
public float stepY = 1.24f;
public float startY;
public bool moveMade = false;
public float chipXSpeed = 10,
chipYSpeed = 0,

View File

@ -83,6 +83,16 @@ public class ComWrapper : MonoBehaviour
onCoinAdded?.Invoke(Balance);
}
public static void ReturnCredits(GameMode gameMode)
{
string gamemodePriceKey = gameMode == GameMode.pvp ? "PricePVP" : "PricePVE";
int gamemodePrice = PlayerPrefs.GetInt(gamemodePriceKey, 10);
Balance += gamemodePrice;
onCoinAdded?.Invoke(Balance);
}
public static void Send(string message)
{
try

View File

@ -30,14 +30,19 @@ public class RGB_FOntAsset : MonoBehaviour
}
private void Update()
{
// Изменяем оттенок (hue) от 0 до 1
hue += Time.deltaTime * speed;
hue %= 1f; // Ограничиваем от 0 до 1
if (material != null)
{
// Изменяем оттенок (hue) от 0 до 1
hue += Time.deltaTime * speed;
hue %= 1f; // Ограничиваем от 0 до 1
// Преобразуем HSV в RGB
Color color = Color.HSVToRGB(hue, 1f, 1f);
// Преобразуем HSV в RGB
Color color = Color.HSVToRGB(hue, 1f, 1f);
material.SetColor(ShaderUtilities.ID_GlowColor, color);
}
material.SetColor(ShaderUtilities.ID_GlowColor, color);
float t = Time.time * scaleSpeed;
float s = mid + half * Mathf.Sin(t);