示例#1
0
 def ApplyAttributes(self, attributes):
     BaseCharacterCreationStep.ApplyAttributes(self, attributes)
     self.isSerenity = boot.region == 'optic'
     self.namesChecked = {}
     self.schoolInfo = {}
     self.ancestryInfo = {}
     self.ancestryConts = {}
     self.schoolConts = {}
     self.checkingName = 0
     self.startAncestryHeight = 180
     self.startEducationHeight = 180
     self.padValue = 16
     self.SetupAncestrySection()
     self.SetupEducationSection()
     self.SetupNameSection()
     self.sr.portraitCont = uiprimitives.Container(name='portraitCont',
                                                   parent=self.sr.leftSide,
                                                   align=uiconst.CENTERTOP,
                                                   pos=(0, 128, 128, 128))
     uicontrols.Frame(parent=self.sr.portraitCont,
                      color=ccConst.COLOR + (0.3, ))
     self.sr.facePortrait = uicontrols.Icon(parent=self.sr.portraitCont,
                                            idx=1,
                                            align=uiconst.TOALL)
     photo = uicore.layer.charactercreation.GetActivePortrait()
     if photo is not None:
         self.sr.facePortrait.texture.atlasTexture = photo
         self.sr.facePortrait.texture.atlasTexture.Reload()
     self.UpdateLayout()
示例#2
0
 def ApplyAttributes(self, attributes):
     BaseCharacterCreationStep.ApplyAttributes(self, attributes)
     self.colorPaletteWidth = uicls.CCColorPalette.COLORPALETTEWIDTH
     self.portraitSize = 128
     self.selectedPortrait = 0
     self.sr.assetMenuPar = uiprimitives.Container(
         parent=self.sr.rightSide,
         pos=(0, 0, MAXMENUSIZE, uicore.desktop.height),
         state=uiconst.UI_PICKCHILDREN,
         align=uiconst.CENTERTOP)
     self.sr.hintBox = uiprimitives.Container(parent=self.sr.assetMenuPar,
                                              pos=(MAXMENUSIZE, 20, 200,
                                                   150),
                                              align=uiconst.TOPRIGHT,
                                              state=uiconst.UI_DISABLED)
     self.sr.hintText = uicontrols.EveLabelMedium(text='',
                                                  parent=self.sr.hintBox,
                                                  align=uiconst.TOTOP)
     self.UpdateLayout()
