public void Start() { _demo = (Demo)FindObjectOfType(typeof(Demo)); if (_demo == null) return; if (MinimapTexture == null) return; _fow = FoWManager.FindInstance(); if (_fow == null) return; _texture = new Texture2D(_demo.SizeX * Scale, _demo.SizeZ * Scale, TextureFormat.ARGB32, false, false); ClearTexture(); MinimapTexture.pixelInset = new Rect(-1 * _demo.SizeX * Scale, 0, _demo.SizeX * Scale, _demo.SizeZ * Scale); MinimapTexture.texture = _texture; UpdateMinimap(); _visibleColor = new Color32(255, 255, 255, 255); _exploredColor = new Color32(64, 64, 64, 255); _hiddenColor = new Color32(0, 0, 0, 255); _playerUnitColor = new Color32(32, 32, 255, 255); _playerTowerColor = _playerUnitColor; _enemyUnitColor = new Color32(255, 32, 32, 255); _enemyTowerColor = _enemyUnitColor; _enemyGhostColor = new Color32(255, 200, 32, 255); }
public MeshFactory(SharpDXGraphics graphics) { this.device = graphics.Device; this.inputAssembler = device.InputAssembler; this.demo = graphics.Demo; instanceDataDesc = new BufferDescription() { Usage = ResourceUsage.Dynamic, BindFlags = BindFlags.VertexBuffer, CpuAccessFlags = CpuAccessFlags.Write, OptionFlags = ResourceOptionFlags.None, }; InputElement[] elements = new InputElement[] { new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0), new InputElement("NORMAL", 0, Format.R32G32B32_Float, 12, 0, InputClassification.PerVertexData, 0), new InputElement("WORLD", 0, Format.R32G32B32A32_Float, 0, 1, InputClassification.PerInstanceData, 1), new InputElement("WORLD", 1, Format.R32G32B32A32_Float, 16, 1, InputClassification.PerInstanceData, 1), new InputElement("WORLD", 2, Format.R32G32B32A32_Float, 32, 1, InputClassification.PerInstanceData, 1), new InputElement("WORLD", 3, Format.R32G32B32A32_Float, 48, 1, InputClassification.PerInstanceData, 1), new InputElement("COLOR", 0, Format.R8G8B8A8_UNorm, 64, 1, InputClassification.PerInstanceData, 1) }; inputLayout = new InputLayout(device, graphics.GetEffectPass().Description.Signature, elements); groundColor = ColorToUint(Color.Green); activeColor = ColorToUint(Color.Orange); passiveColor = ColorToUint(Color.OrangeRed); softBodyColor = ColorToUint(Color.LightBlue); }
public void Load(Demo demo, PhysicsSimulator physicsSimulator) { _circleBody = new Body[_count]; _circleGeom = new Geom[_count]; _circleBody[0] = BodyFactory.Instance.CreateCircleBody(physicsSimulator, _radius, .1f); _circleBody[0].Position = _startPosition; demo.AddCircleToCanvas(_circleBody[0], _color, _radius); for (int i = 1; i < _count; i++) { _circleBody[i] = BodyFactory.Instance.CreateBody(physicsSimulator, _circleBody[0]); _circleBody[i].Position = Vector2.Lerp(_startPosition, _endPosition, i / (float)(_count - 1)); demo.AddCircleToCanvas(_circleBody[i], _color, _radius); } _circleGeom[0] = GeomFactory.Instance.CreateCircleGeom(physicsSimulator, _circleBody[0], _radius, 10); _circleGeom[0].RestitutionCoefficient = .7f; _circleGeom[0].FrictionCoefficient = .2f; _circleGeom[0].CollisionCategories = _collisionCategories; _circleGeom[0].CollidesWith = _collidesWith; for (int j = 1; j < _count; j++) { _circleGeom[j] = GeomFactory.Instance.CreateGeom(physicsSimulator, _circleBody[j], _circleGeom[0]); } }
public ActionResult DeleteUser(Demo.Models.D2LEnroll model) { UserData user; try { user = d2l.GetUserData(model.UserName); model.UserID = user.UserId; } catch (System.Exception e) { return Content("Error: " + e.ToString()); } if (user == null) { return Content("User Not Found"); } try { d2l.DeleteUser(model.OrgUnitID, model.UserID); } catch (System.Exception e1) { return Content ("Error:" + e1.ToString ()); } return Content("Success!"); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (Demo demo = new Demo()) { demo.Run(); } }
public void TestFindName() { WebClientExchanger.PersonName = "Jeff"; var actual = new Demo().FindName(); var expected = "Jeff"; Assert.AreEqual(expected, actual); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (Demo game = new Demo()) { game.Run(); } }
public static void Main() { WebClientExchanger.PersonName = "Jeff"; var actual = new Demo().FindName(); Console.WriteLine(actual); Console.WriteLine("Press any key to continue..."); Console.ReadKey(true); }
static void DecAndShowAttribute(Demo d) { SimpleAttribute attr1 = (SimpleAttribute) Attribute.GetCustomAttribute(d.GetType(), typeof(SimpleAttribute)); if (attr1.value == 0) return; Console.WriteLine(attr1.value--); DecAndShowAttribute(d); }
public void TestMethod1() { dynamic demo = new Demo(); demo.VoerIetsUit(); Demo2 demo2 = new Demo2(); demo2.Invoke("VoerIetsUit"); }
public static int Main () { int r = new Demo ().GetPhones (); if (r != 55) return 1; return 0; }
public static void Main(string[] args) { Console.WriteLine("Hello from .NET!"); // // create the proxy class Demo demo = new Demo(); demo.do_stuff(); }
public static void Main() { Application.Init(); Demo myWin = new Demo("Event demo"); myWin.ShowAll(); Application.Run(); // become an event handler thread }
void Start() { _demo = (Demo)FindObjectOfType(typeof(Demo)); // make each unit move time a little different just for giggles _actionTime = Random.Range(0.5f, 2.5f); _moveTime = Random.Range(0.9f, 1.3f); _idleTime = Random.Range(0.9f, 1.3f); }
public static void Main () { Bus bus = Bus.Session; string bus_name = "org.ndesk.test"; ObjectPath path = new ObjectPath ("/org/ndesk/test"); ObjectPath cppath = new ObjectPath ("/org/ndesk/CodeProvider"); IDemoOne demo; if (bus.RequestName (bus_name) == RequestNameReply.PrimaryOwner) { //create a new instance of the object to be exported demo = new Demo (); bus.Register (path, demo); DCodeProvider dcp = new DCodeProvider(); bus.Register (cppath, dcp); //run the main loop while (true) bus.Iterate (); } else { //import a remote to a local proxy //demo = bus.GetObject<IDemo> (bus_name, path); demo = bus.GetObject<DemoProx> (bus_name, path); //RunTest (demo); ICodeProvider idcp = bus.GetObject<ICodeProvider> (bus_name, cppath); DMethodInfo dmi = idcp.GetMethod ("DemoProx", "SayRepeatedly"); DArgumentInfo[] fields = idcp.GetFields ("DemoProx"); foreach (DArgumentInfo field in fields) Console.WriteLine("Field: " + field.Name); //DynamicMethod dm = new DynamicMethod (dmi.Name, typeof(void), new Type[] { typeof(object), typeof(int), typeof(string) }, typeof(DemoBase)); //ILGenerator ilg = dm.GetILGenerator (); //dmi.Implement (ilg); DynamicMethod dm = dmi.GetDM (); SayRepeatedlyHandler cb = (SayRepeatedlyHandler)dm.CreateDelegate (typeof (SayRepeatedlyHandler), demo); int retVal; retVal = cb (12, "Works!"); Console.WriteLine("retVal: " + retVal); /* for (int i = 0 ; i != dmi.Code.Length ; i++) { if (!dmi.Code[i].Emit(ilg)) throw new Exception(String.Format("Code gen failure at i={0} {1}", i, dmi.Code[i].opCode)); } */ //SayRepeatedlyHandler } }
private static void Main() { Demo titi = new Demo(20,"jean"); titi.Show(); const int x = 100; int j = 0; int k; k = 0; double y = (double) k; int[] tableau = new int[6]; for (int i = 0; i <= 5; i++) { j = addition(1,2); tableau[i] = j; if(i<=2) { k = 30; } else { k = 50; break; } } while(j<=5) { j=j+1; } object o2 = null; try { int i2 = (int)o2; // Error } catch (NullReferenceException e) { Console.WriteLine("Objet null"); } int caseSwitch = 1; switch (caseSwitch) { case 1: Console.WriteLine("Case 1"); break; case 2: Console.WriteLine("Case 2"); break; default: Console.WriteLine("Default case"); break; } Console.WriteLine(x+" "+y); Console.WriteLine(x.ToString()); }
public ActionResult Create(Demo model) { if (ModelState.IsValid) { list.Add(model); return RedirectToAction("Index"); } return View(); }
static void Main(string[] args) { // Contravariant. ISetData<string> set; set = new Demo<object>(); // Covariant. IGetData<object> get; get = new Demo<string>(); }
static void Main(string[] args) { Console.WriteLine("Hello interfaces"); Demo refdemo = new Demo(); def refdef = refdemo; refdef.pqr(); refdef.xyz(); Console.ReadLine(); }
// Use this for initialization void Start () { _content = GameObject.Find ("MaterialsContent"); _materialsDict = new Dictionary<int, GameObject> (); _selectedMaterials = new List<int> (); _materialColors = new Dictionary<int, Color> (); _colorPicker = GameObject.Find ("ColorPicker").GetComponent<ColorPicker> (); _demo = GameObject.Find ("DemoObject").GetComponent<Demo> (); Invoke("OnNewMaterial", 0.5f); }
public GeneralStats(Demo demo) : base(demo) { m_GameEventHandlers = new Dictionary<string, OnGameEvent>(); m_GameEventHandlers.Add("flashbang_detonate", new OnGameEvent(FlashbangDetonate)); m_GameEventHandlers.Add("player_blind", new OnGameEvent(PlayerBlind)); m_GameEventHandlers.Add("player_connect", new OnGameEvent(PlayerConnect)); m_GameEventHandlers.Add("player_connect_full", new OnGameEvent(PlayerConnectFull)); m_GameEventHandlers.Add("player_death", new OnGameEvent(PlayerDeath)); m_GameEventHandlers.Add("player_disconnect", new OnGameEvent(PlayerDisconnect)); m_GameEventHandlers.Add("player_team", new OnGameEvent(PlayerTeam)); m_Players = new PlayerCollection(demo); }
public CommandsController (Demo demo, UIViewController vc) { this.vc = vc; var type = vc.GetType (); Title = demo.Name; var q = from m in type.GetMethods (BindingFlags.Instance | BindingFlags.Public) where m.DeclaringType == type && m.GetParameters ().Length == 0 orderby m.Name select new Command { Method = m }; commands = q.ToList (); TableView.Delegate = new CommandsDelegate (this); TableView.DataSource = new CommandsDataSource (this); }
static void Main () { Demo d = new Demo (); prints ("d", d); prints ("dd", new DD ()); prints ("short str", "short"); prints ("long str", "this is a longer string which we want to measure the size of"); object[] obj_array = new object [100]; prints ("obj array", obj_array); for (int i = 0; i < 100; i++) obj_array [i] = new Demo (); prints ("obj array w/ demos", obj_array); }
static void Main(string[] args) { var demo = new Demo(); demo.PropertyChanged += (sender, e) => { Console.WriteLine("Property '{0}' changed!", e.PropertyName); }; Console.WriteLine("demo.FirstProperty should change:"); demo.FirstProperty = "Hello world!"; Console.WriteLine("demo.FirstProperty should not change:"); demo.FirstProperty = "Hello world!"; Console.WriteLine(); Console.WriteLine("demo.SecondProperty should change:"); demo.SecondProperty = 42; Console.WriteLine("demo.SecondProperty should not change:"); demo.SecondProperty = 42; }
private static void Main() { Demo[] demos = new Demo[] { WriteContinents, WriteContact, WriteRssToJson, ExportRssToJson, }; foreach (Demo demo in demos) { string title = demo.Method.Name; int length = title.Length + 20; Console.WriteLine(new string('=', length)); Console.WriteLine("Demo: " + title); Console.WriteLine(new string('-', length)); demo(); Console.WriteLine(); Console.WriteLine(); } }
public static void Main() { Console.WriteLine ("\nReflection.FieldAttributes"); Demo d = new Demo(); // Get a Type object for Demo, and a FieldInfo for each of // the three fields. Use the FieldInfo to display field // name, value for the Demo object in d, and attributes. // Type myType = typeof(Demo); FieldInfo fiPrivate = myType.GetField("m_field", BindingFlags.NonPublic | BindingFlags.Instance); DisplayField(d, fiPrivate); FieldInfo fiPublic = myType.GetField("Field", BindingFlags.Public | BindingFlags.Instance); DisplayField(d, fiPublic); FieldInfo fiConstant = myType.GetField("FieldC", BindingFlags.Public | BindingFlags.Static); DisplayField(d, fiConstant); }
public ActionResult EnrollUser(Demo.Models.D2LEnroll model) { // Retrieve User Data UserData user; try { user = d2l.GetUserData(model.UserName); model.UserID = user.UserId; } catch (System.Exception e) { return Content("Error: " + e.ToString()); } if (user == null ) { return Content("User Not Found"); } if (model.Role == "instructor") model.RoleID = 898; else model.RoleID = 899; try { d2l.EnrollUser(model.OrgUnitID, model.UserID, model.RoleID); } catch (System.Exception e1) { return Content ("Error: " + e1.ToString ()); } return Content("Success!"); }
/// <summary> /// Loads graphics content for this screen. The background texture is quite /// big, so we use our own local ContentManager to load it. This allows us /// to unload before going from the menus into the game itself, wheras if we /// used the shared ContentManager provided by the Game class, the content /// would remain loaded forever. /// </summary> public override void Activate(bool instancePreserved) { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); //ParticleEffects.Initialize(ScreenManager.GraphicsDeviceManager, ScreenManager.GraphicsDevice); //ParticleEngineEffect.LoadContent(content); //ParticleEffects.LoadContent(content); //Bar.Texture = content.Load<Texture2D>("Textures/Fill22"); SpriteSheet.LoadContent(content, ScreenManager.GraphicsDevice); demoLevel = new Demo(); //Player.SpawnEnemyShip(); //backgroundTexture = ScreenManager.backgroundTexture; backgroundTexture1 = content.Load<Texture2D>("GameScreens\\MenuBackground1"); backgroundTexture2 = content.Load<Texture2D>("GameScreens\\MenuBackground2"); backgroundTexture3 = content.Load<Texture2D>("GameScreens\\MenuBackground3"); backgroundTexture4 = content.Load<Texture2D>("GameScreens\\MenuBackground4"); backgroundTexture5 = content.Load<Texture2D>("GameScreens\\MenuBackground5"); backgroundTexture6 = content.Load<Texture2D>("GameScreens\\MenuBackground6"); //backgroundTexture7 = content.Load<Texture2D>("GameScreens\\UIdescriptionBG"); }
public static void Main() { dynamic d = new Demo(); Console.WriteLine("result: " + d.Ident); Console.WriteLine("Successfully compiled dynamic object!"); }
public async Task <ObservableCollection <WeaponFireEvent> > GetDemoWeaponFiredAsync(Demo demo) { string pathDemoFileJson = GetWeaponFiredFilePath(demo.Id); string json = File.ReadAllText(pathDemoFileJson); ObservableCollection <WeaponFireEvent> weaponFiredList; try { weaponFiredList = await Task.Factory.StartNew(() => JsonConvert.DeserializeObject <ObservableCollection <WeaponFireEvent> >(json, _settingsJson)); } catch (Exception e) { Logger.Instance.Log(e); throw; } return(weaponFiredList); }
public static void CreateShapes(Demo demo, PhysicsScene scene) { }
public async Task <ActionResult> ExternalLoginCallback(string returnUrl) { var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(); var dta = HttpContext.GetOwinContext(); if (loginInfo == null) { return(RedirectToAction("Login")); } //var url= HttpContext.Current.Request.QueryString; // Sign in the user with this external login provider if the user already has a login //var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false); UserProvider userprovider = new UserProvider(this.Connector); UserStoreManager usermanager = new UserStoreManager(userprovider); var email = ""; if (loginInfo.Login.LoginProvider == "Facebook") { var identity = AuthenticationManager.GetExternalIdentity(DefaultAuthenticationTypes.ExternalCookie); var access_token = identity.FindFirstValue("FacebookAccessToken"); var fb = new FacebookClient(access_token); object myInfo = fb.Get("/me?fields=name,email"); // specify the email field //string emailid = (new System.Collections.Generic.Mscorlib_DictionaryValueCollectionDebugView<string, object>(((Facebook.JsonObject)myInfo).Values).Items[0]) // var soap = JsonConvert.DeserializeObject<object>(myInfo); string str = myInfo.ToString(); Demo d = JsonConvert.DeserializeObject <Demo>(str); email = d.email; } else { email = loginInfo.Email; } LocalUser myuser = usermanager.ExternalAuthLogin(email); //if (myuser != null && myuser.IsAuthenticated) //{ // this.LocalAuthorizeUser(myuser); // return RedirectToAction("Index", "Home", new { IDUser = myuser.IDUser }); //} Key "email" string if (myuser == null) { ViewBag.ReturnUrl = returnUrl; ViewBag.LoginProvider = loginInfo.Login.LoginProvider; return(View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = email })); } else { this.LocalAuthorizeUser(myuser); return(RedirectToAction("Index", "Home", new { UserId = myuser.UserName })); } // switch (result) //{ // case SignInStatus.Success: // return RedirectToLocal(returnUrl); // case SignInStatus.LockedOut: // return View("Lockout"); // case SignInStatus.RequiresVerification: // return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = false }); // case SignInStatus.Failure: // default: // // If the user does not have an account, then prompt the user to create an account //} }
public void Load(Demo demo, PhysicsSimulator physicsSimulator) { //Load bodies _spiderBody = BodyFactory.Instance.CreateCircleBody(physicsSimulator, _spiderBodyRadius, 1); _spiderBody.Position = _position; _spiderBody.IsStatic = false; demo.AddCircleToCanvas(_spiderBody, _spiderBodyRadius); _leftUpperLegBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _upperLegSize.X, _upperLegSize.Y, 1); _leftUpperLegBody.Position = _spiderBody.Position - new Vector2(_spiderBodyRadius, 0) - new Vector2(_upperLegSize.X / 2, 0); demo.AddRectangleToCanvas(_leftUpperLegBody, Colors.White, new Vector2(_upperLegSize.X, _upperLegSize.Y)); _leftLowerLegBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _lowerLegSize.X, _lowerLegSize.Y, 1); _leftLowerLegBody.Position = _spiderBody.Position - new Vector2(_spiderBodyRadius, 0) - new Vector2(_upperLegSize.X, 0) - new Vector2(_lowerLegSize.X / 2, 0); demo.AddRectangleToCanvas(_leftLowerLegBody, Colors.Red, new Vector2(_lowerLegSize.X, _lowerLegSize.Y)); _rightUpperLegBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _upperLegSize.X, _upperLegSize.Y, 1); _rightUpperLegBody.Position = _spiderBody.Position + new Vector2(_spiderBodyRadius, 0) + new Vector2(_upperLegSize.X / 2, 0); demo.AddRectangleToCanvas(_rightUpperLegBody, Colors.White, new Vector2(_upperLegSize.X, _upperLegSize.Y)); _rightLowerLegBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _lowerLegSize.X, _lowerLegSize.Y, 1); _rightLowerLegBody.Position = _spiderBody.Position + new Vector2(_spiderBodyRadius, 0) + new Vector2(_upperLegSize.X, 0) + new Vector2(_lowerLegSize.X / 2, 0); demo.AddRectangleToCanvas(_rightLowerLegBody, Colors.Red, new Vector2(_lowerLegSize.X, _lowerLegSize.Y)); //load geometries _spiderGeom = GeomFactory.Instance.CreateCircleGeom(physicsSimulator, _spiderBody, _spiderBodyRadius, 14); _leftUpperLegGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _leftUpperLegBody, _upperLegSize.X, _upperLegSize.Y); _leftLowerLegGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _leftLowerLegBody, _lowerLegSize.X, _lowerLegSize.Y); _rightUpperLegGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _rightUpperLegBody, _upperLegSize.X, _upperLegSize.Y); _rightLowerLegGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _rightLowerLegBody, _lowerLegSize.X, _lowerLegSize.Y); _spiderGeom.CollisionGroup = _collisionGroup; _leftUpperLegGeom.CollisionGroup = _collisionGroup; _leftLowerLegGeom.CollisionGroup = _collisionGroup; _rightUpperLegGeom.CollisionGroup = _collisionGroup; _rightLowerLegGeom.CollisionGroup = _collisionGroup; //load joints JointFactory.Instance.CreateRevoluteJoint(physicsSimulator, _spiderBody, _leftUpperLegBody, _spiderBody.Position - new Vector2(_spiderBodyRadius, 0)); _leftShoulderAngleJoint = JointFactory.Instance.CreateAngleJoint(physicsSimulator, _spiderBody, _leftUpperLegBody); _leftShoulderAngleJoint.TargetAngle = -.4f; _leftShoulderAngleJoint.MaxImpulse = 300; JointFactory.Instance.CreateRevoluteJoint(physicsSimulator, _spiderBody, _rightUpperLegBody, _spiderBody.Position + new Vector2(_spiderBodyRadius, 0)); _rightShoulderAngleJoint = JointFactory.Instance.CreateAngleJoint(physicsSimulator, _spiderBody, _rightUpperLegBody); _rightShoulderAngleJoint.TargetAngle = .4f; _leftShoulderAngleJoint.MaxImpulse = 300; JointFactory.Instance.CreateRevoluteJoint(physicsSimulator, _leftUpperLegBody, _leftLowerLegBody, _spiderBody.Position - new Vector2(_spiderBodyRadius, 0) - new Vector2(_upperLegSize.X, 0)); _leftKneeAngleJoint = JointFactory.Instance.CreateAngleJoint(physicsSimulator, _leftUpperLegBody, _leftLowerLegBody); _leftKneeAngleJoint.TargetAngle = -_kneeTargetAngle; _leftKneeAngleJoint.MaxImpulse = 300; JointFactory.Instance.CreateRevoluteJoint(physicsSimulator, _rightUpperLegBody, _rightLowerLegBody, _spiderBody.Position + new Vector2(_spiderBodyRadius, 0) + new Vector2(_upperLegSize.X, 0)); _rightKneeAngleJoint = JointFactory.Instance.CreateAngleJoint(physicsSimulator, _rightUpperLegBody, _rightLowerLegBody); _rightKneeAngleJoint.TargetAngle = _kneeTargetAngle; _rightKneeAngleJoint.MaxImpulse = 300; }
public XnaGraphics(Demo demo) : base(demo) { Form = new XnaForm(this); }
public static void Main() { Demo.Run(); }
public void MultiLevelTest_Doom2() { using (var resource = CommonResource.CreateDummy(WadPath.Doom2, @"data\multilevel_test_doom2.wad")) { var demo = new Demo(@"data\multilevel_test_doom2.lmp"); var cmds = Enumerable.Range(0, Player.MaxPlayerCount).Select(i => new TicCmd()).ToArray(); var game = new DoomGame(resource, demo.Options); game.DeferedInitNew(); var lastMobjHash = 0; var aggMobjHash = 0; // MAP01 { for (var i = 0; i < 801; i++) { demo.ReadCmd(cmds); game.Update(cmds); lastMobjHash = DoomDebug.GetMobjHash(game.World); aggMobjHash = DoomDebug.CombineHash(aggMobjHash, lastMobjHash); } Assert.AreEqual(0xc88d8c72u, (uint)lastMobjHash); Assert.AreEqual(0x50d51db4u, (uint)aggMobjHash); } // Intermission { for (var i = 0; i < 378; i++) { demo.ReadCmd(cmds); game.Update(cmds); } } // MAP02 { for (var i = 0; i < 334; i++) { demo.ReadCmd(cmds); game.Update(cmds); lastMobjHash = DoomDebug.GetMobjHash(game.World); aggMobjHash = DoomDebug.CombineHash(aggMobjHash, lastMobjHash); } Assert.AreEqual(0xeb24ae67u, (uint)lastMobjHash); Assert.AreEqual(0xa08bf6ceu, (uint)aggMobjHash); } // Intermission { for (var i = 0; i < 116; i++) { demo.ReadCmd(cmds); game.Update(cmds); } } // MAP03 { for (var i = 0; i < 653; i++) { demo.ReadCmd(cmds); game.Update(cmds); lastMobjHash = DoomDebug.GetMobjHash(game.World); aggMobjHash = DoomDebug.CombineHash(aggMobjHash, lastMobjHash); } Assert.AreEqual(0xb4d74694u, (uint)lastMobjHash); Assert.AreEqual(0xd813ac0fu, (uint)aggMobjHash); } // Intermission { for (var i = 0; i < 131; i++) { demo.ReadCmd(cmds); game.Update(cmds); } } // MAP04 { for (var i = 0; i < 469; i++) { demo.ReadCmd(cmds); game.Update(cmds); lastMobjHash = DoomDebug.GetMobjHash(game.World); aggMobjHash = DoomDebug.CombineHash(aggMobjHash, lastMobjHash); } Assert.AreEqual(0xaf214214u, (uint)lastMobjHash); Assert.AreEqual(0xad054ab5u, (uint)aggMobjHash); } // Intermission { for (var i = 0; i < 236; i++) { demo.ReadCmd(cmds); game.Update(cmds); } } // MAP05 { for (var i = 0; i < 312; i++) { demo.ReadCmd(cmds); game.Update(cmds); lastMobjHash = DoomDebug.GetMobjHash(game.World); aggMobjHash = DoomDebug.CombineHash(aggMobjHash, lastMobjHash); } Assert.AreEqual(0xeb01a1fau, (uint)lastMobjHash); Assert.AreEqual(0x0e4e66ffu, (uint)aggMobjHash); } } }
public void MultiLevelTest_Doom1() { using (var resource = CommonResource.CreateDummy(WadPath.Doom1, @"data\multilevel_test_doom1.wad")) { var demo = new Demo(@"data\multilevel_test_doom1.lmp"); demo.Options.GameMode = GameMode.Retail; var cmds = Enumerable.Range(0, Player.MaxPlayerCount).Select(i => new TicCmd()).ToArray(); var game = new DoomGame(resource, demo.Options); game.DeferedInitNew(); var lastMobjHash = 0; var aggMobjHash = 0; // E1M1 { for (var i = 0; i < 456; i++) { demo.ReadCmd(cmds); game.Update(cmds); lastMobjHash = DoomDebug.GetMobjHash(game.World); aggMobjHash = DoomDebug.CombineHash(aggMobjHash, lastMobjHash); } Assert.AreEqual(0xd76283ddu, (uint)lastMobjHash); Assert.AreEqual(0x8e50483eu, (uint)aggMobjHash); } // Intermission { for (var i = 0; i < 523; i++) { demo.ReadCmd(cmds); game.Update(cmds); } } // E1M2 { for (var i = 0; i < 492; i++) { demo.ReadCmd(cmds); game.Update(cmds); lastMobjHash = DoomDebug.GetMobjHash(game.World); aggMobjHash = DoomDebug.CombineHash(aggMobjHash, lastMobjHash); } Assert.AreEqual(0x4499dad4u, (uint)lastMobjHash); Assert.AreEqual(0xf2bdb9dfu, (uint)aggMobjHash); } // Intermission { for (var i = 0; i < 368; i++) { demo.ReadCmd(cmds); game.Update(cmds); } } // E1M3 { for (var i = 0; i < 424; i++) { demo.ReadCmd(cmds); game.Update(cmds); lastMobjHash = DoomDebug.GetMobjHash(game.World); aggMobjHash = DoomDebug.CombineHash(aggMobjHash, lastMobjHash); } Assert.AreEqual(0x807bef69u, (uint)lastMobjHash); Assert.AreEqual(0x7fcd8281u, (uint)aggMobjHash); } // Intermission { for (var i = 0; i < 28; i++) { demo.ReadCmd(cmds); game.Update(cmds); } } // E1M4 { for (var i = 0; i < 507; i++) { demo.ReadCmd(cmds); game.Update(cmds); lastMobjHash = DoomDebug.GetMobjHash(game.World); aggMobjHash = DoomDebug.CombineHash(aggMobjHash, lastMobjHash); } Assert.AreEqual(0xd79ad915u, (uint)lastMobjHash); Assert.AreEqual(0x504e3b27u, (uint)aggMobjHash); } // Intermission { for (var i = 0; i < 253; i++) { demo.ReadCmd(cmds); game.Update(cmds); } } // E1M5 { for (var i = 0; i < 532; i++) { demo.ReadCmd(cmds); game.Update(cmds); lastMobjHash = DoomDebug.GetMobjHash(game.World); aggMobjHash = DoomDebug.CombineHash(aggMobjHash, lastMobjHash); } Assert.AreEqual(0x233e5471u, (uint)lastMobjHash); Assert.AreEqual(0xc5060c4eu, (uint)aggMobjHash); } } }
public vwOracleDemo(Demo model) : base(model) { }
/// <summary> /// Import excel. /// </summary> /// <param name="FilePath">Đường dẫn file trên server.</param> /// <returns>Danh sách đường dẫn.</returns> public async Task <string> ImportFileExcel(string FilePath) { StringBuilder returnMessage = new StringBuilder(); returnMessage.Append("Kết quả nhập file:"); ReadFromExcelDto <Demo> readResult = new ReadFromExcelDto <Demo>(); // Không tìm thấy file if (!File.Exists(FilePath)) { readResult.ResultCode = (int)GlobalConst.ReadExcelResultCode.FileNotFound; } // Đọc hết file excel var data = await GlobalFunction.ReadFromExcel(FilePath); // Không có dữ liệu if (data.Count <= 0) { readResult.ResultCode = (int)GlobalConst.ReadExcelResultCode.CantReadData; } else { // Đọc lần lượt từng dòng for (int i = 0; i < data.Count; i++) { try { string ma = data[i][0]; string ten = data[i][1]; var checkboxTrueFalse = data[i][2] == "1" ? true : false; var dropdownSingle = int.Parse(data[i][3]); var autoCompleteSingle = int.Parse(data[i][4]); var newDemo = new Demo { Ma = ma, Ten = ten, CheckboxTrueFalse = checkboxTrueFalse, DropdownSingle = dropdownSingle, AutoCompleteSingle = autoCompleteSingle, }; // Thêm các bản ghi hợp lệ vào db await this.demoRepository.InsertAsync(newDemo); // Đánh dấu các bản ghi thêm thành công readResult.ListResult.Add(newDemo); } #pragma warning disable CA1031 // Do not catch general exception types catch #pragma warning restore CA1031 // Do not catch general exception types { // Äánh dấu các bản ghi lá»—i readResult.ListErrorRow.Add(data[i]); } } } // Thông tin import readResult.ErrorMessage = GlobalModel.ReadExcelResultCode[readResult.ResultCode]; // Nếu đọc file thất bại if (readResult.ResultCode != 200) { return(readResult.ErrorMessage); } else { // Đọc file thành công // Trả kết quả import returnMessage.Append(string.Format("\r\n\u00A0- Tổng ghi: {0}", readResult.ListResult.Count + readResult.ListErrorRow.Count)); returnMessage.Append(string.Format("\r\n\u00A0- Số bản ghi thành công: {0}", readResult.ListResult.Count)); returnMessage.Append(string.Format("\r\n\u00A0- Số bản ghi thất bại: {0}", readResult.ListErrorRow.Count)); } return(returnMessage.ToString()); }
public GameLauncherConfiguration(Demo demo) { Demo = demo; }
public async Task <List <GenericDoubleChart> > GetTotalDamageHealthChartAsync(Demo demo, Player player) { List <GenericDoubleChart> data = new List <GenericDoubleChart>(); await Task.Factory.StartNew(() => { int total = 0; foreach (Round round in demo.Rounds) { total += demo.PlayersHurted.Where( e => e.RoundNumber == round.Number && e.AttackerSteamId == player.SteamId ).Sum(e => e.HealthDamage); data.Add(new GenericDoubleChart { Label = round.Number.ToString(), Value = total }); } }); return(data); }
public MeshFactory(Demo demo) { _demo = demo; }
public Amphibian1(Demo demo, int instanceIndex) { this.demo = demo; instanceIndexName = " " + instanceIndex.ToString(); }
protected override void OnLoadResources(ResourceVolume volume) { base.OnLoadResources(volume); _demo = volume.Get <Demo>("Resources", "attract"); }
public Plant1(Demo demo, int instanceIndex) { this.demo = demo; instanceIndexName = " " + instanceIndex.ToString(); }
// Use this for initialization void Start() { playerScript = player.GetComponent <Demo> (); playerScript.DamagePlayer(1000); }
public Demo(Demo model) : base(model) { }
protected new void HandleSayText(object sender, SayTextEventArgs e) { base.HandleSayText(sender, e); // game pause if (e.Text == STOP_ROUND) { IsMatchStarted = false; IsGamePaused = true; BackupToLastRound(); return; } // live after pause if (e.Text == MATCH_UNPAUSED || e.Text == ROUND_RESTORED) { IsMatchStarted = true; IsGamePaused = false; return; } // Beginning of the match Match faceItLive = _faceItLiveRegex.Match(e.Text); if (e.Text == EBOT_LIVE || faceItLive.Success) { Demo.ResetStats(false); InitMatch(); CreateNewRound(true); IsMatchStarted = true; } Match scoreUpdateEbot = _scoreRegex.Match(e.Text); // Score update if (!scoreUpdateEbot.Success) { _isFaceit = true; return; } // End of the match (OT or not) Match matchEnd = _endMatchRegex.Match(e.Text); if (matchEnd.Success) { IsMatchStarted = false; _isMatchEnded = true; return; } if (IsOvertime) { // if eBot is waiting for !ready, the match isn't started if (e.Text == PLEASE_WRITE_READY) { IsMatchStarted = false; } // announce the beginning of an overtime if (e.Text == BEGIN_FIRST_SIDE_OVERTIME || e.Text == BEGIN_SECOND_SIDE_OVERTIME) { IsMatchStarted = true; } } }
public SimpleCamera(Demo demo, int instanceIndex) { this.demo = demo; instanceIndexName = " " + instanceIndex.ToString(); }
public Task <List <Stuff> > GetStuffPointListAsync(Demo demo, StuffType type) { throw new NotImplementedException(); }
public void Run() { var demo = new Demo(this.connectionString); // static void Main(string[] args) // { // var connStr = ""; // var demo = new Demo(connStr); // var groups = new List<Group> // { // // new Group { Name = "admins" }, // // new Group { Name = "superusers" }, // }; // var group1 = new Group { Name = "admins" }; // var group2 = new Group { Name = "superusers" }; // group1.Id = demo.CreateGroup(group1); // group2.Id = demo.CreateGroup(group2); // groups.Add(group1); // groups.Add(group2); // var users = new List<User> // { // new User // { // FirstName = "Harrison", // LastName = "Ford", // Groups = groups.AsEnumerable() // }, // new User // { // FirstName = "Gina", // LastName = "Carano", // Groups = groups.AsEnumerable() // }, // new User // { // FirstName = "Michael", // LastName = "Fassbander" // }, // }; // //var user1 = from _ in users where _.FirstName == "Harrison" select _; // var user2 = from _ in users where _.FirstName == "Gina" select _; // demo.CreateUser(user2.Single()); // // demo.CreateUsers(users); // // var audit = new Audit { CreatedAt = DateTime.Now, CreatedBy = "admin", UpdatedAt = DateTime.Now, UpdatedBy = "admin" }; // // var user = new User { FirstName = "Elizabeth", LastName = "Taylor", Audit = audit }; // // user.Id = demo.CreateUser(user); // // user.Id = 4001; // // demo.DisplayUserDetails(demo.FindUser(user.Id)); // // user.FirstName = "Gary"; // // user.Active = true; // // demo.UpdateUser(user); // // demo.DisplayUserDetails(demo.FindUser(11001)); // // demo.DeleteUser(1001); // Console.WriteLine("Completed"); // } }
public static void Main(string[] args) { Console.WriteLine(Demo.count); Demo ob1 = new Demo(1); // Demo ob2 = new Demo(2); }
public async Task <ObservableCollection <PlayerBlindedEvent> > GetDemoPlayerBlindedAsync(Demo demo) { string pathFile = GetPlayerBlindedFilePath(demo.Id); string json = File.ReadAllText(pathFile); ObservableCollection <PlayerBlindedEvent> playerBlindedList; try { playerBlindedList = await Task.Factory.StartNew(() => JsonConvert.DeserializeObject <ObservableCollection <PlayerBlindedEvent> >(json, _settingsJson)); } catch (Exception e) { Logger.Instance.Log(e); throw; } return(playerBlindedList); }
protected override void OnPaint(PaintEventArgs e) { if (Demos.Count < 1) { return; } g = e.Graphics; // update Zoom double width = FirstDemo.MaxX - FirstDemo.MinX + 40; double height = FirstDemo.MaxY - FirstDemo.MinY + 40; double xratio = ClientRectangle.Width / width; double yratio = ClientRectangle.Height / height; Zoom = xratio < yratio ? xratio : yratio; // draw bsp! if (Bsp != null) { foreach (var ed in Bsp.Edges) { var va = Bsp.Vertices[ed.A]; var vb = Bsp.Vertices[ed.B]; Point pa = Convert(va.X, va.Y); Point pb = Convert(vb.X, vb.Y); e.Graphics.DrawLine(Pens.Gray, pa, pb); } } int keyY = 10; foreach (ParsedDemo Demo in Demos) { // find closest state GameState state = Demo.States[0]; foreach (var pair in Demo.States) { if (pair.Key > Time) { break; } state = pair.Value; } // draw player key StatIndex hpstat = StatIndex.Player1HP; StatIndex wpstat = StatIndex.Player1Weapon; StatIndex amstat = StatIndex.Player1Ammo; int x = 10; foreach (Player pl in Demo.Players.Values) { if (pl.Netname == null) { break; } int windex = state.Stat(wpstat); string hptext = state.Stats.ContainsKey(hpstat) ? state.Stat(hpstat).ToString() : "?"; string wptext = Info.WeaponNames.ContainsKey(windex) ? Info.WeaponNames[windex] : "?"; string amtext = state.Stats.ContainsKey(amstat) ? state.Stat(amstat).ToString() : "?"; Entity ent = state.Entities[pl.Entity]; DrawPlayer(e.Graphics, ent, pl, new Rectangle(x, keyY, 10, 10)); e.Graphics.DrawString(pl.Netname, Font, Brushes.White, x + 12, keyY); e.Graphics.DrawString(hptext, Font, Brushes.White, x + 82, keyY); e.Graphics.DrawString(wptext, Font, Brushes.White, x + 102, keyY); e.Graphics.DrawString(amtext, Font, Brushes.White, x + 122, keyY); hpstat++; wpstat++; amstat++; keyY += 14; } // draw messages int y = ClientRectangle.Height - 10; y -= state.Messages.Count * 14; foreach (string msg in state.Messages) { e.Graphics.DrawString(msg, Font, Brushes.White, x, y); y += 14; } // draw counts x = ClientRectangle.Width - 100; y = ClientRectangle.Height - 24; e.Graphics.DrawString($"Kills: {state.Stat(StatIndex.KilledMonsters)} / {state.Stat(StatIndex.NumMonsters)}", Font, Brushes.White, x, y - 14); e.Graphics.DrawString($"Secrets: {state.Stat(StatIndex.FoundSecrets)} / {state.Stat(StatIndex.NumSecrets)}", Font, Brushes.White, x, y); // draw temps foreach (Temp t in state.Temps) { t.Draw(this); } // draw entities foreach (Entity ent in state.Entities.Values.Reverse()) { if (ent.Number == 0) { continue; } if (ent.Model[0] == '*') { continue; } if (ent.Model == "?") { continue; } ModelInfo minf = Info.GetModelInfo(ent.Model, ent.Skin); if (minf.Type == ModelType.Player) { Player pl = Demo.GetPlayer((byte)(ent.Number - 1)); DrawPlayer(e.Graphics, ent, pl); DrawAngle(e.Graphics, ent); continue; } if (minf.DeadFrames.Contains(ent.Frame)) { Cross(ent.Origin, Color.DarkRed, minf.Size / 2); continue; } Rectangle rect = GetDrawRect(ent, minf.Size); e.Graphics.FillRectangle(minf.Background, rect); if (minf.Type == ModelType.Enemy) { DrawAngle(e.Graphics, ent); } if (minf.Label != null) { SizeF size = e.Graphics.MeasureString(minf.Label, Font); float lx = rect.Left + rect.Width / 2 - size.Width / 2; float ly = rect.Top + rect.Height / 2 - size.Height / 2; e.Graphics.DrawString(minf.Label, Font, minf.Foreground, lx, ly); } } } }
private void Start() { instance = this; buttons = new List<GameObject>(16); animTimeout = 0.0f; shapeParamsStart = new float[6]; shapeParamsMax = new float[6]; Vector3 pos = Vector3.zero; pos.z = -0.8f; pos.x = -3.1f; for (int i = 0; i < 20; i++) { CreateButton(i, pos); pos.x = pos.x + 0.73f; } CreateButton(20, new Vector3(10, 0, 5)); CreateButton(21, new Vector3(10, 0, 3.8f)); buttons[20].GetComponent<Renderer>().material = new Material(Shader.Find("Unlit/Texture")); buttons[20].GetComponent<Renderer>().material.mainTexture = Resources.Load("sphereChecker") as Texture2D; buttons[21].GetComponent<Renderer>().material = new Material(Shader.Find("Unlit/Texture")); buttons[21].GetComponent<Renderer>().material.mainTexture = Resources.Load("faceNormalsIcon") as Texture2D; OnButtonHit(0); }
public async Task <List <PlayerRoundStats> > GetPlayerRoundStatsListAsync(Demo demo, Round round) { List <PlayerRoundStats> data = new List <PlayerRoundStats>(); Dictionary <Player, PlayerRoundStats> playerRoundStats = new Dictionary <Player, PlayerRoundStats>(); await Task.Factory.StartNew(() => { foreach (Player player in demo.Players) { if (!playerRoundStats.ContainsKey(player)) { playerRoundStats.Add(player, new PlayerRoundStats()); playerRoundStats[player].Name = player.Name; if (!player.StartMoneyRounds.ContainsKey(round.Number)) { player.StartMoneyRounds[round.Number] = 0; } if (!player.EquipementValueRounds.ContainsKey(round.Number)) { player.EquipementValueRounds[round.Number] = 0; } playerRoundStats[player].StartMoneyValue = player.StartMoneyRounds[round.Number]; playerRoundStats[player].EquipementValue = player.EquipementValueRounds[round.Number]; } foreach (WeaponFireEvent e in demo.WeaponFired) { if (e.RoundNumber == round.Number && e.ShooterSteamId == player.SteamId) { playerRoundStats[player].ShotCount++; } } foreach (PlayerHurtedEvent e in demo.PlayersHurted) { if (e.RoundNumber == round.Number && e.AttackerSteamId != 0 && e.AttackerSteamId == player.SteamId) { playerRoundStats[player].DamageArmorCount += e.ArmorDamage; playerRoundStats[player].DamageHealthCount += e.HealthDamage; playerRoundStats[player].HitCount++; } } foreach (KillEvent e in round.Kills) { if (e.KillerSteamId == player.SteamId) { playerRoundStats[player].KillCount++; if (e.KillerVelocityZ > 0) { playerRoundStats[player].JumpKillCount++; } } } } data.AddRange(playerRoundStats.Select(keyValuePair => keyValuePair.Value)); }); return(data); }
public DemoTestBase(int _a, int _b, int _expectedSum) { objUnderTest = new Demo(_a, _b); this.expectedSum = _expectedSum; }
public void Create() { string sceneInstanceIndexName = name + instanceIndexName; if (demo.Engine.Factory.PhysicsSceneManager.Find(sceneInstanceIndexName) != null) { return; } scene = demo.Engine.Factory.PhysicsSceneManager.Create(sceneInstanceIndexName); // Initialize maximum number of solver iterations for the scene scene.MaxIterationCount = 15; // Initialize time of simulation for the scene scene.TimeOfSimulation = 1.0f / 15.0f; Initialize(); // Initialize objects in the scene skyInstance1.Initialize(scene); quadInstance1.Initialize(scene); cursorInstance.Initialize(scene); shotInstance.Initialize(scene); jengaInstance1.Initialize(scene); pyramidInstance1.Initialize(scene); wallInstance1.Initialize(scene); camera1Instance1.Initialize(scene); lightInstance.Initialize(scene); // Initialize controllers in the scene skyDraw1Instance1.Initialize(scene); cursorDraw1Instance.Initialize(scene); camera1Animation1Instance1.Initialize(scene); camera1Draw1Instance1.Initialize(scene); // Create shapes shared for all physics objects in the scene // These shapes are used by all objects in the scene Demo.CreateSharedShapes(demo, scene); // Create shapes for objects in the scene Sky.CreateShapes(demo, scene); Quad.CreateShapes(demo, scene); Cursor.CreateShapes(demo, scene); Shot.CreateShapes(demo, scene); Jenga.CreateShapes(demo, scene); Pyramid.CreateShapes(demo, scene); Wall.CreateShapes(demo, scene); Camera1.CreateShapes(demo, scene); Lights.CreateShapes(demo, scene); // Create physics objects for objects in the scene skyInstance1.Create(new Vector3(0.0f, 0.0f, 0.0f)); quadInstance1.Create(new Vector3(0.0f, -40.0f, 20.0f), new Vector3(1000.0f, 31.0f, 1000.0f), Quaternion.Identity); cursorInstance.Create(); shotInstance.Create(); jengaInstance1.Create(new Vector3(-30.0f, -9.0f, 20.0f), Vector3.One, Quaternion.FromAxisAngle(Vector3.UnitY, MathHelper.DegreesToRadians(60.0f)), "Box", 16, 3, new Vector3(2.0f, 2.0f, 2.0f), 1.0f, true); pyramidInstance1.Create(new Vector3(0.0f, -9.0f, 20.0f), Vector3.One, Quaternion.FromAxisAngle(Vector3.UnitY, MathHelper.DegreesToRadians(-45.0f)), "Box", 14, new Vector3(2.0f, 2.0f, 2.0f), 1.0f, true); wallInstance1.Create(new Vector3(30.0f, -9.0f, 20.0f), Vector3.One, Quaternion.FromAxisAngle(Vector3.UnitY, MathHelper.DegreesToRadians(-100.0f)), "Box", 12, new Vector3(2.0f, 2.0f, 2.0f), 1.0f, true); camera1Instance1.Create(new Vector3(0.0f, 5.0f, -22.0f), Quaternion.Identity, Quaternion.Identity, Quaternion.Identity, true); lightInstance.CreateLightPoint(0, "Glass", new Vector3(-30.0f, 0.0f, 40.0f), new Vector3(0.2f, 1.0f, 1.0f), 20.0f, 1.0f); lightInstance.CreateLightPoint(1, "Glass", new Vector3(0.0f, 0.0f, 40.0f), new Vector3(1.0f, 0.5f, 0.1f), 20.0f, 1.0f); lightInstance.CreateLightPoint(2, "Glass", new Vector3(20.0f, 0.0f, 40.0f), new Vector3(1.0f, 0.7f, 0.0f), 20.0f, 1.0f); lightInstance.CreateLightPoint(3, "Glass", new Vector3(-30.0f, 7.0f, 15.0f), new Vector3(1.0f, 0.7f, 0.5f), 20.0f, 1.0f); lightInstance.CreateLightPoint(4, "Glass", new Vector3(0.0f, 7.0f, 15.0f), new Vector3(1.0f, 1.0f, 0.5f), 20.0f, 1.0f); lightInstance.CreateLightPoint(5, "Glass", new Vector3(20.0f, 7.0f, 15.0f), new Vector3(0.7f, 0.5f, 0.2f), 20.0f, 1.0f); lightInstance.CreateLightSpot(0, "Glass", new Vector3(-20.0f, 8.0f, 15.0f), new Vector3(0.1f, 0.7f, 1.0f), 20.0f, 1.0f); lightInstance.CreateLightSpot(1, "Glass", new Vector3(0.0f, 8.0f, 5.0f), new Vector3(1.0f, 0.5f, 0.2f), 20.0f, 1.0f); lightInstance.CreateLightSpot(2, "Glass", new Vector3(20.0f, 8.0f, 10.0f), new Vector3(0.5f, 1.0f, 0.2f), 20.0f, 1.0f); // Set controllers for objects in the scene SetControllers(); }
public FarmerviewModel(Demo demo) { Farmer = demo.farmer; }
public ActionResult GetPolygon(int id, int key) { if (key == 1) { var datact = db.States.Where(x => x.state_id == id).Select(x => x.polygon).FirstOrDefault(); if (datact != null) { var tstateId = datact.Replace("*#", ","); string[] lits = tstateId.Split(','); var load = new List <Demo>(); for (int i = 0; i < lits.Length; i += 2) { try { var temp = new Demo(); temp.lat = float.Parse(lits[i].Replace(".", ","), CultureInfo.GetCultureInfo("vi-VN")); if (i < lits.Length - 1) { temp.lng = float.Parse(lits[i + 1].Replace(".", ","), CultureInfo.GetCultureInfo("vi-VN")); } load.Add(temp); } catch (Exception exception) { throw; } } return(Json(load)); } } if (key == 2) { var datact = db.Districts.Where(x => x.district_id == id).Select(x => x.polygon).FirstOrDefault(); if (datact != null) { var tstateId = datact.Replace("*#", ","); string[] lits = tstateId.Split(','); var load = new List <Demo>(); for (int i = 0; i < lits.Length; i += 2) { try { var temp = new Demo(); temp.lat = float.Parse(lits[i].Replace(".", ","), CultureInfo.GetCultureInfo("vi-VN")); if (i < lits.Length - 1) { temp.lng = float.Parse(lits[i + 1].Replace(".", ","), CultureInfo.GetCultureInfo("vi-VN")); } load.Add(temp); } catch (Exception exception) { throw; } } return(Json(load)); } } if (key == 3) { var datact = db.Locations.Where(x => x.location_id == id).Select(x => x.polygon).FirstOrDefault(); if (datact != null) { var tstateId = datact.Replace("*#", ","); string[] lits = tstateId.Split(','); var load = new List <Demo>(); for (int i = 0; i < lits.Length; i += 2) { try { var temp = new Demo(); temp.lat = float.Parse(lits[i].Replace(".", ","), CultureInfo.GetCultureInfo("vi-VN")); if (i < lits.Length - 1) { temp.lng = float.Parse(lits[i + 1].Replace(".", ","), CultureInfo.GetCultureInfo("vi-VN")); } load.Add(temp); } catch (Exception exception) { throw; } } return(Json(load)); } } return(null); }