Esempio n. 1
0
    def ApplyAttributes(self, attributes):
        for each in uicore.layer.main.children:
            if each.name == self.default_name:
                each.Close()

        uicls.Container.ApplyAttributes(self, attributes)
        if attributes.parent is None:
            uicore.layer.main.children.append(self)
        self.onPreSetValueCallback = None
        self.onSetValueCallback = None
        self.onChangeFocusCallback = None
        self._activeData = None
        self._lastBrowseDiff = False
        self._lastSpringValue = None
        self._initMouseDownX = None
        self._doBlock = False
        self._availableTypeIDs = set()
        if session.role & service.ROLE_CONTENT:
            invCache = sm.GetService('invCache')
            if session.stationid:
                try:
                    inv = invCache.GetInventory(const.containerHangar)
                    self._availableTypeIDs.update({i.typeID for i in inv.List() if i.categoryID == const.categoryApparel})
                except Exception as e:
                    log.LogWarn()

            if session.charid:
                try:
                    inv = invCache.GetInventoryFromId(session.charid)
                    self._availableTypeIDs.update({i.typeID for i in inv.List() if i.flagID == const.flagWardrobe})
                except Exception as e:
                    log.LogWarn()

        self.zoomFactor = attributes.get('zoomFactor', 6.0)
        self.imageWidth = attributes.get('imageWidth', 128)
        self.imageHeight = attributes.get('imageHeight', 128)
        self.browserWidth = attributes.get('browserWidth', 400)
        self.numSpecialItems = attributes.get('numSpecialItems', 0)
        l, t, w, h = self.parent.GetAbsolute()
        self.sr.counterParent = uicls.Container(parent=self.parent, align=uiconst.TOPLEFT, name='counterParent', state=uiconst.UI_NORMAL, hint=localization.GetByLabel('UI/CharacterCustomization/ShowActive'), pos=(7, 6, 13, 9), opacity=0.5, idx=0)
        self.sr.counterParent.OnMouseEnter = (self.OnGenericMouseEnter, self.sr.counterParent)
        self.sr.counterParent.OnMouseExit = (self.OnGenericMouseExit, self.sr.counterParent)
        self.sr.counterParent.OnClick = self.ShowActiveSlot
        self.sr.counterParent.sr.icon = uicls.Frame(frameConst=(ccConst.ICON_FOCUSFRAME, 15, -11), parent=self.sr.counterParent, color=ccConst.COLOR50)
        self.sr.counterParent.sr.label = uicls.CCLabel(text='', parent=self.sr.counterParent, color=ccConst.COLOR50, align=uiconst.CENTER, left=1)
        if self.DebugRoleCheck():
            self.sr.debugLabel = uicls.CCLabel(text='', parent=self, align=uiconst.CENTER, top=self.imageHeight / 2 + 8, letterspace=0, fontsize=9, color=(1.0, 1.0, 1.0, 0.5), state=uiconst.UI_NORMAL, idx=0)
            self.sr.debugLabel.GetMenu = self.GetDebugMenu
        self.BuildStrip(attributes.images)
        self.UpdateCounter()
        self.onSetValueCallback = attributes.get('OnSetValue', None)
        self.onChangeFocusCallback = attributes.get('OnChangeFocus', None)
        self.onPreSetValueCallback = attributes.get('OnPreSetValue', None)
