protected override void OnProcess(IAction action) { base.OnProcess(action); LoggerManager.Debug(action.AutomationActionData); TextAction textAction = action as TextAction; HtmlElement element = GetData(action) as HtmlElement; if (element == null) { LoggerManager.Error("Element Not Found"); throw new ElementNoFoundException("Element Not Found", action); } string value = null; if (!string.IsNullOrEmpty(textAction.Attrbute)) { value = element.GetAttribute(textAction.Attrbute); } if (!string.IsNullOrEmpty(textAction.AttrbuteRegex)) { Match match = Regex.Match(value, textAction.AttrbuteRegex, RegexOptions.IgnoreCase); if (match.Success) { value = match.Groups[1].Value; } } this.SaveData <string>(textAction.TextSaveKey, value); }
// Methods internal TextUndoOperation(TextAction action, int index, CharInfo[] infos, ItopVector.DrawArea.TextOperation textoperation) { this.Action = action; this.CharIndex = index; this.CharInfos = infos; this.TextOperation = textoperation; }
public async Task <ActionResult <GameAction> > PostGameAction([FromBody] TextAction textAction) { _context.Actions.Add(textAction); await _context.SaveChangesAsync(); return(CreatedAtAction("GetGameAction", new { id = textAction.Id }, textAction)); }
public void CallText(TextAction action) { if (textActionMapping.ContainsKey(action)) { textActionMapping[action](); } else { Debug.Log("Calling 'text that is no in dictionary" + action.ToString()); } }
// Start is called before the first frame update void Awake() { damage = enemyPreset.damage; moveTime = enemyPreset.moveTime; idleTimeMin = enemyPreset.idleTimeMin; idleTimeMax = enemyPreset.idleTimeMax; wanderRadius = enemyPreset.wanderRadius; home = transform.position; trigger = GetComponentInChildren <DetectPlayer>(); trigger.GetComponent <SphereCollider>().radius = enemyPreset.detectionRadius; navMeshAgent = GetComponent <NavMeshAgent>(); navMeshAgent.speed = enemyPreset.speed; fsm = new FSM("MeleeAI FSM"); WanderState = fsm.AddState("WanderState"); IdleState = fsm.AddState("IdleState"); AlertState = fsm.AddState("AlertState"); MeleeState = fsm.AddState("MeleeState"); WanderAction = new WanderAction(WanderState); IdleAction = new TextAction(IdleState); alertAction = new AlertAction(AlertState); meleeAction = new MeleeAction(MeleeState); WanderState.AddAction(WanderAction); IdleState.AddAction(IdleAction); AlertState.AddAction(alertAction); MeleeState.AddAction(meleeAction); WanderState.AddTransition("ToIdle", IdleState); WanderState.AddTransition("PlayerDetect", AlertState); IdleState.AddTransition("ToWander", WanderState); IdleState.AddTransition("PlayerDetect", AlertState); AlertState.AddTransition("ToIdle", IdleState); AlertState.AddTransition("ToMelee", MeleeState); MeleeState.AddTransition("ToAlert", AlertState); WanderAction.Init(this.transform, home, navMeshAgent, wanderRadius, moveTime, "ToIdle"); IdleAction.Init("Idling", Random.Range(idleTimeMin, idleTimeMax), "ToWander"); alertAction.Init(trigger, navMeshAgent, "ToIdle"); meleeAction.Init(this.transform, damage, trigger, FindObjectOfType <PlayerManager>(), "ToAlert"); fsm.Start("IdleState"); }
public void AddListener(Text target, TextAction textAction) { TextActionParmes findparmes = textListaction.Find((TextActionParmes parms) => { return(parms.text == target); }); if (findparmes.text != null) { textListaction.Remove(findparmes); } findparmes.text = target; findparmes.action = textAction; textListaction.Add(new TextActionParmes() { action = textAction, text = target }); }
/// <summary> /// 绘制一个文本 /// </summary> /// <param name="penColor"></param> /// <param name="fontsize"></param> /// <param name="fontAngle"></param> public TextAction TextAction(Color?penColor = null, int fontsize = 12, int fontAngle = 0, dynamic Element = null) { if (penColor == null) { penColor = Colors.Black; } var a = new TextAction(); a.Geometry.PenColor = penColor.Value; a.Geometry.Element = Element; (a.Geometry as TextGeometry).FontSize = fontsize; (a.Geometry as TextGeometry).Angle = fontAngle; DrawingControl.SetAction(a); LastAction = a; return(a); }
private void Start() { fsm = new FSM("AITest FSM"); IdleState = fsm.AddState("IdleState"); PatrolState = fsm.AddState("PatrolState"); PatrolAction = new TextAction(PatrolState); IdleAction = new TextAction(IdleState); PatrolState.AddAction(PatrolAction); IdleState.AddAction(IdleAction); PatrolState.AddTransition("ToIdle", IdleState); IdleState.AddTransition("ToPatrol", PatrolState); PatrolAction.Init("AI on patrol", 3f, "ToIdle"); IdleAction.Init("AI on idle", 2f, "ToPatrol"); fsm.Start("IdleState"); }
private void Start() { fsm = new FSM("AITest FSM"); idleState = fsm.AddState("IdleState"); patrolState = fsm.AddState("PatrolState"); idleAction = new TextAction(idleState); patrolAction = new TextAction(patrolState); //This adds the actions to the state and add state to it's transition map patrolState.AddAction(patrolAction); idleState.AddAction(idleAction); patrolState.AddTransition("ToIdle", idleState); idleState.AddTransition("ToPatrol", patrolState); patrolAction.Init("AI on Patrol", 3.0f, "ToIdle"); idleAction.Init("AI on Idle", 2.0f, "ToPatrol"); fsm.Start("IdleState"); }
public GameAction GetGameAction() { GameAction gameAction; switch (ActionType) { case "TextAction": gameAction = new TextAction() { Text = Text, Tag = Tag, CharacterId = CharacterId, RoomId = RoomId }; break; default: throw new NotImplementedException(); break; } return(gameAction); }
public static INode FromAction(this IAction action) { return(action switch { DelayAction delayAction => throw new NotImplementedException(), KeyboardAction keyboardAction => new KeyboardNode(new KeyboardNodeViewModel { Keys = new AvaloniaList <byte>(keyboardAction.Keys), DelayAfter = keyboardAction.DelayAfter, DelayBefore = keyboardAction.DelayBefore, InputType = keyboardAction.InputType, }), MouseAction mouseAction => new MouseNode(new MouseNodeViewModel { Key = mouseAction.Key, DelayAfter = mouseAction.DelayAfter, DelayBefore = mouseAction.DelayBefore, InputType = mouseAction.InputType, }), MouseMoveAction mouseMoveAction => new MouseMoveNode(new MouseMoveNodeViewModel { DelayAfter = mouseMoveAction.DelayAfter, DelayBefore = mouseMoveAction.DelayBefore, Horizontal = mouseMoveAction.Horizontal, Vertical = mouseMoveAction.Vertical, MouseMoveType = mouseMoveAction.MouseMoveType, }), RepeatAction repeatAction => new RepeatNode(new RepeatNodeViewModel { DelayAfter = repeatAction.DelayAfter, DelayBefore = repeatAction.DelayBefore, RepeatCount = repeatAction.RepeatCount, SelectedNode = repeatAction.Action?.FromAction(), }), TextAction textAction => new TextNode(new TextNodeViewModel { Text = textAction.Text, DelayAfter = textAction.DelayAfter, DelayBefore = textAction.DelayBefore, }), _ => throw new ArgumentOutOfRangeException(nameof(action)), });
private void SetAction(TextAction a) { tip = new SubTextTip(DrawingControl, textTip); tip.Attention(a); }
public void FixTextInputAction() { textAction_ = null; }
protected void OnTextChanged(string newText) { int oldCaretPos = Field.CaretPosision; int currentCaretPos = Field.ActualCaretPosition; if (oldCaretPos < text_.Length && Input.compositionString.Length > 0) { // compositionStringがある状態で日本語入力を確定させると挿入位置がズレるバグへの対処 //Debug.Log(string.Format("old={0}, caret={2} | current={1}, caret={3}, | compositionString={4}", text_, newText, oldCaretPos, currentCaretPos, Input.compositionString.Length)); currentCaretPos -= Input.compositionString.Length; Field.ActualCaretPosition = currentCaretPos; } if (oldCaretPos < currentCaretPos) { // キャレットが正方向に移動しているので入力 if (textAction_ == null || textAction_ is TextInputAction == false || Time.time - lastTextActionTime_ > GameContext.Config.TextInputFixIntervalTime) { FixTextInputAction(); textAction_ = new TextInputAction(this); Tree.ActionManager.Execute(textAction_); } string appendText = newText.Substring(oldCaretPos, currentCaretPos - oldCaretPos); textAction_.Text.Append(appendText); if (currentCaretPos == newText.Length && appendText == "#" && text_.EndsWith(" ") && Tree is LogTree == false) { Rect rect = Field.Rect; GameContext.Window.TagIncrementalDialog.Show(new Vector2(rect.xMin + Field.GetTextRectLength(text_.Length - 1), rect.yMin)); } } else { // キャレットが負方向に移動しているので削除 if (textAction_ == null || textAction_ is TextDeleteAction == false || Time.time - lastTextActionTime_ > GameContext.Config.TextInputFixIntervalTime) { FixTextInputAction(); textAction_ = new TextDeleteAction(this); Tree.ActionManager.Execute(textAction_); } int deletedCount = text_.Length - newText.Length; if (oldCaretPos > currentCaretPos) // backspace { string deletedText = text_.Substring(currentCaretPos, deletedCount); textAction_.Text.Insert(0, deletedText); if (GameContext.Window.TagIncrementalDialog.IsActive && deletedText == "#" && newText.EndsWith(" ")) { GameContext.Window.TagIncrementalDialog.Close(); } } else // if( oldCaretPos == currentCaretPos ) delete { string deletedText = text_.Substring(oldCaretPos, deletedCount); textAction_.Text.Append(deletedText); } textAction_.CaretPos = currentCaretPos; } lastTextActionTime_ = Time.time; text_ = newText; if (Tree is LogTree == false) { // タグに変化があればそれもアクションに乗せる List <string> newTags = GetHashTags(newText); TagTextEditAction.TagEditDiff tagEditDiff = TagTextEditAction.CheckTagChanged(newTags, tags_); if (tagEditDiff.IsEdited) { if (textAction_.TagEdit == null) { textAction_.TagEdit = new TagTextEditAction(this, tags_); } textAction_.TagEdit.SetNewTag(newTags); textAction_.TagEdit.UpdateTags(tagEditDiff.RemoveTags, tagEditDiff.AddTags); CheckTagIncrementalDialog(); } } Tree.IsEdited = true; #if UNITY_EDITOR if (Binding != null) { Binding.gameObject.name = text_; } #endif if (IsDone || HasAnyTags || IsLinkText) { Field.OnTextLengthChanged(); } ApplyTextToTaggedLine(); CheckIsComment(); }
public void RemoveAllListener(TextAction textAction) { textListaction.Clear(); imageListaction.Clear(); }