public void SetupIcons() { Icons = new List <PlayerIcon>(); var players = PlayerHelpers.GetAllCreatedFarmers(); this.allClickableComponents = new List <ClickableComponent>(); this.xPositionOnScreen = Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Right - 90; this.yPositionOnScreen = 310; this.height = players.Count * HeadshotIconSize; this.width = HeadshotIconSize; for (var idx = 0; idx < players.Count; idx++) { var player = players[idx]; var yOffset = (idx * 50); var yPos = this.yPositionOnScreen + yOffset; var xPos = this.xPositionOnScreen; var waitingIconSize = Convert.ToInt32(9 * Game1.pixelZoom * WaitingIconScale); var offlineIconSize = Convert.ToInt32(11 * Game1.pixelZoom * OfflineIconScale); var waitingIcon = new ClickableTextureComponent( name: "", bounds: new Rectangle(xPos, yPos, waitingIconSize, waitingIconSize), label: "", hoverText: "", texture: Game1.mouseCursors, sourceRect: new Rectangle(434, 475, 9, 9), scale: Game1.pixelZoom * 0.5f, drawShadow: false); var offlineIcon = new ClickableTextureComponent( name: "", bounds: new Rectangle(xPos + HeadshotIconSize - offlineIconSize, yPos + 8, offlineIconSize, offlineIconSize), label: "", hoverText: "", texture: Game1.mouseCursors, sourceRect: new Rectangle(322, 498, 11, 11), scale: Game1.pixelZoom * 0.5f, drawShadow: false); var mugshotPosition = new Rectangle(xPos, yPos, HeadshotIconSize - 8, HeadshotIconSize - 16); this.allClickableComponents.Add(waitingIcon); Icons.Add(new PlayerIcon { PlayerId = player.UniqueMultiplayerID, WaitingIcon = waitingIcon, HeadshotPosition = mugshotPosition, OfflineIcon = offlineIcon }); } }
private void WatchPlayerActions(object sender, EventArgs e) { if (!Context.IsWorldReady) { return; } var players = PlayerHelpers.GetAllCreatedFarmers(); foreach (var player in players) { var playerId = player.uniqueMultiplayerID; LastActions.GetOrCreateDefault(playerId); var currentLocation = player.currentLocation?.name ?? new NetString("(unknown location)"); if (CheckLocationChange(currentLocation, playerId)) { continue; } if (CheckUsingTool(player, playerId, currentLocation)) { continue; } } }