コード例 #1
0
ファイル: SlotScript.cs プロジェクト: spartann123/TCCRPG
    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);
    }
コード例 #2
0
 public void Clear()
 {
     if (items.Count > 0)
     {
         items.Clear();
     }
 }
コード例 #3
0
    }//end of RemoveItem function

    public void Clear()
    {
        if (items.Count > 0)
        {
            items.Clear();
        }
    }//end of Clear function
コード例 #4
0
ファイル: SlotScript.cs プロジェクト: NZBane/kus
 public void Clear()
 {
     if (items.Count > 0)
     {
         InventoryScript.MyInstance.OnItemCountChanged(items.Pop());
         items.Clear();
     }
 }
コード例 #5
0
 public void Clear()
 {
     if (itemStack.Count > 0)
     {
         Debug.Log("Clearing this slot");
         itemStack.Clear();
     }
 }
コード例 #6
0
        /// <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;
        }
コード例 #7
0
        public void Execute()
        {
            if (!_action.CanExecute())
            {
                return;
            }

            _action.ExecuteDo();
            _undoableActions.Push(_action);
            _redoableActions.Clear();
        }
コード例 #8
0
ファイル: CommandProcess.cs プロジェクト: ArunPrakashG/Luna
        public void Dispose()
        {
            if (Process != null)
            {
                if (!Process.HasExited)
                {
                    Process.Kill();
                }

                Process.Dispose();
            }

            OutputContainer.Clear();
            ErrorContainer.Clear();
            InputContainer.Clear();
        }
コード例 #9
0
    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);
    }
コード例 #10
0
        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();
        }
コード例 #11
0
 public void PopToRoot()
 {
     _navigationStack.Clear();
     Initialize();
 }
コード例 #12
0
 /// <summary>
 /// Resets the undo/redo stacks to their starting values.
 /// </summary>
 public void Reset()
 {
     _undoableActions.Clear();
     _redoableActions.Clear();
 }
コード例 #13
0
        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 );
        }