Esempio n. 2
0
 def Setup(self, *args):
     info = uicore.layer.charactercreation.GetInfo()
     self.sr.genderCont = uiprimitives.Container(name='genderCont', parent=self, pos=(0,
      0,
      200,
      int(1.5 * self.hexHeight)), align=uiconst.TOPLEFT)
     self.sr.bloodlineCont = uiprimitives.Container(name='bloodlineCont', parent=self, pos=(0,
      int(1.0 * self.hexHeight + 1.0 * self.padValue),
      200,
      2 * self.hexHeight), align=uiconst.TOPLEFT)
     self.sr.raceBloodlineCont = uiprimitives.Container(parent=self, pos=(0,
      int(2.0 * (self.hexHeight + self.padValue)),
      200,
      2 * self.hexHeight), align=uiconst.TOPLEFT)
     self.CreateRaceHex()
     self.CreateBloodlineHex()
     self.CreateGenderHex()
     left = self.hexWidth + 20
     if self.showText:
         if info.raceID:
             raceTextCont = uiprimitives.Container(name='raceTextCont', parent=self.sr.raceBloodlineCont, pos=(0,
              int(0.5 * (self.padValue + self.hexHeight)),
              0,
              self.hexHeight), align=uiconst.TOTOP)
             raceInfo = sm.GetService('cc').GetRaceDataByID(info.raceID)
             raceName = localization.GetByMessageID(raceInfo.raceNameID)
             text = localization.GetByLabel('UI/CharacterCreation/RaceAndRaceName', raceName=raceName)
             raceText = uicls.CCLabel(parent=raceTextCont, fontsize=12, align=uiconst.CENTERLEFT, text=text, letterspace=1, top=0, left=left, bold=0, color=ccConst.COLOR50)
             if info.bloodlineID:
                 bloodline = sm.GetService('cc').GetBloodlineDataByID()[info.bloodlineID]
                 if bloodline and bloodline.raceID == info.raceID:
                     bloodlineTextCont = uiprimitives.Container(name='bloodlineTextCont', parent=self.sr.bloodlineCont, text=text, pos=(0,
                      int(0.5 * (self.padValue + self.hexHeight)),
                      0,
                      self.hexHeight), align=uiconst.TOTOP)
                     bloodlineName = localization.GetByMessageID(bloodline.bloodlineNameID)
                     text = localization.GetByLabel('UI/CharacterCreation/BloodlineAndBloodlineName', bloodlineName=bloodlineName)
                     bloodlineText = uicls.CCLabel(parent=bloodlineTextCont, fontsize=12, align=uiconst.CENTERLEFT, text=text, letterspace=1, left=left, bold=0, color=ccConst.COLOR50)
         if self.genderID is not None:
             if self.genderID:
                 genderText = localization.GetByLabel('UI/Common/Gender/Male')
             else:
                 genderText = localization.GetByLabel('UI/Common/Gender/Female')
             text = localization.GetByLabel('UI/CharacterCreation/GenderAndGenderName', genderName=genderText)
             genderTextCont = uiprimitives.Container(name='genderTextCont', parent=self.sr.genderCont, text=text, pos=(0,
              int(0.5 * (self.padValue + self.hexHeight)),
              0,
              self.hexHeight), align=uiconst.TOTOP)
             genderText = uicls.CCLabel(parent=genderTextCont, fontsize=12, align=uiconst.CENTERLEFT, text=text, letterspace=1, left=left, bold=0, color=ccConst.COLOR50)
Esempio n. 3
0
    def ApplyAttributes(self, attributes):
        for each in uicore.layer.main.children:
            if each.name == self.default_name:
                each.Close()

        uicls.Container.ApplyAttributes(self, attributes)
        if attributes.parent is None:
            uicore.layer.main.children.append(self)
        self.SetSize(TEXTURESIZE, TEXTURESIZE)
        settings = {
            'radius': 72,
            'textureWidth': 164,
            'textureHeight': 164,
            'texturePath':
            'res:/UI/Texture/CharacterCreation/ovalSlider_1.dds',
            'rotationRange': (4.97, math.pi * 2 - 0.53),
            'centerOffset': (82, 82)
        }
        self.sr.slider = uicls.CharCreationOvalSlider(
            parent=self,
            align=uiconst.CENTERLEFT,
            sliderSetting=settings,
            OnSetValue=attributes.get('OnSetValue', None),
            setValue=attributes.get('setValue', 0.0),
            invertSlider=attributes.get('invertSlider', False),
            modifierName=attributes.modifierName,
            increments=attributes.get('incrementsSlider', None))
        if attributes.label:
            uicls.CCLabel(parent=self.sr.slider,
                          fontsize=13,
                          align=uiconst.BOTTOMRIGHT,
                          text=attributes.label,
                          letterspace=2,
                          top=-20,
                          uppercase=True)
 def ApplyAttributes(self, attributes):
     CharacterNaming.ApplyAttributes(self, attributes)
     self.sr.customizeTextCont = uiprimitives.Container(
         name='customizeLater',
         parent=self.sr.uiContainer,
         align=uiconst.TOBOTTOM,
         height=80,
         top=64,
         state=uiconst.UI_NORMAL)
     self.sr.customizeText = uicls.CCLabel(parent=self.sr.customizeTextCont,
                                           fontsize=14,
                                           align=uiconst.BOTTOMLEFT,
                                           width=600,
                                           text='',
                                           letterspace=0,
                                           top=0,
                                           bold=0)
     self.sr.customizeText.text = localization.GetByLabel(
         'UI/CharacterCreation/CustomizeLater')
     self.UpdateLayout()
