Ejemplo n.º 1
0
    private void SeedSelectedEvent(SeedBox _seedBox)
    {
        _selectedBox = _seedBox;
        if (_seedBox.IsFull)
        {
            InputController.Instance.DragSeedBegin(_seedBox);
            return;
        }
        else
        {
            _seedBox.PlaceSeed(SeedController.Instance.GetSeed(0));
            _selectedBox = null;
        }
        return;

        if (_selectedBox != null && _seedBox != null && _selectedBox != _seedBox)
        {
            if (_selectedBox.IsFull && _seedBox.IsFull)
            {
                // Merge seeds attempt
                SeedController.Instance.MergeSeeds(_selectedBox._currentSeed, _seedBox._currentSeed, (s) => {
                    _seedBox.PlaceSeed(s);
                    _selectedBox.RemoveSeed();
                    _selectedBox = null;
                }, () => {
                    _selectedBox = null;
                });
            }
            else if (!_seedBox.IsFull && _selectedBox.IsFull)
            {
                // Move seed from box
                _seedBox.PlaceSeed(_selectedBox._currentSeed);
                _selectedBox.RemoveSeed();
            }
            else if (_seedBox.IsFull && !_selectedBox.IsFull)
            {
                _selectedBox = _seedBox;
            }
            else
            {
                _selectedBox = null;
            }
        }
        else
        {
            // Selecting new box
            if (_seedBox._currentSeed != null)
            {
                _selectedBox = _seedBox;
            }
            else
            {
                _seedBox.PlaceSeed(SeedController.Instance.GetSeed(0));
                _selectedBox = null;
            }
        }
        SaveSeeds();
    }
Ejemplo n.º 2
0
 private void SeedDroppedEvent(SeedBox _seedBox, SeedBox _selectBox)
 {
     if (_selectBox == null || _seedBox == null)
     {
         return;
     }
     if (_selectBox.IsFull && _seedBox.IsFull)
     {
         // Merge seeds attempt
         SeedController.Instance.MergeSeeds(_selectedBox._currentSeed, _seedBox._currentSeed, (s) => {
             _seedBox.PlaceSeed(s);
             _selectBox.RemoveSeed();
         }, () => {
         });
     }
     else if (!_seedBox.IsFull && _selectBox.IsFull)
     {
         // Move seed from box
         _seedBox.PlaceSeed(_selectedBox._currentSeed);
         _selectedBox.RemoveSeed();
     }
     SaveSeeds();
 }
Ejemplo n.º 3
0
 public void SelectSeedBox(SeedBox seedBox)
 {
     if (_currentlySelectedSeed != null && _lastSelectedSeedBox != null)
     {
         SeedController.Instance.MergeSeeds(seedBox._currentSeed, _currentlySelectedSeed, (s) => {
             seedBox.PlaceSeed(s);
             _lastSelectedSeedBox.RemoveSeed();
             _lastSelectedSeedBox   = null;
             _currentlySelectedSeed = null;
         }, () => {
             _currentlySelectedSeed = null;
             _lastSelectedSeedBox   = null;
         });
     }
     else
     {
         _lastSelectedSeedBox   = seedBox;
         _currentlySelectedSeed = seedBox._currentSeed;
     }
 }