Esempio n. 1
0
 static void Initialize()
 {
     new GameObject("Manager", typeof(Toolbox));
     LuaManager.Start();
     LuaData.Start();
     EventManager.OnApplicationQuit += LuaManager.OnApplicationQuit;
 }
 public static object LuaToObject(object source)
 {
     if (source is LuaData)
     {
         LuaData data = (LuaData)source;
         return(data.LuaToObject());
     }
     return(source);
 }
Esempio n. 3
0
    private void SetLuaTable <TKey>(LuaTable luaTable, TKey fieldName, LuaData luaData, LuaInjection luaInjection)
    {
        switch (luaInjection)
        {
        case LuaInjection.AnimationCurve:
            luaTable.Set(fieldName, luaData.animationCurve);
            break;

        case LuaInjection.Component:
            luaTable.Set(fieldName, luaData.unityObject);
            break;

        default:
            luaTable.Set(fieldName, luaData.unityObject);
            break;
        }
    }
Esempio n. 4
0
    public void OnAfterDeserialize()
    {
        luaDatas = null;
        var luaInjection = Injection;

        if (string.IsNullOrEmpty(luaInjection))
        {
            return;
        }
        var selected = Enum.Parse(typeof(LuaInjection), luaInjection);

        switch (selected)
        {
        case LuaInjection.AnimationCurve:
            if (animationCurveValues != null)
            {
                luaDatas = new LuaData[animationCurveValues.Length];
                for (int i = 0; i < animationCurveValues.Length; i++)
                {
                    luaDatas[i] = new LuaData();
                    luaDatas[i].animationCurve = animationCurveValues[i];
                }
            }
            break;

        default:
            if (unityObjectValues != null)
            {
                luaDatas = new LuaData[unityObjectValues.Length];
                for (int i = 0; i < unityObjectValues.Length; i++)
                {
                    luaDatas[i]             = new LuaData();
                    luaDatas[i].unityObject = unityObjectValues[i];
                }
            }

            break;
        }
    }