void Start() { if (isMine) { if (LogFilter.logDebug) { Debug.Log("Setting VoiceChat recorder NetworkId."); } VoiceChatRecorder.Instance.NewSample += OnNewSample; VoiceChatRecorder.Instance.NetworkId = networkId; } else { VoiceChatPacketReceived += OnReceivePacket; } if (isClient && (!isMine || VoiceChatSettings.Instance.LocalDebug)) { gameObject.AddComponent <AudioSource>(); player = gameObject.AddComponent <VoiceChatPlayer>(); } if (ProxyStarted != null) { ProxyStarted(this); } }
static int VoiceAuth(IntPtr L) { try { ToLua.CheckArgsCount(L, 0); bool o = VoiceChatPlayer.VoiceAuth(); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int Stop(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); VoiceChatPlayer obj = (VoiceChatPlayer)ToLua.CheckObject <VoiceChatPlayer>(L, 1); obj.Stop(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int DeleteVoice(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); string arg0 = ToLua.CheckString(L, 1); VoiceChatPlayer.DeleteVoice(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int addCacheDataByte(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); VoiceChatPlayer obj = (VoiceChatPlayer)ToLua.CheckObject <VoiceChatPlayer>(L, 1); byte[] arg0 = ToLua.CheckByteBuffer(L, 2); obj.addCacheDataByte(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int PlayRecording(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); VoiceChatPlayer obj = (VoiceChatPlayer)ToLua.CheckObject <VoiceChatPlayer>(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.PlayRecording(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int LoadVoice(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); string arg0 = ToLua.CheckString(L, 1); byte[] o = VoiceChatPlayer.LoadVoice(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int OnNewSample(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); VoiceChatPlayer obj = (VoiceChatPlayer)ToLua.CheckObject <VoiceChatPlayer>(L, 1); VoiceChat.VoiceChatPacket arg0 = StackTraits <VoiceChat.VoiceChatPacket> .Check(L, 2); obj.OnNewSample(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
//开始录音 public void StartRecording() { #if UNITY_IOS if (!VoiceChatPlayer.VoiceAuth()) { return; } #endif Stop(); if (recorder == null) { return; } recorder.StartRecording(); recorder.setTransmitToggled(true); }
static int SaveVoice(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); string arg0 = ToLua.CheckString(L, 1); byte[] arg1 = ToLua.CheckByteBuffer(L, 2); bool arg2 = LuaDLL.luaL_checkboolean(L, 3); VoiceChatPlayer.SaveVoice(arg0, arg1, arg2); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_onCommitVoice(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); VoiceChatPlayer obj = (VoiceChatPlayer)o; System.Action arg0 = (System.Action)ToLua.CheckDelegate <System.Action>(L, 2); obj.onCommitVoice = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onCommitVoice on a nil value")); } }
static int get_onCommitVoice(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); VoiceChatPlayer obj = (VoiceChatPlayer)o; System.Action ret = obj.onCommitVoice; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onCommitVoice on a nil value")); } }
void Start() { if (GetComponent <NetworkView>().isMine) { VoiceChatRecorder.Instance.NewSample += OnNewSample; } if (Network.isServer) { assignedNetworkId = ++networkIdCounter; GetComponent <NetworkView>().RPC("SetNetworkId", GetComponent <NetworkView>().owner, assignedNetworkId); } if (Network.isClient && (!GetComponent <NetworkView>().isMine || VoiceChatSettings.Instance.LocalDebug)) { gameObject.AddComponent <AudioSource>(); player = gameObject.AddComponent <VoiceChatPlayer>(); } }
void Start() { if (networkView.isMine) { VoiceChatRecorder.Instance.NewSample += new System.Action <VoiceChatPacket>(OnNewSample); } if (Network.isServer) { assignedNetworkId = ++networkIdCounter; networkView.RPC("SetNetworkId", networkView.owner, assignedNetworkId); } if (Network.isClient && !networkView.isMine) { gameObject.AddComponent <AudioSource>(); player = gameObject.AddComponent <VoiceChatPlayer>(); } }
void Start() { if (GetComponent<NetworkView>().isMine) { VoiceChatRecorder.Instance.NewSample += OnNewSample; } if (Network.isServer) { assignedNetworkId = ++networkIdCounter; GetComponent<NetworkView>().RPC("SetNetworkId", GetComponent<NetworkView>().owner, assignedNetworkId); } if (Network.isClient && (!GetComponent<NetworkView>().isMine || VoiceChatSettings.Instance.LocalDebug)) { gameObject.AddComponent<AudioSource>(); player = gameObject.AddComponent<VoiceChatPlayer>(); } }
void Start() { if (networkView.isMine) { VoiceChatRecorder.Instance.NewSample += new System.Action<VoiceChatPacket>(OnNewSample); } if (Network.isServer) { assignedNetworkId = ++networkIdCounter; networkView.RPC("SetNetworkId", networkView.owner, assignedNetworkId); } if(Network.isClient && !networkView.isMine) { gameObject.AddComponent<AudioSource>(); player = gameObject.AddComponent<VoiceChatPlayer>(); } }
void Start() { // If im the owner of the proxy, send my voice data if (networkView.isMine) { Debug.Log("Network view isMine. Creating VoiceChatPackets."); VoiceChatRecorder.Instance.NewSample += new System.Action <VoiceChatPacket>(OnNewSample); } // if im the server, set the proxy owner's voiceChatRecorder's networkId if (Network.isServer) { Debug.Log("Network.isServer"); Debug.Log("networkView.owner = " + networkView.owner); assignedNetworkId = ++networkIdCounter; /* If I'm the server, I still need to get a networkID. We have to handle this separately bc * the RPC call apparently won't call to itself or something */ if (networkView.isMine) { SetNetworkId(assignedNetworkId); } else { networkView.RPC("SetNetworkId", networkView.owner, assignedNetworkId); gameObject.AddComponent <AudioSource>(); player = gameObject.AddComponent <VoiceChatPlayer>(); } } // im a client other than the owner of the proxy, add an audio source so I can hear the proxy owner's voice data if (Network.isClient && !networkView.isMine) { Debug.Log("VoiceChatNetworkProxy - isClient and addingVoiceChatPlayer"); gameObject.AddComponent <AudioSource>(); player = gameObject.AddComponent <VoiceChatPlayer>(); } }
void Start() { if (isMine) { VoiceChatRecorder.Instance.NewSample += OnNewSample; VoiceChatRecorder.Instance.NetworkId = networkId; } else { VoiceChatPacketReceived += OnReceivePacket; } if (Network.isServer) { //GetComponent<NetworkView>().RPC("SetNetworkId", GetComponent<NetworkView>().owner, assignedNetworkId); } if (isClient && (!isMine || VoiceChatSettings.Instance.LocalDebug)) { gameObject.AddComponent<AudioSource>(); player = gameObject.AddComponent<VoiceChatPlayer>(); } }
void Start() { if (isMine) { VoiceChatRecorder.Instance.NewSample += OnNewSample; VoiceChatRecorder.Instance.NetworkId = networkId; } else { VoiceChatPacketReceived += OnReceivePacket; } if (Network.isServer) { //GetComponent<NetworkView>().RPC("SetNetworkId", GetComponent<NetworkView>().owner, assignedNetworkId); } if (isClient && (!isMine || VoiceChatSettings.Instance.LocalDebug)) { gameObject.AddComponent <AudioSource>(); player = gameObject.AddComponent <VoiceChatPlayer>(); } }
void Start() { // If im the owner of the proxy, send my voice data if (networkView.isMine) { Debug.Log ("Network view isMine. Creating VoiceChatPackets."); VoiceChatRecorder.Instance.NewSample += new System.Action<VoiceChatPacket>(OnNewSample); } // if im the server, set the proxy owner's voiceChatRecorder's networkId if (Network.isServer) { Debug.Log ("Network.isServer"); Debug.Log("networkView.owner = " + networkView.owner); assignedNetworkId = ++networkIdCounter; /* If I'm the server, I still need to get a networkID. We have to handle this separately bc * the RPC call apparently won't call to itself or something */ if(networkView.isMine) { SetNetworkId(assignedNetworkId); } else { networkView.RPC("SetNetworkId", networkView.owner, assignedNetworkId); gameObject.AddComponent<AudioSource>(); player = gameObject.AddComponent<VoiceChatPlayer>(); } } // im a client other than the owner of the proxy, add an audio source so I can hear the proxy owner's voice data if(Network.isClient && !networkView.isMine) { Debug.Log ("VoiceChatNetworkProxy - isClient and addingVoiceChatPlayer"); gameObject.AddComponent<AudioSource>(); player = gameObject.AddComponent<VoiceChatPlayer>(); } }
void Start() { if (isMine) { if (LogFilter.logDebug) { Debug.Log("Setting VoiceChat recorder NetworkId."); } VoiceChatRecorder.Instance.NewSample += OnNewSample; VoiceChatRecorder.Instance.NetworkId = networkId; } else { VoiceChatPacketReceived += OnReceivePacket; } if (isClient && (!isMine || VoiceChatSettings.Instance.LocalDebug)) { gameObject.AddComponent<AudioSource>(); player = gameObject.AddComponent<VoiceChatPlayer>(); } if (ProxyStarted != null) { ProxyStarted(this); } }