Exemplo n.º 1
0
    def Open(self):
        self.PositionOut = 0
        (self.PositionStartX, self.PositionStartY,
         z) = player.GetMainCharacterPosition()
        self.cost.SetText(localeInfo.CHANGE_LOOK_COST %
                          (self.NumberToMoneyString(changelook.GetCost())))
        for i in xrange(changelook.WINDOW_MAX_MATERIALS):
            self.slot.ClearSlot(i)

        self.Show()
    def LoadWindow(self):
        if self.isLoaded:
            return

        self.isLoaded = 1

        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self, "uiscript/changelookwindow.py")

        except:
            import exception
            exception.Abort("ChangeLookWindow.LoadDialog.LoadScript")

        try:
            self.titleBar = self.GetChild("TitleBar")
            self.titleName = self.GetChild("TitleName")
            self.accept = self.GetChild("AcceptButton")
            self.cancel = self.GetChild("CancelButton")
            self.cost = self.GetChild("Cost")
            self.slot = self.GetChild("ChangeLookSlot")
            self.passItemSlot = self.GetChild("ChangeLookSlot_PassYangItem")
        except:
            import exception
            exception.Abort("ChangeLookWindow.LoadDialog.BindObject")

        self.titleBar.SetCloseEvent(ui.__mem_func__(self.OnClose))
        self.titleBar.InfoButton('show')
        self.titleBar.SetInfoToolTip(self.CreateInfoToolTip())
        self.titleName.SetText(localeInfo.CHANGE_LOOK_TITLE)
        self.cancel.SetEvent(ui.__mem_func__(self.OnClose))
        self.accept.SetEvent(ui.__mem_func__(self.OnPressAccept))
        self.cost.SetText(
            localeInfo.CHANGE_LOOK_COST %
            (localeInfo.AddPointToNumberString(changelook.GetCost())))

        self.slot.SetSelectEmptySlotEvent(ui.__mem_func__(
            self.SelectEmptySlot))
        self.slot.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
        self.slot.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
        self.slot.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
        self.slot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))

        self.passItemSlot.SetSelectEmptySlotEvent(
            ui.__mem_func__(self.SelectEmptySlotFreepass))
        self.passItemSlot.SetUnselectItemSlotEvent(
            ui.__mem_func__(self.UseItemSlotFreepass))
        self.passItemSlot.SetUseSlotEvent(
            ui.__mem_func__(self.UseItemSlotFreepass))
        self.passItemSlot.SetOverInItemEvent(
            ui.__mem_func__(self.OverInItemFreeYang))
        self.passItemSlot.SetOverOutItemEvent(ui.__mem_func__(
            self.OverOutItem))

        self.tooltipItem = None
    def Refresh(self):
        for i in xrange(changelook.WINDOW_MAX_MATERIALS):
            self.slot.ClearSlot(i)
            (isHere, iCell) = changelook.GetAttachedItem(i)
            if isHere:
                self.slot.SetItemSlot(i, player.GetItemIndex(iCell), 1)
        self.passItemSlot.ClearSlot(0)
        (isHere, iCell) = changelook.GetAttachedPassItem()
        if isHere:
            self.passItemSlot.SetItemSlot(0, player.GetItemIndex(iCell), 1)

        self.cost.SetText(
            localeInfo.CHANGE_LOOK_COST %
            (localeInfo.AddPointToNumberString(changelook.GetCost())))