Ich verstehe es immer noch nicht :D
Code:
import ui
import chat
import app
import player
import net
GMList = [["[SA]ViCi",0], ["[GA]DJB",0], ["",0], ["",0], ["",0], ["",0]]
TeamCount = len(GMList)
class GMOnlineBoardDialog(ui.ScriptWindow):
GMActivityList = []
test = []
PageCount = 6
if PageCount > TeamCount:
PageCount = TeamCount
LastContactTimeStamp = app.GetTime() - 5
WaitTime = 10
State = "Disabled"
def __init__(self):
ui.ScriptWindow.__init__(self)
if self.GMActivityList == []:
self.LoadUserInterface()
def __del__(self):
ui.ScriptWindow.__del__(self)
if self.Board:
self.Board.Hide()
def LoadUserInterface(self):
global TeamCount
global GMList
width = 295
if TeamCount > self.PageCount:
width = 15 + 280 * int(DivideToFloat(TeamCount, self.PageCount) + 0.5)
height = 135 + 25 * self.PageCount
self.Board = ui.BoardWithTitleBar()
self.Board.SetSize(width, height)
self.Board.SetCenterPosition()
self.Board.AddFlag("movable")
self.Board.AddFlag("float")
self.Board.SetTitleName("EOS-2 GMOnlineBoard | By DaRealFreak")
self.Board.SetCloseEvent(self.__del__)
self.Board.Show()
x = 20
y = 45
for GM in GMList:
if (int(GMList.index(GM))/self.PageCount == DivideToFloat(GMList.index(GM), self.PageCount)) and (int(GMList.index(GM))/self.PageCount != 0):
x = 20 + 280 * int(DivideToFloat(GMList.index(GM), self.PageCount) + 0.5)
y = 45
GMVisage = ui.ExpandedImageBox()
GMVisage.SetParent(self.Board)
GMVisage.SetPosition(x, y)
GMVisage.LoadImage("d:/ymir work/ui/game/windows/messenger_list_online.sub")
if GM[1] == 0:
GMVisage.LoadImage("d:/ymir work/ui/game/windows/messenger_list_offline.sub")
GMVisage.Show()
WhisperButton = ui.Button()
WhisperButton.SetParent(self.Board)
WhisperButton.SetUpVisual("d:/ymir work/ui/public/xlarge_button_01.sub")
WhisperButton.SetOverVisual("d:/ymir work/ui/public/xlarge_button_02.sub")
WhisperButton.SetDownVisual("d:/ymir work/ui/public/xlarge_button_03.sub")
WhisperButton.SetText(str(GM[0]))
WhisperButton.SetToolTipText("Anschreiben", 125, 7)
WhisperButton.SetPosition(x + 20, y)
WhisperButton.SetEvent(lambda arg = GM: self.Whisper(arg))
WhisperButton.Show()
self.GMActivityList.append([GMVisage, WhisperButton])
y += 25
x = 20
y = 65 + self.PageCount * 25
for i in xrange(3):
Description = ui.TextLine()
Description.SetParent(self.Board)
Description.SetDefaultFontName()
Description.SetPosition(x, y)
if i == 0:
Description.SetText("Beschreibung:")
Description.SetFontColor(0.1, 0.7, 1)
elif i == 1:
Description.SetText("Klicke auf den Button mit dem Namen des Teammitgliedes")
elif i == 2:
Description.SetText("um ihn anzuschreiben, falls er online ist.")
Description.Show()
self.GMActivityList.append(Description)
y += 15
def Whisper(self, name):
if int(name[1]) == 0:
chat.AppendChat(chat.CHAT_TYPE_INFO, "Das Teammitglied " + str(name[0]) + " ist momentan nicht online.")
else:
if self.State == "Disabled":
chat.AppendChat(chat.CHAT_TYPE_INFO, "Warte noch " + str(int(int(self.LastContactTimeStamp) + self.WaitTime) - int(app.GetTime())) + " Sekunden bevor du erneut ein Teammitglied anschreibst.")
return
net.SendWhisperPacket(str(name[0]), "Der Spieler " + player.GetName() + " möchte sie kontaktieren.")
chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast dem Teammitglied " + str(name[0]) + " eine Nachricht geschickt.")
self.State = "Disabled"
self.LastContactTimeStamp = app.GetTime()
def OnUpdate(self):
if int(int(self.LastContactTimeStamp) + self.WaitTime) < int(app.GetTime()) and self.State == "Disabled":
self.State = "Enabled"
def UpdateActivity(self, member, activity):
for bla in self.GMActivityList:
try:
if bla[1].GetText() == member:
if activity == 1:
bla[0].LoadImage("d:/ymir work/ui/game/windows/messenger_list_online.sub")
else:
bla[0].LoadImage("d:/ymir work/ui/game/windows/messenger_list_offline.sub")
except:
pass
def DivideToFloat(x, y):
y = x * (y**-1)
return y
GMOnlineBoardDialog().Show()
#GMOnlineBoardDialog().UpdateActivity("[SGA]Nova", 1)
Was muss da jetzt wo rein? :D
MfG