Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create super announcer #810

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions LuaMenu/widgets/chobby/components/configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ function Configuration:GetConfigData()
useLastGameSpectatorState = self.useLastGameSpectatorState,
friendsFilterOnline = self.friendsFilterOnline,
queueExitConfirmPromptDoNotAskAgain = self.queueExitConfirmPromptDoNotAskAgain,
superAnnouncePopupSeen = self.superAnnouncePopupSeen
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,92 +3,110 @@

function widget:GetInfo()
return {
name = "Steam Release Notifier",
desc = "Tells people using standalone ZK when Steam is available.",
author = "GoogleFrog",
date = "23 April 2018",
name = "Super Announcement Notifier",
desc = "For important news. Opens a priority popup shortly after launch.",
author = "Moose, GoogleFrog",
date = "11 November 2024",
version = "1.0",
license = "GNU LGPL, v2.1 or later",
layer = 0,
enabled = false -- loaded by default?
enabled = true -- disabling this won't turn the announcement off
}
end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Initialization
local IMG_LINK = LUA_DIRNAME .. "images/link.png"
local doNotAskAgainKey = "steamReleasePopupSeen"
local releaseDate = {0, 15, 8, 27, 4, 2018} -- second, minute, hour, day, month, year
local IMG_SUPERANNOUNCE = LUA_DIRNAME .. "images/trailer.png"
local doNotAskAgainKey = "superAnnouncePopupSeen" -- change this for new announcement

local function SteamCheckPopup()
local enableAnnouncement = false -- this is the actual enable/disable switch
local announceDate = {0, 15, 8, 27, 4, 2018} -- second, minute, hour, day, month, year

local function SuperAnnouncePopup()
local Configuration = WG.Chobby.Configuration

if WG.Chobby.Configuration.gameConfig.disableSteam or Configuration.canAuthenticateWithSteam or Configuration[doNotAskAgainKey] then
if enableAnnouncement == false or Configuration[doNotAskAgainKey] then
return
end

local _, timeIsInTheFuture = Spring.Utilities.GetTimeDifferenceTable(releaseDate)
local _, timeIsInTheFuture = Spring.Utilities.GetTimeDifferenceTable(announceDate)
if timeIsInTheFuture then
return
end

local width, height = Spring.GetViewSizes()

local steamWindow = Window:New {
x = (width-460)/2,
y = (height-470)/2,
width = 460,
height = 470,
local superAnnounceWindow = Window:New {
x = (width-760)/2,
y = (height-670)/2,
width = 760,
height = 670,
caption = "",
resizable = false,
draggable = false,
parent = WG.Chobby.lobbyInterfaceHolder,
classname = "main_window",
children = {}
}

TextBox:New {
x = 74,
right = 15,
Label:New {
x = 0,
width = superAnnounceWindow.width - 35,
align = "center",
y = 23,
height = 35,
objectOverrideFont = WG.Chobby.Configuration:GetFont(4),
objectOverrideHintFont = WG.Chobby.Configuration:GetFont(4),
text = "Zero-K is on Steam!",
parent = steamWindow,
objectOverrideFont = WG.Chobby.Configuration:GetFont(7),
objectOverrideHintFont = WG.Chobby.Configuration:GetFont(7),
caption = "The New BAR Trailer is here!",
parent = superAnnounceWindow
}

Image:New {
x = 2,
right = 2,
align = "center",
y = 80,
width = 200,
height = 200,
keepAspect = true,
file = IMG_SUPERANNOUNCE,
parent = superAnnounceWindow
}

local offset = superAnnounceWindow.height * 0.65

TextBox:New {
x = 28,
right = 28,
y = 76,
y = offset - 120,
height = 35,
objectOverrideFont = WG.Chobby.Configuration:GetFont(2),
objectOverrideHintFont = WG.Chobby.Configuration:GetFont(2),
text = "You can help out by switching to the Steam version of Zero-K. This lets Steam know that people are interested in Zero-K which should, in turn, show the game to more potential players. See the settings guide for how to link your account and transfer your settings.",
parent = steamWindow,
text = "You can help out by watching the the new trailer for BAR. This lets Youtube know that people are interested in BAR which should, in turn, show the game to more potential players. For more info read the official announcement on our website.",
parent = superAnnounceWindow
}

local function CancelFunc()
steamWindow:Dispose()
superAnnounceWindow:Dispose()
end

local offset = 225
Button:New {
x = "26%",
y = offset,
right = "26%",
height = 65,
caption = "Store Page",
objectOverrideFont = WG.Chobby.Configuration:GetFont(4),
caption = "Watch the Trailer",
objectOverrideFont = WG.Chobby.Configuration:GetFont(5),
classname = "action_button",
padding = {2,4,4,4},
OnClick = {
function()
WG.BrowserHandler.OpenUrl("https://store.steampowered.com/app/334920/ZeroK/")
WG.BrowserHandler.OpenUrl("https://youtu.be/8K_fSWfOC1w?si=XDExlc7a8tuq6bHe")
end
},
parent = steamWindow,
parent = superAnnounceWindow
}
offset = offset + 74

Expand All @@ -97,26 +115,16 @@ local function SteamCheckPopup()
y = offset,
right = "27%",
height = 42,
caption = "Settings Guide",
caption = "Read annoucement",
objectOverrideFont = WG.Chobby.Configuration:GetFont(3),
classname = "option_button",
padding = {2,4,4,4},
OnClick = {
function()
WG.BrowserHandler.OpenUrl("http://zero-k.info/mediawiki/index.php?title=Configuration_Files")
WG.BrowserHandler.OpenUrl("https://www.beyondallreason.info/news/bar-trailer-2024")
end
},
parent = steamWindow,
children = {
Image:New {
right = 2,
y = 6,
width = 20,
height = 20,
keepAspect = true,
file = IMG_LINK
}
}
parent = superAnnounceWindow,
}

Button:New {
Expand All @@ -130,29 +138,28 @@ local function SteamCheckPopup()
OnClick = {
CancelFunc
},
parent = steamWindow,
parent = superAnnounceWindow
}

Checkbox:New {
x = 15,
width = 130,
width = 150,
bottom = 3,
height = 35,
boxalign = "right",
boxsize = 15,
caption = i18n("do_not_ask_again"),
checked = Configuration[doNotAskAgainKey] or false,
objectOverrideFont = WG.Chobby.Configuration:GetFont(1),
parent = steamWindow,
parent = superAnnounceWindow,
OnClick = {
function (obj)
Configuration:SetConfigValue(doNotAskAgainKey, obj.checked)
end
},
}
}

-- I do not know why this fails to bring the dark background to the front. Leave it.
--WG.Chobby.PriorityPopup(factionWindow, CancelFunc, CancelFunc)
WG.Chobby.PriorityPopup(superAnnounceWindow, CancelFunc, CancelFunc)
end

--------------------------------------------------------------------------------
Expand All @@ -165,7 +172,7 @@ function widget:Initialize()
end

function widget:Update()
WG.Delay(SteamCheckPopup, 2)
WG.Delay(SuperAnnouncePopup, 2)
widgetHandler:RemoveCallIn("Update")
end
--------------------------------------------------------------------------------
Expand Down