private Dictionary <string, string> GetHeader(WWWForm form) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (string key in form.get_headers().Keys) { dictionary.Add(key, form.get_headers()[key].ToString()); } AccountManager.Account account = MonoBehaviourSingleton <AccountManager> .I.account; dictionary["Cookie"] = (account.token ?? string.Empty); dictionary["apv"] = NetworkNative.getNativeVersionName(); dictionary["amv"] = string.Empty; if (MonoBehaviourSingleton <ResourceManager> .IsValid()) { dictionary["amv"] = MonoBehaviourSingleton <ResourceManager> .I.manifestVersion.ToString(); } dictionary["aidx"] = string.Empty; if (MonoBehaviourSingleton <ResourceManager> .IsValid()) { dictionary["aidx"] = MonoBehaviourSingleton <ResourceManager> .I.assetIndex.ToString(); } dictionary["tidx"] = string.Empty; if (MonoBehaviourSingleton <ResourceManager> .IsValid()) { dictionary["tidx"] = MonoBehaviourSingleton <ResourceManager> .I.tableIndex.ToString(); } dictionary["tmv"] = string.Empty; if (MonoBehaviourSingleton <DataTableManager> .IsValid()) { dictionary["tmv"] = MonoBehaviourSingleton <DataTableManager> .I.manifestVersion.ToString(); } dictionary[ServerConstDefine.CDV_KEY] = string.Empty; if (MonoBehaviourSingleton <UserInfoManager> .IsValid() && MonoBehaviourSingleton <UserInfoManager> .I.userInfo != null) { dictionary[ServerConstDefine.CDV_KEY] = MonoBehaviourSingleton <UserInfoManager> .I.userInfo.constDefine.cdv.ToString(); } dictionary["User-Agent"] = NetworkNative.getDefaultUserAgent(); return(dictionary); }
public static IObservable <WWW> PostWWW(string url, WWWForm content, Dictionary <string, string> headers, IProgress <float> progress = null) { Dictionary <string, string> contentHeaders = content.get_headers(); return(Observable.FromCoroutine <WWW>((IObserver <WWW> observer, CancellationToken cancellation) => ObservableWWW.Fetch(new WWW(url, content.get_data(), ObservableWWW.MergeHash(contentHeaders, headers)), observer, progress, cancellation))); }