Beispiel #1
0
    /// <summary>
    /// socket登录协议
    /// 请求Send_login自动判断登入lobby还是登入game
    /// </summary>
    /// <param name="username"></param>
    /// <param name="password"></param>
    public static void Send_account_login()
    {
        _LoginType = LoginType.Username;
        SocketConnectInfo connectInfo = SocketConnectInfo.Instance;
        JSONObject        bodyJson    = new JSONObject();

        Debug.Log("====SendAccount  Login================    " + connectInfo.lobbyUserName);
        bodyJson.AddField("username", connectInfo.lobbyUserName);
        bodyJson.AddField("password", connectInfo.lobbyPassword);
        //bodyJson.AddField("captcha", kPassword.value);
        //bodyJson.AddField("proving", kPassword.value);
//#if UNITY_EDITOR
//        bodyJson.AddField("machineCode", "123456");//测试用
//        bodyJson.AddField("device_id", "123456");//测试用
//#else
        bodyJson.AddField("machineCode", "unity_" + EginUser.Instance.device_id);
        bodyJson.AddField("device_id", "");//"unity_" + EginUser.Instance.device_id);//测试用
//#endif
        bodyJson.AddField("client_type", "0");

        JSONObject loginJson = new JSONObject();

        loginJson.AddField("type", "AccountService");
        loginJson.AddField("tag", "account_login");
        loginJson.AddField("body", bodyJson);

        BaseSceneLua.SocketSendMessage(loginJson);
    }
Beispiel #2
0
    static int ConnectSocket(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        SocketConnectInfo arg0 = (SocketConnectInfo)LuaScriptMgr.GetNetObject(L, 1, typeof(SocketConnectInfo));

        Utils.ConnectSocket(arg0);
        return(0);
    }
Beispiel #3
0
    static int ValidInfo(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        SocketConnectInfo obj = (SocketConnectInfo)LuaScriptMgr.GetNetObjectSelf(L, 1, "SocketConnectInfo");
        bool o = obj.ValidInfo();

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Beispiel #4
0
    static int Init(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 3);
        SocketConnectInfo obj  = (SocketConnectInfo)LuaScriptMgr.GetNetObjectSelf(L, 1, "SocketConnectInfo");
        EginUser          arg0 = (EginUser)LuaScriptMgr.GetNetObject(L, 2, typeof(EginUser));
        GameRoom          arg1 = (GameRoom)LuaScriptMgr.GetNetObject(L, 3, typeof(GameRoom));

        obj.Init(arg0, arg1);
        return(0);
    }
Beispiel #5
0
    static int Connect(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 4);
        SocketManager     obj  = (SocketManager)LuaScriptMgr.GetUnityObjectSelf(L, 1, "SocketManager");
        SocketConnectInfo arg0 = (SocketConnectInfo)LuaScriptMgr.GetNetObject(L, 2, typeof(SocketConnectInfo));
        string            arg1 = LuaScriptMgr.GetLuaString(L, 3);
        bool arg2 = LuaScriptMgr.GetBoolean(L, 4);

        obj.Connect(arg0, arg1, arg2);
        return(0);
    }
Beispiel #6
0
    static int _CreateSocketConnectInfo(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            SocketConnectInfo obj = new SocketConnectInfo();
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: SocketConnectInfo.New");
        }

        return(0);
    }
Beispiel #7
0
    IEnumerator DoStartSocket(bool force = true)
    {
        Debug.Log(">>>>>>>>>>>>>>>>>>>>Mark  do start socket ");
        SocketConnectInfo connectInfo = SocketConnectInfo.Instance;

        //connectInfo.roomId = string.Empty;//把房间号置为空后就不会进行游戏登入了

        //SocketManager socketManager = SocketManager.Instance;
        yield return(socketManager);

        if (socketManager)
        {
            socketManager.socketListener = this;
            if (Constants.isEditor)
            {
                UnityEngine.Debug.LogError("CK : ------------------------------ <color=green>PlatformGameDefine.playform.SocketLobbyUrl = " + PlatformGameDefine.playform.SocketLobbyUrl + "</color>");
            }
            socketManager.Connect(connectInfo, PlatformGameDefine.playform.SocketLobbyUrl, force);
            Debug.Log(">>>>>>>>>>>>>>>>>>>>Mark  do start socket     1111 ");
        }
    }
Beispiel #8
0
    static int get_userPassword(IntPtr L)
    {
        object            o   = LuaScriptMgr.GetLuaObject(L, 1);
        SocketConnectInfo obj = (SocketConnectInfo)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name userPassword");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index userPassword on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.userPassword);
        return(1);
    }
