protected void LinkButtonAdd_Click(object sender, EventArgs e) { try { //添加需要写权限 if (!WebUtil.CheckPrivilege(WebConfig.FunctionGameServerAlertCondition, OpType.WRITE, Session)) { LabelOpMsg.Text = StringDef.NotEnoughPrivilege; return; } AlertCondition condition = MakeAlertCondition(ListBoxAlertCondition.SelectedIndex, TextBoxParam1.Text, TextBoxParam2.Text); if (condition != null) { TheAdminServer.GameServerMonitor.AlertConditions.Add(condition); //ShowMessage(StringDef.AddAlertCondition + StringDef.Colon + StringDef.Success, MessageType.Success); Response.Redirect("AlertConfig.aspx"); } } catch (Exception) { ShowMessage(StringDef.AddAlertCondition + StringDef.Colon + StringDef.Failure, MessageType.Failure); } }
private void CreateTableAlertCondition() { IList alertConditions = TheAdminServer.GameServerMonitor.AlertConditions; for (int i = 0; i < alertConditions.Count; i++) { AlertCondition condition = alertConditions[i] as AlertCondition; TableRow row = new TableRow(); TableCell cell = new TableCell(); LinkButton linkButtonRemove = new LinkButton(); linkButtonRemove.Attributes.Add(WebConfig.ParamIndex, i.ToString()); linkButtonRemove.SkinID = "PlainText"; //linkButtonRemove.NavigateUrl = "AlertConfig.aspx?" + WebConfig.ParamOperation + "=" + OperationRemoveAlertCondition + "&" + WebConfig.ParamIndex + "=" + i; linkButtonRemove.Click += LinkButtonRemove_Click; linkButtonRemove.Text = StringDef.Remove; linkButtonRemove.ID = "LinkButtonRemove" + i.ToString(); cell.Controls.Add(linkButtonRemove); row.Cells.Add(cell); cell = new TableCell(); cell.Text = (i + 1).ToString(); row.Cells.Add(cell); cell = new TableCell(); cell.Text = condition.ToString(); row.Cells.Add(cell); TableAlertCondition.Rows.Add(row); } }
public ActionResult AlertConditionDeletePV([Bind(Include = "ID")] AlertCondition alertCondition) { ResultInfo.Result res = ResultInfo.GetResultByID(1); if (ModelState.IsValid) { res = uof_repos.repoAlerts.DeleteCondition(alertCondition.ID); return(Json(res)); } return(Json(res)); }
public PartialViewResult AlertConditionEditPV(long id) { AlertCondition con = uof_repos.repoAlerts.FindCondition(id); ViewBag.ThingID = new SelectList(uof_repos.repoThings.GetList(false), "ID", "Title", con.ThingID); ViewBag.IOTypeID = new SelectList(uof_repos.repoIOTypes.GetList(false), "ID", "Title", con.IOTypeID); ViewBag.EndPointTypeID = new SelectList(uof_repos.repoEndpointTypes.GetList(), "ID", "Title", con.EndPointTypeID); ViewBag.ConditionTypeID = new SelectList(uof_repos.repoAlertConditionTypes.GetList(), "ID", "Title", con.ConditionTypeID); return(PartialView("_Conditions_Edit", con)); }
public PartialViewResult AlertConditionDeletePV(long id) { if (!User.IsInRole("Admin")) { ResultInfo.Result rm = Core.ResultInfo.GetResultByID(1); return(PartialView("_PVResult", rm)); } AlertCondition con = uof_repos.repoAlerts.FindCondition(id); return(PartialView("_Conditions_Delete", con)); }
public ResultInfo.Result DeleteCondition(long id) { try { AlertCondition con = db.AlertConditions.Find(id); db.AlertConditions.Remove(con); db.SaveChanges(); return(Result.GenerateOKResult("Deleted", con.ID.ToString())); } catch { return(Result.GenerateFailedResult()); } }
public ResultInfo.Result DeleteCondition(long id) { try { AlertCondition con = db.AlertConditions.Find(id); db.AlertConditions.Remove(con); db.SaveChanges(); return(ResultInfo.GenerateOKResult("Deleted", con.ID)); } catch { return(ResultInfo.GetResultByID(1)); } }
public AlertCondition FindCondition(long id) { AlertCondition con = new AlertCondition(); List <AlertCondition> cons = db.AlertConditions.Where(l => l.ID == id).ToList(); if (cons.Count == 1) { con = cons[0]; } else { throw new Exception("Not Found"); } return(con); }
public ActionResult AlertConditionEditPV([Bind(Include = "ID,AlertID,ThingID,IOTypeID,EndPointTypeID,ConditionTypeID,ConditionValue,IsMust")] AlertCondition alertCondition) { ResultInfo.Result res = ResultInfo.GetResultByID(1); if (ModelState.IsValid) { res = uof_repos.repoAlerts.EditCondition(alertCondition.ID , alertCondition.ThingID , alertCondition.IOTypeID , alertCondition.EndPointTypeID , alertCondition.ConditionTypeID , alertCondition.ConditionValue , alertCondition.IsMust); return(Json(res)); } return(Json(res)); }
public ResultInfo.Result EditCondition(long ID, long ThingID, long IOTypeID, long EndPointTypeID, long ConditionTypeID, string ConditionValue, bool IsMust) { try { AlertCondition con = db.AlertConditions.Find(ID); con.ThingID = ThingID; con.IOTypeID = IOTypeID; con.EndPointTypeID = EndPointTypeID; con.ConditionTypeID = ConditionTypeID; con.ConditionValue = ConditionValue; con.IsMust = IsMust; db.SaveChanges(); return(Result.GenerateOKResult("Saved", con.ID.ToString())); } catch { return(Result.GenerateFailedResult()); } }
public ResultInfo.Result AddCondition(long AlertID, long ThingID, long IOTypeID, long EndPointTypeID, long ConditionTypeID, string ConditionValue, bool IsMust) { AlertCondition con = new AlertCondition(); try { con.AlertID = AlertID; con.ThingID = ThingID; con.IOTypeID = IOTypeID; con.EndPointTypeID = EndPointTypeID; con.ConditionTypeID = ConditionTypeID; con.ConditionValue = ConditionValue; con.IsMust = IsMust; db.AlertConditions.Add(con); db.SaveChanges(); return(ResultInfo.GenerateOKResult("Saved", con.ID)); } catch { return(ResultInfo.GetResultByID(1)); } }
// Use this for initialization void Start() { eventManager = FindObjectOfType <EventManager>(); navAgent = GetComponent <NavMeshAgent>(); player = FindObjectOfType <Player>(); body = GetComponent <Rigidbody>(); triggerTag = "Player"; m_waypoints.TrimExcess(); Debug.Log("Start target tag: " + triggerTag); animator = GetComponent <Animator>(); // Detects if eye location is set if (!m_eyeLocation) { Debug.Log("Eye Location is not set"); } // Detects if waypoints are set if (m_waypoints.Count < 1) { Debug.Log("Waypoints are not set"); } //---------------------------------------------------- // The Attack Sequence // Set triggers to turn off List <string> offTriggers = new List <string>(); offTriggers.Add("Search"); offTriggers.Add("Chase"); // Set up the attack behaviour PlayAnimation attackAnimation = new PlayAnimation(); attackAnimation.SetParameters(animator, "DeathSequence", offTriggers); // Set up condition for the attack sequence Triggered attackCondition = new Triggered(); // Set up attack sequence Sequence attackSequence = new Sequence(); attackSequence.addBehaviour(attackCondition); attackSequence.addBehaviour(attackAnimation); // --------------------------------------------------- // The Drill Sequence // Set up the drill condition DrillBehaviour drillBehaviour = new DrillBehaviour(); drillBehaviour.SetParameters(false); // Set up drill animation PlayAnimation drillAnimation = new PlayAnimation(); drillAnimation.SetParameters(animator, "DrillSequence", null, onDoorDrilling); // Set up drill sequence Sequence drillSequence = new Sequence(); drillSequence.addBehaviour(drillBehaviour); //drillSequence.addBehaviour(seekPanel); drillSequence.addBehaviour(drillAnimation); // --------------------------------------------------- // The Rage Sequence // Set up the rage condition DrillBehaviour rageBehaviour = new DrillBehaviour(); rageBehaviour.SetParameters(true); // Set up rage animation PlayAnimation rageAnimation = new PlayAnimation(); rageAnimation.SetParameters(animator, "RageSequence"); // Set up rage sequence Sequence rageSequence = new Sequence(); rageSequence.addBehaviour(rageBehaviour); rageSequence.addBehaviour(rageAnimation); //---------------------------------------------------- // The Proximity Sequence // Set up within range condition for search sequence WithinRange withinSearch = new WithinRange(); withinSearch.SetParameters(player.gameObject, m_searchRange); // Set up line of sight condition for search sequence LineOfSight inSight = new LineOfSight(); inSight.SetParameters(player.gameObject, m_sightRange, m_eyeLocation); // Set up the close chase behaviour SetTargetBehaviour closeChase = new SetTargetBehaviour(); closeChase.SetParameters(player.gameObject, m_searchSpeed, "CloseChase", onProximityDetection); // Set up arm extended animation PlayAnimation armExtended = new PlayAnimation(); armExtended.SetParameters(animator, "ArmExtended"); // Set up chase sequence Sequence closeChaseSequence = new Sequence(); closeChaseSequence.addBehaviour(withinSearch); closeChaseSequence.addBehaviour(inSight); closeChaseSequence.addBehaviour(closeChase); closeChaseSequence.addBehaviour(armExtended); //---------------------------------------------------- // The Search Sequence // Turn towards the player FaceTarget facePlayer = new FaceTarget(); facePlayer.SetParameters(player.gameObject, m_rotationSpeed); // Set up arm extended animation PlayAnimation searchAnimation = new PlayAnimation(); searchAnimation.SetParameters(animator, "Search", null, searching); // Set up search sequence Sequence searchSequence = new Sequence(); searchSequence.addBehaviour(withinSearch); searchSequence.addBehaviour(facePlayer); searchSequence.addBehaviour(searchAnimation); //---------------------------------------------------- // The Chase Sequence // Set up the chase behaviour SetTargetBehaviour chasePlayer = new SetTargetBehaviour(); chasePlayer.SetParameters(player.gameObject, m_chaseSpeed, "Chase", chasing); // Set up within range condition for chase sequence WithinRange withinChase = new WithinRange(); withinChase.SetParameters(player.gameObject, m_sightRange); // Set up chase sequence Sequence chaseSequence = new Sequence(); chaseSequence.addBehaviour(withinChase); chaseSequence.addBehaviour(inSight); chaseSequence.addBehaviour(chasePlayer); //---------------------------------------------------- // The Investigate Sequence // Set up alert condition AlertCondition alertCondition = new AlertCondition(); // Set up investigate sequence Sequence investigateSequence = new Sequence(); investigateSequence.addBehaviour(alertCondition); investigateSequence.addBehaviour(m_investigateArea); //---------------------------------------------------- // The Patrol Sequence // Set up the patrol targets Patrol patrolDestination = new Patrol(); patrolDestination.SetParameters(m_waypoints); // Set up the patrol behaviour SetTargetBehaviour patrolBehaviour = new SetTargetBehaviour(); patrolBehaviour.SetParameters(patrolDestination, m_patrolSpeed, "Patrol", patrolling); // Look for nearest waypoint then continue with the patrol from there //---------------------------------------------------- // The Main Selector // Set up main selector Selector mainSelector = new Selector(); mainSelector.addBehaviour(attackSequence); mainSelector.addBehaviour(drillSequence); mainSelector.addBehaviour(rageSequence); mainSelector.addBehaviour(closeChaseSequence); mainSelector.addBehaviour(searchSequence); mainSelector.addBehaviour(chaseSequence); mainSelector.addBehaviour(investigateSequence); mainSelector.addBehaviour(patrolBehaviour); // Add all sequences to the behaviour list m_behaviours.Add(mainSelector); }
// Use this for initialization void Start() { drScript = GetComponent <DrLeben>(); if (drScript) { drScript.enabled = false; } //lebenAudio = GetComponent<AudioSource> (); eventManager = FindObjectOfType <EventManager>(); navAgent = GetComponent <NavMeshAgent>(); player = FindObjectOfType <Player>(); navAgent.SetDestination(transform.position); animator = GetComponent <Animator>(); // --------------------------------------------------- // The Drill Sequence // Set up the drill condition InitialDrill drillBehaviour = new InitialDrill(); drillBehaviour.SetParameters(false); // Set up drill animation PlayAnimation drillAnimation = new PlayAnimation(); drillAnimation.SetParameters(animator, "DrillSequence"); // Set up drill sequence Sequence drillSequence = new Sequence(); drillSequence.addBehaviour(drillBehaviour); //drillSequence.addBehaviour(seekPanel); drillSequence.addBehaviour(drillAnimation); // --------------------------------------------------- // The Rage Sequence // Set up the rage condition InitialDrill rageBehaviour = new InitialDrill(); rageBehaviour.SetParameters(true); // Set up rage animation PlayAnimation rageAnimation = new PlayAnimation(); rageAnimation.SetParameters(animator, "RageSequence"); // Set up rage sequence Sequence rageSequence = new Sequence(); rageSequence.addBehaviour(rageBehaviour); rageSequence.addBehaviour(rageAnimation); //---------------------------------------------------- // The Investigate Sequence // Set up alert condition AlertCondition alertCondition = new AlertCondition(); // Set up investigate sequence Sequence investigateSequence = new Sequence(); investigateSequence.addBehaviour(alertCondition); investigateSequence.addBehaviour(m_investigateArea); //---------------------------------------------------- // The Main Selector // Set up main selector Selector mainSelector = new Selector(); mainSelector.addBehaviour(drillSequence); mainSelector.addBehaviour(rageSequence); mainSelector.addBehaviour(investigateSequence); // Add all sequences to the behaviour list m_behaviours.Add(mainSelector); //if (!batonReference) // Debug.Log("Baton Reference not set on Dr. Leben"); }