[Fix] Conflicts
This commit is contained in:
@@ -6,11 +6,11 @@ namespace YachtDice.Dice
|
||||
[CreateAssetMenu(fileName = "DiceCatalog", menuName = "YachtDice/Dice/Catalog")]
|
||||
public class DiceCatalog : ScriptableObject
|
||||
{
|
||||
[SerializeField] private List<DiceDefinitionSO> dice = new();
|
||||
[SerializeField] private List<DiceDefinition> dice = new();
|
||||
|
||||
public IReadOnlyList<DiceDefinitionSO> All => dice;
|
||||
public IReadOnlyList<DiceDefinition> All => dice;
|
||||
|
||||
public DiceDefinitionSO FindById(string id)
|
||||
public DiceDefinition FindById(string id)
|
||||
{
|
||||
for (int i = 0; i < dice.Count; i++)
|
||||
{
|
||||
@@ -21,10 +21,10 @@ namespace YachtDice.Dice
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static DiceCatalog CreateForTest(List<DiceDefinitionSO> defs)
|
||||
public static DiceCatalog CreateForTest(List<DiceDefinition> defs)
|
||||
{
|
||||
var catalog = CreateInstance<DiceCatalog>();
|
||||
catalog.dice = defs ?? new List<DiceDefinitionSO>();
|
||||
catalog.dice = defs ?? new List<DiceDefinition>();
|
||||
return catalog;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7,11 +7,7 @@ namespace YachtDice.Dice
|
||||
/// Абстрактное определение типа дайса.
|
||||
/// Наследники описывают конкретные виды (стандартный d6, специальные и т.д.).
|
||||
/// </summary>
|
||||
<<<<<<<< HEAD:Assets/Scripts/Dice/DiсeDefinition.cs
|
||||
public abstract class DiсeDefinition : ScriptableObject, IShopItem
|
||||
========
|
||||
public abstract class DiceDefinitionSO : ScriptableObject, IShopItem
|
||||
>>>>>>>> claude/vibrant-tereshkova:Assets/Scripts/Dice/DiceDefinitionSO.cs
|
||||
public abstract class DiceDefinition : ScriptableObject, IShopItem
|
||||
{
|
||||
[field: Header("Identity")]
|
||||
[field: SerializeField] public string Id { get; private set; }
|
||||
@@ -32,11 +28,7 @@ namespace YachtDice.Dice
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static T CreateForTest<T>(string id, string displayName = null,
|
||||
<<<<<<<< HEAD:Assets/Scripts/Dice/DiсeDefinition.cs
|
||||
int shopPrice = 0, string description = null) where T : DiсeDefinition
|
||||
========
|
||||
int shopPrice = 0, string description = null) where T : DiceDefinitionSO
|
||||
>>>>>>>> claude/vibrant-tereshkova:Assets/Scripts/Dice/DiceDefinitionSO.cs
|
||||
int shopPrice = 0, string description = null) where T : DiceDefinition
|
||||
{
|
||||
var so = CreateInstance<T>();
|
||||
so.Id = id;
|
||||
@@ -6,18 +6,18 @@ namespace YachtDice.Dice
|
||||
/// </summary>
|
||||
public class DiceInstance : IDice
|
||||
{
|
||||
public DiceDefinitionSO Definition { get; }
|
||||
public DiceDefinition Definition { get; }
|
||||
public int Value { get; set; }
|
||||
public bool IsLocked { get; set; }
|
||||
|
||||
public DiceInstance(DiceDefinitionSO definition)
|
||||
public DiceInstance(DiceDefinition definition)
|
||||
{
|
||||
Definition = definition;
|
||||
Value = 0;
|
||||
IsLocked = false;
|
||||
}
|
||||
|
||||
public DiceInstance(DiceDefinitionSO definition, int initialValue)
|
||||
public DiceInstance(DiceDefinition definition, int initialValue)
|
||||
{
|
||||
Definition = definition;
|
||||
Value = initialValue;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace YachtDice.Dice
|
||||
[SerializeField] private Rigidbody rb;
|
||||
|
||||
/// <summary>Определение типа дайса (назначается в инспекторе).</summary>
|
||||
[field: SerializeField] public DiceDefinitionSO Definition { get; private set; }
|
||||
[field: SerializeField] public DiceDefinition Definition { get; private set; }
|
||||
|
||||
[Header("Throw Settings")]
|
||||
[Tooltip("Сила подброса вверх")]
|
||||
|
||||
@@ -10,6 +10,6 @@ namespace YachtDice.Dice
|
||||
int Value { get; }
|
||||
|
||||
/// <summary>Определение типа дайса (ScriptableObject).</summary>
|
||||
DiceDefinitionSO Definition { get; }
|
||||
DiceDefinition Definition { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,7 @@ namespace YachtDice.Dice
|
||||
/// По умолчанию — классический d6 (1-6).
|
||||
/// </summary>
|
||||
[CreateAssetMenu(fileName = "StandardDice", menuName = "YachtDice/Dice/Standard Dice")]
|
||||
<<<<<<<< HEAD:Assets/Scripts/Dice/StandardDiсe.cs
|
||||
public class StandardDiсe : DiсeDefinition
|
||||
========
|
||||
public class StandardDiceSO : DiceDefinitionSO
|
||||
>>>>>>>> claude/vibrant-tereshkova:Assets/Scripts/Dice/StandardDiceSO.cs
|
||||
public class StandardDice : DiceDefinition
|
||||
{
|
||||
[Header("Configuration")]
|
||||
[SerializeField] private int[] faceValues = { 1, 2, 3, 4, 5, 6 };
|
||||
@@ -26,15 +22,9 @@ namespace YachtDice.Dice
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
<<<<<<<< HEAD:Assets/Scripts/Dice/StandardDiсe.cs
|
||||
public static StandardDiсe CreateStandardD6ForTest()
|
||||
public static StandardDice CreateStandardD6ForTest()
|
||||
{
|
||||
var so = CreateForTest<StandardDiсe>("standard_d6", "Стандартный d6");
|
||||
========
|
||||
public static StandardDiceSO CreateStandardD6ForTest()
|
||||
{
|
||||
var so = CreateForTest<StandardDiceSO>("standard_d6", "Стандартный d6");
|
||||
>>>>>>>> claude/vibrant-tereshkova:Assets/Scripts/Dice/StandardDiceSO.cs
|
||||
var so = CreateForTest<StandardDice>("standard_d6", "Стандартный d6");
|
||||
so.faceValues = new[] { 1, 2, 3, 4, 5, 6 };
|
||||
return so;
|
||||
}
|
||||
@@ -6,13 +6,13 @@ namespace YachtDice.Player
|
||||
{
|
||||
public class DiceCollection
|
||||
{
|
||||
private readonly List<DiceDefinitionSO> ownedDice = new();
|
||||
private readonly List<DiceDefinition> ownedDice = new();
|
||||
|
||||
public event Action OnChanged;
|
||||
|
||||
public IReadOnlyList<DiceDefinitionSO> OwnedDice => ownedDice;
|
||||
public IReadOnlyList<DiceDefinition> OwnedDice => ownedDice;
|
||||
|
||||
public void Add(DiceDefinitionSO definition)
|
||||
public void Add(DiceDefinition definition)
|
||||
{
|
||||
if (definition == null) return;
|
||||
if (OwnsById(definition.Id)) return;
|
||||
@@ -21,7 +21,7 @@ namespace YachtDice.Player
|
||||
OnChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void Remove(DiceDefinitionSO definition)
|
||||
public void Remove(DiceDefinition definition)
|
||||
{
|
||||
if (ownedDice.Remove(definition))
|
||||
OnChanged?.Invoke();
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace YachtDice.Shop
|
||||
case ModifierDefinition modifier:
|
||||
inventoryModel.AddModifier(modifier);
|
||||
break;
|
||||
case DiceDefinitionSO dice:
|
||||
case DiceDefinition dice:
|
||||
diceCollection.Add(dice);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void Add_IncreasesCount()
|
||||
{
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
var die = StandardDice.CreateStandardD6ForTest();
|
||||
|
||||
collection.Add(die);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void Add_DuplicateId_Ignored()
|
||||
{
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
var die = StandardDice.CreateStandardD6ForTest();
|
||||
|
||||
collection.Add(die);
|
||||
collection.Add(die);
|
||||
@@ -47,7 +47,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void OwnsById_ReturnsTrueWhenOwned()
|
||||
{
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
var die = StandardDice.CreateStandardD6ForTest();
|
||||
|
||||
collection.Add(die);
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void Remove_DecreasesCount()
|
||||
{
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
var die = StandardDice.CreateStandardD6ForTest();
|
||||
|
||||
collection.Add(die);
|
||||
collection.Remove(die);
|
||||
@@ -74,7 +74,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void GetSaveData_ReturnsIds()
|
||||
{
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
var die = StandardDice.CreateStandardD6ForTest();
|
||||
|
||||
collection.Add(die);
|
||||
|
||||
@@ -86,8 +86,8 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void LoadSaveData_RestoresDice()
|
||||
{
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
var catalog = DiceCatalog.CreateForTest(new List<DiceDefinitionSO> { die });
|
||||
var die = StandardDice.CreateStandardD6ForTest();
|
||||
var catalog = DiceCatalog.CreateForTest(new List<DiceDefinition> { die });
|
||||
var ids = new List<string> { "standard_d6" };
|
||||
|
||||
collection.LoadSaveData(ids, catalog);
|
||||
@@ -99,7 +99,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void LoadSaveData_SkipsMissingIds()
|
||||
{
|
||||
var catalog = DiceCatalog.CreateForTest(new List<DiceDefinitionSO>());
|
||||
var catalog = DiceCatalog.CreateForTest(new List<DiceDefinition>());
|
||||
var ids = new List<string> { "nonexistent" };
|
||||
|
||||
collection.LoadSaveData(ids, catalog);
|
||||
@@ -110,7 +110,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void Clear_RemovesAll()
|
||||
{
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
var die = StandardDice.CreateStandardD6ForTest();
|
||||
|
||||
collection.Add(die);
|
||||
collection.Clear();
|
||||
@@ -124,7 +124,7 @@ namespace YachtDice.Tests
|
||||
bool fired = false;
|
||||
collection.OnChanged += () => fired = true;
|
||||
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
var die = StandardDice.CreateStandardD6ForTest();
|
||||
collection.Add(die);
|
||||
|
||||
Assert.IsTrue(fired);
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace YachtDice.Tests
|
||||
private CategoryDefinition twosCategory;
|
||||
private CategoryDefinition chanceCategory;
|
||||
private CategoryCatalog catalog;
|
||||
private DiceDefinitionSO standardDice;
|
||||
private DiceDefinition standardDice;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
standardDice = DiceDefinitionSO.CreateForTest<StandardDiceSO>("d6", "d6");
|
||||
standardDice = DiceDefinition.CreateForTest<StandardDice>("d6", "d6");
|
||||
|
||||
yachtCategory = NOfAKindCategory.CreateForTest("yacht", "Яхта", 5, fixedScoreMode: true, score: 50);
|
||||
onesCategory = SumOfValueCategory.CreateForTest("ones", "Единицы", 1);
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void TryPurchase_DiceItem_AddsToDiceCollection()
|
||||
{
|
||||
var die = DiceDefinitionSO.CreateForTest<StandardDiceSO>("test_die", shopPrice: 100);
|
||||
var die = DiceDefinition.CreateForTest<StandardDice>("test_die", shopPrice: 100);
|
||||
|
||||
bool result = shop.TryPurchase(die);
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void TryPurchase_DiceItem_CannotBeBoughtTwice()
|
||||
{
|
||||
var die = DiceDefinitionSO.CreateForTest<StandardDiceSO>("unique_die", shopPrice: 100);
|
||||
var die = DiceDefinition.CreateForTest<StandardDice>("unique_die", shopPrice: 100);
|
||||
|
||||
shop.TryPurchase(die);
|
||||
bool secondResult = shop.TryPurchase(die);
|
||||
@@ -167,7 +167,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void GetItemState_Dice_Owned_AfterPurchase()
|
||||
{
|
||||
var die = DiceDefinitionSO.CreateForTest<StandardDiceSO>("die1", shopPrice: 50);
|
||||
var die = DiceDefinition.CreateForTest<StandardDice>("die1", shopPrice: 50);
|
||||
|
||||
shop.TryPurchase(die);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user