Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.54 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. indexArray = (3, 2, 1, 0)
  234. for index in indexArray:
  235. id=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_ID)
  236. race=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_RACE)
  237. form=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_FORM)
  238. name=net.GetAccountCharacterSlotDataString(index, net.ACCOUNT_CHARACTER_SLOT_NAME)
  239. hair=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_HAIR)
  240.  
  241. if id:
  242. self.MakeCharacter(index, id, name, race, form, hair)
  243. self.SelectSlot(index)
  244.  
  245. self.SelectSlot(self.slot)
  246.  
  247. def GetCharacterSlotID(self, slotIndex):
  248. return net.GetAccountCharacterSlotDataInteger(slotIndex, net.ACCOUNT_CHARACTER_SLOT_ID)
  249.  
  250. def __LoadQuestionDialog(self, fileName):
  251. self.dlgQuestion = ui.ScriptWindow()
  252.  
  253. try:
  254. pyScrLoader = ui.PythonScriptLoader()
  255. pyScrLoader.LoadScriptFile(self.dlgQuestion, fileName)
  256. except:
  257. import exception
  258. exception.Abort("SelectCharacterWindow.LoadQuestionDialog.LoadScript")
  259.  
  260. try:
  261. GetObject=self.dlgQuestion.GetChild
  262. self.dlgQuestionText=GetObject("message")
  263. self.dlgQuestionAcceptButton=GetObject("accept")
  264. self.dlgQuestionCancelButton=GetObject("cancel")
  265. except:
  266. import exception
  267. exception.Abort("SelectCharacterWindow.LoadQuestionDialog.BindObject")
  268.  
  269. self.dlgQuestionText.SetText(localeInfo.SELECT_DO_YOU_DELETE_REALLY)
  270. self.dlgQuestionAcceptButton.SetEvent(ui.__mem_func__(self.RequestDeleteCharacter))
  271. self.dlgQuestionCancelButton.SetEvent(ui.__mem_func__(self.dlgQuestion.Hide))
  272. return 1
  273.  
  274. def __LoadBoardDialog(self, fileName):
  275. self.dlgBoard = ui.ScriptWindow()
  276.  
  277. try:
  278. pyScrLoader = ui.PythonScriptLoader()
  279. pyScrLoader.LoadScriptFile(self.dlgBoard, fileName)
  280. except:
  281. import exception
  282. exception.Abort("SelectCharacterWindow.LoadBoardDialog.LoadScript")
  283.  
  284. try:
  285. GetObject=self.dlgBoard.GetChild
  286.  
  287. self.btnStart = GetObject("start_button")
  288. self.btnCreate = GetObject("create_button")
  289. self.btnDelete = GetObject("delete_button")
  290. self.btnExit = GetObject("exit_button")
  291.  
  292. self.CharacterName = GetObject("character_name_value")
  293. self.CharacterLevel = GetObject("character_level_value")
  294. self.PlayTime = GetObject("character_play_time_value")
  295. self.CharacterHTH = GetObject("character_hth_value")
  296. self.CharacterINT = GetObject("character_int_value")
  297. self.CharacterSTR = GetObject("character_str_value")
  298. self.CharacterDEX = GetObject("character_dex_value")
  299. self.GuildName = GetObject("GuildName")
  300.  
  301. self.NameList = []
  302. self.NameList.append(GetObject("name_warrior"))
  303. self.NameList.append(GetObject("name_assassin"))
  304. self.NameList.append(GetObject("name_sura"))
  305. self.NameList.append(GetObject("name_shaman"))
  306.  
  307. self.GaugeList = []
  308. self.GaugeList.append(GetObject("gauge_hth"))
  309. self.GaugeList.append(GetObject("gauge_int"))
  310. self.GaugeList.append(GetObject("gauge_str"))
  311. self.GaugeList.append(GetObject("gauge_dex"))
  312.  
  313. self.btnLeft = GetObject("left_button")
  314. self.btnRight = GetObject("right_button")
  315.  
  316. self.empireName = GetObject("EmpireName")
  317. self.flagDict[net.EMPIRE_A] = GetObject("EmpireFlag_A")
  318. self.flagDict[net.EMPIRE_B] = GetObject("EmpireFlag_B")
  319. self.flagDict[net.EMPIRE_C] = GetObject("EmpireFlag_C")
  320.  
  321. self.backGround = GetObject("BackGround")
  322.  
  323. except:
  324. import exception
  325. exception.Abort("SelectCharacterWindow.LoadBoardDialog.BindObject")
  326.  
  327. for name in self.NameList:
  328. name.SetAlpha(0.0)
  329.  
  330. self.btnStart.SetEvent(ui.__mem_func__(self.StartGame))
  331. self.btnCreate.SetEvent(ui.__mem_func__(self.CreateCharacter))
  332. self.btnExit.SetEvent(ui.__mem_func__(self.ExitSelect))
  333.  
  334.  
  335.  
  336. if NOT_NEED_DELETE_CODE:
  337. self.btnDelete.SetEvent(ui.__mem_func__(self.PopupDeleteQuestion))
  338. else:
  339. self.btnDelete.SetEvent(ui.__mem_func__(self.InputPrivateCode))
  340.  
  341. self.btnLeft.SetEvent(ui.__mem_func__(self.DecreaseSlotIndex))
  342. self.btnRight.SetEvent(ui.__mem_func__(self.IncreaseSlotIndex))
  343.  
  344. self.chrRenderer = self.CharacterRenderer()
  345. self.chrRenderer.SetParent(self.backGround)
  346. self.chrRenderer.Show()
  347.  
  348. return 1
  349.  
  350. def SameLoginDisconnect(self):
  351. self.stream.popupWindow.Close()
  352. self.stream.popupWindow.Open(localeInfo.LOGIN_FAILURE_SAMELOGIN, self.ExitSelect, localeInfo.UI_OK)
  353. #self.stream.popupWindow.Open(localeInfo.LOGIN_FAILURE_ALREAY, app.Exit, localeInfo.UI_OK)
  354.  
  355. def MakeCharacter(self, index, id, name, race, form, hair):
  356. if 0 == id:
  357. return
  358.  
  359. chr.CreateInstance(index)
  360. chr.SelectInstance(index)
  361. chr.SetVirtualID(index)
  362. chr.SetNameString(name)
  363.  
  364. chr.SetRace(race)
  365. chr.SetArmor(form)
  366. chr.SetHair(hair)
  367.  
  368. chr.Refresh()
  369. chr.SetMotionMode(chr.MOTION_MODE_GENERAL)
  370. chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)
  371.  
  372. chr.SetRotation(0.0)
  373.  
  374. ## Manage Character
  375. def StartGame(self):
  376.  
  377. if self.sendedChangeNamePacket:
  378. return
  379.  
  380. if self.changeNameFlag:
  381. self.OpenChangeNameDialog()
  382. return
  383.  
  384. if -1 != self.startIndex:
  385. return
  386.  
  387. if musicInfo.selectMusic != "":
  388. snd.FadeLimitOutMusic("BGM/"+musicInfo.selectMusic, systemSetting.GetMusicVolume()*0.05)
  389.  
  390. self.btnStart.SetUp()
  391. self.btnCreate.SetUp()
  392. self.btnDelete.SetUp()
  393. self.btnExit.SetUp()
  394. self.btnLeft.SetUp()
  395. self.btnRight.SetUp()
  396.  
  397. self.btnStart.Disable()
  398. self.btnCreate.Disable()
  399. self.btnDelete.Disable()
  400. self.btnExit.Disable()
  401. self.btnLeft.Disable()
  402. self.btnRight.Disable()
  403. self.dlgQuestion.Hide()
  404.  
  405. self.stream.SetCharacterSlot(self.slot)
  406.  
  407. self.startIndex = self.slot
  408. self.startReservingTime = app.GetTime()
  409.  
  410. for i in xrange(self.SLOT_COUNT):
  411.  
  412. if False == chr.HasInstance(i):
  413. continue
  414.  
  415. chr.SelectInstance(i)
  416.  
  417. if i == self.slot:
  418. self.slot=self.slot
  419. chr.PushOnceMotion(chr.MOTION_INTRO_SELECTED, 0.1)
  420. continue
  421.  
  422. chr.PushOnceMotion(chr.MOTION_INTRO_NOT_SELECTED, 0.1)
  423.  
  424. def OpenChangeNameDialog(self):
  425. import uiCommon
  426. nameInputBoard = uiCommon.InputDialogWithDescription()
  427. nameInputBoard.SetTitle(localeInfo.SELECT_CHANGE_NAME_TITLE)
  428. nameInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputName))
  429. nameInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputName))
  430. nameInputBoard.SetMaxLength(chr.PLAYER_NAME_MAX_LEN)
  431. nameInputBoard.SetBoardWidth(200)
  432. nameInputBoard.SetDescription(localeInfo.SELECT_INPUT_CHANGING_NAME)
  433. nameInputBoard.Open()
  434. nameInputBoard.slot = self.slot
  435. self.nameInputBoard = nameInputBoard
  436.  
  437. def OnChangeName(self, id, name):
  438. self.SelectSlot(id)
  439. self.sendedChangeNamePacket = False
  440. self.PopupMessage(localeInfo.SELECT_CHANGED_NAME)
  441.  
  442. def AcceptInputName(self):
  443. changeName = self.nameInputBoard.GetText()
  444. if not changeName:
  445. return
  446.  
  447. self.sendedChangeNamePacket = True
  448. net.SendChangeNamePacket(self.nameInputBoard.slot, changeName)
  449. return self.CancelInputName()
  450.  
  451. def CancelInputName(self):
  452. self.nameInputBoard.Close()
  453. self.nameInputBoard = None
  454. return True
  455.  
  456. def OnCreateFailure(self, type):
  457. self.sendedChangeNamePacket = False
  458. if 0 == type:
  459. self.PopupMessage(localeInfo.SELECT_CHANGE_FAILURE_STRANGE_NAME)
  460. elif 1 == type:
  461. self.PopupMessage(localeInfo.SELECT_CHANGE_FAILURE_ALREADY_EXIST_NAME)
  462. elif 100 == type:
  463. self.PopupMessage(localeInfo.SELECT_CHANGE_FAILURE_STRANGE_INDEX)
  464.  
  465. def CreateCharacter(self):
  466. id = self.GetCharacterSlotID(self.slot)
  467. if 0==id:
  468. self.stream.SetCharacterSlot(self.slot)
  469.  
  470. EMPIRE_MODE = 1
  471.  
  472. if EMPIRE_MODE:
  473. if self.__AreAllSlotEmpty():
  474. self.stream.SetReselectEmpirePhase()
  475. else:
  476. self.stream.SetCreateCharacterPhase()
  477.  
  478. else:
  479. self.stream.SetCreateCharacterPhase()
  480.  
  481. def __AreAllSlotEmpty(self):
  482. for iSlot in xrange(self.SLOT_COUNT):
  483. if 0!=net.GetAccountCharacterSlotDataInteger(iSlot, net.ACCOUNT_CHARACTER_SLOT_ID):
  484. return 0
  485. return 1
  486.  
  487. def PopupDeleteQuestion(self):
  488. id = self.GetCharacterSlotID(self.slot)
  489. if 0 == id:
  490. return
  491.  
  492. self.dlgQuestion.Show()
  493. self.dlgQuestion.SetTop()
  494.  
  495. def RequestDeleteCharacter(self):
  496. self.dlgQuestion.Hide()
  497.  
  498. id = self.GetCharacterSlotID(self.slot)
  499. if 0 == id:
  500. self.PopupMessage(localeInfo.SELECT_EMPTY_SLOT)
  501. return
  502.  
  503. net.SendDestroyCharacterPacket(self.slot, "1234567")
  504. self.PopupMessage(localeInfo.SELECT_DELEING)
  505.  
  506. def InputPrivateCode(self):
  507.  
  508. import uiCommon
  509. privateInputBoard = uiCommon.InputDialogWithDescription()
  510. privateInputBoard.SetTitle(localeInfo.INPUT_PRIVATE_CODE_DIALOG_TITLE)
  511. privateInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrivateCode))
  512. privateInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputPrivateCode))
  513.  
  514. if ENABLE_ENGNUM_DELETE_CODE:
  515. pass
  516. else:
  517. privateInputBoard.SetNumberMode()
  518.  
  519. privateInputBoard.SetSecretMode()
  520. privateInputBoard.SetMaxLength(7)
  521.  
  522. privateInputBoard.SetBoardWidth(250)
  523. privateInputBoard.SetDescription(localeInfo.INPUT_PRIVATE_CODE_DIALOG_DESCRIPTION)
  524. privateInputBoard.Open()
  525. self.privateInputBoard = privateInputBoard
  526.  
  527. def AcceptInputPrivateCode(self):
  528. privateCode = self.privateInputBoard.GetText()
  529. if not privateCode:
  530. return
  531.  
  532. id = self.GetCharacterSlotID(self.slot)
  533. if 0 == id:
  534. self.PopupMessage(localeInfo.SELECT_EMPTY_SLOT)
  535. return
  536.  
  537. net.SendDestroyCharacterPacket(self.slot, privateCode)
  538. self.PopupMessage(localeInfo.SELECT_DELEING)
  539.  
  540. self.CancelInputPrivateCode()
  541. return True
  542.  
  543. def CancelInputPrivateCode(self):
  544. self.privateInputBoard = None
  545. return True
  546.  
  547. def OnDeleteSuccess(self, slot):
  548. self.PopupMessage(localeInfo.SELECT_DELETED)
  549. self.DeleteCharacter(slot)
  550.  
  551. def OnDeleteFailure(self):
  552. self.PopupMessage(localeInfo.SELECT_CAN_NOT_DELETE)
  553.  
  554. def DeleteCharacter(self, index):
  555. chr.DeleteInstance(index)
  556. self.SelectSlot(self.slot)
  557.  
  558. def ExitSelect(self):
  559. self.dlgQuestion.Hide()
  560.  
  561. if LEAVE_BUTTON_FOR_POTAL:
  562. if app.loggined:
  563. self.stream.SetPhaseWindow(0)
  564. else:
  565. self.stream.setloginphase()
  566. else:
  567. self.stream.SetLoginPhase()
  568.  
  569. self.Hide()
  570.  
  571. def GetSlotIndex(self):
  572. return self.slot
  573.  
  574. def DecreaseSlotIndex(self):
  575. slotIndex = (self.GetSlotIndex() - 1 + self.SLOT_COUNT) % self.SLOT_COUNT
  576. self.SelectSlot(slotIndex)
  577.  
  578. def IncreaseSlotIndex(self):
  579. slotIndex = (self.GetSlotIndex() + 1) % self.SLOT_COUNT
  580. self.SelectSlot(slotIndex)
  581.  
  582. def SelectSlot(self, index):
  583.  
  584. if index < 0:
  585. return
  586. if index >= self.SLOT_COUNT:
  587. return
  588.  
  589. self.slot = index
  590.  
  591. chr.SelectInstance(self.slot)
  592.  
  593. for i in xrange(self.CHARACTER_TYPE_COUNT):
  594. self.destNameAlpha[i] = 0.0
  595.  
  596. for i in xrange(self.SLOT_COUNT):
  597. self.destRotation[(i+self.slot)%self.SLOT_COUNT] = self.SLOT_ROTATION[i]
  598.  
  599. self.destGauge = [0.0, 0.0, 0.0, 0.0]
  600.  
  601. id=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_ID)
  602. if 0 != id:
  603.  
  604. self.btnStart.Show()
  605. self.btnDelete.Show()
  606. self.btnCreate.Hide()
  607.  
  608. playTime=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)
  609. level=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_LEVEL)
  610. race=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_RACE)
  611. valueHTH=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_HTH)
  612. valueINT=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_INT)
  613. valueSTR=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_STR)
  614. valueDEX=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_DEX)
  615. name=net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_NAME)
  616. guildID=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_ID)
  617. guildName=net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_NAME)
  618. self.changeNameFlag=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_CHANGE_NAME_FLAG)
  619.  
  620. job = chr.RaceToJob(race)
  621. if job >= 0 and job < self.CHARACTER_TYPE_COUNT:
  622. self.destNameAlpha[job] = 1.0
  623.  
  624. self.CharacterName.SetText(name)
  625. self.CharacterLevel.SetText(str(level))
  626.  
  627. self.PlayTime.SetText(str(playTime))
  628. self.CharacterHTH.SetText(str(valueHTH))
  629. self.CharacterINT.SetText(str(valueINT))
  630. self.CharacterSTR.SetText(str(valueSTR))
  631. self.CharacterDEX.SetText(str(valueDEX))
  632.  
  633. if guildName:
  634. self.GuildName.SetText(guildName)
  635. else:
  636. self.GuildName.SetText(localeInfo.SELECT_NOT_JOIN_GUILD)
  637.  
  638. statesSummary = float(valueHTH + valueINT + valueSTR + valueDEX)
  639. if statesSummary > 0.0:
  640. self.destGauge = [
  641. float(valueHTH) / statesSummary,
  642. float(valueINT) / statesSummary,
  643. float(valueSTR) / statesSummary,
  644. float(valueDEX) / statesSummary
  645. ]
  646.  
  647. else:
  648.  
  649. self.InitCharacterBoard()
  650.  
  651. def InitCharacterBoard(self):
  652.  
  653. self.btnStart.Hide()
  654. self.btnDelete.Hide()
  655. self.btnCreate.Show()
  656.  
  657. self.CharacterName.SetText("")
  658. self.CharacterLevel.SetText("")
  659. self.PlayTime.SetText("")
  660. self.CharacterHTH.SetText("")
  661. self.CharacterINT.SetText("")
  662. self.CharacterSTR.SetText("")
  663. self.CharacterDEX.SetText("")
  664. self.GuildName.SetText(localeInfo.SELECT_NOT_JOIN_GUILD)
  665.  
  666. ## Event
  667. def OnKeyDown(self, key):
  668.  
  669. if 1 == key:
  670. self.ExitSelect()
  671. if 2 == key:
  672. self.SelectSlot(0)
  673. if 3 == key:
  674. self.SelectSlot(1)
  675. if 4 == key:
  676. self.SelectSlot(2)
  677. if 5 == key:
  678. self.SelectSlot(3)
  679.  
  680. if 28 == key:
  681.  
  682. id = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_ID)
  683. if 0 == id:
  684. self.CreateCharacter()
  685.  
  686. else:
  687. self.StartGame()
  688.  
  689. if 203 == key:
  690. self.slot = (self.GetSlotIndex() - 1 + self.SLOT_COUNT) % self.SLOT_COUNT
  691. self.SelectSlot(self.slot)
  692. if 205 == key:
  693. self.slot = (self.GetSlotIndex() + 1) % self.SLOT_COUNT
  694. self.SelectSlot(self.slot)
  695.  
  696. return True
  697.  
  698. def OnUpdate(self):
  699. chr.Update()
  700.  
  701. for i in xrange(4):
  702. self.curGauge[i] += (self.destGauge[i] - self.curGauge[i]) / 10.0
  703. if abs(self.curGauge[i] - self.destGauge[i]) < 0.005:
  704. self.curGauge[i] = self.destGauge[i]
  705. self.GaugeList[i].SetPercentage(self.curGauge[i], 1.0)
  706.  
  707. for i in xrange(self.CHARACTER_TYPE_COUNT):
  708. self.curNameAlpha[i] += (self.destNameAlpha[i] - self.curNameAlpha[i]) / 10.0
  709. self.NameList[i].SetAlpha(self.curNameAlpha[i])
  710.  
  711. for i in xrange(self.SLOT_COUNT):
  712.  
  713. if False == chr.HasInstance(i):
  714. continue
  715.  
  716. chr.SelectInstance(i)
  717.  
  718. distance = 50.0
  719. rotRadian = self.curRotation[i] * (math.pi*2) / 360.0
  720. x = distance*math.sin(rotRadian) + distance*math.cos(rotRadian)
  721. y = distance*math.cos(rotRadian) - distance*math.sin(rotRadian)
  722. chr.SetPixelPosition(int(x), int(y), 30)
  723.  
  724. #####
  725.  
  726. dir = app.GetRotatingDirection(self.destRotation[i], self.curRotation[i])
  727. rot = app.GetDegreeDifference(self.destRotation[i], self.curRotation[i])
  728.  
  729. if app.DEGREE_DIRECTION_RIGHT == dir:
  730. self.curRotation[i] += rot / 10.0
  731. elif app.DEGREE_DIRECTION_LEFT == dir:
  732. self.curRotation[i] -= rot / 10.0
  733.  
  734. self.curRotation[i] = (self.curRotation[i] + 360.0) % 360.0
  735.  
  736. #######################################################
  737. if -1 != self.startIndex:
  738.  
  739. ## Temporary
  740. ## BackGroundLoading이 지원 될때까지 임시로..
  741. if app.GetTime() - self.startReservingTime > 3.0:
  742. if False == self.openLoadingFlag:
  743. chrSlot=self.stream.GetCharacterSlot()
  744. net.DirectEnter(chrSlot)
  745. self.openLoadingFlag = True
  746.  
  747. playTime=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)
  748.  
  749. import player
  750. player.SetPlayTime(playTime)
  751. import chat
  752. chat.Clear() ## 들어갈때 Chat 을 초기화. 임시 Pos.
  753. ## Temporary
  754. #######################################################
  755.  
  756. def EmptyFunc(self):
  757. pass
  758.  
  759. def PopupMessage(self, msg, func=0):
  760. if not func:
  761. func=self.EmptyFunc
  762.  
  763. self.stream.popupWindow.Close()
  764. self.stream.popupWindow.Open(msg, func, localeInfo.UI_OK)
  765.  
  766. def OnPressExitKey(self):
  767. self.ExitSelect()
  768. return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement