Advertisement
Guest User

Untitled

a guest
May 4th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.71 KB | None | 0 0
  1. import chr
  2. import grp
  3. import app
  4. import math
  5. import wndMgr
  6. import snd
  7. import net
  8. import systemSetting
  9. import localeInfo
  10. import chr
  11.  
  12. import ui
  13. import uiScriptLocale
  14. import networkModule
  15. import musicInfo
  16. import playerSettingModule
  17.  
  18. ####################################
  19. # ºü¸¥ ½ÇÇàÀ» À§ÇÑ ¸ðµâ ·Îµù ºÐ´ã
  20. ####################################
  21. import uiCommon
  22. import uiMapNameShower
  23. import uiAffectShower
  24. import uiPlayerGauge
  25. import uiCharacter
  26. import uiTarget
  27. import consoleModule
  28.  
  29. # interface moduleÀÌ ¹®Á¦¾ß...
  30. import interfaceModule
  31. import uiTaskBar
  32. import uiInventory
  33.  
  34. ###################################
  35.  
  36. LEAVE_BUTTON_FOR_POTAL = FALSE
  37. NOT_NEED_DELETE_CODE = FALSE
  38. ENABLE_ENGNUM_DELETE_CODE = FALSE
  39.  
  40. if localeInfo.IsJAPAN():
  41. NOT_NEED_DELETE_CODE = TRUE
  42. elif localeInfo.IsHONGKONG():
  43. ENABLE_ENGNUM_DELETE_CODE = TRUE
  44. elif localeInfo.IsNEWCIBN() or localeInfo.IsCIBN10():
  45. ENABLE_ENGNUM_DELETE_CODE = TRUE
  46. elif localeInfo.IsEUROPE():
  47. ENABLE_ENGNUM_DELETE_CODE = TRUE
  48.  
  49. ###################################
  50.  
  51. class SelectCharacterWindow(ui.Window):
  52.  
  53. # SLOT4
  54. #SLOT_ROTATION = ( 140.0, 260.0, 20.0 )
  55. #SLOT_COUNT = 3
  56. SLOT_ROTATION = [135.0, 225.0, 315.0, 45.0]
  57. SLOT_COUNT = 4
  58. CHARACTER_TYPE_COUNT = 4
  59.  
  60. EMPIRE_NAME = {
  61. net.EMPIRE_A : localeInfo.EMPIRE_A,
  62. net.EMPIRE_B : localeInfo.EMPIRE_B,
  63. net.EMPIRE_C : localeInfo.EMPIRE_C
  64. }
  65.  
  66. class CharacterRenderer(ui.Window):
  67. def OnRender(self):
  68. grp.ClearDepthBuffer()
  69.  
  70. grp.SetGameRenderState()
  71. grp.PushState()
  72. grp.SetOmniLight()
  73.  
  74. screenWidth = wndMgr.GetScreenWidth()
  75. screenHeight = wndMgr.GetScreenHeight()
  76. newScreenWidth = float(screenWidth - 270)
  77. newScreenHeight = float(screenHeight)
  78.  
  79. grp.SetViewport(270.0/screenWidth, 0.0, newScreenWidth/screenWidth, newScreenHeight/screenHeight)
  80.  
  81. app.SetCenterPosition(0.0, 0.0, 0.0)
  82. app.SetCamera(1550.0, 15.0, 180.0, 95.0)
  83. grp.SetPerspective(10.0, newScreenWidth/newScreenHeight, 1000.0, 3000.0)
  84.  
  85. (x, y) = app.GetCursorPosition()
  86. grp.SetCursorPosition(x, y)
  87.  
  88. chr.Deform()
  89. chr.Render()
  90.  
  91. grp.RestoreViewport()
  92. grp.PopState()
  93. grp.SetInterfaceRenderState()
  94.  
  95. def __init__(self, stream):
  96. ui.Window.__init__(self)
  97. net.SetPhaseWindow(net.PHASE_WINDOW_SELECT, self)
  98.  
  99. self.stream=stream
  100. self.slot = self.stream.GetCharacterSlot()
  101.  
  102. self.openLoadingFlag = FALSE
  103. self.startIndex = -1
  104. self.startReservingTime = 0
  105.  
  106. self.flagDict = {}
  107. self.curRotation = []
  108. self.destRotation = []
  109. for rot in self.SLOT_ROTATION:
  110. self.curRotation.append(rot)
  111. self.destRotation.append(rot)
  112.  
  113. self.curNameAlpha = []
  114. self.destNameAlpha = []
  115. for i in xrange(self.CHARACTER_TYPE_COUNT):
  116. self.curNameAlpha.append(0.0)
  117. self.destNameAlpha.append(0.0)
  118.  
  119. self.curGauge = [0.0, 0.0, 0.0, 0.0]
  120. self.destGauge = [0.0, 0.0, 0.0, 0.0]
  121.  
  122. self.dlgBoard = 0
  123. self.changeNameFlag = FALSE
  124. self.nameInputBoard = None
  125. self.sendedChangeNamePacket = FALSE
  126.  
  127. self.startIndex = -1
  128. self.isLoad = 0
  129.  
  130. def __del__(self):
  131. ui.Window.__del__(self)
  132. net.SetPhaseWindow(net.PHASE_WINDOW_SELECT, 0)
  133.  
  134. def Open(self):
  135. if not self.__LoadBoardDialog(uiScriptLocale.LOCALE_UISCRIPT_PATH + "selectcharacterwindow.py"):
  136. import dbg
  137. dbg.TraceError("SelectCharacterWindow.Open - __LoadScript Error")
  138. return
  139.  
  140. if not self.__LoadQuestionDialog("uiscript/questiondialog.py"):
  141. return
  142.  
  143. playerSettingModule.LoadGameData("INIT")
  144.  
  145. self.InitCharacterBoard()
  146.  
  147. self.btnStart.Enable()
  148. self.btnCreate.Enable()
  149. self.btnDelete.Enable()
  150. self.btnExit.Enable()
  151. self.btnLeft.Enable()
  152. self.btnRight.Enable()
  153.  
  154. self.dlgBoard.Show()
  155. self.SetWindowName("SelectCharacterWindow")
  156. self.Show()
  157.  
  158. if self.slot>=0:
  159. self.SelectSlot(self.slot)
  160.  
  161. if musicInfo.selectMusic != "":
  162. snd.SetMusicVolume(systemSetting.GetMusicVolume())
  163. snd.FadeInMusic("BGM/"+musicInfo.selectMusic)
  164.  
  165. app.SetCenterPosition(0.0, 0.0, 0.0)
  166. app.SetCamera(1550.0, 15.0, 180.0, 95.0)
  167.  
  168. self.isLoad=1
  169. self.Refresh()
  170.  
  171. if self.stream.isAutoSelect:
  172. chrSlot=self.stream.GetCharacterSlot()
  173. self.SelectSlot(chrSlot)
  174. self.StartGame()
  175.  
  176. self.HideAllFlag()
  177. self.SetEmpire(net.GetEmpireID())
  178.  
  179. app.ShowCursor()
  180.  
  181. def Close(self):
  182. if musicInfo.selectMusic != "":
  183. snd.FadeOutMusic("BGM/"+musicInfo.selectMusic)
  184.  
  185. self.stream.popupWindow.Close()
  186.  
  187. if self.dlgBoard:
  188. self.dlgBoard.ClearDictionary()
  189.  
  190. self.empireName = None
  191. self.flagDict = {}
  192. self.dlgBoard = None
  193. self.btnStart = None
  194. self.btnCreate = None
  195. self.btnDelete = None
  196. self.btnExit = None
  197. self.btnLeft = None
  198. self.btnRight = None
  199. self.backGround = None
  200.  
  201. self.dlgQuestion.ClearDictionary()
  202. self.dlgQuestion = None
  203. self.dlgQuestionText = None
  204. self.dlgQuestionAcceptButton = None
  205. self.dlgQuestionCancelButton = None
  206. self.privateInputBoard = None
  207. self.nameInputBoard = None
  208.  
  209. chr.DeleteInstance(0)
  210. chr.DeleteInstance(1)
  211. chr.DeleteInstance(2)
  212. chr.DeleteInstance(3)
  213.  
  214. self.Hide()
  215. self.KillFocus()
  216.  
  217. app.HideCursor()
  218.  
  219. def SetEmpire(self, id):
  220. self.empireName.SetText(self.EMPIRE_NAME.get(id, ""))
  221. if self.flagDict.has_key(id):
  222. self.flagDict[id].Show()
  223.  
  224. def HideAllFlag(self):
  225. for flag in self.flagDict.values():
  226. flag.Hide()
  227.  
  228. def Refresh(self):
  229. if not self.isLoad:
  230. return
  231.  
  232. # SLOT4
  233. for i in xrange(self.SLOT_COUNT):
  234. id = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_ID)
  235. race = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_RACE)
  236. form = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_FORM)
  237. name = net.GetAccountCharacterSlotDataString(i, net.ACCOUNT_CHARACTER_SLOT_NAME)
  238. hair = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_HAIR)
  239. acce = 0
  240. if app.ENABLE_ACCE_SYSTEM:
  241. acce = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_ACCE)
  242.  
  243. if id != 0:
  244. self.MakeCharacter(i, id, name, race, form, hair, acce)
  245. self.SelectSlot(i)
  246. break
  247.  
  248. def GetCharacterSlotID(self, slotIndex):
  249. return net.GetAccountCharacterSlotDataInteger(slotIndex, net.ACCOUNT_CHARACTER_SLOT_ID)
  250.  
  251. def __LoadQuestionDialog(self, fileName):
  252. self.dlgQuestion = ui.ScriptWindow()
  253.  
  254. try:
  255. pyScrLoader = ui.PythonScriptLoader()
  256. pyScrLoader.LoadScriptFile(self.dlgQuestion, fileName)
  257. except:
  258. import exception
  259. exception.Abort("SelectCharacterWindow.LoadQuestionDialog.LoadScript")
  260.  
  261. try:
  262. GetObject=self.dlgQuestion.GetChild
  263. self.dlgQuestionText=GetObject("message")
  264. self.dlgQuestionAcceptButton=GetObject("accept")
  265. self.dlgQuestionCancelButton=GetObject("cancel")
  266. except:
  267. import exception
  268. exception.Abort("SelectCharacterWindow.LoadQuestionDialog.BindObject")
  269.  
  270. self.dlgQuestionText.SetText(localeInfo.SELECT_DO_YOU_DELETE_REALLY)
  271. self.dlgQuestionAcceptButton.SetEvent(ui.__mem_func__(self.RequestDeleteCharacter))
  272. self.dlgQuestionCancelButton.SetEvent(ui.__mem_func__(self.dlgQuestion.Hide))
  273. return 1
  274.  
  275. def __LoadBoardDialog(self, fileName):
  276. self.dlgBoard = ui.ScriptWindow()
  277.  
  278. try:
  279. pyScrLoader = ui.PythonScriptLoader()
  280. pyScrLoader.LoadScriptFile(self.dlgBoard, fileName)
  281. except:
  282. import exception
  283. exception.Abort("SelectCharacterWindow.LoadBoardDialog.LoadScript")
  284.  
  285. try:
  286. GetObject=self.dlgBoard.GetChild
  287.  
  288. self.btnStart = GetObject("start_button")
  289. self.btnCreate = GetObject("create_button")
  290. self.btnDelete = GetObject("delete_button")
  291. self.btnExit = GetObject("exit_button")
  292.  
  293. self.CharacterName = GetObject("character_name_value")
  294. self.CharacterLevel = GetObject("character_level_value")
  295. self.PlayTime = GetObject("character_play_time_value")
  296. self.CharacterHTH = GetObject("character_hth_value")
  297. self.CharacterINT = GetObject("character_int_value")
  298. self.CharacterSTR = GetObject("character_str_value")
  299. self.CharacterDEX = GetObject("character_dex_value")
  300. self.GuildName = GetObject("GuildName")
  301.  
  302. self.NameList = []
  303. self.NameList.append(GetObject("name_warrior"))
  304. self.NameList.append(GetObject("name_assassin"))
  305. self.NameList.append(GetObject("name_sura"))
  306. self.NameList.append(GetObject("name_shaman"))
  307.  
  308. self.GaugeList = []
  309. self.GaugeList.append(GetObject("gauge_hth"))
  310. self.GaugeList.append(GetObject("gauge_int"))
  311. self.GaugeList.append(GetObject("gauge_str"))
  312. self.GaugeList.append(GetObject("gauge_dex"))
  313.  
  314. self.btnLeft = GetObject("left_button")
  315. self.btnRight = GetObject("right_button")
  316.  
  317. self.empireName = GetObject("EmpireName")
  318. self.flagDict[net.EMPIRE_A] = GetObject("EmpireFlag_A")
  319. self.flagDict[net.EMPIRE_B] = GetObject("EmpireFlag_B")
  320. self.flagDict[net.EMPIRE_C] = GetObject("EmpireFlag_C")
  321.  
  322. self.backGround = GetObject("BackGround")
  323.  
  324. except:
  325. import exception
  326. exception.Abort("SelectCharacterWindow.LoadBoardDialog.BindObject")
  327.  
  328. for name in self.NameList:
  329. name.SetAlpha(0.0)
  330.  
  331. self.btnStart.SetEvent(ui.__mem_func__(self.StartGame))
  332. self.btnCreate.SetEvent(ui.__mem_func__(self.CreateCharacter))
  333. self.btnExit.SetEvent(ui.__mem_func__(self.ExitSelect))
  334.  
  335.  
  336.  
  337. if NOT_NEED_DELETE_CODE:
  338. self.btnDelete.SetEvent(ui.__mem_func__(self.PopupDeleteQuestion))
  339. else:
  340. self.btnDelete.SetEvent(ui.__mem_func__(self.InputPrivateCode))
  341.  
  342. self.btnLeft.SetEvent(ui.__mem_func__(self.DecreaseSlotIndex))
  343. self.btnRight.SetEvent(ui.__mem_func__(self.IncreaseSlotIndex))
  344.  
  345. self.chrRenderer = self.CharacterRenderer()
  346. self.chrRenderer.SetParent(self.backGround)
  347. self.chrRenderer.Show()
  348.  
  349. return 1
  350.  
  351. def SameLoginDisconnect(self):
  352. self.stream.popupWindow.Close()
  353. self.stream.popupWindow.Open(localeInfo.LOGIN_FAILURE_SAMELOGIN, self.ExitSelect, localeInfo.UI_OK)
  354. #self.stream.popupWindow.Open(localeInfo.LOGIN_FAILURE_ALREAY, app.Exit, localeInfo.UI_OK)
  355.  
  356. def MakeCharacter(self, index, id, name, race, form, hair, acce):
  357. if 0 == id:
  358. return
  359.  
  360. chr.CreateInstance(index)
  361. chr.SelectInstance(index)
  362. chr.SetVirtualID(index)
  363. chr.SetNameString(name)
  364.  
  365. chr.SetRace(race)
  366. chr.SetArmor(form)
  367. chr.SetHair(hair)
  368. if app.ENABLE_ACCE_SYSTEM:
  369. chr.SetAcce(acce)
  370. chr.Refresh()
  371. chr.SetMotionMode(chr.MOTION_MODE_GENERAL)
  372. chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)
  373.  
  374. chr.SetRotation(0.0)
  375.  
  376. ## Manage Character
  377. def StartGame(self):
  378.  
  379. if self.sendedChangeNamePacket:
  380. return
  381.  
  382. if self.changeNameFlag:
  383. self.OpenChangeNameDialog()
  384. return
  385.  
  386. if -1 != self.startIndex:
  387. return
  388.  
  389. if musicInfo.selectMusic != "":
  390. snd.FadeLimitOutMusic("BGM/"+musicInfo.selectMusic, systemSetting.GetMusicVolume()*0.05)
  391.  
  392. self.btnStart.SetUp()
  393. self.btnCreate.SetUp()
  394. self.btnDelete.SetUp()
  395. self.btnExit.SetUp()
  396. self.btnLeft.SetUp()
  397. self.btnRight.SetUp()
  398.  
  399. self.btnStart.Disable()
  400. self.btnCreate.Disable()
  401. self.btnDelete.Disable()
  402. self.btnExit.Disable()
  403. self.btnLeft.Disable()
  404. self.btnRight.Disable()
  405. self.dlgQuestion.Hide()
  406.  
  407. self.stream.SetCharacterSlot(self.slot)
  408.  
  409. self.startIndex = self.slot
  410. self.startReservingTime = app.GetTime()
  411.  
  412. for i in xrange(self.SLOT_COUNT):
  413.  
  414. if FALSE == chr.HasInstance(i):
  415. continue
  416.  
  417. chr.SelectInstance(i)
  418.  
  419. if i == self.slot:
  420. self.slot=self.slot
  421. chr.PushOnceMotion(chr.MOTION_INTRO_SELECTED, 0.1)
  422. continue
  423.  
  424. chr.PushOnceMotion(chr.MOTION_INTRO_NOT_SELECTED, 0.1)
  425.  
  426. def OpenChangeNameDialog(self):
  427. import uiCommon
  428. nameInputBoard = uiCommon.InputDialogWithDescription()
  429. nameInputBoard.SetTitle(localeInfo.SELECT_CHANGE_NAME_TITLE)
  430. nameInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputName))
  431. nameInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputName))
  432. nameInputBoard.SetMaxLength(chr.PLAYER_NAME_MAX_LEN)
  433. nameInputBoard.SetBoardWidth(200)
  434. nameInputBoard.SetDescription(localeInfo.SELECT_INPUT_CHANGING_NAME)
  435. nameInputBoard.Open()
  436. nameInputBoard.slot = self.slot
  437. self.nameInputBoard = nameInputBoard
  438.  
  439. def OnChangeName(self, id, name):
  440. self.SelectSlot(id)
  441. self.sendedChangeNamePacket = FALSE
  442. self.PopupMessage(localeInfo.SELECT_CHANGED_NAME)
  443.  
  444. def AcceptInputName(self):
  445. changeName = self.nameInputBoard.GetText()
  446. if not changeName:
  447. return
  448.  
  449. self.sendedChangeNamePacket = TRUE
  450. net.SendChangeNamePacket(self.nameInputBoard.slot, changeName)
  451. return self.CancelInputName()
  452.  
  453. def CancelInputName(self):
  454. self.nameInputBoard.Close()
  455. self.nameInputBoard = None
  456. return TRUE
  457.  
  458. def OnCreateFailure(self, type):
  459. self.sendedChangeNamePacket = FALSE
  460. if 0 == type:
  461. self.PopupMessage(localeInfo.SELECT_CHANGE_FAILURE_STRANGE_NAME)
  462. elif 1 == type:
  463. self.PopupMessage(localeInfo.SELECT_CHANGE_FAILURE_ALREADY_EXIST_NAME)
  464. elif 100 == type:
  465. self.PopupMessage(localeInfo.SELECT_CHANGE_FAILURE_STRANGE_INDEX)
  466.  
  467. def CreateCharacter(self):
  468. id = self.GetCharacterSlotID(self.slot)
  469. if 0==id:
  470. self.stream.SetCharacterSlot(self.slot)
  471.  
  472. EMPIRE_MODE = 1
  473.  
  474. if EMPIRE_MODE:
  475. if self.__AreAllSlotEmpty():
  476. self.stream.SetReselectEmpirePhase()
  477. else:
  478. self.stream.SetCreateCharacterPhase()
  479.  
  480. else:
  481. self.stream.SetCreateCharacterPhase()
  482.  
  483. def __AreAllSlotEmpty(self):
  484. for iSlot in xrange(self.SLOT_COUNT):
  485. if 0!=net.GetAccountCharacterSlotDataInteger(iSlot, net.ACCOUNT_CHARACTER_SLOT_ID):
  486. return 0
  487. return 1
  488.  
  489. def PopupDeleteQuestion(self):
  490. id = self.GetCharacterSlotID(self.slot)
  491. if 0 == id:
  492. return
  493.  
  494. self.dlgQuestion.Show()
  495. self.dlgQuestion.SetTop()
  496.  
  497. def RequestDeleteCharacter(self):
  498. self.dlgQuestion.Hide()
  499.  
  500. id = self.GetCharacterSlotID(self.slot)
  501. if 0 == id:
  502. self.PopupMessage(localeInfo.SELECT_EMPTY_SLOT)
  503. return
  504.  
  505. net.SendDestroyCharacterPacket(self.slot, "1234567")
  506. self.PopupMessage(localeInfo.SELECT_DELEING)
  507.  
  508. def InputPrivateCode(self):
  509.  
  510. import uiCommon
  511. privateInputBoard = uiCommon.InputDialogWithDescription()
  512. privateInputBoard.SetTitle(localeInfo.INPUT_PRIVATE_CODE_DIALOG_TITLE)
  513. privateInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrivateCode))
  514. privateInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputPrivateCode))
  515.  
  516. if ENABLE_ENGNUM_DELETE_CODE:
  517. pass
  518. else:
  519. privateInputBoard.SetNumberMode()
  520.  
  521. privateInputBoard.SetSecretMode()
  522. privateInputBoard.SetMaxLength(7)
  523.  
  524. privateInputBoard.SetBoardWidth(250)
  525. privateInputBoard.SetDescription(localeInfo.INPUT_PRIVATE_CODE_DIALOG_DESCRIPTION)
  526. privateInputBoard.Open()
  527. self.privateInputBoard = privateInputBoard
  528.  
  529. def AcceptInputPrivateCode(self):
  530. privateCode = self.privateInputBoard.GetText()
  531. if not privateCode:
  532. return
  533.  
  534. id = self.GetCharacterSlotID(self.slot)
  535. if 0 == id:
  536. self.PopupMessage(localeInfo.SELECT_EMPTY_SLOT)
  537. return
  538.  
  539. net.SendDestroyCharacterPacket(self.slot, privateCode)
  540. self.PopupMessage(localeInfo.SELECT_DELEING)
  541.  
  542. self.CancelInputPrivateCode()
  543. return TRUE
  544.  
  545. def CancelInputPrivateCode(self):
  546. self.privateInputBoard = None
  547. return TRUE
  548.  
  549. def OnDeleteSuccess(self, slot):
  550. self.PopupMessage(localeInfo.SELECT_DELETED)
  551. self.DeleteCharacter(slot)
  552.  
  553. def OnDeleteFailure(self):
  554. self.PopupMessage(localeInfo.SELECT_CAN_NOT_DELETE)
  555.  
  556. def DeleteCharacter(self, index):
  557. chr.DeleteInstance(index)
  558. self.SelectSlot(self.slot)
  559.  
  560. def ExitSelect(self):
  561. self.dlgQuestion.Hide()
  562.  
  563. if LEAVE_BUTTON_FOR_POTAL:
  564. if app.loggined:
  565. self.stream.SetPhaseWindow(0)
  566. else:
  567. self.stream.setloginphase()
  568. else:
  569. self.stream.SetLoginPhase()
  570.  
  571. self.Hide()
  572.  
  573. def GetSlotIndex(self):
  574. return self.slot
  575.  
  576. def DecreaseSlotIndex(self):
  577. slotIndex = (self.GetSlotIndex() - 1 + self.SLOT_COUNT) % self.SLOT_COUNT
  578. self.SelectSlot(slotIndex)
  579.  
  580. def IncreaseSlotIndex(self):
  581. slotIndex = (self.GetSlotIndex() + 1) % self.SLOT_COUNT
  582. self.SelectSlot(slotIndex)
  583.  
  584. def SelectSlot(self, index):
  585.  
  586. if index < 0:
  587. return
  588. if index >= self.SLOT_COUNT:
  589. return
  590.  
  591. self.slot = index
  592.  
  593. chr.SelectInstance(self.slot)
  594.  
  595. for i in xrange(self.CHARACTER_TYPE_COUNT):
  596. self.destNameAlpha[i] = 0.0
  597.  
  598. for i in xrange(self.SLOT_COUNT):
  599. self.destRotation[(i+self.slot)%self.SLOT_COUNT] = self.SLOT_ROTATION[i]
  600.  
  601. self.destGauge = [0.0, 0.0, 0.0, 0.0]
  602.  
  603. id=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_ID)
  604. if 0 != id:
  605.  
  606. self.btnStart.Show()
  607. self.btnDelete.Show()
  608. self.btnCreate.Hide()
  609.  
  610. playTime=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)
  611. level=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_LEVEL)
  612. race=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_RACE)
  613. valueHTH=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_HTH)
  614. valueINT=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_INT)
  615. valueSTR=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_STR)
  616. valueDEX=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_DEX)
  617. name=net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_NAME)
  618. guildID=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_ID)
  619. guildName=net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_NAME)
  620. self.changeNameFlag=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_CHANGE_NAME_FLAG)
  621.  
  622. job = chr.RaceToJob(race)
  623. if job >= 0 and job < self.CHARACTER_TYPE_COUNT:
  624. self.destNameAlpha[job] = 1.0
  625.  
  626. self.CharacterName.SetText(name)
  627. self.CharacterLevel.SetText(str(level))
  628.  
  629. self.PlayTime.SetText(str(playTime))
  630. self.CharacterHTH.SetText(str(valueHTH))
  631. self.CharacterINT.SetText(str(valueINT))
  632. self.CharacterSTR.SetText(str(valueSTR))
  633. self.CharacterDEX.SetText(str(valueDEX))
  634.  
  635. if guildName:
  636. self.GuildName.SetText(guildName)
  637. else:
  638. self.GuildName.SetText(localeInfo.SELECT_NOT_JOIN_GUILD)
  639.  
  640. statesSummary = float(valueHTH + valueINT + valueSTR + valueDEX)
  641. if statesSummary > 0.0:
  642. self.destGauge = [
  643. float(valueHTH) / statesSummary,
  644. float(valueINT) / statesSummary,
  645. float(valueSTR) / statesSummary,
  646. float(valueDEX) / statesSummary
  647. ]
  648.  
  649. else:
  650.  
  651. self.InitCharacterBoard()
  652.  
  653. def InitCharacterBoard(self):
  654.  
  655. self.btnStart.Hide()
  656. self.btnDelete.Hide()
  657. self.btnCreate.Show()
  658.  
  659. self.CharacterName.SetText("")
  660. self.CharacterLevel.SetText("")
  661. self.PlayTime.SetText("")
  662. self.CharacterHTH.SetText("")
  663. self.CharacterINT.SetText("")
  664. self.CharacterSTR.SetText("")
  665. self.CharacterDEX.SetText("")
  666. self.GuildName.SetText(localeInfo.SELECT_NOT_JOIN_GUILD)
  667.  
  668. ## Event
  669. def OnKeyDown(self, key):
  670.  
  671. if 1 == key:
  672. self.ExitSelect()
  673. if 2 == key:
  674. self.SelectSlot(0)
  675. if 3 == key:
  676. self.SelectSlot(1)
  677. if 4 == key:
  678. self.SelectSlot(2)
  679. if 5 == key:
  680. self.SelectSlot(3)
  681.  
  682. if 28 == key:
  683.  
  684. id = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_ID)
  685. if 0 == id:
  686. self.CreateCharacter()
  687.  
  688. else:
  689. self.StartGame()
  690.  
  691. if 203 == key:
  692. self.slot = (self.GetSlotIndex() - 1 + self.SLOT_COUNT) % self.SLOT_COUNT
  693. self.SelectSlot(self.slot)
  694. if 205 == key:
  695. self.slot = (self.GetSlotIndex() + 1) % self.SLOT_COUNT
  696. self.SelectSlot(self.slot)
  697.  
  698. return TRUE
  699.  
  700. def OnUpdate(self):
  701. chr.Update()
  702.  
  703. for i in xrange(4):
  704. self.curGauge[i] += (self.destGauge[i] - self.curGauge[i]) / 10.0
  705. if abs(self.curGauge[i] - self.destGauge[i]) < 0.005:
  706. self.curGauge[i] = self.destGauge[i]
  707. self.GaugeList[i].SetPercentage(self.curGauge[i], 1.0)
  708.  
  709. for i in xrange(self.CHARACTER_TYPE_COUNT):
  710. self.curNameAlpha[i] += (self.destNameAlpha[i] - self.curNameAlpha[i]) / 10.0
  711. self.NameList[i].SetAlpha(self.curNameAlpha[i])
  712.  
  713. for i in xrange(self.SLOT_COUNT):
  714.  
  715. if FALSE == chr.HasInstance(i):
  716. continue
  717.  
  718. chr.SelectInstance(i)
  719.  
  720. distance = 50.0
  721. rotRadian = self.curRotation[i] * (math.pi*2) / 360.0
  722. x = distance*math.sin(rotRadian) + distance*math.cos(rotRadian)
  723. y = distance*math.cos(rotRadian) - distance*math.sin(rotRadian)
  724. chr.SetPixelPosition(int(x), int(y), 30)
  725.  
  726. #####
  727.  
  728. dir = app.GetRotatingDirection(self.destRotation[i], self.curRotation[i])
  729. rot = app.GetDegreeDifference(self.destRotation[i], self.curRotation[i])
  730.  
  731. if app.DEGREE_DIRECTION_RIGHT == dir:
  732. self.curRotation[i] += rot / 10.0
  733. elif app.DEGREE_DIRECTION_LEFT == dir:
  734. self.curRotation[i] -= rot / 10.0
  735.  
  736. self.curRotation[i] = (self.curRotation[i] + 360.0) % 360.0
  737.  
  738. #######################################################
  739. if -1 != self.startIndex:
  740.  
  741. ## Temporary
  742. ## BackGroundLoadingÀÌ Áö¿ø µÉ¶§±îÁö Àӽ÷Î..
  743. if app.GetTime() - self.startReservingTime > 3.0:
  744. if FALSE == self.openLoadingFlag:
  745. chrSlot=self.stream.GetCharacterSlot()
  746. net.DirectEnter(chrSlot)
  747. self.openLoadingFlag = TRUE
  748.  
  749. playTime=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)
  750.  
  751. import player
  752. player.SetPlayTime(playTime)
  753. import chat
  754. chat.Clear() ## µé¾î°¥¶§ Chat À» ÃʱâÈ­. Àӽà Pos.
  755. ## Temporary
  756. #######################################################
  757.  
  758. def EmptyFunc(self):
  759. pass
  760.  
  761. def PopupMessage(self, msg, func=0):
  762. if not func:
  763. func=self.EmptyFunc
  764.  
  765. self.stream.popupWindow.Close()
  766. self.stream.popupWindow.Open(msg, func, localeInfo.UI_OK)
  767.  
  768. def OnPressExitKey(self):
  769. self.ExitSelect()
  770. return TRUE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement