GetLuaFunction() public method

public GetLuaFunction ( string funcName ) : LuaFunction
funcName string
return LuaFunction
示例#1
0
        //LuaFunction _call = null;

        public LuaBeatEvent(LuaTable table)
        {
            self     = table;
            luaState = table.GetLuaState();
            self.AddRef();

            _add    = self.GetLuaFunction("Add");
            _remove = self.GetLuaFunction("Remove");
            //_call = self.GetLuaFunction("__call");
        }
示例#2
0
        //LuaFunction _call = null;
        public LuaEvent(LuaTable table)
        {
            self = table;
            luaState = table.GetLuaState();
            self.AddRef();

            _add = self.GetLuaFunction("Add");
            _remove = self.GetLuaFunction("Remove");
            //_call = self.GetLuaFunction("__call");
        }
示例#3
0
 /*----------- C#调用lua的接口 ----------*/
 public object[] CallMethod(string methodName, params object[] args)
 {
     if (luaTable != null)
     {
         var func = luaTable.GetLuaFunction(methodName);
         if (func != null)
         {
             return(func.Call(args));
         }
     }
     return(null);
 }
        //LuaFunction _call = null;

        #region constructor

        public LuaBeatEvent(LuaTable table)
        {
            self = table;
            // 获取参数 table 的 luaState 字段的值
            luaState = table.GetLuaState();
            // 增加引用计数
            self.AddRef();

            // 获取 self 中的 Add 和 Remove 方法
            _add    = self.GetLuaFunction("Add");
            _remove = self.GetLuaFunction("Remove");
            //_call = self.GetLuaFunction("__call");
        }
示例#5
0
        //		private IEnumerator UpdateAction ()
        //		{
        //			while (true)
        //			{
        //				UpdatePvpAction();
        //				yield return new WaitForSeconds(1);
        //			}
        //		}

        public void SetLoginSuccessData(string sdkId, string u8id, string token, int platformId)
        {
            if (PlatformProxy.instance.GetPlatformId() == 0)
            {
                return;
            }
            LoginProxy.instance.cachedAccount    = sdkId;
            LoginProxy.instance.cachedPassword   = string.Empty;
            LoginProxy.instance.cachedToken      = token;
            LoginProxy.instance.cachedPlatformId = platformId;
            LoginProxy.instance.cachedU8userID   = u8id;
            Logic.TalkingData.Controller.TalkingDataController.instance.TDGAAccountSetAccount(sdkId);
            LuaInterface.LuaTable table = (LuaInterface.LuaTable)LuaInterface.LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetModel", "game_model")[0];
            table.GetLuaFunction("SetChannelId").Call(platformId);
            table.GetLuaFunction("SetPlatformAccountId").Call(sdkId);
        }
示例#6
0
    public void PaymentCallback(string s)
    {
#if UNITY_IOS && !UNITY_EDITOR
        JsonData jsonData              = JsonMapper.ToObject(s);
        string   base64Encoding        = (string)jsonData["base64Encoding"];
        string   productIdentifier     = (string)jsonData["productIdentifier"];
        string   transactionIdentifier = (string)jsonData["transactionIdentifier"];
        string[] strs = productIdentifier.Split('_');
        int      id   = 0;
        if (strs.Length > 1)
        {
            id = strs[1].ToInt32();
        }

        /****** 此段为修复客户端表与app store商品ID不一致的问题所加 ******/
        if (id == 26)
        {
            id = 105;
        }
        else if (id == 27)
        {
            id = 106;
        }
        /****** 此段为修复客户端表与app store商品ID不一致的问题所加 ******/

        Debugger.Log("base64Encoding:" + base64Encoding);
        Debugger.Log("id:" + id);
        LuaInterface.LuaTable onlineGiftController = (LuaInterface.LuaTable)LuaInterface.LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetCtrl", "shop_controller")[0];
        onlineGiftController.GetLuaFunction("AppStoreVerifyReq").Call(id, base64Encoding, transactionIdentifier);
#endif
    }
示例#7
0
        public static void OpenRewardTipsView(List <GameResData> rewardList)
        {
            LuaTable tips_model = LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetModel", "tips_model")[0] as LuaTable;
            LuaTable tip_view   = tips_model.GetLuaFunction("GetTipView").Call("common_reward_tips_view")[0] as LuaTable;

            tip_view.GetLuaFunction("CreateByCSharpGameResDataList").Call(rewardList);
        }
示例#8
0
        void initLuaBridge()
        {
            LuaTable lua = LuaLoader.GetMainState().GetTable("EventBridge");

            if (lua != null)
            {
                luaProtoMsgParseFun  = lua.GetLuaFunction("onProtoMsgParse");
                luaBinaryMsgParseFun = lua.GetLuaFunction("onBinMsgParse");

                luaEventFun = lua.GetLuaFunction("onLuaEventParse");


                lua.Dispose();
                lua = null;
            }
        }
示例#9
0
        public void ClickHeroComposeHandler()
        {
            //			LuaInterface.LuaTable table = (LuaInterface.LuaTable)LuaInterface.LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetModel","consortia_model")[0];
            //			table.GetLuaFunction("OpenCreateConsortiaView").Call();

            LuaInterface.LuaTable table = (LuaInterface.LuaTable)LuaInterface.LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetCtrl", "hero_controller")[0];
            table.GetLuaFunction("OpenHeroComposeView").Call();
        }
 public void ConnectLua(LuaTable luaObj)
 {
     _OnInit = luaObj.GetLuaFunction("OnInit");
     _DoHideAnimation = luaObj.GetLuaFunction("DoHideAnimation");
     _DoShowAnimation = luaObj.GetLuaFunction("DoShowAnimation");
     _OnShown = luaObj.GetLuaFunction("OnShown");
     _OnHide = luaObj.GetLuaFunction("OnHide");
 }
