[Fix] Code visual

This commit is contained in:
2026-02-28 19:25:26 +07:00
parent bee20fd1f8
commit e24b30743b
39 changed files with 2611 additions and 2687 deletions
+1 -2
View File
@@ -4,8 +4,7 @@ using UnityEngine;
namespace YachtDice.Dice namespace YachtDice.Dice
{ {
public class Dice : MonoBehaviour
public sealed class Dice : MonoBehaviour
{ {
[Serializable] [Serializable]
public struct Entry : IEquatable<Entry> public struct Entry : IEquatable<Entry>
+1 -2
View File
@@ -5,12 +5,11 @@ using Random = UnityEngine.Random;
namespace YachtDice.Dice namespace YachtDice.Dice
{ {
/// <summary> /// <summary>
/// Красиво подбрасывает и раскручивает кубик, ждёт пока он остановится, /// Красиво подбрасывает и раскручивает кубик, ждёт пока он остановится,
/// плавно доворачивает до ровного положения и сообщает результат. /// плавно доворачивает до ровного положения и сообщает результат.
/// </summary> /// </summary>
public sealed class DiceRoller : MonoBehaviour public class DiceRoller : MonoBehaviour
{ {
[Header("References")] [Header("References")]
[SerializeField] private Dice dice; [SerializeField] private Dice dice;
+1 -2
View File
@@ -3,8 +3,7 @@ using UnityEngine;
namespace YachtDice.Economy namespace YachtDice.Economy
{ {
public class CurrencyBank : MonoBehaviour
public sealed class CurrencyBank : MonoBehaviour
{ {
[SerializeField] private int startingBalance = 500; [SerializeField] private int startingBalance = 500;
-39
View File
@@ -1,39 +0,0 @@
using UnityEngine;
using YachtDice.Scoring;
namespace YachtDice.Game
{
public sealed class DebugGameInput : MonoBehaviour
{
[SerializeField] private GameManager gameManager;
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
gameManager.Roll();
// 1-5: toggle lock on dice 0-4
if (Input.GetKeyDown(KeyCode.Alpha1)) gameManager.ToggleDiceLock(0);
if (Input.GetKeyDown(KeyCode.Alpha2)) gameManager.ToggleDiceLock(1);
if (Input.GetKeyDown(KeyCode.Alpha3)) gameManager.ToggleDiceLock(2);
if (Input.GetKeyDown(KeyCode.Alpha4)) gameManager.ToggleDiceLock(3);
if (Input.GetKeyDown(KeyCode.Alpha5)) gameManager.ToggleDiceLock(4);
// Score categories
if (Input.GetKeyDown(KeyCode.F1)) gameManager.ScoreInCategory(YachtCategory.Ones);
if (Input.GetKeyDown(KeyCode.F2)) gameManager.ScoreInCategory(YachtCategory.Twos);
if (Input.GetKeyDown(KeyCode.F3)) gameManager.ScoreInCategory(YachtCategory.Threes);
if (Input.GetKeyDown(KeyCode.F4)) gameManager.ScoreInCategory(YachtCategory.Fours);
if (Input.GetKeyDown(KeyCode.F5)) gameManager.ScoreInCategory(YachtCategory.Fives);
if (Input.GetKeyDown(KeyCode.F6)) gameManager.ScoreInCategory(YachtCategory.Sixes);
if (Input.GetKeyDown(KeyCode.F7)) gameManager.ScoreInCategory(YachtCategory.ThreeOfAKind);
if (Input.GetKeyDown(KeyCode.F8)) gameManager.ScoreInCategory(YachtCategory.FourOfAKind);
if (Input.GetKeyDown(KeyCode.F9)) gameManager.ScoreInCategory(YachtCategory.FullHouse);
if (Input.GetKeyDown(KeyCode.F10)) gameManager.ScoreInCategory(YachtCategory.SmallStraight);
if (Input.GetKeyDown(KeyCode.F11)) gameManager.ScoreInCategory(YachtCategory.LargeStraight);
if (Input.GetKeyDown(KeyCode.F12)) gameManager.ScoreInCategory(YachtCategory.Yacht);
if (Input.GetKeyDown(KeyCode.C)) gameManager.ScoreInCategory(YachtCategory.Chance);
}
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 982f0996b85edfe419b07ddb36d6e235
+2 -3
View File
@@ -5,8 +5,7 @@ using YachtDice.Dice;
namespace YachtDice.Game namespace YachtDice.Game
{ {
public class DiceManager : MonoBehaviour
public sealed class DiceManager : MonoBehaviour
{ {
[SerializeField] private List<DiceRoller> diceRollers = new(); [SerializeField] private List<DiceRoller> diceRollers = new();
@@ -99,7 +98,7 @@ public sealed class DiceManager : MonoBehaviour
{ {
for (int i = 0; i < diceRollers.Count; i++) for (int i = 0; i < diceRollers.Count; i++)
{ {
var diceComponent = diceRollers[i].GetComponent<Dice>(); var diceComponent = diceRollers[i].GetComponent<Dice.Dice>();
if (diceComponent != null && diceComponent.TryGetTopValue(out int val)) if (diceComponent != null && diceComponent.TryGetTopValue(out int val))
currentValues[i] = val; currentValues[i] = val;
} }
+1 -2
View File
@@ -4,8 +4,7 @@ using YachtDice.Scoring;
namespace YachtDice.Game namespace YachtDice.Game
{ {
public class GameManager : MonoBehaviour
public sealed class GameManager : MonoBehaviour
{ {
[Header("References")] [Header("References")]
[SerializeField] private DiceManager diceManager; [SerializeField] private DiceManager diceManager;
@@ -5,8 +5,7 @@ using YachtDice.Scoring;
namespace YachtDice.Inventory namespace YachtDice.Inventory
{ {
public class InventoryController : MonoBehaviour
public sealed class InventoryController : MonoBehaviour
{ {
[SerializeField] private InventoryView inventoryView; [SerializeField] private InventoryView inventoryView;
[SerializeField] private ScoringSystem scoringSystem; [SerializeField] private ScoringSystem scoringSystem;
+1 -2
View File
@@ -4,8 +4,7 @@ using YachtDice.Modifiers;
namespace YachtDice.Inventory namespace YachtDice.Inventory
{ {
public class InventoryModel
public sealed class InventoryModel
{ {
private readonly List<ModifierRuntime> ownedModifiers = new(); private readonly List<ModifierRuntime> ownedModifiers = new();
private int maxActiveSlots; private int maxActiveSlots;
@@ -6,8 +6,7 @@ using YachtDice.Modifiers;
namespace YachtDice.Inventory namespace YachtDice.Inventory
{ {
public class InventorySlotView : MonoBehaviour
public sealed class InventorySlotView : MonoBehaviour
{ {
[SerializeField] private Image iconImage; [SerializeField] private Image iconImage;
[SerializeField] private TMP_Text nameText; [SerializeField] private TMP_Text nameText;
+1 -2
View File
@@ -7,8 +7,7 @@ using YachtDice.Modifiers;
namespace YachtDice.Inventory namespace YachtDice.Inventory
{ {
public class InventoryView : MonoBehaviour
public sealed class InventoryView : MonoBehaviour
{ {
[SerializeField] private Transform slotContainer; [SerializeField] private Transform slotContainer;
[SerializeField] private InventorySlotView slotPrefab; [SerializeField] private InventorySlotView slotPrefab;
-1
View File
@@ -3,7 +3,6 @@ using YachtDice.Scoring;
namespace YachtDice.Modifiers namespace YachtDice.Modifiers
{ {
[CreateAssetMenu(fileName = "NewModifier", menuName = "YachtDice/Modifier Data")] [CreateAssetMenu(fileName = "NewModifier", menuName = "YachtDice/Modifier Data")]
public sealed class ModifierData : ScriptableObject public sealed class ModifierData : ScriptableObject
{ {
@@ -3,7 +3,6 @@ using YachtDice.Scoring;
namespace YachtDice.Modifiers namespace YachtDice.Modifiers
{ {
public delegate void ModifierHandler(ModifierData data, ref ScoreResult result); public delegate void ModifierHandler(ModifierData data, ref ScoreResult result);
public static class ModifierEffect public static class ModifierEffect
@@ -3,7 +3,6 @@ using YachtDice.Scoring;
namespace YachtDice.Modifiers namespace YachtDice.Modifiers
{ {
public static class ModifierPipeline public static class ModifierPipeline
{ {
// Application order (explicit): // Application order (explicit):
+1 -2
View File
@@ -2,9 +2,8 @@ using System;
namespace YachtDice.Modifiers namespace YachtDice.Modifiers
{ {
[Serializable] [Serializable]
public sealed class ModifierRuntime public class ModifierRuntime
{ {
public string ModifierId; public string ModifierId;
public bool IsActive; public bool IsActive;
@@ -4,7 +4,6 @@ using YachtDice.Scoring;
namespace YachtDice.Modifiers namespace YachtDice.Modifiers
{ {
[Serializable] [Serializable]
public struct ModifierTarget public struct ModifierTarget
{ {
-1
View File
@@ -3,7 +3,6 @@ using System.Collections.Generic;
namespace YachtDice.Persistence namespace YachtDice.Persistence
{ {
[Serializable] [Serializable]
public sealed class SaveData public sealed class SaveData
{ {
-1
View File
@@ -3,7 +3,6 @@ using UnityEngine;
namespace YachtDice.Persistence namespace YachtDice.Persistence
{ {
public static class SaveSystem public static class SaveSystem
{ {
private const string SaveKey = "YachtDice_SaveData"; private const string SaveKey = "YachtDice_SaveData";
-1
View File
@@ -2,7 +2,6 @@ using System;
namespace YachtDice.Scoring namespace YachtDice.Scoring
{ {
public static class CategoryScorer public static class CategoryScorer
{ {
public static int Calculate(int[] dice, YachtCategory category) public static int Calculate(int[] dice, YachtCategory category)
-1
View File
@@ -3,7 +3,6 @@ using UnityEngine;
namespace YachtDice.Scoring namespace YachtDice.Scoring
{ {
[Serializable] [Serializable]
public struct ScoreResult public struct ScoreResult
{ {
+1 -2
View File
@@ -5,8 +5,7 @@ using YachtDice.Modifiers;
namespace YachtDice.Scoring namespace YachtDice.Scoring
{ {
public class ScoringSystem : MonoBehaviour
public sealed class ScoringSystem : MonoBehaviour
{ {
public event Action<YachtCategory, int> OnCategoryScored; public event Action<YachtCategory, int> OnCategoryScored;
public event Action<int> OnAllCategoriesScored; public event Action<int> OnAllCategoriesScored;
-1
View File
@@ -4,7 +4,6 @@ using YachtDice.Modifiers;
namespace YachtDice.Shop namespace YachtDice.Shop
{ {
[CreateAssetMenu(fileName = "ShopCatalog", menuName = "YachtDice/Shop Catalog")] [CreateAssetMenu(fileName = "ShopCatalog", menuName = "YachtDice/Shop Catalog")]
public sealed class ShopCatalog : ScriptableObject public sealed class ShopCatalog : ScriptableObject
{ {
+1 -2
View File
@@ -4,8 +4,7 @@ using YachtDice.Modifiers;
namespace YachtDice.Shop namespace YachtDice.Shop
{ {
public class ShopController : MonoBehaviour
public sealed class ShopController : MonoBehaviour
{ {
[SerializeField] private ShopCatalog catalog; [SerializeField] private ShopCatalog catalog;
[SerializeField] private ShopView shopView; [SerializeField] private ShopView shopView;
+1 -2
View File
@@ -6,8 +6,7 @@ using YachtDice.Modifiers;
namespace YachtDice.Shop namespace YachtDice.Shop
{ {
public class ShopItemView : MonoBehaviour
public sealed class ShopItemView : MonoBehaviour
{ {
[SerializeField] private Image iconImage; [SerializeField] private Image iconImage;
[SerializeField] private TMP_Text nameText; [SerializeField] private TMP_Text nameText;
+1 -2
View File
@@ -6,8 +6,7 @@ using YachtDice.Modifiers;
namespace YachtDice.Shop namespace YachtDice.Shop
{ {
public class ShopModel
public sealed class ShopModel
{ {
private readonly CurrencyBank currencyBank; private readonly CurrencyBank currencyBank;
private readonly InventoryModel inventoryModel; private readonly InventoryModel inventoryModel;
+1 -2
View File
@@ -7,8 +7,7 @@ using YachtDice.Modifiers;
namespace YachtDice.Shop namespace YachtDice.Shop
{ {
public class ShopView : MonoBehaviour
public sealed class ShopView : MonoBehaviour
{ {
[SerializeField] private Transform itemContainer; [SerializeField] private Transform itemContainer;
[SerializeField] private ShopItemView itemPrefab; [SerializeField] private ShopItemView itemPrefab;
@@ -5,8 +5,7 @@ using YachtDice.Modifiers;
namespace YachtDice.Tests namespace YachtDice.Tests
{ {
public class InventoryModelTests
public sealed class InventoryModelTests
{ {
private InventoryModel inventory; private InventoryModel inventory;
@@ -5,8 +5,7 @@ using YachtDice.Scoring;
namespace YachtDice.Tests namespace YachtDice.Tests
{ {
public class ModifierEffectTests
public sealed class ModifierEffectTests
{ {
private static ModifierData CreateData( private static ModifierData CreateData(
ModifierEffectType effectType, float effectValue, ModifierEffectType effectType, float effectValue,
@@ -6,8 +6,7 @@ using YachtDice.Scoring;
namespace YachtDice.Tests namespace YachtDice.Tests
{ {
public class ModifierPipelineTests
public sealed class ModifierPipelineTests
{ {
[Test] [Test]
public void Apply_AdditiveBeforeMultiplicative() public void Apply_AdditiveBeforeMultiplicative()
@@ -5,8 +5,7 @@ using YachtDice.Persistence;
namespace YachtDice.Tests namespace YachtDice.Tests
{ {
public class SaveSystemTests
public sealed class SaveSystemTests
{ {
[SetUp] [SetUp]
public void SetUp() public void SetUp()
@@ -6,8 +6,7 @@ using YachtDice.Modifiers;
namespace YachtDice.Tests namespace YachtDice.Tests
{ {
public class ScoringSystemTests
public sealed class ScoringSystemTests
{ {
private ScoringSystem CreateScoringSystem() private ScoringSystem CreateScoringSystem()
{ {
@@ -7,7 +7,6 @@ using YachtDice.Modifiers;
namespace YachtDice.Tests namespace YachtDice.Tests
{ {
public sealed class ShopModelTests public sealed class ShopModelTests
{ {
private CurrencyBank bank; private CurrencyBank bank;
+1 -2
View File
@@ -6,8 +6,7 @@ using YachtDice.Scoring;
namespace YachtDice.UI namespace YachtDice.UI
{ {
public class CategoryRowView : MonoBehaviour
public sealed class CategoryRowView : MonoBehaviour
{ {
[Header("UI Elements")] [Header("UI Elements")]
[SerializeField] private TMP_Text categoryNameText; [SerializeField] private TMP_Text categoryNameText;
+1 -2
View File
@@ -5,8 +5,7 @@ using TMPro;
namespace YachtDice.UI namespace YachtDice.UI
{ {
public class DicePanelView : MonoBehaviour
public sealed class DicePanelView : MonoBehaviour
{ {
[Header("Dice Display")] [Header("Dice Display")]
[SerializeField] private Button[] diceButtons = new Button[5]; [SerializeField] private Button[] diceButtons = new Button[5];
+1 -2
View File
@@ -11,8 +11,7 @@ using YachtDice.Modifiers;
namespace YachtDice.UI namespace YachtDice.UI
{ {
public class GameController : MonoBehaviour
public sealed class GameController : MonoBehaviour
{ {
[Header("Model")] [Header("Model")]
[SerializeField] private GameManager gameManager; [SerializeField] private GameManager gameManager;
+1 -2
View File
@@ -5,8 +5,7 @@ using TMPro;
namespace YachtDice.UI namespace YachtDice.UI
{ {
public class GameInfoView : MonoBehaviour
public sealed class GameInfoView : MonoBehaviour
{ {
[Header("Turn Info")] [Header("Turn Info")]
[SerializeField] private TMP_Text turnText; [SerializeField] private TMP_Text turnText;
+1 -2
View File
@@ -6,8 +6,7 @@ using YachtDice.Scoring;
namespace YachtDice.UI namespace YachtDice.UI
{ {
public class ScoreCardView : MonoBehaviour
public sealed class ScoreCardView : MonoBehaviour
{ {
[Header("Category Rows (in YachtCategory enum order)")] [Header("Category Rows (in YachtCategory enum order)")]
[SerializeField] private List<CategoryRowView> categoryRows = new(); [SerializeField] private List<CategoryRowView> categoryRows = new();