Dateien sind fehlerhaft oder nicht vorhanden/leer.
Beiträge von RonnieBreathe
-
-
Quest per Spoiler bitte einfügen.
Btw. wenn das die Quest von 2013 ist, dann weiß ich den Fehler, aber schick mal. -
Hallo!
Das Group-Search-System wird in letzter Zeit oft gesucht.
Ich hatte es noch am PC und dachte mir, ich gebe es euch.
Bugs sind mir keine bekannt, und ich kann euch wenig Hilfe dazu anbieten, da es von Santa ist.
ALLE CREDITS GEHEN AN SANTA, ICH BIN NICHT ERSTELLER DES SYSTEMS!Video:
Bitte melden Sie sich an, um dieses Medienelement zu sehen.
Download:
Bitte melden Sie sich an, um diesen Link zu sehen.
-
Danke erstmal dafür.
Ich biete meinen Service kostenlos an, weil ich nicht bekannt bin und kein Geld verlange bevor die Leute wissen wie ich meine Arbeit mache.
Der Service ist und bleibt kostenlos für alle und egal für welchen Zweck..Was einige aber vergessen, ich mache bis zu 4x4 maps kostenlos was nicht bedeutet das ihr einfach mal 5mal eine 4x4 map requesten könnt die gratis sind.
Wie ihr ganz oben sehen könnt, nimmt jede map egal wie groß sie ist, viel Zeit in anspruch.
Ich werde die Aufträge annehmen was aber nicht bedeutet, dass ihr Stammkunden bei einem kostenlosen Service werden könnt.Ich tue das um euch zu helfen etwas Geld zu sparen und um mir selber zu helfen besser zu werden und mir einen Namen zu machen.
Nur weil ich kostenlos bin heißt das nicht, dass ich mich ausnutzen lasse.
Wenn ihr extra Wünsche habt oder zu viel requested, rechnet damit, dass es etwas kosten wird.
Richtig so. Klar sind Erwähnungen gut und schön, aber Geld regiert die Welt.B2T: Klasser Einfall, haben uns ja schon unterhalten per PN und über meine Idee. Ich hoffe wir kriegen da gemeinsam was zusammen
-
Oldschool-Server sind langweilig, da kann ich gleich auf DE anfangen.
Oldschool's sind ausgeluscht, außerdem was bringt den Randoms deine tar.gz Dateien, deren Inhalt irrelevant ist auf einem Oldschool, und noch dazu gestripped und coded ist?
Abziehen hin oder her, ich kann mich an einige deiner Fragen erinnern, und - sorry dass ich das jetzt so sage - wenn ein Mitglied das unter dir steht mehr Ahnung hat als du, dann solltest du keinen Server aufbauen.
Alleine deine Aussage mit der gz-Archiven ist mir ein Rätsel, ich würde dir nichtmal aus freien Stücken helfen. Meine Meinung dazu. -
Eigentlich sollte es gehen, da er hier sagt, dass in der InfoBoard kein HideCorners ist, welches ich aber gerade gepostet hab.... oO
-
Ein anderer Dude hat hier schon danach gefragt - schau mal da, ob dein Fehler dabei ist.
-
Öffne in root: ui.py
Suche: class ThinBoard(Window):
Such in dem Abschnitt: def SetSize(self, width, height):Setze DAVOR:
Code- if app.ENABLE_SEND_TARGET_INFO:
- def ShowCorner(self, corner):
- self.Corners[corner].Show()
- self.SetSize(self.GetWidth(), self.GetHeight())
- def HideCorners(self, corner):
- self.Corners[corner].Hide()
- self.SetSize(self.GetWidth(), self.GetHeight())
- def ShowLine(self, line):
- self.Lines[line].Show()
- self.SetSize(self.GetWidth(), self.GetHeight())
- def HideLine(self, line):
- self.Lines[line].Hide()
- self.SetSize(self.GetWidth(), self.GetHeight())
Sollte so aussehen:
Python- def __init__(self, layer = "UI"):
- Window.__init__(self, layer)
- CornerFileNames = [ "d:/ymir work/ui/pattern/ThinBoard_Corner_"+dir+".tga" for dir in ["LeftTop","LeftBottom","RightTop","RightBottom"] ]
- LineFileNames = [ "d:/ymir work/ui/pattern/ThinBoard_Line_"+dir+".tga" for dir in ["Left","Right","Top","Bottom"] ]
- self.Corners = []
- for fileName in CornerFileNames:
- Corner = ExpandedImageBox()
- Corner.AddFlag("attach")
- Corner.AddFlag("not_pick")
- Corner.LoadImage(fileName)
- Corner.SetParent(self)
- Corner.SetPosition(0, 0)
- Corner.Show()
- self.Corners.append(Corner)
- self.Lines = []
- for fileName in LineFileNames:
- Line = ExpandedImageBox()
- Line.AddFlag("attach")
- Line.AddFlag("not_pick")
- Line.LoadImage(fileName)
- Line.SetParent(self)
- Line.SetPosition(0, 0)
- Line.Show()
- self.Lines.append(Line)
- Base = Bar()
- Base.SetParent(self)
- Base.AddFlag("attach")
- Base.AddFlag("not_pick")
- Base.SetPosition(self.CORNER_WIDTH, self.CORNER_HEIGHT)
- Base.SetColor(self.BOARD_COLOR)
- Base.Show()
- self.Base = Base
- self.Lines[self.L].SetPosition(0, self.CORNER_HEIGHT)
- self.Lines[self.T].SetPosition(self.CORNER_WIDTH, 0)
- def __del__(self):
- Window.__del__(self)
- if app.ENABLE_SEND_TARGET_INFO:
- def ShowCorner(self, corner):
- self.Corners[corner].Show()
- self.SetSize(self.GetWidth(), self.GetHeight())
- def HideCorners(self, corner):
- self.Corners[corner].Hide()
- self.SetSize(self.GetWidth(), self.GetHeight())
- def ShowLine(self, line):
- self.Lines[line].Show()
- self.SetSize(self.GetWidth(), self.GetHeight())
- def HideLine(self, line):
- self.Lines[line].Hide()
- self.SetSize(self.GetWidth(), self.GetHeight())
- def SetSize(self, width, height):
- width = max(self.CORNER_WIDTH*2, width)
- height = max(self.CORNER_HEIGHT*2, height)
- Window.SetSize(self, width, height)
- self.Corners[self.LB].SetPosition(0, height - self.CORNER_HEIGHT)
- self.Corners[self.RT].SetPosition(width - self.CORNER_WIDTH, 0)
- self.Corners[self.RB].SetPosition(width - self.CORNER_WIDTH, height - self.CORNER_HEIGHT)
- self.Lines[self.R].SetPosition(width - self.CORNER_WIDTH, self.CORNER_HEIGHT)
- self.Lines[self.B].SetPosition(self.CORNER_HEIGHT, height - self.CORNER_HEIGHT)
- verticalShowingPercentage = float((height - self.CORNER_HEIGHT*2) - self.LINE_HEIGHT) / self.LINE_HEIGHT
- horizontalShowingPercentage = float((width - self.CORNER_WIDTH*2) - self.LINE_WIDTH) / self.LINE_WIDTH
- self.Lines[self.L].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
- self.Lines[self.R].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
- self.Lines[self.T].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
- self.Lines[self.B].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
- self.Base.SetSize(width - self.CORNER_WIDTH*2, height - self.CORNER_HEIGHT*2)
-
Werden in Sublime mit Windows 1252 auch die proto.txt umlaute korrekt angezeigt?
Du meinst item_proto.txt vom Server?
Ich benutz leider noch Datenbank, und kann es nur an der item_proto.txt aus dem Clienten testen, wenn du möchtest, oder du sendest mir deine Datei per PN und ich sehs mir an -
Locale_de/locale/de/locale_game.txt ->
TARGET_INFO_DAMAGE Damage : %s - %s
TARGET_INFO_DEFENSE Defence : %s
TARGET_INFO_EXP Expierence : %s
TARGET_INFO_MAINRACE Rasse : %s
TARGET_INFO_MAX_HP Max. TP : %s
TARGET_INFO_NO_ITEM_TEXT Keine Items droppbar.
TARGET_INFO_NO_RACE Keine
TARGET_INFO_RACE_METIN Metin
TARGET_INFO_RACE_ANIMAL Tiere
TARGET_INFO_RACE_DARK Dunkelheit
TARGET_INFO_RACE_DEVIL Teufel
TARGET_INFO_RACE_EARTH Erde
TARGET_INFO_RACE_ELEC Blitz
TARGET_INFO_RACE_FIRE Feuer
TARGET_INFO_RACE_HUMAN Halbmenschen
TARGET_INFO_RACE_ICE Eis
TARGET_INFO_RACE_MILGYO Esoterische
TARGET_INFO_RACE_ORC Orks
TARGET_INFO_RACE_UNDEAD Untote
TARGET_INFO_RACE_WIND Wind
TARGET_INFO_STONE_NAME Geiststein
TARGET_INFO_SUBRACE Unterart : %s -
Source, sowohl Server als auch Client sind C++.
Wenn du Metin2-Systeme einbauen/erstellen möchtest, musst du dich mit dem Aufbau und Struktur auseinandersetzen, und C++ lernen, und verstehen.
Wenn es darum geht, Systeme einzubauen, wird dir im Normalfall erklärt, was genau du wo hin tun sollst. -
Mir wurde gesagt, dass man für Metin auf ansi umstellen muss
ANSI ist nur in Quests nötig.
Windows 1252 bei Sublime Text3, wenn du die SRC/locale_string bearbeiten möchtest.Ich hab auch vor kurzem auf Sublime gewechselt, weil es viel übersichtlicher, und mit mehr Codec ausgestattet ist.
Du kannst aber auch W 1252 benutzen für Quests, um Umlaute richtig darzustellen -
uiTarget.py bitte per Spoiler und Code einfügen, und in Zeile 428 mal nachsehen, ob da Tabs fehlen/zuviele Tabs sind.
-
Erst einmal Danke für deine Zeit jedoch spuckt der Server folgenden Fehler ausBitte melden Sie sich an, um diesen Link zu sehen.
pc.level() mit pc.get_level() ersetzen, und versuchen.
In Zeile 5 fehlen die Klammern () nach pc.skillgroup. -
Bones und Animationen richtig gesetzt?
-
oxevent.cpp ist die Eventflag definiert.
CodeTheoretisch hast du bereits einen Eventflag-Trigger ingame: /e
Vielleicht funktioniert es ja mit /e oxevent_status 1 zum öffnen? -
Mehrere Möglichkeiten:
Falscher Type in der mse, eine Datei fehlt.
Poste die mse bitte. -
szDurationPoly = Dauer des Skills in skill_proto in der Datenbank.
szDurationPoly wird in Sekunden gerechnet. 3600 = 1Stunde -
Hallo M2DL,
Ich besitze das Biologensystem von Abizu2, funktioniert alles so weit so gut, doch man kann keine Items abgeben, die auf Seite 3, 4 oder 5 liegen.
Sobald das Item z.b. Orkzahn auf Seite 1 oder 2 liegt, kann man es normal abgeben. Ich denke, da ist in der python der Biologenquest ein Fehler.
Wäre euch sehr verbunden, wenn ihr mir da weiterhelfen könnt.uibiology.py:
Code- import ui
- import localeInfo
- import chat
- import app
- import uiToolTip
- import mouseModule
- import snd
- import player
- import TextReader
- import dbg
- import event
- import net
- import constinfo
- BASE_PATH = "locale/de/ui/biosystem/"
- class BioSystemNewBoard(ui.ScriptWindow):
- def __init__(self, managerWnd):
- ui.ScriptWindow.__init__(self)
- self.managerWnd = managerWnd
- self.Load()
- constinfo.bio = True
- def __del__(self):
- constinfo.bio = False
- ui.ScriptWindow.__del__(self)
- def __LoadScript(self, fileName):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, fileName)
- except:
- import exception
- exception.Abort("BioSystemNewBoard.LoadDialog.LoadScript")
- def __BindObject(self):
- try:
- GetObject=self.GetChild
- self.board = GetObject("board")
- self.titleBar = GetObject("TitleBar")
- self.main = {
- "say_text" : GetObject("SayText"),
- "button" : GetObject("Button"),
- }
- except:
- import exception
- exception.Abort("BioSystemNewBoard.LoadDialog.BindObject")
- self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
- self.main["button"].SAFE_SetEvent(self.Close)
- def Load(self):
- self.__LoadScript("UIScript/BioSystemNewBoard.py")
- self.__BindObject()
- def Destroy(self):
- self.Close()
- def Open(self):
- if self.managerWnd.GetQuestID() == -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast keine aktive Biologenaufgabe.")
- return
- self.Refresh(TRUE)
- self.SetCenterPosition()
- self.Show()
- def Close(self):
- self.Hide()
- def GetTextByFile(self, fileName, autoEnter = TRUE):
- MyTextReader = TextReader.TextReader(autoEnter)
- # load file
- MyTextReader.LoadFile(fileName)
- return MyTextReader.GetText()
- def Refresh(self, bForce = FALSE):
- if bForce == FALSE and self.IsShow() == FALSE:
- return
- questID = self.managerWnd.GetQuestID()
- self.main["say_text"].SetText(self.GetTextByFile(BASE_PATH + "%d_new.txt" % (questID)))
- btn = self.main["button"]
- btn.SetPosition(btn.GetLeft(), self.main["say_text"].GetBottom() + 5)
- self.board.SetSize(self.GetWidth(), btn.GetBottom() + 20)
- self.SetSize(self.GetWidth(), btn.GetBottom() + 20)
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- class BioSystemCurrentBoard(ui.ScriptWindow):
- class QuestStateData():
- def __init__(self):
- self.itemVnum = 0
- self.itemCount = 0
- self.itemCountGiven = 0
- self.itemCountChecking = 0
- self.checkingTimeOver = 0
- def LoadInformation(self, itemVnum, itemCount, itemCountGiven, itemCountChecking, checkingTimeLeft):
- self.SetItemVnum(itemVnum)
- self.SetItemCount(itemCount)
- self.SetItemCountGiven(itemCountGiven)
- self.SetItemCountChecking(itemCountChecking)
- self.SetCheckingTimeLeft(checkingTimeLeft)
- def GetItemVnum(self):
- return self.itemVnum
- def SetItemVnum(self, itemVnum):
- self.itemVnum = int(itemVnum)
- def GetItemCount(self):
- return self.itemCount
- def SetItemCount(self, itemCount):
- self.itemCount = int(itemCount)
- def GetItemCountGiven(self):
- return self.itemCountGiven
- def SetItemCountGiven(self, itemCountGiven):
- self.itemCountGiven = int(itemCountGiven)
- def GetItemCountNeed(self):
- return self.itemCount - self.itemCountGiven
- def GetItemCountChecking(self):
- return self.itemCountChecking
- def SetItemCountChecking(self, itemCountChecking):
- self.itemCountChecking = int(itemCountChecking)
- def GetCheckingTimeLeft(self):
- return int(self.checkingTimeOver - app.GetTime() + 0.5)
- def SetCheckingTimeLeft(self, checkingTimeLeft):
- if int(checkingTimeLeft) == 0:
- self.checkingTimeOver = 0
- else:
- self.checkingTimeOver = app.GetTime() + int(checkingTimeLeft)
- def __init__(self, managerWnd):
- ui.ScriptWindow.__init__(self)
- self.managerWnd = managerWnd
- self.questState = self.QuestStateData()
- self.itemToolTip = uiToolTip.ItemToolTip()
- self.itemToolTip.HideToolTip()
- self.selectedItemSlot = -1
- self.lastCheckingTimeLeft = 0
- self.Load()
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def __LoadScript(self, fileName):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, fileName)
- except:
- import exception
- exception.Abort("BioSystemCurrentBoard.LoadDialog.LoadScript")
- def __BindObject(self):
- try:
- GetObject=self.GetChild
- self.titleBar = GetObject("TitleBar")
- self.main = {
- "say_text" : GetObject("BioSayText"),
- "item_slot" : GetObject("ItemSlot"),
- "item_button" : GetObject("ItemLeaveButton"),
- "info_text" : GetObject("InfoText"),
- }
- except:
- import exception
- exception.Abort("BioSystemCurrentBoard.LoadDialog.BindObject")
- self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
- wndItem = self.main["item_slot"]
- wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.OnSelectEmptySlot))
- wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.OnSelectItemSlot))
- wndItem.SetOverInItemEvent(ui.__mem_func__(self.OnOverInItem))
- wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OnOverOutItem))
- self.main["item_button"].SAFE_SetEvent(self.OnClickItemButton)
- def Load(self):
- self.__LoadScript("UIScript/BioSystemCurrentBoard.py")
- self.__BindObject()
- def Destroy(self):
- self.Close()
- def Open(self):
- if self.managerWnd.GetQuestID() == -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast keine aktive Biologenaufgabe.")
- return
- self.selectedItemSlot = -1
- self.main["item_slot"].SetItemSlot(0, 0, 0)
- self.Refresh(TRUE)
- self.SetCenterPosition()
- self.Show()
- def Close(self):
- self.Hide()
- def GetTextByFile(self, fileName, autoEnter = TRUE):
- MyTextReader = TextReader.TextReader(autoEnter)
- # key words
- itemSlotCount = 0
- if self.selectedItemSlot != -1:
- itemSlotCount = player.GetItemCount(self.selectedItemSlot)
- MyTextReader.AddKeyWord("[ITEM_MAX_COUNT]", str(self.questState.GetItemCount()))
- MyTextReader.AddKeyWord("[ITEM_SLOT_COUNT]", str(itemSlotCount))
- MyTextReader.AddKeyWord("[ITEM_LEFT_COUNT]", str(self.questState.GetItemCountNeed()))
- MyTextReader.AddKeyWord("[ITEM_GIVEN_COUNT]", str(self.questState.GetItemCountGiven()))
- MyTextReader.AddKeyWord("[ITEM_CHECKING_COUNT]", str(self.questState.GetItemCountChecking()))
- secondsLeft = self.questState.GetCheckingTimeLeft()
- MyTextReader.AddKeyWord("[ITEM_CHECKING_TIME_LEFT]", localeInfo.SecondToHMS(secondsLeft))
- # refresh lastCheckingTimeLeft
- self.lastCheckingTimeLeft = secondsLeft
- # load file
- MyTextReader.LoadFile(fileName)
- return MyTextReader.GetText()
- def Refresh(self, bForce = FALSE):
- if bForce == FALSE and self.IsShow() == FALSE:
- return
- questID = self.managerWnd.GetQuestID()
- self.main["say_text"].SetText(self.GetTextByFile(BASE_PATH + "%d_current_say.txt" % (questID)))
- self.main["info_text"].SetText(self.GetTextByFile(BASE_PATH + "%d_current_info.txt" % (questID)))
- self.main["item_button"].SetText(self.GetTextByFile(BASE_PATH + "%d_current_button.txt" % (questID), FALSE))
- def LoadQuestInformation(self, itemVnum, itemCount, itemCountGiven, checkingCount, timeLeft):
- self.questState.LoadInformation(itemVnum, itemCount, itemCountGiven, checkingCount, timeLeft)
- self.Refresh()
- def OnSelectEmptySlot(self, slotID):
- if mouseModule.mouseController.isAttached():
- attachedSlotType = mouseModule.mouseController.GetAttachedType()
- attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
- attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
- attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
- if player.SLOT_TYPE_INVENTORY == attachedSlotType:
- if self.questState.GetItemVnum() == attachedItemIndex:
- self.selectedItemSlot = attachedSlotPos
- itemCount = attachedItemCount
- if itemCount == 1:
- itemCount = 0
- self.main["item_slot"].SetItemSlot(0, attachedItemIndex, attachedItemCount)
- self.Refresh()
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du benötigst einen anderen Gegenstand.")
- mouseModule.mouseController.DeattachObject()
- def OnSelectItemSlot(self, slotID):
- if mouseModule.mouseController.isAttached():
- self.OnSelectEmptySlot(slotID)
- else:
- itemSlotIndex = self.selectedItemSlot
- selectedItemVNum = player.GetItemIndex(itemSlotIndex)
- itemCount = player.GetItemCount(itemSlotIndex)
- mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
- snd.PlaySound("sound/ui/pick.wav")
- def OnOverInItem(self, slotID):
- self.itemToolTip.ClearToolTip()
- self.itemToolTip.SetInventoryItem(self.selectedItemSlot)
- self.itemToolTip.ShowToolTip()
- def OnOverOutItem(self):
- self.itemToolTip.HideToolTip()
- def OnClickItemButton(self):
- if self.selectedItemSlot == -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du musst erst einen Gegenstand zum Abgeben wählen.")
- return
- self.managerWnd.SendQuestPacket(self.selectedItemSlot)
- def OnUpdate(self):
- if self.selectedItemSlot != -1 and player.GetItemIndex(self.selectedItemSlot) != self.questState.GetItemVnum():
- self.selectedItemSlot = -1
- self.main["item_slot"].SetItemSlot(0, 0, 0)
- self.Refresh()
- if self.lastCheckingTimeLeft != 0 and self.lastCheckingTimeLeft != self.questState.GetCheckingTimeLeft():
- self.lastCheckingTimeLeft = self.questState.GetCheckingTimeLeft()
- if self.lastCheckingTimeLeft <= 0:
- self.lastCheckingTimeLeft = 0
- self.questState.SetItemCountChecking(0)
- self.questState.SetCheckingTimeLeft(0)
- self.Refresh()
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- class BioSystemFinishBoard(ui.ScriptWindow):
- class QuestStateData():
- def __init__(self):
- self.itemCountFailed = 0
- self.itemCountSuccess = 0
- def LoadInformation(self, itemCountFailed, itemCountSuccess):
- self.SetItemCountFailed(itemCountFailed)
- self.SetItemCountSuccess(itemCountSuccess)
- def GetItemCountFailed(self):
- return self.itemCountFailed
- def SetItemCountFailed(self, itemCountFailed):
- self.itemCountFailed = int(itemCountFailed)
- def GetItemCountSuccess(self):
- return self.itemCountSuccess
- def SetItemCountSuccess(self, itemCountSuccess):
- self.itemCountSuccess = int(itemCountSuccess)
- def __init__(self, managerWnd):
- ui.ScriptWindow.__init__(self)
- self.managerWnd = managerWnd
- self.questState = self.QuestStateData()
- self.Load()
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def __LoadScript(self, fileName):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, fileName)
- except:
- import exception
- exception.Abort("BioSystemFinishBoard.LoadDialog.LoadScript")
- def __BindObject(self):
- try:
- GetObject=self.GetChild
- self.titleBar = GetObject("TitleBar")
- self.main = {
- "say_text" : GetObject("SayText"),
- "button" : GetObject("Button"),
- }
- except:
- import exception
- exception.Abort("BioSystemFinishBoard.LoadDialog.BindObject")
- self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
- self.main["button"].SAFE_SetEvent(self.Close)
- def Load(self):
- self.__LoadScript("UIScript/BioSystemFinishBoard.py")
- self.__BindObject()
- def Destroy(self):
- self.Close()
- def Open(self):
- if self.managerWnd.GetQuestID() == -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast keine aktive Biologenaufgabe.")
- return
- self.Refresh(TRUE)
- self.SetCenterPosition()
- self.Show()
- def Close(self):
- self.Hide()
- def GetTextByFile(self, fileName, autoEnter = TRUE):
- MyTextReader = TextReader.TextReader(autoEnter)
- # key words
- MyTextReader.AddKeyWord("[ITEM_FAILED_COUNT]", str(self.questState.GetItemCountFailed()))
- MyTextReader.AddKeyWord("[ITEM_SUCCESS_COUNT]", str(self.questState.GetItemCountSuccess()))
- # load file
- MyTextReader.LoadFile(fileName)
- return MyTextReader.GetText()
- def Refresh(self, bForce = FALSE):
- if bForce == FALSE and self.IsShow() == FALSE:
- return
- questID = self.managerWnd.GetQuestID()
- self.main["say_text"].SetText(self.GetTextByFile(BASE_PATH + "%d_finish_checking.txt" % (questID)))
- def LoadQuestInformation(self, failedCount, successCount):
- self.questState.LoadInformation(failedCount, successCount)
- self.Refresh()
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- class BioSystemDoneBoard(ui.ScriptWindow):
- class QuestStateData():
- def __init__(self):
- self.itemCountSuccess = 0
- self.itemCountMax = 0
- self.itemCountBack = 0
- def LoadInformation(self, itemCountSuccess, itemCountMax, itemCountBack):
- self.SetItemCountSuccess(itemCountSuccess)
- self.SetItemCountMax(itemCountMax)
- self.SetItemCountBack(itemCountBack)
- def GetItemCountSuccess(self):
- return self.itemCountSuccess
- def SetItemCountSuccess(self, itemCountSuccess):
- self.itemCountSuccess = int(itemCountSuccess)
- def GetItemCountMax(self):
- return self.itemCountMax
- def SetItemCountMax(self, itemCountMax):
- self.itemCountMax = int(itemCountMax)
- def GetItemCountBack(self):
- return self.itemCountBack
- def SetItemCountBack(self, itemCountBack):
- self.itemCountBack = int(itemCountBack)
- def __init__(self, managerWnd):
- ui.ScriptWindow.__init__(self)
- self.managerWnd = managerWnd
- self.questState = self.QuestStateData()
- self.Load()
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def __LoadScript(self, fileName):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, fileName)
- except:
- import exception
- exception.Abort("BioSystemDoneBoard.LoadDialog.LoadScript")
- def __BindObject(self):
- try:
- GetObject=self.GetChild
- self.titleBar = GetObject("TitleBar")
- self.main = {
- "say_text" : GetObject("SayText"),
- "button" : GetObject("Button"),
- }
- except:
- import exception
- exception.Abort("BioSystemDoneBoard.LoadDialog.BindObject")
- self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
- self.main["button"].SAFE_SetEvent(self.Close)
- def Load(self):
- self.__LoadScript("UIScript/BioSystemDoneBoard.py")
- self.__BindObject()
- def Destroy(self):
- self.Close()
- def Open(self):
- if self.managerWnd.GetQuestID() == -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast keine aktive Biologenaufgabe.")
- return
- self.Refresh(TRUE)
- self.SetCenterPosition()
- self.Show()
- def Close(self):
- self.Hide()
- def GetTextByFile(self, fileName, autoEnter = TRUE):
- MyTextReader = TextReader.TextReader(autoEnter)
- # key words
- MyTextReader.AddKeyWord("[ITEM_COUNT_SUCCESS]", str(self.questState.GetItemCountSuccess()))
- MyTextReader.AddKeyWord("[ITEM_COUNT_MAX]", str(self.questState.GetItemCountMax()))
- MyTextReader.AddKeyWord("[ITEM_COUNT_BACK]", str(self.questState.GetItemCountBack()))
- # load file
- MyTextReader.LoadFile(fileName)
- return MyTextReader.GetText()
- def Refresh(self, bForce = FALSE):
- if bForce == FALSE and self.IsShow() == FALSE:
- return
- questID = self.managerWnd.GetQuestID()
- self.main["say_text"].SetText(self.GetTextByFile(BASE_PATH + "%d_done.txt" % (questID)))
- def LoadQuestInformation(self, successCount, maxCount, backCount):
- self.questState.LoadInformation(successCount, maxCount, backCount)
- self.Refresh()
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- class BioSystemRewardBoard(ui.ScriptWindow):
- class QuestStateData():
- def __init__(self):
- self.itemCountBack = 0
- def LoadInformation(self, itemCountBack):
- self.SetItemCountBack(itemCountBack)
- def GetItemCountBack(self):
- return self.itemCountBack
- def SetItemCountBack(self, itemCountBack):
- self.itemCountBack = int(itemCountBack)
- def __init__(self, managerWnd):
- ui.ScriptWindow.__init__(self)
- self.managerWnd = managerWnd
- self.questState = self.QuestStateData()
- self.Load()
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def __LoadScript(self, fileName):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, fileName)
- except:
- import exception
- exception.Abort("BioSystemRewardBoard.LoadDialog.LoadScript")
- def __BindObject(self):
- try:
- GetObject=self.GetChild
- self.titleBar = GetObject("TitleBar")
- self.main = {
- "say_text" : GetObject("SayText"),
- "button" : GetObject("Button"),
- }
- except:
- import exception
- exception.Abort("BioSystemRewardBoard.LoadDialog.BindObject")
- self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
- self.main["button"].SAFE_SetEvent(self.Close)
- def Load(self):
- self.__LoadScript("UIScript/BioSystemRewardBoard.py")
- self.__BindObject()
- def Destroy(self):
- self.Close()
- def Open(self):
- if self.managerWnd.GetQuestID() == -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast keine aktive Biologenaufgabe.")
- return
- self.Refresh(TRUE)
- self.SetCenterPosition()
- self.Show()
- def Close(self):
- self.Hide()
- def GetTextByFile(self, fileName, autoEnter = TRUE):
- MyTextReader = TextReader.TextReader(autoEnter)
- # key words
- MyTextReader.AddKeyWord("[ITEM_BACK_COUNT]", str(self.questState.GetItemCountBack()))
- # load file
- MyTextReader.LoadFile(fileName)
- return MyTextReader.GetText()
- def Refresh(self, bForce = FALSE):
- if bForce == FALSE and self.IsShow() == FALSE:
- return
- questID = self.managerWnd.GetQuestID()
- self.main["say_text"].SetText(self.GetTextByFile(BASE_PATH + "%d_reward.txt" % (questID)))
- def LoadQuestInformation(self, backCount):
- self.questState.LoadInformation(backCount)
- self.Refresh()
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- class BioSystemManager():
- def __init__(self):
- self.wndNewBoard = BioSystemNewBoard(self)
- self.wndNewBoard.Close()
- self.wndCurrentBoard = BioSystemCurrentBoard(self)
- self.wndCurrentBoard.Close()
- self.wndFinishBoard = BioSystemFinishBoard(self)
- self.wndFinishBoard.Close()
- self.wndDoneBoard = BioSystemDoneBoard(self)
- self.wndDoneBoard.Close()
- self.wndRewardBoard = BioSystemRewardBoard(self)
- self.wndRewardBoard.Close()
- self.questIndex = 0
- self.questID = 0
- def __del__(self):
- self.wndNewBoard.Close()
- self.wndNewBoard = None
- self.wndCurrentBoard.Close()
- self.wndCurrentBoard = None
- self.wndFinishBoard.Close()
- self.wndFinishBoard = None
- self.wndDoneBoard.Close()
- self.wndDoneBoard = None
- self.wndRewardBoard.Close()
- self.wndRewardBoard = None
- def SetQuestIndex(self, index):
- self.questIndex = index
- def GetQuestIndex(self):
- return self.questIndex
- def SetQuestID(self, index):
- self.questID = index
- def GetQuestID(self):
- return self.questID
- def SendQuestPacket(self, infoString):
- if self.questIndex == 0:
- return
- event.QuestButtonClick(self.questIndex)
- if infoString:
- net.SendQuestInputStringPacket(str(infoString))
- def RecvQuestPacket(self, dataString):
- data = dataString.split(",")
- # quest init
- if data[0] == "init":
- self.SetQuestID(int(data[1]))
- # quest new
- elif data[0] == "new":
- self.wndRewardBoard.Close()
- self.SetQuestID(int(data[1]))
- self.wndNewBoard.Open()
- # quest current
- elif data[0] == "current":
- self.wndNewBoard.Close()
- self.wndFinishBoard.Close()
- self.SetQuestIndex(int(data[1]))
- self.wndCurrentBoard.LoadQuestInformation(data[2], data[3], data[4], data[5], data[6])
- self.wndCurrentBoard.Open()
- # quest finish
- elif data[0] == "finish":
- qState = self.wndCurrentBoard.questState
- qState.SetItemCountGiven(qState.GetItemCountGiven() + int(data[2]))
- self.wndCurrentBoard.Refresh()
- self.wndFinishBoard.LoadQuestInformation(data[1], data[2])
- self.wndFinishBoard.Open()
- # quest done
- elif data[0] == "done":
- self.wndCurrentBoard.Close()
- self.wndFinishBoard.Close()
- self.wndDoneBoard.LoadQuestInformation(data[1], data[2], data[3])
- self.wndDoneBoard.Open()
- # quest reward
- elif data[0] == "reward":
- self.wndDoneBoard.Close()
- self.wndRewardBoard.LoadQuestInformation(data[1])
- self.wndRewardBoard.Open()
- # unkown
- else:
- dbg.TraceError("cannot identify bio system packet type %s [%s]" % (data[0], dataString))
-
Hallo M2D!
Ich habe soweit erfolgreich das Biologensystem eingebaut, nun hab ich aber folgendes Problem:
0630 17:19:28578 :: Traceback (most recent call last):
0630 17:19:28578 :: File "uiQuest.py", line 706, in OnInput
0630 17:19:28578 :: AttributeError
0630 17:19:28578 :: :
0630 17:19:28578 :: 'NoneType' object has no attribute 'UpdateRect'
0630 17:19:28578 ::Und es bleibt ein Eingabefenster offen:
Bitte melden Sie sich an, um diesen Link zu sehen.
Hat da jemand eine Lösung für?
uiquest.py:
Code- import ui
- import dbg
- import app
- import grp
- import grpImage
- import event
- import time
- import wndMgr
- import net
- import sys
- QUEST_BOARD_IMAGE_DIR = 'd:/ymir work/ui/game/questboard/'
- cur_questpage_number = 1
- entire_questbutton_number = 0
- entire_questpage_number = 1
- # TOOLTIP_IMAGE_BOX
- class ToolTipImageBox(ui.ImageBox):
- def __init__(self):
- ui.ImageBox.__init__(self)
- self.DestroyToolTip()
- def __del__(self):
- ui.ImageBox.__del__(self)
- def CreateToolTip(self, parent, title, desc, x, y):
- import uiToolTip
- self.toolTip = uiToolTip.ToolTip()
- self.toolTip.SetWindowHorizontalAlignCenter()
- self.toolTip.SetFollow(False)
- self.toolTip.SetTitle(title)
- self.toolTip.SetPosition(x, y)
- desc = desc.replace("|", "/")
- for line in desc.split("/"):
- self.toolTip.AutoAppendTextLine(line)
- self.toolTip.ResizeToolTip()
- self.toolTip.Hide()
- def DestroyToolTip(self):
- self.toolTip = None
- def OnMouseOverIn(self):
- if self.toolTip:
- self.toolTip.SetTop()
- self.toolTip.Show()
- def OnMouseOverOut(self):
- if self.toolTip:
- self.toolTip.Hide()
- # END_OF_TOOLTIP_IMAGE_BOX
- class QuestCurtain(ui.Window):
- CURTAIN_TIME = 0.25
- CURTAIN_SPEED = 200
- BarHeight = 60
- OnDoneEventList = []
- def __init__(self,layer="TOP_MOST"):
- ui.Window.__init__(self,layer)
- self.TopBar = ui.Bar("TOP_MOST")
- self.BottomBar = ui.Bar("TOP_MOST")
- self.TopBar.Show()
- self.BottomBar.Show()
- self.TopBar.SetColor(0xff000000)
- self.BottomBar.SetColor(0xff000000)
- self.TopBar.SetPosition(0,-self.BarHeight)
- self.TopBar.SetSize(wndMgr.GetScreenWidth(),self.BarHeight)
- self.BottomBar.SetPosition(0,wndMgr.GetScreenHeight())
- self.BottomBar.SetSize(wndMgr.GetScreenWidth(),self.BarHeight)
- self.CurtainMode = 0
- self.lastclock = time.clock()
- def Close(self):
- self.CurtainMode = 0
- self.TopBar.SetPosition(0, -self.BarHeight-1)
- self.BottomBar.SetPosition(0, wndMgr.GetScreenHeight()+1)
- for OnDoneEvent in QuestCurtain.OnDoneEventList:
- apply(OnDoneEvent,(self,))
- QuestCurtain.OnDoneEventList = []
- def OnUpdate(self):
- dt = time.clock() - self.lastclock
- if self.CurtainMode>0:
- self.TopBar.SetPosition(0, int(self.TopBar.GetGlobalPosition()[1]+dt*self.CURTAIN_SPEED))
- self.BottomBar.SetPosition(0, int(self.BottomBar.GetGlobalPosition()[1]-dt*self.CURTAIN_SPEED))
- if self.TopBar.GetGlobalPosition()[1]>0:
- self.TopBar.SetPosition(0,0)
- self.BottomBar.SetPosition(0,wndMgr.GetScreenHeight()-self.BarHeight)
- self.CurtainMode = 0
- elif self.CurtainMode<0:
- self.TopBar.SetPosition(0, int(self.TopBar.GetGlobalPosition()[1]-dt*self.CURTAIN_SPEED))
- self.BottomBar.SetPosition(0, int(self.BottomBar.GetGlobalPosition()[1]+dt*self.CURTAIN_SPEED))
- if self.TopBar.GetGlobalPosition()[1]<-self.BarHeight:
- self.TopBar.SetPosition(0,-self.BarHeight-1)
- self.BottomBar.SetPosition(0,wndMgr.GetScreenHeight()+1)
- self.Close()
- self.lastclock = time.clock()
- class EventCurtain(ui.Bar):
- COLOR_WHITE = 0.0
- COLOR_BLACK = 1.0
- DEFAULT_FADE_SPEED = 0.035
- STATE_WAIT = 0
- STATE_OUT = 1
- STATE_IN = 2
- def __init__(self, index):
- print "NEW EVENT CURTAIN ----------------------------------------------------------------------------"
- ui.Bar.__init__(self, "CURTAIN")
- self.SetWindowName("EventCurtain")
- self.AddFlag("float")
- self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
- self.Hide()
- self.fadeColor = 1.0
- self.curAlpha = 0.0
- self.FadeInFlag = False
- self.state = self.STATE_WAIT
- self.speed = 1.0
- self.eventIndex = index
- def __del__(self):
- print "---------------------------------------------------------------------------- DELETE EVENT CURTAIN"
- ui.Bar.__del__(self)
- def SetAlpha(self, alpha):
- color = grp.GenerateColor(self.fadeColor, self.fadeColor, self.fadeColor, alpha)
- self.SetColor(color)
- def FadeOut(self, speed):
- self.curAlpha = 0.0
- self.__StartFade(self.STATE_OUT, 0.0, speed)
- def FadeIn(self, speed):
- self.curAlpha = 1.0
- self.__StartFade(self.STATE_IN, 0.0, speed)
- def WhiteOut(self, speed):
- self.curAlpha = 0.0
- self.__StartFade(self.STATE_OUT, 1.0, speed)
- def WhiteIn(self, speed):
- self.curAlpha = 1.0
- self.__StartFade(self.STATE_IN, 1.0, speed)
- def __StartFade(self, state, color, speed):
- self.state = state
- self.fadeColor = color
- self.Show()
- self.speed = self.DEFAULT_FADE_SPEED
- if 0 != speed:
- self.speed = speed
- def __EndFade(self):
- event.EndEventProcess(self.eventIndex)
- def OnUpdate(self):
- if self.STATE_OUT == self.state:
- self.curAlpha += self.speed
- if self.curAlpha >= 1.0:
- self.state = self.STATE_WAIT
- self.curAlpha = 1.0
- self.__EndFade()
- elif self.STATE_IN == self.state:
- self.curAlpha -= self.speed
- if self.curAlpha <= 0.0:
- self.state = self.STATE_WAIT
- self.curAlpha = 0.0
- self.__EndFade()
- self.Hide()
- self.SetAlpha(self.curAlpha)
- class BarButton(ui.Button):
- ColorUp = 0x40999999
- ColorDown = 0x40aaaacc
- ColorOver = 0x40ddddff
- UP=0
- DOWN=1
- OVER=2
- def __init__(self, layer = "UI",
- aColorUp = ColorUp,
- aColorDown = ColorDown,
- aColorOver = ColorOver):
- ui.Button.__init__(self,layer)
- self.state = self.UP
- self.colortable = aColorUp, aColorDown, aColorOver
- def OnRender(self):
- x,y = self.GetGlobalPosition()
- grp.SetColor(self.colortable[self.state])
- grp.RenderBar(x,y,self.GetWidth(),self.GetHeight())
- def CallEvent(self):
- self.state = self.UP
- ui.Button.CallEvent(self)
- def DownEvent(self):
- self.state = self.DOWN
- def ShowToolTip(self):
- self.state = self.OVER
- def HideToolTip(self):
- self.state = self.UP
- class DescriptionWindow(ui.Window):
- def __init__(self,idx):
- ui.Window.__init__(self, "TOP_MOST")
- self.descIndex = idx
- def __del__(self):
- ui.Window.__del__(self)
- def OnRender(self):
- event.RenderEventSet(self.descIndex)
- class QuestDialog(ui.ScriptWindow):
- TITLE_STATE_NONE = 0
- TITLE_STATE_APPEAR = 1
- TITLE_STATE_SHOW = 2
- TITLE_STATE_DISAPPEAR = 3
- SKIN_NONE = 0
- SKIN_CINEMA = 5
- QUEST_BUTTON_MAX_NUM = 8
- def __init__(self,skin,idx):
- ui.ScriptWindow.__init__(self)
- self.SetWindowName("quest dialog")
- self.focusIndex = 0
- self.board = None
- self.sx = 0
- self.sy = 0
- self.skin = skin
- if skin == 3:
- event.SetRestrictedCount(idx,36)
- else:
- event.SetRestrictedCount(idx,60)
- QuestCurtain.BarHeight = (wndMgr.GetScreenHeight()-wndMgr.GetScreenWidth()*9/16)/2
- if QuestCurtain.BarHeight<0:
- QuestCurtain.BarHeight = 50
- if not ('QuestCurtain' in QuestDialog.__dict__):
- QuestDialog.QuestCurtain = QuestCurtain()
- QuestDialog.QuestCurtain.Show()
- QuestDialog.QuestCurtain.CurtainMode = 1
- self.nextCurtainMode = 0
- if self.skin:
- QuestDialog.QuestCurtain.CurtainMode = 1
- self.nextCurtainMode = 0
- self.LoadDialog(self.skin)
- else:
- QuestDialog.QuestCurtain.CurtainMode = -1
- self.nextCurtainMode = -1
- self.descIndex = idx
- self.descWindow = DescriptionWindow(idx)
- self.descWindow.Show()
- self.eventCurtain = EventCurtain(idx)
- event.SetEventHandler(idx, self)
- self.OnCloseEvent = None
- self.btnAnswer = None
- self.btnNext = None
- self.imgLeft = None
- self.imgTop = None
- self.imgBackground = None
- self.imgTitle = None
- self.titleState = self.TITLE_STATE_NONE
- self.titleShowTime = 0
- self.images = []
- self.prevbutton = None
- self.nextbutton = None
- # QUEST_INPUT
- self.needInputString = False
- self.editSlot = None
- self.editLine = None
- # END_OF_QUEST_INPUT
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def LoadDialog(self, skin):
- try:
- PythonScriptLoader = ui.PythonScriptLoader()
- PythonScriptLoader.LoadScriptFile(self, "uiscript/questdialog.py")
- except RuntimeError:
- dbg.TraceError("QuestDialog.LoadDialog")
- try:
- self.board = self.GetChild('board')
- except RuntimeError:
- dbg.TraceError("QuestDialog.BindObject")
- self.SetCenterPosition()
- if self.SKIN_CINEMA == skin:
- self.board.Hide()
- # QUEST_CANCEL
- def OnCancel(self):
- self.nextCurtainMode = -1
- self.CloseSelf()
- # END_OF_QUEST_CANCEL
- def CloseSelf(self):
- QuestDialog.QuestCurtain.CurtainMode = self.nextCurtainMode
- self.btnNext = None
- self.descWindow = None
- self.btnAnswer = None
- self.Destroy()
- if self.descIndex:
- event.ClearEventSet(self.descIndex)
- self.descIndex = None
- self.focusIndex = 0
- def Destroy(self):
- self.ClearDictionary()
- if self.OnCloseEvent:
- self.OnCloseEvent()
- self.OnCloseEvent = None
- # QUEST_INPUT
- if self.needInputString:
- if self.editLine:
- text = self.editLine.GetText()
- net.SendQuestInputStringPacket(text)
- # END_OF_QUEST_INPUT
- self.imgTitle = None
- self.images = None
- self.eventCurtain = None
- self.board = None
- def OnUpdate(self):
- if self.skin == self.SKIN_CINEMA:
- event.UpdateEventSet(self.descIndex, 50, -(wndMgr.GetScreenHeight() - 44))
- # AUTO_RESIZE_BOARD
- elif self.skin == 3:
- if self.board:
- event.UpdateEventSet(self.descIndex, self.board.GetGlobalPosition()[0]+20+self.sx, -self.board.GetGlobalPosition()[1]-20-self.sy)
- event.SetEventSetWidth(self.descIndex, self.board.GetWidth()-40)
- elif self.skin:
- if self.board:
- event.UpdateEventSet(self.descIndex, self.board.GetGlobalPosition()[0]+20, -self.board.GetGlobalPosition()[1]-20)
- event.SetEventSetWidth(self.descIndex, self.board.GetWidth()-40)
- # END_OF_AUTO_RESIZE_BOARD
- else:
- event.UpdateEventSet(self.descIndex, 0, 0)
- if self.TITLE_STATE_NONE != self.titleState:
- curTime = app.GetTime()
- elapsedTime = app.GetTime() - self.titleShowTime
- if self.TITLE_STATE_APPEAR == self.titleState:
- self.imgTitle.SetAlpha(elapsedTime*2)
- if elapsedTime > 0.5:
- self.titleState = self.TITLE_STATE_SHOW
- self.titleShowTime = curTime
- elif self.TITLE_STATE_SHOW == self.titleState:
- if elapsedTime > 1.0:
- self.titleState = self.TITLE_STATE_DISAPPEAR
- self.titleShowTime = curTime
- elif self.TITLE_STATE_DISAPPEAR == self.titleState:
- self.imgTitle.SetAlpha(1.0 - elapsedTime*2)
- if elapsedTime > 0.5:
- self.titleState = self.TITLE_STATE_NONE
- self.titleShowTime = curTime
- ## Set Variables
- def AddOnCloseEvent(self,f):
- if self.OnCloseEvent:
- self.OnCloseEvent = lambda z=[self.OnCloseEvent, f]:map(apply,z)
- else:
- self.OnCloseEvent = f
- def AddOnDoneEvent(self,f):
- QuestCurtain.OnDoneEventList.append(f)
- def SetOnCloseEvent(self,f):
- self.OnCloseEvent = f
- def SetEventSetPosition(self, x, y):
- self.sx = x
- self.sy = y
- def AdjustEventSetPosition(self, x, y):
- self.sx += x
- self.sy += y
- ## Event
- # QUEST_CANCEL
- def MakeNextButton(self, button_type):
- if self.SKIN_NONE == self.skin:
- return
- yPos = event.GetEventSetLocalYPosition(self.descIndex)
- b = BarButton()
- b.SetParent(self.board)
- b.SetSize(100,26)
- b.SetPosition(self.sx+self.board.GetWidth()/2-50,self.sy+yPos)
- self.nextButtonType = button_type;
- import localeInfo
- if event.BUTTON_TYPE_CANCEL == button_type:
- b.SetEvent(lambda s=self:event.SelectAnswer(s.descIndex, 254) or s.OnCancel())
- b.SetText(localeInfo.UI_CANCEL)
- elif event.BUTTON_TYPE_DONE == button_type:
- b.SetEvent(lambda s=self:s.CloseSelf())
- b.SetText(localeInfo.UI_OK)
- elif event.BUTTON_TYPE_NEXT == button_type:
- b.SetEvent(lambda s=self:event.SelectAnswer(s.descIndex, 254) or s.CloseSelf())
- b.SetText(localeInfo.UI_NEXT)
- b.Show()
- b.SetTextColor(0xffffffff)
- self.btnNext = b
- # END_OF_QUEST_CANCEL
- def MakeQuestion(self, n): # n은 모든 퀘스트 대화창의 마지막 버튼인 "닫기"를 포함한 전체 퀘스트 버튼 개수. by 김준호
- global entire_questbutton_number
- global entire_questpage_number
- global cur_questpage_number
- entire_questpage_number = ((n-2)/7)+1
- entire_questbutton_number = n
- if not self.board:
- return
- self.btnAnswer = [self.MakeEachButton(i) for i in xrange (n)]
- import localeInfo
- self.prevbutton = self.MakeNextPrevPageButton()
- self.prevbutton.SetPosition(self.sx+self.board.GetWidth()/2-164, self.board.GetHeight()/2-16)
- self.prevbutton.SetText(localeInfo.UI_PREVPAGE)
- self.prevbutton.SetEvent(self.PrevQuestPageEvent, 1, n)
- self.nextbutton = self.MakeNextPrevPageButton()
- self.nextbutton.SetPosition(self.sx+self.board.GetWidth()/2+112, self.board.GetHeight()/2-16)
- self.nextbutton.SetText(localeInfo.UI_NEXTPAGE)
- self.nextbutton.SetEvent(self.NextQuestPageEvent, 1, n)
- if cur_questpage_number != 1:
- cur_questpage_number = 1
- def MakeEachButton(self, i):
- if self.skin == 3:
- button = BarButton("TOP_MOST",0x50000000, 0x50404040, 0x50606060)
- button.SetParent(self.board)
- button.SetSize(106,26)
- button.SetPosition(self.sx + self.board.GetWidth()/2+((i*2)-1)*56-56, self.sy+(event.GetLineCount(self.descIndex))*16+20+5)
- button.SetText("a")
- button.SetTextColor(0xff000000)
- else:
- i = i % 8
- button = BarButton("TOP_MOST")
- button.SetParent(self.board)
- button.SetSize(200,26)
- button.SetPosition(self.sx + self.board.GetWidth()/2-100,self.sy+(event.GetLineCount(self.descIndex)+i*2)*16+20+5)
- button.SetText("a")
- button.SetTextColor(0xffffffff)
- return button
- def MakeNextPrevPageButton(self):
- button = BarButton("TOP_MOST")
- button.SetParent(self.board)
- button.SetSize(52,26)
- button.SetText("a")
- button.SetTextColor(0xffffffff)
- return button
- def RefreshQuestPage(self, n):
- global cur_questpage_number
- global entire_questpage_number
- num = 0
- Showing_button_inx = (cur_questpage_number-1)* self.QUEST_BUTTON_MAX_NUM
- while num < n:
- if num >= Showing_button_inx and num < Showing_button_inx + self.QUEST_BUTTON_MAX_NUM:
- self.btnAnswer[num].Show()
- else:
- self.btnAnswer[num].Hide()
- num = num + 1
- if cur_questpage_number == 1:
- self.prevbutton.Hide()
- self.nextbutton.Show()
- elif cur_questpage_number == entire_questpage_number:
- self.prevbutton.Show()
- self.nextbutton.Hide()
- else:
- self.prevbutton.Show()
- self.nextbutton.Show()
- def NextQuestPageEvent(self, one, n):
- global cur_questpage_number
- cur_questpage_number = cur_questpage_number + one
- self.RefreshQuestPage(n)
- def PrevQuestPageEvent(self, one, n):
- global cur_questpage_number
- cur_questpage_number = cur_questpage_number - one
- self.RefreshQuestPage(n)
- def ClickAnswerEvent(self, ai):
- event.SelectAnswer(self.descIndex, ai)
- self.nextbutton = None
- self.prevbutton = None
- self.CloseSelf()
- def AppendQuestion(self, name, idx): # idx는 0부터 시작함. PythonEventManager.cpp line 881 참고. by 김준호
- if not self.btnAnswer:
- return
- self.btnAnswer[idx].SetText(name)
- x, y= self.btnAnswer[idx].GetGlobalPosition()
- self.btnAnswer[idx].SetEvent(self.ClickAnswerEvent, idx)
- global entire_questbutton_number
- Showing_button_idx = (cur_questpage_number-1)* self.QUEST_BUTTON_MAX_NUM
- if Showing_button_idx <= idx and idx < Showing_button_idx + self.QUEST_BUTTON_MAX_NUM:
- self.btnAnswer[idx].Show()
- else:
- self.btnAnswer[idx].Hide()
- if entire_questbutton_number >= self.QUEST_BUTTON_MAX_NUM:
- self.nextbutton.Show()
- def FadeOut(self, speed):
- self.eventCurtain.FadeOut(speed)
- def FadeIn(self, speed):
- self.eventCurtain.FadeIn(speed)
- def WhiteOut(self, speed):
- self.eventCurtain.WhiteOut(speed)
- def WhiteIn(self, speed):
- self.eventCurtain.WhiteIn(speed)
- def DoneEvent(self):
- self.nextCurtainMode = -1
- if self.SKIN_NONE == self.skin or self.SKIN_CINEMA == self.skin:
- self.CloseSelf()
- def __GetQuestImageFileName(self, filename):
- if len(filename) > 1:
- if filename[1]!=':':
- filename = QUEST_BOARD_IMAGE_DIR+filename
- return filename
- # QUEST_INPUT
- def OnKeyDown(self, key):
- if self.btnAnswer == None:
- ## 선택문이 없고 '다음', '확인' 등의 일방 버튼만 있는 경우에 대한 처리
- if None != self.btnNext:
- if app.DIK_RETURN == key:
- self.OnPressEscapeKey()
- if app.DIK_UP == key or app.DIK_DOWN == key:
- self.btnNext.ShowToolTip()
- return True
- focusIndex = self.focusIndex;
- lastFocusIndex = focusIndex;
- #print "QuestDialog key down - focus, last : ", focusIndex, lastFocusIndex
- answerCount = len(self.btnAnswer)
- if app.DIK_DOWN == key:
- focusIndex += 1
- if app.DIK_UP == key:
- focusIndex -= 1
- if focusIndex < 0:
- focusIndex = answerCount - 1
- if focusIndex >= answerCount:
- focusIndex = 0
- self.focusIndex = focusIndex;
- focusBtn = self.btnAnswer[focusIndex]
- lastFocusBtn = self.btnAnswer[lastFocusIndex]
- if focusIndex != lastFocusIndex:
- focusBtn.ShowToolTip()
- lastFocusBtn.HideToolTip()
- if app.DIK_RETURN == key:
- focusBtn.CallEvent()
- return True
- def OnPressEscapeKey(self):
- # ESC키가 눌린 경우 "다음" 버튼을 누른 것과 같은 효과를 내도록 함.
- if None != self.btnNext:
- ##퀘스트문자들이 전부다 나왔을경우의 ESC버튼
- if event.BUTTON_TYPE_CANCEL == self.nextButtonType:
- event.SelectAnswer(self.descIndex, 254)
- self.CloseSelf()
- ## 아무 작업을 하지 않을때
- elif event.BUTTON_TYPE_DONE == self.nextButtonType:
- self.CloseSelf()
- ## 엔터나 다음화면으로 넘어가려고 할경우
- elif event.BUTTON_TYPE_NEXT == self.nextButtonType:
- event.SelectAnswer(self.descIndex, 254)
- self.CloseSelf()
- else:
- ## 도중에 꺼버리거나, ESC버튼이 나왓을경우
- event.SelectAnswer(self.descIndex, entire_questbutton_number -1 )
- self.nextbutton = None
- self.prevbutton = None
- self.OnCancel()
- return True
- def OnIMEReturn(self):
- if self.needInputString:
- self.CloseSelf()
- return True
- def OnIMEUpdate(self):
- if not self.needInputString:
- return
- if not self.editLine:
- return
- self.editLine.OnIMEUpdate()
- def OnInput(self):
- self.needInputString = True
- event.AddEventSetLocalYPosition(self.descIndex, 5+10)
- yPos = event.GetEventSetLocalYPosition(self.descIndex)
- self.editSlot = ui.SlotBar()
- self.editSlot.SetSize(200, 18)
- self.editSlot.SetPosition(0, yPos)
- self.editSlot.SetParent(self.board)
- self.editSlot.SetWindowHorizontalAlignCenter()
- self.editSlot.Show()
- self.editLine = ui.EditLine()
- self.editLine.SetParent(self.editSlot)
- self.editLine.SetPosition(3, 3)
- self.editLine.SetSize(200, 17)
- self.editLine.SetMax(30)
- self.editLine.SetFocus()
- self.editLine.Show()
- event.AddEventSetLocalYPosition(self.descIndex, 25+10)
- self.MakeNextButton(event.BUTTON_TYPE_DONE)
- self.editLine.UpdateRect()
- self.editSlot.UpdateRect()
- self.board.UpdateRect()
- # END_OF_QUEST_INPUT
- def OnImage(self, x, y, filename, desc=""):
- filename = self.__GetQuestImageFileName(filename)
- # IMAGE_EXCEPTION_BUG_FIX
- try:
- img = ui.MakeImageBox(self.board, filename, x, y)
- self.images.append(img)
- except RuntimeError:
- pass
- # END_OF_IMAGE_EXCEPTION_BUG_FIX
- # QUEST_IMAGE
- def OnInsertItemIcon(self, type, idx, title, desc, index=0, total=1):
- if "item" != type:
- return
- import item
- item.SelectItem(idx)
- filename = item.GetIconImageFileName()
- underTitle = title
- if not title and not desc:
- title = item.GetItemName()
- desc = item.GetItemDescription()
- tempDesc = desc
- desc = ""
- import grpText
- lineCount = grpText.GetSplitingTextLineCount(tempDesc, 25)
- for i in xrange(lineCount):
- desc += grpText.GetSplitingTextLine(tempDesc, 25, i) + "/"
- desc = desc[:-1]
- self.OnInsertImage(filename, underTitle, title, desc, index, total)
- def OnInsertImage(self, filename, underTitle, title, desc, index=0, total=1):
- if index == 0:
- event.AddEventSetLocalYPosition(self.descIndex, 24)
- y = event.GetEventSetLocalYPosition(self.descIndex)
- xBoard, yBoard = self.board.GetGlobalPosition()
- try:
- img = ToolTipImageBox()
- img.SetParent(self.board)
- img.LoadImage(filename)
- pos_x = (self.board.GetWidth() * (index + 1) / (total + 1)) - (img.GetWidth() / 2)
- img.SetPosition(pos_x, y)
- #img.SetWindowHorizontalAlignCenter()
- img.DestroyToolTip()
- if title and desc:
- img.CreateToolTip(self.board, title, desc, 0, yBoard + y + img.GetHeight())
- img.Show()
- self.images.append(img)
- except RuntimeError:
- pass
- event.AddEventSetLocalYPosition(self.descIndex, img.GetHeight() - 20)
- if underTitle:
- event.AddEventSetLocalYPosition(self.descIndex, 3)
- event.InsertTextInline(self.descIndex, underTitle, (self.board.GetWidth() * (index + 1) / (total + 1)))
- if index != total - 1:
- event.AddEventSetLocalYPosition(self.descIndex, -( 3 + 16 ))
- else:
- if index == total - 1:
- event.AddEventSetLocalYPosition(self.descIndex, 4)
- if index != total - 1:
- event.AddEventSetLocalYPosition(self.descIndex, -(img.GetHeight() - 20))
- # END_OF_QUEST_IMAGE
- def OnSize(self, width, height):
- self.board.SetSize(width, height)
- def OnTitleImage(self, filename):
- img = ui.ImageBox("TOP_MOST")
- try:
- img.SetWindowHorizontalAlignCenter()
- img.LoadImage(filename)
- img.SetPosition(0, wndMgr.GetScreenHeight() - (75/2) - (32/2))
- img.SetAlpha(0.0)
- img.Show()
- except RuntimeError:
- dbg.TraceError("QuestDialog.OnTitleImage(%s)" % filename)
- img.Hide()
- self.imgTitle = img
- self.titleState = self.TITLE_STATE_APPEAR
- self.titleShowTime = app.GetTime()
- def OnLeftImage(self, imgfile):
- imgfile = self.__GetQuestImageFileName(imgfile)
- if not self.imgLeft:
- self.imgLeft = ui.ExpandedImageBox("TOP_MOST")
- self.imgLeft.SetParent(self)
- self.imgLeft.SetPosition(0,0)
- bd = self.board
- bx, by = bd.GetLocalPosition()
- bd.SetPosition(160,by)
- if self.imgTop:
- tx, ty = self.imgTop.GetLocalPosition()
- self.imgTop.SetPosition(160,ty)
- try:
- self.imgLeft.LoadImage(imgfile)
- self.imgLeft.SetSize(400,450)
- self.imgLeft.SetOrigin(self.imgLeft.GetWidth()/2,self.imgLeft.GetHeight()/2)
- self.imgLeft.Show()
- except RuntimeError:
- import dbg
- dbg.TraceError("QuestDialog.OnLeftImage(%s)" % imgfile)
- self.imgLeft.Hide()
- def OnTopImage(self, imgfile):
- imgfile = self.__GetQuestImageFileName(imgfile)
- bd = self.board
- bx, by = bd.GetLocalPosition()
- if not self.imgTop:
- self.imgTop = ui.ExpandedImageBox("TOP_MOST")
- self.imgTop.SetParent(self)
- bd.SetPosition(bx,190)
- self.imgTop.SetPosition(bx,10)
- try:
- self.imgTop.LoadImage(imgfile)
- h = self.imgTop.GetHeight()
- if h>170:
- # need adjust board size
- bd.SetPosition(bx,20+h)
- bd.SetSize(350,420-h)
- self.imgTop.SetSize(350,h)
- else:
- self.imgTop.SetSize(350,170)
- bd.SetPosition(bx,190)
- bd.SetSize(350,250)
- self.imgTop.SetOrigin(self.imgTop.GetWidth()/2,self.imgTop.GetHeight()/2)
- self.imgTop.Show()
- except RuntimeError:
- dbg.TraceError("QuestDialog.OnTopImage(%s)" % imgfile)
- self.imgTop.Hide()
- def OnBackgroundImage(self, imgfile):
- imgfile = self.__GetQuestImageFileName(imgfile)
- c = self.board
- w = c.GetWidth()
- h = c.GetHeight()
- px, py = c.GetLocalPosition()
- moved = 0
- if not self.imgBackground:
- self.imgBackground = ui.ExpandedImageBox("TOP_MOST")
- self.imgBackground.SetParent(c)
- self.imgBackground.SetPosition(0,0)
- self.imgBackground.LoadImage(imgfile)
- iw = self.imgBackground.GetWidth()
- ih = self.imgBackground.GetHeight()
- if self.skin==3:
- iw = 256
- ih = 333
- self.imgBackground.SetSize(iw,ih)
- if w < iw:
- px -= (iw-w)/2
- c.SetPosition(px,py)
- w = iw
- if h < ih:
- py -= (ih-h)/2
- c.SetPosition(px,py)
- h = ih
- if self.skin == 3:
- w=256
- h = 333
- self.sx = 0
- self.sy = 100
- c.SetSize(w,h)
- c.HideInternal()
- c.SetWindowHorizontalAlignCenter()
- c.SetWindowVerticalAlignCenter()
- c.SetPosition(0,0)
- if self.skin==3:
- c.SetPosition(-190,0)
- self.imgBackground.SetWindowHorizontalAlignCenter()
- self.imgBackground.SetWindowVerticalAlignCenter()
- self.imgBackground.SetPosition(0,0)
- self.imgBackground.Show()
LG