private bool SwapItems(SlotScript from) { if (IsEmpty) { return(false); } if (from.MyItem.GetType() != MyItem.GetType() || from.MyCount + MyCount > MyItem.MyStackSize) { //cópia de todos os itens ObservableStack <Item> tmpFrom = new ObservableStack <Item>(from.items); //limpa slot A from.items.Clear(); //Todos os itens do slot B, copia para o slot A from.AddItems(items); //limpa slot B items.Clear(); //Move os itens cópia do slot A para o slot B AddItems(tmpFrom); return(true); } return(false); }
public void Clear() { if (items.Count > 0) { items.Clear(); } }
}//end of RemoveItem function public void Clear() { if (items.Count > 0) { items.Clear(); } }//end of Clear function
public void Clear() { if (items.Count > 0) { InventoryScript.MyInstance.OnItemCountChanged(items.Pop()); items.Clear(); } }
public void Clear() { if (itemStack.Count > 0) { Debug.Log("Clearing this slot"); itemStack.Clear(); } }
/// <summary> /// Executes a specified action and adds it to the stack of undoable actions. /// </summary> /// <param name="action"> /// The action to be executed. /// </param> public void NewAction(IUndoable action) { if (action == null) { throw new ArgumentNullException(nameof(action)); } if (!action.CanExecute()) { return; } action.ExecuteDo(); _undoableActions.Push(action); _redoableActions.Clear(); _saveLoadManager.Unsaved = true; }
public void Execute() { if (!_action.CanExecute()) { return; } _action.ExecuteDo(); _undoableActions.Push(_action); _redoableActions.Clear(); }
public void Dispose() { if (Process != null) { if (!Process.HasExited) { Process.Kill(); } Process.Dispose(); } OutputContainer.Clear(); ErrorContainer.Clear(); InputContainer.Clear(); }
private bool SwapItems(SlotScript from) { if (IsEmpty) { return(false); } if ((from.MyItem.GetType() != MyItem.GetType()) || (from.MyCount + MyCount > MyItem.MyStackSize)) { ObservableStack <Item> tmpFrom = new ObservableStack <Item>(from.items); from.items.Clear(); from.AddItems(items); items.Clear(); AddItems(tmpFrom); return(true); } return(false); }
public void Dispose() { if (!CommandInputSessionToken.IsCancellationRequested) { CommandInputSessionToken.Cancel(); CommandInputSessionToken.Dispose(); } if (Process != null) { if (!Process.HasExited) { Process.Kill(); } Process.Dispose(); } OutputContainer.Clear(); InputContainer.Clear(); ErrorContainer.Clear(); }
public void PopToRoot() { _navigationStack.Clear(); Initialize(); }
/// <summary> /// Resets the undo/redo stacks to their starting values. /// </summary> public void Reset() { _undoableActions.Clear(); _redoableActions.Clear(); }
public void ShouldClearWithEvents() { // arrange var target = new ObservableStack<string>(); target.Push( "1" ); // act Assert.PropertyChanged( target, "Count", () => target.Clear() ); // assert Assert.Equal( 0, target.Count ); }