示例#1
0
        protected static JoinRandomGameResponse GetJoinRandomGameResponse(OperationResponse op)
        {
            var res = new JoinRandomGameResponse
            {
                GameId  = GetParameter <string>(op, ParameterCode.RoomName, false),
                Address = GetParameter <string>(op, ParameterCode.Address, false),
            };

            return(res);
        }
示例#2
0
        protected static JoinGameResponse GetJoinGameResponse(OperationResponse op)
        {
            var res = new JoinGameResponse
            {
                Address        = GetParameter <string>(op, ParameterCode.Address, true),
                GameProperties = GetParameter <Hashtable>(op, ParameterCode.GameProperties, true),
            };

            return(res);
        }
示例#3
0
文件: Agent.cs 项目: tuita520/Regulus
            void ExitGames.Client.Photon.IPhotonPeerListener.OnOperationResponse(ExitGames.Client.Photon.OperationResponse operationResponse)
            {
                var args = new Dictionary <byte, byte[]>();

                foreach (var p in operationResponse.Parameters)
                {
                    args.Add(p.Key, p.Value as byte[]);
                }
                _Core.OnResponse(operationResponse.OperationCode, args);
            }
示例#4
0
        protected static CreateGameResponse GetCreateGameResponse(OperationResponse op)
        {
            var res = new CreateGameResponse
            {
                GameId  = GetParameter <string>(op, ParameterCode.RoomName, true),
                Address = GetParameter <string>(op, ParameterCode.Address, true)
            };

            return(res);
        }
示例#5
0
        protected static GetLobbyStatsResponse GetLobbyStatsResponse(OperationResponse op)
        {
            var res = new GetLobbyStatsResponse
            {
                LobbyNames = GetParameter <string[]>(op, ParameterCode.LobbyName, true),
                LobbyTypes = GetParameter <byte[]>(op, ParameterCode.LobbyType, true),
                PeerCount  = GetParameter <int[]>(op, ParameterCode.PeerCount, true),
                GameCount  = GetParameter <int[]>(op, ParameterCode.GameCount, true)
            };

            return(res);
        }
        protected static JoinGameResponse GetJoinGameResponse(OperationResponse op)
        {
            var res = new JoinGameResponse
            {
                Address          = GetParameter <string>(op, ParameterCode.Address, true),
                GameProperties   = GetParameter <Hashtable>(op, ParameterCode.GameProperties, true),
                ActorsProperties = GetParameter <Hashtable>(op, ParameterCode.PlayerProperties, true),
                RoomFlags        = GetParameter <int>(op, ParameterCode.RoomOptionFlags, true),
            };

            return(res);
        }
示例#7
0
        protected static T GetParameter <T>(OperationResponse response, byte parameterCode, bool isOptional)
        {
            T value;

            if (!TryGetParameter(response, parameterCode, out value))
            {
                if (isOptional == false && response.ReturnCode == (short)Photon.Common.ErrorCode.Ok)
                {
                    Assert.Fail("Parameter {0} is missing in operation response {1}", parameterCode, (Photon.LoadBalancing.Operations.OperationCode)response.OperationCode);
                }

                return(default(T));
            }

            return(value);
        }
示例#8
0
        protected static GetPropertiesResponse CreateGetPropertiesResponse(OperationResponse response)
        {
            var result = new GetPropertiesResponse();

            if (response.Parameters.ContainsKey(ParameterCode.PlayerProperties))
            {
                result.ActorProperties = (Hashtable)response[ParameterCode.PlayerProperties];
            }

            if (response.Parameters.ContainsKey(ParameterCode.GameProperties))
            {
                result.GameProperties = (Hashtable)response[ParameterCode.GameProperties];
            }

            return(result);
        }
示例#9
0
        protected static bool TryGetParameter <T>(OperationResponse response, byte parameterCode, out T value)
        {
            value = default(T);

            if (response.Parameters == null)
            {
                return(false);
            }

            object temp;

            if (response.Parameters.TryGetValue(parameterCode, out temp) == false)
            {
                return(false);
            }

            Assert.IsInstanceOf <T>(temp);
            value = (T)temp;
            return(true);
        }
示例#10
0
        static int _m_OnOperationResponse(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                ProtocolBase gen_to_be_invoked = (ProtocolBase)translator.FastGetCSObj(L, 1);



                {
                    ExitGames.Client.Photon.OperationResponse _operationResponse = (ExitGames.Client.Photon.OperationResponse)translator.GetObject(L, 2, typeof(ExitGames.Client.Photon.OperationResponse));

                    gen_to_be_invoked.OnOperationResponse(_operationResponse);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
 void IPunCallbacks.OnWebRpcResponse(ExitGames.Client.Photon.OperationResponse response)
 {
 }
示例#12
0
 public void OnWebRpcResponse(ExitGames.Client.Photon.OperationResponse response)
 {
     Publish(this);
 }
        private void SetupEncryption(OperationResponse response)
        {
            var encryptionData = (Dictionary <byte, object>)response[ParameterCode.EncryptionData];

            this.Client.SetupEncryption(encryptionData);
        }
示例#14
0
 /** RPC
  */
 public override void OnWebRpcResponse(ExitGames.Client.Photon.OperationResponse a_response)
 {
     //this.pun.OnPunWebRpcResponse(a_response);
 }