示例#1
0
        public void Draw(ref MapOverlayDrawContext context, ref string text)
        {
            List <TeleportPylonInfo> pylons = Main.PylonSystem.Pylons;
            float     scaleIfNotSelected    = 1f;
            float     scaleIfSelected       = scaleIfNotSelected * 2f;
            Texture2D texture = TextureAssets.Extra[182].Value;
            int       num     = TeleportPylonsSystem.IsPlayerNearAPylon(Main.LocalPlayer) ? 1 : 0;
            Color     color   = Color.White;

            if (num == 0)
            {
                color = Color.Gray * 0.5f;
            }
            for (int index = 0; index < pylons.Count; ++index)
            {
                TeleportPylonInfo info = pylons[index];
                if (context.Draw(texture, info.PositionInTiles.ToVector2() + new Vector2(1.5f, 2f), color, new SpriteFrame((byte)9, (byte)1, (byte)info.TypeOfPylon, (byte)0)
                {
                    PaddingY = 0
                }, scaleIfNotSelected, scaleIfSelected, Alignment.Center).IsMouseOver)
                {
                    Main.cancelWormHole = true;
                    string itemNameValue = Lang.GetItemNameValue(TETeleportationPylon.GetPylonItemTypeFromTileStyle((int)info.TypeOfPylon));
                    text = itemNameValue;
                    if (Main.mouseLeft && Main.mouseLeftRelease)
                    {
                        Main.mouseLeftRelease = false;
                        Main.mapFullscreen    = false;
                        Main.PylonSystem.RequestTeleportation(info, Main.LocalPlayer);
                        SoundEngine.PlaySound(11, -1, -1, 1, 1f, 0.0f);
                    }
                }
            }
        }
示例#2
0
        public void Draw(ref MapOverlayDrawContext context, ref string text)
        {
            List <TeleportPylonInfo> pylons = Main.PylonSystem.Pylons;
            float     num             = 1f;
            float     scaleIfSelected = num * 2f;
            Texture2D value           = TextureAssets.Extra[182].get_Value();
            bool      num2            = TeleportPylonsSystem.IsPlayerNearAPylon(Main.LocalPlayer);
            Color     color           = Color.White;

            if (!num2)
            {
                color = Color.Gray * 0.5f;
            }
            for (int i = 0; i < pylons.Count; i++)
            {
                TeleportPylonInfo info = pylons[i];
                if (context.Draw(value, info.PositionInTiles.ToVector2() + new Vector2(1.5f, 2f), color, new SpriteFrame(9, 1, (byte)info.TypeOfPylon, 0)
                {
                    PaddingY = 0
                }, num, scaleIfSelected, Alignment.Center).IsMouseOver)
                {
                    Main.cancelWormHole = true;
                    string text2 = text = Lang.GetItemNameValue(TETeleportationPylon.GetPylonItemTypeFromTileStyle((int)info.TypeOfPylon));
                    if (Main.mouseLeft && Main.mouseLeftRelease)
                    {
                        Main.mouseLeftRelease = false;
                        Main.mapFullscreen    = false;
                        Main.PylonSystem.RequestTeleportation(info, Main.LocalPlayer);
                        SoundEngine.PlaySound(11);
                    }
                }
            }
        }