示例#3
0
    def ApplyAttributes(self, attributes):
        BaseCharacterCreationStep.ApplyAttributes(self, attributes)
        self.bloodlineInfo = {}
        self.bloodlineIDs = []
        self.bloodlineBtns = []
        info = self.GetInfo()
        self.raceID = info.raceID
        self.bloodlineID = info.bloodlineID
        self.hoveredBloodlineID = None
        self.isFemaleLeft = False
        self.sr.rightSide.width = self.sr.leftSide.width
        bloodlines = sm.GetService('cc').GetBloodlineDataByRaceID().get(
            self.raceID, [])[:]
        for bloodline in bloodlines:
            self.bloodlineIDs.append(bloodline.bloodlineID)

        self.sr.raceInfoCont = uiprimitives.Container(
            name='raceInfoCont',
            parent=self.sr.uiContainer,
            align=uiconst.CENTERTOP,
            width=600,
            height=uicore.desktop.height,
            state=uiconst.UI_PICKCHILDREN)
        self.sr.textCont = uiprimitives.Container(name='raceCont',
                                                  parent=self.sr.raceInfoCont,
                                                  align=uiconst.TOTOP,
                                                  pos=(0, 38, 0, 20),
                                                  state=uiconst.UI_DISABLED)
        self.sr.header = uicls.CCLabel(text=localization.GetByLabel(
            'UI/CharacterCreation/BloodlineSelection'),
                                       name='header',
                                       parent=self.sr.textCont,
                                       align=uiconst.CENTERTOP,
                                       uppercase=1,
                                       letterspace=2,
                                       color=(0.9, 0.9, 0.9, 0.8),
                                       fontsize=22,
                                       bold=False)
        if uicore.desktop.height <= 900:
            top = 20
        else:
            top = 40
        self.sr.raceCont = uiprimitives.Container(name='raceCont',
                                                  parent=self.sr.raceInfoCont,
                                                  align=uiconst.TOTOP,
                                                  pos=(0, top, 0, 80),
                                                  state=uiconst.UI_DISABLED)
        self.raceSprite = uiprimitives.Sprite(name='raceSprite',
                                              parent=self.sr.raceCont,
                                              align=uiconst.CENTER,
                                              state=uiconst.UI_HIDDEN,
                                              texturePath=self.raceHeaderPath,
                                              pos=(0, 0, 512, 128))
        self.raceSprite.state = uiconst.UI_DISABLED
        height = 128
        top = self.racialHeader.get(self.raceID, None)
        self.raceSprite.rectTop, self.raceSprite.rectHeight = top, height
        for bloodlineID in self.bloodlineIDs:
            cont = uiprimitives.Container(name='cont',
                                          parent=self.sr.uiContainer,
                                          align=uiconst.TOPLEFT,
                                          pos=(0, 0, 300, 200),
                                          state=uiconst.UI_HIDDEN)
            contName = 'cont_%d' % bloodlineID
            setattr(self.sr, contName, cont)
            contGender = uiprimitives.Container(name='contGender',
                                                parent=cont,
                                                align=uiconst.CENTERBOTTOM,
                                                pos=(0, 4, 255, 64))
            contGenderName = 'contGender_%d' % bloodlineID
            setattr(self.sr, contGenderName, contGender)
            genderBtnFemale = GenderButton(name='GenderButton',
                                           parent=contGender,
                                           align=uiconst.BOTTOMLEFT,
                                           pos=(0, 0, 64, 64),
                                           genderID=0,
                                           raceID=self.raceID,
                                           state=uiconst.UI_HIDDEN)
            btnName = 'genderBtn_%d_%d' % (bloodlineID, 0)
            setattr(self.sr, btnName, genderBtnFemale)
            genderBtnMale = GenderButton(name='GenderButton',
                                         parent=contGender,
                                         align=uiconst.BOTTOMRIGHT,
                                         pos=(0, 0, 64, 64),
                                         genderID=1,
                                         raceID=self.raceID,
                                         state=uiconst.UI_HIDDEN)
            btnName = 'genderBtn_%d_%d' % (bloodlineID, 1)
            setattr(self.sr, btnName, genderBtnMale)
            btn = BloodlineButton(
                name='BloodlineButton',
                parent=cont,
                align=uiconst.CENTER,
                pos=(0, 0, 128, 128),
                bloodlineID=bloodlineID,
                mouseExitCallback=self.ResetHoverRaceID,
                mouseEnterCallback=self.HiliteCorrectBloodlines)
            btnName = 'bloodlineBtn_%d' % bloodlineID
            setattr(self.sr, btnName, btn)
            self.bloodlineBtns.append(btn)
            if info.bloodlineID and info.bloodlineID == bloodlineID:
                btn.Select()
                genderBtnFemale.state = uiconst.UI_NORMAL
                genderBtnMale.state = uiconst.UI_NORMAL
                if info.genderID is not None:
                    canChangeGender = uicore.layer.charactercreation.CanChangeGender(
                    )
                    if info.genderID == ccConst.GENDERID_FEMALE:
                        genderBtnFemale.Select()
                        if not canChangeGender:
                            genderBtnMale.state = uiconst.UI_HIDDEN
                    else:
                        genderBtnMale.Select()
                        if not canChangeGender:
                            genderBtnFemale.state = uiconst.UI_HIDDEN

        self.sr.bloodlineTextCont = uiprimitives.Container(
            name='bloodlineTextCont',
            parent=self.sr.uiContainer,
            align=uiconst.TOBOTTOM,
            height=80,
            top=64,
            state=uiconst.UI_NORMAL)
        self.sr.bloodlineText = uicls.CCLabel(parent=self.sr.bloodlineTextCont,
                                              fontsize=12,
                                              align=uiconst.BOTTOMLEFT,
                                              width=600,
                                              text='',
                                              letterspace=0,
                                              top=0,
                                              bold=0)
        if info.bloodlineID:
            self.GetBloodlineText()
 def ApplyAttributes(self, attributes):
     uicore.event.RegisterForTriuiEvents(uiconst.UI_ACTIVE,
                                         self.CheckAppFocus)
     BaseCharacterCreationStep.ApplyAttributes(self, attributes)
     info = self.GetInfo()
     self.menuMode = self.ASSETMENU
     self.charID = attributes.charID
     self.colorPaletteWidth = uicls.CCColorPalette.COLORPALETTEWIDTH
     self.tattooChangeMade = 0
     self.menusInitialized = 0
     self.sr.leftSide.width = 200
     self.sr.headBodyPicker = uicls.CCHeadBodyPicker(
         name='headBodyPicker',
         parent=self.sr.leftSide,
         align=uiconst.CENTERTOP,
         top=98,
         headCallback=self.LoadFaceMode,
         bodyCallback=self.LoadBodyMode)
     clickable = uicore.layer.charactercreation.CanChangeBloodline()
     if clickable and not uicore.layer.charactercreation.CanChangeGender():
         disabledHex = ['gender']
     else:
         disabledHex = []
     picker = uicls.CCRacePicker(parent=self.sr.uiContainer,
                                 align=uiconst.BOTTOMLEFT,
                                 raceID=info.raceID,
                                 bloodlineID=info.bloodlineID,
                                 genderID=info.genderID,
                                 padding=(30, 0, 0, -8),
                                 clickable=clickable,
                                 disabledHex=disabledHex)
     self.sr.assetMenuPar = uiprimitives.Container(
         parent=self.sr.rightSide,
         name='assetMenuPar',
         pos=(0, 0, MAXMENUSIZE, uicore.desktop.height),
         state=uiconst.UI_PICKCHILDREN,
         align=uiconst.CENTERTOP)
     self.sr.hintBox = uiprimitives.Container(parent=self.sr.assetMenuPar,
                                              pos=(0, 20, 200, 150),
                                              align=uiconst.TOPRIGHT,
                                              state=uiconst.UI_DISABLED)
     self.sr.hintText = uicontrols.EveLabelMedium(text='',
                                                  parent=self.sr.hintBox,
                                                  align=uiconst.TOTOP)
     self.sr.randomButton = uiprimitives.Transform(
         parent=self.sr.headBodyPicker,
         pos=(-52, 34, 22, 22),
         state=uiconst.UI_NORMAL,
         align=uiconst.CENTERTOP,
         hint=localization.GetByLabel('UI/CharacterCreation/RandomizeAll'),
         idx=0)
     self.sr.randomButton.OnClick = self.RandomizeCharacter
     self.sr.randomButton.OnMouseEnter = (self.OnGenericMouseEnter,
                                          self.sr.randomButton)
     self.sr.randomButton.OnMouseExit = (self.OnGenericMouseExit,
                                         self.sr.randomButton)
     randIcon = uicontrols.Icon(parent=self.sr.randomButton,
                                icon=ccConst.ICON_RANDOM,
                                state=uiconst.UI_DISABLED,
                                align=uiconst.CENTER,
                                color=ccConst.COLOR50)
     self.sr.randomButton.sr.icon = randIcon
     self.sr.toggleClothesButton = uiprimitives.Container(
         parent=self.sr.headBodyPicker,
         pos=(52, 32, 26, 26),
         state=uiconst.UI_NORMAL,
         align=uiconst.CENTERTOP,
         hint=localization.GetByLabel('UI/CharacterCreation/ToggleClothes'),
         idx=0)
     toggleIcon = uicontrols.Icon(parent=self.sr.toggleClothesButton,
                                  icon=ccConst.ICON_TOGGLECLOTHES,
                                  state=uiconst.UI_DISABLED,
                                  align=uiconst.CENTER,
                                  color=ccConst.COLOR50)
     self.sr.toggleClothesButton.OnClick = self.ToggleClothes
     self.sr.toggleClothesButton.OnMouseEnter = (
         self.OnGenericMouseEnter, self.sr.toggleClothesButton)
     self.sr.toggleClothesButton.OnMouseExit = (self.OnGenericMouseExit,
                                                self.sr.toggleClothesButton)
     self.sr.toggleClothesButton.sr.icon = toggleIcon
     self.UpdateLayout()
     self.StartLoadingThread()
