Add
This commit is contained in:
1 parent
3c154f858d
commit
b32e298a18
98 files changed
+39416
-1625
No files matched your search
@@ -70,12 +70,61 @@ void UIComponent_PressStartToPlay::handleReload()
|
||||
m_controlPressStartPanel.setVisible(showPressStart);
|
||||
}
|
||||
|
||||
void UIComponent_PressStartToPlay::ShowAchievementToast(string achievementName, string achievementDescription, string achT)
|
||||
{
|
||||
/*IggyStringUTF8 stringVal;
|
||||
stringVal.string = (char*)label.c_str();
|
||||
stringVal.length = static_cast<S32>(label.length());
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[0].string8 = stringVal;*/
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
|
||||
IggyStringUTF8 stringVal1;
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
stringVal1.string = (char*)achievementName.c_str();
|
||||
stringVal1.length = static_cast<S32>(achievementName.length());
|
||||
value[0].string8 = stringVal1;
|
||||
|
||||
IggyStringUTF8 stringVal2;
|
||||
stringVal2.string = (char*)achievementDescription.c_str();
|
||||
stringVal2.length = static_cast<S32>(achievementDescription.length());
|
||||
value[1].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[1].string8 = stringVal2;
|
||||
|
||||
IggyStringUTF8 stringVal3;
|
||||
stringVal3.string = (char*)achT.c_str();
|
||||
stringVal3.length = static_cast<S32>(achT.length()+3);
|
||||
value[2].type = IGGY_DATATYPE_string_UTF8;
|
||||
value[2].string8 = stringVal3;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcShowAchToast, 3, value);
|
||||
|
||||
addTimer(1, 5000);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void UIComponent_PressStartToPlay::HideAchievementToast()
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcHideAchToast, 0, nullptr);
|
||||
|
||||
Minecraft::GetInstance()->achID = 0;
|
||||
}
|
||||
|
||||
void UIComponent_PressStartToPlay::handleTimerComplete(int id)
|
||||
{
|
||||
m_controlPressStartPanel.setVisible(false);
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||
{
|
||||
m_showingPressStart[i] = false;
|
||||
if (id == 1) {
|
||||
HideAchievementToast();
|
||||
killTimer(id);
|
||||
ui.toastOn = false;
|
||||
}
|
||||
}
|
||||
ui.ClearPressStart();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "UIScene.h"
|
||||
#include "UIControl_Label.h"
|
||||
|
||||
|
||||
class UIComponent_PressStartToPlay : public UIScene
|
||||
{
|
||||
@@ -15,7 +17,7 @@ private:
|
||||
protected:
|
||||
UIControl_Label m_labelTrialTimer, m_labelPressStart, m_playerDisplayName;
|
||||
UIControl m_controlSaveIcon, m_controlPressStartPanel;
|
||||
IggyName m_funcShowController;
|
||||
IggyName m_funcShowController, m_funcShowAchToast, m_funcHideAchToast;
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT(m_labelTrialTimer, "TrialTimer")
|
||||
UI_MAP_ELEMENT(m_controlSaveIcon, "SaveIcon")
|
||||
@@ -26,6 +28,8 @@ protected:
|
||||
UI_END_MAP_CHILD_ELEMENTS()
|
||||
|
||||
UI_MAP_NAME(m_funcShowController, L"ShowController");
|
||||
UI_MAP_NAME(m_funcShowAchToast, L"ShowAchievementToast");
|
||||
UI_MAP_NAME(m_funcHideAchToast, L"HideAchievementToast");
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
public:
|
||||
@@ -47,6 +51,9 @@ public:
|
||||
// Returns true if lower scenes in this scenes layer, or in any layer below this scenes layers should be hidden
|
||||
virtual bool hidesLowerScenes() { return false; }
|
||||
|
||||
void ShowAchievementToast(string achievementName, string achievementDescription, string achT = "");
|
||||
void HideAchievementToast();
|
||||
|
||||
virtual void handleReload();
|
||||
virtual void handleTimerComplete(int id);
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
eTexturePackList,
|
||||
eBitmapIcon,
|
||||
eTouchControl,
|
||||
eAchievementList,
|
||||
};
|
||||
protected:
|
||||
eUIControlType m_eControlType;
|
||||
@@ -63,7 +64,7 @@ public:
|
||||
UIControl();
|
||||
|
||||
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
|
||||
void UpdateControl();
|
||||
virtual void UpdateControl();
|
||||
void setHidden(bool bHidden) {m_bHidden=bHidden;}
|
||||
bool getHidden(void) {return m_bHidden;}
|
||||
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
#include "UIControl_AchievementsList.h"
|
||||
#include "stdafx.h"
|
||||
#include "UI.h"
|
||||
#include "../../../Minecraft.World/JavaMath.h"
|
||||
|
||||
UIControl_AchievementsList::UIControl_AchievementsList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UIControl_AchievementsList::init(int id)
|
||||
{
|
||||
m_id = id;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_initFunc, 1, value);
|
||||
|
||||
//Hardcoded from SWF since it techinically won't ever change, and getting the x and y just doesnt work through the intended way
|
||||
m_x = 221;
|
||||
m_y = 204;
|
||||
}
|
||||
|
||||
void UIControl_AchievementsList::setCurrentSelection(int iSelection)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iSelection;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcHighlightItem, 1, value);
|
||||
}
|
||||
|
||||
bool UIControl_AchievementsList::setupControl(UIScene* scene, IggyValuePath* parent, const string& controlName)
|
||||
{
|
||||
UIControl::setControlType(UIControl::eAchievementList);
|
||||
bool success = UIControl_Base::setupControl(scene, parent, controlName);
|
||||
|
||||
//Label specific initialisers
|
||||
m_funcAddNewItem = registerFastName(L"addNewItem");
|
||||
m_funcHighlightItem = registerFastName(L"HighlightItem");
|
||||
m_funcSetTouchFocus = registerFastName(L"SetTouchFocus");
|
||||
m_funcEnableButton = registerFastName(L"EnableButton");
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_AchievementsList::UpdateControl()
|
||||
{
|
||||
F64 fwidth, fheight;
|
||||
IggyValueGetF64RS(getIggyValuePath(), m_nameWidth, nullptr, &fwidth);
|
||||
IggyValueGetF64RS(getIggyValuePath(), m_nameHeight, nullptr, &fheight);
|
||||
m_width = static_cast<S32>(Math::round(fwidth));
|
||||
m_height = static_cast<S32>(Math::round(fheight));
|
||||
}
|
||||
|
||||
void UIControl_AchievementsList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = iX;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = iY;
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = bRepeat;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetTouchFocus, 3, value);
|
||||
}
|
||||
|
||||
void UIControl_AchievementsList::addnewItem(int id, wstring textureName)
|
||||
{
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
value[1].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
stringVal.string = (IggyUTF16*)textureName.c_str();
|
||||
stringVal.length = textureName.length();
|
||||
value[1].string16 = stringVal;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcAddNewItem, 2, value);
|
||||
|
||||
++m_itemCount;
|
||||
}
|
||||
|
||||
void UIControl_AchievementsList::EnableButton(int id, bool bEnable) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = id;
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = bEnable;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcEnableButton, 2, value);
|
||||
}
|
||||
|
||||
void UIControl_AchievementsList::updateChildFocus(int iChild)
|
||||
{
|
||||
m_iCurrentSelection = iChild;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_AchievementsList : public UIControl_Base
|
||||
{
|
||||
private:
|
||||
IggyName m_funcAddNewItem, m_funcHighlightItem, m_funcSetTouchFocus, m_funcEnableButton;
|
||||
|
||||
public:
|
||||
UIControl_AchievementsList();
|
||||
void init(int id);
|
||||
int m_itemCount;
|
||||
int m_iCurrentSelection = 0;
|
||||
void SetTouchFocus(S32 iX, S32 iY, bool bRepeat);
|
||||
void UpdateControl();
|
||||
void EnableButton(int id, bool bEnable);
|
||||
void updateChildFocus(int iChild);
|
||||
void setCurrentSelection(int iSelection);
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent, const string& controlName);
|
||||
void UIControl_AchievementsList::addnewItem(int id, wstring textureName);
|
||||
//virtual void ReInit();
|
||||
};
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "UIScene.h"
|
||||
#include "UIControl_Slider.h"
|
||||
#include "UIControl_TexturePackList.h"
|
||||
#include "UIControl_AchievementsList.h"
|
||||
#include "UIScene_AchievementsMenu.h"
|
||||
#include "../../../Minecraft.World/StringHelpers.h"
|
||||
#include "../../LocalPlayer.h"
|
||||
#include "../../DLCTexturePack.h"
|
||||
@@ -590,6 +592,8 @@ void UIController::loadSkins()
|
||||
m_iggyLibraries[eLibrary_HUD] = loadSkin(L"skinHDHud.swf", L"skinHDHud.swf");
|
||||
m_iggyLibraries[eLibrary_Tooltips] = loadSkin(L"skinHDTooltips.swf", L"skinHDTooltips.swf");
|
||||
m_iggyLibraries[eLibrary_Default] = loadSkin(L"skinHD.swf", L"skinHD.swf");
|
||||
m_iggyLibraries[eLibrary_LCDefault] = loadSkin(L"skinLC.swf", L"skinLC.swf");
|
||||
m_iggyLibraries[eLibrary_LCInGame] = loadSkin(L"skinInGameLC.swf", L"skinInGameLC.swf");
|
||||
|
||||
#elif defined _DURANGO
|
||||
m_iggyLibraries[eLibrary_Platform] = loadSkin(L"skinHDDurango.swf", L"platformskinHD.swf");
|
||||
@@ -934,7 +938,7 @@ void UIController::tickInput()
|
||||
UIControl::eUIControlType type = ctrl->getControlType();
|
||||
if (type != UIControl::eButton && type != UIControl::eTextInput &&
|
||||
type != UIControl::eCheckBox && type != UIControl::eSlider &&
|
||||
type != UIControl::eButtonList && type != UIControl::eTexturePackList)
|
||||
type != UIControl::eButtonList && type != UIControl::eAchievementList)
|
||||
continue;
|
||||
|
||||
// If the scene has an active panel (e.g. tab menus),
|
||||
@@ -967,6 +971,18 @@ void UIController::tickInput()
|
||||
hitArea = INT_MAX;
|
||||
hitCtrl = NULL;
|
||||
break; // ButtonList takes priority
|
||||
}
|
||||
if (type == UIControl::eAchievementList)
|
||||
{
|
||||
auto t = (UIScene_AchievementsMenu*)pScene;
|
||||
static_cast<UIControl_AchievementsList*>(ctrl)->SetTouchFocus(
|
||||
static_cast<S32>(sceneMouseX - cx), static_cast<S32>(sceneMouseY - cy), false);
|
||||
/*static_cast<UIControl_AchievementsList*>(ctrl)->SetTouchFocus(
|
||||
static_cast<S32>(t->aX), static_cast<S32>(t->aY), false);*/
|
||||
hitControlId = -1;
|
||||
hitArea = INT_MAX;
|
||||
hitCtrl = NULL;
|
||||
break;
|
||||
}
|
||||
if (type == UIControl::eTexturePackList)
|
||||
{
|
||||
@@ -1839,7 +1855,9 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void *
|
||||
image.preMultiplyAlpha();
|
||||
Textures *t = Minecraft::GetInstance()->textures;
|
||||
int id = t->getTexture(&image,C4JRender::TEXTURE_FORMAT_RxGyBzAw,false);
|
||||
std::string result(texture_name, texture_name + wcslen(texture_name));
|
||||
|
||||
bool isSub = result.find("sub") != std::string::npos;
|
||||
// 4J Stu - All our flash controls that allow replacing textures use a special 64x64 symbol
|
||||
// Force this size here so that our images don't get scaled wildly
|
||||
#if (defined __ORBIS__ || defined _DURANGO )
|
||||
@@ -1853,10 +1871,12 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void *
|
||||
#if defined _WINDOWS64
|
||||
// Only set the size to 96x96 for 1080p on Windows
|
||||
UIScene *scene = uiController->GetTopScene(0);
|
||||
if (scene->getSceneResolution() == UIScene::eSceneResolution_1080)
|
||||
{
|
||||
*width = 96;
|
||||
*height = 96;
|
||||
if (scene) {
|
||||
if (scene->getSceneResolution() == UIScene::eSceneResolution_1080 && (scene->getSceneType() != eUIScene_PauseMenu && scene->getSceneType() != eUIScene_MainMenu && scene->getSceneType() != eUIScene_AchievementsMenu) && isSub == false)
|
||||
{
|
||||
*width = 96;
|
||||
*height = 96;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2943,6 +2963,16 @@ void UIController::HidePressStart()
|
||||
if(m_groups[static_cast<int>(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast<int>(eUIGroup_Fullscreen)]->getPressStartToPlay()->showPressStart(0, false);
|
||||
}
|
||||
|
||||
void UIController::ShowAchievementToast(string achievementName, string achievementDescription, byteArray b, string achT)
|
||||
{
|
||||
if (m_groups[static_cast<int>(eUIGroup_Fullscreen)]->getPressStartToPlay()) {
|
||||
m_groups[static_cast<int>(eUIGroup_Fullscreen)]->getPressStartToPlay()->registerSubstitutionTexture(convStringToWstring(achT) + L"sub", b.data, b.length);
|
||||
m_groups[static_cast<int>(eUIGroup_Fullscreen)]->getPressStartToPlay()->ShowAchievementToast(achievementName, achievementDescription, achT + "sub");
|
||||
}
|
||||
toastOn = true;
|
||||
}
|
||||
|
||||
|
||||
void UIController::ClearPressStart()
|
||||
{
|
||||
m_iPressStartQuadrantsMask = 0;
|
||||
|
||||
@@ -19,6 +19,7 @@ class UIController : public IUIController
|
||||
public:
|
||||
static int64_t iggyAllocCount;
|
||||
|
||||
bool toastOn = false;
|
||||
// MGH - added to prevent crash loading Iggy movies while the skins were being reloaded
|
||||
static CRITICAL_SECTION ms_reloadSkinCS;
|
||||
static bool ms_bReloadSkinCSInitialised;
|
||||
@@ -103,6 +104,9 @@ private:
|
||||
eLibrary_Tooltips,
|
||||
eLibrary_Default,
|
||||
|
||||
eLibrary_LCDefault,
|
||||
eLibrary_LCInGame,
|
||||
|
||||
#if defined(_WINDOWS64)
|
||||
// Non-HD skin libraries needed by 720p/480p scene SWFs.
|
||||
eLibraryFallback_Platform,
|
||||
@@ -201,6 +205,7 @@ protected:
|
||||
UIGroup *m_groups[eUIGroup_COUNT];
|
||||
|
||||
public:
|
||||
auto& getGroups() { return m_groups; }
|
||||
void showComponent(int iPad, EUIScene scene, EUILayer layer, EUIGroup group, bool show)
|
||||
{
|
||||
m_groups[group]->showComponent(iPad, scene, layer, show);
|
||||
@@ -381,6 +386,7 @@ public:
|
||||
virtual bool PressStartPlaying(unsigned int iPad);
|
||||
virtual void ShowPressStart(unsigned int iPad);
|
||||
virtual void HidePressStart();
|
||||
void ShowAchievementToast(string achievementName, string achievementDescription, byteArray b, string achT = "");
|
||||
void ClearPressStart();
|
||||
|
||||
virtual C4JStorage::EMessageResult RequestAlertMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, WCHAR *pwchFormatString=nullptr);
|
||||
|
||||
@@ -98,6 +98,7 @@ enum EUIScene
|
||||
eUIScene_BeaconMenu,
|
||||
eUIScene_HorseMenu,
|
||||
eUIScene_FireworksMenu,
|
||||
eUIScene_AchievementsMenu,
|
||||
|
||||
#ifdef _XBOX
|
||||
// eUIScene_TransferToXboxOne,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "UI.h"
|
||||
#include "UILayer.h"
|
||||
#include "UIScene.h"
|
||||
#include "UIScene_AchievementsMenu.h"
|
||||
|
||||
UILayer::UILayer(UIGroup *parent)
|
||||
{
|
||||
@@ -266,6 +267,9 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData)
|
||||
case eUIScene_HelpAndOptionsMenu:
|
||||
newScene = new UIScene_HelpAndOptionsMenu(iPad, initData, this);
|
||||
break;
|
||||
case eUIScene_AchievementsMenu:
|
||||
newScene = new UIScene_AchievementsMenu(iPad, initData, this);
|
||||
break;
|
||||
case eUIScene_SettingsMenu:
|
||||
newScene = new UIScene_SettingsMenu(iPad, initData, this);
|
||||
break;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "UI.h"
|
||||
#include "UIScene.h"
|
||||
#include "UISplitScreenHelpers.h"
|
||||
|
||||
#include "../../Lighting.h"
|
||||
#include "../../LocalPlayer.h"
|
||||
#include "../../ItemRenderer.h"
|
||||
@@ -765,7 +764,7 @@ void UIScene::setVisible(bool visible)
|
||||
|
||||
void UIScene::customDraw(IggyCustomDrawCallbackRegion *region)
|
||||
{
|
||||
app.DebugPrintf("Handling custom draw for scene with no override!\n");
|
||||
//app.DebugPrintf("Handling custom draw for scene with no override!\n");
|
||||
}
|
||||
|
||||
void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations)
|
||||
|
||||
@@ -0,0 +1,272 @@
|
||||
#include "UIScene_AchievementsMenu.h"
|
||||
#include "UI.h"
|
||||
#include "UILayer.h"
|
||||
#include "../Minecraft.World/HtmlString.h"
|
||||
#include "../Minecraft.World/Achievements.h"
|
||||
#include "../Minecraft.World/Achievement.h"
|
||||
#include "UISplitScreenHelpers.h"
|
||||
#include "StatsCounter.h"
|
||||
#include "MultiPlayerLocalPlayer.h"
|
||||
#include "Windows64/KeyboardMouseInput.h"
|
||||
|
||||
#include "UIControl_Label.h"
|
||||
|
||||
extern HWND g_hWnd;
|
||||
|
||||
UIScene_AchievementsMenu::UIScene_AchievementsMenu(int iPad, void* _initData, UILayer* parentLayer) : UIScene(iPad, parentLayer)
|
||||
{
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
/*RECT rc;
|
||||
GetClientRect(g_hWnd, &rc);
|
||||
POINT center;
|
||||
center.x = rc.left;
|
||||
center.y = rc.top;
|
||||
ClientToScreen(g_hWnd, ¢er);
|
||||
SetCursorPos(center.x, center.y);*/
|
||||
|
||||
m_labelAchievements.init(L"Achievements");
|
||||
//m_labelDesc.init(L"");
|
||||
m_labelName.init(L"");
|
||||
m_achievementsList.init(0);
|
||||
for (int i = 0; i < Achievements::achievements->size(); i++) { //Achievements::achievements->size()
|
||||
std::wstring path;
|
||||
if (app.hasArchiveFile(L"Graphics\\TexturePackIcon.png"))
|
||||
{
|
||||
std::wstring iconStr(Achievements::achievements->at(i)->iconInt.begin(),
|
||||
Achievements::achievements->at(i)->iconInt.end());
|
||||
|
||||
path = L"Graphics\\Achievements\\TROP" +
|
||||
(iconStr.empty() ? L"000" : iconStr) +
|
||||
L".png";
|
||||
byteArray ba = app.getArchiveFile(path);
|
||||
registerSubstitutionTexture(path, ba.data, ba.length);
|
||||
}
|
||||
|
||||
|
||||
std::string result = "Graphics\\Achievements\\" "TROP" + Achievements::achievements->at(i)->iconInt + ".png"; //media\\
|
||||
|
||||
m_achievementsList.addnewItem(i+1, path);
|
||||
int newPad = 0;
|
||||
if (Minecraft::GetInstance()->player != nullptr) {
|
||||
newPad = Minecraft::GetInstance()->player->GetXboxPad();
|
||||
}
|
||||
|
||||
if (Minecraft::GetInstance()->stats[newPad]->hasTaken(Achievements::achievements->at(i)))
|
||||
{
|
||||
m_achievementsList.EnableButton(i, true);
|
||||
}
|
||||
else {
|
||||
m_achievementsList.EnableButton(i, false);
|
||||
}
|
||||
}
|
||||
m_funcSetDesc = registerFastName(L"SetAchievementDescription");
|
||||
|
||||
m_achievementsList.setCurrentSelection(Minecraft::GetInstance()->achID + 1);
|
||||
m_achievementsList.m_iCurrentSelection = Minecraft::GetInstance()->achID + 1;
|
||||
|
||||
}
|
||||
|
||||
void UIScene_AchievementsMenu::handleDestroy()
|
||||
{
|
||||
m_parentLayer->showComponent(m_iPad, eUIComponent_MenuBackground, false);
|
||||
}
|
||||
|
||||
void UIScene_AchievementsMenu::SetAchievementDescription(wstring desc) {
|
||||
wstring desc2 = L"";
|
||||
|
||||
if (desc != L"") {
|
||||
HtmlString test = HtmlString(desc, eHTMLColor_White);
|
||||
vector<HtmlString>* lines = new vector<HtmlString>();
|
||||
lines->push_back(test);
|
||||
desc2 = HtmlString::Compose(lines);
|
||||
}
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
IggyStringUTF16 stringVal1;
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
stringVal1.string = (IggyUTF16*)desc2.c_str();
|
||||
stringVal1.length = desc2.length();
|
||||
value[0].string16 = stringVal1;
|
||||
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcSetDesc, 1, value);
|
||||
}
|
||||
|
||||
wstring UIScene_AchievementsMenu::getMoviePath()
|
||||
{
|
||||
if (app.GetLocalPlayerCount() > 1)
|
||||
{
|
||||
return L"AchievementsMenu";
|
||||
}
|
||||
else
|
||||
{
|
||||
return L"AchievementsMenu";
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_AchievementsMenu::updateComponents()
|
||||
{
|
||||
bool bNotInGame = (Minecraft::GetInstance()->level == nullptr);
|
||||
if (!bNotInGame)
|
||||
{
|
||||
m_parentLayer->showComponent(m_iPad, eUIComponent_MenuBackground, true);
|
||||
}
|
||||
m_parentLayer->showComponent(m_iPad, eUIComponent_Logo, false);
|
||||
|
||||
}
|
||||
|
||||
void UIScene_AchievementsMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled)
|
||||
{
|
||||
ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
|
||||
switch (key)
|
||||
{
|
||||
case ACTION_MENU_CANCEL:
|
||||
ui.NavigateBack(iPad);
|
||||
break;
|
||||
case ACTION_MENU_Y:
|
||||
if (pressed) {
|
||||
showDescription = !showDescription;
|
||||
|
||||
if (showDescription) {
|
||||
SetAchievementDescription(app.GetString(Achievements::achievements->at(m_achievementsList.m_iCurrentSelection - 1)->descID));
|
||||
}
|
||||
else {
|
||||
SetAchievementDescription(L"");
|
||||
}
|
||||
}
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_UP:
|
||||
if (pressed) {
|
||||
if (m_achievementsList.m_iCurrentSelection > 10) {
|
||||
m_achievementsList.m_iCurrentSelection -= 10;
|
||||
}
|
||||
}
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_DOWN:
|
||||
if (pressed) {
|
||||
if (m_achievementsList.m_iCurrentSelection < Achievements::achievements->size() - 10) {
|
||||
m_achievementsList.m_iCurrentSelection += 10;
|
||||
}
|
||||
}
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_LEFT:
|
||||
if (pressed) {
|
||||
if (m_achievementsList.m_iCurrentSelection > 1) {
|
||||
m_achievementsList.m_iCurrentSelection -= 1;
|
||||
}
|
||||
}
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_RIGHT:
|
||||
if (pressed) {
|
||||
if (m_achievementsList.m_iCurrentSelection < Achievements::achievements->size()) {
|
||||
m_achievementsList.m_iCurrentSelection += 1;
|
||||
}
|
||||
}
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
handled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
//m_achievementsList.updateChildFocus(static_cast<int>(childId));
|
||||
};
|
||||
|
||||
void UIScene_AchievementsMenu::getMouseToSWFScale(float& scaleX, float& scaleY)
|
||||
{
|
||||
extern HWND g_hWnd;
|
||||
RECT rc;
|
||||
GetClientRect(g_hWnd, &rc);
|
||||
int winW = rc.right - rc.left;
|
||||
int winH = rc.bottom - rc.top;
|
||||
if (winW <= 0 || winH <= 0) { scaleX = 1.0f; scaleY = 1.0f; return; }
|
||||
|
||||
S32 renderW, renderH;
|
||||
C4JRender::eViewportType vp = GetParentLayer()->getViewport();
|
||||
ui.getRenderDimensions(vp, renderW, renderH);
|
||||
if (vp != C4JRender::VIEWPORT_TYPE_FULLSCREEN)
|
||||
Fit16x9(renderW, renderH);
|
||||
|
||||
float screenW = (float)ui.getScreenWidth();
|
||||
float screenH = (float)ui.getScreenHeight();
|
||||
scaleX = static_cast<float>(m_movieWidth) * screenW / (static_cast<float>(renderW) * static_cast<float>(winW));
|
||||
scaleY = static_cast<float>(m_movieHeight) * screenH / (static_cast<float>(renderH) * static_cast<float>(winH));
|
||||
}
|
||||
|
||||
void UIScene_AchievementsMenu::tick()
|
||||
{
|
||||
UIScene::tick();
|
||||
//ShowCursor(FALSE);
|
||||
//m_cursorPath1.setVisible(g_KBMInput.IsKBMActive());
|
||||
//g_KBMInput.SetMouseGrabbed(false);
|
||||
|
||||
|
||||
if (m_achievementsList.m_iCurrentSelection != selection && m_achievementsList.m_iCurrentSelection != 0) {
|
||||
m_achievementsList.setCurrentSelection(m_achievementsList.m_iCurrentSelection - 1);
|
||||
m_labelName.setLabel(app.GetString(Achievements::achievements->at(m_achievementsList.m_iCurrentSelection - 1)->nameID));
|
||||
if (showDescription) {
|
||||
SetAchievementDescription(app.GetString(Achievements::achievements->at(m_achievementsList.m_iCurrentSelection - 1)->descID));
|
||||
}
|
||||
else {
|
||||
SetAchievementDescription(L"");
|
||||
}
|
||||
}
|
||||
|
||||
// Apply mouse delta
|
||||
/*int deltaX = g_KBMInput.GetMouseDeltaX();
|
||||
int deltaY = g_KBMInput.GetMouseDeltaY();
|
||||
|
||||
if (deltaX != 0 || deltaY != 0)
|
||||
{
|
||||
float scaleX, scaleY;
|
||||
getMouseToSWFScale(scaleX, scaleY);
|
||||
m_pointerPos.x += static_cast<float>(deltaX) * scaleX / 2;
|
||||
m_pointerPos.y += static_cast<float>(deltaY) * scaleY / 2;
|
||||
|
||||
if (m_pointerPos.x < 0.0f) m_pointerPos.x = 0.0f;
|
||||
if (m_pointerPos.x > static_cast<float>(m_movieWidth)) m_pointerPos.x = static_cast<float>(m_movieWidth);
|
||||
if (m_pointerPos.y < 0.0f) m_pointerPos.y = 0.0f;
|
||||
if (m_pointerPos.y > static_cast<float>(m_movieHeight)) m_pointerPos.y = static_cast<float>(m_movieHeight);
|
||||
}
|
||||
|
||||
IggyEvent mouseEvent;
|
||||
S32 width, height;
|
||||
m_parentLayer->getRenderDimensions(width, height);
|
||||
S32 x = static_cast<S32>(m_pointerPos.x * (static_cast<F32>(width) / static_cast<F32>(m_movieWidth)));
|
||||
aX = x;
|
||||
S32 y = static_cast<S32>(m_pointerPos.y * (static_cast<F32>(height) / static_cast<F32>(m_movieHeight)));
|
||||
aY = y;
|
||||
IggyMakeEventMouseMove(&mouseEvent, x, y);
|
||||
IggyEventResult result;
|
||||
IggyPlayerDispatchEventRS(getMovie(), &mouseEvent, &result);*/
|
||||
|
||||
selection = m_achievementsList.m_iCurrentSelection;
|
||||
}
|
||||
|
||||
void UIScene_AchievementsMenu::updateTooltips()
|
||||
{
|
||||
ui.SetTooltips(m_iPad, -1, IDS_TOOLTIPS_CANCEL, -1, IDS_TOOLTIPS_SHOW_DESCRIPTION);
|
||||
}
|
||||
|
||||
void UIScene_AchievementsMenu::handleFocusChange(F64 controlId, F64 childId)
|
||||
{
|
||||
switch (static_cast<int>(controlId))
|
||||
{
|
||||
case 0:
|
||||
m_achievementsList.updateChildFocus(static_cast<int>(childId));
|
||||
//m_achievementsList.setCurrentSelection(static_cast<int>(childId));
|
||||
//m_labelName.setLabel(app.GetString(Achievements::achievements->at(static_cast<int>(childId) - 1)->nameID));
|
||||
//SetAchievementDescription(app.GetString(Achievements::achievements->at(static_cast<int>(childId) - 1)->descID));
|
||||
|
||||
//m_labelName.setLabel(app.GetString(IDS_ACHIEVEMENTS);
|
||||
break;
|
||||
};
|
||||
updateTooltips();
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
#include "Common/UI/UIScene.h"
|
||||
#include "Common/UI/UIControl_Button.h"
|
||||
#include "Common/UI/UIControl_Cursor.h"
|
||||
#include "UIControl_AchievementsList.h"
|
||||
#include "UIControl_Label.h"
|
||||
|
||||
class UIScene_AchievementsMenu : public UIScene
|
||||
{
|
||||
private:
|
||||
|
||||
enum EControls
|
||||
{
|
||||
eControl_AchievementsLabel,
|
||||
eControl_AchievementsName,
|
||||
eControl_AchievementsDesc,
|
||||
eControl_AchievementsListContainer
|
||||
};
|
||||
UIControl m_controlMainPanel;
|
||||
UIControl_Label m_labelAchievements, m_labelName, m_labelDesc;
|
||||
UIControl_Cursor m_cursorPath1;
|
||||
vector<UIControl_Button*> m_AchButton;
|
||||
UIControl_AchievementsList m_achievementsList;
|
||||
IggyName m_funcSetDesc;
|
||||
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT(m_labelAchievements, "AcheivementsLabel")
|
||||
UI_MAP_ELEMENT(m_labelName, "AchievementName")
|
||||
UI_MAP_ELEMENT(m_labelDesc, "AchievementDescription")
|
||||
//UI_MAP_ELEMENT(m_achievementsList, "AchievementsList")
|
||||
UI_MAP_ELEMENT(m_controlMainPanel, "AchievementsListContainer")
|
||||
UI_MAP_NAME(m_funcSetDesc, L"SetAchievementDescription")
|
||||
UI_BEGIN_MAP_CHILD_ELEMENTS(m_controlMainPanel)
|
||||
UI_MAP_ELEMENT(m_achievementsList, "AchievementsList")
|
||||
UI_END_MAP_CHILD_ELEMENTS()
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
bool showDescription = false;
|
||||
|
||||
|
||||
public:
|
||||
struct SceneMousePos
|
||||
{
|
||||
F32 x;
|
||||
F32 y;
|
||||
};
|
||||
int deltaX;
|
||||
int deltaY;
|
||||
int aX;
|
||||
int aY;
|
||||
UIVec2D m_pointerPos;
|
||||
void getMouseToSWFScale(float& scaleX, float& scaleY);
|
||||
UIScene_AchievementsMenu(int iPad, void* initData, UILayer* parentLayer);
|
||||
SceneMousePos GetSceneMousePosition(UIScene* pScene, int rawMouseX, int rawMouseY);
|
||||
virtual void handleDestroy();
|
||||
int selection = 0;
|
||||
void SetAchievementDescription(wstring desc);
|
||||
virtual void tick();
|
||||
virtual EUIScene getSceneType() { return eUIScene_AchievementsMenu; }
|
||||
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled);
|
||||
virtual void handleFocusChange(F64 controlId, F64 childId);
|
||||
virtual void updateComponents();
|
||||
|
||||
virtual void updateTooltips();
|
||||
protected:
|
||||
virtual wstring getMoviePath();
|
||||
};
|
||||
@@ -1,79 +1,33 @@
|
||||
#include "stdafx.h"
|
||||
#include "UI.h"
|
||||
#if defined(__PS3__) || defined(__ORBIS__)
|
||||
#include "Common/Network/Sony/SonyCommerce.h"
|
||||
#endif
|
||||
#include "UIScene_DLCMainMenu.h"
|
||||
|
||||
#define PLAYER_ONLINE_TIMER_ID 0
|
||||
#define PLAYER_ONLINE_TIMER_TIME 100
|
||||
|
||||
UIScene_DLCMainMenu::UIScene_DLCMainMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||
UIScene_DLCMainMenu::UIScene_DLCMainMenu(int iPad, void* initData, UILayer* parentLayer)
|
||||
: UIScene(iPad, parentLayer)
|
||||
{
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
// Alert the app the we want to be informed of ethernet connections
|
||||
app.SetLiveLinkRequired( true );
|
||||
app.SetLiveLinkRequired(true);
|
||||
|
||||
m_labelOffers.init(IDS_DOWNLOADABLE_CONTENT_OFFERS);
|
||||
m_buttonListOffers.init(eControl_OffersList);
|
||||
|
||||
#if defined _XBOX_ONE || defined __ORBIS__
|
||||
// load any local DLC images
|
||||
app.LoadLocalDLCImages();
|
||||
#endif
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||
// show a timer on this menu
|
||||
m_Timer.setVisible(true);
|
||||
|
||||
m_bCategoriesShown=false;
|
||||
#endif
|
||||
|
||||
if(m_loadedResolution == eSceneResolution_1080)
|
||||
{
|
||||
#ifdef _DURANGO
|
||||
m_labelXboxStore.init(IDS_XBOX_STORE);
|
||||
#else
|
||||
m_labelXboxStore.init( L"" );
|
||||
#endif
|
||||
}
|
||||
m_labelXboxStore.init(L"");
|
||||
|
||||
m_buttonListOffers.addItem(L"All Packs", 0);
|
||||
m_buttonListOffers.addItem(L"Skin Packs", 1);
|
||||
m_buttonListOffers.addItem(L"Texture Packs", 2);
|
||||
m_buttonListOffers.addItem(L"Mash-up Packs", 3);
|
||||
m_buttonListOffers.setFocus(true);
|
||||
|
||||
#if defined(_DURANGO)
|
||||
m_Timer.setVisible(false);
|
||||
|
||||
m_buttonListOffers.addItem(IDS_DLC_MENU_SKINPACKS,e_DLC_SkinPack);
|
||||
m_buttonListOffers.addItem(IDS_DLC_MENU_TEXTUREPACKS,e_DLC_TexturePacks);
|
||||
m_buttonListOffers.addItem(IDS_DLC_MENU_MASHUPPACKS,e_DLC_MashupPacks);
|
||||
|
||||
app.AddDLCRequest(e_Marketplace_Content); // content is skin packs, texture packs and mash-up packs
|
||||
// we also need to mount the local DLC so we can tell what's been purchased
|
||||
app.StartInstallDLCProcess(iPad);
|
||||
#endif
|
||||
|
||||
TelemetryManager->RecordMenuShown(iPad, eUIScene_DLCMainMenu, 0);
|
||||
|
||||
#if defined __ORBIS__ || defined __PSVITA__
|
||||
app.GetCommerce()->ShowPsStoreIcon();
|
||||
#endif
|
||||
|
||||
#if ( defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ )
|
||||
addTimer( PLAYER_ONLINE_TIMER_ID, PLAYER_ONLINE_TIMER_TIME );
|
||||
#endif
|
||||
}
|
||||
|
||||
UIScene_DLCMainMenu::~UIScene_DLCMainMenu()
|
||||
{
|
||||
// Alert the app the we no longer want to be informed of ethernet connections
|
||||
app.SetLiveLinkRequired( false );
|
||||
#if defined _XBOX_ONE || defined __ORBIS__
|
||||
app.FreeLocalDLCImages();
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
// 4J-JEV: Have to switch back to user preferred languge now.
|
||||
setLanguageOverride(true);
|
||||
#endif
|
||||
app.SetLiveLinkRequired(false);
|
||||
}
|
||||
|
||||
wstring UIScene_DLCMainMenu::getMoviePath()
|
||||
@@ -83,29 +37,19 @@ wstring UIScene_DLCMainMenu::getMoviePath()
|
||||
|
||||
void UIScene_DLCMainMenu::updateTooltips()
|
||||
{
|
||||
ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK );
|
||||
ui.SetTooltips(m_iPad, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK);
|
||||
}
|
||||
|
||||
void UIScene_DLCMainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
||||
void UIScene_DLCMainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled)
|
||||
{
|
||||
//app.DebugPrintf("UIScene_DebugOverlay handling input for pad %d, key %d, down- %s, pressed- %s, released- %s\n", iPad, key, down?"TRUE":"FALSE", pressed?"TRUE":"FALSE", released?"TRUE":"FALSE");
|
||||
ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case ACTION_MENU_CANCEL:
|
||||
if(pressed)
|
||||
{
|
||||
#if defined __ORBIS__ || defined __PSVITA__
|
||||
app.GetCommerce()->HidePsStoreIcon();
|
||||
#endif
|
||||
navigateBack();
|
||||
}
|
||||
if(pressed) navigateBack();
|
||||
break;
|
||||
case ACTION_MENU_OK:
|
||||
#ifdef __ORBIS__
|
||||
case ACTION_MENU_TOUCHPAD_PRESS:
|
||||
#endif
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
break;
|
||||
case ACTION_MENU_UP:
|
||||
@@ -121,122 +65,32 @@ void UIScene_DLCMainMenu::handleInput(int iPad, int key, bool repeat, bool press
|
||||
|
||||
void UIScene_DLCMainMenu::handlePress(F64 controlId, F64 childId)
|
||||
{
|
||||
switch(static_cast<int>(controlId))
|
||||
{
|
||||
case eControl_OffersList:
|
||||
{
|
||||
int iIndex = static_cast<int>(childId);
|
||||
DLCOffersParam *param = new DLCOffersParam();
|
||||
param->iPad = m_iPad;
|
||||
if(static_cast<int>(controlId) != eControl_OffersList) return;
|
||||
|
||||
param->iType = iIndex;
|
||||
// promote the DLC content request type
|
||||
|
||||
// Xbox One will have requested the marketplace content - there is only that type
|
||||
#ifndef _XBOX_ONE
|
||||
app.AddDLCRequest(static_cast<eDLCMarketplaceType>(iIndex), true);
|
||||
#endif
|
||||
killTimer(PLAYER_ONLINE_TIMER_ID);
|
||||
ui.NavigateToScene(m_iPad, eUIScene_DLCOffersMenu, param);
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void UIScene_DLCMainMenu::handleTimerComplete(int id)
|
||||
{
|
||||
#if ( defined __PS3__ || defined __ORBIS__ || defined __PSVITA__)
|
||||
switch(id)
|
||||
{
|
||||
case PLAYER_ONLINE_TIMER_ID:
|
||||
#ifndef _WINDOWS64
|
||||
if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())==false)
|
||||
{
|
||||
// check the player hasn't gone offline
|
||||
// If they have, bring up the PSN warning and exit from the leaderboards
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_OK;
|
||||
C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CONNECTION_LOST, g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT), uiIDA,1,ProfileManager.GetPrimaryPad(),UIScene_DLCMainMenu::ExitDLCMainMenu,this);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int UIScene_DLCMainMenu::ExitDLCMainMenu(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
UIScene_DLCMainMenu* pClass = static_cast<UIScene_DLCMainMenu *>(pParam);
|
||||
|
||||
#if defined __ORBIS__ || defined __PSVITA__
|
||||
app.GetCommerce()->HidePsStoreIcon();
|
||||
#endif
|
||||
pClass->navigateBack();
|
||||
|
||||
return 0;
|
||||
DLCOffersParam* param = new DLCOffersParam();
|
||||
param->iPad = m_iPad;
|
||||
param->iType = static_cast<int>(childId);
|
||||
ui.NavigateToScene(m_iPad, eUIScene_DLCOffersMenu, param);
|
||||
}
|
||||
|
||||
void UIScene_DLCMainMenu::handleGainFocus(bool navBack)
|
||||
{
|
||||
UIScene::handleGainFocus(navBack);
|
||||
|
||||
updateTooltips();
|
||||
|
||||
if(navBack)
|
||||
{
|
||||
// add the timer back in
|
||||
#if ( defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ )
|
||||
addTimer( PLAYER_ONLINE_TIMER_ID, PLAYER_ONLINE_TIMER_TIME );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_DLCMainMenu::tick()
|
||||
{
|
||||
UIScene::tick();
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||
if((m_bCategoriesShown==false) && (app.GetCommerceCategoriesRetrieved()))
|
||||
{
|
||||
// disable the timer display on this menu
|
||||
m_Timer.setVisible(false);
|
||||
m_bCategoriesShown=true;
|
||||
|
||||
// add the categories to the list box
|
||||
SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo();
|
||||
std::list<SonyCommerce::CategoryInfoSub>::iterator iter = pCategories->subCategories.begin();
|
||||
SonyCommerce::CategoryInfoSub category;
|
||||
for(int i=0;i<pCategories->countOfSubCategories;i++)
|
||||
{
|
||||
// add a button in with the subcategory
|
||||
category = (SonyCommerce::CategoryInfoSub)(*iter);
|
||||
|
||||
string teststring=category.categoryName;
|
||||
m_buttonListOffers.addItem(teststring,i);
|
||||
|
||||
iter++;
|
||||
}
|
||||
|
||||
// set the focus to the first thing in the categories if there are any
|
||||
if(pCategories->countOfSubCategories>0)
|
||||
{
|
||||
m_buttonListOffers.setFocus(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined __ORBIS__ || defined __PSVITA__ || defined __PS3__
|
||||
app.CheckForEmptyStore(ProfileManager.GetPrimaryPad());
|
||||
#endif
|
||||
// need to display text to say no downloadable content available yet
|
||||
m_labelOffers.setLabel(app.GetString(IDS_NO_DLCCATEGORIES));
|
||||
|
||||
#ifdef __ORBIS__
|
||||
// 4J-JEV: TRC Requirement (R4055), need to display this system message.
|
||||
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_EMPTY_STORE, ProfileManager.GetPrimaryPad() );
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UIScene_DLCMainMenu::handleTimerComplete(int id)
|
||||
{
|
||||
}
|
||||
|
||||
int UIScene_DLCMainMenu::ExitDLCMainMenu(void* pParam, int iPad, C4JStorage::EMessageResult result)
|
||||
{
|
||||
UIScene_DLCMainMenu* pClass = static_cast<UIScene_DLCMainMenu*>(pParam);
|
||||
pClass->navigateBack();
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,96 +1,75 @@
|
||||
#pragma once
|
||||
|
||||
#include "UIScene.h"
|
||||
|
||||
struct WorkshopZip
|
||||
{
|
||||
std::string filename;
|
||||
std::string destToken;
|
||||
};
|
||||
struct WorkshopPack
|
||||
{
|
||||
std::string id;
|
||||
std::wstring name;
|
||||
std::wstring author;
|
||||
std::wstring description;
|
||||
std::vector<std::string> categories;
|
||||
std::string thumbnailUrl;
|
||||
std::vector<WorkshopZip> zips;
|
||||
std::string version;
|
||||
std::vector<BYTE> thumbnailData;
|
||||
bool thumbnailLoaded;
|
||||
WorkshopPack() : thumbnailLoaded(false) {}
|
||||
};
|
||||
class UIScene_DLCOffersMenu : public UIScene
|
||||
{
|
||||
private:
|
||||
enum EControls
|
||||
{
|
||||
eControl_OffersList,
|
||||
};
|
||||
|
||||
bool m_bIsSD;
|
||||
bool m_bHasPurchased;
|
||||
bool m_bIsSelected;
|
||||
|
||||
UIControl_DLCList m_buttonListOffers;
|
||||
UIControl_Label m_labelOffers, m_labelPriceTag, m_labelXboxStore;
|
||||
UIControl_HTMLLabel m_labelHTMLSellText;
|
||||
UIControl_BitmapIcon m_bitmapIconOfferImage;
|
||||
UIControl m_Timer;
|
||||
enum EControls { eControl_OffersList };
|
||||
enum EFetchState { eFetch_Idle, eFetch_Ready, eFetch_Error };
|
||||
bool m_bIsSD;
|
||||
bool m_bHasPurchased;
|
||||
bool m_bIsSelected;
|
||||
UIControl_DLCList m_buttonListOffers;
|
||||
UIControl_Label m_labelOffers, m_labelPriceTag, m_labelXboxStore;
|
||||
UIControl_HTMLLabel m_labelHTMLSellText;
|
||||
UIControl_BitmapIcon m_bitmapIconOfferImage;
|
||||
UIControl m_Timer;
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT( m_buttonListOffers, "OffersList")
|
||||
UI_MAP_ELEMENT( m_labelOffers, "OffersList_Title")
|
||||
UI_MAP_ELEMENT( m_labelPriceTag, "PriceTag")
|
||||
UI_MAP_ELEMENT( m_labelHTMLSellText, "HTMLSellText")
|
||||
UI_MAP_ELEMENT( m_bitmapIconOfferImage, "DLCIcon" )
|
||||
UI_MAP_ELEMENT( m_Timer, "Timer")
|
||||
|
||||
UI_MAP_ELEMENT(m_buttonListOffers, "OffersList")
|
||||
UI_MAP_ELEMENT(m_labelOffers, "OffersList_Title")
|
||||
UI_MAP_ELEMENT(m_labelPriceTag, "PriceTag")
|
||||
UI_MAP_ELEMENT(m_labelHTMLSellText, "HTMLSellText")
|
||||
UI_MAP_ELEMENT(m_bitmapIconOfferImage, "DLCIcon")
|
||||
UI_MAP_ELEMENT(m_Timer, "Timer")
|
||||
if(m_loadedResolution == eSceneResolution_1080)
|
||||
{
|
||||
UI_MAP_ELEMENT( m_labelXboxStore, "XboxLabel" )
|
||||
UI_MAP_ELEMENT(m_labelXboxStore, "XboxLabel")
|
||||
}
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
EFetchState m_eFetchState;
|
||||
std::vector<WorkshopPack> m_packs;
|
||||
std::vector<WorkshopPack*> m_filteredPacks;
|
||||
int m_iCurrentPack;
|
||||
int m_iProductInfoIndex;
|
||||
static const char* CategoryForIndex(int index);
|
||||
static bool FetchURL(const std::string& url, std::vector<BYTE>& outData);
|
||||
static bool FetchURLString(const std::string& url, std::string& outStr);
|
||||
bool ParseRegistry(const std::string& json);
|
||||
void PopulateList();
|
||||
void UpdateDetailPanel();
|
||||
static bool InstallPack(const std::vector<BYTE>& zipData, const std::string& packName);
|
||||
static bool IsPackInstalled(const std::string& packName);
|
||||
public:
|
||||
UIScene_DLCOffersMenu(int iPad, void *initData, UILayer *parentLayer);
|
||||
UIScene_DLCOffersMenu(int iPad, void* initData, UILayer* parentLayer);
|
||||
~UIScene_DLCOffersMenu();
|
||||
static int ExitDLCOffersMenu(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
|
||||
virtual EUIScene getSceneType() { return eUIScene_DLCOffersMenu;}
|
||||
virtual void tick();
|
||||
virtual void updateTooltips();
|
||||
|
||||
static int ExitDLCOffersMenu(void* pParam, int iPad, C4JStorage::EMessageResult result);
|
||||
virtual EUIScene getSceneType() { return eUIScene_DLCOffersMenu; }
|
||||
virtual void tick();
|
||||
virtual void updateTooltips();
|
||||
protected:
|
||||
// TODO: This should be pure virtual in this class
|
||||
virtual wstring getMoviePath();
|
||||
|
||||
public:
|
||||
// INPUT
|
||||
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
||||
|
||||
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled);
|
||||
virtual void handlePress(F64 controlId, F64 childId);
|
||||
virtual void handleSelectionChanged(F64 selectedId);
|
||||
virtual void handleFocusChange(F64 controlId, F64 childId);
|
||||
virtual void handleTimerComplete(int id);
|
||||
#ifdef __PS3__
|
||||
virtual void HandleDLCInstalled();
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
virtual void HandleDLCLicenseChange();
|
||||
#endif
|
||||
|
||||
private:
|
||||
#ifdef _DURANGO
|
||||
void GetDLCInfo( int iOfferC, bool bUpdateOnly=false );
|
||||
void UpdateTooltips(MARKETPLACE_CONTENTOFFER_INFO& xOffer);
|
||||
bool UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer);
|
||||
|
||||
static int OrderSortFunction(const void* a, const void* b);
|
||||
|
||||
bool m_bIgnorePress;
|
||||
bool m_bDLCRequiredIsRetrieved;
|
||||
DLC_INFO *m_pNoImageFor_DLC;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int uiContentIndex;
|
||||
unsigned int uiSortIndex;
|
||||
}
|
||||
SORTINDEXSTRUCT;
|
||||
|
||||
vector <wstring>m_vIconRetrieval;
|
||||
bool m_bSelectionChanged;
|
||||
|
||||
#endif
|
||||
|
||||
bool m_bProductInfoShown;
|
||||
int m_iProductInfoIndex;
|
||||
int m_iCurrentDLC;
|
||||
int m_iTotalDLC;
|
||||
bool m_bAddAllDLCButtons;
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||
std::vector<SonyCommerce::ProductInfo>*m_pvProductInfo;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
@@ -27,7 +27,6 @@ UIScene_DeathMenu::UIScene_DeathMenu(int iPad, void *initData, UILayer *parentLa
|
||||
|
||||
if (isHardcore)
|
||||
{
|
||||
m_buttonRespawn.init(app.GetString(IDS_HARDCORE_DEATH_MESSAGE), eControl_Respawn);
|
||||
m_buttonRespawn.setVisible(false);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -125,5 +125,8 @@ void UIScene_LanguageSelector::handlePress(F64 controlId, F64 childId)
|
||||
app.SetMinecraftLocale(m_iPad, newLocale);
|
||||
|
||||
app.CheckGameSettingsChanged(true, m_iPad);
|
||||
|
||||
app.loadStringTable();
|
||||
app.SetAction(m_iPad, eAppAction_ReloadFont);
|
||||
}
|
||||
}
|
||||
@@ -424,6 +424,8 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, bool
|
||||
|
||||
void UIScene_LeaderboardsMenu::ReadStats(int startIndex)
|
||||
{
|
||||
m_labelInfo.setLabel(app.GetString(IDS_LEADERBOARD_LOADING));
|
||||
m_labelInfo.setVisible(true);
|
||||
//If startIndex == -1, then use default values
|
||||
if( startIndex == -1 )
|
||||
{
|
||||
@@ -490,10 +492,6 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//Show the loading message
|
||||
m_labelInfo.setLabel(app.GetString(IDS_LEADERBOARD_LOADING));
|
||||
m_labelInfo.setVisible(true);
|
||||
}
|
||||
|
||||
bool UIScene_LeaderboardsMenu::OnStatsReadComplete(LeaderboardManager::eStatsReturn retIn, int numResults, LeaderboardManager::ViewOut results)
|
||||
|
||||
@@ -29,8 +29,7 @@ int UIScene_LoadMenu::m_iDifficultyTitleSettingA[5]=
|
||||
IDS_DIFFICULTY_TITLE_PEACEFUL,
|
||||
IDS_DIFFICULTY_TITLE_EASY,
|
||||
IDS_DIFFICULTY_TITLE_NORMAL,
|
||||
IDS_DIFFICULTY_TITLE_HARD,
|
||||
IDS_GAMEMODE_HARDCORE
|
||||
IDS_DIFFICULTY_TITLE_HARD
|
||||
};
|
||||
|
||||
int UIScene_LoadMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes)
|
||||
@@ -511,6 +510,17 @@ void UIScene_LoadMenu::tick()
|
||||
m_MoreOptionsParams.bNaturalRegeneration = app.GetGameHostOption(uiHostOptions, eGameHostOption_NaturalRegeneration);
|
||||
m_MoreOptionsParams.bDoDaylightCycle = app.GetGameHostOption(uiHostOptions, eGameHostOption_DoDaylightCycle);
|
||||
|
||||
unsigned int saveDifficulty = app.GetGameHostOption(uiHostOptions, eGameHostOption_Difficulty);
|
||||
if (saveDifficulty <= 3)
|
||||
{
|
||||
m_CurrentDifficulty = static_cast<unsigned char>(saveDifficulty);
|
||||
app.SetGameSettings(m_iPad, eGameSetting_Difficulty, m_CurrentDifficulty);
|
||||
|
||||
WCHAR difficultyLabel[256];
|
||||
swprintf((WCHAR*)difficultyLabel, 256, L"%ls: %ls", app.GetString(IDS_SLIDER_DIFFICULTY), app.GetString(m_iDifficultyTitleSettingA[m_CurrentDifficulty]));
|
||||
m_sliderDifficulty.init(difficultyLabel, eControl_Difficulty, 0, 3, m_CurrentDifficulty);
|
||||
}
|
||||
|
||||
bool cheatsOn = m_MoreOptionsParams.bHostPrivileges;
|
||||
if (!cheatsOn)
|
||||
{
|
||||
|
||||
@@ -2021,6 +2021,7 @@ void UIScene_MainMenu::RunAchievements(int iPad)
|
||||
XShowAchievementsUI( iPad );
|
||||
}
|
||||
#endif
|
||||
ui.NavigateToScene(iPad, eUIScene_AchievementsMenu);
|
||||
}
|
||||
|
||||
void UIScene_MainMenu::RunHelpAndOptions(int iPad)
|
||||
|
||||
@@ -635,7 +635,21 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId)
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case BUTTON_PAUSE_ACHIEVEMENTS:
|
||||
|
||||
// guests can't look at achievements
|
||||
/*if(ProfileManager.IsGuest(pNotifyPressData->UserIndex))
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0]=IDS_OK;
|
||||
ui.RequestAlertMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad());
|
||||
}
|
||||
else
|
||||
{
|
||||
XShowAchievementsUI( pNotifyPressData->UserIndex );
|
||||
}*/
|
||||
ui.NavigateToScene(m_iPad, eUIScene_AchievementsMenu);
|
||||
break;
|
||||
case BUTTON_PAUSE_HELPANDOPTIONS:
|
||||
ui.NavigateToScene(m_iPad,eUIScene_HelpAndOptionsMenu);
|
||||
break;
|
||||
@@ -992,6 +1006,7 @@ int UIScene_PauseMenu::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::
|
||||
ProfileManager.DisplayFullVersionPurchase(false,pMinecraft->player->GetXboxPad(),eSen_UpsellID_Full_Version_Of_Game);
|
||||
}
|
||||
}
|
||||
pMinecraft->forceStatsSave(pMinecraft->player->GetXboxPad());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
#include "UI.h"
|
||||
#include "UIScene_SettingsOptionsMenu.h"
|
||||
|
||||
#if defined(_XBOX_ONE)
|
||||
#define _ENABLE_LANGUAGE_SELECT
|
||||
#endif
|
||||
|
||||
int UIScene_SettingsOptionsMenu::m_iDifficultySettingA[4]=
|
||||
{
|
||||
@@ -137,26 +135,21 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat
|
||||
// MGH - disabled the language select for the patch build, we'll re-enable afterwards
|
||||
// 4J Stu - Removed it with a preprocessor def as we turn this off in various places
|
||||
#ifdef _ENABLE_LANGUAGE_SELECT
|
||||
if (app.GetGameStarted())
|
||||
{
|
||||
removeControl( &m_buttonLanguageSelect, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_buttonLanguageSelect.init(IDS_LANGUAGE_SELECTOR, eControl_Languages);
|
||||
}
|
||||
|
||||
if (app.GetGameStarted())
|
||||
{
|
||||
removeControl(&m_buttonLanguageSelect, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_buttonLanguageSelect.init(IDS_LANGUAGE_SELECTOR, eControl_Languages);
|
||||
}
|
||||
|
||||
#else
|
||||
removeControl( &m_buttonLanguageSelect, false );
|
||||
#endif
|
||||
|
||||
doHorizontalResizeCheck();
|
||||
removeControl(&m_buttonLanguageSelect, false);
|
||||
|
||||
if(app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
#if TO_BE_IMPLEMENTED
|
||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
|
||||
#endif
|
||||
}
|
||||
|
||||
m_labelDifficultyText.disableReinitialisation();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user