the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 145 lines 4.3 kB view raw
1#include "stdafx.h" 2#include "UI.h" 3#include "UIControl_TexturePackList.h" 4 5UIControl_TexturePackList::UIControl_TexturePackList() 6{ 7} 8 9bool UIControl_TexturePackList::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) 10{ 11 UIControl::setControlType(UIControl::eTexturePackList); 12 bool success = UIControl_Base::setupControl(scene,parent,controlName); 13 14 //SlotList specific initialisers 15 m_addPackFunc = registerFastName(L"addPack"); 16 m_clearSlotsFunc = registerFastName(L"removeAllItems"); 17 m_funcSelectSlot = registerFastName(L"SelectSlot"); 18 m_funcEnableSelector = registerFastName(L"EnableSelector"); 19 m_funcSetTouchFocus = registerFastName(L"SetTouchFocus"); 20 m_funcCanTouchTrigger = registerFastName(L"CanTouchTrigger"); 21 m_funcGetRealHeight = registerFastName(L"GetRealHeight"); 22 23 return success; 24} 25 26void UIControl_TexturePackList::init(const wstring &label, int id) 27{ 28 m_label = label; 29 m_id = id; 30 31 IggyDataValue result; 32 IggyDataValue value[2]; 33 value[0].type = IGGY_DATATYPE_string_UTF16; 34 IggyStringUTF16 stringVal; 35 36 stringVal.string = (IggyUTF16*)label.c_str(); 37 stringVal.length = label.length(); 38 value[0].string16 = stringVal; 39 40 value[1].type = IGGY_DATATYPE_number; 41 value[1].number = id; 42 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 2 , value ); 43 44#ifdef __PSVITA__ 45 // 4J-TomK - add this texturepack list to the vita touch box list 46 47 switch(m_parentScene->GetParentLayer()->m_iLayer) 48 { 49 case eUILayer_Fullscreen: 50 case eUILayer_Scene: 51 case eUILayer_HUD: 52 ui.TouchBoxAdd(this,m_parentScene); 53 break; 54 } 55#endif 56} 57 58void UIControl_TexturePackList::addPack(int id, const wstring &textureName) 59{ 60 IggyDataValue result; 61 IggyDataValue value[2]; 62 value[0].type = IGGY_DATATYPE_number; 63 value[0].number = id; 64 65 value[1].type = IGGY_DATATYPE_string_UTF16; 66 IggyStringUTF16 stringVal; 67 68 stringVal.string = (IggyUTF16*)textureName.c_str(); 69 stringVal.length = textureName.length(); 70 value[1].string16 = stringVal; 71 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_addPackFunc ,2 , value ); 72} 73 74void UIControl_TexturePackList::selectSlot(int id) 75{ 76 IggyDataValue result; 77 IggyDataValue value[1]; 78 value[0].type = IGGY_DATATYPE_number; 79 value[0].number = id; 80 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSelectSlot ,1 , value ); 81} 82 83void UIControl_TexturePackList::clearSlots() 84{ 85 IggyDataValue result; 86 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_clearSlotsFunc ,0 , NULL ); 87} 88 89void UIControl_TexturePackList::setEnabled(bool enable) 90{ 91 IggyDataValue result; 92 IggyDataValue value[1]; 93 value[0].type = IGGY_DATATYPE_boolean; 94 value[0].number = enable; 95 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcEnableSelector ,1 , value ); 96} 97 98void UIControl_TexturePackList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat) 99{ 100 IggyDataValue result; 101 IggyDataValue value[3]; 102 103 value[0].type = IGGY_DATATYPE_number; 104 value[0].number = iX; 105 value[1].type = IGGY_DATATYPE_number; 106 value[1].number = iY; 107 value[2].type = IGGY_DATATYPE_boolean; 108 value[2].boolval = bRepeat; 109 110 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetTouchFocus, 3 , value ); 111} 112 113bool UIControl_TexturePackList::CanTouchTrigger(S32 iX, S32 iY) 114{ 115 IggyDataValue result; 116 IggyDataValue value[2]; 117 118 value[0].type = IGGY_DATATYPE_number; 119 value[0].number = iX; 120 value[1].type = IGGY_DATATYPE_number; 121 value[1].number = iY; 122 123 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcCanTouchTrigger, 2 , value ); 124 125 S32 bCanTouchTrigger = false; 126 if(result.type == IGGY_DATATYPE_boolean) 127 { 128 bCanTouchTrigger = (bool)result.boolval; 129 } 130 return bCanTouchTrigger; 131} 132 133S32 UIControl_TexturePackList::GetRealHeight() 134{ 135 IggyDataValue result; 136 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , NULL ); 137 138 S32 iRealHeight = m_height; 139 if(result.type == IGGY_DATATYPE_number) 140 { 141 iRealHeight = (S32)result.number; 142 } 143 return iRealHeight; 144} 145