- Mesaj
- 878
- Çözümler
- 21
- Beğeni
- 122
- Puan
- 559
- Ticaret Puanı
- 0
Python:
import ui
import localeInfo
import item
import time
import wndMgr
import uiToolTip
import app
FAKE_EVENT_DATA = {
0 : [
("Pazartesi", "21:00", "23:00", 817, "EP Parşömeni"),
("Salı", "21:00", "23:00", 817, "EP Parşömeni"),
("Çarşamba", "21:00", "23:30", 817, "EP Parşömeni"),
("Perşembe", "21:00", "23:00", 817, "EP Parşömeni"),
("Cuma", "21:00", "23:00", 817, "EP Parşömeni"),
("Cumartesi", "21:00", "23:00", 817, "EP Parşömeni"),
("Pazar", "21:00", "23:00", 817, "EP Parşömeni"),
],
1 : [
("Cumartesi", "21:00", "00:00", 70079, "Bilgi Girilmedi"),
]
}
DAY_NAME_INDEX = {
"Pazar" : 0,
"Pazartesi" : 1,
"Salı" : 2,
"Çarşamba" : 3,
"Perşembe" : 4,
"Cuma" : 5,
"Cumartesi" : 6,
"Her gün" : 7,
}
EVENT_MAX_COUNT = 11
class EventObj:
EVENT_WINDOW_INDEX = 0
EVENT_DAY_INDEX = 1
EVENT_STARTTIME_INDEX = 2
EVENT_FINSHTIME_INDEX = 3
EVENT_ACTIVE_INDEX = 4
EVENT_ITEM_INDEX = 5
EVENT_NAME_INDEX = 6
def __init__(self, parent, x, y):
self.Children = []
window = ui.Window()
window.SetParent(parent)
window.SetPosition(x, y)
window.Show()
self.Children.append(window)
dayText = ui.TextLine()
dayText.SetParent(window)
dayText.SetText("Pazartesi")
dayText.SetPosition(50, 0)
dayText.SetHorizontalAlignCenter()
dayText.Show()
self.Children.append(dayText)
startTimeText = ui.TextLine()
startTimeText.SetParent(window)
startTimeText.SetText("18:00")
startTimeText.SetPosition(130, 0)
startTimeText.SetHorizontalAlignCenter()
startTimeText.Show()
self.Children.append(startTimeText)
finshTimeText = ui.TextLine()
finshTimeText.SetParent(window)
finshTimeText.SetText("20:00")
finshTimeText.SetPosition(200, 0)
finshTimeText.SetHorizontalAlignCenter()
finshTimeText.Show()
self.Children.append(finshTimeText)
isActivateText = ui.TextLine()
isActivateText.SetParent(window)
isActivateText.SetText("|cFF0ea930[Aktif] |r")
isActivateText.SetPosition(240, 0)
isActivateText.SetHorizontalAlignCenter()
isActivateText.Hide()
self.Children.append(isActivateText)
wndItem = ui.GridSlotWindow()
wndItem.SetParent(window)
wndItem.ArrangeSlot(0, 1, 1, 32, 32, 0, 0)
wndItem.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
wndItem.SetCoverButton(0)
wndItem.EnableCoverButton(0)
wndItem.RefreshSlot()
wndItem.SetPosition(280, -10)
wndItem.SetWindowHorizontalAlignCenter()
wndItem.Show()
self.Children.append(wndItem)
nameText = ui.TextLine()
nameText.SetParent(window)
nameText.SetText("Deneme Etkinligi & Deneme Etkinligi")
nameText.SetPosition(325, -3)
nameText.Show()
self.Children.append(nameText)
def __del__(self):
for child in self.Children:
del child
self.Children = []
def SetDay(self, text):
dayText = self.Children[EventObj.EVENT_DAY_INDEX]
dayText.SetText(text)
dayText.SetPackedFontColor(0xfff8d090)
def GetDay(self):
return self.Children[EventObj.EVENT_DAY_INDEX]
def SetStartTime(self, text):
startTimeText = self.Children[EventObj.EVENT_STARTTIME_INDEX]
startTimeText.SetText(text)
startTimeText.SetPackedFontColor(0xfff8d090)
def GetStartTime(self):
return self.Children[EventObj.EVENT_STARTTIME_INDEX]
def SetFinshTime(self, text):
finshTimeText = self.Children[EventObj.EVENT_FINSHTIME_INDEX]
finshTimeText.SetText(text)
finshTimeText.SetPackedFontColor(0xfff8d090)
def GetFinshTime(self):
return self.Children[EventObj.EVENT_FINSHTIME_INDEX]
def SetActive(self, isActive):
isActivateText = self.Children[EventObj.EVENT_ACTIVE_INDEX]
wndItem = self.GetItem()
if isActive:
isActivateText.Show()
isActivateText.SetText("|cFF0ea930[Aktif] |r")
wndItem.ActivateSlot(0, wndMgr.COLOR_TYPE_GREEN)
else:
isActivateText.Show()
isActivateText.SetText("|cFFDE0101[Pasif] |r")
wndItem.ActivateSlot(0, wndMgr.COLOR_TYPE_RED)
def GetActive(self):
return self.Children[EventObj.EVENT_ACTIVE_INDEX]
def SetItem(self, itemVnum):
wndItem = self.Children[EventObj.EVENT_ITEM_INDEX]
wndItem.SetItemSlot(0, itemVnum, 0)
wndItem.RefreshSlot()
def GetItem(self):
return self.Children[EventObj.EVENT_ITEM_INDEX]
def SetName(self, text):
nameText = self.Children[EventObj.EVENT_NAME_INDEX]
nameText.SetText(text)
nameText.SetPackedFontColor(0xfff8d090)
def GetName(self):
return self.Children[EventObj.EVENT_NAME_INDEX]
class EventBoardWindow(ui.ScriptWindow):
class TitleBar(ui.TitleBar):
def CloseButtonHide(self):
if not self.btnClose:
return
self.imgRight.LoadImage("d:/ymir work/ui/pattern/titlebar_right_02.tga")
self.btnClose.Hide()
def __init__(self):
ui.ScriptWindow.__init__(self)
self.boardFirst = None
self.boardSecond = None
self.eventButton = None
self.bossButton = None
self.tableType = 0
self.eventList = []
self.bossList = []
self.LoadWindow()
def __del__(self):
ui.ScriptWindow.__del__(self)
def Destroy(self):
self.ClearDictionary()
def LoadWindow(self):
try:
ui.PythonScriptLoader().LoadScriptFile(self, "UIScript/calendarwindow.py")
except:
import exception
exception.Abort("EventBoardWindow.LoadDialog.LoadObject")
try:
self.GetChild("TitleBar").SetCloseEvent(self.Close)
subTitleBar = ui.ExpandedImageBox()
subTitleBar.SetParent(self)
subTitleBar.SetPosition(10, 60)
subTitleBar.LoadImage("d:/ymir work/ui/event_list_menu.tga")
subTitleBar.Show()
self.InsertChild("subTitleBar", subTitleBar)
subTitleText1 = ui.TextLine()
subTitleText1.SetParent(subTitleBar)
subTitleText1.SetPosition(40, 3)
subTitleText1.SetText("Gün")
subTitleText1.SetPackedFontColor(0xfff8d090)
subTitleText1.Show()
self.InsertChild("subTitleText1", subTitleText1)
subTitleText2 = ui.TextLine()
subTitleText2.SetParent(subTitleBar)
subTitleText2.SetPosition(110, 3)
subTitleText2.SetText("Baslangıç")
subTitleText2.SetPackedFontColor(0xfff8d090)
subTitleText2.Show()
self.InsertChild("subTitleText2", subTitleText2)
subTitleText3 = ui.TextLine()
subTitleText3.SetParent(subTitleBar)
subTitleText3.SetPosition(190, 3)
subTitleText3.SetText("Bitiş")
subTitleText3.SetPackedFontColor(0xfff8d090)
subTitleText3.Show()
self.InsertChild("subTitleText3", subTitleText3)
subTitleText4 = ui.TextLine()
subTitleText4.SetParent(subTitleBar)
subTitleText4.SetPosition(360, 3)
subTitleText4.SetText("Türü")
subTitleText4.SetPackedFontColor(0xfff8d090)
subTitleText4.Show()
self.InsertChild("subTitleText4", subTitleText4)
subTitleText5 = ui.TextLine()
subTitleText5.SetParent(subTitleBar)
subTitleText5.SetPosition(190+40+40-3, 3)
subTitleText5.SetText("Durum")
subTitleText5.SetPackedFontColor(0xfff8d090)
subTitleText5.Show()
self.InsertChild("subTitleText5", subTitleText5)
self.boardFirst = self.GetChild("board_first")
self.boardSecond = self.GetChild("board_second")
self.eventButton = self.GetChild("EventTimesButton")
self.bossButton = self.GetChild("BossTimesButton")
except:
import exception
exception.Abort("EventBoardWindow.LoadDialog.BindObject")
self.eventButton.SetEvent(self.__ButtonEvent, 0)
self.bossButton.SetEvent(self.__ButtonEvent, 1)
self.__ButtonEvent(self.tableType)
def Open(self):
self.SetCenterPosition()
self.Show()
self.SetTop()
self.RefreshProcess()
def Close(self):
self.Hide()
return True
def __ButtonEvent(self, type):
self.tableType = type
self.RefreshProcess()
if self.tableType == 0:
self.eventButton.Down()
self.eventButton.Disable()
self.bossButton.Down()
self.bossButton.Disable()
else:
self.eventButton.SetUp()
self.eventButton.Enable()
self.bossButton.Down()
self.bossButton.Disable()
def RefreshProcess(self):
self.eventList = []
self.bossList = []
try:
eventTuple = FAKE_EVENT_DATA[self.tableType]
except:
return
if not eventTuple:
return
data_count = len(eventTuple)
if data_count < 1:
return
for index in xrange(0, data_count):
if index >= EVENT_MAX_COUNT:
break
(dayName, startTime, finshTime, itemVnum, eventName) = eventTuple[index]
eventObj = EventObj(self.boardFirst, 0, 35 * index + 20)
eventObj.SetDay(dayName)
eventObj.SetStartTime(startTime)
eventObj.SetFinshTime(finshTime)
eventObj.SetItem(itemVnum)
isActive = False
if DAY_NAME_INDEX.has_key(dayName):
startTime = int(startTime.replace(":", ""))
finshTime = int(finshTime.replace(":", ""))
eventDayIndex = DAY_NAME_INDEX[dayName]
dayIndex = int(time.strftime("%w"))
time_ = int("%s%s" % (time.strftime("%H"), time.strftime("%M")))
isActive = (eventDayIndex == 7 or eventDayIndex == dayIndex)
isActive = (isActive and (startTime <= time_ and finshTime >= time_))
eventObj.SetActive(isActive)
eventObj.SetName(eventName)
self.eventList.append(eventObj)
def OnPressEscapeKey(self):
self.Close()
return True
ben kodların nasıl çalıştığını çözemedim. Etkinlik için oraya sadece görsel mi ekleniliyor kafam karıştı