Esempio n. 5
0
    def ApplyAttributes(self, attributes):
        uicls.Container.ApplyAttributes(self, attributes)
        for each in uicore.layer.main.children:
            if each.name == self.default_name:
                each.Close()

        if not attributes.parent:
            uicore.layer.main.children.insert(0, self)
        self.bitChangeCheck = attributes.bitChangeCheck
        self._lastLit = None
        self._currentIndex = None
        self._scrolling = False
        self._mouseOffset = 0
        self._lastLoadIndex = attributes.lastLitHistoryBit
        for name, icon, align in (('left', ccConst.ICON_BACK, uiconst.TOLEFT),
                                  ('right', ccConst.ICON_NEXT,
                                   uiconst.TORIGHT)):
            btn = uicls.Container(name='%sBtn' % name,
                                  parent=self,
                                  align=align,
                                  width=self.SIZE,
                                  state=uiconst.UI_NORMAL)
            btn.sr.icon = uicls.Icon(name='%sIcon' % name,
                                     icon=icon,
                                     parent=btn,
                                     state=uiconst.UI_DISABLED,
                                     align=uiconst.CENTER,
                                     color=ccConst.COLOR50)
            uicls.Frame(parent=btn, frameConst=ccConst.MAINFRAME_INV)
            uicls.Fill(parent=btn, color=(0.0, 0.0, 0.0, 0.25))
            btn.OnClick = (self.OnButtonClicked, btn)
            btn.OnMouseEnter = (self.OnButtonEnter, btn)
            btn.OnMouseExit = (self.OnButtonExit, btn)
            btn.cursor = uiconst.UICURSOR_SELECT

        uicls.CCLabel(parent=self,
                      idx=0,
                      text=localization.GetByLabel(
                          'UI/Login/CharacterCreation/UndoHistory'),
                      top=-16,
                      uppercase=True,
                      letterspace=1,
                      shadowOffset=(0, 0),
                      color=ccConst.COLOR50)
        self.sr.mainPar = uicls.Container(parent=self,
                                          clipChildren=True,
                                          padding=(3, 0, 3, 0))
        self.sr.bitParent = uicls.Container(parent=self.sr.mainPar,
                                            align=uiconst.TOPLEFT,
                                            height=self.SIZE)
        self.sr.scrollHandle = uicls.Container(parent=self.sr.bitParent,
                                               align=uiconst.TOPLEFT,
                                               pos=(0, 0, 10, self.SIZE),
                                               color=(1.0, 1.0, 1.0, 1.0),
                                               state=uiconst.UI_NORMAL)
        uicls.Fill(parent=self.sr.scrollHandle,
                   color=(1.0, 1.0, 1.0, 1.0),
                   padding=(2, 0, 2, 0))
        self.sr.scrollHandle.OnMouseDown = self.SH_MouseDown
        self.sr.scrollHandle.OnMouseUp = self.SH_MouseUp
        uicls.Frame(parent=self.sr.mainPar, frameConst=ccConst.MAINFRAME_INV)
        uicls.Fill(parent=self.sr.mainPar, color=(0.0, 0.0, 0.0, 0.25))
        frame = uicls.Frame(parent=self,
                            frameConst=ccConst.FRAME_SOFTSHADE,
                            color=(0.0, 0.0, 0.0, 0.25))
        frame.padding = (-32, -5, -32, -15)
        self.UpdateHistory()
        sm.RegisterNotify(self)
