private string GetURL() { if (EntityFactory.MainHeroView == null) { return(null); } uint nUserID = GameLogicAPI.getPlayerUserID(EntityFactory.MainHeroView.ID); if (nUserID == 0) { return(null); } IntPtr account = GameLogicAPI.getActorClientAccount(); if (account == null || account == IntPtr.Zero) { return(null); } string username = Marshal.PtrToStringAnsi(account); if (string.IsNullOrEmpty(username)) { return(null); } string time = DateTime.Now.ToString("yyyyMMddHHmm"); string sign = Md5Sum(string.Format("{0}{1}{2}{3}", nUserID, username, time, KEY)); string host = null; if (!WebUrl.TryGetValue(GameWebUrl.WEB_INTERFACE_LINK, out host)) { Trace.Log("gamepromotion not have host in WebUrl."); return(null); } if (string.IsNullOrEmpty(host)) { Trace.Log(string.Format("gamepromotion host is empty")); return(null); } string get_info_and_user_list = host + GET_INFO_AND_USER_LIST; string url = string.Format(get_info_and_user_list, nUserID, username, GAMEID, time, sign); return(url); }
public System.Collections.IEnumerator BuildRecommendQRCode() { uint nUserID = GameLogicAPI.getPlayerUserID(EntityFactory.MainHeroView.ID); if (nUserID == 0) { Trace.Log("gamepromotion : get player userid failed."); } string host = null; if (!WebUrl.TryGetValue(GameWebUrl.QRCODE_LINK, out host)) { Trace.Log("gamepromotion : not find QR LINK."); yield break; } if (string.IsNullOrEmpty(host)) { Trace.Log("gamepromotion : QR LINK is empty."); yield break; } string url = string.Format("{0}{1}?u={2}&w=256&c=black&b=white&bw=4&bs=4&bc=orange&t=0&l=", Config.QRBuildUrl, host, nUserID); WWW www = new WWW(url); yield return(www); if (www.error != null) { Debug.LogWarning(www.error); yield break; } m_RQCode = www.texture; UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_GAME_PROMOTION_SET_QRCODE); }