public void Display(object data, bool isRowOdd) { m_options = data as VehicleOptions; if (m_icon == null || m_options == null) { return; } m_icon.spriteName = UIMainPanel.vehicleIconList[(int)m_options.category]; m_icon.size = m_icon.spriteInfo.pixelSize; UIUtils.ResizeIcon(m_icon, new Vector2(32, 32)); m_icon.relativePosition = new Vector3(10, Mathf.Floor((height - m_icon.height) / 2)); m_name.text = m_options.localizedName; m_disabled.isVisible = !options.enabled; m_name.textColor = options.enabled ? new Color32(255, 255, 255, 255) : new Color32(128, 128, 128, 255); m_steamIcon.tooltip = m_options.steamID; m_steamIcon.isVisible = m_options.steamID != null; if (isRowOdd) { background.backgroundSprite = "UnlockingItemBackground"; background.color = new Color32(0, 0, 0, 128); } else { background.backgroundSprite = null; } }
public void Display(object data, bool isRowOdd) { m_options = data as VehicleOptions; if (m_icon == null || m_options == null) { return; } m_icon.spriteName = UIMainPanel.vehicleIconList[(int)m_options.category]; m_icon.size = m_icon.spriteInfo.pixelSize; UIUtils.ResizeIcon(m_icon, new Vector2(32, 32)); m_icon.relativePosition = new Vector3(10, Mathf.Floor((height - m_icon.height) / 2)); m_name.text = m_options.localizedName; m_disabled.isVisible = !options.enabled; //Verify if the vehicle is a Game Controlled Spawn Public Transport vehicle, where the game controls spawning; if disabled/deactivated set to enabled if (options.isPublicTransportGame == true) // && AdvancedVehicleOptionsUID.SpawnControl == true) && options.isUncontrolledPublicTransport == false) { if (options.enabled == false) { options.enabled = true; } } m_disabled.isVisible = !options.enabled; m_name.textColor = options.enabled ? new Color32(255, 255, 255, 255) : new Color32(128, 128, 128, 255); m_steamIcon.tooltip = m_options.steamID; m_steamIcon.isVisible = m_options.steamID != null; if (isRowOdd) { background.backgroundSprite = "UnlockingItemBackground"; background.color = new Color32(0, 0, 0, 128); } else { background.backgroundSprite = null; } }
public override void Start() { base.Start(); isVisible = true; canFocus = true; isInteractive = true; width = parent.width; height = 40; m_icon = AddUIComponent <UISprite>(); m_disabled = AddUIComponent <UISprite>(); m_disabled.spriteName = "Niet"; m_disabled.size = m_disabled.spriteInfo.pixelSize; UIUtils.ResizeIcon(m_disabled, new Vector2(32, 32)); m_disabled.relativePosition = new Vector3(10, Mathf.Floor((height - m_disabled.height) / 2)); m_name = AddUIComponent <UILabel>(); m_name.textScale = 0.8f; m_name.relativePosition = new Vector3(55, 13); m_steamIcon = AddUIComponent <UISprite>(); m_steamIcon.spriteName = "SteamWorkshop"; m_steamIcon.isVisible = false; m_steamIcon.relativePosition = new Vector3(width - 45, 12.5f); UIUtils.ResizeIcon(m_steamIcon, new Vector2(25, 25)); if (PlatformService.IsOverlayEnabled()) { m_steamIcon.eventClick += (c, p) => { p.Use(); PlatformService.ActivateGameOverlayToWorkshopItem(new PublishedFileId(ulong.Parse(m_options.steamID))); }; } }