Esempio n. 6
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()
Esempio n. 7
0
    def SetupAncestrySection(self, *args):
        info = self.GetInfo()
        padding = self.padValue
        if self.sr.ancestyCont:
            self.sr.ancestyCont.Close()
        self.sr.ancestyCont = uiprimitives.Container(
            name='ancestryCont',
            parent=self.sr.rightSide,
            align=uiconst.TOTOP,
            height=self.startAncestryHeight,
            padding=(padding, padding, padding, 0))
        sub = uiprimitives.Container(name='sub',
                                     parent=self.sr.ancestyCont,
                                     align=uiconst.TOALL,
                                     state=uiconst.UI_PICKCHILDREN,
                                     padding=(padding, padding, padding,
                                              padding))
        topCont = uiprimitives.Container(name='topCont',
                                         parent=sub,
                                         align=uiconst.TOTOP,
                                         state=uiconst.UI_PICKCHILDREN,
                                         pos=(0, 30, 0, 78))
        text = uicls.CCLabel(state=uiconst.UI_NORMAL,
                             parent=sub,
                             text=localization.GetByLabel(
                                 'UI/CharacterCreation/AncestrySelection'),
                             fontsize=20,
                             align=uiconst.TOPLEFT,
                             letterspace=1,
                             idx=1,
                             pos=(0, -6, 0, 0),
                             uppercase=1,
                             color=ccConst.COLOR50)
        text.hint = localization.GetByLabel(
            'UI/CharacterCreation/HelpTexts/chooseAncestryHint')
        self.ancestryTextCont = textCont = uiprimitives.Container(
            name='textCont',
            parent=sub,
            align=uiconst.TOALL,
            state=uiconst.UI_PICKCHILDREN)
        self.sr.ancestryNameText = uicls.CCLabel(parent=textCont,
                                                 text='',
                                                 fontsize=14,
                                                 align=uiconst.TOPLEFT,
                                                 letterspace=1,
                                                 idx=1,
                                                 pos=(0, 0, 0, 0),
                                                 color=ccConst.COLOR50)
        self.sr.ancestryDescrText = uicls.CCLabel(parent=textCont,
                                                  text='',
                                                  fontsize=10,
                                                  align=uiconst.TOTOP,
                                                  letterspace=0,
                                                  idx=1,
                                                  padTop=20,
                                                  shadowOffset=(0, 0),
                                                  bold=0,
                                                  color=ccConst.COLOR50)
        hiliteFrame = uicontrols.Frame(name='hiliteFrame',
                                       parent=self.sr.ancestyCont,
                                       frameConst=ccConst.MAINFRAME_INV)
        uiprimitives.Fill(name='fill',
                          parent=self.sr.ancestyCont,
                          color=(0.0, 0.0, 0.0, 0.5))
        if not self.ancestryInfo:
            ancestries = sm.GetService('cc').GetData(
                'ancestries', ['bloodlineID', info.bloodlineID], 1)
            for each in ancestries:
                self.ancestryInfo[each.ancestryID] = each

        self.ancestryConts = {}
        left = 0
        for i, (ancestryID, info) in enumerate(self.ancestryInfo.iteritems()):
            c = uiprimitives.Container(name='c',
                                       parent=topCont,
                                       align=uiconst.TOPLEFT,
                                       state=uiconst.UI_PICKCHILDREN,
                                       pos=(left, 0, 100, 80))
            hexName = localization.GetByMessageID(info.ancestryNameID)
            label = uicls.CCLabel(parent=c,
                                  text='<center>%s' % hexName,
                                  fontsize=12,
                                  align=uiconst.CENTERTOP,
                                  letterspace=0,
                                  idx=1,
                                  pos=(0, 46, c.width, 0),
                                  shadowOffset=(0, 0),
                                  bold=0,
                                  color=ccConst.COLOR50)
            hex = uicls.CCHexButtonAncestry(name='ancestryHex',
                                            parent=c,
                                            align=uiconst.CENTERTOP,
                                            state=uiconst.UI_NORMAL,
                                            pos=(0, -10, 64, 64),
                                            pickRadius=32,
                                            info=info,
                                            id=ancestryID,
                                            hexName=hexName,
                                            func=self.SetAncestry,
                                            iconNum=ancestryID - 1)
            left += 110
            self.ancestryConts[ancestryID] = hex
