Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function QuestLister() -- CREATES A LIST OF THE PLAYERS QUESTS
- group.maps.elements.Text_Header.text = ( rosetta:getString("Quests") )
- group.maps.elements.Text_Sub1.text = ( " " )
- local questNames = {}
- group.maps.groups['ScrollHandle1'].isVisible = false
- group.maps.groups['ScrollHandle2'].isVisible = false
- group.maps.groups['ScrollMap'].isVisible = true
- group.maps.groups['AtlasMap'].isVisible = false
- group.maps.groups['Lists'].isVisible = true
- group.maps.elements.btnScroll.isVisible = false
- group.maps.elements.btnScroll:setEnabled(false, 'up')
- group.maps.elements.btnWorld.isVisible = false
- group.maps.elements.btnWorld:setEnabled(false, 'up')
- group.maps.elements.btnQuests.isVisible = false
- group.maps.elements.btnQuests:setEnabled(false, 'up')
- group.maps.elements.btnSpellbook.isVisible = false
- group.maps.elements.btnSpellbook:setEnabled(false, 'up')
- group.maps.elements.btnLeft.onTap = returnToGameFromList
- if #playerData.playerQuests > 0 then -- if the player has any quests complete or active...
- for i= 1, #playerData.playerQuests do
- print ("Quest# " .. i .. " is " .. playerData.playerQuests[i].QuestName )
- table.insert (questNames, playerData.playerQuests[i].QuestName )
- atrace (xinspect(questNames))
- end
- else -- if the player doesnt have any quest at all
- group.maps.elements.Text_Header.text = ( rosetta:getString("No quests...") )
- group.maps.elements.Text_Sub1.text = ( rosetta:getString("Search for quests.") )
- end
- local tableView = require("tableView")
- --initial values
- local screenOffsetW, screenOffsetH = display.contentWidth - display.viewableContentWidth, display.contentHeight - display.viewableContentHeight
- local myList, backBtn
- -- you might want to move this to layout
- local backgroundBox = display.newRect(1, 1, 320, 412)
- backgroundBox:setFillColor(tonumber("27", 16), tonumber("27", 16), tonumber("27", 16))
- group.maps.groups['Lists']:insert( backgroundBox )
- --setup functions to execute on touch of the list view items
- function listButtonRelease( event )
- local function returnToList()
- group.maps.elements.btnYes.isVisible = false
- print "remove self on return to LIST"
- textBox:removeSelf()
- textBox=nil
- myList.isVisible = true
- end
- myList.isVisible = false -- get rid of the list
- -- add a description of what the quest is...
- textBox = native.newTextBox( 15, 100, 280, 300 )
- textBox.font = native.newFont( native.systemFontBold, 24 / display.contentScaleX )
- textBox:setTextColor( 200, 200, 200, 255 )
- textBox.isEditable = false
- textBox.align = "center"
- textBox.text = "Defeat the Necromancer East of the Village of Kyre." -- TEMP, Change to Character's Quest Text
- textBox.hasBackground = false
- group.maps.elements.btnYes.isVisible = true
- group.maps.elements.btnYes.onTap = returnToList
- self = event.target
- local id = self.id
- print("This is the Self.id:" .. self.id)
- group.maps.elements.Text_Header.text = ( rosetta:getString(questNames[self.id]) )
- print ("questNames[self.id]:" .. questNames[self.id])
- end
- -- setup the data
- local data = questNames
- local topBoundary = display.screenOriginY + 46
- local bottomBoundary = display.screenOriginY + 0
- -- Create a list with no backgroundIMG, allowing the backgroundIMG image to show through
- myList = tableView.newList{
- data=data,
- default="huge_button_up.png",
- over="huge_button_down.png",
- onRelease=listButtonRelease,
- top=topBoundary,
- bottom=bottomBoundary,
- callback=function(row)
- local t = display.newGroup()
- --[[ **** Put Quest Complete image or Quest Current image here ***
- local img = display.newImage("Quest.png")
- img.x = math.floor(img.width/2) + 12
- img.y = 46
- t:insert(img)
- ]]
- local txt = display.newText(row, 0, 0, native.systemFontBold, 18)
- txt:setTextColor(255, 255, 255)
- txt.x = math.floor(txt.width/2) + 82
- txt.y = 46
- t:insert(txt)
- return t
- end
- }
- group.maps.groups['Lists']:insert(myList)
- group.maps.groups['ScrollHandle1'].isVisible = false
- group.maps.groups['ScrollHandle2'].isVisible = false
- group.maps.groups['ScrollMap'].isVisible = false
- group.maps.groups['AtlasMap'].isVisible = false
- group.maps.groups['Lists'].isVisible = true
- group.maps.elements.btnQuests.isVisible = false
- group.maps.elements.btnSpellbook.isVisible = false
- group.maps.elements.btnLeft:toFront()
- group.maps.elements.btnQuests.isVisible = false
- group.maps.elements.btnWorld.isVisible = false
- end
Advertisement
Add Comment
Please, Sign In to add comment