Poodletooth-iLand/toontown/toon/GroupInvitee.py

64 lines
2.3 KiB
Python
Raw Normal View History

from panda3d.core import *
2015-03-03 22:10:12 +00:00
from toontown.toonbase.ToontownGlobals import *
from direct.showbase import DirectObject
from direct.directnotify import DirectNotifyGlobal
from toontown.toontowngui import TTDialog
from otp.otpbase import OTPLocalizer
from toontown.toontowngui import ToonHeadDialog
from direct.gui.DirectGui import DGG
from otp.otpbase import OTPGlobals
from toontown.toonbase import TTLocalizer
class GroupInvitee(ToonHeadDialog.ToonHeadDialog):
notify = DirectNotifyGlobal.directNotify.newCategory('GroupInvitee')
def __init__(self):
pass
def make(self, party, toon, leaderId, merger, **kw):
self.leaderId = leaderId
self.avName = toon.getName()
self.av = toon
self.avId = toon.doId
self.avDNA = toon.getStyle()
self.party = party
if merger:
2015-07-05 23:59:25 +00:00
text = TTLocalizer.BoardingInviteeMergeMessage % self.avName
2015-03-03 22:10:12 +00:00
else:
2015-07-05 23:59:25 +00:00
text = TTLocalizer.BoardingInviteeMessage % self.avName
2015-03-03 22:10:12 +00:00
style = TTDialog.TwoChoice
buttonTextList = [OTPLocalizer.FriendInviteeOK, OTPLocalizer.FriendInviteeNo]
command = self.__handleButton
optiondefs = (('dialogName', 'GroupInvitee', None),
('text', text, None),
('style', style, None),
('buttonTextList', buttonTextList, None),
('command', command, None),
('image_color', (1.0, 0.89, 0.77, 1.0), None),
('geom_scale', 0.2, None),
('geom_pos', (-0.1, 0, -0.025), None),
('pad', (0.075, 0.075), None),
('topPad', 0, None),
('midPad', 0, None),
('scale', 0.75, None))
self.defineoptions(kw, optiondefs)
ToonHeadDialog.ToonHeadDialog.__init__(self, self.avDNA)
self.initialiseoptions(GroupInvitee)
self.show()
return
def cleanup(self):
ToonHeadDialog.ToonHeadDialog.cleanup(self)
def forceCleanup(self):
self.party.requestRejectInvite(self.leaderId, self.avId)
self.cleanup()
def __handleButton(self, value):
place = base.cr.playGame.getPlace()
if value == DGG.DIALOG_OK and place and not place.getState() == 'elevator':
self.party.requestAcceptInvite(self.leaderId, self.avId)
else:
self.party.requestRejectInvite(self.leaderId, self.avId)
self.cleanup()