private string Datestr() { //mouseDownTime //lastSucceedTime //startTime ActionDate ad = new ActionDate(); GameData gd = new GameData(); ad.score = score; ad.times = times; var startTime = GetTimeStamp(DateTime.Now) - 1500000; gd.seed = GetTimeStamp(DateTime.Now); gd.action = new List <object>(); gd.musicList = new List <bool>(); gd.touchList = new List <object>(); gd.steps = new List <IList <double> >(); gd.timestamp = new List <long>(); for (var i = 0; i < score; i++) { Random rd = new Random(); var r = rd.NextDouble(); gd.action.Add(new object[3] { Math.Round(r, 3), Math.Round(r * 2, 2), i / 5000 == 0 ? true : false }); gd.musicList.Add(false); var touch_x = 250 - Math.Round(r * 10, 4); var touch_y = 650 - Math.Round(r * 10, 4); gd.touchList.Add(new object[2] { touch_x, touch_y }); IList <double> touchMoveList = new List <double>(); for (int l = 0; l < 5; l++) { touchMoveList.Add(touch_x); touchMoveList.Add(touch_y); } gd.steps.Add(touchMoveList); long newTime = startTime + (int)Math.Round(r * 2700); gd.timestamp.Add(newTime); startTime = newTime; } gd.version = 2; var s2 = WriteFromObject <GameData>(gd); ad.game_data = s2; var text = WriteFromObject <ActionDate>((Object)ad); var ActionData = AESEncrypt(text, session_id); return(ActionData); }
private void Datestr() { currentScore = 0; int perScore = 1; int addScore = 0; long succeedTime = 0; //long mouseDownTime; int order = 15; int StayTime; bool musicScore = false; IList <int> OrderList = new List <int>(); //特殊方框概率 IList <bool> IsDouble = new List <bool>(); //连击概率 int Count = 0; for (int i = 0; i < 100; i++) { if (i < 60) { OrderList.Add(15);//1 IsDouble.Add(false); } else { if (i < 78) { IsDouble.Add(false); OrderList.Add(26);//5 } else if (i < 86) { IsDouble.Add(false); OrderList.Add(17);//10 } else if (i < 95) { IsDouble.Add(true); OrderList.Add(24);//15 } else { IsDouble.Add(true); OrderList.Add(19);//30 } } } ActionDate ad = new ActionDate(); GameData gd = new GameData(); startTime = GetTimeStamp(DateTime.Now); gd.action = new List <object>(); gd.musicList = new List <bool>(); gd.touchList = new List <object>(); gd.steps = new List <IList <double> >(); gd.timestamp = new List <long>(); Random ran; int stoptime; int t; double d; double duration; int o; double calY; int x; int y; double touch_x; double touch_y; int WaitTime; long touchStartTime; do { ran = new Random(); stoptime = ran.Next(200, 500); WaitTime = ran.Next(1000, 2000); //mouseDownTime = succeedTime + StayTime + WaitTime; Thread.Sleep(WaitTime);//停留时间 d = ran.NextDouble() * 4 / 1000 + 1.88; o = ran.Next(0, 99); order = OrderList[o]; if (order != 15) { if (Count < 4) { order = 15; StayTime = 0; } else { musicScore = true;//特殊方框 StayTime = ran.Next(2100, 2300); } } else { StayTime = 0; } if (IsDouble[o])//连击 { if (Count < 1) { perScore = 1; } else { perScore = perScore * 2 > 32 ? 32 : perScore * 2; } } else { perScore = 1; } Thread.Sleep(StayTime);//特殊方框 停留时间 touchStartTime = GetTimeStamp(DateTime.Now) + WaitTime + StayTime; //touchStartTime = GetTimeStamp(DateTime.Now); t = ran.Next(300, 1000);//按压时间 duration = t / 1000; //Thread.Sleep(t); //Thread.Sleep((int)Math.Round((135 + 15 * duration) * 2000 / 720));//飞行时间 calY = Math.Round(2.75 - d * duration, 2); gd.action.Add(new object[3] { duration, calY, false }); gd.musicList.Add(musicScore); x = ran.Next(120, 165); y = ran.Next(480, 500); touch_x = x + (x % 4) * 0.25; touch_y = y + (y % 4) * 0.25; gd.touchList.Add(new object[2] { touch_x, touch_y }); IList <double> touchMoveList = new List <double>(); if (t < 410) { for (int l = 0; l < 3; l++) { touchMoveList.Add(touch_x); touchMoveList.Add(touch_y); } } else if (t < 450) { for (int l = 0; l < 4; l++) { touchMoveList.Add(touch_x); touchMoveList.Add(touch_y); } } else { for (int l = 0; l < 5; l++) { touchMoveList.Add(touch_x); touchMoveList.Add(touch_y); } } gd.steps.Add(touchMoveList); if (succeedTime == 0) { succeedTime = startTime; } gd.timestamp.Add(touchStartTime); succeedTime = touchStartTime + t + (int)Math.Round((135 + 15 * duration) * 2000 / 720); //succeedTime = GetTimeStamp(DateTime.Now); switch (order)//特殊分值 { case 26: addScore = 5; break; case 17: addScore = 10; break; case 24: addScore = 15; break; case 19: addScore = 30; break; default: addScore = 0; break; } currentScore = currentScore + perScore + addScore; OnTouch?.Invoke(currentScore); Count++; } while (currentScore <= score); var s = succeedTime - startTime + 200; for (int i = 0; i < Count; i++) { gd.timestamp[i] = gd.timestamp[i] - s; } startTime = startTime - s; endTime = succeedTime - s; ad.score = score; ad.times = times; gd.seed = startTime; gd.version = 2; var jSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; var s2 = JsonConvert.SerializeObject(gd, jSetting); ad.game_data = s2; var text = JsonConvert.SerializeObject(ad, jSetting); ActionData = AESEncrypt(text, session_id); OnTouchEnd?.Invoke(); //return ActionData; }
private string Datestr() { currentScore = 0; int perScore = 1; int addScore = 0; long succeedTime = 0; long mouseDownTime; int order = 15; int StayTime; bool musicScore = false; IList <int> OrderList = new List <int>(); IList <bool> IsDouble = new List <bool>(); int Count = 0; for (int i = 0; i < 100; i++) { if (i < 60) { OrderList.Add(15);//1 IsDouble.Add(false); } else { if (i < 78) { IsDouble.Add(false); OrderList.Add(26);//5 } else if (i < 86) { IsDouble.Add(false); OrderList.Add(17);//10 } else if (i < 95) { IsDouble.Add(true); OrderList.Add(24);//15 } else { IsDouble.Add(true); OrderList.Add(19);//30 } } } ActionDate ad = new ActionDate(); GameData gd = new GameData(); startTime = GetTimeStamp(DateTime.Now); gd.action = new List <object>(); gd.musicList = new List <bool>(); gd.touchList = new List <object>(); gd.steps = new List <IList <double> >(); gd.timestamp = new List <long>(); do { Random ran = new Random(); int stoptime = ran.Next(200, 500); int t = ran.Next(300, 1000); double d = ran.NextDouble() * 4 / 1000 + 1.88; double duration = t / 1000; int o = ran.Next(0, 99); order = OrderList[o]; if (order != 15) { if (Count < 4) { order = 15; StayTime = 0; } else { musicScore = true; StayTime = ran.Next(2000, 3000); } } else { StayTime = 0; } if (IsDouble[o]) { if (Count < 1) { perScore = 1; } else { perScore = perScore * 2 > 32 ? 32 : perScore * 2; } } else { perScore = 1; } var calY = Math.Round(2.75 - d * duration, 2); gd.action.Add(new object[3] { duration, calY, false }); gd.musicList.Add(musicScore); var x = ran.Next(230, 245); var y = ran.Next(500, 530); var touch_x = x + (x % 4) * 0.25; var touch_y = y + (y % 4) * 0.25; gd.touchList.Add(new object[2] { touch_x, touch_y }); IList <double> touchMoveList = new List <double>(); if (t < 410) { for (int l = 0; l < 3; l++) { touchMoveList.Add(touch_x); touchMoveList.Add(touch_y); } } else if (t < 450) { for (int l = 0; l < 4; l++) { touchMoveList.Add(touch_x); touchMoveList.Add(touch_y); } } else { for (int l = 0; l < 5; l++) { touchMoveList.Add(touch_x); touchMoveList.Add(touch_y); } } gd.steps.Add(touchMoveList); if (succeedTime == 0) { succeedTime = startTime; } int WaitTime = ran.Next(1000, 3000); mouseDownTime = succeedTime + StayTime + WaitTime; gd.timestamp.Add(mouseDownTime); succeedTime = mouseDownTime + (long)Math.Round((135 + 15 * duration) * 2000 / 720) + t; switch (order) { case 26: addScore = 5; break; case 17: addScore = 10; break; case 24: addScore = 15; break; case 19: addScore = 30; break; default: addScore = 0; break; } currentScore = currentScore + perScore + addScore; Count++; } while (currentScore <= score); var s = gd.timestamp[Count - 1] - startTime + 200; for (int i = 0; i < Count; i++) { gd.timestamp[i] = gd.timestamp[i] - s; } startTime = startTime - s; endTime = succeedTime - s; ad.score = score; ad.times = times; gd.seed = startTime; gd.version = 2; var s2 = WriteFromObject <GameData>(gd); ad.game_data = s2; var text = WriteFromObject <ActionDate>((Object)ad); var ActionData = AESEncrypt(text, session_id); return(ActionData); }