Beispiel #9
0
    static int set_lobbyPassword(IntPtr L)
    {
        object            o   = LuaScriptMgr.GetLuaObject(L, 1);
        SocketConnectInfo obj = (SocketConnectInfo)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name lobbyPassword");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index lobbyPassword on a nil value");
            }
        }

        obj.lobbyPassword = LuaScriptMgr.GetString(L, 3);
        return(0);
    }
Beispiel #10
0
    static int set_entry_fee(IntPtr L)
    {
        object            o   = LuaScriptMgr.GetLuaObject(L, 1);
        SocketConnectInfo obj = (SocketConnectInfo)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name entry_fee");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index entry_fee on a nil value");
            }
        }

        obj.entry_fee = (int)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
Beispiel #11
0
    static int set_roomFixseat(IntPtr L)
    {
        object            o   = LuaScriptMgr.GetLuaObject(L, 1);
        SocketConnectInfo obj = (SocketConnectInfo)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name roomFixseat");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index roomFixseat on a nil value");
            }
        }

        obj.roomFixseat = LuaScriptMgr.GetBoolean(L, 3);
        return(0);
    }
Beispiel #12
0
    /* ------ Other ------ */
    private IEnumerator DoSocketConnect()
    {
        SocketConnectInfo connectInfo = SocketConnectInfo.Instance;

        if (connectInfo.ValidInfo())
        {
            SocketManager socketManager = SocketManager.Instance;
            yield return(socketManager);

            if (PlatformGameDefine.game.GameTypeIDs == "6" || (PlatformGameDefine.game.GameName == "DDZ" && PlatformGameDefine.game.GameTypeIDs == "4") ||
                (PlatformGameDefine.game.GameName == "DDZ" && (PlatformGameDefine.game.GameTypeIDs == "7" || PlatformGameDefine.game.GameTypeIDs == "8")))
            {
                EginProgressHUD.Instance.ShowWaitHUD("正在进入比赛场...", true);
            }
            socketManager.socketListener = this;
            socketManager.Connect(connectInfo);
        }
        else
        {
            EginProgressHUD.Instance.ShowPromptHUD(ZPLocalization.Instance.Get("Socket_Valid"));
        }
    }
Beispiel #13
0
    IEnumerator DoStartSocket(bool force, float delay = 0)
    {
        if (delay > 0)
        {
            yield return(new WaitForSeconds(delay));
        }
        SocketConnectInfo connectInfo = SocketConnectInfo.Instance;

        //connectInfo.roomId = string.Empty;//把房间号置为空后就不会进行游戏登入了

        //SocketManager socketManager = SocketManager.Instance;
        yield return(socketManager);

        if (socketManager)
        {
            socketManager.socketListener = this;
            if (Constants.isEditor)
            {
                UnityEngine.Debug.Log("CK : ------------------------------ <color=green>PlatformGameDefine.playform.SocketLobbyUrl = " + PlatformGameDefine.playform.SocketLobbyUrl + "</color>");
            }
            socketManager.Connect(connectInfo, PlatformGameDefine.playform.SocketLobbyUrl, force);
        }
    }
Beispiel #14
0
    /// <summary>
    /// 游戏登入协议
    /// 请求Send_login自动判断登入lobby还是登入game
    /// </summary>
    public static void Send_game_login()
    {
        if (!string.IsNullOrEmpty(NewGameLogin_lua))
        {
            SimpleFramework.Util.CallMethod("ProtocolHelper", NewGameLogin_lua);
            return;
        }

        SocketConnectInfo connectInfo = SocketConnectInfo.Instance;
        JSONObject        messageBody = new JSONObject();

        messageBody.AddField("userid", connectInfo.userId);
        messageBody.AddField("password", connectInfo.userPassword);
        messageBody.AddField("dbname", connectInfo.roomDBName);
        messageBody.AddField("version", "0");                   ///0
        messageBody.AddField("client_type", "0");
        messageBody.AddField("roomid", connectInfo.roomId);
        messageBody.AddField("fixseat", true);
        //斗地主电视现场版房间在进入房间时需要密码.
        if (entryRoom_password.Length > 0)
        {
            messageBody.AddField("entry_pwd", entryRoom_password);
        }
        else
        {
            //进入密码房间发client_info服务器会收不到消息,奇怪
            messageBody.AddField("client_info", "WIN");                      // 0928  UNITY  解决排行榜 不显示的问题  更改  此处 .
        }
        //messageBody.AddField("first_money", "");
        JSONObject messageObj = new JSONObject();

        messageObj.AddField("type", "account");
        messageObj.AddField("tag", "login");
        messageObj.AddField("body", messageBody);
        SocketManager.Instance.SendPackageWithJson(messageObj);
        entryRoom_password = "";
    }