Esempio n. 8
0
 def SetupNameSection(self, *args):
     info = self.GetInfo()
     padding = self.padValue
     if self.sr.nameCont:
         self.sr.nameCont.Close()
     if self.isSerenity:
         maxFirstNameChars = 37
         contHeight = 120
     else:
         maxFirstNameChars = 24
         contHeight = 160
     self.sr.nameCont = uiprimitives.Container(name='nameCont',
                                               parent=self.sr.rightSide,
                                               align=uiconst.TOTOP,
                                               pos=(0, 0, 0, contHeight),
                                               padding=(padding, padding,
                                                        padding, 0))
     if not uicore.layer.charactercreation.CanChangeName():
         self.sr.nameCont.height = 0
         return
     sub = uiprimitives.Container(name='sub',
                                  parent=self.sr.nameCont,
                                  align=uiconst.TOALL,
                                  state=uiconst.UI_PICKCHILDREN,
                                  padding=(padding, padding, padding,
                                           padding))
     hiliteFrame = uicontrols.Frame(name='hiliteFrame',
                                    parent=self.sr.nameCont,
                                    frameConst=ccConst.MAINFRAME_INV)
     uiprimitives.Fill(name='fill',
                       parent=self.sr.nameCont,
                       color=(0.0, 0.0, 0.0, 0.5))
     text = uicls.CCLabel(
         parent=sub,
         text=localization.GetByLabel('UI/CharacterCreation/NameSelection'),
         fontsize=20,
         align=uiconst.TOPLEFT,
         letterspace=1,
         idx=1,
         pos=(0, -6, 0, 0),
         uppercase=1,
         color=ccConst.COLOR50)
     text.SetRGB(1.0, 1.0, 1.0)
     text.SetAlpha(1.0)
     top = 30
     firstName = info.charFirstName or ''
     self.sr.firstNameEdit = edit = uicontrols.SinglelineEdit(
         name='firstNameEdit',
         setvalue=firstName,
         parent=sub,
         pos=(0, top, 150, 0),
         maxLength=maxFirstNameChars,
         align=uiconst.TOTOP,
         OnChange=self.EnteringName,
         color=(1.0, 1.0, 1.0, 1.0),
         hinttext=localization.GetByLabel('UI/CharacterCreation/FirstName'))
     edit.OnReturn = self.CheckAvailability
     edit.OnAnyChar = self.OnCharInFirstName
     offset = 20
     if not self.isSerenity:
         btnTop = edit.top + edit.height + offset - 2
         btn = uicls.CharCreationButton(
             parent=sub,
             label=localization.GetByLabel(
                 'UI/CharacterCreation/Randomize'),
             pos=(0, btnTop, 0, 0),
             align=uiconst.TOPRIGHT,
             func=self.RandomizeLastName)
         rightPadding = btn.width + 10
         lastNameEditCont = uiprimitives.Container(
             name='lastNameEditCont',
             parent=sub,
             align=uiconst.TOTOP,
             state=uiconst.UI_PICKCHILDREN,
             pos=(0, offset - 10, 0, 29),
             padding=(0, 0, rightPadding, 0))
         lastNameEditCont.isTabOrderGroup = 1
         lastName = info.charLastName or ''
         self.sr.lastNameEdit = edit = uicontrols.SinglelineEdit(
             name='lastNameEdit',
             parent=lastNameEditCont,
             setvalue=lastName,
             pos=(0, 10, 0, 0),
             maxLength=12,
             align=uiconst.TOTOP,
             OnChange=self.EnteringName,
             color=(1.0, 1.0, 1.0, 1.0),
             hinttext=localization.GetByLabel(
                 'UI/CharacterCreation/LastName'))
         edit.OnReturn = self.CheckAvailability
         edit.OnAnyChar = self.OnCharInLastName
         self.sr.firstNameEdit.padRight = rightPadding
     availCont = uiprimitives.Container(name='availCont',
                                        parent=sub,
                                        align=uiconst.TOTOP,
                                        state=uiconst.UI_PICKCHILDREN,
                                        pos=(0, offset, 0, 0))
     availBtn = uicls.CharCreationButton(
         parent=availCont,
         label=localization.GetByLabel(
             'UI/CharacterCreation/CheckNameAvailability'),
         pos=(0, 0, 0, 0),
         align=uiconst.TOPLEFT,
         func=self.CheckAvailability)
     availCont.height = availBtn.height
     left = availBtn.width + 4
     self.sr.availabilityLabel = uicontrols.EveLabelMedium(
         parent=availCont,
         align=uiconst.CENTERLEFT,
         left=left + 16,
         state=uiconst.UI_DISABLED)
     self.sr.availableIcon = uicontrols.Icon(parent=availCont,
                                             align=uiconst.CENTERLEFT,
                                             pos=(left, 0, 16, 16),
                                             state=uiconst.UI_HIDDEN)
     self.sr.availableIcon.LoadIcon('ui_38_16_193')
