
2018/3/9
Getting Started with Easy Save 3 - 絮酱翻译
絮酱翻译 - 英文原文:http://docs.moodkie.com/easy-save-3/getting-started/
1/3
Home (http://docs.moodkie.com) Easy Save 3 Getting Started
Getting Started 入门
从资源商店导入Easy Save后,您可以立即在脚本和PlayMaker中使用Easy Save插件。
有关PlayMaker可用操作的信息,请参阅 PlayMaker Actions Overview (http://docs.moodkie.com/easy-save-3/es3-playmaker/playmaker-actions-overview/).
Basic saving and loading 基础保存和加载
Easy Save插件 将数据存储为键(key)和值(value),非常像Dictionary(C#字典)。
To save a value, use ES3.Save<Type>("key",value)
To load a value, use ES3.Load<Type>("key")
例如,要将一个整数保存到名为
myInteger
的键中,并重新加载,您可以执行以下操作:
如果在加载前,您不确定某个键是否存在,则可以使用ES3.KeyExists 或指定ES3.Load方法的
defaultValue
参数。
要将值加载到现有的对象中,请使用ES3.LoadInto (http://docs.moodkie.com/easy-save-3/es3-api/es3-methods/es3-loadinto/)
// Save the integer 123 to a key named myInteger. 将整数123保存到名为myInteger的键 中。
ES3.Save<int>("myInteger", 123);
// Load the integer back again. 再次加载 整数。
int myInteger = ES3.Load<int>("myInteger");
// If the key "myKey" does not exist, this will throw an error. 如果键“myKey”不存在,则会引发错误。
myValue = ES3.Load<float>("myKey");
// This checks whether "myKey" exists before trying to load it. 这样就会在尝试加载它之前检查“myKey”是否存在。
if(ES3.KeyExists("myKey"))
myValue = ES3.Load<float>("myKey");
// If "myKey" doesn't exist, it returns our default value. 如果“myKey”不存在,它将返回Type(数据类型)的默认值。
myValue = ES3.Load<float>("myKey", 123f);
EasySave3插件 絮酱翻译
灰色文字为译者添加
评论2