コード例 #1
0
        public void OnRowSwitch(PokemonBoxViewer caller)
        {
            if (PokeManager.IsHoldingPokemon || PokeManager.HasSelection)
            {
                PokeManager.DropAll();
                PokeManager.ClearSelectedPokemon();
                PokeManager.RefreshUI();
            }

            if (!PokeManager.Settings.AllowDoubleBoxRows)
            {
                int callerIndex = GetIndex(caller);
                PokemonBoxViewer[] priorities = new PokemonBoxViewer[3];
                boxViewer1.SupressIndexChanged = true;
                boxViewer2.SupressIndexChanged = true;
                boxViewer3.SupressIndexChanged = true;

                priorities[0] = caller;
                if (callerIndex == 1)
                {
                    if (IsValid(boxViewer2, caller) || !IsValid(boxViewer3, caller))
                    {
                        priorities[1] = boxViewer2;
                        priorities[2] = boxViewer3;
                    }
                    else
                    {
                        priorities[1] = boxViewer3;
                        priorities[2] = boxViewer2;
                    }
                }
                else if (callerIndex == 2)
                {
                    priorities[1] = boxViewer1;
                    priorities[2] = boxViewer3;
                }
                else
                {
                    priorities[1] = boxViewer1;
                    priorities[2] = boxViewer2;
                }

                MakeValid(priorities[1], priorities[0]);
                MakeValid(priorities[2], priorities[0], priorities[1]);

                boxViewer1.SupressIndexChanged = false;
                boxViewer2.SupressIndexChanged = false;
                boxViewer3.SupressIndexChanged = false;
            }
            else
            {
            }
        }
コード例 #2
0
 private void OnPokemonSelected(object sender, PokemonSelectedEventArgs e)
 {
     if (mode == SendPokemonModes.GiveItem && ((PokeBoxControl)sender).IsPickupMode && e.Pokemon != null)
     {
         if (e.Pokemon.IsEgg)
         {
             TriggerMessageBox.Show(this, "Cannot give items to Eggs", "Can't Hold");
         }
         else if (e.Pokemon.HeldItemID != 0 && e.Pokemon.HeldItemData.ID == 0)
         {
             TriggerMessageBox.Show(this, "Cannot switch " + e.Pokemon.Nickname + "'s item because it is an Unknown Item", "Unknown Item");
         }
         else if (e.Pokemon.HeldItemID == giveItem.ID)
         {
             TriggerMessageBox.Show(this, e.Pokemon.Nickname + " is already holding " + e.Pokemon.HeldItemData.Name, "Already Holding");
         }
         else
         {
             MessageBoxResult result = MessageBoxResult.Yes;
             if (e.Pokemon.IsHoldingMail)
             {
                 result = MessageBoxResult.No;
                 TriggerMessageBox.Show(this, "Cannot give " + giveItem.ItemData.Name + " to this Pokémon because it is holding mail. To remove the mail goto the mailbox tab and click Take Mail From Party", "Can't Give Item");
             }
             else if (e.Pokemon.IsHoldingItem)
             {
                 result = TriggerMessageBox.Show(this, e.Pokemon.Nickname + " is already holding " + e.Pokemon.HeldItemData.Name + ", would you like to switch it with " + giveItem.ItemData.Name + "?", "Switch Items", MessageBoxButton.YesNo);
                 if (result == MessageBoxResult.Yes)
                 {
                     PokeManager.ManagerGameSave.Inventory.Items[e.Pokemon.HeldItemData.PocketType].AddItem(e.Pokemon.HeldItemID, 1);
                 }
             }
             if (result == MessageBoxResult.Yes)
             {
                 e.Pokemon.HeldItemID = giveItem.ID;
                 giveItem.Pocket.TossItemAt(giveItem.Pocket.IndexOf(giveItem), 1);
                 TriggerMessageBox.Show(Window.GetWindow(this), "Gave " + giveItem.ItemData.Name + " to " + e.Pokemon.Nickname, "Gave Item");
                 PokeManager.RefreshUI();
                 PokeManager.LastGameInDialogIndex = gameIndex;
                 DialogResult = true;
             }
         }
     }
     else if (mode == SendPokemonModes.SendTo && e.Pokemon == null)
     {
         if (!PokeManager.CanSafelyPlaceHeldUnknownItem(e.PokeContainer))
         {
             MessageBoxResult unknownItemResult = TriggerMessageBox.Show(Window.GetWindow(this), "The Pokémon that you are trying to send is holding an Unknown Item. Sending it to a different game may cause problems. Are you sure you want to send it?", "Unknown Item", MessageBoxButton.YesNo);
             if (unknownItemResult == MessageBoxResult.No)
             {
                 return;
             }
         }
         PokeManager.PlacePokemon(e.PokeContainer, e.Index);
         PokeManager.LastGameInDialogIndex = gameIndex;
         DialogResult = true;
     }
     else if (mode == SendPokemonModes.SendFrom && e.Pokemon != null)
     {
         if (e.Pokemon.HeldItemID != 0 && e.Pokemon.HeldItemData.ID == 0 && e.Pokemon.GameSave != container.GameSave)
         {
             MessageBoxResult unknownItemResult = TriggerMessageBox.Show(Window.GetWindow(this), "That Pokémon is holding an Unknown Item. Sending it to a different game may cause problems. Are you sure you want to send it?", "Unknown Item", MessageBoxButton.YesNo);
             if (unknownItemResult == MessageBoxResult.No)
             {
                 return;
             }
         }
         if (PokeManager.CanPickupPokemon(e.Pokemon))
         {
             PokeManager.PickupPokemon(e.Pokemon, null);
             PokeManager.PlacePokemon(container, containerIndex);
             PokeManager.LastGameInDialogIndex = gameIndex;
             DialogResult = true;
         }
         else if (PokeManager.IsPartyHoldingMail(e.PokeContainer))
         {
             TriggerMessageBox.Show(Window.GetWindow(this), "Cannot send that Pokémon. A Pokémon in your party is holding mail. To remove the mail goto the mailbox tab and click Take Mail From Party", "Can't Send");
         }
         else
         {
             TriggerMessageBox.Show(Window.GetWindow(this), "Cannot send that Pokémon. It is the last valid Pokémon in your party", "Can't Send");
         }
     }
     else if (mode == SendPokemonModes.SendMulti && e.Pokemon == null)
     {
         if (!PokeManager.CanSafelyPlaceHeldUnknownItem(e.PokeContainer))
         {
             MessageBoxResult unknownItemResult = TriggerMessageBox.Show(Window.GetWindow(this), "A Pokémon that you are trying to send is holding an Unknown Item. Sending it to a different game may cause problems. Are you sure you want to send it?", "Unknown Item", MessageBoxButton.YesNo);
             if (unknownItemResult == MessageBoxResult.No)
             {
                 return;
             }
         }
         if (e.PokeContainer.PokePC.HasRoomForPokemon(PokeManager.NumSelectedPokemon))
         {
             PokeManager.PlaceSelection(e.PokeContainer, e.Index);
             PokeManager.ClearSelectedPokemon();
             PokeManager.LastGameInDialogIndex = gameIndex;
             DialogResult = true;
         }
         else
         {
             TriggerMessageBox.Show(Window.GetWindow(this), "Not enough room in game to store all selected Pokémon", "No Room");
         }
     }
     else if (mode == SendPokemonModes.SelectPokemon && e.Pokemon != null && ((PokeBoxControl)sender).IsPickupMode && (!e.Pokemon.IsEgg || !noEggs) && !e.Pokemon.IsShadowPokemon)
     {
         pokemon      = e.Pokemon;
         DialogResult = true;
     }
 }
