static int Send(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                Game.MessageManager          obj  = (Game.MessageManager)ToLua.CheckObject <Game.MessageManager>(L, 1);
                UFrame.MessageCenter.Message arg0 = (UFrame.MessageCenter.Message)ToLua.CheckObject <UFrame.MessageCenter.Message>(L, 2);
                obj.Send(arg0);
                return(0);
            }
            else if (count == 3)
            {
                Game.MessageManager          obj  = (Game.MessageManager)ToLua.CheckObject <Game.MessageManager>(L, 1);
                UFrame.MessageCenter.Message arg0 = (UFrame.MessageCenter.Message)ToLua.CheckObject <UFrame.MessageCenter.Message>(L, 2);
                bool arg1 = LuaDLL.luaL_checkboolean(L, 3);
                obj.Send(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: Game.MessageManager.Send"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 public void MessageCallback(UFrame.MessageCenter.Message msg)
 {
     if (msg.messageID == (int)GameMsg.C2C_Return_Login)
     {
         returnLogin = true;
     }
 }
Example #3
0
        void OnD2L_BattleInit(UFrame.MessageCenter.Message msg)
        {
            D2L_BattleInit convMsg = msg as D2L_BattleInit;

            if (convMsg.result)
            {
                displayOK = true;
                Debug.LogError("display init ok");
            }
        }
 static int Release(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UFrame.MessageCenter.Message obj = (UFrame.MessageCenter.Message)ToLua.CheckObject <UFrame.MessageCenter.Message>(L, 1);
         obj.Release();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #5
0
        void OnJOY_Press(UFrame.MessageCenter.Message msg)
        {
            JOY_Press convMsg  = msg as JOY_Press;
            var       tankCtrs = logicDataManager.GetTankCtrs();
            var       tankCtr  = tankCtrs[convMsg.tankID];

            tankCtr.moveObject.couldMove = convMsg.couldMove;
            tankCtr.moveObject.couldTurn = convMsg.couldTurn;

            if (convMsg.couldMove && convMsg.couldTurn)
            {
                tankCtr.Turn(F64Vec3.FromUnityVector3(convMsg.dir));
            }
        }
    static int set_messageID(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UFrame.MessageCenter.Message obj = (UFrame.MessageCenter.Message)o;
            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            obj.messageID = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index messageID on a nil value"));
        }
    }
    static int get_messageID(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UFrame.MessageCenter.Message obj = (UFrame.MessageCenter.Message)o;
            int ret = obj.messageID;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index messageID on a nil value"));
        }
    }
Example #8
0
        void OnL2D_TankPos(UFrame.MessageCenter.Message msg)
        {
            L2D_TankPos convMsg = msg as L2D_TankPos;

            for (int i = 0; i < convMsg.tankGroup.Count; ++i)
            {
                var tankPos = convMsg.tankGroup[i];
                int tankID  = tankPos.id;
                var tank    = tanks[tankID];

                tank.go.transform.position = tankPos.pos;
                //tank.go.transform.LookAt(tankPos.dir + tankPos.pos);
                //tank.go.transform.LookAt(tankPos.dir);
                //tank.go.transform.LookAt(tankPos.pos);
                tank.go.transform.forward = tankPos.dir;
            }
        }
Example #9
0
        void OnL2D_BattleInit(UFrame.MessageCenter.Message msg)
        {
            L2D_BattleInit initMsg = msg as L2D_BattleInit;

            for (int i = 0; i < initMsg.tankGroup.Count; ++i)
            {
                tank_info        ti         = tank_infoAPI.GetDataBy_tank_type(initMsg.tankGroup[i].tank_type);
                GameObjectGetter tankGetter = ResHelper.LoadGameObject(ti.res_path);
                GameObject       tankGo     = tankGetter.Get();
                tankGo.transform.position = initMsg.tankGroup[i].pos;
                Debug.LogError(initMsg.tankGroup[i].dir);
                tankGo.transform.transform.LookAt(initMsg.tankGroup[i].dir);
                var tank = new Tank();
                tank.go        = tankGo;
                tank.ID        = initMsg.tankGroup[i].id;
                tank.dectLen   = initMsg.tankGroup[i].detectionLen;
                tank.dectWidth = initMsg.tankGroup[i].detectionWidth;
                tanks.Add(initMsg.tankGroup[i].id, tank);

                Debug.LogError(initMsg.tankGroup[i].id + " " + initMsg.tankGroup[i].isPlayer);
                //增加跟随相机
                //if (initMsg.tankGroup[i].isSelf && initMsg.tankGroup[i].isCaptain)
                //{
                //    GameObjectGetter selfCameraGetter = ResHelper.LoadGameObject("prefabs/self_camera");
                //    GameObject selfCamera = selfCameraGetter.Get();
                //    //RPGCamera rpgCamera = selfCamera.GetComponent<RPGCamera>();
                //    //rpgCamera.UsedCamera = Camera.main;
                //    selfCamera.transform.SetParent(tank.transform);
                //}
            }

            for (int i = 0; i < initMsg.avoidances.Count; ++i)
            {
                //tank_info ti = tank_infoAPI.GetDataBy_tank_type(initMsg.tankGroup[i].tank_type);
                GameObjectGetter getter = ResHelper.LoadGameObject("prefabs/avoidance3");
                GameObject       av     = getter.Get();
                av.transform.position = initMsg.avoidances[i].pos;
                //av.transform.localScale *= (initMsg.avoidances[i].rad);
            }

            D2L_BattleInit initRetMsg = new D2L_BattleInit();

            initRetMsg.result = true;
            battleManager.battleMessageCenter.Send(initRetMsg);
        }
    static int _CreateUFrame_MessageCenter_Message(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                UFrame.MessageCenter.Message obj = new UFrame.MessageCenter.Message();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UFrame.MessageCenter.Message.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #11
0
 public void Execute(UFrame.MessageCenter.Message msg)
 {
     battleMessageCallbacks[msg.messageID](msg);
 }
Example #12
0
 public void SendBattleMessage(UFrame.MessageCenter.Message msg)
 {
     battleManager.battleMessageCenter.Send(msg);
 }
Example #13
0
    public override void Execute(UFrameMessage msg)
    {
        MessageTest _msg = msg as MessageTest;

        Debug.LogError(msg.messageID + " " + _msg.field1 + " " + _msg.field2);
    }
Example #14
0
 public void Send(UFrame.MessageCenter.Message msg, bool immediately = true)
 {
     gameMessageCenter.Send(msg, immediately);
 }