public ActionResult DeleteConfirmed(int id) { PollTime pollTime = db.PollTimes.Find(id); db.PollTimes.Remove(pollTime); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,IntervalDuration")] PollTime pollTime) { if (ModelState.IsValid) { db.Entry(pollTime).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pollTime)); }
public ActionResult Create([Bind(Include = "Id,IntervalDuration")] PollTime pollTime) { if (ModelState.IsValid) { db.PollTimes.Add(pollTime); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pollTime)); }
// GET: PollTimes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PollTime pollTime = db.PollTimes.Find(id); if (pollTime == null) { return(HttpNotFound()); } return(View(pollTime)); }
void OnGUI() { AscensionNetworkInternal.DebugDrawer.IsEditor(false); { Rect r = new Rect(10, Screen.height - 30, Screen.width - 20, 20); DrawBackground(r); r.xMin += 5; r.yMin += 5; GUILayout.BeginArea(r); GUILayout.BeginHorizontal(); GUILayout.Label("Ascension Performance: ", LabelStyleBold); string pollTime = PollTime.ToString().PadLeft(3, '0'); string sendTime = SendTime.ToString().PadLeft(3, '0'); //GUILayout.Label("Send: " + System.Math.Round(Core.SendTime.TotalMilliseconds, 2)); //GUILayout.Label("Auto: " + System.Math.Round(Core.AutoscopeTime.TotalMilliseconds, 2)); //GUILayout.Label("Poll: " + System.Math.Round(Core.PollNetworkTime.TotalMilliseconds, 2)); //GUILayout.Label("Callbacks: " + System.Math.Round(Core.InvokeRemoteSceneCallbacksTime.TotalMilliseconds, 2)); //GUILayout.Label("StepLocal: " + System.Math.Round(Core.SimulateLocalAndControlledEntitiesTime.TotalMilliseconds, 2)); //GUILayout.Label("Step: " + System.Math.Round(Core.StepNonControlledRemoteEntitiesTime.TotalMilliseconds, 2)); //GUILayout.Label("Adjust: " + System.Math.Round(Core.AdjustEstimatedRemoteFramesTime.TotalMilliseconds, 2)); GUILayout.Label(string.Format("Poll {0} ms", pollTime), LabelStyleColor(GetColor(PollTime, 16))); GUILayout.Label(string.Format("Send {0} ms", sendTime), LabelStyleColor(GetColor(SendTime, 16))); GUILayout.Label(string.Format("Active Entities {0}", Core.entities.Count(x => !x.IsFrozen)), LabelStyle); GUILayout.Label(string.Format("Frozen Entities {0}", Core.entities.Count(x => x.IsFrozen)), LabelStyle); // GUILayout.EndHorizontal(); GUILayout.EndArea(); } { Camera c = Camera.main; if (!c) { return; } //Hover //Vector3 mp; //mp = c.ScreenToViewportPoint(Input.mousePosition); //mp.z = 0; foreach (Entity en in Core.entitiesThawed) { DrawEntity(en.UnityObject); } //Hover Entity hover = Core.entitiesThawed .Where(x => ignoreList.Contains(x.NetworkId) == false) .Where(x => c.WorldToViewportPoint(x.UnityObject.transform.position).ViewPointIsOnScreen()) .Where(x => { Vector3 m; m = Input.mousePosition; m.z = 0; Vector3 p; p = c.WorldToScreenPoint(x.UnityObject.transform.position); p.z = 0; return((m - p).sqrMagnitude < (32 * 32)); }) .OrderBy(x => { Vector3 center = new Vector3(0.5f, 0.5f, 0f); Vector3 vp; vp = c.WorldToViewportPoint(x.UnityObject.transform.position); vp.z = 0; return((center - vp).sqrMagnitude); }) .FirstOrDefault(); locked = hover; if (Input.GetKeyDown(KeyCode.End)) { //locked = hover; } Entity entity = locked ? locked : hover; //Center of the Screen if (Input.GetKeyDown(KeyCode.Home)) { locked = Core.entities .Where(x => ignoreList.Contains(x.NetworkId) == false) .Where(x => c.WorldToViewportPoint(x.UnityObject.transform.position).ViewPointIsOnScreen()) .OrderBy(x => { Vector3 center = new Vector3(0.5f, 0.5f, 0f); Vector3 vp; vp = c.WorldToViewportPoint(x.UnityObject.transform.position); vp.z = 0; return((center - vp).sqrMagnitude); }) .FirstOrDefault(); } if (locked && mouseOver) { Rect r = new Rect(Screen.width - 410, 10, 400, Screen.height - 20); DrawBackground(r); r.xMin += 10; r.xMax -= 10; r.yMin += 10; r.yMax -= 10; GUILayout.BeginArea(r); debugInfoScroll = GUILayout.BeginScrollView(debugInfoScroll, false, false, GUIStyle.none, GUIStyle.none); GUILayout.BeginVertical(); var state = (NetworkState)locked.Serializer; if (Input.GetKeyDown(KeyCode.L)) { AscensionNetworkInternal.DebugDrawer.SelectGameObject(locked.UnityObject.gameObject); } LabelBold("Entity Info"); LabelField("Name", locked.UnityObject.gameObject.name); LabelField("Network Id", locked.NetworkId); LabelField("Is Frozen", locked.IsFrozen); LabelField("Animator", state.Animator == null ? "NULL" : state.Animator.gameObject.name); LabelField("Entity Parent", locked.HasParent ? locked.Parent.UnityObject.ToString() : "NULL"); //LabelField("Transform Parent", entity.UnityObject.transform.parent == null ? "NULL" : entity.UnityObject.transform.parent.GetComponent<AscensionEntity>().ToString()); LabelField("Has Control", locked.HasControl); if (state.Animator != null) { for (int i = 0; i < state.Animator.layerCount; ++i) { LabelField(" Layer", state.Animator.GetLayerName(i)); #if UNITY_5 || UNITY5 var clips = state.Animator.GetCurrentAnimatorClipInfo(i); #else var clips = state.Animator.GetCurrentAnimationClipState(i); #endif foreach (var clip in clips) { LabelField(" Clip", string.Format("{0} (weight: {1})", clip.clip.name, clip.weight)); } } } if (locked.IsOwner) { LabelBold(""); LabelBold("Connection Priorities"); foreach (Connection cn in AscensionNetwork.Connections) { LabelField("Connection#" + cn.ConnectionId, cn.entityChannel.GetPriority(locked).ToString()); } } if (locked.IsOwner == false) { LabelBold(""); LabelBold("Frame Info"); LabelField("Buffer Count", state.Frames.Count); LabelField("Latest Received Number", state.Frames.Last.Frame); LabelField("Diff (Should be < 0)", AscensionNetwork.ServerFrame - state.Frames.Last.Frame); } LabelBold(""); LabelBold("World Info"); LabelField("Position", locked.UnityObject.transform.position); LabelField("Distance From Camera", (c.transform.position - locked.UnityObject.transform.position).magnitude); locked.Serializer.DebugInfo(); GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndArea(); } if (Input.GetKey(KeyCode.PageUp)) { debugInfoScroll.y = Mathf.Max(debugInfoScroll.y - 10, 0); } if (Input.GetKey(KeyCode.PageDown)) { debugInfoScroll.y = Mathf.Min(debugInfoScroll.y + 10, 2000); } } }