コード例 #1
0
        public void Draw(MapOverlayDrawContext context, string text)
        {
            Player  localPlayer = Main.LocalPlayer;
            Vector2 position    = new Vector2(localPlayer.SpawnX, localPlayer.SpawnY);

            if (context.Draw(position: new Vector2(Main.spawnTileX, Main.spawnTileY), texture: TextureAssets.SpawnPoint.Value, alignment: Alignment.Bottom).IsMouseOver)
            {
                text = Language.GetTextValue("UI.SpawnPoint");
            }
            if (localPlayer.SpawnX != -1 && context.Draw(TextureAssets.SpawnBed.Value, position, Alignment.Bottom).IsMouseOver)
            {
                text = Language.GetTextValue("UI.SpawnBed");
            }
        }
コード例 #2
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);
                    }
                }
            }
        }
コード例 #3
0
        public void Draw(ref MapOverlayDrawContext context, ref string text)
        {
            Player  localPlayer = Main.LocalPlayer;
            Vector2 position1   = new Vector2((float)localPlayer.SpawnX, (float)localPlayer.SpawnY);
            Vector2 position2   = new Vector2((float)Main.spawnTileX, (float)Main.spawnTileY);

            if (context.Draw(TextureAssets.SpawnPoint.get_Value(), position2, Alignment.Bottom).IsMouseOver)
            {
                text = Language.GetTextValue("UI.SpawnPoint");
            }
            if (localPlayer.SpawnX == -1 || !context.Draw(TextureAssets.SpawnBed.get_Value(), position1, Alignment.Bottom).IsMouseOver)
            {
                return;
            }
            text = Language.GetTextValue("UI.SpawnBed");
        }
コード例 #4
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);
                    }
                }
            }
        }
コード例 #5
0
ファイル: PingMapLayer.cs プロジェクト: egshels/Sources
        public void Draw(ref MapOverlayDrawContext context, ref string text)
        {
            SpriteFrame frame = new SpriteFrame((byte)1, (byte)5);
            DateTime    now   = DateTime.Now;

            using (IEnumerator <SlotVector <PingMapLayer.Ping> .ItemPair> enumerator = ((IEnumerable <SlotVector <PingMapLayer.Ping> .ItemPair>) this._pings).GetEnumerator())
            {
                while (((IEnumerator)enumerator).MoveNext())
                {
                    SlotVector <PingMapLayer.Ping> .ItemPair current = enumerator.Current;
                    PingMapLayer.Ping ping         = (PingMapLayer.Ping)current.Value;
                    double            totalSeconds = (now - ping.Time).TotalSeconds;
                    int num = (int)(totalSeconds * 10.0);
                    frame.CurrentRow = (byte)((uint)num % (uint)frame.RowCount);
                    context.Draw(TextureAssets.MapPing.get_Value(), ping.Position, frame, Alignment.Center);
                    if (totalSeconds > 15.0)
                    {
                        this._pings.Remove((SlotId)current.Id);
                    }
                }
            }
        }
コード例 #6
0
ファイル: PingMapLayer.cs プロジェクト: egshels/Sources
		public void Draw(ref MapOverlayDrawContext context, ref string text)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			SpriteFrame frame = new SpriteFrame(1, 5);
			DateTime now = DateTime.Now;
			foreach (ItemPair<Ping> item in (IEnumerable<ItemPair<Ping>>)_pings)
			{
				Ping value = item.Value;
				double totalSeconds = (now - value.Time).TotalSeconds;
				int num = (int)(totalSeconds * 10.0);
				frame.CurrentRow = (byte)(num % (int)frame.RowCount);
				context.Draw(TextureAssets.MapPing.get_Value(), value.Position, frame, Alignment.Center);
				if (totalSeconds > 15.0)
				{
					_pings.Remove(item.Id);
				}
			}
		}