コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
ファイル: ActionOperation.cs プロジェクト: Hengle/NUtilities
        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;
        }
コード例 #3
0
        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);
                            }
                        }
                    }
                }
            }
        }
コード例 #4
0
        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));
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
            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();
                }
            }
コード例 #7
0
        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));
            }
        }
コード例 #8
0
    /*
     * "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);
    }
コード例 #9
0
 public StartProgressInfo(float timeForCompletion, ActionTarget target, GameObject performer,
                          ProgressBar progressBar)
 {
     TimeForCompletion = timeForCompletion;
     Target            = target;
     Performer         = performer;
     ProgressBar       = progressBar;
 }
コード例 #10
0
        private void AddDefaultHandlerForAction(RouteHandler routes, MethodInfo info)
        {
            ManosAction action = ActionForMethod(info);

            ActionTarget target = new ActionTarget(action);

            AddImplicitRouteHandler(target, new string [] { "/" + info.Name }, HttpMethods.RouteMethods);
        }
コード例 #11
0
        private void AddHandlerForAction(RouteHandler routes, HttpMethodAttribute att, MethodInfo info)
        {
            ManosAction action = ActionForMethod(info);

            ActionTarget target = new ActionTarget(action);

            AddImplicitRouteHandler(target, att.Patterns, att.Methods);
        }
コード例 #12
0
        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);
                            }
                        }
                    }
                }
            }
        }
コード例 #13
0
ファイル: ToolUtils.cs プロジェクト: Basipek/unitystation
 /// <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);
 }
コード例 #14
0
ファイル: ActionTargetTest.cs プロジェクト: txdv/manos
        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);
        }
コード例 #15
0
ファイル: ToolUtils.cs プロジェクト: Basipek/unitystation
 /// <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);
 }
コード例 #16
0
    // 大招技能指示器解析,这部分有点冗余,是自己抽出来的,不是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);
    }
コード例 #17
0
ファイル: ActionTargetTest.cs プロジェクト: vbatz258/manos
        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);
        }
コード例 #18
0
 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;
 }
コード例 #19
0
ファイル: WeakActionTest.cs プロジェクト: xaecors/Catel
        public void MemoryLeakFreeWithNoInvocation()
        {
            var target     = new ActionTarget();
            var weakAction = new WeakAction(target, target.PublicActionToExecute);

            target = null;
            GC.Collect();

            Assert.IsFalse(weakAction.IsTargetAlive);
        }
コード例 #20
0
    public static void  Init()
    {
        var target = new ActionTarget
        {
            Action = _ => LastMessage = _.Message
        };

        LogManagerFactory.DefaultConfiguration = new LoggingConfiguration();
        LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Debug, target);
    }
コード例 #21
0
    public static void Init()
    {
        var target = new ActionTarget
            {
                Action = _ => LastMessage = _.Message
            };

        LogManagerFactory.DefaultConfiguration = new LoggingConfiguration();
        LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Debug, target);
    }
コード例 #22
0
        public void MemoryLeakFreeWithNoInvocation()
        {
            var target = new ActionTarget();
            var weakAction = new WeakAction(target, target.PublicActionToExecute);

            target = null;
            GC.Collect();

            Assert.IsFalse(weakAction.IsTargetAlive);
        }
コード例 #23
0
 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;
 }
コード例 #24
0
ファイル: Obstacle.cs プロジェクト: ddionisio/1GAM_01_Aries
    protected override void Awake()
    {
        base.Awake();

        mSprite = GetComponentInChildren<tk2dAnimatedSprite>();
        mStats = GetComponentInChildren<StatBase>();
        mActTarget = GetComponentInChildren<ActionTarget>();

        //hook calls up
    }
コード例 #25
0
        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);
        }
コード例 #26
0
 /// <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);
 }
コード例 #27
0
 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;
 }
コード例 #28
0
 /// <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);
 }
コード例 #29
0
 private void TryApplyGhostNote()
 {
     if (noteTrack.TryUpdate(grabbedNoteIndex, ghostNote))
     {
         Event.current.Use();
         if (DataUpdated != null)
         {
             DataUpdated();
         }
     }
     currentActionTarget = ActionTarget.Empty;
 }
コード例 #30
0
    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;
    }
コード例 #31
0
    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;
    }
コード例 #32
0
        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();
            }
        }
コード例 #33
0
    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;

    }
コード例 #34
0
        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);
        }
コード例 #35
0
 public BattlerAction(
     string name,
     int requiredSP,
     float power,
     ActionTarget actionTarget,
     Action<IBattler, IBattler> execute)
 {
     Name = name;
     RequiredSP = requiredSP;
     Power = power;
     ActionTarget = actionTarget;
     Execute = execute;
 }
コード例 #36
0
        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);
                }
            }
        }
コード例 #37
0
            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);
            }
コード例 #38
0
        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);
        }
コード例 #39
0
    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;
    }
コード例 #40
0
ファイル: NLogTests.cs プロジェクト: GeorgeHahn/Anotar
    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;
    }
コード例 #41
0
ファイル: MetroLogTests.cs プロジェクト: vlaci/Anotar
    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);
    }
コード例 #42
0
    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;
                    }
                }
            }
        }
    }
コード例 #43
0
    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;
                    }
                }
            }
        }
    }
コード例 #44
0
        public void ActionSetter_InvalidDelegateType_Throws()
        {
            var mat = new ActionTarget (new ManosAction (ValidAction));

                        Should.Throw<InvalidOperationException> (() => mat.Action = new InvalidDelegate (InvalidAction));
        }
コード例 #45
0
        public void Ctor_ValidActon_SetsAction()
        {
            var mat = new ActionTarget (ValidAction);

                        Assert.AreEqual (new ManosAction (ValidAction), mat.Action);
        }
コード例 #46
0
        public void ActionSetter_NullAction_Throws()
        {
            var mat = new ActionTarget (ValidAction);

                        Should.Throw<ArgumentNullException> (() => mat.Action = null);
        }
コード例 #47
0
ファイル: Menu.cs プロジェクト: jallarzie/spectrum
 public void AddAction(string name, ActionTarget target)
 {
     mActions.Add(new Action(name, target, null));
 }
コード例 #48
0
ファイル: Menu.cs プロジェクト: jallarzie/spectrum
 public Action(string text, ActionTarget target, Library.Graphics.String label)
 {
     Text = text;
     Target = target;
     Label = label;
 }
コード例 #49
0
ファイル: UnitEntity.cs プロジェクト: ddionisio/1GAM_01_Aries
    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;
        }
    }
コード例 #50
0
ファイル: ActionListener.cs プロジェクト: andi2/ludum-dare-26
    //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;
    }
コード例 #51
0
ファイル: ActionListener.cs プロジェクト: andi2/ludum-dare-26
    private void ApplyToCurTarget(ActionTarget target)
    {
        target.AddListener(this);

        mCurActionTarget = target;
        mCurActionCollider = target.collider;

        OnActionEnter();

        if(enterCallback != null) {
            enterCallback(this);
        }
    }
コード例 #52
0
ファイル: ActionListener.cs プロジェクト: andi2/ludum-dare-26
 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);
     }
 }
コード例 #53
0
ファイル: UnitBaseEntity.cs プロジェクト: andi2/ludum-dare-26
    protected override void Awake()
    {
        base.Awake();

        mActTarget = GetComponent<ActionTarget>();
    }
コード例 #54
0
        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);
        }