Skip to content

Commit

Permalink
Merge pull request #6 from Peppie84/development
Browse files Browse the repository at this point in the history
v1.1.0.0 Release
  • Loading branch information
Peppie84 authored May 26, 2023
2 parents a790a7c + 46b46ea commit d131e08
Show file tree
Hide file tree
Showing 17 changed files with 262 additions and 75 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ charset = utf-8
max_line_length = off
indent_size = 2


[*.md]
trim_trailing_whitespace = false
insert_final_newline = false
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ luac.out

# repo specific
.testrunner/

# Giants debugger
*.gdpu
*.gdp
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]


## [1.1.0.0] - 2023-05-26
- Added github link to modDesc.xml
- Refactored TempInfo.lua
- Decreased TempInfo min/max temperatur font size
- Decreased TempInfo min/max temperatur font size - for #2
- Added Settings area to disable temp info - for #1
- modDesc.xml descVersion update
- Added `l10n_cz.xml` by [SniperKittenCZ](https://github.com/SniperKittenCZ)


## [1.0.0.0] - 2023-04-17

### Added or Changed
- Initial release (https://www.farming-simulator.com/mod.php?mod_id=267536)
131 changes: 131 additions & 0 deletions FS22_ExtendedGameInfoDisplay/extendedgameinfodisplaygui.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
-- ExtendedGameInfoDisplayGui
--
-- Class to handle the new ui controls on the settings frame
-- to control the temperature info on & off and saves the
-- value in the modSettings-folder.
--
-- Copyright (c) Peppie84, 2023
--
ExtendedGameInfoDisplayGui = {
MOD_DIRECTORY = g_currentModDirectory,
MOD_SETTINGS_DIRECTORY = g_currentModSettingsDirectory .. '../',
MOD_SETTINGS_FILENAME = 'ExtendedGameInfoDisplay.xml',
MOD_SETTINGS_XML_ROOT_NODE = 'settings',
CURRENT_MOD = g_currentModName or 'unknown',
L10N_SYMBOLS = {
MOD_TITLE = 'mod_title',
TEMPERATURE_SETTING_LABEL = 'settings_temperature_label',
TEMPERATURE_SETTING_DESCRIPTION = 'settings_temperature_description',
EASYARMCONTROL_TEMPERATURE_OPTION1 = 'settings_temperature_option1',
EASYARMCONTROL_TEMPERATURE_OPTION2 = 'settings_temperature_option2',
},
ENUM_EASYARMCONTROL_INDEX = {
LABEL = 4,
DESCRIPTION = 6,
},
ENUM_TEMPERATURE_VIEW_STATE = {
ON = 1,
OFF = 2,
}
}

ExtendedGameInfoDisplayGui.settings = {}
ExtendedGameInfoDisplayGui.settings.temperatureVisibility = true

---Append to InGameMenuGeneralSettingsFrame.onFrameOpen
---Initialize our gui elements for the settings frame that we need.
function ExtendedGameInfoDisplayGui:initGui()
if not self.initGuiDone then
local title = TextElement.new()
local temperaturSettingTitleText = g_i18n:getText(ExtendedGameInfoDisplayGui.L10N_SYMBOLS.MOD_TITLE, ExtendedGameInfoDisplayGui.CURRENT_MOD)
local temperaturSettingLabelText = g_i18n:getText(ExtendedGameInfoDisplayGui.L10N_SYMBOLS.TEMPERATURE_SETTING_LABEL, ExtendedGameInfoDisplayGui.CURRENT_MOD)
local temperaturSettingDescriptionText = g_i18n:getText(ExtendedGameInfoDisplayGui.L10N_SYMBOLS.TEMPERATURE_SETTING_DESCRIPTION, ExtendedGameInfoDisplayGui.CURRENT_MOD)
local temperaturSettingOption1Text = g_i18n:getText(ExtendedGameInfoDisplayGui.L10N_SYMBOLS.EASYARMCONTROL_TEMPERATURE_OPTION1, ExtendedGameInfoDisplayGui.CURRENT_MOD)
local temperaturSettingOption2Text = g_i18n:getText(ExtendedGameInfoDisplayGui.L10N_SYMBOLS.EASYARMCONTROL_TEMPERATURE_OPTION2, ExtendedGameInfoDisplayGui.CURRENT_MOD)

self.ExtendedGameInfoDisplay = self.checkUseEasyArmControl:clone()
self.ExtendedGameInfoDisplay.target = ExtendedGameInfoDisplayGui
self.ExtendedGameInfoDisplay.id = 'ExtendedGameInfoDisplay'
self.ExtendedGameInfoDisplay:setCallback('onClickCallback', 'onExtendedGameInfoDisplayChanged')
self.ExtendedGameInfoDisplay:setTexts({temperaturSettingOption1Text, temperaturSettingOption2Text})
self.ExtendedGameInfoDisplay.elements[ExtendedGameInfoDisplayGui.ENUM_EASYARMCONTROL_INDEX.LABEL]:setText(temperaturSettingLabelText)
self.ExtendedGameInfoDisplay.elements[ExtendedGameInfoDisplayGui.ENUM_EASYARMCONTROL_INDEX.DESCRIPTION]:setText(temperaturSettingDescriptionText)

title:applyProfile('settingsMenuSubtitle', true)
title:setText(temperaturSettingTitleText)

self.boxLayout:addElement(title)
self.boxLayout:addElement(self.ExtendedGameInfoDisplay)

local state = ExtendedGameInfoDisplayGui.ENUM_TEMPERATURE_VIEW_STATE.ON
if ExtendedGameInfoDisplayGui.settings.temperatureVisibility == false then
state = ExtendedGameInfoDisplayGui.ENUM_TEMPERATURE_VIEW_STATE.OFF
end

self.ExtendedGameInfoDisplay:setState(state)
self.initGuiDone = true
end
end

---Callback function for our gui element by on change
---@param state number
function ExtendedGameInfoDisplayGui:onExtendedGameInfoDisplayChanged(state)
ExtendedGameInfoDisplayGui.settings.temperatureVisibility = true
if state == ExtendedGameInfoDisplayGui.ENUM_TEMPERATURE_VIEW_STATE.OFF then
ExtendedGameInfoDisplayGui.settings.temperatureVisibility = false
end

ExtendedGameInfoDisplayGui:saveSettings()
g_currentMission.hud.gameInfoDisplay:setTemperatureVisible(nil)
end

---Appand to and InGameMenuGeneralSettingsFrame.updateGameSettings()
---Just udpate the gui
function ExtendedGameInfoDisplayGui:updateGui()
if self.initGuiDone and self.ExtendedGameInfoDisplay ~= nil then
self.ExtendedGameInfoDisplay:setState(ExtendedGameInfoDisplayGui.ENUM_TEMPERATURE_VIEW_STATE.ON)
end
end

---Save the settings into its own xml under modSettings/ path
function ExtendedGameInfoDisplayGui:saveSettings()
local filename = ExtendedGameInfoDisplayGui.MOD_SETTINGS_DIRECTORY .. ExtendedGameInfoDisplayGui.MOD_SETTINGS_FILENAME
local xmlRootNode = ExtendedGameInfoDisplayGui.MOD_SETTINGS_XML_ROOT_NODE
local xmlFile = XMLFile.create("settingsXML", filename, xmlRootNode)

if xmlFile ~= nil then
xmlFile:setBool(xmlRootNode .. ".temperatureVisibility", self.settings.temperatureVisibility)

xmlFile:save()
xmlFile:delete()
end
end

---Load the settings xml from modSettings/
function ExtendedGameInfoDisplayGui:loadSettings()
local filename = ExtendedGameInfoDisplayGui.MOD_SETTINGS_DIRECTORY .. ExtendedGameInfoDisplayGui.MOD_SETTINGS_FILENAME
local xmlRootNode = ExtendedGameInfoDisplayGui.MOD_SETTINGS_XML_ROOT_NODE
local xmlFile = XMLFile.loadIfExists("settingsXML", filename, xmlRootNode)

if xmlFile ~= nil then
ExtendedGameInfoDisplayGui.settings.temperatureVisibility = Utils.getNoNil(xmlFile:getBool(xmlRootNode .. ".temperatureVisibility"), true)

xmlFile:delete()
end
end

---Event from addModEventListener after loading the map
function ExtendedGameInfoDisplayGui:loadMap()
ExtendedGameInfoDisplayGui:loadSettings()
g_currentMission.hud.gameInfoDisplay:setTemperatureVisible(nil)
end

---Init
local function init()
InGameMenuGeneralSettingsFrame.onFrameOpen = Utils.appendedFunction(InGameMenuGeneralSettingsFrame.onFrameOpen, ExtendedGameInfoDisplayGui.initGui)
InGameMenuGeneralSettingsFrame.updateGameSettings = Utils.appendedFunction(InGameMenuGeneralSettingsFrame.updateGameSettings, ExtendedGameInfoDisplayGui.updateGui)
end

init()
addModEventListener(ExtendedGameInfoDisplayGui)
File renamed without changes.
40 changes: 21 additions & 19 deletions FS22_ExtendedGameInfoDisplay/modDesc.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="73">
<modDesc descVersion="74">
<author>Peppie84</author>
<version>1.0.0.0</version>
<version>1.1.0.0</version>
<title>
<en>Extended Game Infodisplay</en>
<de>Erweiterte Spiel-Infodarstellung</de>
</title>
<description>
<en>
<![CDATA[
<en><![CDATA[
Expands the current GameInfoDisplay in the upper right corner by displaying the current year under the date and activates a hidden temperature feature with an indicator of whether the temperature is falling, staying constant or rising, the display of the current temperature. I also added the min/max temperature of the day.
For more information, help, and reporting issues please visit <a href='https://github.com/Peppie23/FS22_ExtendedGameInfoDisplay'>GitHub</a>.
]]>
</en>
<de>
<![CDATA[
Changelog v1.1.0.0
- Decreased min/max temperature font size
- Added settings area to en-/disable temperature info
- Added CZ translations
For more information, help, and reporting issues please visit <a href='https://github.com/Peppie84/FS22_ExtendedGameInfoDisplay'>GitHub</a>.
]]> </en>
<de><![CDATA[
Erweitert die aktuelle GameInfoDisplay oben rechts um die Anzeige des aktuellen Jahres unter dem Datum und aktiviert ein verstecktes Temperaturfeature mit einem Indikator ob die Temepratur fällt, gleich bleibt oder steigt, die Anzeige der aktuellen Temperatur und der min/max Temperatur des Tages.
Weitere Informationen, Hilfe und Probleme melden finden Sie unter <a href='https://github.com/Peppie23/FS22_ExtendedGameInfoDisplay'>GitHub</a>.
]]>
</de>
Changelog v1.1.0.0
- Schriftgröße der min/max Temperatur verkleinert
- Bei Settings kann die Temperaturanzeige ein-/ausgeblendet werden
- CZ translations hinzugefügt
Weitere Informationen, Hilfe und Probleme melden finden Sie unter <a href='https://github.com/Peppie84/FS22_ExtendedGameInfoDisplay'>GitHub</a>.
]]> </de>
</description>
<iconFilename>mod_icon.dds</iconFilename>
<iconFilename>icon_ExGameInfoDisp.dds</iconFilename>
<multiplayer supported="true" />
<extraSourceFiles>
<sourceFile filename="yearinfo.lua" />
<sourceFile filename="tempinfo.lua" />
<sourceFile filename="extendedgameinfodisplaygui.lua" />
</extraSourceFiles>
<l10n>
<text name="current_year">
<en>Year</en>
<de>Jahr</de>
</text>
</l10n>
<l10n filenamePrefix="translations/l10n" />
</modDesc>
4 changes: 2 additions & 2 deletions FS22_ExtendedGameInfoDisplay/tempinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TempInfo = {}
---@param overwrittenFunc function
---@param isVisible boolean
function TempInfo:gameinfodisplay__setTemperatureVisible(overwrittenFunc, isVisible)
overwrittenFunc(self, true)
overwrittenFunc(self, ExtendedGameInfoDisplayGui.settings.temperatureVisibility)
end

---Overwritten GameInfoDisplay:updateTemperature()
Expand Down Expand Up @@ -50,6 +50,6 @@ GameInfoDisplay.drawTemperatureText = Utils.overwrittenFunction(GameInfoDisplay.

-- Change dimensions of the temp box
GameInfoDisplay.SIZE.TEMPERATURE_BOX = {
95,
92,
GameInfoDisplay.BOX_HEIGHT
}
12 changes: 12 additions & 0 deletions FS22_ExtendedGameInfoDisplay/translations/l10n_cz.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<l10n>
<translationContributors>SniperKittenCz</translationContributors>
<elements>
<e k="mod_title" v="Rozšířený herní info displej"/>
<e k="yearinfo_current_year" v="Rok"/>
<e k="settings_temperature_label" v="Teplota"/>
<e k="settings_temperature_description" v="Přepíná pohled na aktuální, min &amp; maximální teplotu v pravém horním rohu HUD."/>
<e k="settings_temperature_option1" v="Zap"/>
<e k="settings_temperature_option2" v="Vyp"/>
</elements>
</l10n>
12 changes: 12 additions & 0 deletions FS22_ExtendedGameInfoDisplay/translations/l10n_de.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<l10n>
<translationContributors>Peppie84</translationContributors>
<elements>
<e k="mod_title" v="Erweiterte Spiel-Infodarstellung"/>
<e k="yearinfo_current_year" v="Jahr"/>
<e k="settings_temperature_label" v="Temperaturanzeige"/>
<e k="settings_temperature_description" v="Steuert die Anzeige der aktuellen, min &amp; max Temperatur oben rechts im Hud."/>
<e k="settings_temperature_option1" v="An"/>
<e k="settings_temperature_option2" v="Aus"/>
</elements>
</l10n>
12 changes: 12 additions & 0 deletions FS22_ExtendedGameInfoDisplay/translations/l10n_en.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<l10n>
<translationContributors>Peppie84</translationContributors>
<elements>
<e k="mod_title" v="Extended Game Infodisplay"/>
<e k="yearinfo_current_year" v="Year"/>
<e k="settings_temperature_label" v="Temperature"/>
<e k="settings_temperature_description" v="Toggles view of the current, min &amp; max temperature on the upper right corner hud."/>
<e k="settings_temperature_option1" v="On"/>
<e k="settings_temperature_option2" v="Off"/>
</elements>
</l10n>
23 changes: 13 additions & 10 deletions FS22_ExtendedGameInfoDisplay/yearinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@
--
-- Copyright (c) Peppie84, 2021
--
yearInfo = {}
yearInfo.currentModName = g_currentModName
yearInfo.currentModDirectory = g_currentModDirectory
YearInfo = {
L10N_SYMBOLS = {
YEAR_TEXT = "yearinfo_current_year"
},
CURRENT_MOD = g_currentModName or 'unknown'
}

function yearInfo:gameinfodisplay__drawDateText()
---Overwritten GameInfoDisplay.drawDateText()
---Overwrite the vanilla drawDateText function to append the
---current year under the current month.
---@param overwrittenFunc function
function YearInfo:gameinfodisplay__drawDateText(overwrittenFunc)
setTextBold(false)
setTextAlignment(RenderText.ALIGN_LEFT)
setTextColor(unpack(GameInfoDisplay.COLOR.TEXT))
Expand All @@ -24,16 +31,12 @@ function yearInfo:gameinfodisplay__drawDateText()
local textPositionYForMonth = self.monthTextPositionY + (scaledTextSizeForMonth * 0.5)
local textPositionYForYear = self.monthTextPositionY - (scaledTextSizeForMonth * 0.30)

local l10nTextYear = g_i18n:getText(yearInfo.L10N_SYMBOL.YEAR_TEXT, yearInfo.currentModName)
local l10nTextYear = g_i18n:getText(YearInfo.L10N_SYMBOLS.YEAR_TEXT, YearInfo.CURRENT_MOD)

--
renderText(self.monthTextPositionX, textPositionYForMonth, scaledTextSizeForMonth, self.monthText)
renderText(self.monthTextPositionX, textPositionYForYear, scaledTextSizeForYear, l10nTextYear .. " " .. tostring(self.environment.currentYear))
end

-- Overwrite the default GameInfoDisplay.drawDateText function
GameInfoDisplay.drawDateText = Utils.overwrittenFunction(GameInfoDisplay.drawDateText, yearInfo.gameinfodisplay__drawDateText)

yearInfo.L10N_SYMBOL = {
YEAR_TEXT = "current_year"
}
GameInfoDisplay.drawDateText = Utils.overwrittenFunction(GameInfoDisplay.drawDateText, YearInfo.gameinfodisplay__drawDateText)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<a name="readme-top"></a>

[![FarmingSimulator-22](https://img.shields.io/badge/FarmingSimulator-22-blue?style=flat-square)](https://www.farming-simulator.com/)
[![Modhub Version](https://img.shields.io/badge/Modhub-v1.0.0.0-green?style=flat-square)](https://farming-simulator.com/mod.php?mod_id=267536)
[![GitHub issues](https://img.shields.io/github/issues/Peppie23/FS22_ExtendedGameInfoDisplay?style=flat-square)](https://github.com/Peppie23/FS22_ExtendedGameInfoDisplay/issues)
[![Modhub Version](https://img.shields.io/badge/Modhub-v1.1.0.0-green?style=flat-square)](https://farming-simulator.com/mod.php?mod_id=267536)
[![GitHub issues](https://img.shields.io/github/issues/Peppie84/FS22_ExtendedGameInfoDisplay?style=flat-square)](https://github.com/Peppie84/FS22_ExtendedGameInfoDisplay/issues)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0)

<br />
Expand All @@ -29,7 +29,7 @@
* Sqeep

# Copyright
Copyright (c) 2023 [Dennis Schmitt](https://github.com/peppie23).
Copyright (c) 2023 [Dennis Schmitt](https://github.com/peppie84).
All rights reserved.

<p align="right">(<a href="#readme-top">back to top</a>)</p>
Binary file modified documents/screen1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/screen3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/screens-full.pdn
Binary file not shown.
Binary file modified documents/screens.pdn
Binary file not shown.
Loading

0 comments on commit d131e08

Please sign in to comment.