public static void Buffer(NetworkView view, string func, RPCMode mode, params object[] args) { //first fix up the mode so no one accidentally passes in a buffered mode if(mode == RPCMode.AllBuffered) mode = RPCMode.All; else if(mode == RPCMode.OthersBuffered) mode = RPCMode.Others; if(m_RPCs == null) m_RPCs = new BufferedRPC[0]; BufferedRPC [] temp = new BufferedRPC[m_RPCs.Length+1]; if(m_RPCs.Length > 0) m_RPCs.CopyTo(temp,0); BufferedRPC tempRPC = new BufferedRPC(); tempRPC.func = func; tempRPC.mode = mode; if(args != null) { // for(int i = 0; i < args.Length; i++) // Debug.Log(args[i].ToString() + ", "); tempRPC.args = new object[args.Length]; args.CopyTo(tempRPC.args,0); } tempRPC.view = view; temp[temp.Length-1] = tempRPC; m_RPCs = temp; view.RPC(func, mode, args); }
public static void Buffer(NetworkView view, string func, RPCMode mode, params object[] args) { //first fix up the mode so no one accidentally passes in a buffered mode if (mode == RPCMode.AllBuffered) { mode = RPCMode.All; } else if (mode == RPCMode.OthersBuffered) { mode = RPCMode.Others; } if (m_RPCs == null) { m_RPCs = new BufferedRPC[0]; } BufferedRPC [] temp = new BufferedRPC[m_RPCs.Length + 1]; if (m_RPCs.Length > 0) { m_RPCs.CopyTo(temp, 0); } BufferedRPC tempRPC = new BufferedRPC(); tempRPC.func = func; tempRPC.mode = mode; if (args != null) { // for(int i = 0; i < args.Length; i++) // Debug.Log(args[i].ToString() + ", "); tempRPC.args = new object[args.Length]; args.CopyTo(tempRPC.args, 0); } tempRPC.view = view; temp[temp.Length - 1] = tempRPC; m_RPCs = temp; view.RPC(func, mode, args); }