class BattleMessageBox(SizedWidget): """ Represents the Message Box for a Battle """ def __init__(self, battle, width, height): """ Initialize the Battle Message Box """ SizedWidget.__init__(self, width, height) self.messageBox = MessageBox("") self.battle = battle def update(self): """ Update the screen """ if not self.battle.noEvents() and not self.battle.eventQueue[0] == self.messageBox.message: self.messageBox = MessageBox(self.battle.eventQueue[0]) self.messageBox.update() def drawSurface(self): """ Draw the child Message Box """ messageBoxSurface = self.messageBox.draw() self.drawOnSurface(messageBoxSurface, centerx=0.5, centery=0.5)
class BattleMessageBox(SizedWidget): """ Represents the Message Box for a Battle """ def __init__(self, battle, width, height): """ Initialize the Battle Message Box """ SizedWidget.__init__(self, width, height) self.messageBox = MessageBox("") self.battle = battle def update(self): """ Update the screen """ if not self.battle.noEvents( ) and not self.battle.eventQueue[0] == self.messageBox.message: self.messageBox = MessageBox(self.battle.eventQueue[0]) self.messageBox.update() def drawSurface(self): """ Draw the child Message Box """ messageBoxSurface = self.messageBox.draw() self.drawOnSurface(messageBoxSurface, centerx=.5, centery=.5)
class MessageBoxScreen(PygameScreen): """ Represents a message box screen """ def __init__(self, message, lastScreen): """ Initialize the Message Box Screen """ PygameScreen.__init__(self) self.messageBox = MessageBox(self.width * .9, self.height * .3, message) self.lastScreen = lastScreen def drawSurface(self): """ Draw the Screen """ previousScreenSurface = self.lastScreen.draw() self.drawOnSurface(previousScreenSurface, left=0, top=0) messageBoxSurface = self.messageBox.draw() self.drawOnSurface(messageBoxSurface, left=.05, top=.7) def update(self): """ Update the Screen """ self.lastScreen.update() self.messageBox.update()
class MessageBoxScreen(PygameScreen): """ Represents a message box screen """ def __init__(self, message, lastScreen): """ Initialize the Message Box Screen """ PygameScreen.__init__(self) self.messageBox = MessageBox(self.width*.9, self.height*.3, message) self.lastScreen = lastScreen def drawSurface(self): """ Draw the Screen """ previousScreenSurface = self.lastScreen.draw() self.drawOnSurface(previousScreenSurface, left=0, top=0) messageBoxSurface = self.messageBox.draw() self.drawOnSurface(messageBoxSurface, left=.05, top=.7) def update(self): """ Update the Screen """ self.lastScreen.update() self.messageBox.update()