예제 #1
0
        public WrenchUpgradeButtons()
        {
            SetSize(90f, 20f);
            SetOffset(40f, 3f);
            BackgroundColor = Microsoft.Xna.Framework.Color.Transparent;
            BorderColor     = Microsoft.Xna.Framework.Color.Transparent;
            SetPadding(0);

            elements = new CustomUIImageButton[HelperMethods.WrenchUpgrade.UpgradesCount.ToInt()];
            for (int i = 0; i < elements.Length; i++)
            {
                int index = i;
                CustomUIImageButton toggle = new CustomUIImageButton(OffTexture, 1f);
                toggle.Left.Set(OffTexture.Width * i + 7f, 0);
                toggle.Top.Set(1f, 0);
                toggle.OnMouseOver += (__, _) =>
                {
                    text = new UIText(names[index]);
                    Append(text);
                };
                toggle.OnMouseOut += (__, _) =>
                {
                    text?.Remove();
                    text = null;
                };
                elements[i] = toggle;
                Append(toggle);
            }
        }
예제 #2
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            Main.hidePlayerCraftingMenu = true;

            KeybladeBase keyblade = (KeybladeBase)item.Item.ModItem;

            if (keyblade != null)
            {
                if (text == null)
                {
                    text        = new UIText("Keyblade level: " + (keyblade.keyLevel).ToString());
                    text.HAlign = 0.56f;
                    text.VAlign = 0.54f;
                    Append(text);
                }
                else
                {
                    text.SetText("Keyblade level: " + (keyblade.keyLevel).ToString());
                }


                bool hoveringOnLevelButton = Main.mouseX > slotX && Main.mouseX <slotX && Main.mouseY> slotY && Main.mouseY > slotY && !PlayerInput.IgnoreMouseInterface;

                if (hoveringOnLevelButton)
                {
                    if (!tickPlayed)
                    {
                        SoundEngine.PlaySound(SoundID.MenuTick, -1, -1, 1, 1f, 0f);
                    }
                    tickPlayed = true;


                    if (Main.mouseLeftRelease && Main.mouseLeft)
                    {
                        if (keyblade.keyLevel < 10000)
                        {
                            keyblade.keyLevel++;
                            SoundEngine.PlaySound(SoundID.Item37, -1, -1);
                        }
                    }
                }
            }
            else
            {
                if (text != null)
                {
                    text.Deactivate();
                    text.Remove();
                    text = null;
                }
            }
        }
예제 #3
0
 private void ElementOnMouseOut()
 {
     elementHovered = false;
     hoverText?.Remove();
 }
예제 #4
0
        public virtual void GameEnd()
        {
            Player player = Main.player[Main.myPlayer];

            playerChoice  = 0;
            resultCounter = 0;
            randomSign    = 0;

            if (won)
            {
                cheatChance += Main.rand.Next(2, 8);
                if (pCoins != 0)
                {
                    Item.NewItem(player.position, ItemID.PlatinumCoin, pCoins);
                }
                if (gCoins != 0)
                {
                    Item.NewItem(player.position, ItemID.GoldCoin, gCoins);
                }
                if (accuseOfCheating && cheating)
                {
                    if (pCoins != 0)
                    {
                        Item.NewItem(player.position, ItemID.PlatinumCoin, pCoins * 2);
                    }
                    if (gCoins != 0)
                    {
                        Item.NewItem(player.position, ItemID.GoldCoin, gCoins * 2);
                    }
                }
                if (!cheating)
                {
                    Main.NewText("Dang it... No! How is this possible!? Fine, just take the coins, I have much more anyway.");
                }
                pCoins = 0;
                gCoins = 0;
            }
            else
            {
                for (int c = 0; c < Main.maxInventory; c++)
                {
                    if (player.inventory[c].type == ItemID.PlatinumCoin)
                    {
                        player.inventory[c].stack -= pCoins;
                    }
                    if (player.inventory[c].type == ItemID.GoldCoin)
                    {
                        player.inventory[c].stack -= gCoins;
                    }
                }
                Main.NewText("Thanks for the coins!");
                pCoins = 0;
                gCoins = 0;
            }
            if (cheating)
            {
                cheatChance = 0;
                cheating    = false;
            }
            if (accuseOfCheating)
            {
                accuseOfCheating = false;
            }

            if (chosenGame == 1)
            {
                if (resultsInitialized)
                {
                    playerResult.Remove();
                    npcResult.Remove();
                    resultsInitialized = false;
                }
                chosenGame = 0;     //here in each one so that chosenGame doesn't turn 0 first
            }
            if (chosenGame == 2)
            {
                if (buttonsInitialized)
                {
                    rollButton.Remove();
                    rollText.Remove();
                    buttonsInitialized = false;
                }
                if (resultsInitialized)
                {
                    rollResult1.Remove();
                    rollResult2.Remove();
                    rollResult3.Remove();
                    resultsInitialized = false;
                }
                roll1       = 0;
                roll2       = 0;
                roll3       = 0;
                rollTurn    = 0;
                Rolling     = false;
                chosenGame  = 0;
                rollCounter = 0;
            }
            if (chosenGame == 3)
            {
                if (buttonsInitialized)
                {
                    PlayerCard1Button.Remove();
                    PlayerCard2Button.Remove();
                    NPCCard1Image.Remove();
                    NPCCard2Image.Remove();
                    ShowCardsButton.Remove();
                    drawPile.Remove();
                    buttonsInitialized = false;
                }
                playerCard1        = 0;
                playerCard2        = 0;
                NPCCard1           = 0;
                NPCCard2           = 0;
                chosenGame         = 0;
                waitingForCardSwap = false;
                showingCards       = false;
                swappeOutCard      = false;
            }
        }