public void registerProtocol(C2SProtocol protocol, BumProtocolType type, string url, DispatchProtocolDelegate dispatchCallBack) { BumProtocolInfo newProtocolInfo = new BumProtocolInfo(); newProtocolInfo.protocol = protocol; newProtocolInfo.url = url; newProtocolInfo.protocolType = type; newProtocolInfo.dispatchProtocol = dispatchCallBack; protocolCluster.Add((int)protocol, newProtocolInfo); }
void doSend(BumProtocolInfo protocolInfo, WWWForm postForm) { WWW www = null; switch (protocolInfo.protocolType) { case BumProtocolType.eProtocolType_GET: www = new WWW(serverURL + protocolInfo.url); break; case BumProtocolType.eProtocolType_POST: www = new WWW(serverURL + protocolInfo.url, postForm); break; case BumProtocolType.eProtocolType_POST_WITH_COOKIES: BumBase.Assert(BumLogic.clientUser.userConfig.cookieRequestHeader != null); www = new WWW(serverURL + protocolInfo.url, postForm.data, BumLogic.clientUser.userConfig.cookieRequestHeader); break; } BumApp.Instance.StartCoroutine(protocolInfo.dispatchProtocol(www)); }
public void send(C2SProtocol protocol, WWWForm postForm) { BumProtocolInfo pi = getProtocolInfo(protocol); doSend(pi, postForm); }