Пример #1
0
        public int logout()
        {
            JsonData jo = new JsonData();

            jo["action"] = "logout";
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #2
0
        public int gerVersion()
        {
            JsonData jo = new JsonData();

            jo["action"] = "getVersion";
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #3
0
        public int registerUser()
        {
            JsonData jo = new JsonData();

            jo["action"] = "registerUser";
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #4
0
        public int init(MatchVSResponse[] pMatchVSResponse, string channel, string platform, int gameid)
        {
            try {
                handler.handleString = handleJsonStringImp;
                handler.handleByte   = handleByteImp;
                Native.JsonRpc_regitCCallCsharp(ref handler);
                listener = new List <MatchVSResponse>();
                if (pMatchVSResponse != null)
                {
                    for (int i = 0; i < pMatchVSResponse.Length; i++)
                    {
                        if (pMatchVSResponse[i] != null)
                        {
                            listener.Add(pMatchVSResponse[i]);
                        }
                    }
                }

                JsonData jo = new JsonData();
                jo["action"]           = "init";
                jo["pMatchVSResponse"] = JsonMapper.ToObject(JsonUtil.toJson(pMatchVSResponse));
                jo["sChannel"]         = channel;
                jo["sPlatform"]        = platform;
                jo["iGameId"]          = gameid;
                //			jo["pIsPushQueue"] = 1;

                JsonRpc.JsonRpc_callNativeMethod(jo.ToJson());
            } catch (Exception e) {
                Log.w(e);
            }
            return(0);
        }
Пример #5
0
        public int sendFrameEvent(string cpProto)
        {
            JsonData jo = new JsonData();

            jo["action"]  = "sendFrameEvent";
            jo["cpProto"] = cpProto;
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #6
0
        public int leaveRoom(String payload)
        {
            JsonData jo = new JsonData();

            jo["action"]  = "leaveRoom";
            jo["cpProto"] = payload;
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #7
0
        public int getRoomList(MsRoomFilter roomFilter)
        {
            string   data = JsonMapper.ToJson(roomFilter);
            JsonData jo   = JsonUtil.toObject(data);

            jo["action"] = "getRoomList";
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #8
0
        public int joinOver(string cpProto)
        {
            JsonData jo = new JsonData();

            jo["action"]  = "joinOver";
            jo["cpProto"] = cpProto;
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #9
0
        public int joinRoomWithProperties(MsMatchInfo matchInfo, string userProfile)
        {
            JsonData jo = JsonUtil.toObject(JsonUtil.toJson(matchInfo));

            jo["action"]      = "joinRoomWithProperties";
            jo["userProfile"] = userProfile;
            return(JsonRpc.JsonRpc_callNativeMethod(JsonUtil.toJson(jo)));
        }
Пример #10
0
        public int setFrameSync(int frameRate)
        {
            JsonData jo = new JsonData();

            jo["action"]    = "setFrameSync";
            jo["frameRate"] = frameRate;
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #11
0
        public int setTimestamp(int priority, bool enable)
        {
            JsonData jo = new JsonData();

            jo["action"]   = "sendFrameEvent";
            jo["priority"] = priority;
            jo["enable"]   = enable;
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #12
0
        public int sendEvent(string pMsg)
        {
            JsonData jo = new JsonData();

            jo["action"] = "sendEvent";
            jo["pMsg"]   = pMsg;
            Debug.Log("[sendevent]: " + jo.ToJson());
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #13
0
        public int joinRoom(string roomID, string userProfile)
        {
            JsonData jo = new JsonData();

            jo["action"]      = "joinRoom";
            jo["roomID"]      = roomID;
            jo["userProfile"] = userProfile;
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #14
0
        public int kickPlayer(int userID, string cpProto)
        {
            JsonData jo = new JsonData();

            jo["action"]  = "kickPlayer";
            jo["userID"]  = userID;
            jo["cpProto"] = cpProto;
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #15
0
        public int joinRandomRoom(int iMaxPlayer, string strUserProfile)
        {
            JsonData jo = new JsonData();

            jo["action"]       = "joinRandomRoom";
            jo["iMaxPlayer"]   = iMaxPlayer;
            jo["sUserProfile"] = strUserProfile;
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #16
0
        public int subscribeEventGroup(string[] subGroups, string[] unsubGroups)
        {
            JsonData jo = new JsonData();

            jo["action"]      = "subscribeEventGroup";
            jo["subGroups"]   = JsonUtil.toObject(JsonUtil.toJson(subGroups));
            jo["unsubGroups"] = JsonUtil.toObject(JsonUtil.toJson(unsubGroups));
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #17
0
        public int createRoom(MsCreateRoomInfo roomInfo, string userProfile)
        {
            string   json = JsonMapper.ToJson(roomInfo);
            JsonData jo   = JsonUtil.toObject(json);

            jo["action"]      = "createRoom";
            jo["userProfile"] = userProfile;
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #18
0
        public int sendEventGroup(string cpProto, string[] groups)
        {
            JsonData jo = new JsonData();

            jo["action"]  = "sendEventGroup";
            jo["cpProto"] = cpProto;
            jo["groups"]  = JsonUtil.toObject(JsonUtil.toJson(groups));
            Debug.Log("[sendEventGroup]: " + jo.ToJson());
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #19
0
        public int sendEvent(int iType, string pMsg, int iTargetType, int[] pTargetUserId)
        {
            JsonData jo = new JsonData();

            jo["action"]        = "sendEvent";
            jo["iType"]         = iType;
            jo["pMsg"]          = pMsg;
            jo["iTargetType"]   = iTargetType;
            jo["pTargetUserId"] = JsonUtil.toObject(JsonUtil.toJson(pTargetUserId));
            Debug.Log("[sendevent]: " + jo.ToJson());
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }
Пример #20
0
        public int login(int userid, string token, int gameid, int gameVersion, string appkey, string secretkey,
                         string deviceid, int gatewayid)
        {
            JsonData jo = new JsonData();

            jo["action"]       = "login";
            jo["iUserId"]      = userid;
            jo["sToken"]       = token;
            jo["iGameId"]      = gameid;
            jo["iGameVersion"] = gameVersion;
            jo["pAppKey"]      = appkey;
            jo["pSecretKey"]   = secretkey;
            jo["pDeviceId"]    = deviceid;
            jo["iGatewayId"]   = gatewayid;
            return(JsonRpc.JsonRpc_callNativeMethod(jo.ToJson()));
        }