def OpenWithTarget(self, targetName):
        chat.CreateWhisper(targetName)
        chat.SetWhisperBoxSize(targetName,
                               self.GetWidth() - 60,
                               self.GetHeight() - 90)
        self.chatLine.SetFocus()
        self.titleName.SetText(targetName)
        self.targetName = targetName
        self.textRenderer.SetTargetName(targetName)
        self.titleNameEdit.Hide()
        self.ignoreButton.Hide()
        if app.IsDevStage():
            self.reportViolentWhisperButton.Show()
        else:
            self.reportViolentWhisperButton.Hide()
        self.acceptButton.Hide()
        self.gamemasterMark.Hide()
        self.minimizeButton.Show()

        import messenger
        if not messenger.IsFriendByName(self.targetName):
            self.friendButton = ui.Button()
            self.friendButton.SetParent(self.board)
            self.friendButton.SetPosition(119, 10)
            self.friendButton.SetUpVisual(
                "d:/ymir work/ui/game/windows/messenger_add_friend_01.sub")
            self.friendButton.SetOverVisual(
                "d:/ymir work/ui/game/windows/messenger_add_friend_02.sub")
            self.friendButton.SetDownVisual(
                "d:/ymir work/ui/game/windows/messenger_add_friend_03.sub")
            self.friendButton.SetText("")
            self.friendButton.SetEvent(ui.__mem_func__(self.AddFrind))
            self.friendButton.Show()
Beispiel #2
0
    def RefreshButton(self):

        self.HideAllButton()

        if chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(self.vid):
            #self.__ShowButton(locale.TARGET_BUTTON_BUILDING_DESTROY)
            #self.__ArrangeButtonPosition()
            return

        if player.IsPVPInstance(self.vid) or player.IsObserverMode():
            # PVP_INFO_SIZE_BUG_FIX
            self.SetSize(200 + 7 * self.nameLength, 40)
            self.UpdatePosition()
            # END_OF_PVP_INFO_SIZE_BUG_FIX
            return

        self.ShowDefaultButton()

        if guild.MainPlayerHasAuthority(guild.AUTH_ADD_MEMBER):
            if not guild.IsMemberByName(self.nameString):
                if 0 == chr.GetGuildID(self.vid):
                    self.__ShowButton(locale.TARGET_BUTTON_INVITE_GUILD)

        if not messenger.IsFriendByName(self.nameString):
            self.__ShowButton(locale.TARGET_BUTTON_FRIEND)

        if player.IsPartyMember(self.vid):

            self.__HideButton(locale.TARGET_BUTTON_FIGHT)

            if player.IsPartyLeader(self.vid):
                self.__ShowButton(locale.TARGET_BUTTON_LEAVE_PARTY)
            elif player.IsPartyLeader(player.GetMainCharacterIndex()):
                self.__ShowButton(locale.TARGET_BUTTON_EXCLUDE)

        else:
            if player.IsPartyMember(player.GetMainCharacterIndex()):
                if player.IsPartyLeader(player.GetMainCharacterIndex()):
                    self.__ShowButton(locale.TARGET_BUTTON_INVITE_PARTY)
            else:
                if chr.IsPartyMember(self.vid):
                    self.__ShowButton(locale.TARGET_BUTTON_REQUEST_ENTER_PARTY)
                else:
                    self.__ShowButton(locale.TARGET_BUTTON_INVITE_PARTY)

            if player.IsRevengeInstance(self.vid):
                self.__HideButton(locale.TARGET_BUTTON_FIGHT)
                self.__ShowButton(locale.TARGET_BUTTON_AVENGE)
            elif player.IsChallengeInstance(self.vid):
                self.__HideButton(locale.TARGET_BUTTON_FIGHT)
                self.__ShowButton(locale.TARGET_BUTTON_ACCEPT_FIGHT)
            elif player.IsCantFightInstance(self.vid):
                self.__HideButton(locale.TARGET_BUTTON_FIGHT)

            if not player.IsSameEmpire(self.vid):
                self.__HideButton(locale.TARGET_BUTTON_INVITE_PARTY)
                self.__HideButton(locale.TARGET_BUTTON_FRIEND)
                self.__HideButton(locale.TARGET_BUTTON_FIGHT)

        distance = player.GetCharacterDistance(self.vid)
        if distance > self.EXCHANGE_LIMIT_RANGE:
            self.__HideButton(locale.TARGET_BUTTON_EXCHANGE)
            self.__ArrangeButtonPosition()

        self.__ArrangeButtonPosition()