mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
Added Zach's shard page, and apparently he doesn't want his resources anymore.
This commit is contained in:
parent
7ca72d45e2
commit
8eb2b7bb82
5 changed files with 114 additions and 74 deletions
|
@ -2,7 +2,6 @@
|
|||
distribution dev
|
||||
|
||||
# Art assets:
|
||||
want-uplevel-res #t
|
||||
model-path ../resources/
|
||||
|
||||
# Server:
|
||||
|
|
|
@ -21,18 +21,14 @@ class DNABulkLoader:
|
|||
|
||||
def loadDNABulk(dnaStorage, file):
|
||||
dnaLoader = DNALoader.DNALoader()
|
||||
file = 'resources/' + file
|
||||
if config.GetBool('want-uplevel-res', False):
|
||||
file = '../resources/' + file
|
||||
file = '../resources/' + file
|
||||
dnaLoader.loadDNAFile(dnaStorage, file)
|
||||
dnaLoader.destroy()
|
||||
|
||||
def loadDNAFile(dnaStorage, file):
|
||||
print 'Reading DNA file...', file
|
||||
dnaLoader = DNALoader.DNALoader()
|
||||
file = 'resources/' + file
|
||||
if config.GetBool('want-uplevel-res', False):
|
||||
file = '../resources/' + file
|
||||
file = '../resources/' + file
|
||||
node = dnaLoader.loadDNAFile(dnaStorage, file)
|
||||
dnaLoader.destroy()
|
||||
if node.node().getNumChildren() > 0:
|
||||
|
@ -41,9 +37,7 @@ def loadDNAFile(dnaStorage, file):
|
|||
|
||||
def loadDNAFileAI(dnaStorage, file):
|
||||
dnaLoader = DNALoader.DNALoader()
|
||||
file = 'resources/' + file
|
||||
if config.GetBool('want-uplevel-res', False):
|
||||
file = '../resources/' + file
|
||||
file = '../resources/' + file
|
||||
data = dnaLoader.loadDNAFileAI(dnaStorage, file)
|
||||
dnaLoader.destroy()
|
||||
return data
|
||||
|
|
|
@ -39,8 +39,6 @@ class NameGenerator:
|
|||
self.nameDictionary = {}
|
||||
searchPath = DSearchPath()
|
||||
if __debug__:
|
||||
searchPath.appendDirectory(Filename('resources/phase_3/etc'))
|
||||
if config.GetBool('want-uplevel-res', False):
|
||||
searchPath.appendDirectory(Filename('../resources/phase_3/etc'))
|
||||
searchPath.appendDirectory(Filename('/phase_3/etc'))
|
||||
filename = Filename(TTLocalizer.NameShopNameMaster)
|
||||
|
|
|
@ -1086,8 +1086,6 @@ class NPCMoviePlayer(DirectObject.DirectObject):
|
|||
|
||||
searchPath = DSearchPath()
|
||||
if __debug__:
|
||||
searchPath.appendDirectory(Filename('resources/phase_3/etc'))
|
||||
if config.GetBool('want-uplevel-res', False):
|
||||
searchPath.appendDirectory(Filename('../resources/phase_3/etc'))
|
||||
searchPath.appendDirectory(Filename('/phase_3/etc'))
|
||||
scriptFile = Filename('QuestScripts.txt')
|
||||
|
|
|
@ -5,6 +5,8 @@ from pandac.PandaModules import *
|
|||
from toontown.distributed import ToontownDistrictStats
|
||||
from toontown.hood import ZoneUtil
|
||||
from toontown.shtiker import ShtikerPage
|
||||
from toontown.suit import SuitDNA
|
||||
from toontown.suit import Suit
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toontowngui import TTDialog
|
||||
|
@ -51,8 +53,8 @@ def setupInvasionMarker(node, invasionStatus):
|
|||
icons.removeNode()
|
||||
|
||||
icon.setColor(ICON_COLORS[invasionStatus - 1])
|
||||
icon.setPos(0.54, 0, 0.015)
|
||||
icon.setScale(0.053)
|
||||
icon.setPos(0.50, 0, 0.01225)
|
||||
icon.setScale(0.0535)
|
||||
|
||||
def removeInvasionMarker(node):
|
||||
markerNode = node.find('**/*invasion-marker')
|
||||
|
@ -66,10 +68,11 @@ class ShardPage(ShtikerPage.ShtikerPage):
|
|||
|
||||
def __init__(self):
|
||||
ShtikerPage.ShtikerPage.__init__(self)
|
||||
|
||||
self.shardButtonMap = {}
|
||||
self.shardButtons = []
|
||||
self.scrollList = None
|
||||
self.currentBTL = None
|
||||
self.currentBTR = None
|
||||
self.textRolloverColor = Vec4(1, 1, 0, 1)
|
||||
self.textDownColor = Vec4(0.5, 0.9, 1, 1)
|
||||
self.textDisabledColor = Vec4(0.4, 0.8, 0.4, 1)
|
||||
|
@ -88,8 +91,10 @@ class ShardPage(ShtikerPage.ShtikerPage):
|
|||
helpText_ycoord = 0.403
|
||||
self.helpText = DirectLabel(parent=self, relief=None, text='', text_scale=main_text_scale, text_wordwrap=12, text_align=TextNode.ALeft, textMayChange=1, pos=(0.058, 0, helpText_ycoord))
|
||||
shardPop_ycoord = helpText_ycoord - 0.523
|
||||
totalPop_ycoord = shardPop_ycoord - 0.26
|
||||
self.totalPopulationText = DirectLabel(parent=self, relief=None, text=TTLocalizer.ShardPagePopulationTotal % 1, text_scale=main_text_scale, text_wordwrap=8, textMayChange=1, text_align=TextNode.ACenter, pos=(0.38, 0, totalPop_ycoord))
|
||||
totalPop_ycoord = shardPop_ycoord - 0.35
|
||||
self.districtInfo = NodePath('Selected-Shard-Info')
|
||||
self.districtInfo.reparentTo(self)
|
||||
self.totalPopulationText = DirectLabel(parent=self.districtInfo, relief=None, text=TTLocalizer.ShardPagePopulationTotal % 1, text_scale=main_text_scale, text_wordwrap=8, textMayChange=1, text_align=TextNode.ACenter, pos=(0.4247, 0, totalPop_ycoord))
|
||||
if self.showTotalPop:
|
||||
self.totalPopulationText.show()
|
||||
else:
|
||||
|
@ -100,12 +105,25 @@ class ShardPage(ShtikerPage.ShtikerPage):
|
|||
self.listZorigin = -0.96
|
||||
self.listFrameSizeZ = 1.04
|
||||
self.arrowButtonScale = 1.3
|
||||
self.itemFrameXorigin = -0.237
|
||||
self.itemFrameXorigin = -0.247
|
||||
self.itemFrameZorigin = 0.365
|
||||
self.buttonXstart = self.itemFrameXorigin + 0.293
|
||||
self.regenerateScrollList()
|
||||
scrollTitle = DirectFrame(parent=self.scrollList, text=TTLocalizer.ShardPageScrollTitle, text_scale=main_text_scale, text_align=TextNode.ACenter, relief=None, pos=(self.buttonXstart, 0, self.itemFrameZorigin + 0.127))
|
||||
|
||||
def firstLoadShard(self, buttonTuple):
|
||||
curShardTuples = base.cr.listActiveShards()
|
||||
curShardTuples.sort(compareShardTuples)
|
||||
actualShardId = base.localAvatar.defaultShard
|
||||
for i in xrange(len(curShardTuples)):
|
||||
shardId, name, pop, WVPop, invasionStatus = curShardTuples[i]
|
||||
if shardId == actualShardId:
|
||||
self.currentBTL = buttonTuple[1]
|
||||
self.currentBTR = buttonTuple[2]
|
||||
self.currentBTL['state'] = DGG.DISABLED
|
||||
self.currentBTR['state'] = DGG.DISABLED
|
||||
self.reloadRightBrain(pop, name, shardId, buttonTuple)
|
||||
|
||||
def unload(self):
|
||||
self.gui.removeNode()
|
||||
del self.title
|
||||
|
@ -126,13 +144,13 @@ class ShardPage(ShtikerPage.ShtikerPage):
|
|||
self.scrollList.destroy()
|
||||
self.scrollList = None
|
||||
|
||||
self.scrollList = DirectScrolledList(parent=self, relief=None, pos=(-0.5, 0, 0), incButton_image=(self.gui.find('**/FndsLst_ScrollUp'),
|
||||
self.scrollList = DirectScrolledList(parent=self, relief=None, pos=(-0.51, 0, 0), incButton_image=(self.gui.find('**/FndsLst_ScrollUp'),
|
||||
self.gui.find('**/FndsLst_ScrollDN'),
|
||||
self.gui.find('**/FndsLst_ScrollUp_Rllvr'),
|
||||
self.gui.find('**/FndsLst_ScrollUp')), incButton_relief=None, incButton_scale=(self.arrowButtonScale, self.arrowButtonScale, -self.arrowButtonScale), incButton_pos=(self.buttonXstart, 0, self.itemFrameZorigin - 0.999), incButton_image3_color=Vec4(1, 1, 1, 0.2), decButton_image=(self.gui.find('**/FndsLst_ScrollUp'),
|
||||
self.gui.find('**/FndsLst_ScrollUp')), incButton_relief=None, incButton_scale=(self.arrowButtonScale, self.arrowButtonScale, -self.arrowButtonScale), incButton_pos=(self.buttonXstart + 0.005, 0, self.itemFrameZorigin - 1.000), incButton_image3_color=Vec4(1, 1, 1, 0.2), decButton_image=(self.gui.find('**/FndsLst_ScrollUp'),
|
||||
self.gui.find('**/FndsLst_ScrollDN'),
|
||||
self.gui.find('**/FndsLst_ScrollUp_Rllvr'),
|
||||
self.gui.find('**/FndsLst_ScrollUp')), decButton_relief=None, decButton_scale=(self.arrowButtonScale, self.arrowButtonScale, self.arrowButtonScale), decButton_pos=(self.buttonXstart, 0, self.itemFrameZorigin + 0.227), decButton_image3_color=Vec4(1, 1, 1, 0.2), itemFrame_pos=(self.itemFrameXorigin, 0, self.itemFrameZorigin), itemFrame_scale=1.0, itemFrame_relief=DGG.SUNKEN, itemFrame_frameSize=(self.listXorigin,
|
||||
self.gui.find('**/FndsLst_ScrollUp')), decButton_relief=None, decButton_scale=(self.arrowButtonScale, self.arrowButtonScale, self.arrowButtonScale), decButton_pos=(self.buttonXstart, 0.0025, self.itemFrameZorigin + 0.130), decButton_image3_color=Vec4(1, 1, 1, 0.2), itemFrame_pos=(self.itemFrameXorigin, 0, self.itemFrameZorigin), itemFrame_scale=1.0, itemFrame_relief=DGG.SUNKEN, itemFrame_frameSize=(self.listXorigin,
|
||||
self.listXorigin + self.listFrameSizeX,
|
||||
self.listZorigin,
|
||||
self.listZorigin + self.listFrameSizeZ), itemFrame_frameColor=(0.85, 0.95, 1, 1), itemFrame_borderWidth=(0.01, 0.01), numItemsVisible=15, forceHeight=0.065, items=self.shardButtons)
|
||||
|
@ -145,49 +163,70 @@ class ShardPage(ShtikerPage.ShtikerPage):
|
|||
|
||||
def makeShardButton(self, shardId, shardName, shardPop):
|
||||
shardButtonParent = DirectFrame()
|
||||
shardButtonL = DirectButton(parent=shardButtonParent, relief=None, text=shardName, text_scale=0.06, text_align=TextNode.ALeft, text1_bg=self.textDownColor, text2_bg=self.textRolloverColor, text3_fg=self.textDisabledColor, textMayChange=0, command=self.getPopChoiceHandler(shardPop), extraArgs=[shardId])
|
||||
shardButtonL = DirectButton(parent=shardButtonParent, relief=None, text=shardName, text_scale=0.06, text_align=TextNode.ALeft, text_fg=Vec4(0, 0, 0, 1), text3_fg=self.textDisabledColor, text1_bg=self.textDownColor, text2_bg=self.textRolloverColor, textMayChange=0, command=self.reloadRightBrain)
|
||||
popText = str(shardPop)
|
||||
if popText is None:
|
||||
popText = ''
|
||||
model = loader.loadModel('phase_3.5/models/gui/matching_game_gui')
|
||||
button = model.find('**/minnieCircle')
|
||||
|
||||
if self.showPop:
|
||||
popText = str(shardPop)
|
||||
|
||||
if shardPop == None:
|
||||
popText = ''
|
||||
|
||||
shardButtonR = DirectButton(parent=shardButtonParent, relief=None,
|
||||
text=popText, text_scale=0.06,
|
||||
text_align=TextNode.ALeft,
|
||||
text1_bg=self.textDownColor,
|
||||
text2_bg=self.textRolloverColor,
|
||||
text3_fg=self.textDisabledColor,
|
||||
textMayChange=1, pos=(0.5, 0, 0),
|
||||
command=self.choseShard,
|
||||
extraArgs=[shardId])
|
||||
|
||||
else:
|
||||
model = loader.loadModel('phase_3.5/models/gui/matching_game_gui')
|
||||
button = model.find('**/minnieCircle')
|
||||
shardButtonR = DirectButton(parent=shardButtonParent, relief=None,
|
||||
image=button, image_scale=(0.3, 1, 0.3),
|
||||
image2_scale=(0.35, 1, 0.35),
|
||||
image_color=self.getPopColor(shardPop),
|
||||
pos=(0.6, 0, 0.0125),
|
||||
text=self.getPopText(shardPop),
|
||||
text_scale=0.06,
|
||||
text_align=TextNode.ACenter,
|
||||
text_pos=(-0.0125, -0.0125),
|
||||
text_fg=Vec4(0, 0, 0, 0),
|
||||
text1_fg=Vec4(0, 0, 0, 0),
|
||||
text2_fg=Vec4(0, 0, 0, 1),
|
||||
text3_fg=Vec4(0, 0, 0, 0),
|
||||
command=self.getPopChoiceHandler(shardPop),
|
||||
extraArgs=[shardId])
|
||||
model.removeNode()
|
||||
button.removeNode()
|
||||
shardButtonR = DirectButton(parent=shardButtonParent, relief=None,
|
||||
image=button,
|
||||
image_scale=(0.3, 1, 0.3),
|
||||
image2_scale=(0.35, 1, 0.35),
|
||||
image_color=self.getPopColor(shardPop),
|
||||
pos=(0.58, 0, 0.0125),
|
||||
text=popText,
|
||||
text_scale=0.06,
|
||||
text_align=TextNode.ACenter,
|
||||
text_pos=(-0.215, -0.0165), text_fg=Vec4(0, 0, 0, 1), text3_fg=self.textDisabledColor, text1_bg=self.textRolloverColor, text2_bg=self.textRolloverColor, textMayChange=1, command=self.reloadRightBrain)
|
||||
model.removeNode()
|
||||
button.removeNode()
|
||||
|
||||
invasionMarker = NodePath('InvasionMarker-%s' % shardId)
|
||||
invasionMarker.reparentTo(shardButtonParent)
|
||||
|
||||
return (shardButtonParent, shardButtonR, shardButtonL, invasionMarker)
|
||||
buttonTuple = (shardButtonParent, shardButtonR, shardButtonL, invasionMarker)
|
||||
shardButtonL['extraArgs'] = extraArgs=[shardPop, shardName, shardId, buttonTuple]
|
||||
shardButtonR['extraArgs'] = extraArgs=[shardPop, shardName, shardId, buttonTuple]
|
||||
|
||||
return buttonTuple
|
||||
|
||||
def removeRightBrain(self):
|
||||
self.districtInfo.find('**/*district-info').removeNode()
|
||||
|
||||
def reloadRightBrain(self, shardPop, shardName, shardId, buttonTuple):
|
||||
if not self.districtInfo:
|
||||
return
|
||||
if self.districtInfo.find('**/*district-info'):
|
||||
self.removeRightBrain()
|
||||
if self.currentBTL:
|
||||
self.currentBTL['state'] = DGG.NORMAL
|
||||
if self.currentBTR:
|
||||
self.currentBTR['state'] = DGG.NORMAL
|
||||
popText = self.getPopText(shardPop)
|
||||
districtInfoNode = self.districtInfo.attachNewNode('district-info')
|
||||
self.districtStatusLabel = DirectLabel(parent=districtInfoNode, relief=None, pos=(0.4247, 0, 0.40), text=popText, text_scale=0.09, text_fg=Vec4(0, 0, 0, 1), textMayChange=1)
|
||||
pText = '%s Population: %s' % (shardName, str(shardPop))
|
||||
self.populationStatusLabel = DirectLabel(parent=districtInfoNode, relief=None, pos=(0.4247, 0, 0.33), text=pText, text_scale=0.04, text_fg=Vec4(0, 0, 0, 1), textMayChange=1)
|
||||
tText = 'Teleport to\n%s' % shardName
|
||||
tImage = loader.loadModel('phase_4/models/gui/purchase_gui')
|
||||
tImage.setSz(1.35)
|
||||
self.shardTeleportButton = DirectButton(parent=districtInfoNode, relief=None, pos=(0.4247, 0, -0.15), image=(tImage.find('**/PurchScrn_BTN_UP'), tImage.find('**/PurchScrn_BTN_DN'), tImage.find('**/PurchScrn_BTN_RLVR')), text=tText, text_scale=0.065, text_pos=(0.0, 0.015), text_fg=Vec4(0, 0, 0, 1), textMayChange=1, command=self.choseShard, extraArgs=[shardId])
|
||||
|
||||
self.currentBTL = buttonTuple[1]
|
||||
self.currentBTR = buttonTuple[2]
|
||||
self.currentBTL['state'] = DGG.DISABLED
|
||||
self.currentBTR['state'] = DGG.DISABLED
|
||||
|
||||
if shardId == self.getCurrentShardId():
|
||||
self.shardTeleportButton['state'] = DGG.DISABLED
|
||||
|
||||
## suitHead = NodePath('CogHead-%s' % shardName)
|
||||
## head = self.createSuitHead()
|
||||
## head.reparentTo(suitHead)
|
||||
## suitHead.reparentTo(self.districtInfo)
|
||||
## suitHead.setPos(0.4247, 0, 0.2)
|
||||
|
||||
def getPopColor(self, pop):
|
||||
if pop <= self.lowPop:
|
||||
|
@ -237,6 +276,22 @@ class ShardPage(ShtikerPage.ShtikerPage):
|
|||
else:
|
||||
return base.localAvatar.defaultShard
|
||||
|
||||
def createSuitHead(self, suitName):
|
||||
suitDNA = SuitDNA.SuitDNA()
|
||||
suitDNA.newSuit(suitName)
|
||||
suit = Suit.Suit()
|
||||
suit.setDNA(suitDNA)
|
||||
headParts = suit.getHeadParts()
|
||||
head = hidden.attachNewNode('head')
|
||||
for part in headParts:
|
||||
copyPart = part.copyTo(head)
|
||||
copyPart.setDepthTest(1)
|
||||
copyPart.setDepthWrite(1)
|
||||
self.fitGeometry(head, fFlip=1)
|
||||
suit.delete()
|
||||
suit = None
|
||||
return head
|
||||
|
||||
def updateScrollList(self):
|
||||
curShardTuples = base.cr.listActiveShards()
|
||||
curShardTuples.sort(compareShardTuples)
|
||||
|
@ -266,23 +321,16 @@ class ShardPage(ShtikerPage.ShtikerPage):
|
|||
buttonTuple = self.makeShardButton(shardId, name, pop)
|
||||
self.shardButtonMap[shardId] = buttonTuple
|
||||
anyChanges = 1
|
||||
elif self.showPop:
|
||||
buttonTuple[1]['text'] = str(pop)
|
||||
else:
|
||||
buttonTuple[1]['image_color'] = self.getPopColor(pop)
|
||||
buttonTuple[1]['text'] = self.getPopText(pop)
|
||||
buttonTuple[1]['command'] = self.getPopChoiceHandler(pop)
|
||||
buttonTuple[2]['command'] = self.getPopChoiceHandler(pop)
|
||||
buttonTuple[1]['text'] = str(pop)
|
||||
buttonTuple[1]['command'] = self.reloadRightBrain
|
||||
buttonTuple[1]['extraArgs'] = [pop, name, shardId, buttonTuple]
|
||||
buttonTuple[2]['command'] = self.reloadRightBrain
|
||||
buttonTuple[2]['extraArgs'] = [pop, name, shardId, buttonTuple]
|
||||
|
||||
self.shardButtons.append(buttonTuple[0])
|
||||
|
||||
if shardId == currentShardId or self.book.safeMode:
|
||||
buttonTuple[1]['state'] = DGG.DISABLED
|
||||
buttonTuple[2]['state'] = DGG.DISABLED
|
||||
else:
|
||||
buttonTuple[1]['state'] = DGG.NORMAL
|
||||
buttonTuple[2]['state'] = DGG.NORMAL
|
||||
|
||||
if invasionStatus:
|
||||
setupInvasionMarker(buttonTuple[3], invasionStatus)
|
||||
else:
|
||||
|
@ -316,11 +364,14 @@ class ShardPage(ShtikerPage.ShtikerPage):
|
|||
if buttonTuple:
|
||||
i = self.shardButtons.index(buttonTuple[0])
|
||||
self.scrollList.scrollTo(i, centered=1)
|
||||
|
||||
self.firstLoadShard(buttonTuple)
|
||||
ShtikerPage.ShtikerPage.enter(self)
|
||||
self.accept('shardInfoUpdated', self.updateScrollList)
|
||||
|
||||
def exit(self):
|
||||
for shardId, buttonTuple in self.shardButtonMap.items():
|
||||
buttonTuple[1]['state'] = DGG.NORMAL
|
||||
buttonTuple[2]['state'] = DGG.NORMAL
|
||||
self.ignore('shardInfoUpdated')
|
||||
self.ignore('ShardPageConfirmDone')
|
||||
taskMgr.remove('ShardPageUpdateTask-doLater')
|
||||
|
|
Loading…
Reference in a new issue