MauryDev.KoGaMa.AvatarAPI 1.0.1

dotnet add package MauryDev.KoGaMa.AvatarAPI --version 1.0.1
                    
NuGet\Install-Package MauryDev.KoGaMa.AvatarAPI -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MauryDev.KoGaMa.AvatarAPI" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MauryDev.KoGaMa.AvatarAPI" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MauryDev.KoGaMa.AvatarAPI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MauryDev.KoGaMa.AvatarAPI --version 1.0.1
                    
#r "nuget: MauryDev.KoGaMa.AvatarAPI, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MauryDev.KoGaMa.AvatarAPI@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MauryDev.KoGaMa.AvatarAPI&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=MauryDev.KoGaMa.AvatarAPI&version=1.0.1
                    
Install as a Cake Tool

📦 MauryDev.KoGaMa.AvatarAPI

MauryDev.KoGaMa.AvatarAPI is a specialized library designed for managing, manipulating, and persisting avatar data for the KoGaMa ecosystem. It provides the necessary data structures and logic to handle avatar compositions, equipment mapping, bone positioning, and spatial constraint validation.

🚀 Overview

The library acts as the data logic layer between the technical definition of an avatar (where parts are located and their size limits) and the actual instance of an avatar equipped by a user.

The core workflow is based on three pillars:

  1. Registry: Static definitions of "where" and "how" each body part must exist.
  2. Info: The current state of an avatar (which models are equipped in which slots).
  3. Serialization: The ability to save and load this state via a Stream.

🛠️ Detailed Architecture

1. PartIndex (Enumeration)

Defines the available slots for equipment. This is the primary key for any operation involving avatar parts.

  • Members: Head, Torso, RArm, LArm, RUpLeg, RLowLeg, LUpLeg, LLowLeg, Holster, Size.

2. AvatarPartRegistry (Static Registry)

The "Source of Truth" for the library. This static class contains immutable definitions for every part of the body.

  • Function: Maps each PartIndex to a PartDefinition.
  • Utility: Allows the system to determine, for example, that the Head slot has a specific bone position and bounding box constraints for model construction.

3. PartDefinition (Data Model)

Contains the technical constraints and metadata for each avatar slot:

  • Name: Human-readable name of the part.
  • BonePosition: The Vector3 offset where the model should be anchored.
  • MinCubes: The minimum number of cubes required for the part to be valid.
  • BoxMin / BoxMax: Vectors defining the allowed area for the part's construction (Bounding Box).

4. AvatarInfo (Core Logic)

The main class representing an individual avatar. It manages a dictionary of ModelInfo objects indexed by PartIndex.

Key Capabilities:

  • Equipment Management: Methods to Equip(index, model) and Unequip(index) parts.
  • Fast Access: Implements an indexer, allowing direct access via avatarInfo[PartIndex.Head].
  • Validation: The IsFullyEquipped() method checks if essential parts (Head and Torso) are present.
  • Integration: Provides shortcuts like GetBonePosition(index) which internally query the AvatarPartRegistry.

5. ISerializer (Interface)

Defines the contract for any data persistence implementation. Since the library remains agnostic to the storage format (JSON, XML, Binary), you can implement your own serializer by adhering to this interface.


💻 Usage Examples

Creating and Equipping an Avatar

using MauryDev.KoGaMa.AvatarAPI;
using MauryDev.KoGaMa.AvatarAPI.Enums;
using MauryDev.KoGaMa.ModelAPI.Model; // Source of ModelInfo

// 1. Instantiate avatar information
AvatarInfo myAvatar = new AvatarInfo();

// 2. Define model information (hypothetical)
ModelInfo headModel = new ModelInfo { /* model data */ };
ModelInfo torsoModel = new ModelInfo { /* model data */ };

// 3. Equip parts to slots
myAvatar.Equip(PartIndex.Head, headModel);
myAvatar.Equip(PartIndex.Torso, torsoModel);

// 4. Check if the avatar is ready for instantiation/rendering
if (myAvatar.IsFullyEquipped()) 
{
    Console.WriteLine("Basic avatar configured successfully!");
}

Querying Technical Definitions

// Get the bone position for the Right Upper Leg
Vector3 bonePos = myAvatar.GetBonePosition(PartIndex.RUpLeg);

// Get the full definition to validate construction limits
var definition = myAvatar.GetDefinition(PartIndex.Head);
Console.WriteLine($"Head requires at least {definition.MinCubes} cubes.");
Console.WriteLine($"Head Bounding Box Max: {definition.BoxMax}");

Implementing a Custom Serializer

public class JsonAvatarSerializer : ISerializer
{
    public void Serialize(Stream stream, AvatarInfo avatar)
    {
        // Logic to convert AvatarInfo to JSON and write to the stream
    }

    public AvatarInfo Deserialize(Stream stream)
    {
        // Logic to read JSON from the stream and reconstruct AvatarInfo
        return new AvatarInfo(); 
    }
}

⚙️ Technical Specifications

  • Target Framework: .NET Standard 2.0 (Ensures compatibility with .NET Core, .NET Framework, and Unity).
  • C# Version: 7.3.
  • Dependencies:
    • MauryDev.KoGaMa.ModelAPI: For the ModelInfo class definition.
    • System.Numerics.Vectors: Used for positional and dimensional calculations (Vector3).

📂 Namespace Structure

  • MauryDev.KoGaMa.AvatarAPI: Core classes and business logic.
  • MauryDev.KoGaMa.AvatarAPI.Enums: Type definitions and enumerations.
  • MauryDev.KoGaMa.AvatarAPI.Models: Data models and part definitions.

Author: Maury

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MauryDev.KoGaMa.AvatarAPI:

Package Downloads
MauryDev.KoGaMa.AvatarAPI.KoGaMaTools

avatar api kogama kogama-tools

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 48 6/19/2026
1.0.0 43 6/17/2026