42 lines
857 B
C#
42 lines
857 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using KitsuneCafe.Sys;
|
|
using MessagePack;
|
|
using UnityEngine;
|
|
|
|
namespace KitsuneCafe.SOAP
|
|
{
|
|
[MessagePackObject(AllowPrivate = true)]
|
|
[CreateAssetMenu(menuName = KitsuneCafeMenu.SoapCollection + "Blackboard")]
|
|
public partial class Blackboard : ScriptableObject
|
|
{
|
|
[Key(0)]
|
|
private Dictionary<string, object> variables = new();
|
|
|
|
public object Read(string key)
|
|
{
|
|
return variables[key];
|
|
}
|
|
|
|
public T Read<T>(string key)
|
|
{
|
|
return (T)variables[key];
|
|
}
|
|
|
|
public void Write(string key, object value)
|
|
{
|
|
variables[key] = value;
|
|
}
|
|
|
|
public List<KeyValuePair<string, object>> ToList()
|
|
{
|
|
return variables.ToList();
|
|
}
|
|
|
|
public void Load(Blackboard blackboard)
|
|
{
|
|
variables = blackboard.variables;
|
|
}
|
|
}
|
|
}
|