public override void DoUpdate(float deltaTime) { if (bindTransforms == null || bindTransforms.Count == 0) { return; } actionTarget = SelectionTargetUtil.GetActionTarget(m_Context, aeeData.TargetSelection.Value); if (actionTarget == null || actionTarget.TargetType == ActionTargetType.None) { Leyoutech.Utility.DebugUtility.LogWarning("AddEmitLinkTargetDurationEffectAction", "AddEmitLinkTargetDurationEffectAction::DoEnter->target not found"); return; } //Leyoutech.Utility.DebugUtility.LogWarning("连接特效", string.Format("目标,entity = {0},偏移 offset = {1}", actionTarget.TargetEntity, actionTarget.TargetEntityHitPositionOffet)); foreach (var effect in effects) { if (actionTarget.TargetType == ActionTargetType.Entity) { if (aeeData.TargetSelection.Value.TargetSecondType == Eternity.FlatBuffer.Enums.TargetSecondType.Entity) { EffectActionUtil.ChangeLinkEffectTarget(effect, actionTarget.TargetEntity, Vector3.zero); } else { EffectActionUtil.ChangeLinkEffectTarget(effect, actionTarget.TargetEntity, actionTarget.TargetEntityHitPositionOffet); } } else { EffectActionUtil.ChangeLinkEffectTarget(effect, actionTarget.TargetPosition); } } }
public ActionOperation(ActionTarget target, string name, string path, Action actionWhenSelected) { switch (target) { case ActionTarget.None: break; case ActionTarget.Selection: name = $"{name} (Selection)"; break; case ActionTarget.Scene: name = $"{name} (In Scene)"; break; case ActionTarget.All: name = $"{name} (All)"; break; default: throw new ArgumentOutOfRangeException(nameof(target), target, null); } this.actionWhenSelected = actionWhenSelected; Name = name; Path = path; Target = ActionTarget.None; }
private static void AddPrefabMenuItems(ref GenericMenu menu, ActionUtility.ActionCreationParams actionParams) { Type type = actionParams.parameter.GetType(); List <Type> actionsSortedByCategory = ActionTargets.GetActionsSortedByCategory(); using (List <Type> .Enumerator enumerator = actionsSortedByCategory.GetEnumerator()) { while (enumerator.MoveNext()) { Type current = enumerator.get_Current(); ActionUtility.ActionCreationParams actionCreationParams = new ActionUtility.ActionCreationParams(actionParams); List <ActionTarget> actionTargets = ActionTargets.GetActionTargets(current); using (List <ActionTarget> .Enumerator enumerator2 = actionTargets.GetEnumerator()) { while (enumerator2.MoveNext()) { ActionTarget current2 = enumerator2.get_Current(); if (current2.get_AllowPrefabs() && current2.get_ObjectType().IsAssignableFrom(type)) { actionCreationParams.actionType = current; actionCreationParams.actionTarget = current2; menu.AddItem(new GUIContent(Labels.GetActionLabel(current)), false, new GenericMenu.MenuFunction2(ActionUtility.AddAction), actionCreationParams); } } } } } }
public async Task <IActionResult> Delete(int id) { if (ModelState.IsValid) { try { ActionTarget _actionTarget = _unitOfWork.ActionTarget.GetSingleOrDefault(e => e.Id == id); if (_actionTarget != null) { _unitOfWork.ActionTarget.Remove(_actionTarget); await _unitOfWork.SaveChangesAsync(); return(Ok("OK")); } else { return(BadRequest()); } } catch (Exception ex) { return(BadRequest(ex.Data)); } } else { return(BadRequest(ModelState)); } }
private void HandleAction(ActionTarget target) { // hoo boy var chest = target as Chest; if (chest) { if (!PlaceMode) { return; } HandleChest(chest); } var pot = target as Pot; if (pot) { if (!PlaceMode) { return; } HandlePot(pot); } }
public void TryTool(HandApply interaction) { Stored = interaction; ThisSurgeryStep = null; ThisSurgeryStep = SurgeryProcedureBase.SurgerySteps[CurrentStep]; if (ThisSurgeryStep != null) { if (Validations.HasItemTrait(interaction.HandObject, ThisSurgeryStep.RequiredTrait)) { string StartSelf = ApplyChatModifiers(ThisSurgeryStep.StartSelf); string StartOther = ApplyChatModifiers(ThisSurgeryStep.StartOther); string SuccessSelf = ApplyChatModifiers(ThisSurgeryStep.SuccessSelf); string SuccessOther = ApplyChatModifiers(ThisSurgeryStep.SuccessOther); string FailSelf = ApplyChatModifiers(ThisSurgeryStep.FailSelf); string FailOther = ApplyChatModifiers(ThisSurgeryStep.FailOther); ToolUtils.ServerUseToolWithActionMessages(interaction.Performer, interaction.HandObject, ActionTarget.Object(interaction.TargetObject.RegisterTile()), ThisSurgeryStep.Time, StartSelf, StartOther, SuccessSelf, SuccessOther, SuccessfulProcedure, FailSelf, FailOther, UnsuccessfulProcedure); return; } } if (Validations.HasItemTrait(interaction.HandObject, CommonTraits.Instance.Cautery)) { CancelSurgery(); } }
public async Task <IActionResult> Put(int id, [FromBody] ActionTargetViewModel actionTarget) { if (ModelState.IsValid) { try { ActionTarget _actionTarget = _unitOfWork.ActionTarget.GetSingleOrDefault(e => e.Id == actionTarget.Id); _actionTarget.Actions = _unitOfWork.Actions.GetSingleOrDefault(e => e.Id == actionTarget.ActionsId); _actionTarget.Group = actionTarget.GroupId == null ? _actionTarget.Group : _unitOfWork.Group.GetSingleOrDefault(e => e.Id == actionTarget.GroupId); _actionTarget.Target = actionTarget.Target; _unitOfWork.ActionTarget.Update(_actionTarget); await _unitOfWork.SaveChangesAsync(); return(Ok("OK")); } catch (Exception ex) { return(BadRequest(ex.Data)); } } else { return(BadRequest(ModelState)); } }
/* * "Damage": * { * "Target":"TARGET", * "DamageFlags" : ["DAMAGE_FLAG_CRIT","DAMAGE_FLAG_LIFELINK"], * "DamageType" : "DAMAGE_TYPE_PHYSICAL", * "ValueSource": * { * "ValueBasicParams":[0, 0], * "ValueAdditionParams": * [ * { * "ValueSourceType":"SOURCE_TYPE_PHYSICAL_ATTACK", * "ValueSourceParams":[27500, 0] * } * ] * } * "OnSuccess": * { * "FireSound": * { * "SoundType":"SOUND_NORMAL", * "SoundName":99082 * } * } * }*/ private static D2Action CreateDamageAction(JsonData json, ActionTarget actionTarget, AbilityData abilityData) { var damageTypeConfig = GetStringValue(json, "DamageType"); if (damageTypeConfig == null) { return(null); } var damageType = GetEnumValue <AbilityDamageType>(damageTypeConfig); var damageFlagConfig = GetJsonValue(json, "DamageFlags"); if (damageFlagConfig == null) { return(null); } AbilityDamageFlag damageFlag = ParseDamageFlagArray(damageFlagConfig); var damageValueSource = ParseValueSource(json, abilityData); var dealDamageSuccessActionConfig = GetJsonValue(json, "OnSuccess"); var actions = ParseActions(dealDamageSuccessActionConfig, abilityData); var d2Action_Damage = new D2Action_Damage(damageType, damageFlag, damageValueSource, actions, actionTarget); return(d2Action_Damage); }
public StartProgressInfo(float timeForCompletion, ActionTarget target, GameObject performer, ProgressBar progressBar) { TimeForCompletion = timeForCompletion; Target = target; Performer = performer; ProgressBar = progressBar; }
private void AddDefaultHandlerForAction(RouteHandler routes, MethodInfo info) { ManosAction action = ActionForMethod(info); ActionTarget target = new ActionTarget(action); AddImplicitRouteHandler(target, new string [] { "/" + info.Name }, HttpMethods.RouteMethods); }
private void AddHandlerForAction(RouteHandler routes, HttpMethodAttribute att, MethodInfo info) { ManosAction action = ActionForMethod(info); ActionTarget target = new ActionTarget(action); AddImplicitRouteHandler(target, att.Patterns, att.Methods); }
private static void AddObjectMenuItems(ref GenericMenu menu, ActionUtility.ActionCreationParams actionParams, bool isSubMenu = false) { Type type = actionParams.parameter.GetType(); string text = isSubMenu ? (Labels.StripNamespace(type.get_FullName()) + '/') : ""; List <Type> actionsSortedByCategory = ActionTargets.GetActionsSortedByCategory(); using (List <Type> .Enumerator enumerator = actionsSortedByCategory.GetEnumerator()) { while (enumerator.MoveNext()) { Type current = enumerator.get_Current(); ActionUtility.ActionCreationParams actionCreationParams = new ActionUtility.ActionCreationParams(actionParams); List <ActionTarget> actionTargets = ActionTargets.GetActionTargets(current); using (List <ActionTarget> .Enumerator enumerator2 = actionTargets.GetEnumerator()) { while (enumerator2.MoveNext()) { ActionTarget current2 = enumerator2.get_Current(); if (ActionUtility.PinToTopOfMenu(current) && current2.get_ObjectType().IsAssignableFrom(type)) { actionCreationParams.actionType = current; actionCreationParams.actionTarget = current2; menu.AddItem(new GUIContent(text + Labels.GetActionLabel(current)), false, new GenericMenu.MenuFunction2(ActionUtility.AddAction), actionCreationParams); } } } } } if (menu.GetItemCount() > 2) { menu.AddSeparator(text); } using (List <Type> .Enumerator enumerator3 = actionsSortedByCategory.GetEnumerator()) { while (enumerator3.MoveNext()) { Type current3 = enumerator3.get_Current(); ActionUtility.ActionCreationParams actionCreationParams2 = new ActionUtility.ActionCreationParams(actionParams); List <ActionTarget> actionTargets2 = ActionTargets.GetActionTargets(current3); using (List <ActionTarget> .Enumerator enumerator4 = actionTargets2.GetEnumerator()) { while (enumerator4.MoveNext()) { ActionTarget current4 = enumerator4.get_Current(); if (!ActionUtility.PinToTopOfMenu(current3) && current4.get_ObjectType().IsAssignableFrom(type)) { actionCreationParams2.actionType = current3; actionCreationParams2.actionTarget = current4; string actionLabel = Labels.GetActionLabel(current3); string text2 = Actions.GetActionCategory(current3) + '/'; menu.AddItem(new GUIContent(text + text2 + actionLabel), false, new GenericMenu.MenuFunction2(ActionUtility.AddAction), actionCreationParams2); } } } } } }
/// <summary> /// Performs common tool usage logic and also sends start / end action messages, and invokes a callback on success. /// </summary> /// <param name="handApply">interaction causing the tool use</param> /// <param name="seconds">seconds taken to perform the action, 0 if it should be instant</param> /// <param name="performerStartActionMessage">message to show performer when action begins.</param> /// <param name="othersStartActionMessage">message to show others when action begins.</param> /// <param name="performerFinishActionMessage">message to show performer when action completes successfully.</param> /// <param name="othersFinishActionMessage">message to show others when action completes successfully.</param> /// <param name="onSuccessfulCompletion">called when action is completed</param> public static void ServerUseToolWithActionMessages(HandApply handApply, float seconds, string performerStartActionMessage, string othersStartActionMessage, string performerFinishActionMessage, string othersFinishActionMessage, Action onSuccessfulCompletion) { ServerUseToolWithActionMessages(handApply.Performer, handApply.HandObject, ActionTarget.Object(handApply.TargetObject.RegisterTile()), seconds, performerStartActionMessage, othersStartActionMessage, performerFinishActionMessage, othersFinishActionMessage, onSuccessfulCompletion); }
public void Invoke_ActionIsInvoked() { bool action_set = false; var mat = new ActionTarget(ctx => action_set = true); mat.Invoke(new ManosAppStub(), new ManosContextStub()); Assert.IsTrue(action_set); }
/// <summary> /// Performs common tool usage logic and also sends start / end action messages, and invokes a callback on success. /// </summary> /// <param name="handApply">interaction causing the tool use</param> /// <param name="seconds">seconds taken to perform the action, 0 if it should be instant</param> /// <param name="performerStartActionMessage">message to show performer when action begins.</param> /// <param name="othersStartActionMessage">message to show others when action begins.</param> /// <param name="performerFinishActionMessage">message to show performer when action completes successfully.</param> /// <param name="othersFinishActionMessage">message to show others when action completes successfully.</param> /// <param name="onSuccessfulCompletion">called when action is completed</param> public static void ServerUseToolWithActionMessages(PositionalHandApply handApply, float seconds, string performerStartActionMessage, string othersStartActionMessage, string performerFinishActionMessage, string othersFinishActionMessage, Action onSuccessfulCompletion) { ServerUseToolWithActionMessages(handApply.Performer, handApply.HandObject, ActionTarget.Tile(handApply.WorldPositionTarget), seconds, performerStartActionMessage, othersStartActionMessage, performerFinishActionMessage, othersFinishActionMessage, onSuccessfulCompletion); }
// 大招技能指示器解析,这部分有点冗余,是自己抽出来的,不是dota源解析,那dota是怎么实现技能指示器的 private static ActionTarget ParseAbilityRange(JsonData json, AbilityData abilityData) { if (json == null) { return(null); } var actionTarget = new ActionTarget(); var targetTeam = GetEnumValue <MultipleTargetsTeam>(json, "AbilityUnitTargetTeam"); actionTarget.SetTargetTeam(targetTeam); var abilityBehavior = abilityData.abilityBehavior; if ((abilityBehavior & AbilityBehavior.ABILITY_BEHAVIOR_DIRECTIONAL) != 0) { var lineJsonData = GetJsonValue(json, "AbilityAoeLine"); if (lineJsonData == null) { BattleLog.LogError("技能[{0}]行为是ABILITY_BEHAVIOR_LINE_AOE,未找到AbilityAoeLine配置", abilityData.configFileName); return(null); } var length = (float)GetJsonValue(lineJsonData, "Length"); var thickness = (float)GetJsonValue(lineJsonData, "Thickness"); actionTarget.SetLineAoe(ActionMultipleTargetsCenter.CASTER, length, thickness); } if ((abilityBehavior & AbilityBehavior.ABILITY_BEHAVIOR_SECTOR_AOE) != 0) { var sectorJsonData = GetJsonValue(json, "AbilityAoeSector"); if (sectorJsonData == null) { BattleLog.LogError("技能[{0}]行为是ABILITY_BEHAVIOR_SECTOR_AOE,未找到AbilityAoeSector配置", abilityData.configFileName); return(null); } var sectorRadius = (float)GetJsonValue(sectorJsonData, "Radius"); var angle = (float)GetJsonValue(sectorJsonData, "Angle"); actionTarget.SetSectorAoe(ActionMultipleTargetsCenter.CASTER, sectorRadius, angle); } if ((abilityBehavior & AbilityBehavior.ABILITY_BEHAVIOR_RADIUS_AOE) != 0) { var radiusJson = GetJsonValue(json, "AbilityAoeRadius"); if (radiusJson == null) { BattleLog.LogError("技能[{0}]行为是ABILITY_BEHAVIOR_RADIUS_AOE,未找到AbilityAoeRadius配置", abilityData.configFileName); return(null); } float radius = (float)radiusJson; actionTarget.SetRadiusAoe(ActionMultipleTargetsCenter.CASTER, radius); } return(actionTarget); }
public void Invoke_ActionIsInvoked() { bool action_set = false; var mat = new ActionTarget (ctx => action_set = true); mat.Invoke (new ManosAppStub (), new ManosContextStub ()); Assert.IsTrue (action_set); }
public override void Execute(Action action, ActionTarget actionTarget) { currentAction = (ShootAction)action; currentTarget = actionTarget.targetLocation; rotateTo = rotationPoint.GetLookAtAngle(currentTarget); rotateTo = rotateTo < 0 ? 360 - Mathf.Abs(rotateTo) : rotateTo; active = true; nextShootTime = 0; bulletsLeft = currentAction.numberOfShoots; }
public void MemoryLeakFreeWithNoInvocation() { var target = new ActionTarget(); var weakAction = new WeakAction(target, target.PublicActionToExecute); target = null; GC.Collect(); Assert.IsFalse(weakAction.IsTargetAlive); }
public static void Init() { var target = new ActionTarget { Action = _ => LastMessage = _.Message }; LogManagerFactory.DefaultConfiguration = new LoggingConfiguration(); LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Debug, target); }
public static void Init() { var target = new ActionTarget { Action = _ => LastMessage = _.Message }; LogManagerFactory.DefaultConfiguration = new LoggingConfiguration(); LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Debug, target); }
public void MemoryLeakFreeWithNoInvocation() { var target = new ActionTarget(); var weakAction = new WeakAction(target, target.PublicActionToExecute); target = null; GC.Collect(); Assert.IsFalse(weakAction.IsTargetAlive); }
public ActionCreationParams(ActionUtility.ActionCreationParams source) { this.fsm = source.fsm; this.state = source.state; this.actionType = source.actionType; this.actionTarget = source.actionTarget; this.parameter = source.parameter; this.beforeAction = source.beforeAction; this.position = source.position; }
protected override void Awake() { base.Awake(); mSprite = GetComponentInChildren<tk2dAnimatedSprite>(); mStats = GetComponentInChildren<StatBase>(); mActTarget = GetComponentInChildren<ActionTarget>(); //hook calls up }
private void AddHandlerForAction(RouteHandler routes, HttpMethodAttribute att, MethodInfo info) { ManosAction action = ActionForMethod(info); ActionTarget target = new ActionTarget(action); string[] patterns = null == att.Patterns ? new string [] { "/" + info.Name } : att.Patterns; AddImplicitRouteHandlerForTarget(target, OpsForPatterns(patterns, att.MatchType), att.Methods); }
/// <summary> /// Performs common tool usage logic and also sends start / end action messages, and invokes a callback on success. /// </summary> /// <param name="handApply">interaction causing the tool use</param> /// <param name="seconds">seconds taken to perform the action, 0 if it should be instant</param> /// <param name="performerStartActionMessage">message to show performer when action begins.</param> /// <param name="othersStartActionMessage">message to show others when action begins.</param> /// <param name="performerFinishActionMessage">message to show performer when action completes successfully.</param> /// <param name="othersFinishActionMessage">message to show others when action completes successfully.</param> /// <param name="onSuccessfulCompletion">called when action is completed</param> /// <param name="performerFailMessage">message to show performer when action completes unsuccessfully.</param> /// <param name="othersFailMessage">message to show others when action completes unsuccessfully.</param> /// <param name="onFailComplete">called when action is completed unsuccessfully.</param> /// <param name="playSound">Whether to play default tool sound</param> public static void ServerUseToolWithActionMessages(PositionalHandApply handApply, float seconds, string performerStartActionMessage, string othersStartActionMessage, string performerFinishActionMessage, string othersFinishActionMessage, Action onSuccessfulCompletion, string performerFailMessage = "", string othersFailMessage = "", Action onFailComplete = null, bool playSound = true) { ServerUseToolWithActionMessages(handApply.Performer, handApply.HandObject, ActionTarget.Tile(handApply.WorldPositionTarget), seconds, performerStartActionMessage, othersStartActionMessage, performerFinishActionMessage, othersFinishActionMessage, onSuccessfulCompletion, performerFailMessage, othersFailMessage, onFailComplete, playSound); }
public static void Init() { var actionTarget = new ActionTarget { Action = _ => LastMessage = _.Message }; var config = new LoggingConfiguration(); config.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, actionTarget)); config.AddTarget("debugger", actionTarget); LogManager.Configuration = config; }
/// <summary> /// Performs common tool usage logic and also sends start / end action messages, and invokes a callback on success. /// </summary> /// <param name="tileApply">interaction causing the tool use</param> /// <param name="seconds">seconds taken to perform the action, 0 if it should be instant</param> /// <param name="performerStartActionMessage">message to show performer when action begins.</param> /// <param name="othersStartActionMessage">message to show others when action begins.</param> /// <param name="performerFinishActionMessage">message to show performer when action completes successfully.</param> /// <param name="othersFinishActionMessage">message to show others when action completes successfully.</param> /// <param name="onSuccessfulCompletion">called when action is completed</param> /// <param name="performerFailMessage">message to show performer when action completes unsuccessfully.</param> /// <param name="othersFailMessage">message to show others when action completes unsuccessfully.</param> /// <param name="onFailComplete">called when action is completed unsuccessfully.</param> public static void ServerUseToolWithActionMessages(TileApply tileApply, float seconds, string performerStartActionMessage, string othersStartActionMessage, string performerFinishActionMessage, string othersFinishActionMessage, Action onSuccessfulCompletion, string performerFailMessage = "", string othersFailMessage = "", Action onFailComplete = null) { ServerUseToolWithActionMessages(tileApply.Performer, tileApply.HandObject, ActionTarget.Tile(tileApply.WorldPositionTarget), seconds, performerStartActionMessage, othersStartActionMessage, performerFinishActionMessage, othersFinishActionMessage, onSuccessfulCompletion, performerFailMessage, othersFailMessage, onFailComplete); }
private void TryApplyGhostNote() { if (noteTrack.TryUpdate(grabbedNoteIndex, ghostNote)) { Event.current.Use(); if (DataUpdated != null) { DataUpdated(); } } currentActionTarget = ActionTarget.Empty; }
public static void CaptureLogMessages() { var config = new LoggingConfiguration(); var target = new ActionTarget { Action = info => LoggingEvents.Add(info) }; config.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, target)); config.AddTarget("debugger", target); LogManager.Configuration = config; }
public static void Init() { var actionTarget = new ActionTarget { Action = _ => LastMessage = _.Message }; var config = new LoggingConfiguration(); config.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, actionTarget)); config.AddTarget("debugger", actionTarget); LogManager.Configuration = config; }
private void OnMouseDown() { var mousePos = Event.current.mousePosition; float beat; int subTrack; if (BeatAtPosition(mousePos, out beat) && SubtrackAtPosition(mousePos, out subTrack)) { int noteIndex = noteTrack.notes.FindIndex(x => x.subTrack == subTrack && x.Contains(beat)); if (noteIndex != -1) { //Clicked on a note var note = noteTrack.notes[noteIndex]; var bounds = BoundsForNote(note); grabStart = mousePos; grabOffset = mousePos - bounds.position; grabbedNoteIndex = noteIndex; if (Event.current.button == 0) { if (bounds.RightBorder(NoteResizeBorderWidth).Contains(mousePos)) { currentActionTarget = ActionTarget.NoteCornerRight; } else if (bounds.LeftBorder(NoteResizeBorderWidth).Contains(mousePos)) { currentActionTarget = ActionTarget.NoteCornerLeft; } else { currentActionTarget = ActionTarget.Note; } } else if (Event.current.button == 2) { noteTrack.notes.RemoveAt(noteIndex); } } else { if (Event.current.clickCount == 2) { if (TryCreateNoteAtMousePosition() && DataUpdated != null) { DataUpdated(); } } } Event.current.Use(); } }
public static void CaptureLogMessages() { var config = new LoggingConfiguration(); var target = new ActionTarget { Action = info => Messages.Add(info) }; config.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, target)); config.AddTarget("debugger", target); LogManager.Configuration = config; }
protected void StartUnwrapAction(GameObject performer) { var cfg = new StandardProgressActionConfig( StandardProgressActionType.Restrain); Chat.AddActionMsgToChat( performer, string.Format(originatorUnwrapText, gameObject.ExpensiveName()), string.Format(othersUnwrapText, performer.ExpensiveName(), gameObject.ExpensiveName())); StandardProgressAction.Create(cfg, UnWrap) .ServerStartProgress(ActionTarget.Object(performer.RegisterTile()), timeToUnwrap, performer); }
public BattlerAction( string name, int requiredSP, float power, ActionTarget actionTarget, Action<IBattler, IBattler> execute) { Name = name; RequiredSP = requiredSP; Power = power; ActionTarget = actionTarget; Execute = execute; }
public override void Trigger() { IBaseActionProperty property = m_Context.GetObject <IBaseActionProperty>(); AddBindLinkTargetEffectData data = GetData <AddBindLinkTargetEffectData>(); IBindNodeActionProperty bindNodeProperty = m_Context.GetObject <IBindNodeActionProperty>(); ActionTarget actionTarget = SelectionTargetUtil.GetActionTarget(m_Context, data.TargetSelection.Value); if (actionTarget == null || actionTarget.TargetType == ActionTargetType.None) { Leyoutech.Utility.DebugUtility.LogWarning("AddBindLinkTargetEffectAction", "AddBindLinkTargetEffectAction::Trigger->target not found"); return; } List <Transform> bindTransforms = null; if (bindNodeProperty.GetPresentation() == null) { Leyoutech.Utility.DebugUtility.LogWarning("查找挂点", string.Format("bindNodeProperty.GetPresentation() == null ,Entity = {0} ,ItemId = {1} " + "模型未加载完毕,挂点脚本未被赋值!, 此时挂点作 root 处理", property.EntityId(), property.GetItemID())); bindTransforms = new List <Transform>(); bindTransforms.Add(property.GetRootTransform()); } else { bindTransforms = bindNodeProperty.GetPresentation().GetBindNode(data.NodeType.ToLaunchPoint(), data.NodeIndex); } foreach (var tran in bindTransforms) { if (actionTarget.TargetType == ActionTargetType.Entity) { if (data.TargetSelection.Value.TargetSecondType == Eternity.FlatBuffer.Enums.TargetSecondType.Entity) { EffectActionUtil.CreateEffect(data.Address, tran, property.IsMain(), actionTarget.TargetEntity, Vector3.zero); } else { EffectActionUtil.CreateEffect(data.Address, tran, property.IsMain(), actionTarget.TargetEntity, actionTarget.TargetEntityHitPositionOffet); } } else { EffectActionUtil.CreateEffect(data.Address, tran, property.IsMain(), actionTarget.TargetPosition); } } }
public ActionInfo(Type type) { this.action = type.GetConstructor(new Type[0]).Invoke(new object[0]); this.priority = PriorityAttribute.GetPriority(this.action, 1000); this.text = CaptionAttribute.GetCaption(this.action, type.Name); this.description = BAL.Types.AttributesExtensions.GetDescription(null, this.action); var pinfo = type.GetProperty("Target", BindingFlags.Instance | BindingFlags.Public); if (pinfo != null) { this.target = (ActionTarget)pinfo.GetValue(this.action, null); } else { this.target = ActionTarget.None; } pinfo = type.GetProperty("MarginLeft", BindingFlags.Instance | BindingFlags.Public); if (pinfo != null) { this.MarginLeft = (int)pinfo.GetValue(this.action, null); } pinfo = type.GetProperty("MarginRight", BindingFlags.Instance | BindingFlags.Public); if (pinfo != null) { this.MarginRight = (int)pinfo.GetValue(this.action, null); } pinfo = type.GetProperty("MarginTop", BindingFlags.Instance | BindingFlags.Public); if (pinfo != null) { this.MarginTop = (int)pinfo.GetValue(this.action, null); } pinfo = type.GetProperty("MarginBottom", BindingFlags.Instance | BindingFlags.Public); if (pinfo != null) { this.MarginBottom = (int)pinfo.GetValue(this.action, null); } this.propertySelectedRows = type.GetProperty("SelectedRows"); this.propertyCurrentRow = type.GetProperty("CurrentRow"); this.propertyFireReload = type.GetProperty("FireReload"); this.propertyFireRefresh = type.GetProperty("FireRefresh"); this.propertyFireSelectionChanged = type.GetProperty("FireSelectionChanged"); this.methodOnAction = type.GetMethod("OnAction", BindingFlags.Instance | BindingFlags.Public); this.methodOnSelectionChanged = type.GetMethod("OnSelectionChanged", BindingFlags.Instance | BindingFlags.Public); }
public void NonGeneric_PublicMethod() { var target = new ActionTarget(); var weakAction = new WeakAction(target, target.PublicActionToExecute); Assert.IsTrue(weakAction.Execute()); Assert.AreEqual(1, target.PublicActionExecutedCount); target = null; GC.Collect(); Assert.IsFalse(weakAction.IsTargetAlive); }
public UnitEntity GrabUnit(UnitType type, ActionTarget.Priority priority) { HashSet<UnitEntity> units; UnitEntity ret = null; if(mUnitsByType.TryGetValue(type, out units)) { foreach(UnitEntity unit in units) { ActionListener listener = unit.listener; if(!listener.lockAction && listener.currentPriority <= priority) { ret = unit; break; } } } return ret; }
public NLogTests() { beforeAssemblyPath = Path.GetFullPath(@"..\..\..\NLogAssemblyToProcess\bin\Debug\NLogAssemblyToProcess.dll"); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); var config = new LoggingConfiguration(); var target = new ActionTarget { Action = LogEvent }; config.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, target)); config.AddTarget("debuger", target); LogManager.Configuration = config; }
public MetroLogTests() { AppDomainAssemblyFinder.Attach(); beforeAssemblyPath = Path.GetFullPath(@"..\..\..\MetroLogAssemblyToProcess\bin\Debug\MetroLogAssemblyToProcess.dll"); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath); assembly = Assembly.LoadFile(afterAssemblyPath); var target = new ActionTarget { Action = LogEvent }; LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Trace, target); LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Debug, target); LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Warn, target); LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Info, target); LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Error, target); LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Fatal, target); }
public IEnumerable GetTargetFilter(ActionTarget target) { foreach(KeyValuePair<UnitType, HashSet<UnitEntity>> key in mUnitsByType) { foreach(UnitEntity unit in key.Value) { ActionListener listener = unit.listener; if(!listener.lockAction && target.vacancy && listener.currentPriority <= target.priority) { switch(target.type) { case ActionType.Attack: StatBase targetStats = target.GetComponentInChildren<StatBase>(); if(targetStats == null || unit.stats.CanDamage(targetStats)) { yield return unit; } break; default: yield return unit; break; } } } } }
public IEnumerable GetTargetFilter(UnitType type, ActionTarget target) { HashSet<UnitEntity> units; if(mUnitsByType.TryGetValue(type, out units)) { foreach(UnitEntity unit in units) { ActionListener listener = unit.listener; if(target.vacancy && listener.currentPriority <= target.priority) { switch(target.type) { case ActionType.Attack: StatBase targetStats = target.GetComponentInChildren<StatBase>(); if(targetStats == null || unit.stats.CanDamage(targetStats)) { yield return unit; } break; default: yield return unit; break; } } } } }
public void ActionSetter_InvalidDelegateType_Throws() { var mat = new ActionTarget (new ManosAction (ValidAction)); Should.Throw<InvalidOperationException> (() => mat.Action = new InvalidDelegate (InvalidAction)); }
public void Ctor_ValidActon_SetsAction() { var mat = new ActionTarget (ValidAction); Assert.AreEqual (new ManosAction (ValidAction), mat.Action); }
public void ActionSetter_NullAction_Throws() { var mat = new ActionTarget (ValidAction); Should.Throw<ArgumentNullException> (() => mat.Action = null); }
public void AddAction(string name, ActionTarget target) { mActions.Add(new Action(name, target, null)); }
public Action(string text, ActionTarget target, Library.Graphics.String label) { Text = text; Target = target; Label = label; }
protected override void Awake() { base.Awake(); mStats = GetComponentInChildren<UnitStat>(); mFlockUnit = GetComponentInChildren<FlockUnit>(); mListener = GetComponentInChildren<ActionListener>(); mActTarget = GetComponentInChildren<ActionTarget>(); mSpriteControl = GetComponentInChildren<UnitSpriteController>(); mWeapon = GetComponentInChildren<Weapon>(); mSpellCaster = GetComponentInChildren<SpellCaster>(); //hook calls up mStats.statChangeCallback += OnStatChange; if(mFlockUnit != null) { mFlockUnit.groupMoveEnabled = false; } if(mListener != null) { mListener.enterCallback += OnActionEnter; mListener.hitEnterCallback += OnActionHitEnter; mListener.hitExitCallback += OnActionHitExit; mListener.finishCallback += OnActionFinish; } }
//true if stopped or there was no action target public bool StopAction(ActionTarget.Priority priority, bool resumeDefault) { if(mCurActionTarget == null) { if(resumeDefault && mDefaultActionTarget != null) { ApplyToCurTarget(mDefaultActionTarget); } return true; } else if(mCurActionTarget == mDefaultActionTarget || mCurActionTarget.priority <= priority) { mCurActionTarget.RemoveListener(this); OnActionFinish(); if(finishCallback != null) { finishCallback(this); } mCurActionTarget = null; mCurActionCollider = null; if(resumeDefault && mDefaultActionTarget != null) { ApplyToCurTarget(mDefaultActionTarget); } return true; } return false; }
private void ApplyToCurTarget(ActionTarget target) { target.AddListener(this); mCurActionTarget = target; mCurActionCollider = target.collider; OnActionEnter(); if(enterCallback != null) { enterCallback(this); } }
private void SetTarget(ActionTarget target) { if(target != null) { if(target != mCurActionTarget && target.vacancy) { //check if we currently have a target, then determine priority if(StopAction(target.priority, false)) { ApplyToCurTarget(target); } } } else { StopAction(ActionTarget.Priority.Highest, true); } }
protected override void Awake() { base.Awake(); mActTarget = GetComponent<ActionTarget>(); }
public void Generic_PublicMethod() { var target = new ActionTarget(); var weakAction = new WeakAction<int>(target, target.PublicActionWithParameterToExecute); Assert.IsTrue(weakAction.Execute(1)); Assert.AreEqual(1, target.PublicActionWithParameterExecutedCount); target = null; GC.Collect(); Assert.IsFalse(weakAction.IsTargetAlive); }