Esempio n. 9
0
    def SetupEducationSection(self, *args):
        info = self.GetInfo()
        padding = self.padValue
        if self.sr.educationCont:
            self.sr.educationCont.Close()
        self.sr.educationCont = uiprimitives.Container(
            name='educationCont',
            parent=self.sr.rightSide,
            align=uiconst.TOTOP,
            height=self.startEducationHeight,
            padding=(padding, padding, padding, 0))
        sub = uiprimitives.Container(name='sub',
                                     parent=self.sr.educationCont,
                                     align=uiconst.TOALL,
                                     state=uiconst.UI_PICKCHILDREN,
                                     padding=(padding, padding, padding,
                                              padding))
        topCont = uiprimitives.Container(name='topCont',
                                         parent=sub,
                                         align=uiconst.TOTOP,
                                         state=uiconst.UI_PICKCHILDREN,
                                         pos=(0, 30, 0, 78))
        text = uicls.CCLabel(state=uiconst.UI_NORMAL,
                             parent=sub,
                             text=localization.GetByLabel(
                                 'UI/CharacterCreation/EducationSelection'),
                             fontsize=20,
                             align=uiconst.TOPLEFT,
                             letterspace=1,
                             idx=1,
                             pos=(0, -6, 0, 0),
                             uppercase=1,
                             color=ccConst.COLOR50)
        text.hint = localization.GetByLabel(
            'UI/CharacterCreation/HelpTexts/chooseEducationHint')
        self.schoolTextCont = textCont = uiprimitives.Container(
            name='textCont',
            parent=sub,
            align=uiconst.TOALL,
            state=uiconst.UI_PICKCHILDREN)
        self.sr.schoolNameText = uicls.CCLabel(parent=textCont,
                                               text='',
                                               fontsize=14,
                                               align=uiconst.TOPLEFT,
                                               letterspace=1,
                                               idx=1,
                                               pos=(0, 0, 0, 0),
                                               color=ccConst.COLOR50)
        self.sr.schoolDescrText = uicls.CCLabel(parent=textCont,
                                                text='',
                                                fontsize=10,
                                                align=uiconst.TOTOP,
                                                letterspace=0,
                                                idx=1,
                                                padTop=20,
                                                shadowOffset=(0, 0),
                                                bold=0,
                                                color=ccConst.COLOR50)
        hiliteFrame = uicontrols.Frame(name='hiliteFrame',
                                       parent=self.sr.educationCont,
                                       frameConst=ccConst.MAINFRAME_INV)
        uiprimitives.Fill(name='fill',
                          parent=self.sr.educationCont,
                          color=(0.0, 0.0, 0.0, 0.5))
        if not self.schoolInfo:
            schools = sm.GetService('cc').GetData('schools',
                                                  ['raceID', info.raceID], 1)
            for each in schools:
                info = sm.GetService('cc').GetData('schools',
                                                   ['schoolID', each.schoolID])
                self.schoolInfo[each.schoolID] = info

        left = 0
        offsetByRace = {
            const.raceCaldari: 17,
            const.raceMinmatar: 14,
            const.raceAmarr: 11,
            const.raceGallente: 20
        }
        iconNumOffset = offsetByRace.get(info.raceID)
        for schoolID, info in self.schoolInfo.iteritems():
            c = uiprimitives.Container(name='c',
                                       parent=topCont,
                                       align=uiconst.TOPLEFT,
                                       state=uiconst.UI_PICKCHILDREN,
                                       pos=(left, 0, 100, 80))
            hexName = localization.GetByMessageID(info.schoolNameID)
            label = uicls.CCLabel(parent=c,
                                  text='<center>%s' % hexName,
                                  fontsize=12,
                                  align=uiconst.CENTERTOP,
                                  letterspace=0,
                                  idx=1,
                                  pos=(0, 46, c.width, 0),
                                  shadowOffset=(0, 0),
                                  bold=0,
                                  color=ccConst.COLOR50)
            hex = uicls.CCHexButtonSchool(name='schoolHex',
                                          parent=c,
                                          align=uiconst.CENTERTOP,
                                          state=uiconst.UI_NORMAL,
                                          pos=(0, -10, 64, 64),
                                          pickRadius=32,
                                          info=info,
                                          id=schoolID,
                                          hexName=hexName,
                                          func=self.SetSchool,
                                          iconNum=schoolID - iconNumOffset)
            left += 110
            self.schoolConts[schoolID] = hex