コード例 #3
0
        public void OnGameSwitch(PokemonBoxViewer caller = null)
        {
            if (PokeManager.IsHoldingPokemon || PokeManager.HasSelection)
            {
                PokeManager.DropAll();
                PokeManager.ClearSelectedPokemon();
                PokeManager.RefreshUI();
            }

            if (!PokeManager.Settings.AllowDoubleBoxRows)
            {
                if (caller == null)
                {
                    caller = boxViewer1;
                }
                int callerIndex = GetIndex(caller);
                PokemonBoxViewer[] priorities = new PokemonBoxViewer[3];
                boxViewer1.SupressIndexChanged = true;
                boxViewer2.SupressIndexChanged = true;
                boxViewer3.SupressIndexChanged = true;

                priorities[0] = boxViewer1;
                if (callerIndex == 1)
                {
                    if (IsValid(boxViewer2, caller) || !IsValid(boxViewer3, caller))
                    {
                        priorities[1] = boxViewer2;
                        priorities[2] = boxViewer3;
                    }
                    else
                    {
                        priorities[1] = boxViewer3;
                        priorities[2] = boxViewer2;
                    }

                    boxViewer2.ComboBoxGames.ResetGameSaveVisibility();
                    boxViewer3.ComboBoxGames.ResetGameSaveVisibility();
                    if (GetNumRows(caller) == 1)
                    {
                        boxViewer2.ComboBoxGames.SetGameSaveVisible(GameIndex, false);
                        boxViewer3.ComboBoxGames.SetGameSaveVisible(GameIndex, false);
                    }
                }
                else if (callerIndex == 2)
                {
                    if (GetNumRows(caller) > 2)
                    {
                        priorities[1] = boxViewer3;
                        priorities[2] = boxViewer2;
                    }
                    else
                    {
                        priorities[1] = boxViewer2;
                        priorities[2] = boxViewer3;
                    }
                    //FindAvailableRow(priorities[1], priorities[1]);
                }
                else
                {
                    if (GetNumRows(caller) > 2)
                    {
                        priorities[1] = boxViewer2;
                        priorities[2] = boxViewer3;
                    }
                    else
                    {
                        priorities[1] = boxViewer3;
                        priorities[2] = boxViewer2;
                    }
                    //FindAvailableRow(priorities[1], priorities[1]);
                }

                MakeValid(priorities[1], priorities[0]);
                MakeValid(priorities[2], priorities[0], priorities[1]);

                boxViewer1.SupressIndexChanged = false;
                boxViewer2.SupressIndexChanged = false;
                boxViewer3.SupressIndexChanged = false;
            }
            else
            {
                boxViewer2.ComboBoxGames.ResetGameSaveVisibility();
                boxViewer3.ComboBoxGames.ResetGameSaveVisibility();
            }
        }