示例#11
0
 public void ClickPackButtonHandler()
 {
     LuaInterface.LuaTable table = (LuaInterface.LuaTable)LuaInterface.LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetCtrl", "pack_controller")[0];
     table.GetLuaFunction("OpenPackView").Call();
 }
示例#12
0
 public void ClickArenaPointRaceBtnHandler()
 {
     LuaInterface.LuaTable table = (LuaInterface.LuaTable)LuaInterface.LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetModel", "arena_model")[0];
     table.GetLuaFunction("OpenRaceIntroView").Call();
 }
示例#13
0
        private bool LOBBY2CLIENT_LOGIN_SUCCESS_Handler(Observers.Interfaces.INotification note)
        {
            UI.UIMgr.instance.CloseAll();
            UI.UIMgr.instance.Open <Logic.UI.LoadGame.View.LoadGameView>(Logic.UI.LoadGame.View.LoadGameView.PREFAB_PATH);
            Logic.Protocol.Model.LoginResp resp = note.Body as Logic.Protocol.Model.LoginResp;
            //Debugger.Log(resp.account);
            //Debugger.Log(resp.ToString());

            //            PlayerProxy.instance.SetPlayerName(resp.roleName);
            GameProxy.instance.AccountName = resp.roleName;
            List <PlayerInfo> playerInfoList = PlayerProxy.instance.PlayerInfoDictionary.GetValues();
            int playerInfoCount = playerInfoList.Count;

            //            for (int i = 0; i < playerInfoCount; i++)
            //            {
            //                playerInfoList[i].name = PlayerProxy.instance.PlayerName;
            //            }
            //            GameProxy.instance.PlayerInfo.name = PlayerProxy.instance.PlayerName;
            GameProxy.instance.serverId        = resp.serverId;
            GameProxy.instance.AccountId       = resp.roleId;
            GameProxy.instance.AccountHeadIcon = UIUtil.ParseHeadIcon(resp.headNo);
            //GameProxy.instance.UpdateAccountLevelAndExp(resp.lv, resp.exp);
            LuaInterface.LuaTable table = (LuaInterface.LuaTable)LuaInterface.LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetModel", "game_model")[0];
            table.GetLuaFunction("UpdateAccountLevelAndExp").Call(resp.lv, resp.exp);
            table.GetLuaFunction("SetAccountName").Call(resp.roleName);
            table.GetLuaFunction("SetAccountHeadNo").Call(resp.headNo);
            table.GetLuaFunction("SetLastServerId").Call(resp.serverId);
            table.GetLuaFunction("SetAccountId").Call(resp.account);
            table.GetLuaFunction("SetServerName").Call(ServerList.Model.ServerListProxy.instance.GetCurrentServerInfo().name);
            TimeController.instance.login = true;
            TimeController.instance.ServerTimeTicksMillisecond = resp.serverTime;

            LuaInterface.LuaTable onlineGiftController = (LuaInterface.LuaTable)LuaInterface.LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetCtrl", "online_gift_controller")[0];
            onlineGiftController.GetLuaFunction("OnlineGiftSynReq").Call();
            Protocol.ProtocolProxy.instance.SendProtocol(new ClientActiveReq());

            PlayerPrefs.SetString("account", resp.account);
            PlayerPrefs.SetInt("lastLoginServerId", ServerList.Model.ServerListProxy.instance.lastServerId);
            PlayerPrefs.Save();
#if UNITY_IOS
            PlatformProxy.instance.InitIOSPayment();
            Game.Model.GameProxy.instance.SetLoginSuccessData(resp.account, string.Empty, string.Empty, PlatformProxy.instance.GetPlatformId());
#endif
            GameProxy.instance.SendGameInfo();

            //if(FunctionOpen.Model.FunctionOpenProxy.instance.IsFunctionOpen(Enums.FunctionOpenType.MainView_Activity))
            //    LuaInterface.ToLuaPb.SetFromLua((int)MSG.ActivityListReq);
            //if (FunctionOpen.Model.FunctionOpenProxy.instance.IsFunctionOpen(Enums.FunctionOpenType.MainView_Chat))
            //    LuaInterface.ToLuaPb.SetFromLua((int)MSG.ChatInfoReq);
            //            Logic.Game.Controller.GameController.instance.LoadGame();
            //UIMgr.instance.Close(Logic.UI.ServerList.View.ServerView.PREFAB_PATH);
            Logic.Game.Controller.GameController.instance.LoadAllGame();

            if (CreateRole.Controller.CreateRoleController.instance.isCreatingNewRole)
            {
                AdTracking.Controller.AdTrackingController.instance.AdTracking_OnRegister(resp.account);
                Logic.Game.Controller.GameController.instance.SendExternalData(Logic.Enums.ExtraDataType.CreateRole);
                CreateRole.Controller.CreateRoleController.instance.isCreatingNewRole = false;
            }
            AdTracking.Controller.AdTrackingController.instance.AdTracking_OnLogin(resp.account);

            Logic.Game.Controller.GameController.instance.SendExternalData(Logic.Enums.ExtraDataType.EntryGame);
            return(true);
        }
示例#14
0
 public void OnClickTopHundredRankBtnHandler()
 {
     LuaInterface.LuaTable table = (LuaInterface.LuaTable)LuaInterface.LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetCtrl", "ranking_controller")[0];
     table.GetLuaFunction("OpenRankingView").Call(4);
 }