Esempio n. 10
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()
Esempio n. 11
0
    def ApplyAttributes(self, attributes):
        for each in uicore.layer.main.children:
            if each.name == self.default_name:
                each.Close()

        uicls.Container.ApplyAttributes(self, attributes)
        if attributes.parent is None:
            uicore.layer.main.children.append(self)
        self.SetSize(TEXTURESIZE, TEXTURESIZE)
        settings1 = {
            'radius': 72,
            'textureWidth': 82,
            'textureHeight': 117,
            'texturePath':
            'res:/UI/Texture/CharacterCreation/ovalSlider_3_1.dds',
            'rotationRange': (4.975, math.pi * 0.502),
            'centerOffset': (82, 35)
        }
        self.sr.slider1 = uicls.CharCreationOvalSlider(
            parent=self,
            align=uiconst.BOTTOMLEFT,
            sliderSetting=settings1,
            OnSetValue=attributes.get('OnSetValue1', None),
            setValue=attributes.get('setValue1', 0.0),
            invertSlider=attributes.get('invertSlider1', False),
            modifierName=attributes.modifierName1,
            increments=attributes.get('incrementsSlider1', None))
        if attributes.label1:
            uicls.CCLabel(parent=self.sr.slider1,
                          fontsize=12,
                          align=uiconst.BOTTOMRIGHT,
                          text=attributes.label1,
                          letterspace=2,
                          top=-10,
                          uppercase=True,
                          left=12)
        settings2 = {
            'radius': 72,
            'textureWidth': 82,
            'textureHeight': 118,
            'texturePath':
            'res:/UI/Texture/CharacterCreation/ovalSlider_3_2.dds',
            'rotationRange': (2.88, math.pi * 0.502),
            'centerOffset': (0, 36)
        }
        self.sr.slider2 = uicls.CharCreationOvalSlider(
            parent=self,
            align=uiconst.BOTTOMRIGHT,
            sliderSetting=settings2,
            OnSetValue=attributes.get('OnSetValue2', None),
            setValue=attributes.get('setValue2', 0.0),
            invertSlider=attributes.get('invertSlider2', True),
            modifierName=attributes.modifierName2,
            increments=attributes.get('incrementsSlider2', None))
        if attributes.label2:
            uicls.CCLabel(parent=self.sr.slider2,
                          fontsize=12,
                          align=uiconst.BOTTOMLEFT,
                          text=attributes.label2,
                          letterspace=2,
                          top=-10,
                          uppercase=True,
                          left=12)
        settings3 = {
            'radius': 72,
            'textureWidth': 164,
            'textureHeight': 48,
            'texturePath':
            'res:/UI/Texture/CharacterCreation/ovalSlider_3_3.dds',
            'rotationRange': (0.78, math.pi * 0.502),
            'centerOffset': (82, 82)
        }
        self.sr.slider3 = uicls.CharCreationOvalSlider(
            parent=self,
            align=uiconst.TOPLEFT,
            sliderSetting=settings3,
            OnSetValue=attributes.get('OnSetValue3', None),
            setValue=attributes.get('setValue3', 0.0),
            invertSlider=attributes.get('invertSlider3', False),
            modifierName=attributes.modifierName3,
            increments=attributes.get('incrementsSlider3', None))
        if attributes.label3:
            uicls.CCLabel(parent=self.sr.slider3,
                          fontsize=12,
                          align=uiconst.CENTERTOP,
                          text=attributes.label3,
                          letterspace=2,
                          top=-20,
                          uppercase=True)