public override MethodIL GetMethodIL(MethodDesc method) { RemoveAction action = GetAction(method); switch (action) { case RemoveAction.Nothing: return(_baseILProvider.GetMethodIL(method)); case RemoveAction.ConvertToStub: if (method.Signature.ReturnType.IsVoid) { return(new ILStubMethodIL(method, new byte[] { (byte)ILOpcode.ret }, Array.Empty <LocalVariableDefinition>(), null)); } else if (method.Signature.ReturnType.Category == TypeFlags.Boolean) { return(new ILStubMethodIL(method, new byte[] { (byte)ILOpcode.ldc_i4_0, (byte)ILOpcode.ret }, Array.Empty <LocalVariableDefinition>(), null)); } else { goto default; } case RemoveAction.ConvertToTrueStub: return(new ILStubMethodIL(method, new byte[] { (byte)ILOpcode.ldc_i4_1, (byte)ILOpcode.ret }, Array.Empty <LocalVariableDefinition>(), null)); case RemoveAction.ConvertToGetResourceStringStub: return(new ILStubMethodIL(method, new byte[] { (byte)ILOpcode.ldarg_0, (byte)ILOpcode.ret }, Array.Empty <LocalVariableDefinition>(), null)); case RemoveAction.ConvertToThrow: return(new ILStubMethodIL(method, new byte[] { (byte)ILOpcode.ldnull, (byte)ILOpcode.throw_ }, Array.Empty <LocalVariableDefinition>(), null)); case RemoveAction.ConvertToGetKnownObjectComparer: case RemoveAction.ConvertToGetKnownObjectEqualityComparer: { TypeSystemContext context = method.Context; MetadataType comparerType = action == RemoveAction.ConvertToGetKnownObjectComparer ? context.SystemModule.GetType("System.Collections.Generic", "ObjectComparer`1") : context.SystemModule.GetType("System.Collections.Generic", "ObjectEqualityComparer`1"); MethodDesc methodDef = method.GetTypicalMethodDefinition(); ILEmitter emitter = new ILEmitter(); ILCodeStream codeStream = emitter.NewCodeStream(); codeStream.Emit(ILOpcode.newobj, emitter.NewToken(comparerType.MakeInstantiatedType(context.GetSignatureVariable(0, method: false)).GetDefaultConstructor())); codeStream.Emit(ILOpcode.dup); codeStream.Emit(ILOpcode.stsfld, emitter.NewToken(methodDef.OwningType.InstantiateAsOpen().GetField("_default"))); codeStream.Emit(ILOpcode.ret); return(new InstantiatedMethodIL(method, emitter.Link(methodDef))); } default: throw new NotImplementedException(); } }
private void Viewer_PopupMenuShowing(DependencyObject d, PopupMenuShowingEventArgs e) { // Remove the Hand tool item from the page context popup menu. RemoveAction removeHandTool = new RemoveAction(); removeHandTool.ElementName = DefaultPdfBarManagerItemNames.HandTool; e.Actions.Add(removeHandTool); // Remove the Select All item from the page context popup menu. RemoveAction removeSelectAll = new RemoveAction(); removeSelectAll.ElementName = DefaultPdfBarManagerItemNames.SelectAll; e.Actions.Add(removeSelectAll); // Insert the "Save As..." item invoking the Save As dialog. BarButtonItem barButtonItem = new BarButtonItem(); barButtonItem.Content = "Save As..."; barButtonItem.Command = viewer.SaveAsCommand; InsertAction insertBarButtonItem = new InsertAction(); insertBarButtonItem.ContainerName = DefaultPdfBarManagerItemNames.ContextMenu; insertBarButtonItem.Element = barButtonItem; e.Actions.Add(insertBarButtonItem); }
void OnRemove(object o, EventArgs args) { var action = new RemoveAction(app.Document, app.IconView.SelectedPages); action.Do(); // Undo isn't working yet //undo_manager.AddUndoAction (action); }
//The main function! This EXACT coroutine will be executed, even across frames. //See GameAction.cs for more information on how this function should work! public override IEnumerator TakeAction() { if (caller.inventory == null) { Debug.LogError($"{caller.name} cannot drop without an inventory! Skipping turn to prevent deadlock.", caller); caller.energy = 0; yield break; } if (indices.Count == 0) { Debug.Log($"{caller.name} tried to drop no items."); yield break; } //Collect all removables, dump them in one go List <int> needsToBeRemoved = new List <int>(); foreach (int index in indices) { if (index < 0 || index > caller.inventory.capacity) { continue; } //For each item, check if it's equipped. If so, remove it. ItemStack item = caller.inventory[index]; if (item == null) { continue; } EquipableItem equip = item.held[0].equipable; if (equip && equip.isEquipped) { needsToBeRemoved.Add(index); } } if (needsToBeRemoved.Count > 0) { RemoveAction secondaryAction = new RemoveAction(needsToBeRemoved); secondaryAction.Setup(caller); while (secondaryAction.action.MoveNext()) { yield return(secondaryAction.action.Current); } } foreach (int index in indices) { caller.inventory.Drop(index); } caller.energy -= 100; caller.inventory.GetFloor().Collapse(); }
/** * Allow to disable an the selected object. */ private void removeObject() { //Remove object if (this.objectSelected != null && !this.objectSelected.name.Equals("Center")) { RemoveAction removeAction = new RemoveAction(this.objectSelected); base.managerListener.doAction(removeAction); deselectCollisionObject(); } }
public void Remove <TElement>(Expression <Func <T, IEnumerable <TElement> > > expression, TElement element, RemoveAction action = RemoveAction.RemoveFirst) { Patch.Add("type", "remove"); Patch.Add("value", element); Patch.Add("path", toPath(expression)); Patch.Add("action", (int)action); apply(); }
/// <summary> /// Fire Remvoe Action Event /// </summary> /// <param name="sender">The Sender</param> /// <param name="args">The Event Arguments</param> protected virtual void OnRemoveAction(object sender, ActionEditorControlEventArgs args) { try { RemoveAction?.Invoke(sender, args); } catch (Exception caught) { logger.Error("Unexpected Error Firing Remove Action Event", caught); throw; } }
public AutomationTextBox(Control parent, AnnAutomation automation, AnnEditTextEventArgs editTextEvent, RemoveAction removeAction) { if (parent == null) { throw new ArgumentNullException("parent"); } if (editTextEvent == null) { throw new ArgumentNullException("editTextEvent"); } _textObject = editTextEvent.TextObject; if (_textObject == null) { throw new InvalidOperationException("No annotation text object was found in the event"); } _removeAction = removeAction; _automation = automation; var rect = editTextEvent.Bounds.ToLeadRect(); rect.Inflate(12, 12); this.SuspendLayout(); this.Location = new Point(rect.X, rect.Y); this.Size = new Size(rect.Width, rect.Height); this.AutoSize = false; this.Tag = _textObject; this.Text = _textObject.Text; this.Name = "AnnotationsText"; this.Font = AnnWinFormsRenderingEngine.ToFont(_textObject.Font); var brush = _textObject.TextForeground as AnnSolidColorBrush; if (brush != null) { this.ForeColor = Color.FromName(brush.Color); } this.WordWrap = false; this.AcceptsReturn = true; this.Multiline = true; this.ResumeLayout(); //this.LostFocus += new EventHandler(AutomationTextBox_LostFocus); //this.KeyPress += new KeyPressEventHandler(AutomationTextBox_KeyPress); parent.Controls.Add(this); this.Focus(); this.SelectAll(); }
public void Remove <TElement>(Expression <Func <T, IEnumerable <TElement> > > expression, TElement element, RemoveAction action = RemoveAction.RemoveFirst) where TElement : notnull { Patch.Add("type", "remove"); Patch.Add("value", element); Patch.Add("path", toPath(expression)); Patch.Add("action", (int)action); PossiblyPolymorphic = element.GetType() != typeof(TElement); apply(); }
public void RemoveLine(Line l) { if (!_working) { var ac = new RemoveAction(l); if (pos != _actions.Count) { if (pos < 0) { pos = 0; } _actions.RemoveRange(pos, _actions.Count - pos); } _actions.Add(ac); pos = _actions.Count; } }
//The main function! This EXACT coroutine will be executed, even across frames. //See GameAction.cs for more information on how this function should work! public override IEnumerator TakeAction() { if (!caller.equipment.CanEquip(itemIndex, equipIndex)) { yield break; } //Quick check: Are we trying to do something redundant? if (!caller.equipment.RequiresReequip(itemIndex, equipIndex)) { Debug.Log("You can't re-equip an item to its own slot. Why would you want to do this?"); yield break; } //We can attempt to move forward here! List <int> neededSlots = caller.equipment.SlotsNeededToEquip(itemIndex, equipIndex); ItemStack item = caller.inventory[itemIndex]; if (item.held[0].equipable.isEquipped) { RemoveAction remove = new RemoveAction(item); remove.Setup(caller); while (remove.action.MoveNext()) { yield return(remove.action.Current); } } if (neededSlots.Count > 0) { //We need to remove those slots! RemoveAction remove = new RemoveAction(neededSlots); remove.Setup(caller); while (remove.action.MoveNext()) { yield return(remove.action.Current); } } //We can now Equip! //TODO: Make this energy cost item dependent caller.equipment.Equip(itemIndex, equipIndex); caller.energy -= 100; }
public SkypeContext() { Users = new ObservableCollection <SkypeUser>(); TestCommand = new DelegateCommand(() => { SkypeCommandLauncher.StartCall("echo123"); }); AddCommand = new DelegateCommand(() => { AddAction?.Invoke(); }); RemoveCommand = new DelegateCommand(() => { RemoveAction?.Invoke(); }); }
public void ConstrainVirtualDeleteResource(long idResource, String name, RemoveAction action) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { List <long> idActivities = Service.GetIdActivitiesByResource(idResource); if (Service.SetResourceVirtualDelete(idResource, true, action)) { switch (action) { case RemoveAction.FromNotCompletedAssignments: View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, View.IdProject, ModuleProjectManagement.ActionType.ResourceRemoveFromNotCompletedAssignments); break; case RemoveAction.FromNotStartedAssignments: View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, View.IdProject, ModuleProjectManagement.ActionType.ResourceRemoveFromNotStartedAssignments); break; case RemoveAction.FromAllAndRecalculateCompletion: View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, View.IdProject, ModuleProjectManagement.ActionType.ResourceRemoveFromAllAndRecalculateCompletion); break; case RemoveAction.FromNotCompletedAssignmentsAndRecalculateCompletion: View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, View.IdProject, ModuleProjectManagement.ActionType.ResourceRemoveFromNotCompletedAssignmentsAndRecalculateCompletion); break; case RemoveAction.FromAllAssignments: View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, View.IdProject, ModuleProjectManagement.ActionType.ResourceRemoveFromAllAssignments); break; } View.InitializeControlForResourcesSelection(Service.GetProjectResources(View.IdProject, View.UnknownUser)); View.DisplayRemovedResource(name); } else { View.DisplayUnableToRemoveResource(name); } } }
public void ConstrainVirtualDeleteResource(long idResource, String name, RemoveAction action) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { if (Service.SetResourceVirtualDelete(idResource, true, action)) { switch (action) { case RemoveAction.FromNotCompletedAssignments: View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, View.IdProject, ModuleProjectManagement.ActionType.ResourceRemoveFromNotCompletedAssignments); break; case RemoveAction.FromNotStartedAssignments: View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, View.IdProject, ModuleProjectManagement.ActionType.ResourceRemoveFromNotStartedAssignments); break; case RemoveAction.FromAllAndRecalculateCompletion: View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, View.IdProject, ModuleProjectManagement.ActionType.ResourceRemoveFromAllAndRecalculateCompletion); break; case RemoveAction.FromNotCompletedAssignmentsAndRecalculateCompletion: View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, View.IdProject, ModuleProjectManagement.ActionType.ResourceRemoveFromNotCompletedAssignmentsAndRecalculateCompletion); break; case RemoveAction.FromAllAssignments: View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, View.IdProject, ModuleProjectManagement.ActionType.ResourceRemoveFromAllAssignments); break; } View.DisplayRemovedResource(name); View.LoadWizardSteps(View.IdProject, View.ProjectIdCommunity, View.isPersonal, View.forPortal, Service.GetAvailableSteps(WizardProjectStep.ProjectUsers, View.IdProject)); } else { View.DisplayUnableToRemoveResource(name); } } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { NativeArray <Entity> entityArray = chunk.GetNativeArray(entityType); NativeArray <RemoveAction> removeActionArray = chunk.GetNativeArray(removeActionType); BufferAccessor <Action> buffers = chunk.GetBufferAccessor <Action>(actionBufferType); for (int i = 0; i < chunk.Count; i++) { Entity entity = entityArray[i]; DynamicBuffer <Action> actions = buffers[i]; RemoveAction removal = removeActionArray[i]; if (actions.Length > 0) //if there are actions { int j = 0; while (j < actions.Length && actions[j].id != removal.id) // find the index of the action { j++; } if (j < actions.Length) // if the action was found before the end of the buffer { Debug.Log("Removing Action " + "!"); ActionType aType = actions[j].type; // get the type of the action that was removed entityCommandBuffer.DestroyEntity(chunkIndex, actions[j].dataHolder); // delete the data holder for the action actions.RemoveAt(j); //remove the action entityCommandBuffer.AddComponent <ChangeAction>(chunkIndex, entity, new ChangeAction { }); // tell the system that the current action should be changed } else { Debug.Log("Failed to remove " + "!"); } } entityCommandBuffer.RemoveComponent <RemoveAction>(chunkIndex, entity); // remove this component } }
static void Main(string[] args) { var repositoryManagerApi = new RepositoryManagerApi(); var emloyeesListAction = new ShowEmployeesAction(repositoryManagerApi.GetEmployeeApi(), repositoryManagerApi.GetPositionApi(), repositoryManagerApi.GetRuleApi(), repositoryManagerApi.GetOwerworkApi(), repositoryManagerApi.GetPaymentApi(), repositoryManagerApi.GetHolidayApi()); var addAction = new AddAction(repositoryManagerApi.GetEmployeeApi(), repositoryManagerApi.GetPositionApi(), repositoryManagerApi.GetRuleApi(), repositoryManagerApi.GetOwerworkApi(), repositoryManagerApi.GetPaymentApi(), repositoryManagerApi.GetHolidayApi()); var removeAction = new RemoveAction(repositoryManagerApi.GetEmployeeApi(), repositoryManagerApi.GetPositionApi(), repositoryManagerApi.GetRuleApi()); var calculateAction = new CalculateAction(repositoryManagerApi.GetCalculatorApi(), repositoryManagerApi.GetEmployeeApi()); var demo = new DemoDataGenerator(repositoryManagerApi); demo.Generate(); new MenuBuilder() .Title("Main menu") .Repeatable() .Item("Show", emloyeesListAction) .Item("Calculate money and hourse", calculateAction) .Item("Add", addAction) .Item("Remove", removeAction) .Exit("Exit") .GetMenu() .Run(); }
void AnimateRemoveAction(RemoveAction action) { AnimateRemove(action.coord); }
public static IReadOnlyList <IElabAction> GetAvailableActions(Element el, TreeNode node) { var remove = new RemoveAction(el, node); var noAction = new List <IElabAction>(); switch (el) { case AnySpec anySpec: return(noAction); case ArrConstructor arrConstructor: return(new [] { remove }); case Assign assign: return(new [] { remove }); case Attempt attempt: return(new [] { remove }); case Bool b: return(new [] { remove }); case BoolSpec boolSpec: return(noAction); case Break @break: return(new [] { remove }); case Builtin builtin: return(new [] { remove }); case Continue @continue: return(new [] { remove }); case Fn fn: return(new [] { remove }); case FnApply fnApply: return(new [] { remove }); case FnSpec fnSpec: return(noAction); case Char c: return(new [] { remove }); case CharSpec charSpec: return(noAction); case Ident ident: return(new[] { remove }); case Import import: return(new [] { remove }); case Int i: return(new [] { remove }); case IntSpec intSpec: return(noAction); case Let @let: return(new [] { remove }); case Loop loop: return(new [] { remove }); case MemberAccess memberAccess: return(new [] { remove }); case New @new: return(new [] { remove }); case NotSetSpec notSetSpec: return(new [] { remove }); case Obj obj: return(new [] { remove }); case ObjSpec objSpec: return(noAction); case Param param: return(new [] { remove }); case Return @return: return(new [] { remove }); case Sequence sequence: return(new [] { remove }); case Text text: return(new [] { remove }); case TextSpec textSpec: return(noAction); case Toss toss: return(new [] { remove }); case Var @var: return(new [] { remove }); case Void @void: return(new [] { remove }); case VoidSpec voidSpec: return(noAction); case When @when: return(new [] { remove }); case Arr arr: return(new [] { remove }); case ArrSpec arrSpec: return(noAction); default: throw new Exception(); } }
private void Update() { if ( UIManager.IsModalActive() ) { return; } //if ( _pixelsToPopIn.Any() ) //{ // _popInTimeElapsed += TimeSpan.FromSeconds( Time.deltaTime ); // if ( ( _popInTimeElapsed.TotalSeconds / popInDelaySeconds ) > _poppedInCount ) // { // PopIn( _pixelsToPopIn[0] ); // if ( _audio ) // { // if ( !_audio.isPlaying ) // { // _audio.Play(); // } // if ( !_pixelsToPopIn.Any() ) // { // _audio.Stop(); // } // } // } //} var pointerPos = new Vector3( _pointerPosX.GetValue(), _pointerPosY.GetValue(), 0 ); var ray = Camera.main.ScreenPointToRay( pointerPos ); Debug.DrawRay( ray.origin, ray.direction * 100, Color.green ); PixelConfig selectedPixel = null; if ( _placePixel.IsActive() ) { var hits = Physics.RaycastAll( ray ); var sortedPixels = SortClosestPixels( ConvertToPixels( hits ) ); if ( sortedPixels.Any( p => p.Color.a > 0 ) ) { var pix = sortedPixels.First( p => p.Color.a > 0 ); if ( UIManager.SelectedTool == UIManager.Tools.Add ) { var sortedSurroundingPixels = SortClosestPixels( GetSurroundingPixels( sortedPixels, pix ) ); try { selectedPixel = sortedSurroundingPixels.First( p => _placeablePixels.Contains( p ) ); } catch { } } else if ( UIManager.SelectedTool == UIManager.Tools.Remove || UIManager.SelectedTool == UIManager.Tools.Change ) { selectedPixel = pix; } } else if ( UIManager.SelectedTool == UIManager.Tools.Add ) { try { selectedPixel = sortedPixels.First( p => _placeablePixels.Contains( p ) ); } catch { } } if ( selectedPixel != null ) { IEditAction action = null; if ( UIManager.SelectedTool == UIManager.Tools.Add ) { selectedPixel.Color = UIManager.GetSelectedColor(); RemoveFromPlaceablePixels( selectedPixel ); action = new AddAction( this, selectedPixel ); } else if ( UIManager.SelectedTool == UIManager.Tools.Remove ) { action = new RemoveAction( this, selectedPixel ); PopOut( selectedPixel ); } else if ( UIManager.SelectedTool == UIManager.Tools.Change ) { if ( selectedPixel.Color != UIManager.GetSelectedColor() ) { action = new ChangeAction( this, selectedPixel, UIManager.GetSelectedColor() ); selectedPixel.Color = UIManager.GetSelectedColor(); } } DetectPlaceablePixels(); if ( action != null ) { _actionStack.AddAction( action ); } } } }
void OnRemove (object o, EventArgs args) { var action = new RemoveAction (app.Document, app.IconView.SelectedPages); action.Do (); // Undo isn't working yet //undo_manager.AddUndoAction (action); }
public void When(RemoveAction c) { throw new NotImplementedException(); }
private static void HandleQueueModificationBaseAction(QueueModificationBaseAction action) { List <IDownloadableLink> matchingLinks; switch (action.MatchingItemType) { case ItemTypeToAddRemove.Course: matchingLinks = SharedVars.Courses .Where((course, j) => action.MatchingItems.Contains(j)) .SelectMany(course => SectionExtractor.ExtractSectionsForCourse(course).Result .SelectMany(section => section.Links)) .ToList(); break; case ItemTypeToAddRemove.Section: matchingLinks = SharedVars.Sections .Where((section, j) => action.MatchingItems.Contains(j)) .SelectMany(section => section.Links) .ToList(); break; case ItemTypeToAddRemove.Link: matchingLinks = SharedVars.SelectedSection.Links .Where((link, j) => action.MatchingItems.Contains(j)) .ToList(); break; default: matchingLinks = Enumerable.Empty <IDownloadableLink>().ToList(); break; } if (!matchingLinks.Any()) { ConsoleUtils.WriteLine("Unfortunately downloading files using multiple naming methods at once is not possible", ConsoleIOType.Error); return; } do { string message; if (action is AddAction) { var count = matchingLinks.Except(SharedVars.DownloadQueue).Count(); SharedVars.DownloadQueue.AddUnique(matchingLinks); message = $"Added {count} items (to revert, " + "simply call Remove like you did with Add in the same way and location"; } else { var count = SharedVars.DownloadQueue.Intersect(matchingLinks).Count(); SharedVars.DownloadQueue.RemoveAll(link => matchingLinks.Contains(link)); message = $"Removed {count} items (to revert, " + "simply call Add like you did with Remove in the same way and location"; } ConsoleUtils.WriteLine(message, ConsoleColor.Yellow); if (action is AddAction) { action = new RemoveAction(); } else { action = new AddAction(); } } while (MenuChooseItem.AskYesNoQuestion("Do you want to revert now? [Y/N] ")); }
public void onGamePadEvent(ref Event e) { if (writeMode) { updateWriteMode(ref e); print("writemode"); return; } // Rename Action else if (UnityEngine.Input.GetKey(KeyCode.Joystick1Button1)) // A button { textMesh = select.GetComponentInChildren <TextMesh>(); renameAction = new RenameAction(textMesh); writeMode = true; } else if (UnityEngine.Input.GetKey(KeyCode.Joystick1Button6)) // LT button { InputLeftControlAction(); } else { if (UnityEngine.Input.GetKeyDown(KeyCode.Joystick1Button3)) // Y button { AddAction addAction = new AddAction(PrimitiveType.Cube, new Vector3(0, 0, -8)); base.managerListener.doAction(addAction); print("action: add"); this.nodeCourant.Add(new Node(addAction.GameObject)); } else if (UnityEngine.Input.GetKeyDown(KeyCode.Joystick1Button2) && !deleteMode) // B button { RemoveAction removeAction = new RemoveAction(ref this.nodeCourant); base.managerListener.doAction(removeAction); print("action: remove"); this.nodeCourant = removeAction.NodeCourant; if (this.nodeCourant == null) { Select(instance); } else { Select(nodeCourant.Gameobject); } deleteMode = true; } else if (UnityEngine.Input.GetKeyUp(KeyCode.Joystick1Button2) && deleteMode) // B button { deleteMode = false; } else if (UnityEngine.Input.GetKeyDown(KeyCode.Joystick1Button5)) // RB button { base.managerListener.undoAction(); print("action: undo"); } else if (UnityEngine.Input.GetKeyDown(KeyCode.Joystick1Button4)) // LB button { base.managerListener.redoAction(); print("action: redo"); } else { InputMoveAction(); } } }
private void ExportButton_Click(object sender, RoutedEventArgs e) { var screen = new OpenFileDialog(); if (screen.ShowDialog() == true) { var url = screen.FileName; using (StreamReader sr = new StreamReader(url)) { while (sr.Peek() >= 0) { string[] tokens_sub = sr.ReadLine().Split(new string[] { " - " }, StringSplitOptions.None); string[] tokens_space = tokens_sub[0].Split(new string[] { " " }, StringSplitOptions.None); string[] tokens_Args = tokens_sub[1].Split(new string[] { " " }, StringSplitOptions.None); string first_word = tokens_space[0]; if (first_word == "Replace") { var _replaceArgs = new ReplaceArgs(); _replaceArgs.Needle = tokens_Args[1]; _replaceArgs.Hammer = tokens_Args[3]; var _action = new ReplaceAction(); var _replacAction = _action as StringAction; var _cloneReplaceAction = _replacAction.Clone(); _cloneReplaceAction.Args = _replaceArgs; ActionListBox.Items.Add(_cloneReplaceAction); } else if (first_word == "New") { var _newcaseArgs = new NewCaseArgs(); _newcaseArgs.Needle = tokens_Args[3]; var _action = new NewCaseAction(); var _newcaseAction = _action as StringAction; var _cloneNewCaseAction = _newcaseAction.Clone(); _cloneNewCaseAction.Args = _newcaseArgs; ActionListBox.Items.Add(_cloneNewCaseAction); } else if (first_word == "Fullname") { var _fullnameArgs = new FullnameNormalizeArgs(); _fullnameArgs.Needle = tokens_Args[3]; var _action = new FullnameNormalizeAction(); var _fullnameAction = _action as StringAction; var _cloneFullNameAction = _fullnameAction.Clone(); _cloneFullNameAction.Args = _fullnameArgs; ActionListBox.Items.Add(_cloneFullNameAction); } else if (first_word == "Move") { var _moveArgs = new MoveArgs(); _moveArgs.Needle = tokens_Args[2]; var _action = new MoveAction(); var _moveAction = _action as StringAction; var _cloneMoveAction = _moveAction.Clone(); _cloneMoveAction.Args = _moveArgs; ActionListBox.Items.Add(_cloneMoveAction); } else if (first_word == "Unique") { var _uniqueArgs = new UniqueNameArgs(); _uniqueArgs.Needle = tokens_Args[1]; _uniqueArgs.Hammer = tokens_Args[3]; var _action = new UniqueName(); var _uniqueAction = _action as StringAction; var _cloneUniqueAction = _uniqueAction.Clone(); _cloneUniqueAction.Args = _uniqueArgs; ActionListBox.Items.Add(_cloneUniqueAction); } else { var _removeArgs = new RemoveActionArgs(); _removeArgs.Needle = tokens_Args[2]; var _action = new RemoveAction(); var _removeAction = _action as StringAction; var _cloneRemoveAction = _removeAction.Clone(); _cloneRemoveAction.Args = _removeArgs; ActionListBox.Items.Add(_cloneRemoveAction); } } } System.Windows.MessageBox.Show("Exported!"); } }
public Boolean Delete(long idResource, RemoveAction action) { return(Service.SetResourceVirtualDelete(idResource, true, action)); }
public void onKeyboardEvent(ref Event e) { if (writeMode) { updateWriteMode(ref e); print("writemode"); return; } // Rename Action else if (UnityEngine.Input.GetKey(KeyCode.F2)) { textMesh = select.GetComponentInChildren <TextMesh>(); renameAction = new RenameAction(textMesh); writeMode = true; } // Action avec la touche "Controle" else if (UnityEngine.Input.GetKey(KeyCode.LeftControl)) { // Selection des objets avec les fleches directionnelles InputLeftControlAction(); } // Action sans la touche "Controle" else { // A: AddAction if (UnityEngine.Input.GetKeyDown(KeyCode.A)) { addObject(); print("action: add"); } // D: RemoveAction else if (UnityEngine.Input.GetKeyDown(KeyCode.D) && !deleteMode) { // Remove Action /*RemoveAction removeAction = new RemoveAction(this.select); * base.managerListener.doAction(removeAction); * print("action: remove"); * * // Supprimer de l'arbre pour ne plus pouvoir le selectionner * this.nodeCourant = this.nodeCourant.Remove(); */ // Remove Action RemoveAction removeAction = new RemoveAction(ref this.nodeCourant); base.managerListener.doAction(removeAction); print("action: remove"); this.nodeCourant = removeAction.NodeCourant; // Selectionner le precedent if (this.nodeCourant == null) { Select(instance); } else { Select(nodeCourant.Gameobject); } deleteMode = true; } else if (UnityEngine.Input.GetKeyUp(KeyCode.D) && deleteMode) { deleteMode = false; } // U: UndoAction else if (UnityEngine.Input.GetKeyDown(KeyCode.U)) { base.managerListener.undoAction(); print("action: undo"); } // R: RedoAction else if (UnityEngine.Input.GetKeyDown(KeyCode.R)) { base.managerListener.redoAction(); print("action: redo"); } // Deplacer un objet selectionne avec les fleches directionnelles else { InputMoveAction(); } } }
private void InitKeyControl() { var UpFolderAction = new Action <TreeIter>(iter => { if (TreeIter.Zero.Equals(iter)) { return; } TreeIter parent; packStore.IterParent(out parent, iter); RefreshFolderView(parent); currentFolder = parent; Packer.Item item = packStore.GetValue(iter, 0) as Packer.Item; TreeIter selectedInFolder = FindInCurrentFolder(item); packTreeView.SelectAndFocus(selectedInFolder); }); var DownFolderAction = new Action <TreeIter>(iter => { if (TreeIter.Zero.Equals(iter)) { return; } RefreshFolderView(iter); currentFolder = iter; TreeIter selectedInFolder; folderStore.GetIterFirst(out selectedInFolder); packTreeView.SelectAndFocus(selectedInFolder); }); packTreeView.RowActivated += (o, args) => { TreeIter selectedInFolder; folderStore.GetIter(out selectedInFolder, args.Path); Packer.Item item = folderStore.GetValue(selectedInFolder, 2) as Packer.Item; if (!item.IsFolder) { return; } if (item.IsRoot) { UpFolderAction(currentFolder); } else { DownFolderAction(FindInPack(item)); } }; packTreeView.AddEvents((int)(Gdk.EventMask.KeyPressMask)); packTreeView.KeyReleaseEvent += (o, args) => { if (args.Event.Key == Gdk.Key.BackSpace) { UpFolderAction(currentFolder); } if (args.Event.Key == Gdk.Key.Delete) { RemoveAction.Activate(); } }; }
public void UnsubscribeFromCommunity(Int32 idCommunity, String path, RemoveAction action, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsBy orderBy, Boolean ascending, Int32 pageIndex, Int32 pageSize) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { lm.Comol.Core.BaseModules.CommunityManagement.dtoUnsubscribeTreeNode node = Service.UnsubscribeInfo(UserContext.CurrentUserID, idCommunity, path); if (node != null) { switch (action) { case RemoveAction.None: break; default: ModuleDashboard.ActionType dAction = ModuleDashboard.ActionType.UnableToUnsubscribe; List <liteSubscriptionInfo> subscriptions = Service.UnsubscribeFromCommunity(UserContext.CurrentUserID, node, action); if (subscriptions == null && !subscriptions.Any()) { switch (action) { case RemoveAction.FromCommunity: dAction = ModuleDashboard.ActionType.UnableToUnsubscribeFromCommunity; View.DisplayUnableToUnsubscribe(node.Name); break; case RemoveAction.FromAllSubCommunities: dAction = ModuleDashboard.ActionType.UnableToUnsubscribeFromCommunities; View.DisplayUnsubscriptionMessage(new List <String>(), node.GetAllNodes().Where(n => n.AllowUnsubscribe()).Select(n => n.Name).ToList()); break; } } else { switch (action) { case RemoveAction.FromCommunity: dAction = ModuleDashboard.ActionType.UnsubscribeFromCommunity; View.DisplayUnsubscribedFrom(node.Name); break; case RemoveAction.FromAllSubCommunities: dAction = ModuleDashboard.ActionType.UnsubscribeFromCommunities; View.DisplayUnsubscriptionMessage(node.GetAllNodes().Where(n => n.AllowUnsubscribe() && subscriptions.Where(s => s.IdCommunity == n.Id && s.IdRole < 1).Any()).Select(n => n.Name).ToList(), node.GetAllNodes().Where(n => n.AllowUnsubscribe() && subscriptions.Where(s => s.IdCommunity == n.Id && s.IdRole > 0).Any()).Select(n => n.Name).ToList() ); break; } } View.SendUserAction(0, CurrentIdModule, idCommunity, dAction); break; } } else { String name = CurrentManager.GetCommunityName(idCommunity); if (!String.IsNullOrEmpty(name)) { View.DisplayUnableToUnsubscribe(name); } View.SendUserAction(0, CurrentIdModule, idCommunity, ModuleDashboard.ActionType.UnableToUnsubscribe); } LoadCommunities(filters, orderBy, ascending, pageIndex, pageSize); } }
// public float radiusAlert = 40f;//radio para alertarse // public float radiusRun = 35f;//radio para huir void Start() { //INICIALIZAMOS LA DATA DEL EXTERIOR kineticsAgent = agent.kineticsAgent; steeringAgent = agent.steeringAgent; kineticsTrainer = trainer.kineticsAgent; kineticsRival = rival.kineticsAgent; sightSensor = sightComponent.sensor; sightSensorPokemon = sightComponentPokemon.sensor; soundSensor = soundComponent.sensor; //Piedras stones = GameObject.FindGameObjectsWithTag("Stone"); List <GameObject> stonesList = new List <GameObject>(stones); //Inicializamos grafo y A* graph = graphComponent.graph; aStar = new PathFindAStar(graph, null, null, null, walkable); //Inicializamos seek seek = new Seek(kineticsAgent, kineticsAgent, maxAccel); //Inicializamos lookwehereyougoing look = new LookWhereYouAreGoing(kineticsAgent); //Obstaculos GameObject[] obstacles = GameObject.FindGameObjectsWithTag("Obstacle"); obstacle_data[] obstaclesData = new obstacle_data[obstacles.Length]; for (int k = 0; k < obstacles.Length; k++) { obstaclesData[k] = obstacles[k].GetComponent <obstacle_data>(); } //Puntos estrategicos strategicPoints = pointsComponent.coverNodes; //COMENZAMOS A CONSTRUIR LA MAQUINA DE ESTADOS //1. ACCIONES: //acciones relacionadas a astar FollowPathOfPoints followPath = new FollowPathOfPoints(steeringAgent, seek, null, false); UpdateFollowPathWithAstar updateFollow = new UpdateFollowPathWithAstar(followPath, aStar, obstaclesData); UpdateAstarBestCoverPoint updateAstarCover = new UpdateAstarBestCoverPoint(strategicPoints, transform, new Transform[] { kineticsRival.transform, kineticsTrainer.transform }, obstaclesData, graph, aStar, walkable); UpdateAStarSeenStone updateAstarStone = new UpdateAStarSeenStone(sightSensor, aStar, graph, transform, walkable); //acciones de manejo de giros SetAngularSpeed setDefaultRotation = new SetAngularSpeed(kineticsAgent, 10f); SetAngularSpeed setZeroRotation = new SetAngularSpeed(kineticsAgent, 0f); StopMoving stop = new StopMoving(kineticsAgent, steeringAgent); LookWhereGoing lookAction = new LookWhereGoing(look, steeringAgent); //acciones de manejo de srpites ShowDefaultSprite defaultSprite = new ShowDefaultSprite(pokemonData); RunSprite showRunSprite = new RunSprite(pokemonData); Evolve2 evolve; ShowIcon showExclamation = new ShowIcon(this.gameObject, "Exclamation"); DisableIcon disableExclamation = new DisableIcon(this.gameObject, "Exclamation"); ShowIcon showSweat = new ShowIcon(this.gameObject, "Sweat"); DisableIcon disableSweat = new DisableIcon(this.gameObject, "Sweat"); //acciones de asistencia ResetSensor resetSight = new ResetSensor(sightSensor); ResetSensor resetSightPokemon = new ResetSensor(sightSensorPokemon); ResetSensor resetSound = new ResetSensor(soundSensor); ResetSensorList resetSensors = new ResetSensorList(new List <ResetSensor>() { resetSight, resetSound, resetSightPokemon }); //acciones de tiempo SetTimer setAlertTime; //acciones que modifican la maquina de estados misma RemoveStateTransition removeTouchStone; RemoveStateTransition removeSawStone; RemoveStateTransition removeSawStone2; RemoveAction removeDefaultSpriteAction; RemoveAction removeRunSpriteAction; RemoveAction removeRunSpriteAction2; //2. ESTADOS: List <Action> entryActions; //aqui iremos guardanndo todas las acciondes de entrada List <Action> exitActions; //aqui iremos guardanndo todas las acciones de salida List <Action> actions; //aqui guardaremos todas las acciones intermedias //2.a estado para esperar sin hacer nada //durante este estado eevee estara quieto hasta que algun humano lo haga reaccionar entryActions = new List <Action>() { stop, defaultSprite, setZeroRotation, resetSensors }; //al entrar al estado debemos parar y sentarnos removeDefaultSpriteAction = new RemoveAction(defaultSprite, entryActions); actions = new List <Action>() { }; //hacer guardia girando exitActions = new List <Action>() { }; State wait = new State(actions, entryActions, exitActions); //2.b estado para sorprenderse //durante este estado eevee dara vueltas en alterta angustiado porque escucho algo, este estado durara solo cierto tiempo entryActions = new List <Action>() { showExclamation, setDefaultRotation }; //al entrar al estado debemos sorprendernos actions = new List <Action>() { }; exitActions = new List <Action>() { disableExclamation, setZeroRotation }; //al salir dejamos de sorprendernos State alert = new State(actions, entryActions, exitActions); //2.c estado para perseguir piedra //durante este estado eevee se concentrara unicamente en buscar las piedra que vio entryActions = new List <Action>() { updateAstarStone, updateFollow, showExclamation, showRunSprite }; //al entrar al estado debemos actualizar el a* y luego el camino removeRunSpriteAction2 = new RemoveAction(showRunSprite, entryActions); actions = new List <Action>() { followPath, lookAction }; //durante la accion seguimos el camino exitActions = new List <Action>() { disableExclamation }; //al salir no hacemos nada State followStone = new State(actions, entryActions, exitActions); //2.d estado para perseguir punto de encuentro //durante este estado eevee buscara donde esconderse, puede verse interrumpido si accidentalmente toca una piedra o se comprometio su escondite entryActions = new List <Action>() { updateAstarCover, updateFollow, showSweat, showRunSprite, resetSensors }; //al entrar al estado debemos actualizar el a* y luego el camino removeRunSpriteAction = new RemoveAction(showRunSprite, entryActions); actions = new List <Action>() { followPath, lookAction }; //durante la accion seguimos el camino exitActions = new List <Action>() { disableSweat }; //al salir no hacemos nada State followCoverPoint = new State(actions, entryActions, exitActions); //2.extra dummy states //estos estados son de relleno para facilitar la activacion de ciertas acciones en le orden adecuado entryActions = new List <Action>(); //al entrar al estado debemos parar y sentarnos actions = new List <Action>(); //hacer guardia girando exitActions = new List <Action>(); //al salir no hacemos nada State evolveState1 = new State(actions, entryActions, exitActions); State evolveState2 = new State(actions, entryActions, exitActions); //3. CONDICIONES: SawSomething sawStone = new SawSomething(sightSensor, "Stone"); //si vemos una piedra evolutiva SawSomething sawHuman = new SawSomething(sightSensor, "Human"); //si vemos una persona HeardSomething heardHumanClose = new HeardSomething(soundSensor, "Human", 0f); //si escuchamos a un humano cerca HeardSomething heardHumanVeryClose = new HeardSomething(soundSensor, "Human", 5f); //si escuchamos a un humanos muy cerca TouchedGameObjects touchedStone = new TouchedGameObjects(stonesList, transform, "Sun"); //si tocamos una piedra evolutiva evolve = new Evolve2(pokemonData, touchedStone, updateAstarCover, aStar); FollowArrived arrived = new FollowArrived(followPath, transform); //si llegamos al objetivo de follow PokemonInCoverPoint otherInMyCover = new PokemonInCoverPoint(aStar, sightSensorPokemon, transform); //si vemos que un pokemon se metio en nuestro escondite TimeOut alertTimeOut = new TimeOut(5f); setAlertTime = new SetTimer(alertTimeOut); TrueCondition alwaysTrue = new TrueCondition(); //4. TRANSICIONES: List <Action> transitionsActions; List <Action> noActions = new List <Action>(); transitionsActions = new List <Action>() { setAlertTime }; Transition heardCloseHuman = new Transition(heardHumanClose, transitionsActions, alert); Transition seemsSafe = new Transition(alertTimeOut, noActions, wait); Transition heardVeryCloseHuman = new Transition(heardHumanVeryClose, noActions, followCoverPoint); transitionsActions = new List <Action>() { }; Transition sawAhuman = new Transition(sawHuman, transitionsActions, followCoverPoint); Transition sawAstone = new Transition(sawStone, transitionsActions, followStone); Transition pokemonInMyCover = new Transition(otherInMyCover, transitionsActions, followCoverPoint); //transiciones dummy transitionsActions = new List <Action>() { evolve }; Transition evolving1 = new Transition(alwaysTrue, transitionsActions, followCoverPoint); Transition evolving2 = new Transition(alwaysTrue, transitionsActions, wait); transitionsActions = new List <Action>() { evolve, removeDefaultSpriteAction, removeRunSpriteAction, removeRunSpriteAction2 }; Transition touchStone1 = new Transition(touchedStone, transitionsActions, evolveState1); Transition touchStone2 = new Transition(touchedStone, transitionsActions, evolveState2); //si evolucionamos debemos quitar las transiciones relacionadas a las stones removeSawStone = new RemoveStateTransition(sawAstone, followCoverPoint); removeSawStone2 = new RemoveStateTransition(sawAstone, alert); removeTouchStone = new RemoveStateTransition(touchStone1, followCoverPoint); transitionsActions.Add(removeSawStone); transitionsActions.Add(removeSawStone2); transitionsActions.Add(removeTouchStone); Transition arrivedFollowEnd = new Transition(arrived, noActions, wait); //4.1 AGREGAMOS TRANSICIONES A ESTADOS List <Transition> transitions; transitions = new List <Transition>() { sawAhuman, heardCloseHuman }; wait.transitions = transitions; transitions = new List <Transition>() { sawAhuman, sawAstone, heardVeryCloseHuman, seemsSafe }; alert.transitions = transitions; transitions = new List <Transition>() { evolving1 }; evolveState1.transitions = transitions; transitions = new List <Transition>() { evolving2 }; evolveState2.transitions = transitions; transitions = new List <Transition>() { touchStone1, sawAstone, pokemonInMyCover, arrivedFollowEnd, sawAhuman }; followCoverPoint.transitions = transitions; transitions = new List <Transition>() { touchStone2, arrivedFollowEnd, pokemonInMyCover }; followStone.transitions = transitions; //5 MAQUINA DE ESTADOS State[] states = new State[] { wait, alert, followCoverPoint, followStone, evolveState1, evolveState2 }; eeveeMachine = new StateMachine(states, wait); }