Files

48 lines
1.9 KiB
C#
Raw Permalink Normal View History

2026-03-16 21:38:49 +01:00
using UnityEngine;
namespace Guildlib.Runtime
{
/// <summary>
/// Project-level Guildlib configuration.
///
/// HOW TO CREATE:
/// Assets → Create → Guildlib → Config
/// Name it exactly "GuildlibConfig" and place it in any Resources/ folder.
///
/// HOW TO CONFIGURE:
/// - Server URL: your Bun server address (local or production)
/// - Project ID: any unique string identifying your game project
/// - API Key: must match GUILDLIB_API_KEY env var on the server
/// Leave blank during local development (server auth disabled)
/// - Shard list: comma-separated list of shards to sync, or leave empty
/// to sync ALL shards the server knows about
/// </summary>
[CreateAssetMenu(menuName = "Guildlib/Config", fileName = "GuildlibConfig")]
public class GuildlibConfig : ScriptableObject
{
[Header("Server connection")]
public string serverUrl = "http://localhost:3000";
public string projectId = "";
[Tooltip("Must match GUILDLIB_API_KEY on the server. Leave blank for local dev.")]
public string apiKey = "";
[Header("Local storage")]
[Tooltip("Folder name inside Application.persistentDataPath where .sqlite shards are saved.")]
public string shardFolder = "GuildlibShards";
[Header("Sync targets")]
[Tooltip("Leave empty to sync all shards. Or list specific shard names to limit syncing.")]
public string[] shardsToSync = new string[0];
/// <summary>
/// Returns the list of shards to sync. If empty, returns null
/// (meaning: ask the server for all available shards).
/// </summary>
public string[] GetSyncTargets() =>
shardsToSync != null && shardsToSync.Length > 0 ? shardsToSync : null;
public static GuildlibConfig Load() =>
Resources.Load<GuildlibConfig>("GuildlibConfig");
}
}