mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-12-24 09:24:15 +08:00
allow copying own id and a friend's ID
This commit is contained in:
parent
9eee49d6af
commit
b8e305bc41
@ -96,6 +96,98 @@ const char translationChat[TRANSLATION_NUMBER_OF_LANGUAGES][TRANSLATION_BUFFER_S
|
||||
"Razgovor"
|
||||
};
|
||||
|
||||
const char translationCopyId[TRANSLATION_NUMBER_OF_LANGUAGES][TRANSLATION_BUFFER_SIZE] = {
|
||||
// 0 - English
|
||||
"Copy ID",
|
||||
|
||||
// 1 - Arabic
|
||||
"Copy ID",
|
||||
|
||||
// 2 - Bulgarian
|
||||
"Copy ID",
|
||||
|
||||
// 3 - Simplified Chinese
|
||||
"Copy ID",
|
||||
|
||||
// 4 - Traditional Chinese
|
||||
"Copy ID",
|
||||
|
||||
// 5 - Czech
|
||||
"Copy ID",
|
||||
|
||||
// 6 - Danish
|
||||
"Copy ID",
|
||||
|
||||
// 7 - Dutch
|
||||
"Copy ID",
|
||||
|
||||
// 8 - Finnish
|
||||
"Copy ID",
|
||||
|
||||
// 9 - French
|
||||
"Copy ID",
|
||||
|
||||
// 10 - German
|
||||
"Copy ID",
|
||||
|
||||
// 11 - Greek
|
||||
"Copy ID",
|
||||
|
||||
// 12 - Hungarian
|
||||
"Copy ID",
|
||||
|
||||
// 13 - Italian
|
||||
"Copy ID",
|
||||
|
||||
// 14 - Japanese
|
||||
"Copy ID",
|
||||
|
||||
// 15 - Korean
|
||||
"Copy ID",
|
||||
|
||||
// 16 - Norwegian
|
||||
"Copy ID",
|
||||
|
||||
// 17 - Polish
|
||||
"Copy ID",
|
||||
|
||||
// 18 - Portuguese
|
||||
"Copy ID",
|
||||
|
||||
// 19 - Brazilian Portuguese
|
||||
"Copy ID",
|
||||
|
||||
// 20 - Romanian
|
||||
"Copy ID",
|
||||
|
||||
// 21 - Russian
|
||||
"Copy ID",
|
||||
|
||||
// 22 - Spanish
|
||||
"Copy ID",
|
||||
|
||||
// 23 - Latin American
|
||||
"Copy ID",
|
||||
|
||||
// 24 - Swedish
|
||||
"Copy ID",
|
||||
|
||||
// 25 - Thai
|
||||
"Copy ID",
|
||||
|
||||
// 26 - Turkish
|
||||
"Copy ID",
|
||||
|
||||
// 27 - Ukrainian
|
||||
"Copy ID",
|
||||
|
||||
// 28 - Vietnamese
|
||||
"Copy ID",
|
||||
|
||||
// 29 - Croatian
|
||||
"Copy ID",
|
||||
};
|
||||
|
||||
// C:\Program Files (x86)\Steam\tenfoot\resource\localization\tenfoot_*.txt
|
||||
// Friends_ProfileDetails_Action_InviteToGame
|
||||
const char translationInvite[TRANSLATION_NUMBER_OF_LANGUAGES][TRANSLATION_BUFFER_SIZE] = {
|
||||
|
@ -587,26 +587,28 @@ bool Steam_Overlay::IHaveLobby()
|
||||
|
||||
void Steam_Overlay::BuildContextMenu(Friend const& frd, friend_window_state& state)
|
||||
{
|
||||
if (ImGui::BeginPopupContextItem("Friends_ContextMenu", 1))
|
||||
{
|
||||
if (ImGui::BeginPopupContextItem("Friends_ContextMenu", 1)) {
|
||||
// this is set to true if any button was clicked
|
||||
// otherwise, after clicking any button, the menu will be persistent
|
||||
bool close_popup = false;
|
||||
|
||||
// user clicked on "chat"
|
||||
if (ImGui::Button(translationChat[current_language]))
|
||||
{
|
||||
if (ImGui::Button(translationChat[current_language])) {
|
||||
close_popup = true;
|
||||
state.window_state |= window_state_show;
|
||||
}
|
||||
// user clicked on "copy id" on a friend
|
||||
if (ImGui::Button(translationCopyId[current_language])) {
|
||||
close_popup = true;
|
||||
auto friend_id_str = std::to_string(frd.id());
|
||||
ImGui::SetClipboardText(friend_id_str.c_str());
|
||||
}
|
||||
// If we have the same appid, activate the invite/join buttons
|
||||
if (settings->get_local_game_id().AppID() == frd.appid())
|
||||
{
|
||||
if (settings->get_local_game_id().AppID() == frd.appid()) {
|
||||
// user clicked on "invite to game"
|
||||
std::string translationInvite_tmp(translationInvite[current_language]);
|
||||
translationInvite_tmp.append("##PopupInviteToGame");
|
||||
if (i_have_lobby && ImGui::Button(translationInvite_tmp.c_str()))
|
||||
{
|
||||
if (i_have_lobby && ImGui::Button(translationInvite_tmp.c_str())) {
|
||||
close_popup = true;
|
||||
state.window_state |= window_state_invite;
|
||||
has_friend_action.push(frd);
|
||||
@ -616,8 +618,7 @@ void Steam_Overlay::BuildContextMenu(Friend const& frd, friend_window_state& sta
|
||||
std::string translationJoin_tmp(translationJoin[current_language]);
|
||||
translationJoin_tmp.append("##PopupAcceptInvite");
|
||||
|
||||
if (state.joinable && ImGui::Button(translationJoin_tmp.c_str()))
|
||||
{
|
||||
if (state.joinable && ImGui::Button(translationJoin_tmp.c_str())) {
|
||||
close_popup = true;
|
||||
// don't bother adding this friend if the button "invite all" was clicked
|
||||
// we will send them the invitation later in Steam_Overlay::RunCallbacks()
|
||||
@ -628,8 +629,7 @@ void Steam_Overlay::BuildContextMenu(Friend const& frd, friend_window_state& sta
|
||||
}
|
||||
}
|
||||
|
||||
if (close_popup || invite_all_friends_clicked)
|
||||
{
|
||||
if (close_popup || invite_all_friends_clicked) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
@ -705,13 +705,17 @@ void Steam_Overlay::BuildFriendWindow(Friend const& frd, friend_window_state& st
|
||||
ImGuiStyle &style = ImGui::GetStyle();
|
||||
wnd_width -= ImGui::CalcTextSize(translationSend[current_language]).x + style.FramePadding.x * 2 + style.ItemSpacing.x + 1;
|
||||
|
||||
uint64_t frd_id = frd.id();
|
||||
ImGui::PushID((const char *)&frd_id, (const char *)&frd_id + sizeof(frd_id));
|
||||
ImGui::PushItemWidth(wnd_width);
|
||||
|
||||
if (ImGui::InputText("##chat_line", state.chat_input, max_chat_len, ImGuiInputTextFlags_EnterReturnsTrue))
|
||||
{
|
||||
send_chat_msg = true;
|
||||
ImGui::SetKeyboardFocusHere(-1);
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::PopID();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
@ -1053,8 +1057,8 @@ void Steam_Overlay::OverlayProc()
|
||||
settings->get_local_name(),
|
||||
settings->get_local_steam_id().ConvertToUint64(),
|
||||
settings->get_local_game_id().AppID());
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button(translationShowAchievements[current_language])) {
|
||||
show_achievements = true;
|
||||
@ -1064,6 +1068,14 @@ void Steam_Overlay::OverlayProc()
|
||||
if (ImGui::Button(translationSettings[current_language])) {
|
||||
show_settings = true;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
// user clicked on "copy id" on themselves
|
||||
if (ImGui::Button(translationCopyId[current_language])) {
|
||||
auto friend_id_str = std::to_string(settings->get_local_steam_id().ConvertToUint64());
|
||||
ImGui::SetClipboardText(friend_id_str.c_str());
|
||||
}
|
||||
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Spacing();
|
||||
|
Loading…
x
Reference in New Issue
Block a user