Esempio n. 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");
            }
        }
Esempio n. 2
0
        void shopItem_Click(object sender, SdlDotNet.Widgets.MouseButtonEventArgs e)
        {
            if (loaded)
            {
                if (ShopItems[currentTen * 10 + Array.IndexOf(lblVisibleItems, sender)].GetItem > 0)
                {
                    ChangeSelected(Array.IndexOf(lblVisibleItems, sender));

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

                    UpdateSelectedItemInfo();
                    Music.Music.AudioPlayer.PlaySoundEffect("beep2.wav");
                }
            }
        }