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