Esempio n. 1
0
 def addClientMessage(self, message, isCurrentPlayer = False):
     if isCurrentPlayer:
         fillColor = FILL_COLORS.BROWN
     else:
         fillColor = FILL_COLORS.BLACK
     self.__sharedHistory.addMessage(message, fillColor=fillColor)
     self.__updateHistoryControls()
     self.__flashCall(BTMS_COMMANDS.ReceiveMessage(), [0, message, fillColor])
Esempio n. 2
0
 def __onCheckCooldownPeriod(self, *args):
     parser = CommandArgsParser(self.__onCheckCooldownPeriod.__name__, 1, [long])
     clientID, = parser.parse(*args)
     controller = self.__getController(clientID)
     if not controller:
         return
     result, errorMsg = controller.canSendMessage()
     parser.addArgs([clientID, result])
     self.__flashRespond(parser.args())
     if not result:
         message = g_settings.htmlTemplates.format('battleErrorMessage', ctx={'error': errorMsg})
         history = self.__sharedHistory()
         if history:
             history.addMessage(message)
         self.__flashCall(BTMS_COMMANDS.ReceiveMessage(), [clientID, message, FILL_COLORS.BLACK])
Esempio n. 3
0
 def __onCheckCooldownPeriod(self, *args):
     controller = self._controller()
     if controller is None:
         return
     else:
         parser = CommandArgsParser(self.__onCheckCooldownPeriod.__name__,
                                    1, [long])
         channelID, = parser.parse(*args)
         if channelID == self._channelID:
             LOG_DEBUG('BattleChannelView.__onCheckCooldownPeriod',
                       channelID)
             result, errorMsg = controller.canSendMessage()
             parser.addArgs([channelID, result])
             self.__flashRespond(parser.args())
             if not result:
                 message = g_settings.htmlTemplates.format(
                     'battleErrorMessage', ctx={'error': errorMsg})
                 self.__flashCall(BTMS_COMMANDS.ReceiveMessage(),
                                  [channelID, message, False])
         return
Esempio n. 4
0
 def addMessage(self, message, fillColor=FILL_COLORS.BLACK, accountDBID=0):
     history = self.__sharedHistory()
     if history:
         history.addMessage(message, fillColor)
     self.__flashCall(BTMS_COMMANDS.ReceiveMessage(),
                      [0, message, fillColor])
Esempio n. 5
0
 def addMessage(self, message, isCurrentPlayer=False):
     self.__flashCall(BTMS_COMMANDS.ReceiveMessage(),
                      [self._channelID, message, isCurrentPlayer])
Esempio n. 6
0
 def addClientMessage(self, message, isCurrentPlayer = False):
     self.__flashCall(BTMS_COMMANDS.ReceiveMessage(), [0, message, isCurrentPlayer])