feat: achievements, minecraft store, languages, auto lb sendStats, more Language Strings
This commit is contained in:
@@ -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,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "UIScene.h"
|
||||
#include "UIControl_Label.h"
|
||||
|
||||
class UIComponent_PressStartToPlay : public UIScene
|
||||
{
|
||||
@@ -15,7 +16,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 +27,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 +50,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"
|
||||
@@ -581,6 +583,11 @@ void UIController::loadSkins()
|
||||
m_iggyLibraries[eLibrary_Tooltips] = loadSkin(L"skinHDTooltips.swf", L"skinHDTooltips.swf");
|
||||
m_iggyLibraries[eLibrary_Default] = loadSkin(L"skinHD.swf", L"skinHD.swf");
|
||||
|
||||
//Load skins specifcally edited for use on achievements, if we
|
||||
//used these as skin.swf and skinInGame.swf it breaks some other things
|
||||
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");
|
||||
|
||||
@@ -924,7 +931,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::eTexturePackList && type != UIControl::eAchievementList)
|
||||
continue;
|
||||
|
||||
// If the scene has an active panel (e.g. tab menus),
|
||||
@@ -958,6 +965,18 @@ void UIController::tickInput()
|
||||
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)
|
||||
{
|
||||
// TexturePackList expects coords relative to its origin.
|
||||
@@ -1830,6 +1849,10 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void *
|
||||
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 )
|
||||
@@ -1843,11 +1866,15 @@ 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;
|
||||
//Fix for icon size changing on Achievements
|
||||
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
|
||||
|
||||
*destroy_callback_data = (void *)id;
|
||||
@@ -2933,6 +2960,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;
|
||||
|
||||
@@ -18,6 +18,8 @@ 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;
|
||||
@@ -100,6 +102,8 @@ private:
|
||||
eLibrary_HUD,
|
||||
eLibrary_Tooltips,
|
||||
eLibrary_Default,
|
||||
eLibrary_LCDefault,
|
||||
eLibrary_LCInGame,
|
||||
|
||||
#if defined(_WINDOWS64)
|
||||
// Non-HD skin libraries needed by 720p/480p scene SWFs.
|
||||
@@ -199,6 +203,8 @@ 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);
|
||||
@@ -379,6 +385,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;
|
||||
|
||||
@@ -757,7 +757,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,240 @@
|
||||
#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"
|
||||
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(app.GetString(IDS_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,63 @@
|
||||
#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 "Common/UI/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();
|
||||
};
|
||||
@@ -2021,6 +2021,7 @@ void UIScene_MainMenu::RunAchievements(int iPad)
|
||||
XShowAchievementsUI( iPad );
|
||||
}
|
||||
#endif
|
||||
ui.NavigateToScene(iPad, eUIScene_AchievementsMenu);
|
||||
}
|
||||
|
||||
void UIScene_MainMenu::RunHelpAndOptions(int iPad)
|
||||
|
||||
@@ -619,11 +619,11 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId)
|
||||
Windows::Xbox::ApplicationModel::Help::Show(user);
|
||||
}
|
||||
break;
|
||||
#elif TO_BE_IMPLEMENTED
|
||||
#endif
|
||||
case BUTTON_PAUSE_ACHIEVEMENTS:
|
||||
|
||||
// guests can't look at achievements
|
||||
if(ProfileManager.IsGuest(pNotifyPressData->UserIndex))
|
||||
/*if(ProfileManager.IsGuest(pNotifyPressData->UserIndex))
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0]=IDS_OK;
|
||||
@@ -633,8 +633,9 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId)
|
||||
{
|
||||
XShowAchievementsUI( pNotifyPressData->UserIndex );
|
||||
}
|
||||
}*/
|
||||
ui.NavigateToScene(m_iPad, eUIScene_AchievementsMenu);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case BUTTON_PAUSE_HELPANDOPTIONS:
|
||||
ui.NavigateToScene(m_iPad,eUIScene_HelpAndOptionsMenu);
|
||||
@@ -992,6 +993,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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user