Guest User

Untitled

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