mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
refactor: route IPlatformGame and Leaderboard call sites through platform/
This commit is contained in:
parent
fbfccdeac6
commit
9c502ce8fc
|
|
@ -1,7 +1,7 @@
|
||||||
[wrap-git]
|
[wrap-git]
|
||||||
url = https://github.com/simdutf/simdutf.git
|
url = https://github.com/simdutf/simdutf.git
|
||||||
depth = 1
|
depth = 1
|
||||||
revision = v8.2.0
|
revision = fd476229424b40ae71a58dd5a205795c3d76b5f1
|
||||||
patch_directory = simdutf
|
patch_directory = simdutf
|
||||||
|
|
||||||
[provide]
|
[provide]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "app/common/Audio/SoundEngine.h"
|
#include "app/common/Audio/SoundEngine.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
#include "app/common/DLC/DLCManager.h"
|
#include "app/common/DLC/DLCManager.h"
|
||||||
#include "app/common/Game.h"
|
#include "app/common/Game.h"
|
||||||
#include "app/common/GameRules/GameRuleManager.h"
|
#include "app/common/GameRules/GameRuleManager.h"
|
||||||
|
|
@ -454,13 +455,13 @@ void Game::HandleXuiActions(void) {
|
||||||
for (int j = 0; j < XUSER_MAX_COUNT; j++) {
|
for (int j = 0; j < XUSER_MAX_COUNT; j++) {
|
||||||
if (pMinecraft->localplayers[j]) {
|
if (pMinecraft->localplayers[j]) {
|
||||||
if (g_NetworkManager.IsLocalGame()) {
|
if (g_NetworkManager.IsLocalGame()) {
|
||||||
app.SetRichPresenceContext(
|
PlatformGame.SetRichPresenceContext(
|
||||||
j, CONTEXT_GAME_STATE_BLANK);
|
j, CONTEXT_GAME_STATE_BLANK);
|
||||||
PlatformProfile.SetCurrentGameActivity(
|
PlatformProfile.SetCurrentGameActivity(
|
||||||
j, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,
|
j, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,
|
||||||
false);
|
false);
|
||||||
} else {
|
} else {
|
||||||
app.SetRichPresenceContext(
|
PlatformGame.SetRichPresenceContext(
|
||||||
j, CONTEXT_GAME_STATE_BLANK);
|
j, CONTEXT_GAME_STATE_BLANK);
|
||||||
PlatformProfile.SetCurrentGameActivity(
|
PlatformProfile.SetCurrentGameActivity(
|
||||||
j, CONTEXT_PRESENCE_MULTIPLAYER, false);
|
j, CONTEXT_PRESENCE_MULTIPLAYER, false);
|
||||||
|
|
@ -468,7 +469,7 @@ void Game::HandleXuiActions(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
app.SetRichPresenceContext(i, CONTEXT_GAME_STATE_BLANK);
|
PlatformGame.SetRichPresenceContext(i, CONTEXT_GAME_STATE_BLANK);
|
||||||
if (g_NetworkManager.IsLocalGame()) {
|
if (g_NetworkManager.IsLocalGame()) {
|
||||||
PlatformProfile.SetCurrentGameActivity(
|
PlatformProfile.SetCurrentGameActivity(
|
||||||
i, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,
|
i, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "GameNetworkManager.h"
|
#include "GameNetworkManager.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
@ -349,7 +350,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||||
createdConnections.push_back(connection);
|
createdConnections.push_back(connection);
|
||||||
|
|
||||||
int primaryPad = PlatformProfile.GetPrimaryPad();
|
int primaryPad = PlatformProfile.GetPrimaryPad();
|
||||||
app.SetRichPresenceContext(primaryPad, CONTEXT_GAME_STATE_BLANK);
|
PlatformGame.SetRichPresenceContext(primaryPad, CONTEXT_GAME_STATE_BLANK);
|
||||||
if (GetPlayerCount() >
|
if (GetPlayerCount() >
|
||||||
1) // Are we offline or online, and how many players are there
|
1) // Are we offline or online, and how many players are there
|
||||||
{
|
{
|
||||||
|
|
@ -451,7 +452,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||||
if (g_NetworkManager.IsLeavingGame() || !IsInSession()) break;
|
if (g_NetworkManager.IsLeavingGame() || !IsInSession()) break;
|
||||||
|
|
||||||
if (PlatformProfile.IsSignedIn(idx) && !connection->isClosed()) {
|
if (PlatformProfile.IsSignedIn(idx) && !connection->isClosed()) {
|
||||||
app.SetRichPresenceContext(idx, CONTEXT_GAME_STATE_BLANK);
|
PlatformGame.SetRichPresenceContext(idx, CONTEXT_GAME_STATE_BLANK);
|
||||||
if (IsLocalGame())
|
if (IsLocalGame())
|
||||||
PlatformProfile.SetCurrentGameActivity(
|
PlatformProfile.SetCurrentGameActivity(
|
||||||
idx, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false);
|
idx, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false);
|
||||||
|
|
@ -1221,7 +1222,7 @@ void CGameNetworkManager::PlayerJoining(INetworkPlayer* pNetworkPlayer) {
|
||||||
g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
||||||
if (pNetworkPlayer == nullptr) continue;
|
if (pNetworkPlayer == nullptr) continue;
|
||||||
|
|
||||||
app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BLANK);
|
PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BLANK);
|
||||||
if (multiplayer) {
|
if (multiplayer) {
|
||||||
if (localgame)
|
if (localgame)
|
||||||
PlatformProfile.SetCurrentGameActivity(
|
PlatformProfile.SetCurrentGameActivity(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
#include "UIScene_MainMenu.h"
|
#include "UIScene_MainMenu.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
@ -769,7 +770,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) {
|
||||||
// clear the remembered signed in users so their profiles get read again
|
// clear the remembered signed in users so their profiles get read again
|
||||||
app.ClearSignInChangeUsersMask();
|
app.ClearSignInChangeUsersMask();
|
||||||
|
|
||||||
app.ReleaseSaveThumbnail();
|
PlatformGame.ReleaseSaveThumbnail();
|
||||||
|
|
||||||
if (PlatformProfile.IsGuest(iPad)) {
|
if (PlatformProfile.IsGuest(iPad)) {
|
||||||
unsigned int uiIDA[1];
|
unsigned int uiIDA[1];
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
#include "UIScene_AnvilMenu.h"
|
#include "UIScene_AnvilMenu.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
@ -92,7 +93,7 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void* _initData,
|
||||||
|
|
||||||
setIgnoreInput(false);
|
setIgnoreInput(false);
|
||||||
|
|
||||||
app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_ANVIL);
|
PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_ANVIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UIScene_AnvilMenu::getMoviePath() {
|
std::string UIScene_AnvilMenu::getMoviePath() {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "UIScene_BeaconMenu.h"
|
#include "UIScene_BeaconMenu.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
@ -61,7 +62,7 @@ UIScene_BeaconMenu::UIScene_BeaconMenu(int iPad, void* _initData,
|
||||||
|
|
||||||
m_slotListActivatorIcons.addSlots(m_menu->getSize(), 4);
|
m_slotListActivatorIcons.addSlots(m_menu->getSize(), 4);
|
||||||
|
|
||||||
// app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_BEACON);
|
// PlatformGame.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_BEACON);
|
||||||
|
|
||||||
delete initData;
|
delete initData;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "UIScene_BrewingStandMenu.h"
|
#include "UIScene_BrewingStandMenu.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
@ -61,7 +62,7 @@ UIScene_BrewingStandMenu::UIScene_BrewingStandMenu(int iPad, void* _initData,
|
||||||
|
|
||||||
if (initData) delete initData;
|
if (initData) delete initData;
|
||||||
|
|
||||||
app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BREWING);
|
PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BREWING);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UIScene_BrewingStandMenu::getMoviePath() {
|
std::string UIScene_BrewingStandMenu::getMoviePath() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
#include "UIScene_EnchantingMenu.h"
|
#include "UIScene_EnchantingMenu.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
@ -55,7 +56,7 @@ UIScene_EnchantingMenu::UIScene_EnchantingMenu(int iPad, void* _initData,
|
||||||
|
|
||||||
m_slotListIngredient.addSlots(EnchantmentMenu::INGREDIENT_SLOT, 1);
|
m_slotListIngredient.addSlots(EnchantmentMenu::INGREDIENT_SLOT, 1);
|
||||||
|
|
||||||
app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_ENCHANTING);
|
PlatformGame.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_ENCHANTING);
|
||||||
|
|
||||||
delete initData;
|
delete initData;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
#include "UIScene_FurnaceMenu.h"
|
#include "UIScene_FurnaceMenu.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
@ -53,7 +54,7 @@ UIScene_FurnaceMenu::UIScene_FurnaceMenu(int iPad, void* _initData,
|
||||||
m_slotListIngredient.addSlots(FurnaceMenu::INGREDIENT_SLOT, 1);
|
m_slotListIngredient.addSlots(FurnaceMenu::INGREDIENT_SLOT, 1);
|
||||||
m_slotListResult.addSlots(FurnaceMenu::RESULT_SLOT, 1);
|
m_slotListResult.addSlots(FurnaceMenu::RESULT_SLOT, 1);
|
||||||
|
|
||||||
app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FORGING);
|
PlatformGame.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FORGING);
|
||||||
|
|
||||||
delete initData;
|
delete initData;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "UIScene_HorseInventoryMenu.h"
|
#include "UIScene_HorseInventoryMenu.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
@ -77,7 +78,7 @@ UIScene_HorseInventoryMenu::UIScene_HorseInventoryMenu(int iPad,
|
||||||
|
|
||||||
setIgnoreInput(false);
|
setIgnoreInput(false);
|
||||||
|
|
||||||
// app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_HORSE);
|
// PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_HORSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UIScene_HorseInventoryMenu::getMoviePath() {
|
std::string UIScene_HorseInventoryMenu::getMoviePath() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
#include "UIScene_TradingMenu.h"
|
#include "UIScene_TradingMenu.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
@ -83,7 +84,7 @@ UIScene_TradingMenu::UIScene_TradingMenu(int iPad, void* _initData,
|
||||||
ui.OverrideSFX(m_iPad, ACTION_MENU_UP, true);
|
ui.OverrideSFX(m_iPad, ACTION_MENU_UP, true);
|
||||||
ui.OverrideSFX(m_iPad, ACTION_MENU_DOWN, true);
|
ui.OverrideSFX(m_iPad, ACTION_MENU_DOWN, true);
|
||||||
|
|
||||||
app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_TRADING);
|
PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_TRADING);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UIScene_TradingMenu::getMoviePath() {
|
std::string UIScene_TradingMenu::getMoviePath() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
#include "UIScene_CraftingMenu.h"
|
#include "UIScene_CraftingMenu.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
|
|
||||||
#include "app/common/Tutorial/Tutorial.h"
|
#include "app/common/Tutorial/Tutorial.h"
|
||||||
#include "app/common/Tutorial/TutorialEnum.h"
|
#include "app/common/Tutorial/TutorialEnum.h"
|
||||||
|
|
@ -118,7 +119,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void* _initData,
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CRAFTING);
|
PlatformGame.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CRAFTING);
|
||||||
setGroupText(GetGroupNameText(m_pGroupA[m_iGroupIndex]));
|
setGroupText(GetGroupNameText(m_pGroupA[m_iGroupIndex]));
|
||||||
|
|
||||||
// Update the tutorial state
|
// Update the tutorial state
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "LinuxGame.h"
|
#include "LinuxGame.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
@ -51,7 +52,7 @@ void LinuxGame::TemporaryCreateGameStart() {
|
||||||
|
|
||||||
// From CScene_Main::RunPlayGame
|
// From CScene_Main::RunPlayGame
|
||||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
app.ReleaseSaveThumbnail();
|
PlatformGame.ReleaseSaveThumbnail();
|
||||||
PlatformProfile.SetLockedProfile(0);
|
PlatformProfile.SetLockedProfile(0);
|
||||||
pMinecraft->user->name = "Windows";
|
pMinecraft->user->name = "Windows";
|
||||||
app.ApplyGameSettingsChanged(0);
|
app.ApplyGameSettingsChanged(0);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
#include "WindowsGame.h"
|
#include "WindowsGame.h"
|
||||||
|
#include "platform/game/game.h"
|
||||||
#include "app/common/Game.h"
|
#include "app/common/Game.h"
|
||||||
#include "minecraft/client/Minecraft.h"
|
#include "minecraft/client/Minecraft.h"
|
||||||
#include "minecraft/client/User.h"
|
#include "minecraft/client/User.h"
|
||||||
|
|
@ -42,7 +43,7 @@ void WindowsGame::TemporaryCreateGameStart() {
|
||||||
|
|
||||||
// From CScene_Main::RunPlayGame
|
// From CScene_Main::RunPlayGame
|
||||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
app.ReleaseSaveThumbnail();
|
PlatformGame.ReleaseSaveThumbnail();
|
||||||
PlatformProfile.SetLockedProfile(0);
|
PlatformProfile.SetLockedProfile(0);
|
||||||
pMinecraft->user->name = "Windows";
|
pMinecraft->user->name = "Windows";
|
||||||
app.ApplyGameSettingsChanged(0);
|
app.ApplyGameSettingsChanged(0);
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "app/common/App_structs.h"
|
#include "app/common/App_structs.h"
|
||||||
#include "app/common/Leaderboards/LeaderboardManager.h"
|
|
||||||
#include "app/linux/LinuxGame.h"
|
#include "app/linux/LinuxGame.h"
|
||||||
|
#include "platform/leaderboard/leaderboard.h"
|
||||||
#include "minecraft/stats/Achievement.h"
|
#include "minecraft/stats/Achievement.h"
|
||||||
#include "minecraft/stats/Achievements.h"
|
#include "minecraft/stats/Achievements.h"
|
||||||
#include "minecraft/stats/GenericStats.h"
|
#include "minecraft/stats/GenericStats.h"
|
||||||
|
|
@ -248,9 +248,9 @@ void StatsCounter::save(int player, bool force) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatsCounter::flushLeaderboards() {
|
void StatsCounter::flushLeaderboards() {
|
||||||
if (LeaderboardManager::Instance()->OpenSession()) {
|
if (PlatformLeaderboard.OpenSession()) {
|
||||||
writeStats();
|
writeStats();
|
||||||
LeaderboardManager::Instance()->FlushStats();
|
PlatformLeaderboard.FlushStats();
|
||||||
} else {
|
} else {
|
||||||
Log::info(
|
Log::info(
|
||||||
"Failed to open a session in order to write to leaderboard\n");
|
"Failed to open a session in order to write to leaderboard\n");
|
||||||
|
|
@ -264,9 +264,9 @@ void StatsCounter::flushLeaderboards() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatsCounter::saveLeaderboards() {
|
void StatsCounter::saveLeaderboards() {
|
||||||
if (LeaderboardManager::Instance()->OpenSession()) {
|
if (PlatformLeaderboard.OpenSession()) {
|
||||||
writeStats();
|
writeStats();
|
||||||
LeaderboardManager::Instance()->CloseSession();
|
PlatformLeaderboard.CloseSession();
|
||||||
} else {
|
} else {
|
||||||
Log::info(
|
Log::info(
|
||||||
"Failed to open a session in order to write to leaderboard\n");
|
"Failed to open a session in order to write to leaderboard\n");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue