/// <summary> /// 重置 /// </summary> public virtual void Reset() { SetActionAsset(null); StopLoadAction(); _colorFilter.Reset(); ShaderManager.inst.ApplyColorFilter(_material, null); //_type = 0; _action = 0; _direction = ActionDirection.NONE; _frameIndex = 0; _maxFrameIndex = -1; _currentDelayFrame = 0; _delayFrames = 0; _sortingIndex = 0; _sortingOrder = int.MinValue; _frames = null; _depth = 0; _loop = false; _lockActionAndDirection = false; _lockDepth = false; _lockSorting = false; _callback = null; _loadCallback = null; _renderer.sprite = null; _sprite = null; //Color color = _renderer.color; //_renderer.color = new Color(color.r, color.g, color.b); alpha = 1; }
public Task <bool> RunActions(string name, ActionDirection aDirection) { var tcs = new TaskCompletionSource <bool>(); Task.Factory.StartNew(/*async*/ () => { try { BrItem Item = Items.FirstOrDefault(item => item.Name == name); var ActionItems = aDirection == ActionDirection.Backup ? Item.BackupActions.OrderBy(i => i.Order) : Item.RestoreActions.OrderBy(i => i.Order); foreach (var action in ActionItems) { var type = Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(t => t.Name == "Action" + action.ActionName); if (type == null) { continue; } action.ItemName = name; IAction iaction = (IAction)Activator.CreateInstance(type, action, aDirection); iaction.Run(); } } catch (Exception e) { tcs.SetException(e); } tcs.SetResult(true); }, TaskCreationOptions.None); return(tcs.Task); }
/// <summary> /// 根据朝向获取角度 /// </summary> /// <param name="direction"></param> /// <returns></returns> public static float GetDegByDirection(ActionDirection direction) { switch (direction) { case ActionDirection.RIGHT: return(0f); case ActionDirection.RIGHT_DOWN: return(45f); case ActionDirection.DOWN: return(90f); case ActionDirection.LEFT_DOWN: return(135f); case ActionDirection.LEFT: return(180f); case ActionDirection.LEFT_UP: return(225f); case ActionDirection.UP: return(270f); case ActionDirection.RIGHT_UP: return(315f); } return(0f); }
/// <summary> /// 如果无解返回null。 /// </summary> /// <param name="act"></param> /// <param name="name"></param> /// <param name="parameter"></param> /// <param name="currentSteps"></param> /// <param name="maxStepsToSolution"></param> /// <param name="enlargedGrid"></param> /// <returns></returns> private LinkedList <Action> TestAction(Func <double, Car> act, ActionDirection name, double parameter, int currentSteps, int maxStepsToSolution, bool enlargedGrid) { Car vc = act(parameter); currentSteps++; //执行好act,所以又走了一步了! Point center = vc.Center; if (center.X > 0 && center.Y > 0 && center.X < Map.Size.Width && center.Y < Map.Size.Height && IsShorterPath(center, vc.Orientation, currentSteps, enlargedGrid)) { //不会碰到其他车 if (DoesCollide(vc.GetBound()) == false) { var list = SolveInternal(vc, currentSteps, maxStepsToSolution); if (list != null) //有解 { list.AddFirst(new Action { ActionDirection = name, Parameter = parameter }); //if(bestSolution==null) // bestSolution=list; return(list); } } } return(null); }
/// <summary> /// Chooses the option that the trace file is a Fiddler text trace file. /// </summary> /// <param name="direction">Used to tell the controller whether the view needs to be updated or not, to avoid recursive loops.</param> public void ChooseFiddlerTextTraceFile(ActionDirection direction) { this.SetTraceFileTypeStateOnTheWizardData(TraceType.FiddlerText); if (direction == ActionDirection.FromController) { this.SetTraceFileTypeStateOnTheView(TraceType.FiddlerText); } }
/// <summary> /// Sets the operation timer mode. /// </summary> /// <param name="operationTimerMode">The timer mode.</param> /// <param name="direction">Indicates where the set came from.</param> public void SetOperationTimerMode(OperationTimerMode operationTimerMode, ActionDirection direction) { if (direction == ActionDirection.FromController) { this.view.SetIncludeOperationTimers(operationTimerMode == OperationTimerMode.IncludeOperationTimers); } this.wizardData.Configuration.operationTimerMode = operationTimerMode; }
/// <summary> /// Sets the test method. /// </summary> /// <param name="testMethodMode">The test method.</param> /// <param name="direction">Indicates where the set came from.</param> public void SetTestMethodMode(TestMethodMode testMethodMode, ActionDirection direction) { if (direction == ActionDirection.FromController) { this.view.SetIncludeUnitTestPerOperation(testMethodMode == TestMethodMode.IncludeIndividualOperations); } this.wizardData.Configuration.testMethodMode = testMethodMode; }
/// <summary> /// 设置动作 /// </summary> /// <param name="action"></param> /// <param name="direction"></param> /// <param name="callback"></param> public virtual void SetAction(int action, ActionDirection direction, Action callback = null) { _callback = callback; if (_action == action && _direction == direction) { return; } _action = action; this.direction = direction; }
/// <summary> /// 获取前一方向 /// </summary> /// <param name="direction"></param> /// <returns></returns> public static ActionDirection GetPreviousDirection(ActionDirection direction) { ActionDirection previousDirection = direction - 1; if (previousDirection < ActionDirection.UP) { previousDirection = ActionDirection.LEFT_UP; } return(previousDirection); }
/// <summary> /// Sets the Soap action list. /// </summary> /// <param name="direction">Where the action initiated.</param> private void SetSoapActionList(ActionDirection direction) { if (direction == ActionDirection.FromController) { this.view.SetSoapActionList(this.wizardData.Configuration.soapActions); } this.SetSoapActionSelectionButtons(); this.SetNavigationControls(); }
/// <summary> /// 获取后一方向 /// </summary> /// <param name="direction"></param> /// <returns></returns> public static ActionDirection GetNextDirection(ActionDirection direction) { ActionDirection nextDirection = direction + 1; if (nextDirection > ActionDirection.LEFT_UP) { nextDirection = ActionDirection.UP; } return(nextDirection); }
/// <summary> /// Removes the selected assembly from the list of assemblies. /// </summary> /// <param name="index">Index in <see cref="IWizardView.SelectedSoapActions"/></param> /// <param name="direction">Used to tell the controller whether the view needs to be updated or not, to avoid recursive loops.</param> public void RemoveAssembly(int index, ActionDirection direction) { this.wizardData.Configuration.RemoveAssembly(index); if (direction == ActionDirection.FromController) { this.view.RemoveAssembly(index); } this.SetNavigationControls(); }
/// <summary> /// Sets the name of the file to be executed. /// </summary> /// <param name="executableFileName">The name of the file to be executed</param> /// <param name="direction">Used to tell the controller whether the view needs to be updated or not, to avoid recursive loops.</param> public void SetExecutableFileName(string executableFileName, ActionDirection direction) { if (direction == ActionDirection.FromController) { this.view.ExecutableFileName = executableFileName; } this.view.SetButtonState(WizardButton.RunExecutable, !string.IsNullOrEmpty(executableFileName)); this.ResetConfigurationData(); this.SetNavigationControls(); }
public static string SearchResultLabel(Member member, string query, ActionDirection direction, bool expectingBoolean) { var label = SearchUtility.HighlightQuery(Haystack(member, direction, expectingBoolean), query); if (member.isInvocable) { label += $" ({member.methodBase.DisplayParameterString(member.targetType)})"; } return(label); }
/// <summary> /// 方向发生改变 /// </summary> /// <param name="oldDirection"></param> /// <param name="newDirection"></param> protected virtual void OnDirectionChanged(ActionDirection oldDirection, ActionDirection newDirection) { // 检查动作视图深度是否发生改变 if (ActionCore.actionViewDepthChangeChecker != null) { if (ActionCore.actionViewDepthChangeChecker.Invoke(oldDirection, newDirection)) { RefreshRenderersDepth(); } } }
/// <summary> /// Sets the name of the trace file to be processed. /// </summary> /// <param name="traceFileName">The name of the trace file to be processed</param> /// <param name="direction">Used to tell the controller whether the view needs to be updated or not, to avoid recursive loops.</param> public void SetTraceFileName(string traceFileName, ActionDirection direction) { this.wizardData.TraceFile = traceFileName; if (direction == ActionDirection.FromController) { this.view.TraceFileName = traceFileName; } this.view.SetButtonState(WizardButton.ParseTraceFile, !string.IsNullOrEmpty(traceFileName)); this.ResetConfigurationData(); this.SetNavigationControls(); }
public Action(BrAction bAction, ActionDirection bDirection) { if (bAction.ActionName != ActionName) { throw new Exception("Invalid argument for ActionCopy constructor"); } ItemName = bAction.ItemName; Overwrite = bAction.Overwrite; ActionDirection = bDirection; RegistryKey = bAction.RegistryKey; SrcPath = bAction.SrcPath?.NormilizePath(this); DstPath = bAction.DstPath?.NormilizePath(this); }
/// <summary> /// 重置 /// </summary> public virtual void Reset() { _direction = ActionDirection.NONE; _time = 0f; _maxTime = 0f; _sortingLayer = null; _sortingIndex = 0; _sortingOrder = int.MinValue; _depth = 0; _loop = false; _lockSorting = false; _callback = null; ResetActionData(); }
/// <summary> /// 设置动作 /// </summary> /// <param name="action"></param> /// <param name="direction"></param> /// <param name="callback"></param> public virtual void SetAction(int action, ActionDirection direction, Action callback = null) { if (_action == action && _direction == direction) { return; } ActionDirection oldDirection = _direction; _action = action; _direction = direction; _callback = callback; SetRenderersAction(); OnDirectionChanged(oldDirection, _direction); }
public async Task RunItem(ActionDirection bDirection) { ToggleControls(); try { var name = ((BrItem)dataGridMain.SelectedItem).Name; if (!String.IsNullOrWhiteSpace(name)) { await BrConfig.Instance.RunActions(name, bDirection); } } catch (Exception e) { //await Dispatcher.BeginInvoke(DispatcherPriority.Normal, (System.Action)(() => Trace.WriteLine(e.Message))); Trace.WriteLine(e.Message); } ToggleControls(); }
/// <summary> /// 根据方向获取偏移系数(-1, 0, 1) /// </summary> /// <param name="direction"></param> /// <returns></returns> public static Vector3 GetVectorByDirection(ActionDirection direction) { Vector3 vector = new Vector3(); switch (direction) { case ActionDirection.RIGHT: vector.x = 1; break; case ActionDirection.RIGHT_DOWN: vector.x = 1; vector.y = 1; break; case ActionDirection.DOWN: vector.y = 1; break; case ActionDirection.LEFT_DOWN: vector.x = -1; vector.y = 1; break; case ActionDirection.LEFT: vector.x = -1; break; case ActionDirection.LEFT_UP: vector.x = -1; vector.y = -1; break; case ActionDirection.UP: vector.y = -1; break; case ActionDirection.RIGHT_UP: vector.x = 1; vector.y = -1; break; } return(vector); }
public static string CSharpName(this MemberInfo member, ActionDirection direction) { if (member is MethodInfo && ((MethodInfo)member).IsOperator()) { return(operators[member.Name] + " operator"); } if (member is ConstructorInfo) { return("new " + member.DeclaringType.CSharpName()); } if ((member is FieldInfo || member is PropertyInfo) && direction != ActionDirection.Any) { return($"{member.Name} ({direction.ToString().ToLower()})"); } return(member.Name); }
/// <summary> /// Sets the trace file source. /// </summary> /// <param name="direction">Where the action initiated.</param> /// <param name="source">The source.</param> private void SetTraceFileSource(ActionDirection direction, TraceFileSource source) { this.wizardData.TraceFileSource = source; if (source == TraceFileSource.Dynamic) { this.view.SetControlState(WizardControl.ExecutableFileName, true); this.view.SetButtonState(WizardButton.BrowseExecutable, true); this.view.SetControlState(WizardControl.TraceFileName, false); this.view.SetButtonState(WizardButton.BrowseTraceFile, false); this.view.SetButtonState(WizardButton.RunExecutable, !string.IsNullOrEmpty(this.view.ExecutableFileName)); this.view.SetButtonState(WizardButton.ParseTraceFile, false); if (direction == ActionDirection.FromController) { this.view.SetRadioState(WizardButton.ChooseTraceFile, false); this.view.SetRadioState(WizardButton.ChooseExecutable, true); } this.view.SetButtonState(WizardButton.ChooseWcfClientTrace, false); this.view.SetButtonState(WizardButton.ChooseWcfServerTrace, false); this.view.SetButtonState(WizardButton.ChooseFiddlerTextTrace, false); } else { this.view.SetControlState(WizardControl.ExecutableFileName, false); this.view.SetButtonState(WizardButton.BrowseExecutable, false); this.view.SetControlState(WizardControl.TraceFileName, true); this.view.SetButtonState(WizardButton.BrowseTraceFile, true); this.view.SetButtonState(WizardButton.RunExecutable, false); this.view.SetButtonState(WizardButton.ParseTraceFile, !string.IsNullOrEmpty(this.view.TraceFileName)); if (direction == ActionDirection.FromController) { this.view.SetRadioState(WizardButton.ChooseExecutable, false); this.view.SetRadioState(WizardButton.ChooseTraceFile, true); } this.view.SetButtonState(WizardButton.ChooseWcfClientTrace, true); this.view.SetButtonState(WizardButton.ChooseWcfServerTrace, true); this.view.SetButtonState(WizardButton.ChooseFiddlerTextTrace, true); } }
/// <summary> /// 获取镜像方向 /// </summary> /// <param name="direction"></param> /// <returns></returns> public static ActionDirection GetCopyDirection(ActionDirection direction) { if (direction <= ActionDirection.DOWN) { return(direction); } switch (direction) { case ActionDirection.LEFT_UP: return(ActionDirection.RIGHT_UP); case ActionDirection.LEFT: return(ActionDirection.RIGHT); case ActionDirection.LEFT_DOWN: return(ActionDirection.RIGHT_DOWN); } return(direction); }
/// <summary> /// 重置 /// </summary> public virtual void Reset() { foreach (var v in _rendererDict) { v.Value.Reset(); } _type = 0; _action = 0; _direction = ActionDirection.NONE; _frameIndex = 0; _maxFrameIndex = -1; _sortingIndex = 0; _sortingOrder = int.MinValue; _frames = null; _depth = 0; _loop = false; _alpha = 1f; _colorFilter.Reset(); _callback = null; }
//private void FixedUpdate() //{ // if (hit) // { // if ((transform.position - HitPosition).magnitude > .1f) // { // // transform.position = Vector3.Lerp(transform.position, HitPosition, Time.deltaTime * StumbleSpeed); // } // } //} public void Action(ActionDirection currentAction) { if (currentState == CombatState.Idle) { currentState = Blocking ? CombatState.Blocking : CombatState.Attacking; switch (currentAction) { case ActionDirection.ActionRight: m_Animator.SetTrigger("ActionRight"); break; case ActionDirection.ActionLeft: m_Animator.SetTrigger("ActionLeft"); break; case ActionDirection.ActionOverhead: m_Animator.SetTrigger("ActionOverhead"); break; } } }
public MemberOption(Member member, ActionDirection direction, bool expectingBoolean) { Ensure.That(nameof(member)).IsNotNull(member); value = member; documentation = member.info.Documentation(); UnityAPI.Async(() => icon = member.pseudoDeclaringType.Icon()); if (member.isPseudoInherited) { style = FuzzyWindow.Styles.optionWithIconDim; } if (member.isInvocable) { label = $"{member.info.DisplayName(direction, expectingBoolean)} ({member.methodBase.DisplayParameterString(member.targetType)})"; } else { label = member.info.DisplayName(direction, expectingBoolean); } }
public InspectorVariableNameAttribute(ActionDirection direction) { this.direction = direction; }
public static EditorTexture Icon(this MemberInfo member, ActionDirection direction = ActionDirection.Any) { return(Member(member, direction)); }
public static EditorTexture Member(MemberInfo member, ActionDirection direction) { Ensure.That(nameof(member)).IsNotNull(member); var method = member as MethodInfo; var field = member as FieldInfo; var property = member as PropertyInfo; var constructor = member as ConstructorInfo; if (method != null) { if (method.IsExtension()) { return(Language.extensionMethod.@public); } if (method.IsPrivate) { return(Language.method.@private); } if (method.IsFamily) { return(Language.method.@protected); } if (method.IsAssembly) { return(Language.method.@internal); } if (method.IsPublic) { return(Language.method.@public); } } else if (constructor != null) { if (constructor.IsPrivate) { return(Language.constructor.@private); } if (constructor.IsFamily) { return(Language.constructor.@protected); } if (constructor.IsAssembly) { return(Language.constructor.@internal); } if (constructor.IsPublic) { return(Language.constructor.@public); } } else if (field != null) { if (field.IsLiteral) { if (field.IsPrivate) { return(Language.method.@private); } if (field.IsFamily) { return(Language.method.@protected); } if (field.IsAssembly) { return(Language.method.@internal); } if (field.IsPublic) { return(Language.method.@public); } } else { if (field.IsPrivate) { return(Language.method.@private); } if (field.IsFamily) { return(Language.method.@protected); } if (field.IsAssembly) { return(Language.method.@internal); } if (field.IsPublic) { return(Language.method.@public); } } } else if (property != null) { var accessors = property.GetAccessors(true); var getter = accessors.FirstOrDefault(accessor => accessor.ReturnType != typeof(void)); var setter = accessors.FirstOrDefault(accessor => accessor.ReturnType == typeof(void)); bool isPrivate, isProtected, isInternal, isPublic; if (direction == ActionDirection.Any) { isPrivate = getter == null || getter.IsPrivate || setter == null || setter.IsPrivate; if (isPrivate) { isProtected = false; isInternal = false; isPublic = false; } else { isProtected = getter.IsFamily || setter.IsFamily; isInternal = getter.IsAssembly || setter.IsAssembly; isPublic = getter.IsPublic && setter.IsPublic; } } else if (direction == ActionDirection.Get && getter != null) { isPrivate = getter.IsPrivate; isProtected = getter.IsFamily; isInternal = getter.IsAssembly; isPublic = getter.IsPublic; } else if (direction == ActionDirection.Set && setter != null) { isPrivate = setter.IsPrivate; isProtected = setter.IsFamily; isInternal = setter.IsAssembly; isPublic = setter.IsPublic; } else { return(null); } if (isPrivate) { return(Language.property.@private); } if (isProtected) { return(Language.property.@protected); } if (isInternal) { return(Language.property.@internal); } if (isPublic) { return(Language.property.@public); } } return(null); }
public Action(StateParameter parameter, ActionDirection direction) { Parameter = parameter; Direction = direction; }