public void getOperatorTest() { Ran rt1 = new Ran(); Random rand = new Random(); int d = rand.Next(4); char c = Ran.getOperator(); char f; switch (d) { case 0: d = '+'; break; case 1: d = '-'; break; case 2: d = '*'; break; case 3: d = '/'; break; } Assert.AreEqual(c, d); }
public static void Main(string[] args) { Ran rn = new Ran(); lista = rn.GetLista(15, 1, 55); Console.WriteLine("premi un tasto per uscire..."); Console.ReadKey(); }
internal long MakeSessionId() { lock (Ran) { long c = 630822816000000000; //2000-1-1 0:0:0:0 long x = DateTime.Now.Ticks; long m = ((x - c) * 1000) + Ran.Next(1000); return(m); } }
public ShootingStarShard(StageDataPackage StageData, PointF OriginalPosition) : base(StageData, "StarShardBS", OriginalPosition) { Region = 8; AngularVelocity = 0.0f; DirectionDegree += Ran.Next(-49, 50) / 10.0; TransparentValueF = 0.0f; TransparentVelocity = 16f; Active = true; ColorValue = Color.Blue; }
private void LooseBurgers() { Ammo -= 3; for (int i = 0; i < 3; i++) { Vector2 spawnpoint = Vector2.Add(Position, new Vector2(BoundingBox.Width / 2, BoundingBox.Height - 20)); Burger burger = new Burger(game.BurgerTexture, spawnpoint); burger.Velocity = new Vector2(Ran.Next(3) - 1, Ran.Next(3) - 1); game.Level.SpawnSpriteAtRuntime(burger); blink = true; } }
public override void Ctrl() { base.Ctrl(); Region = (int)(TxtureObject.Width / 2.0 * 0.699999988079071); if (Time < LifeTime - 50) { TransparentValueF = 150 + Ran.Next(40); } else { TransparentValueF = (LifeTime - Time) * 2 - 20 + Ran.Next(40); } }
public void Build() { // 10 for (int j = 0; j < Height; j++) { var line = World.AsSpan((int)(j * Width), (int)Width); for (int i = 0; i < Width; i++) { if (Ran.Next(3) == 1) { line[i] = true; } } } }
public override void HitCheckAll() { if (HitCheck(MyPlane, 48f)) { Obtain = true; } if (!HitCheck(MyPlane)) { return; } ItemList.Remove(this); if (ColorValue == Color.Red) { MyPlane.LastColor = EnchantmentType.Red; } else if (ColorValue == Color.Blue) { MyPlane.LastColor = EnchantmentType.Blue; } else if (ColorValue == Color.Green) { MyPlane.LastColor = EnchantmentType.Green; } MyPlane.StarPoint += 800; if (ColorValue == Color.Red) { ++MyPlane.LifeChip; } else if (ColorValue == Color.Blue) { MyPlane.HighItemScore += 5000; } else if (ColorValue == Color.Green) { ++MyPlane.SpellChip; } StageData.SoundPlay("se_item00.wav", OriginalPosition.X / BoundRect.Width); for (int index = 0; index < 50; ++index) { ParticleSmaller particleSmaller = new ParticleSmaller(StageData, "光点", Position, Ran.Next(20, 200) / 10, Ran.Next(360) / 180.0 * Math.PI) { LifeTime = 20, Scale = Ran.Next(100) / 100f, TransparentValueF = 200f, ColorValue = ColorValue }; } }
public override void Shoot() { int num1 = 160 - Time; int num2 = 10; for (int index = 0; index < num2; ++index) { PointF OriginalPosition = new PointF(); ref PointF local1 = ref OriginalPosition; PointF originalPosition = OriginalPosition; double num3 = originalPosition.X + num1 * Math.Sin(Angle) + Ran.Next(-15, 15); originalPosition = OriginalPosition; double num4 = originalPosition.Y + num1 * Math.Cos(Angle) + Ran.Next(-15, 15); local1 = new PointF((float)num3, (float)num4); StarItem_Touhou starItemTouhou1 = new StarItem_Touhou(StageData, OriginalPosition); ref PointF local2 = ref OriginalPosition;
public JsonResult registGetPasswordrationJson(string AccdanhNhap_Email, string EmailLayPass) { /* * 1 la tai khoan khong chinh xac * 2 la gmail khong chinh xac * 3 la thanh cong * 0 la he thong gap loi */ string Trave = ""; try { if (db.accs.Where(n => n.taikhoan == AccdanhNhap_Email).Count() == 1) { if (db.accs.Where(n => n.taikhoan == AccdanhNhap_Email && n.email == EmailLayPass).Count() == 1) { guiMail gm = new guiMail(); Ran r = new Ran(); if (gm.ToguiMail(EmailLayPass, r.songaunhien().ToString()) == true) { Trave = "3"; } else { Trave = "0"; } } else { Trave = "2"; } } else { Trave = "1"; } } catch (Exception) { Trave = "0"; } return(Json(Trave)); }
public JsonResult laymk(string taikhoan, string gmail) { string trave = ""; if (taikhoan == null || taikhoan == "" || gmail == null || gmail == "") { trave = "3"; } else { try { Ran a = new Ran(); int songaunhien = a.songaunhien(); guiMail g = new guiMail(); var taiKhoanLayDuoc = db.accs.Where(n => n.taikhoan == taikhoan.Trim() && n.email == gmail.Trim()); if (taiKhoanLayDuoc.Count() == 1) { if (g.ToguiMail(gmail, Convert.ToString(songaunhien).Trim()) == true) { taiKhoanLayDuoc.FirstOrDefault().matkhau = MD5.ToMD5(Convert.ToString(songaunhien).Trim()); db.SaveChanges(); trave = "1"; } else { //gui mail den tai khoan cua ban trave = "2"; } } else { trave = "0"; } } catch (Exception) { trave = "2"; } } return(Json(trave)); }
public override void Shoot() { if (Time < StartTime || Time > StartTime + Duration) { return; } int num1 = Circle + (int)(RanCircle * Ran.NextPMDouble()); int num2 = num1 < 1 ? 1 : num1; if (!DeepBinding && (Time - StartTime + 1) % num2 == 0) { ShootBullet(); } else { if (!DeepBinding || Time % num2 != 0) { return; } ShootBullet(); } }
public override void Ctrl() { if (Time == StartTime) { Velocity += RanVelocity * (float)Ran.NextPMDouble(); DirectionDegree += RanDirection * Ran.NextPMDouble(); AccelerateCS += RanAccelerate * (float)Ran.NextPMDouble(); AccDirection += RanAccDirection * Ran.NextPMDouble(); } if (LifeTime > StartTime + Duration) { LifeTime = StartTime + Duration; } if (Range != 360.0) { RangeShoot = true; } if (BindingObj != null && BindingObj is BaseEnemyPlane_Touhou && BindingObj.HealthPoint <= 0.0) { EnemyPlaneList.Remove(this); } base.Ctrl(); }
protected virtual void OnRan(EventArgs <IJob> e) { Ran?.Invoke(this, e); }
/// <inheritdoc /> public Foo() { Count = Ran.Next(); }
/// <summary> /// /// </summary> /// <param name="value"></param> protected void OnRan(ICommand value) { Ran?.Invoke(this, value); }
//static List<string> _list = new List<string>(); private static string RandomRenderType() { var t = RenTypes[Ran.Next(0, RenTypes.Count())]; return(t); }
private void OnRan() { Ran?.Invoke(this, EventArgs.Empty); }
protected void Page_Load(object sender, EventArgs e) { Ran check = new Ran(); if (Request.Cookies["userName"] != null) { userName.Text = Request.Cookies["userName"].Value; } }
private void OnRan(ICogTool tool) { Ran?.Invoke(tool, LastRunResult); }
public void ShootBullet() { float x = EmitPoint.X; float y = EmitPoint.Y; PointF originalPosition; float num1; if (x == -99999.0) { originalPosition = MyPlane.OriginalPosition; num1 = originalPosition.X; } else if (x == -99998.0) { originalPosition = this.OriginalPosition; num1 = originalPosition.X; } else { num1 = (float)(x - 320.0 + 192.0); } float num2; if (y == -99999.0) { originalPosition = MyPlane.OriginalPosition; num2 = originalPosition.Y; } else if (y == -99998.0) { originalPosition = this.OriginalPosition; num2 = originalPosition.Y; } else { num2 = (float)(y - 240.0 + 224.0); } if (EmitterMode == EmitterMode.StraightLaser || EmitterMode == EmitterMode.RadialLaser || EmitterMode == EmitterMode.BendLaser) { originalPosition = this.OriginalPosition; num1 = originalPosition.X; originalPosition = this.OriginalPosition; num2 = originalPosition.Y; } PointF OriginalPosition = new PointF(num1 + RanX * (float)Ran.NextPMDouble(), num2 + RanY * (float)Ran.NextPMDouble()); double edi = EmitDirection != -99999.0 ? (EmitDirection + RanEmitDirection * Ran.NextPMDouble() + SubBullet.RanDirection * Ran.NextPMDouble()) * Math.PI / 180.0 : GetDirection(MyPlane) + (RanEmitDirection * Ran.NextPMDouble() + SubBullet.RanDirection * Ran.NextPMDouble()) * Math.PI / 180.0; double num3 = RadiusDirection != -99999.0 ? (RadiusDirection + RanRadiusDirection * Ran.NextPMDouble()) * Math.PI / 180.0 : GetDirection(MyPlane) + RanRadiusDirection * Ran.NextPMDouble() * Math.PI / 180.0; float num4 = EmitRadius + RanRadius * (float)Ran.NextPMDouble(); int num5 = Way + (int)(RanWay * Ran.NextPMDouble()); float num6 = SubBullet.Velocity + SubBullet.RanVelocity * (float)Ran.NextPMDouble(); float num7 = SubBullet.AccelerateCS + SubBullet.RanAccelerate * (float)Ran.NextPMDouble(); double num8 = SubBullet.AccDirection + SubBullet.RanAccDirection; double num9 = Range + RanRange * Ran.NextPMDouble(); if (RDirectionWithDirection) { num3 += edi; } double num10 = num9 * Math.PI / 180.0 / num5; edi -= (num5 - 1) * num10 / 2.0; double num11 = num3 - (num5 - 1) * num10 / 2.0; if (EffectType == 2) { EmitterSaveEnegy3D emitterSaveEnegy3D = new EmitterSaveEnegy3D(StageData, OriginalPosition, CSEffect.ColorValue); StageData.SoundPlay("se_ch02.wav"); } else if (EffectType == 3) { EmitterGiveOutEnegy3D emitterGiveOutEnegy3D = new EmitterGiveOutEnegy3D(StageData, OriginalPosition, CSEffect.ColorValue); StageData.SoundPlay("se_cat00.wav"); StageData.SoundPlay("se_enep02.wav"); } else { for (int index1 = 0; index1 < num5; ++index1) { PointF p = new PointF(OriginalPosition.X + num4 * (float)Math.Cos(num11), OriginalPosition.Y + num4 * (float)Math.Sin(num11)); for (int index2 = 0; index2 < Count; ++index2) { if (EmitterMode == EmitterMode.Bullet || EmitterMode == EmitterMode.StraightLaser || EmitterMode == EmitterMode.RadialLaser || EmitterMode == EmitterMode.BendLaser) { BaseBullet_Touhou b = new BaseBullet_Touhou(StageData); if (CSBullet != null) { b = (BaseBullet_Touhou)CSBullet.Clone(); b.OriginalPosition = p; b.GhostingCount = b.GhostingCount; b.AngleDegree += CSBullet.RanAngle * Ran.NextPMDouble(); } else if (CSLaserS != null) { b = (BaseBullet_Touhou)CSLaserS.Clone(); b.OriginalPosition = p; b.Angle = -1.0 * Math.PI / 2.0; b.Active = true; } else if (CSLaserR != null) { b = (BaseBullet_Touhou)CSLaserR.Clone(); b.OriginalPosition = p; b.Angle = Math.PI / 2.0; b.UnRemoveable = true; b.Active = true; } else if (CSLaserB != null) { b = (BaseBullet_Touhou)CSLaserB.Clone(); b.OriginalPosition = p; b.UnRemoveable = true; b.Active = true; } b.GhostingCount = b.GhostingCount; b.Velocity = num6 - index2 * DeltaV; b.Direction = edi; b.AccelerateCS = num7; b.AccDirection = num8; b.ID = ID; b.LayerID = LayerID; if (MotionBinding) { b.SetBinding(this); } BulletList.Add(b); if (EmitterMode == EmitterMode.Bullet) { CSData.EmitterList.ForEach(em => { if (em.BindingID != ID) { return; } b.UnRemoveable = true; BaseEmitter_CS baseEmitterCs = (BaseEmitter_CS)em.Clone(); StageData.EnemyPlaneList.Add(baseEmitterCs); baseEmitterCs.OriginalPosition = p; baseEmitterCs.LifeTime = SubBullet.LifeTime; baseEmitterCs.ColorValue = SubBullet.ColorValue; baseEmitterCs.TransparentValueF = SubBullet.TransparentValueF; baseEmitterCs.Direction = edi; baseEmitterCs.DestPoint = SubBullet.DestPoint; baseEmitterCs.Active = SubBullet.Active; baseEmitterCs.OutBound = SubBullet.OutBound; if (baseEmitterCs.BindWithDirection) { baseEmitterCs.EmitDirection += edi * 180.0 / Math.PI; } baseEmitterCs.SetBinding(b); if (!baseEmitterCs.DeepBinding) { baseEmitterCs.Time = Time; baseEmitterCs.LifeTime = Math.Min(SubBullet.LifeTime + Time, em.StartTime + em.Duration); } }); } } else if (EmitterMode == EmitterMode.Enemy) { BaseEnemyPlane_Touhou enemy = (BaseEnemyPlane_Touhou)SubBullet.Clone(); enemy.LifeTime = 0; enemy.OriginalPosition = p; enemy.GhostingCount = enemy.GhostingCount; enemy.Velocity = num6 - index2 * DeltaV; enemy.Direction = edi; enemy.AccelerateCS = num7; enemy.AccDirection = num8; enemy.ID = ID; enemy.LayerID = LayerID; if (MotionBinding) { enemy.SetBinding(this); } EnemyPlaneList.Add(enemy); CSData.EmitterList.ForEach(em => { if (em.BindingID != ID) { return; } BaseEmitter_CS baseEmitterCs = (BaseEmitter_CS)em.Clone(); StageData.EnemyPlaneList.Add(baseEmitterCs); baseEmitterCs.OriginalPosition = p; baseEmitterCs.LifeTime = SubBullet.LifeTime; baseEmitterCs.ColorValue = SubBullet.ColorValue; baseEmitterCs.TransparentValueF = SubBullet.TransparentValueF; baseEmitterCs.Direction = edi; baseEmitterCs.DestPoint = SubBullet.DestPoint; baseEmitterCs.Active = SubBullet.Active; baseEmitterCs.OutBound = SubBullet.OutBound; baseEmitterCs.SetBinding(enemy); if (baseEmitterCs.BindWithDirection) { baseEmitterCs.EmitDirection += edi * 180.0 / Math.PI; } if (!baseEmitterCs.DeepBinding) { baseEmitterCs.Time = Time; baseEmitterCs.LifeTime = Math.Min(SubBullet.LifeTime + Time, em.StartTime + em.Duration); } }); } else if (EmitterMode == EmitterMode.Effect) { BaseEffect_CS baseEffectCs = (BaseEffect_CS)CSEffect.Clone(); baseEffectCs.OriginalPosition = p; baseEffectCs.GhostingCount = baseEffectCs.GhostingCount; baseEffectCs.AngleDegree += CSEffect.RanAngle * Ran.NextPMDouble(); baseEffectCs.Velocity = num6 - index2 * DeltaV; baseEffectCs.Direction = edi; baseEffectCs.AccelerateCS = num7; baseEffectCs.AccDirection = num8; baseEffectCs.ID = ID; baseEffectCs.LayerID = LayerID; if (MotionBinding) { baseEffectCs.SetBinding(this); } EffectList.Add(baseEffectCs); } } num11 += num10; edi += num10; if (SpecifySE) { StageData.SoundPlay(SoundName); } else if (EmitterMode == EmitterMode.Bullet) { StageData.SoundPlay("se_tan00a.wav", OriginalPosition.X / BoundRect.Width); } else if (EmitterMode == EmitterMode.StraightLaser || EmitterMode == EmitterMode.RadialLaser) { StageData.SoundPlay("se_lazer00.wav", OriginalPosition.X / BoundRect.Width); } } } }
public override void Ctrl() { base.Ctrl(); if (1 < Time && Time < 60) { int num1 = 7; double num2 = 360.0 / num1; for (int index = 0; index < num1; ++index) { BaseEffect baseEffect1 = new BaseEffect(StageData, "bullet23_0", Position, 1.5f, 0.0) { DirectionDegree = Time * 18 + num2 * index, ScaleWidth = 0.3f, ScaleLength = 0.3f, LifeTime = 999 }; BaseEffect baseEffect2 = baseEffect1; baseEffect2.OutBound = false; baseEffect2.DirectionVelocityDegree = -2.8f; baseEffect2.VelocityDictionary.Add(40, 3f); baseEffect2.AccelerateDictionary.Add(115, 2f); baseEffect2.AccelerateDictionary.Add(123, 0.0f); baseEffect2.DirectionVelocityDegreeDictionary.Add(115, (float)((Ran.NextPMDouble() - 80.0) / 45.0)); baseEffect2.DirectionVelocityDegreeDictionary.Add(160, 0.0f); baseEffect2.ScaleLengthVelocityDictionary.Add(115, 0.3f); baseEffect2.ScaleWidthVelocityDictionary.Add(115, 0.1f); baseEffect2.ScaleLengthVelocityDictionary.Add(120, 0.0f); baseEffect2.ScaleWidthVelocityDictionary.Add(120, 0.0f); baseEffect2.SetBinding(this); BaseEffect baseEffect3 = new BaseEffect(StageData, "bullet23_0", Position, 1.5f, 0.0) { DirectionDegree = 180 - Time * 18 + num2 * index, ScaleWidth = 0.3f, ScaleLength = 0.3f, LifeTime = 999 }; BaseEffect baseEffect4 = baseEffect3; baseEffect4.OutBound = false; baseEffect4.DirectionVelocityDegree = 2.8f; baseEffect4.VelocityDictionary.Add(40, 3f); baseEffect4.AccelerateDictionary.Add(115, 2f); baseEffect4.AccelerateDictionary.Add(123, 0.0f); baseEffect4.DirectionVelocityDegreeDictionary.Add(115, (float)((80.0 + Ran.NextPMDouble()) / 45.0)); baseEffect4.DirectionVelocityDegreeDictionary.Add(160, 0.0f); baseEffect4.ScaleLengthVelocityDictionary.Add(115, 0.3f); baseEffect4.ScaleWidthVelocityDictionary.Add(115, 0.1f); baseEffect4.ScaleLengthVelocityDictionary.Add(120, 0.0f); baseEffect4.ScaleWidthVelocityDictionary.Add(120, 0.0f); baseEffect4.SetBinding(this); } } if (130 < Time && Time < 220) { for (int index = 0; index < 3; ++index) { BaseEffect_CS baseEffectCs1 = new BaseEffect_CS(StageData) { TxtureObject = TextureObjectDictionary["bullet50_0"] }; BaseEffect_CS baseEffectCs2 = baseEffectCs1; Rectangle boundRect = BoundRect; double num1 = boundRect.Width / 2 + 200.0 * Ran.NextPMDouble(); boundRect = BoundRect; double num2 = boundRect.Height / 2 + 280.0 * Ran.NextPMDouble(); PointF pointF = new PointF((float)num1, (float)num2); baseEffectCs2.OriginalPosition = pointF; baseEffectCs1.Velocity = (float)Ran.NextPMDouble(); baseEffectCs1.Direction = Math.PI / 2.0 * Ran.NextPMDouble(); baseEffectCs1.Scale = 0.05f; baseEffectCs1.LifeTime = 40; EventGroup eventGroup = new EventGroup(); eventGroup.index = 0; eventGroup.tag = "0"; eventGroup.t = 15; eventGroup.addtime = 15; Event event1 = new Event(); event1.EventString = "当前帧=1:高比变化到0,正弦,14"; event1.String2BulletEvent(); eventGroup.EventList.Add(event1); Event event2 = new Event(); event2.EventString = "当前帧=1:宽比变化到0,正弦,14"; event2.String2BulletEvent(); eventGroup.EventList.Add(event2); baseEffectCs1.EventGroupList.Add(eventGroup); EffectList.Add(baseEffectCs1); } } if (Time != 122) { return; } ScaleVelocity = 10f; EmitterGiveOutEnegy3D emitterGiveOutEnegy3D = new EmitterGiveOutEnegy3D(StageData, OriginalPosition, Color.White); StageData.SoundPlay("se_cat00.wav"); StageData.VibrateStart(LifeTime - Time); }