/// <summary> /// /// </summary> /// <param name="state">The state that invoked the callback</param> /// <param name="map">The map currently being processed</param> /// <param name="group">The group being processed</param> /// <param name="scaleindex">The scaleindex being processed</param> /// <param name="row">The row being processed</param> /// <param name="column">The column being processed</param> /// <param name="cancel">A control flag to stop the tile rendering</param> public TileProgressEventArgs(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, bool cancel) { this.State = state; this.Map = map; this.Group = group; this.ScaleIndex = scaleindex; this.Row = row; this.Column = column; this.Cancel = cancel; }
/// <summary> /// /// </summary> /// <param name="state">The state that invoked the callback</param> /// <param name="map">The map currently being processed</param> /// <param name="group">The group being processed</param> /// <param name="scaleindex">The scaleindex being processed</param> /// <param name="row">The row being processed</param> /// <param name="column">The column being processed</param> /// <param name="error"></param> public TileRenderingErrorEventArgs(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, Exception error) { this.State = state; this.Map = map; this.Group = group; this.ScaleIndex = scaleindex; this.Row = row; this.Column = column; this.Error = error; }
// 加载本地配置项,无则返回空 public static CallbackStates Load() { try { StreamReader streamReader = new StreamReader(filePath); string json = streamReader.ReadToEnd(); streamReader.Close(); CallbackStates config = JsonMapper.ToObject <CallbackStates>(json); return(config); } catch (Exception e) { Debug.Log(e.Message); return(null); } }
private CallbackSettings() { callback = CallbackStates.Load(); if (callback == null || String.IsNullOrEmpty(callback.loginState)) { // 若为空,则对配置初始化 callback = new CallbackStates(); callback.loginState = loginStates[loginIndex]; callback.authState = authStates[authIndex]; callback.shareState = shareStates[shareIndex]; callback.relationState = relationStates[relationIndex]; callback.wakeupState = wakeupStates[wakeupIndex]; callback.groupState = groupStates[groupIndex]; callback.cardState = cardStates[cardIndex]; callback.locationState = lbsStates[locationIndex]; callback.nearbyState = lbsStates[nearbyIndex]; callback.Update(); } else { // 更新索引值 try { loginIndex = Array.IndexOf(loginStates, callback.loginState, 0); authIndex = Array.IndexOf(authStates, callback.authState, 0); shareIndex = Array.IndexOf(shareStates, callback.shareState, 0); relationIndex = Array.IndexOf(relationStates, callback.relationState, 0); wakeupIndex = Array.IndexOf(wakeupStates, callback.wakeupState, 0); groupIndex = Array.IndexOf(groupStates, callback.groupState, 0); cardIndex = Array.IndexOf(cardStates, callback.cardState, 0); locationIndex = Array.IndexOf(lbsStates, callback.locationState, 0); nearbyIndex = Array.IndexOf(lbsStates, callback.nearbyState, 0); } catch (Exception e) { Debug.LogWarning(e.Message); } } }
void bx_FinishRenderingTile(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel) { m_tileRuns.Add(DateTime.Now - m_beginTile); m_tileCount++; m_grandTotalTileCount++; //Update display, after 1000 tiles if (m_tileRuns.Count > 500 || (DateTime.Now - m_lastUpdate).TotalSeconds > 5 || m_cancel) { long d = 0; foreach (TimeSpan ts in m_tileRuns) d += ts.Ticks; d /= m_tileRuns.Count; //For all other than the first calculation, we use the previous counts too if (m_grandTotalTileCount != m_tileRuns.Count) d = (d + m_prevDuration.Ticks) / 2; m_prevDuration = new TimeSpan(d); TimeSpan duration = new TimeSpan(d * m_totalTiles); m_tileRuns.Clear(); m_lastUpdate = DateTime.Now; DisplayProgress(map, group, scaleindex, row, column, ref cancel); } }
void bx_FinishRenderingMaps(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel) { if (this.InvokeRequired) this.Invoke(new System.Threading.ThreadStart(DoClose)); else DoClose(); }
void bx_FailedRenderingTile(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref Exception exception) { m_failCount++; exception = null; //Eat it }
void bx_BeginRenderingTile(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel) { m_beginTile = DateTime.Now; }
static void bx_FinishRenderingTile(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel) { tileRuns.Add(DateTime.Now - beginTile); tileCount++; //Update display, after 1000 tiles if (tileRuns.Count > 500 || (DateTime.Now - lastUpdate).TotalSeconds > 5) { long d = 0; foreach (TimeSpan ts in tileRuns) d += ts.Ticks; d /= tileRuns.Count; //For all other than the first calculation, we use the previous counts too if (tileCount != tileRuns.Count) d = (d + prevDuration.Ticks) / 2; prevDuration = new TimeSpan(d); TimeSpan duration = new TimeSpan(d * totalTiles); tileRuns.Clear(); lastUpdate = DateTime.Now; if (m_logableProgress) Console.WriteLine(string.Format(Strings.ConsoleOperationFinishTile, tileCount, totalTiles, group, duration)); else DisplayProgress(map, group, scaleindex, row, column, ref cancel); } }
static void bx_FinishRenderingScale(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel) { TimeSpan duration = DateTime.Now - beginScale; if (m_logableProgress) Console.WriteLine(string.Format(Strings.ConsoleOperationFinishScale, DateTime.Now, map.MapDefinition.BaseMap.GetScaleAt(scaleindex), duration)); }
static void bx_FinishRenderingMap(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel) { groupCount = 0; TimeSpan duration = DateTime.Now - beginMap; if (m_logableProgress) Console.WriteLine(string.Format(Strings.ConsoleOperationFinishMap, DateTime.Now, map.ResourceId, duration)); }
static void bx_FailedRenderingTile(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref Exception exception) { exceptionList.Add(exception); exception = null; }
static void bx_BeginRenderingScale(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel) { beginScale = DateTime.Now; if (m_logableProgress) Console.WriteLine(string.Format(Strings.ConsoleOperationBeginScale, beginMap, map.MapDefinition.BaseMap.GetScaleAt(scaleindex), scaleindex, map.Resolutions)); }
static void bx_BeginRenderingMap(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel) { mapCount++; beginMap = DateTime.Now; if (m_logableProgress) Console.WriteLine(string.Format(Strings.ConsoleOperationBeginMap, beginMap, map.ResourceId)); }
static void bx_BeginRenderingGroup(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel) { groupCount++; beginGroup = DateTime.Now; if (m_logableProgress) Console.WriteLine(string.Format(Strings.ConsoleOperationBeginGroup, beginGroup, group, 1, 1)); tileRuns = new List<TimeSpan>(); tileCount = 0; totalTiles = map.TotalTiles; }
private static void TriggerEvent(TileProgressEventHandler evt, object sender, CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel) { var args = new TileProgressEventArgs(state, map, group, scaleindex, row, column, cancel); evt?.Invoke(sender, args); cancel = args.Cancel; }
void bx_BeginRenderingMap(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel) { m_tileCount = 0; }
private DataGenerator() { // 读取游戏对事件的配置 callback = CallbackStates.Load(); if (callback == null) { callback = new CallbackStates(); } // 登录数据 loginSucc = new LoginRet(); loginSucc.flag = (int)eFlag.eFlag_Succ; loginSucc.desc = ":-) , QQ授权成功 cb: content: success statusCode: 200"; loginSucc.platform = (int)ePlatform.ePlatform_QQ; loginSucc.pf_key = "e9638c4ea7295ae02ebf1f529239bd65"; loginSucc.open_id = "D51F963BA3E2571ABD8244D95F9B9AD0"; loginSucc.pf = "desktop_m_qq-73213123-android-00000000-qq-100703379-D51F963BA3E2571ABD8244D95F9B9AD0"; List <TokenRet> token = new List <TokenRet>(); token.Add(new TokenRet(eTokenType.eToken_QQ_Access, "B8B01FC091389DF970D534AE6003B54D", 1465110708)); token.Add(new TokenRet(eTokenType.eToken_QQ_Pay, "48E5BC4FC984CDF842CDC64D32B669E8", 1457939508)); loginSucc.token = token; loginFail = new LoginRet(); loginFail.flag = (int)eFlag.eFlag_Error; loginFail.desc = "Login fail"; loginFail.platform = (int)ePlatform.ePlatform_QQ; loginFail.open_id = "D51F963BA3E2571ABD8244D95F9B9AD0"; // 实名认证 authSucc = new RealNameAuthRet(); authSucc.flag = (int)eFlag.eFlag_Succ; authSucc.desc = "实名认证成功"; authSucc.platform = (int)ePlatform.ePlatform_QQ; authFail = new RealNameAuthRet(); authFail.flag = (int)eFlag.eFlag_Error; authFail.desc = "实名认证失败"; authFail.platform = (int)ePlatform.ePlatform_QQ; authFail.errorCode = RealNameAuthErrCode.eErrCode_InvalidIDCard; // 分享数据 shareSucc = new ShareRet(); shareSucc.flag = (int)eFlag.eFlag_Succ; shareSucc.desc = "Share success"; shareSucc.platform = (int)ePlatform.ePlatform_QQ; shareSucc.extInfo = "QQ share extInfo"; shareFail = new ShareRet(); shareFail.flag = (int)eFlag.eFlag_Error; shareFail.desc = "Share fail"; shareFail.platform = (int)ePlatform.ePlatform_QQ; shareFail.extInfo = "QQ share extInfo"; // 关系链数据 relationSucc = new RelationRet(); relationSucc.flag = (int)eFlag.eFlag_Succ; relationSucc.desc = "com.tencent.msdk.remote.api.QueryQQFriends ret: 0 msg: success"; relationSucc.platform = (int)ePlatform.ePlatform_QQ; PersonInfo personInfo = new PersonInfo(); personInfo.nickName = "demo玩家Blwn2🕶⚽ ➕ ❤ = I love football"; personInfo.openId = "D51F963BA3E2571ABD8244D95F9B9AD0"; personInfo.pictureSmall = "http://q.qlogo.cn/qqapp/100703379/D51F963BA3E2571ABD8244D95F9B9AD0/40"; personInfo.pictureMiddle = "http://q.qlogo.cn/qqapp/100703379/D51F963BA3E2571ABD8244D95F9B9AD0/40"; personInfo.pictureLarge = "http://q.qlogo.cn/qqapp/100703379/D51F963BA3E2571ABD8244D95F9B9AD0/100"; personInfo.isFriend = false; personInfo.gender = "男"; relationSucc.persons.Add(personInfo); relationCleanLoc = new RelationRet(); relationCleanLoc.flag = (int)eFlag.eFlag_Succ; relationCleanLoc.desc = "{\"msg\":\"success\",\"ret\":\"0\"}"; relationFail = new RelationRet(); relationFail.flag = (int)eFlag.eFlag_Error; relationFail.desc = "Query relation fail"; // 第三方拉起游戏数据 wakeupRet = new WakeupRet(); wakeupRet.flag = eFlag.eFlag_NeedSelectAccount; wakeupRet.platform = (int)ePlatform.ePlatform_QQ; wakeupRet.open_id = "7675FCD4A008A6BBA75809D54CFC9BE2"; wakeupRet.extInfo.Add(new KVPair("platform", "qq_m")); wakeupRet.extInfo.Add(new KVPair("leftViewText", "游戏详情")); wakeupRet.extInfo.Add(new KVPair("launchfrom", "sq_gamecenter")); wakeupRet.extInfo.Add(new KVPair("fling_action_key", "2")); wakeupRet.extInfo.Add(new KVPair("current_uin", "7675FCD4A008A6BBA75809D54CFC9BE2")); wakeupRet.extInfo.Add(new KVPair("openid", "7675FCD4A008A6BBA75809D54CFC9BE2")); wakeupRet.extInfo.Add(new KVPair("fling_code_key", "1099963824")); wakeupRet.extInfo.Add(new KVPair("atoken", "B8B01FC091389DF970D534AE6003B54D")); wakeupRet.extInfo.Add(new KVPair("ptoken", "48E5BC4FC984CDF842CDC64D32B669E8")); // 群相关数据 groupSucc = new GroupRet(); groupSucc.flag = (int)eFlag.eFlag_Succ; groupSucc.platform = (int)ePlatform.ePlatform_QQ; groupSucc.desc = "call WGBindQQGroup finished ,but not sure succ or failed"; groupSucc.errorCode = 0; QQGroup qqgroup = new QQGroup(); qqgroup._groupId = "groupId0"; qqgroup._groupName = "_groupName0"; QQGroup qqgroup1 = new QQGroup(); qqgroup1._groupId = "groupId1"; qqgroup1._groupName = "_groupName1"; List <QQGroup> qqGroups = new List <QQGroup>(); qqGroups.Add(qqgroup); qqGroups.Add(qqgroup1); QQGroupInfoV2 qqGroupInfoV2 = new QQGroupInfoV2(); qqGroupInfoV2._guildId = "1"; qqGroupInfoV2._guildName = "name"; qqGroupInfoV2._relation = 3; qqGroupInfoV2._qqGroups = qqGroups; groupSucc.mQQGroupInfoV2 = qqGroupInfoV2; groupFail = new GroupRet(); groupFail.flag = (int)eFlag.eFlag_Error; groupFail.desc = "com.tencent.msdk.qq.group.QueryQQGroup ret: -10000 msg: 2002,没有绑定记录,请检查公会id和区id。"; groupFail.errorCode = 2002; // 微信卡卷数据 cardSucc = new CardRet(); cardSucc.flag = (int)eFlag.eFlag_Succ; cardSucc.platform = (int)ePlatform.ePlatform_None; cardSucc.open_id = "oGRTijiYT4CaRfydUbDFR25kAmwQ"; cardSucc.extInfo.Add(new KVPair("wxapi_add_card_to_wx_card_list", "{\"card_list\":[{\"card_id\":\"pe7Gmjg3EpKtnwzNAGHMGJhNKSo4\",\"" + "card_ext\":\"{\\\"code\\\":\\\"\\\",\\\"openid\\\":\\\"\\\",\\\"timestamp\\\":\\\"1111111111\\\"," + "\\\"signature\\\":\\\"sdffsfffff\\\"}\",\"is_succ\":0}]}")); cardFail = new CardRet(); cardFail.flag = (int)eFlag.eFlag_Error; cardFail.platform = (int)ePlatform.ePlatform_None; cardFail.desc = "Bind card fail"; // Lbs数据 locationSucc = new LocationRet(); locationSucc.flag = (int)eFlag.eFlag_Succ; locationSucc.platform = (int)ePlatform.ePlatform_QQ; locationSucc.desc = "com.tencent.msdk.remote.api.GetLocationInfo ret: 0 msg: success"; locationSucc.latitude = 22.547855; locationSucc.longitude = 113.94498; locationFail = new LocationRet(); locationFail.flag = (int)eFlag.eFlag_LbsNeedOpenLocationService; locationFail.platform = (int)ePlatform.ePlatform_None; locationFail.desc = "location service is closed!"; locationFail.latitude = 0; locationFail.longitude = 0; nearbySucc = new RelationRet(); relationSucc.flag = (int)eFlag.eFlag_Succ; relationSucc.desc = "com.tencent.msdk.remote.api.QueryNearbyPlayer ret: 0 msg: success"; relationSucc.platform = (int)ePlatform.ePlatform_QQ; personInfo = new PersonInfo(); personInfo.nickName = "demo玩家B"; personInfo.openId = "D51F963BA3E2571ABD8244D95F9B9AD0"; personInfo.distance = 2; personInfo.timestamp = 1458728556; personInfo.isFriend = true; personInfo.gender = "男"; personInfo.pictureSmall = "http://q.qlogo.cn/qqapp/100703379/D51F963BA3E2571ABD8244D95F9B9AD0/40"; personInfo.pictureMiddle = "http://q.qlogo.cn/qqapp/100703379/D51F963BA3E2571ABD8244D95F9B9AD0/40"; personInfo.pictureLarge = "http://q.qlogo.cn/qqapp/100703379/D51F963BA3E2571ABD8244D95F9B9AD0/100"; relationSucc.persons.Add(personInfo); personInfo = new PersonInfo(); personInfo.nickName = "MSDK-qingcui2"; personInfo.openId = "57388C7E931F9D12AC8C86E9C78655C8"; personInfo.distance = 2; personInfo.timestamp = 1458728597; personInfo.isFriend = true; personInfo.gender = "女"; personInfo.pictureSmall = "http://q.qlogo.cn/qqapp/100703379/57388C7E931F9D12AC8C86E9C78655C8/40"; personInfo.pictureMiddle = "http://q.qlogo.cn/qqapp/100703379/57388C7E931F9D12AC8C86E9C78655C8/40"; personInfo.pictureLarge = "http://q.qlogo.cn/qqapp/100703379/57388C7E931F9D12AC8C86E9C78655C8/100"; relationSucc.persons.Add(personInfo); nearbyFail = new RelationRet(); nearbyFail.flag = (int)eFlag.eFlag_LbsNeedOpenLocationService; nearbyFail.platform = (int)ePlatform.ePlatform_None; nearbyFail.desc = "location service is closed!"; //web View 数据 webviewRet = new WebviewRet(); webviewRet.flag = 0; webviewRet.desc = "浏览器打开关闭回调,0" + eFlag.eFlag_Succ + "为打开回调," + eFlag.eFlag_Webview_closed + "为关闭回调"; groupUnbind = new GroupRet(); groupUnbind.flag = 0; groupUnbind.desc = "解绑成功"; }