コード例 #1
0
        void inventoryItem_Click(object sender, SdlDotNet.Widgets.MouseButtonEventArgs e)
        {
            if (Players.PlayerManager.MyPlayer.GetInvItemNum(currentTen * 10 + 1 + Array.IndexOf(lblVisibleItems, sender)) > 0)
            {
                ChangeSelected(Array.IndexOf(lblVisibleItems, sender));


                if (mode == Enums.InvMenuType.Store)
                {
                    mnuBankItemSelected selectedMenu = (mnuBankItemSelected)Windows.WindowSwitcher.GameWindow.MenuManager.FindMenu("mnuBankItemSelected");
                    if (selectedMenu != null)
                    {
                        Windows.WindowSwitcher.GameWindow.MenuManager.RemoveMenu(selectedMenu);
                        //selectedMenu.ItemSlot = GetSelectedItemSlot();
                        //selectedMenu.ItemNum = Players.PlayerManager.MyPlayer.GetInvItemNum(GetSelectedItemSlot());
                    }

                    Windows.WindowSwitcher.GameWindow.MenuManager.AddMenu(new Menus.mnuBankItemSelected("mnuBankItemSelected", Players.PlayerManager.MyPlayer.GetInvItemNum(GetSelectedItemSlot()), Players.PlayerManager.MyPlayer.Inventory[GetSelectedItemSlot()].Value, GetSelectedItemSlot(), Enums.InvMenuType.Store));
                    Windows.WindowSwitcher.GameWindow.MenuManager.SetActiveMenu("mnuBankItemSelected");
                }
                else if (mode == Enums.InvMenuType.Use)
                {
                    // Don't select the item, interferes with drag & drop
                    //mnuItemSelected selectedMenu = (mnuItemSelected)Windows.WindowSwitcher.GameWindow.MenuManager.FindMenu("mnuItemSelected");
                    //if (selectedMenu != null) {
                    //    Windows.WindowSwitcher.GameWindow.MenuManager.RemoveMenu(selectedMenu);
                    //    //selectedMenu.ItemSlot = GetSelectedItemSlot();
                    //    //ChangeSelected(Array.IndexOf(lblVisibleItems, sender));
                    //}
                    //Windows.WindowSwitcher.GameWindow.MenuManager.AddMenu(new Menus.mnuItemSelected("mnuItemSelected", currentTen * 10 + 1 + Array.IndexOf(lblVisibleItems, sender)));
                    //Windows.WindowSwitcher.GameWindow.MenuManager.SetActiveMenu("mnuItemSelected");
                    ////ChangeSelected(Array.IndexOf(lblVisibleItems, sender));
                }
                else if (mode == Enums.InvMenuType.Sell)
                {
                    mnuShopItemSelected selectedMenu = (mnuShopItemSelected)Windows.WindowSwitcher.GameWindow.MenuManager.FindMenu("mnuShopItemSelected");
                    if (selectedMenu != null)
                    {
                        Windows.WindowSwitcher.GameWindow.MenuManager.RemoveMenu(selectedMenu);
                        //selectedMenu.ItemSlot = GetSelectedItemSlot();
                        //ChangeSelected(Array.IndexOf(lblVisibleItems, sender));
                    }
                    Windows.WindowSwitcher.GameWindow.MenuManager.AddMenu(new Menus.mnuShopItemSelected("mnuShopItemSelected", Players.PlayerManager.MyPlayer.GetInvItemNum(GetSelectedItemSlot()), GetSelectedItemSlot(), Enums.InvMenuType.Sell));
                    Windows.WindowSwitcher.GameWindow.MenuManager.SetActiveMenu("mnuShopItemSelected");
                    //ChangeSelected(Array.IndexOf(lblVisibleItems, sender));
                }
                UpdateSelectedItemInfo();
                Music.Music.AudioPlayer.PlaySoundEffect("beep2.wav");
            }
        }
コード例 #2
0
ファイル: mnuBank.cs プロジェクト: MystikalPooka/PJOFiles
        void bankItem_Click(object sender, SdlDotNet.Widgets.MouseButtonEventArgs e)
        {
            if (loaded)
            {
                if (SortedItems == null)
                {
                    if (BankItems[currentTen * 10 + Array.IndexOf(lblVisibleItems, sender)].Num > 0)
                    {
                        ChangeSelected(Array.IndexOf(lblVisibleItems, sender));

                        mnuBankItemSelected selectedMenu = (mnuBankItemSelected)Windows.WindowSwitcher.GameWindow.MenuManager.FindMenu("mnuBankItemSelected");
                        if (selectedMenu != null)
                        {
                            Windows.WindowSwitcher.GameWindow.MenuManager.RemoveMenu(selectedMenu);
                            //selectedMenu.ItemSlot = GetSelectedItemSlot();
                            //selectedMenu.ItemNum = BankItems[GetSelectedItemSlot()].Num;
                        }
                        Windows.WindowSwitcher.GameWindow.MenuManager.AddMenu(new Menus.mnuBankItemSelected("mnuBankItemSelected", BankItems[GetSelectedItemSlot()].Num, BankItems[GetSelectedItemSlot()].Value, GetSelectedItemSlot(), Enums.InvMenuType.Take));
                        Windows.WindowSwitcher.GameWindow.MenuManager.SetActiveMenu("mnuBankItemSelected");

                        UpdateSelectedItemInfo();
                    }
                }
                else
                {
                    if (currentTen * 10 + Array.IndexOf(lblVisibleItems, sender) < SortedItems.Count && BankItems[SortedItems[currentTen * 10 + Array.IndexOf(lblVisibleItems, sender)]].Num > 0)
                    {
                        ChangeSelected(Array.IndexOf(lblVisibleItems, sender));

                        mnuBankItemSelected selectedMenu = (mnuBankItemSelected)Windows.WindowSwitcher.GameWindow.MenuManager.FindMenu("mnuBankItemSelected");
                        if (selectedMenu != null)
                        {
                            Windows.WindowSwitcher.GameWindow.MenuManager.RemoveMenu(selectedMenu);
                            //selectedMenu.ItemSlot = GetSelectedItemSlot();
                            //selectedMenu.ItemNum = BankItems[GetSelectedItemSlot()].Num;
                        }
                        Windows.WindowSwitcher.GameWindow.MenuManager.AddMenu(new Menus.mnuBankItemSelected("mnuBankItemSelected", BankItems[SortedItems[GetSelectedItemSlot()]].Num, BankItems[SortedItems[GetSelectedItemSlot()]].Value, SortedItems[GetSelectedItemSlot()], Enums.InvMenuType.Take));
                        Windows.WindowSwitcher.GameWindow.MenuManager.SetActiveMenu("mnuBankItemSelected");

                        UpdateSelectedItemInfo();
                    }
                }
            }
        }