Improve QuestFrame font handling
All checks were successful
forgejo/Czech Quests/addon/pipeline/head This commit looks good
All checks were successful
forgejo/Czech Quests/addon/pipeline/head This commit looks good
This commit is contained in:
parent
cb1e6950e3
commit
a606f6b16b
3 changed files with 59 additions and 158 deletions
|
@ -35,17 +35,42 @@ function QuestFrame:Init()
|
|||
self.Texture:SetAllPoints(true)
|
||||
self.Texture:SetHorizTile(true)
|
||||
|
||||
-- Load settings
|
||||
self:UpdateSettings()
|
||||
end
|
||||
|
||||
function QuestFrame:UpdateSettings()
|
||||
-- Create fonts
|
||||
self.Title = self:CreateHeader()
|
||||
self.Text1 = self:CreateText()
|
||||
self.Header = self:CreateHeader()
|
||||
self.Text2 = self:CreateText()
|
||||
|
||||
self:ApplyTheme()
|
||||
-- Load settings
|
||||
self:UpdateSettings()
|
||||
end
|
||||
|
||||
function QuestFrame:UpdateFontSettings(FontString, newFont, newSize)
|
||||
local _, _, flags = FontString:GetFont()
|
||||
FontString:SetFont(newFont, newSize, flags)
|
||||
end
|
||||
|
||||
function QuestFrame:UpdateSettings()
|
||||
self:UpdateFontSettings(
|
||||
self.Title,
|
||||
CzechQuestsAddon_Store.config.QUEST_HEADER_FONT_NAME,
|
||||
CzechQuestsAddon_Store.config.QUEST_HEADER_FONT_SIZE
|
||||
)
|
||||
self:UpdateFontSettings(
|
||||
self.Text1,
|
||||
CzechQuestsAddon_Store.config.QUEST_TEXT_FONT_NAME,
|
||||
CzechQuestsAddon_Store.config.QUEST_TEXT_FONT_SIZE
|
||||
)
|
||||
self:UpdateFontSettings(
|
||||
self.Header,
|
||||
CzechQuestsAddon_Store.config.QUEST_HEADER_FONT_NAME,
|
||||
CzechQuestsAddon_Store.config.QUEST_HEADER_FONT_SIZE
|
||||
)
|
||||
self:UpdateFontSettings(
|
||||
self.Text2,
|
||||
CzechQuestsAddon_Store.config.QUEST_TEXT_FONT_NAME,
|
||||
CzechQuestsAddon_Store.config.QUEST_TEXT_FONT_SIZE
|
||||
)
|
||||
|
||||
if not CzechQuestsAddon_Store.config.QUEST_TEXTURE_ALPHA_ONLY_MOVING then
|
||||
self.Texture:SetAlpha(CzechQuestsAddon_Store.config.QUEST_TEXTURE_ALPHA / 100)
|
||||
|
@ -69,46 +94,36 @@ end
|
|||
function QuestFrame:ApplyTheme()
|
||||
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
|
||||
self.Texture:SetTexture("Interface/QUESTFRAME/QuestBG");
|
||||
self.Texture:SetTexCoord(0, .58, 0.005, 0.66)
|
||||
self:SetTextColor(0, 0, 0, 1)
|
||||
if CzechQuestsAddon_Store.config.QUEST_DARK_MODE then
|
||||
self:SetBackdropColor(0, 0, 0, 1)
|
||||
self.Texture:SetColorTexture(0, 0, 0, 1)
|
||||
self:SetTextColor(255, 255, 255, 1)
|
||||
else
|
||||
self.Texture:SetTexCoord(0, .58, 0.005, 0.66)
|
||||
self:SetTextColor(0, 0, 0, 1)
|
||||
end
|
||||
else
|
||||
self.Texture:SetTexture("Interface/QUESTFRAME/QuestBackgroundParchment");
|
||||
self.Texture:SetTexCoord(0, .01, 0, 0.4)
|
||||
self:SetTextColor(0, 0, 0, 1)
|
||||
local questTextContrast = C_CVar.GetCVar("questTextContrast")
|
||||
if questTextContrast == "1" then -- Brown
|
||||
if questTextContrast == "1" then
|
||||
-- Brown
|
||||
self.Texture:SetTexCoord(0, .01, .4, .8)
|
||||
elseif questTextContrast == "2" or questTextContrast == "3" then -- Gray
|
||||
elseif questTextContrast == "2" or questTextContrast == "3" then
|
||||
-- Gray
|
||||
self.Texture:SetColorTexture(255, 255, 255, 1)
|
||||
elseif questTextContrast == "4" then -- Black
|
||||
elseif questTextContrast == "4" then
|
||||
-- Black
|
||||
self.Texture:SetColorTexture(0, 0, 0, 1)
|
||||
self:SetTextColor(0, 0, 0, 1)
|
||||
self:SetTextColor(255, 255, 255, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function QuestFrame:CalculateHeight()
|
||||
local height = 0;
|
||||
local heights = {
|
||||
self.Title:GetHeight() ,
|
||||
self.Text1:GetHeight(),
|
||||
self.Header:GetHeight(),
|
||||
self.Text2:GetHeight(),
|
||||
10
|
||||
}
|
||||
for _, value in ipairs(heights) do
|
||||
height = height + value + 10
|
||||
end
|
||||
self:SetHeight(height)
|
||||
end
|
||||
|
||||
function QuestFrame:SetData(name, text1, header, text2, parentFrame, yOffset, xOffset)
|
||||
-- Reset previously values
|
||||
self:ApplyTheme()
|
||||
self:ResetText()
|
||||
|
||||
-- Set parent
|
||||
|
@ -144,4 +159,19 @@ function QuestFrame:SetData(name, text1, header, text2, parentFrame, yOffset, xO
|
|||
else
|
||||
self:CalculateHeight()
|
||||
end
|
||||
end
|
||||
|
||||
function QuestFrame:CalculateHeight()
|
||||
local height = 0;
|
||||
local heights = {
|
||||
self.Title:GetHeight(),
|
||||
self.Text1:GetHeight(),
|
||||
self.Header:GetHeight(),
|
||||
self.Text2:GetHeight(),
|
||||
10
|
||||
}
|
||||
for _, value in ipairs(heights) do
|
||||
height = height + value + 10
|
||||
end
|
||||
self:SetHeight(height)
|
||||
end
|
129
release.sh
129
release.sh
|
@ -1,129 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
output_directory="CzechQuests"
|
||||
|
||||
wow_versions=(
|
||||
"Classic ERA" # 1 - classic_era
|
||||
"Retail" # 2 - retail
|
||||
)
|
||||
|
||||
toc_files=(
|
||||
"CzechQuests_Vanilla.toc"
|
||||
"CzechQuests_Mainline.toc"
|
||||
)
|
||||
|
||||
|
||||
read_toc_version() {
|
||||
local wow_version=$1
|
||||
local toc_file=${toc_files[$wow_version]}
|
||||
local current_version=0
|
||||
if [[ -f "$toc_file" ]]; then
|
||||
current_version=$(grep "## Version:" "$toc_file" | cut -d ' ' -f 3)
|
||||
fi
|
||||
echo "$current_version"
|
||||
}
|
||||
|
||||
write_toc_version() {
|
||||
local wow_version=$1
|
||||
local next_version=$2
|
||||
local toc_file=${toc_files[$wow_version]}
|
||||
if [[ -f "$toc_file" ]]; then
|
||||
sed -i '' "s/## Version: $current_version/## Version: $next_version/" "$toc_file"
|
||||
fi
|
||||
}
|
||||
|
||||
make_zip() {
|
||||
local wow_version=$1
|
||||
local current_version=$2
|
||||
|
||||
local zip_filename=""
|
||||
local files_to_zip=()
|
||||
|
||||
# prepare output directory
|
||||
mkdir -p $output_directory
|
||||
mkdir -p "${output_directory}/Addon/Data/"
|
||||
|
||||
# Includes classic era continents
|
||||
if [ "$wow_version" = "1" ]; then
|
||||
cp -r "./Addon/Data/classic_era/" "${output_directory}/Addon/Data/"
|
||||
cp "./CzechQuests_Vanilla.toc" "${output_directory}"
|
||||
zip_filename="czech-quests-classic_era-v$current_version.zip"
|
||||
fi
|
||||
|
||||
# Includes retail continents
|
||||
if [ "$wow_version" = "2" ]; then
|
||||
cp -r "./Addon/Data/retail/" "${output_directory}/Addon/Data/"
|
||||
cp "./CzechQuests_Mainline.toc" "${output_directory}"
|
||||
zip_filename="czech-quests-retail-v$current_version.zip"
|
||||
fi
|
||||
|
||||
# includes frames
|
||||
while IFS= read -r line; do
|
||||
files_to_zip+=("$line")
|
||||
done < <(find . -name "*.lua" -path "./Addon/Frames/*")
|
||||
|
||||
# includes code
|
||||
while IFS= read -r line; do
|
||||
files_to_zip+=("$line")
|
||||
done < <(find . -name "*.lua" -path "./Addon/Code/*")
|
||||
|
||||
# includes assets
|
||||
while IFS= read -r line; do
|
||||
files_to_zip+=("$line")
|
||||
done < <(find . -name "*" -path "./Assets/*")
|
||||
|
||||
# includes other files
|
||||
files_to_zip+=("./Addon/Data/other.lua" "./Addon/Addon.lua" "./CzechQuests.lua")
|
||||
|
||||
# prepare output directory
|
||||
for file in "${files_to_zip[@]}"; do
|
||||
rsync -R "$file" "$output_directory"
|
||||
done
|
||||
|
||||
# Remove invalid files
|
||||
find "$output_directory" -name ".DS_Store" -type f -delete
|
||||
|
||||
# create zip file
|
||||
zip -r "$zip_filename" $output_directory
|
||||
|
||||
# remove output directory
|
||||
rm -r $output_directory
|
||||
}
|
||||
|
||||
release_wow() {
|
||||
local wow_version=$1
|
||||
|
||||
# Read current version from file for wow version
|
||||
current_version=$(read_toc_version "$wow_version")
|
||||
|
||||
# Increase version
|
||||
new_version="$current_version"
|
||||
vared -p "Choose version: " new_version
|
||||
|
||||
# Write to file
|
||||
write_toc_version "$wow_version" "$new_version"
|
||||
|
||||
# Generate zip
|
||||
make_zip $wow_version $new_version
|
||||
}
|
||||
|
||||
init() {
|
||||
echo "Choose Wow:"
|
||||
select opt in "${wow_versions[@]}"
|
||||
do
|
||||
case $opt in
|
||||
"Classic ERA")
|
||||
echo "You chose Classic ERA"
|
||||
release_wow 1
|
||||
return 0
|
||||
;;
|
||||
"Retail")
|
||||
echo "You chose Retail"
|
||||
release_wow 2
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
init
|
4
sync.sh
4
sync.sh
|
@ -13,8 +13,8 @@ src_folder="."
|
|||
dest_folder="/Applications/World of Warcraft/_${wow_destiny_folder}_/Interface/AddOns/CzechQuests"
|
||||
|
||||
fswatch -o "$src_folder" | while read -r change; do
|
||||
rsync -avu --delete "$src_folder" "$dest_folder" --exclude={'.*','*.png','*.sh','*.md','Addon/Data/**','downloader/**'}
|
||||
rsync -avu --delete "$src_folder" "$dest_folder" --exclude={'.*','*.png','*.sh','*.md','Addon/Data/**','downloader/**',"lib/**","Jenkinsfile"}
|
||||
rsync -au --delete "$src_folder/Addon/Data/$wow_source_folder/" "$dest_folder/Addon/Data/"
|
||||
echo "Dest: $dest_folder"
|
||||
cp "$src_folder/Addon/Data/other.lua" "$dest_folder/Addon/Data/"
|
||||
done
|
||||
done
|
||||
|
|
Loading…
Add table
Reference in a new issue