(01/30 15:23:26) __init__CampbravoBookGUI v.1
(01/30 15:23:30) CampbravoBookGUI: OnFirstUpdate called
(01/30 15:23:37) CampbravoBookGUI: OnNotify called
(01/30 15:23:37) Someone clicked on object welcomebk
(01/30 15:23:37) It was you
(01/30 15:23:37) CampbravoBookGUI: OnNotify called
ageBooks = ('welcomebk', 'dummy')
bookPages = (['cbjournal1'], ['dummy'])
# BookDef sets cover and margins of the book. The cover can be the same texture as used for the book object itself.
BookDef = '<cover src="welcomebook"><margin right=32 left=32>'
def IOpenBook(self, bkPages = None, forceOwned = 0):
global ourBook
global bkLinks
print ('%s: IOpenBook: Page request for %s' % (self.__class__.__name__, bkPages))
if (type(bkPages) == type(None)):
return
#PageDef = CampbravoPageDefs.BookDef + CampbravoPageDefs.BookFont
PageCount = xLinkingBookDefs.kFirstLinkPanelID
bkLinks = []
for bkPage in bkPages:
if (not bkPage in CampbravoPageDefs.LinkDestinations):
print ('skipping %s because definition does not exist' % bkPage)
continue
# setting up the destination from the definition
params = CampbravoPageDefs.LinkDestinations[bkPage]
(bkAge, spawnPoint, spTitle, linkRule,) = params
alink = 1
if (type(bkAge) != type(None) and forceOwned):
print ('ownership check for %s book' % bkAge)
vault = ptVault()
ainfo = ptAgeInfoStruct()
ainfo.setAgeFilename(bkAge)
alink = vault.getOwnedAgeLink(ainfo)
if alink:
print ('showing page for %s' % bkAge)
if (type(bkAge) != type(None)):
t = (PageCount, bkAge, spawnPoint, spTitle, linkRule)
bkLinks.append(t)
PageDef = CampbravoPageDefs.BookPages[bkPage] % (PageCount) + '<pb>'
else:
PageDef = CampbravoPageDefs.BookPages[bkPage] + '<pb>'
PageCount = PageCount + 1
else:
print ('No %s book on your shelf so we are not showing the link' % bkAge)
if (PageCount == xLinkingBookDefs.kFirstLinkPanelID):
print 'no pages created'
return
print ('linkingpages created: %d' % (len(bkLinks)))
PageDef = PageDef[:-4]
ourBook = ptBook(PageDef, self.key)
ourBook.setSize(1.0, 1.0)
ourBook.setGUI('BkBook')
ourBook.show(0) # 0 = closed book, 1 = open book
Users browsing this forum: No registered users and 0 guests