示例#5
0
    def ApplyAttributes(self, attributes):
        self.raceInfo = {}
        self.bloodlineInfo = {}
        self.movieStateCheckRunning = 0
        self.padValue = 6
        self.raceID = None
        self.hoveredRaceID = None
        BaseCharacterCreationStep.ApplyAttributes(self, attributes)
        info = self.GetInfo()
        if uicore.desktop.width <= 1360:
            fontsize = 12
        else:
            fontsize = 14
        self.sr.raceInfoCont = uiprimitives.Container(
            name='raceInfoCont',
            parent=self.sr.uiContainer,
            align=uiconst.CENTERTOP,
            width=600,
            height=uicore.desktop.height,
            state=uiconst.UI_PICKCHILDREN)
        self.sr.textCont = uiprimitives.Container(name='raceCont',
                                                  parent=self.sr.raceInfoCont,
                                                  align=uiconst.TOTOP,
                                                  pos=(0, 38, 0, 20),
                                                  state=uiconst.UI_NORMAL)
        header = uicls.CCLabel(
            text=localization.GetByLabel('UI/CharacterCreation/RaceSelection'),
            name='header',
            parent=self.sr.textCont,
            align=uiconst.CENTERTOP,
            uppercase=1,
            letterspace=2,
            color=(0.9, 0.9, 0.9, 0.8),
            fontsize=22,
            bold=False)
        self.sr.raceCont = uiprimitives.Container(name='raceCont',
                                                  parent=self.sr.raceInfoCont,
                                                  align=uiconst.TOTOP,
                                                  pos=(0, 40, 0, 80),
                                                  state=uiconst.UI_HIDDEN)
        self.raceSprite = uiprimitives.Sprite(name='raceSprite',
                                              parent=self.sr.raceCont,
                                              align=uiconst.CENTER,
                                              state=uiconst.UI_DISABLED,
                                              texturePath=self.raceHeaderPath,
                                              pos=(0, 0, 512, 128))
        uiprimitives.Container(name='push',
                               parent=self.sr.raceInfoCont,
                               align=uiconst.TOTOP,
                               pos=(0, 0, 0, 15),
                               state=uiconst.UI_DISABLED)
        self.sr.movieCont = uiprimitives.Container(name='movieCont',
                                                   parent=self.sr.raceInfoCont,
                                                   align=uiconst.TOTOP,
                                                   pos=(0, 0, 0, 338),
                                                   state=uiconst.UI_HIDDEN)
        self.sr.raceTextCont = uiprimitives.Container(
            name='raceTextCont',
            parent=self.sr.raceInfoCont,
            align=uiconst.TOTOP,
            padding=(0, 15, 0, self.padValue),
            state=uiconst.UI_HIDDEN)
        self.sr.raceText = uicls.CCLabel(parent=self.sr.raceTextCont,
                                         fontsize=fontsize,
                                         align=uiconst.TOPLEFT,
                                         text='',
                                         letterspace=0,
                                         top=0,
                                         pos=(0, 0, 600, 0),
                                         bold=0,
                                         color=ccConst.COLOR75)
        self.sr.buttonCont = uiprimitives.Container(parent=self.sr.uiContainer,
                                                    align=uiconst.CENTERBOTTOM,
                                                    pos=(0, 60, 512, 128))
        self.raceBtns = []
        for race in sm.GetService('cc').GetRaceData(shuffleFirstTime=True):
            raceBtn = RaceButton(name='raceBtn',
                                 parent=self.sr.buttonCont,
                                 align=uiconst.TOLEFT,
                                 pos=(0, 0, 128, 128),
                                 raceID=race.raceID,
                                 mouseExitCallback=self.ResetHoverRaceID)
            btnName = 'raceBtn_%s' % race.raceID
            self.raceBtns.append(raceBtn)
            setattr(self.sr, btnName, raceBtn)
            if info.raceID and info.raceID == race.raceID:
                raceBtn.Select()

        if info.raceID:
            self.raceID = info.raceID
            self.UpdateRaceHeader(info.raceID)
            self.GetRaceText()
        uicontrols.Frame(parent=self.sr.movieCont, color=(1.0, 1.0, 1.0, 0.2))
        self.sr.racialImage = uiprimitives.Sprite(name='racialImage',
                                                  parent=self.sr.movieCont,
                                                  align=uiconst.TOALL,
                                                  state=uiconst.UI_DISABLED)
        self.sr.movieCont.OnMouseEnter = self.OnMovieEnter
        self.movie = StreamingVideoSprite(parent=self.sr.movieCont,
                                          pos=(0, 0, 600, 338),
                                          videoPath=self.racialMovies.get(
                                              info.raceID, ''),
                                          videoAutoPlay=False)
        self.movie.display = False
        self.sr.movieControlCont = uiprimitives.Container(
            name='controlCont',
            parent=self.sr.movieCont,
            align=uiconst.CENTERBOTTOM,
            pos=(0, 0, 60, 22),
            idx=0,
            state=uiconst.UI_HIDDEN)
        uiprimitives.Fill(parent=self.sr.movieControlCont,
                          padding=(0, 0, 0, 1),
                          color=(0, 0, 0, 0.3))
        self.UpdateLayout()
        buttons = [('playpPauseBtn', 4, 'ui_73_16_225', self.ClickPlayPause),
                   ('soundBtn', 40, 'ui_73_16_230', self.ClickSound),
                   ('noSoundBtn', 40, 'ui_38_16_111', self.ClickSound)]
        for name, left, iconPath, function in buttons:
            icon = uicontrols.Icon(parent=self.sr.movieControlCont,
                                   align=uiconst.TOPLEFT,
                                   state=uiconst.UI_NORMAL,
                                   pos=(left, 2, 16, 16),
                                   icon=iconPath,
                                   idx=0)
            icon.OnClick = function
            icon.OnMouseEnter = (self.MouseOverButton, icon)
            icon.OnMouseExit = (self.MouseExitButton, icon)
            icon.SetAlpha(0.5)
            self.sr.Set(name, icon)

        self.sr.noSoundBtn.state = uiconst.UI_HIDDEN
        self.setupDone = 1
        self.TryPlayMovie()