Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function scoreRowRender(event)
- event.background.alpha, event.line.alpha = 0, 0
- local scoreInfo = history:TopScore(event.parent.Source, event.index - 1)
- if not scoreInfo then return end
- local happened = scoreInfo.happened do
- local YYyy, mm, dd, hh, MM, SS = happened:match("(%d%d%d%d)%-(%d%d)%-(%d%d) (%d%d)%:(%d%d)%:(%d%d)")
- happened = os.date("%I:%M%p, %m/%d",
- os.time{year = YYyy, month = mm, day = dd, hour = hh, min = MM, sec = SS}
- )
- end
- local date = display.newEmbossedText(event.view, happened, 0, 0, fonts.crisp, event.target.height * 0.75)
- event.view:insert(date)
- date:setTextColor(colors.wood())
- date:setReferencePoint(display.CenterLeft)
- event.row.Score = display.newEmbossedText(event.view, tostring(scoreInfo.Score), 0, 0, fonts.crisp, event.target.height * 0.75) do local score = event.row.Score
- event.view:insert(score)
- score:setTextColor(colors.wood())
- score:setReferencePoint(display.CenterRightReferencePoint)
- score.x = event.view.width
- end
- event.row.Days = display.newEmbossedText(event.view, tostring(scoreInfo.Days).." days", 0, 0, fonts.crisp, event.target.height * 0.75) do local days = event.row.Days
- event.view:insert(days)
- days:setTextColor(colors.wood())
- days:setReferencePoint(display.CenterRightReferencePoint)
- days.x = event.view.width
- days.isVisible = false
- end
- event.row.Links = display.newEmbossedText(event.view, tostring(scoreInfo.CircuitLength).." links", 0, 0, fonts.crisp, event.target.height * 0.75) do local links = event.row.Links
- event.view:insert(links)
- links:setTextColor(colors.wood())
- links:setReferencePoint(display.CenterRightReferencePoint)
- links.x = event.view.width
- links.isVisible = false
- end
- end
- local function scoreRowTouch(event)
- if event.phase == "release" then
- if event.row.Score.isVisible then
- event.row.Score.isVisible = false
- event.row.Days.isVisible = true
- elseif event.row.Days.isVisible then
- event.row.Days.isVisible = false
- event.row.Links.isVisible = true
- elseif event.row.Links.isVisible then
- event.row.Links.isVisible = false
- event.row.Score.isVisible = true
- end
- end
- return true
- end
- local function blank(event)
- event.background.alpha, event.line.alpha = 0, 0
- end
- local function list(parent, source, top)
- local self = widget.newTableView{
- bgColor = {0, 0, 0, 0},
- left = display.contentWidth * 0.15,
- width = display.contentWidth * 0.7,
- top = display.contentHeight * top,
- height = display.contentHeight * 0.225,
- maskFile = "tableMask.png"
- }
- parent:insert(self)
- self.maskScaleX = display.contentWidth / 640
- self.maskScaleY = self.maskScaleX
- self.Source = source
- self:insertRow{
- height = display.contentHeight * 0.005,
- onRender = blank
- }
- for i=1,15 do
- self:insertRow{
- height = typesize,
- onRender = scoreRowRender,
- onEvent = scoreRowTouch,
- }
- end
- self:insertRow{
- height = display.contentHeight * 0.005,
- onRender = blank
- }
- self:addEventListener('touch', function(...) return true end)
- return self
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement