Beispiel #1
0
    static int set_OnColliderHit(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            DummyBehavior obj = (DummyBehavior)o;
            System.Action <UnityEngine.Collider> arg0 = null;
            LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (System.Action <UnityEngine.Collider>)ToLua.CheckObject(L, 2, typeof(System.Action <UnityEngine.Collider>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.Collider>), func) as System.Action <UnityEngine.Collider>;
            }

            obj.OnColliderHit = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index OnColliderHit on a nil value" : e.Message));
        }
    }
Beispiel #2
0
 static int OnNewObject(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         DummyBehavior obj = (DummyBehavior)ToLua.CheckObject(L, 1, typeof(DummyBehavior));
         obj.OnNewObject();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #3
0
 static int GetCollider(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         DummyBehavior          obj = (DummyBehavior)ToLua.CheckObject(L, 1, typeof(DummyBehavior));
         UnityEngine.RaycastHit o   = obj.GetCollider();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #4
0
    public DummyBehavior CreateDummy(uint sceneid, string uid, int entityType, GameObject go)
    {
        DummyBehavior dummy = go.GetComponent <DummyBehavior>();

        if (dummy == null)
        {
            dummy = go.AddComponent <DummyBehavior>();
        }
        entityBehaviors.Add(uid, dummy);
        dummy.uid        = uid;
        dummy.entityType = entityType;
        dummy.sceneid    = sceneid;

        dummy.OnNewObject();
        return(dummy);
    }
Beispiel #5
0
    static int get_groundLayer(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            DummyBehavior         obj = (DummyBehavior)o;
            UnityEngine.LayerMask ret = obj.groundLayer;
            ToLua.PushLayerMask(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index groundLayer on a nil value" : e.Message));
        }
    }
Beispiel #6
0
    static int get_OnColliderHit(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            DummyBehavior obj = (DummyBehavior)o;
            System.Action <UnityEngine.Collider> ret = obj.OnColliderHit;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index OnColliderHit on a nil value" : e.Message));
        }
    }
 static int CreateDummy(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 5);
         EntityBehaviorMgr obj       = (EntityBehaviorMgr)ToLua.CheckObject(L, 1, typeof(EntityBehaviorMgr));
         uint   arg0                 = (uint)LuaDLL.luaL_checknumber(L, 2);
         string arg1                 = ToLua.CheckString(L, 3);
         int    arg2                 = (int)LuaDLL.luaL_checknumber(L, 4);
         UnityEngine.GameObject arg3 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 5, typeof(UnityEngine.GameObject));
         DummyBehavior          o    = obj.CreateDummy(arg0, arg1, arg2, arg3);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #8
0
        public void Run_TypesOnSameInterfaceRegisteredByDifferentBehaviors_LastRegisteredBehaviorOverwrites()
        {
            DummyAssembly  assembly       = new DummyAssembly(typeof(Implementation), typeof(ProxyImpl));
            DummyContainer dummyContainer = new DummyContainer();
            IBootstrapper  bootstrapper   = new Bootstrapper(new[] { assembly })
                                            .ConfigureWith(dummyContainer)
                                            .ConfigureWith(new Mock <IContextStore>().Object);

            IRegistrationBehavior proxyBeh   = new DummyBehavior("Proxy");
            IRegistrationBehavior serviceBeh = new DummyBehavior("Service");

            bootstrapper.AddRegistrationBehavior(proxyBeh);
            bootstrapper.AddRegistrationBehavior(serviceBeh);

            bootstrapper.Run();

            ServiceInfo resolved = dummyContainer.GetRegistration(typeof(IService));

            Assert.Equal(typeof(Implementation), resolved.To);
        }
 static Coroutine()
 {
     _DummyBehaviour = _GameObject.AddComponent <DummyBehavior>();
 }