commit
13cf6e44ca
@ -1,7 +1,7 @@
|
||||
local Lobby = luiglobals.Lobby
|
||||
local MPLobbyOnline = LUI.mp_menus.MPLobbyOnline
|
||||
|
||||
function LeaveLobby(f5_arg0)
|
||||
function LeaveLobby()
|
||||
LeaveXboxLive()
|
||||
if Lobby.IsInPrivateParty() == false or Lobby.IsPrivatePartyHost() then
|
||||
LUI.FlowManager.RequestLeaveMenuByName("menu_xboxlive")
|
||||
@ -9,7 +9,7 @@ function LeaveLobby(f5_arg0)
|
||||
end
|
||||
end
|
||||
|
||||
function menu_xboxlive(f16_arg0, f16_arg1)
|
||||
function menu_xboxlive(f16_arg0)
|
||||
local menu = LUI.MPLobbyBase.new(f16_arg0, {
|
||||
menu_title = "@PLATFORM_UI_HEADER_PLAY_MP_CAPS",
|
||||
memberListState = Lobby.MemberListStates.Prelobby
|
||||
@ -17,7 +17,7 @@ function menu_xboxlive(f16_arg0, f16_arg1)
|
||||
|
||||
menu:setClass(LUI.MPLobbyOnline)
|
||||
|
||||
local serverListButton = menu:AddButton("@LUA_MENU_SERVERLIST", function(a1, a2)
|
||||
local serverListButton = menu:AddButton("@LUA_MENU_SERVERLIST", function(a1)
|
||||
LUI.FlowManager.RequestAddMenu(a1, "menu_systemlink_join", true, nil)
|
||||
end)
|
||||
serverListButton:setDisabledRefreshRate(500)
|
||||
@ -27,9 +27,7 @@ function menu_xboxlive(f16_arg0, f16_arg1)
|
||||
menu:AddPersonalizationButton()
|
||||
menu:AddDepotButton()
|
||||
|
||||
-- kinda a weird place to do this, but it's whatever
|
||||
-- add "MODS" button below depot button
|
||||
local modsButton = menu:AddButton("@MENU_MODS", function(a1, a2)
|
||||
menu:AddButton("@MENU_MODS", function(a1)
|
||||
LUI.FlowManager.RequestAddMenu(a1, "mods_menu", true, nil)
|
||||
end)
|
||||
end
|
||||
@ -58,6 +56,8 @@ function menu_xboxlive(f16_arg0, f16_arg1)
|
||||
menu:addElement(self)
|
||||
end
|
||||
|
||||
menu:AddMenuDescription(1)
|
||||
menu:AddMarketingPanel(LUI.MarketingLocation.Featured, LUI.ComScore.ScreenID.PlayOnline)
|
||||
menu.isSignInMenu = true
|
||||
menu:registerEventHandler("gain_focus", LUI.MPLobbyOnline.OnGainFocus)
|
||||
menu:registerEventHandler("player_joined", luiglobals.Cac.PlayerJoinedEvent)
|
||||
@ -81,6 +81,15 @@ function menu_xboxlive(f16_arg0, f16_arg1)
|
||||
end
|
||||
end)
|
||||
|
||||
menu:AddHelp({
|
||||
name = "add_button_helper_text",
|
||||
button_ref = "",
|
||||
helper_text = " ",
|
||||
side = "left",
|
||||
priority = -9000,
|
||||
clickable = false
|
||||
})
|
||||
|
||||
return menu
|
||||
end
|
||||
|
||||
|
37
src/client/component/motd.cpp
Normal file
37
src/client/component/motd.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include "materials.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
|
||||
#include <utils/http.hpp>
|
||||
|
||||
namespace motd
|
||||
{
|
||||
class component final : public component_interface
|
||||
{
|
||||
public:
|
||||
void post_load() override
|
||||
{
|
||||
std::thread([]
|
||||
{
|
||||
auto data = utils::http::get_data("https://h1.gg/data/motd.png");
|
||||
if (data.has_value())
|
||||
{
|
||||
materials::add("motd_image", data.value().buffer);
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
|
||||
void post_unpack() override
|
||||
{
|
||||
if (game::environment::is_sp())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
REGISTER_COMPONENT(motd::component)
|
@ -351,6 +351,9 @@ namespace patches
|
||||
dvars::override::register_float("cg_fovScale", 1.f, 0.1f, 2.f, game::DvarFlags::DVAR_FLAG_SAVED);
|
||||
dvars::override::register_float("cg_fovMin", 1.f, 1.0f, 90.f, game::DvarFlags::DVAR_FLAG_SAVED);
|
||||
|
||||
// Enable Marketing Comms
|
||||
dvars::override::register_int("marketing_active", 1, 1, 1, game::DVAR_FLAG_WRITE);
|
||||
|
||||
// Makes com_maxfps saved dvar
|
||||
dvars::override::register_int("com_maxfps", 0, 0, 1000, game::DVAR_FLAG_SAVED);
|
||||
|
||||
|
@ -237,4 +237,29 @@ namespace demonware
|
||||
buffer->read_string(&this->filename);
|
||||
}
|
||||
};
|
||||
|
||||
class bdMarketingMessage final : public bdTaskResult
|
||||
{
|
||||
public:
|
||||
uint64_t m_messageID;
|
||||
std::string m_languageCode;
|
||||
std::string m_content;
|
||||
std::string m_metadata;
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->write_uint64(this->m_messageID);
|
||||
buffer->write_string(this->m_languageCode);
|
||||
buffer->write_blob(this->m_content);
|
||||
buffer->write_blob(this->m_metadata);
|
||||
}
|
||||
|
||||
void deserialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->read_uint64(&this->m_messageID);
|
||||
buffer->read_string(&this->m_languageCode);
|
||||
buffer->read_blob(&this->m_content);
|
||||
buffer->read_blob(&this->m_metadata);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include <std_include.hpp>
|
||||
|
||||
#include <utils/http.hpp>
|
||||
#include "../services.hpp"
|
||||
|
||||
namespace demonware
|
||||
@ -7,12 +9,46 @@ namespace demonware
|
||||
{
|
||||
this->register_task(1, &bdMarketingComms::getMessages);
|
||||
this->register_task(4, &bdMarketingComms::reportFullMessagesViewed);
|
||||
this->register_task(5, &bdMarketingComms::getMessages_);
|
||||
}
|
||||
|
||||
void bdMarketingComms::getMessages(service_server* server, byte_buffer* /*buffer*/) const
|
||||
{
|
||||
// TODO:
|
||||
auto reply = server->create_reply(this->task_id());
|
||||
|
||||
const auto motd_content = utils::http::get_data("https://h1.gg/data/motd.json");
|
||||
if (motd_content.has_value())
|
||||
{
|
||||
const auto motd = new bdMarketingMessage;
|
||||
motd->m_messageID = 1;
|
||||
motd->m_languageCode = "en-US";
|
||||
motd->m_content = motd_content.value().buffer.data();
|
||||
motd->m_metadata = "{}";
|
||||
reply->add(motd);
|
||||
}
|
||||
|
||||
const auto featured_content = utils::http::get_data("https://h1.gg/data/featured.json");
|
||||
if (featured_content.has_value())
|
||||
{
|
||||
const auto featured = new bdMarketingMessage;
|
||||
featured->m_messageID = 2;
|
||||
featured->m_languageCode = "en-US";
|
||||
featured->m_content = featured_content.value().buffer.data();
|
||||
featured->m_metadata = "{}";
|
||||
reply->add(featured);
|
||||
}
|
||||
|
||||
const auto featured2_content = utils::http::get_data("https://h1.gg/data/featured2.json");
|
||||
if (featured2_content.has_value())
|
||||
{
|
||||
const auto featured2 = new bdMarketingMessage;
|
||||
featured2->m_messageID = 3;
|
||||
featured2->m_languageCode = "en-US";
|
||||
featured2->m_content = featured2_content.value().buffer.data();
|
||||
featured2->m_metadata = "{}";
|
||||
reply->add(featured2);
|
||||
}
|
||||
|
||||
reply->send();
|
||||
}
|
||||
|
||||
@ -22,4 +58,11 @@ namespace demonware
|
||||
auto reply = server->create_reply(this->task_id());
|
||||
reply->send();
|
||||
}
|
||||
|
||||
void bdMarketingComms::getMessages_(service_server* server, byte_buffer* /*buffer*/) const
|
||||
{
|
||||
// TODO:
|
||||
auto reply = server->create_reply(this->task_id());
|
||||
reply->send();
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,6 @@ namespace demonware
|
||||
private:
|
||||
void getMessages(service_server* server, byte_buffer* buffer) const;
|
||||
void reportFullMessagesViewed(service_server* server, byte_buffer* buffer) const;
|
||||
void getMessages_(service_server* server, byte_buffer* buffer) const;
|
||||
};
|
||||
}
|
||||
|
@ -4993,14 +4993,19 @@ namespace dvars
|
||||
},
|
||||
{
|
||||
"marketing_active",
|
||||
"Are we allowed to enable Marketing Comms or not",
|
||||
"Enable/Disable Marketing Comms",
|
||||
generate_hash("marketing_active")
|
||||
},
|
||||
{
|
||||
"marketing_refresh_time",
|
||||
"time in seconds to wait before refreshing marketing messages from demonware",
|
||||
"Time in seconds to wait before refreshing marketing messages from demonware",
|
||||
generate_hash("marketing_refresh_time")
|
||||
},
|
||||
{
|
||||
"marketing_motd_once_per_day",
|
||||
"Display motd once per day",
|
||||
generate_hash("marketing_motd_once_per_day")
|
||||
},
|
||||
{
|
||||
"matchdata_active",
|
||||
"Are match data uploads enabled",
|
||||
|
Loading…
Reference in New Issue
Block a user