added more utilty packges

This commit is contained in:
Sebastian Bularca
2026-03-29 18:59:24 +02:00
parent ee97b2fec3
commit 71b432e253
131 changed files with 7674 additions and 54 deletions

View File

@@ -1,11 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Jovian.Utilities;
namespace Nox.Game {
public interface IModfiersFactory {
IReadOnlyCollection<ModifierDefinition> GetAll();
ModifierDefinition GetById(ModifierIds modifierId);
ModifierDefinition GetById(Guid modifierId);
IReadOnlyCollection<ModifierDefinition> GetModifiersFor(CharacterDefinition character);
bool TryAddModifier(CharacterDefinition character, string modiferId);
}
@@ -20,7 +21,6 @@ namespace Nox.Game {
[Serializable]
public sealed class ModifierDefinition {
[ReadOnlyField]
public System.Guid id = Guid.NewGuid();
public StatType statType;
public AttributeType attributeType;
@@ -44,7 +44,7 @@ namespace Nox.Game {
public IReadOnlyCollection<ModifierDefinition> GetAll() {
return modifiersRegistry.modifiersData.modifiers;
}
public ModifierDefinition GetById(ModifierIds modifierId) {
public ModifierDefinition GetById(Guid modifierId) {
return modifiersRegistry.modifiersData.modifiers.FirstOrDefault(m => m.id == modifierId);
}
public IReadOnlyCollection<ModifierDefinition> GetModifiersFor(CharacterDefinition character) {

View File

@@ -6,14 +6,14 @@ namespace Nox.Game {
public interface IPerkFactory {
IReadOnlyCollection<PerkDefinition> GetAll();
PerkDefinition GetById(PerksIds perkId);
PerkDefinition GetById(Guid perkId);
IReadOnlyCollection<PerkDefinition> GetPerksFor(CharacterDefinition character);
bool TryAddPerk(CharacterDefinition character, PerksIds perkId);
bool TryAddPerk(CharacterDefinition character, Guid perkId);
}
[Serializable]
public sealed class PerkDefinition {
public PerksIds id;
public Guid id;
public string name;
public ModifiersData modifiers = new ();
}
@@ -24,7 +24,7 @@ namespace Nox.Game {
}
public sealed class PerkFactory : IPerkFactory {
private readonly Dictionary<PerksIds, PerkDefinition> perkPool = new ();
private readonly Dictionary<Guid, PerkDefinition> perkPool = new ();
public PerkFactory(PerksRegistry perksRegistry) {
if(!perksRegistry) {
@@ -40,7 +40,7 @@ namespace Nox.Game {
return perkPool.Values.ToList();
}
public PerkDefinition GetById(PerksIds perkId) {
public PerkDefinition GetById(Guid perkId) {
perkPool.TryGetValue(perkId, out var perk);
return perk;
}
@@ -57,7 +57,7 @@ namespace Nox.Game {
return perkPool.Values.Where(p => !ownedPerkIds.Contains(p.id)).ToList();
}
public bool TryAddPerk(CharacterDefinition character, PerksIds perkId) {
public bool TryAddPerk(CharacterDefinition character, Guid perkId) {
if(character == null) {
return false;
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 40aa0aa493d1bb745a531cdb360e7e62
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,23 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 67fe3f48aa2b3b349a7b99381bebb12d, type: 3}
m_Name: logger-settings
m_EditorClassIdentifier: Jovian.Logger::Jovian.Logger.LoggerSettings
enableGlobalLogging: 1
globalFilters: []
loggerColors:
infoColor: {r: 1, g: 1, b: 1, a: 1}
warningColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
errorColor: {r: 1, g: 0, b: 0, a: 1}
assertColor: {r: 1, g: 0.3, b: 0.2, a: 1}
exceptionColor: {r: 1, g: 0, b: 0.7, a: 1}
spamColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 97634890f80d79941abb209746593eef
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant: