public IActionResult Buggy(int id, int qtype) { int account_id = methods.get_Account_ID(); //Response.WriteAsync("ID:"+account_id.ToString()); bool vip = methods.get_Account_VIP(account_id); Debug.WriteLine("---> ID:" + account_id.ToString()); Debug.WriteLine("---> VIP:" + vip.ToString()); if (vip) { Buggy buggy = new Buggy(); buggy.AccountId = account_id; buggy.QId = id; buggy.QType = qtype;; db.Buggy.Add(buggy); db.SaveChanges(); Response.WriteAsync("<script>alert('Bildirim gönderildi.');</script>"); } else { Response.WriteAsync("<script>alert('VIP üye değilsiniz.');</script>"); } return(View()); }
public void FindBugData() { Slider bugSelector = (Slider)GameObject.Find("BugSelector").GetComponent(typeof(Slider)); int num = (int)bugSelector.value; Buggy bug = bugs [num]; Text bugNum = (Text)GameObject.Find("BugNumText").GetComponent(typeof(Text)); InputField k11 = (InputField)GameObject.Find("BugK11").GetComponent(typeof(InputField)); InputField k12 = (InputField)GameObject.Find("BugK12").GetComponent(typeof(InputField)); InputField k21 = (InputField)GameObject.Find("BugK21").GetComponent(typeof(InputField)); InputField k22 = (InputField)GameObject.Find("BugK22").GetComponent(typeof(InputField)); InputField bugX = (InputField)GameObject.Find("BugX").GetComponent(typeof(InputField)); InputField bugY = (InputField)GameObject.Find("BugY").GetComponent(typeof(InputField)); InputField bugR = (InputField)GameObject.Find("BugR").GetComponent(typeof(InputField)); InputField bugSize = (InputField)GameObject.Find("BugSize").GetComponent(typeof(InputField)); bugNum.text = (num + 1).ToString(); k11.text = Round(bug.K [0, 0]).ToString(); k12.text = Round(bug.K [1, 0]).ToString(); k21.text = Round(bug.K [0, 1]).ToString(); k22.text = Round(bug.K [1, 1]).ToString(); bugX.text = Mathf.Round(bug.transform.position.x).ToString(); bugY.text = Mathf.Round(bug.transform.position.z).ToString(); bugR.text = Mathf.Round(bug.transform.rotation.eulerAngles.y).ToString(); bugSize.text = Mathf.Round(bug.transform.localScale.x).ToString(); }
public void UpdateNumberOfBugs() { InputField numbugs = (InputField)GameObject.Find("NumBugs").GetComponent(typeof(InputField)); int num; if (!int.TryParse(numbugs.text, out num)) { return; } while (bugs.Count > num) { GameObject go = GameObject.Find("Buggy" + bugs.Count); Buggy b = bugs[bugs.Count - 1]; bugs.RemoveAt(bugs.Count - 1); Destroy(go); } while (bugs.Count < num) { GameObject go = (Instantiate(prefab, prefab.transform.position, prefab.transform.rotation) as Transform).gameObject; go.SetActive(true); Buggy b = go.GetComponent <Buggy>(); b.Init(); bugs.Add(b); go.name = "Buggy" + bugs.Count; } Slider bugSelector = (Slider)GameObject.Find("BugSelector").GetComponent(typeof(Slider)); bugSelector.maxValue = bugs.Count - 1; bugSelector.value = bugs.Count - 1; FindBugData(); }
public void UpdateBugData() { Slider bugSelector = (Slider)GameObject.Find("BugSelector").GetComponent(typeof(Slider)); int num = (int)bugSelector.value; Buggy bug = bugs [num]; InputField k11 = (InputField)GameObject.Find("BugK11").GetComponent(typeof(InputField)); InputField k12 = (InputField)GameObject.Find("BugK12").GetComponent(typeof(InputField)); InputField k21 = (InputField)GameObject.Find("BugK21").GetComponent(typeof(InputField)); InputField k22 = (InputField)GameObject.Find("BugK22").GetComponent(typeof(InputField)); InputField bugX = (InputField)GameObject.Find("BugX").GetComponent(typeof(InputField)); InputField bugY = (InputField)GameObject.Find("BugY").GetComponent(typeof(InputField)); InputField bugR = (InputField)GameObject.Find("BugR").GetComponent(typeof(InputField)); InputField bugSize = (InputField)GameObject.Find("BugSize").GetComponent(typeof(InputField)); float k11F; if (float.TryParse(k11.text, out k11F)) { bug.K [0, 0] = Round(k11F); } float k12F; if (float.TryParse(k12.text, out k12F)) { bug.K [1, 0] = Round(k12F); } float k21F; if (float.TryParse(k21.text, out k21F)) { bug.K [0, 1] = Round(k21F); } float k22F; if (float.TryParse(k22.text, out k22F)) { bug.K [1, 1] = Round(k22F); } float bugXF; if (float.TryParse(bugX.text, out bugXF)) { bug.transform.position = new Vector3(Mathf.Round(bugXF), bug.transform.position.y, Mathf.Round(bug.transform.position.z)); } float bugYF; if (float.TryParse(bugY.text, out bugYF)) { bug.transform.position = new Vector3(Mathf.Round(bug.transform.position.x), bug.transform.position.y, Mathf.Round(bugYF)); } float bugRF; if (float.TryParse(bugR.text, out bugRF)) { bug.transform.rotation = Quaternion.AngleAxis(Mathf.Round(bugRF), Vector3.up); } float bugSizeF; if (float.TryParse(bugSize.text, out bugSizeF)) { bug.transform.localScale = new Vector3(Mathf.Round(bugSizeF), Mathf.Round(bugSizeF), Mathf.Round(bugSizeF)); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; graphics.ApplyChanges(); IsFixedTimeStep = false; IsMouseVisible = true; World = new World(Vector2.Zero); FarseerPhysics.ConvertUnits.SetDisplayUnitToSimUnitRatio(64); InputManager = new InputManager(); TimerManager = new TimerManager(); EntityManager = new EntityManager() { Game = this }; Camera = new Camera() { Game = this, SceneSize = new Point(1280, 720) }; Level = new Level(20, 20) { Game = this, TileSet = new TileSet(Content.Load <Texture2D>("ts"), 1024) }; Level[0, 0] = new Tile() { Type = 1 }; Level[1, 1] = new Tile() { Type = 2 }; Level[0, 1] = new Tile() { Type = 2 }; Level[1, 0] = new Tile() { Type = 2 }; Level[2, 0] = new Tile() { Type = 2 }; Level[0, 2] = new Tile() { Type = 1 }; Level[2, 1] = new Tile() { Type = 2 }; Level[1, 2] = new Tile() { Type = 1 }; Level[2, 2] = new Tile() { Type = 1 }; Services.AddService(TimerManager); Services.AddService(EntityManager); Services.AddService(TextureManager); b = EntityManager.Create <Buggy>(); byte[] code = b.Computer.Processor.GetAssociatedCompiler().Compile(System.IO.File.Open("BuggyCode.txt", System.IO.FileMode.Open)); var memory = new Assembler.SafeMemory(code.Length, Assembler.BinaryMultiplier.B); memory.Write(0, code); b.Computer.SwitchROM(memory); b.Computer.PowerUp(); }