masodikbela

newcharselect_dev

Jan 3rd, 2016
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.97 KB | None | 0 0
  1. import ui
  2. import chr
  3. import grp
  4. import app
  5. import snd
  6. import net
  7. import math
  8. import event
  9. import wndMgr
  10. import uiCommon
  11. import uiTarget
  12. import constInfo
  13. import musicInfo
  14. import uiTaskBar
  15. import uiToolTip
  16. import localeInfo
  17. import uiCharacter
  18. import uiInventory
  19. import uiPlayerGauge
  20. import consoleModule
  21. import systemSetting
  22. import networkModule
  23. import uiAffectShower
  24. import uiScriptLocale
  25. import uiMapNameShower
  26. import interfaceModule
  27. import playerSettingModule
  28.  
  29. LEAVE_BUTTON_FOR_POTAL = FALSE
  30. NOT_NEED_DELETE_CODE = FALSE
  31. ENABLE_ENGNUM_DELETE_CODE = FALSE
  32.  
  33. if localeInfo.IsJAPAN():
  34. NOT_NEED_DELETE_CODE = TRUE
  35. elif localeInfo.IsHONGKONG():
  36. ENABLE_ENGNUM_DELETE_CODE = TRUE
  37. elif localeInfo.IsNEWCIBN() or localeInfo.IsCIBN10():
  38. ENABLE_ENGNUM_DELETE_CODE = TRUE
  39. elif localeInfo.IsEUROPE():
  40. ENABLE_ENGNUM_DELETE_CODE = TRUE
  41.  
  42. class SelectCharacterWindow(ui.Window):
  43. SLOT_COUNT = 4
  44. CHARACTER_TYPE_COUNT = 4
  45.  
  46. EMPIRE_NAME = {
  47. net.EMPIRE_A : localeInfo.EMPIRE_A,
  48. net.EMPIRE_B : localeInfo.EMPIRE_B,
  49. net.EMPIRE_C : localeInfo.EMPIRE_C
  50. }
  51.  
  52. RACE_NAME = {
  53. playerSettingModule.RACE_WARRIOR_M : localeInfo.JOB_WARRIOR,
  54. playerSettingModule.RACE_WARRIOR_W : localeInfo.JOB_WARRIOR,
  55. playerSettingModule.RACE_ASSASSIN_M : localeInfo.JOB_ASSASSIN,
  56. playerSettingModule.RACE_ASSASSIN_W : localeInfo.JOB_ASSASSIN,
  57. playerSettingModule.RACE_SURA_M : localeInfo.JOB_SURA,
  58. playerSettingModule.RACE_SURA_W : localeInfo.JOB_SURA,
  59. playerSettingModule.RACE_SHAMAN_M : localeInfo.JOB_SHAMAN,
  60. playerSettingModule.RACE_SHAMAN_W : localeInfo.JOB_SHAMAN,
  61. }
  62.  
  63. DESCRIPTION_FILE_NAME = {
  64. playerSettingModule.RACE_WARRIOR_M : uiScriptLocale.JOBDESC_WARRIOR_PATH,
  65. playerSettingModule.RACE_WARRIOR_W : uiScriptLocale.JOBDESC_WARRIOR_PATH,
  66. playerSettingModule.RACE_ASSASSIN_M : uiScriptLocale.JOBDESC_ASSASSIN_PATH,
  67. playerSettingModule.RACE_ASSASSIN_W : uiScriptLocale.JOBDESC_ASSASSIN_PATH,
  68. playerSettingModule.RACE_SURA_M : uiScriptLocale.JOBDESC_SURA_PATH,
  69. playerSettingModule.RACE_SURA_W : uiScriptLocale.JOBDESC_SURA_PATH,
  70. playerSettingModule.RACE_SHAMAN_M : uiScriptLocale.JOBDESC_SHAMAN_PATH,
  71. playerSettingModule.RACE_SHAMAN_W : uiScriptLocale.JOBDESC_SHAMAN_PATH,
  72. }
  73.  
  74. DESCRIPTION_FILE_NAME_LIMIT = {
  75. playerSettingModule.RACE_WARRIOR_M : 1,
  76. playerSettingModule.RACE_WARRIOR_W : 1,
  77. playerSettingModule.RACE_ASSASSIN_M : 1,
  78. playerSettingModule.RACE_ASSASSIN_W : 1,
  79. playerSettingModule.RACE_SURA_M : 1,
  80. playerSettingModule.RACE_SURA_W : 1,
  81. playerSettingModule.RACE_SHAMAN_M : 0,
  82. playerSettingModule.RACE_SHAMAN_W : 0,
  83. }
  84.  
  85. FACE_IMAGE_DICT_1 = {
  86. playerSettingModule.RACE_WARRIOR_M : "d:/ymir work/ui/intro/public_intro/face/face_warrior_m_01.sub",
  87. playerSettingModule.RACE_WARRIOR_W : "d:/ymir work/ui/intro/public_intro/face/face_warrior_w_01.sub",
  88. playerSettingModule.RACE_ASSASSIN_M : "d:/ymir work/ui/intro/public_intro/face/face_assassin_m_01.sub",
  89. playerSettingModule.RACE_ASSASSIN_W : "d:/ymir work/ui/intro/public_intro/face/face_assassin_w_01.sub",
  90. playerSettingModule.RACE_SURA_M : "d:/ymir work/ui/intro/public_intro/face/face_sura_m_01.sub",
  91. playerSettingModule.RACE_SURA_W : "d:/ymir work/ui/intro/public_intro/face/face_sura_w_01.sub",
  92. playerSettingModule.RACE_SHAMAN_M : "d:/ymir work/ui/intro/public_intro/face/face_shaman_m_01.sub",
  93. playerSettingModule.RACE_SHAMAN_W : "d:/ymir work/ui/intro/public_intro/face/face_shaman_w_01.sub",
  94. }
  95.  
  96. FACE_IMAGE_DICT_2 = {
  97. playerSettingModule.RACE_WARRIOR_M : "d:/ymir work/ui/intro/public_intro/face/face_warrior_m_02.sub",
  98. playerSettingModule.RACE_WARRIOR_W : "d:/ymir work/ui/intro/public_intro/face/face_warrior_w_02.sub",
  99. playerSettingModule.RACE_ASSASSIN_M : "d:/ymir work/ui/intro/public_intro/face/face_assassin_m_02.sub",
  100. playerSettingModule.RACE_ASSASSIN_W : "d:/ymir work/ui/intro/public_intro/face/face_assassin_w_02.sub",
  101. playerSettingModule.RACE_SURA_M : "d:/ymir work/ui/intro/public_intro/face/face_sura_m_02.sub",
  102. playerSettingModule.RACE_SURA_W : "d:/ymir work/ui/intro/public_intro/face/face_sura_w_02.sub",
  103. playerSettingModule.RACE_SHAMAN_M : "d:/ymir work/ui/intro/public_intro/face/face_shaman_m_02.sub",
  104. playerSettingModule.RACE_SHAMAN_W : "d:/ymir work/ui/intro/public_intro/face/face_shaman_w_02.sub",
  105. }
  106.  
  107. FACE_IMAGE_DICT_3 = {
  108. playerSettingModule.RACE_WARRIOR_M : "icon/face/warrior_m.tga",
  109. playerSettingModule.RACE_WARRIOR_W : "icon/face/warrior_w.tga",
  110. playerSettingModule.RACE_ASSASSIN_M : "icon/face/assassin_m.tga",
  111. playerSettingModule.RACE_ASSASSIN_W : "icon/face/assassin_w.tga",
  112. playerSettingModule.RACE_SURA_M : "icon/face/sura_m.tga",
  113. playerSettingModule.RACE_SURA_W : "icon/face/sura_w.tga",
  114. playerSettingModule.RACE_SHAMAN_M : "icon/face/shaman_m.tga",
  115. playerSettingModule.RACE_SHAMAN_W : "icon/face/shaman_w.tga",
  116. }
  117.  
  118. class DescriptionBox(ui.Window):
  119. def __init__(self):
  120. ui.Window.__init__(self)
  121. self.descIndex = 0
  122. def __del__(self):
  123. ui.Window.__del__(self)
  124. def SetIndex(self, index):
  125. self.descIndex = index
  126. def OnRender(self):
  127. event.RenderEventSet(self.descIndex)
  128.  
  129. class CharacterRenderer(ui.Window):
  130. def OnRender(self):
  131. grp.ClearDepthBuffer()
  132. grp.SetGameRenderState()
  133. grp.PushState()
  134. grp.SetOmniLight()
  135.  
  136. screenWidth = wndMgr.GetScreenWidth()
  137. screenHeight = wndMgr.GetScreenHeight()
  138. newScreenWidth = float(screenWidth - 270)
  139. newScreenHeight = float(screenHeight)
  140. grp.SetViewport(270.0/screenWidth, 0.0, newScreenWidth/screenWidth, newScreenHeight/screenHeight)
  141.  
  142. app.SetCenterPosition(0.0, 0.0, 0.0)
  143. app.SetCamera(1550.0, 15.0, 180.0, 95.0)
  144. grp.SetPerspective(10.0, newScreenWidth/newScreenHeight, 1000.0, 3000.0)
  145.  
  146. (x, y) = app.GetCursorPosition()
  147. grp.SetCursorPosition(x, y)
  148. chr.Deform()
  149. chr.Render()
  150. grp.RestoreViewport()
  151. grp.PopState()
  152. grp.SetInterfaceRenderState()
  153.  
  154. def __init__(self, stream):
  155. ui.Window.__init__(self)
  156. net.SetPhaseWindow(net.PHASE_WINDOW_SELECT, self)
  157. self.stream=stream
  158. self.slot = self.stream.GetCharacterSlot()
  159.  
  160. self.openLoadingFlag = FALSE
  161. self.startIndex = -1
  162. self.startReservingTime = 0
  163.  
  164. self.curNameAlpha = []
  165. self.destNameAlpha = []
  166. for i in xrange(self.CHARACTER_TYPE_COUNT):
  167. self.curNameAlpha.append(0.0)
  168. self.destNameAlpha.append(0.0)
  169.  
  170. self.curGauge = [0.0, 0.0, 0.0, 0.0]
  171. self.destGauge = [0.0, 0.0, 0.0, 0.0]
  172.  
  173. self.dlgBoard = 0
  174. self.changeNameFlag = FALSE
  175. self.nameInputBoard = None
  176. self.sendedChangeNamePacket = FALSE
  177.  
  178. self.startIndex = -1
  179. self.isLoad = 0
  180.  
  181. def __del__(self):
  182. ui.Window.__del__(self)
  183. net.SetPhaseWindow(net.PHASE_WINDOW_SELECT, 0)
  184.  
  185. def Open(self):
  186. if not self.__LoadBoardDialog(uiScriptLocale.LOCALE_UISCRIPT_PATH + "selectcharacterwindow.py"):
  187. dbg.TraceError("SelectCharacterWindow.Open - __LoadScript Error")
  188. return
  189.  
  190. if not self.__LoadQuestionDialog("uiscript/questiondialog.py"):
  191. return
  192.  
  193. playerSettingModule.LoadGameData("INIT")
  194. self.InitCharacterBoard()
  195. self.btnStart.Enable()
  196. self.btnCreate.Enable()
  197. self.btnDelete.Enable()
  198. self.btnExit.Enable()
  199. self.dlgBoard.Show()
  200. self.SetWindowName("SelectCharacterWindow")
  201. self.Show()
  202.  
  203. if self.slot >= 0:
  204. self.SelectSlot(self.slot)
  205.  
  206. if musicInfo.selectMusic != "":
  207. snd.SetMusicVolume(systemSetting.GetMusicVolume())
  208. snd.FadeInMusic("BGM/"+musicInfo.selectMusic)
  209.  
  210. app.SetCenterPosition(0.0, 0.0, 0.0)
  211. app.SetCamera(1550.0, 15.0, 180.0, 95.0)
  212.  
  213. self.isLoad=1
  214. self.Refresh()
  215. if self.stream.isAutoSelect:
  216. chrSlot=self.stream.GetCharacterSlot()
  217. self.SelectSlot(chrSlot)
  218. self.StartGame()
  219.  
  220. self.SetEmpire(net.GetEmpireID())
  221. app.ShowCursor()
  222.  
  223. def Close(self):
  224. if musicInfo.selectMusic != "":
  225. snd.FadeOutMusic("BGM/"+musicInfo.selectMusic)
  226.  
  227. self.stream.popupWindow.Close()
  228. if self.dlgBoard:
  229. self.dlgBoard.ClearDictionary()
  230.  
  231. self.my_id = None
  232. self.textBoard = None
  233. self.empireName = None
  234. self.EmpireFlagA = None
  235. self.EmpireFlagB = None
  236. self.EmpireFlagC = None
  237. self.dlgBoard = None
  238. self.btnStart = None
  239. self.btnCreate = None
  240. self.btnDelete = None
  241. self.btnExit = None
  242. self.backGroundImg1 = None
  243. self.backGroundImg2 = None
  244. self.backGroundImg3 = None
  245. self.dlgQuestion.ClearDictionary()
  246. self.dlgQuestion = None
  247. self.dlgQuestionText = None
  248. self.dlgQuestionAcceptButton = None
  249. self.dlgQuestionCancelButton = None
  250. self.privateInputBoard = None
  251. self.nameInputBoard = None
  252.  
  253. chr.DeleteInstance(self.slot)
  254.  
  255. self.Hide()
  256. self.KillFocus()
  257. app.HideCursor()
  258. event.Destroy()
  259.  
  260. def SetEmpire(self, id):
  261. self.empireName.SetText(self.EMPIRE_NAME.get(id, ""))
  262. if id == 1:
  263. self.empireName.SetFontColor(1.0, 0, 0)
  264. self.EmpireFlagA.Show()
  265. self.EmpireFlagB.Hide()
  266. self.EmpireFlagC.Hide()
  267. self.BackGround = self.backGroundImg1
  268. self.backGroundImg1.Show()
  269. self.backGroundImg2.Hide()
  270. self.backGroundImg3.Hide()
  271.  
  272. self.chrRenderer = self.CharacterRenderer()
  273. self.chrRenderer.SetParent(self.backGroundImg1)
  274. self.chrRenderer.Show()
  275. elif id == 2:
  276. self.empireName.SetFontColor(1.0, 1.0, 0.0)
  277. self.EmpireFlagA.Hide()
  278. self.EmpireFlagB.Show()
  279. self.EmpireFlagC.Hide()
  280. self.BackGround = self.backGroundImg2
  281. self.backGroundImg1.Hide()
  282. self.backGroundImg2.Show()
  283. self.backGroundImg3.Hide()
  284.  
  285. self.chrRenderer = self.CharacterRenderer()
  286. self.chrRenderer.SetParent(self.backGroundImg2)
  287. self.chrRenderer.Show()
  288. elif id == 3:
  289. self.empireName.SetFontColor(0.0, 0, 1.0)
  290. self.EmpireFlagA.Hide()
  291. self.EmpireFlagB.Hide()
  292. self.EmpireFlagC.Show()
  293. self.BackGround = self.backGroundImg3
  294. self.backGroundImg1.Hide()
  295. self.backGroundImg2.Hide()
  296. self.backGroundImg3.Show()
  297.  
  298. self.chrRenderer = self.CharacterRenderer()
  299. self.chrRenderer.SetParent(self.backGroundImg3)
  300. self.chrRenderer.Show()
  301.  
  302. def Refresh(self):
  303. if not self.isLoad:
  304. return
  305.  
  306. for i in xrange(self.SLOT_COUNT):
  307. id = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_ID)
  308. race = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_RACE)
  309. form = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_FORM)
  310. name = net.GetAccountCharacterSlotDataString(i, net.ACCOUNT_CHARACTER_SLOT_NAME)
  311. hair = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_HAIR)
  312. #acce = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_ACCE)
  313. if id != 0:
  314. self.MakeCharacter(i, id, name, race, form, hair)#, acce)
  315. self.SelectSlot(i)
  316. break
  317.  
  318. self.CharacterSlot_0.Hide()
  319. self.CharacterFace_0.Hide()
  320. self.CharacterSlot_0_Lv.Hide()
  321. self.CharacterSlot_0_Name.Hide()
  322. self.CharacterSlot_1.Hide()
  323. self.CharacterFace_1.Hide()
  324. self.CharacterSlot_1_Lv.Hide()
  325. self.CharacterSlot_1_Name.Hide()
  326. self.CharacterSlot_2.Hide()
  327. self.CharacterFace_2.Hide()
  328. self.CharacterSlot_2_Lv.Hide()
  329. self.CharacterSlot_2_Name.Hide()
  330. self.CharacterSlot_3.Hide()
  331. self.CharacterFace_3.Hide()
  332. self.CharacterSlot_3_Lv.Hide()
  333. self.CharacterSlot_3_Name.Hide()
  334. for i in xrange(self.SLOT_COUNT):
  335. id = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_ID)
  336. race = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_RACE)
  337. name = net.GetAccountCharacterSlotDataString(i, net.ACCOUNT_CHARACTER_SLOT_NAME)
  338. level = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_LEVEL)
  339. if id != 0:
  340. if i == 0:
  341. self.CharacterFace_0.LoadImage(self.FACE_IMAGE_DICT_2[race])
  342. self.CharacterFace_0.Show()
  343. self.CharacterSlot_0.Show()
  344. self.CharacterSlot_0_Name.SetText(name)
  345. self.CharacterSlot_0_Name.Show()
  346. self.CharacterSlot_0_Lv.SetText(localeInfo.INTRO_SELECT_LEVEL % (level))
  347. self.CharacterSlot_0_Lv.SetFontColor(30, 72, 168)
  348. self.CharacterSlot_0_Lv.Show()
  349. elif i == 1:
  350. self.CharacterFace_1.LoadImage(self.FACE_IMAGE_DICT_2[race])
  351. self.CharacterFace_1.Show()
  352. self.CharacterSlot_1.Show()
  353. self.CharacterSlot_1_Name.SetText(name)
  354. self.CharacterSlot_1_Name.Show()
  355. self.CharacterSlot_1_Lv.SetText(localeInfo.INTRO_SELECT_LEVEL % (level))
  356. self.CharacterSlot_1_Lv.SetFontColor(30, 72, 168)
  357. self.CharacterSlot_1_Lv.Show()
  358. elif i == 2:
  359. self.CharacterFace_2.LoadImage(self.FACE_IMAGE_DICT_2[race])
  360. self.CharacterFace_2.Show()
  361. self.CharacterSlot_2.Show()
  362. self.CharacterSlot_2_Name.SetText(name)
  363. self.CharacterSlot_2_Name.Show()
  364. self.CharacterSlot_2_Lv.SetText(localeInfo.INTRO_SELECT_LEVEL % (level))
  365. self.CharacterSlot_2_Lv.SetFontColor(30, 72, 168)
  366. self.CharacterSlot_2_Lv.Show()
  367. elif i == 3:
  368. self.CharacterFace_3.LoadImage(self.FACE_IMAGE_DICT_2[race])
  369. self.CharacterFace_3.Show()
  370. self.CharacterSlot_3.Show()
  371. self.CharacterSlot_3_Name.SetText(name)
  372. self.CharacterSlot_3_Name.Show()
  373. self.CharacterSlot_3_Lv.SetText(localeInfo.INTRO_SELECT_LEVEL % (level))
  374. self.CharacterSlot_3_Lv.SetFontColor(30, 72, 168)
  375. self.CharacterSlot_3_Lv.Show()
  376.  
  377. def GetCharacterSlotID(self, slotIndex):
  378. return net.GetAccountCharacterSlotDataInteger(slotIndex, net.ACCOUNT_CHARACTER_SLOT_ID)
  379.  
  380. def __LoadQuestionDialog(self, fileName):
  381. self.dlgQuestion = ui.ScriptWindow()
  382.  
  383. try:
  384. pyScrLoader = ui.PythonScriptLoader()
  385. pyScrLoader.LoadScriptFile(self.dlgQuestion, fileName)
  386. except:
  387. import exception
  388. exception.Abort("SelectCharacterWindow.LoadQuestionDialog.LoadScript")
  389.  
  390. try:
  391. GetObject=self.dlgQuestion.GetChild
  392. self.dlgQuestionText=GetObject("message")
  393. self.dlgQuestionAcceptButton=GetObject("accept")
  394. self.dlgQuestionCancelButton=GetObject("cancel")
  395. except:
  396. import exception
  397. exception.Abort("SelectCharacterWindow.LoadQuestionDialog.BindObject")
  398.  
  399. self.dlgQuestionText.SetText(localeInfo.SELECT_DO_YOU_DELETE_REALLY)
  400. self.dlgQuestionAcceptButton.SetEvent(ui.__mem_func__(self.RequestDeleteCharacter))
  401. self.dlgQuestionCancelButton.SetEvent(ui.__mem_func__(self.dlgQuestion.Hide))
  402. return 1
  403.  
  404. def __LoadBoardDialog(self, fileName):
  405. self.dlgBoard = ui.ScriptWindow()
  406. try:
  407. pyScrLoader = ui.PythonScriptLoader()
  408. pyScrLoader.LoadScriptFile(self.dlgBoard, fileName)
  409. except:
  410. import exception
  411. exception.Abort("SelectCharacterWindow.LoadBoardDialog.LoadScript")
  412.  
  413. try:
  414. GetObject=self.dlgBoard.GetChild
  415. self.backGroundImg1 = GetObject("BackGround")
  416. self.backGroundImg2 = GetObject("BackGround2")
  417. self.backGroundImg2.Hide()
  418. self.backGroundImg3 = GetObject("BackGround3")
  419. self.backGroundImg3.Hide()
  420.  
  421. self.btnStart = GetObject("start_button")
  422. self.btnCreate = GetObject("create_button")
  423. self.btnDelete = GetObject("delete_button")
  424. self.btnExit = GetObject("exit_button")
  425. self.CharacterSlot_0 = GetObject("CharacterSlot_0")
  426. self.CharacterFace_0 = GetObject("CharacterFace_0")
  427. self.CharacterSlot_0_Lv = ui.TextLine()
  428. self.CharacterSlot_0_Lv.SetParent(self.CharacterSlot_0)
  429. self.CharacterSlot_0_Lv.SetPosition(108, 19)
  430. self.CharacterSlot_0_Lv.SetHorizontalAlignLeft()
  431. self.CharacterSlot_0_Lv.SetText("")
  432. self.CharacterSlot_0_Name = ui.TextLine()
  433. self.CharacterSlot_0_Name.SetParent(self.CharacterSlot_0)
  434. self.CharacterSlot_0_Name.SetPosition(140, 3)
  435. self.CharacterSlot_0_Name.SetHorizontalAlignRight()
  436. self.CharacterSlot_0_Name.SetText("")
  437. self.CharacterSlot_1 = GetObject("CharacterSlot_1")
  438. self.CharacterFace_1 = GetObject("CharacterFace_1")
  439. self.CharacterSlot_1_Lv = ui.TextLine()
  440. self.CharacterSlot_1_Lv.SetParent(self.CharacterSlot_1)
  441. self.CharacterSlot_1_Lv.SetPosition(108, 19)
  442. self.CharacterSlot_1_Lv.SetHorizontalAlignLeft()
  443. self.CharacterSlot_1_Lv.SetText("")
  444. self.CharacterSlot_1_Name = ui.TextLine()
  445. self.CharacterSlot_1_Name.SetParent(self.CharacterSlot_1)
  446. self.CharacterSlot_1_Name.SetPosition(140, 3)
  447. self.CharacterSlot_1_Name.SetHorizontalAlignRight()
  448. self.CharacterSlot_1_Name.SetText("")
  449. self.CharacterSlot_2 = GetObject("CharacterSlot_2")
  450. self.CharacterFace_2 = GetObject("CharacterFace_2")
  451. self.CharacterSlot_2_Lv = ui.TextLine()
  452. self.CharacterSlot_2_Lv.SetParent(self.CharacterSlot_2)
  453. self.CharacterSlot_2_Lv.SetPosition(108, 19)
  454. self.CharacterSlot_2_Lv.SetHorizontalAlignLeft()
  455. self.CharacterSlot_2_Lv.SetText("")
  456. self.CharacterSlot_2_Name = ui.TextLine()
  457. self.CharacterSlot_2_Name.SetParent(self.CharacterSlot_2)
  458. self.CharacterSlot_2_Name.SetPosition(140, 3)
  459. self.CharacterSlot_2_Name.SetHorizontalAlignRight()
  460. self.CharacterSlot_2_Name.SetText("")
  461. self.CharacterSlot_3 = GetObject("CharacterSlot_3")
  462. self.CharacterFace_3 = GetObject("CharacterFace_3")
  463. self.CharacterSlot_3_Lv = ui.TextLine()
  464. self.CharacterSlot_3_Lv.SetParent(self.CharacterSlot_3)
  465. self.CharacterSlot_3_Lv.SetPosition(108, 19)
  466. self.CharacterSlot_3_Lv.SetHorizontalAlignLeft()
  467. self.CharacterSlot_3_Lv.SetText("")
  468. self.CharacterSlot_3_Name = ui.TextLine()
  469. self.CharacterSlot_3_Name.SetParent(self.CharacterSlot_3)
  470. self.CharacterSlot_3_Name.SetPosition(140, 3)
  471. self.CharacterSlot_3_Name.SetHorizontalAlignRight()
  472. self.CharacterSlot_3_Name.SetText("")
  473. self.DiscFace = GetObject("DiscFace")
  474. self.raceName = GetObject("raceName_Text")
  475.  
  476. self.my_id = GetObject("my_id")
  477. self.textBoard = GetObject("text_board")
  478. self.textBoardPrev = GetObject("prev_button")
  479. self.textBoardNext = GetObject("next_button")
  480.  
  481. self.CharacterHTH = GetObject("hth_value")
  482. self.CharacterINT = GetObject("int_value")
  483. self.CharacterSTR = GetObject("str_value")
  484. self.CharacterDEX = GetObject("dex_value")
  485.  
  486. self.NameList = []
  487. self.NameList.append(GetObject("name_warrior"))
  488. self.NameList.append(GetObject("name_assassin"))
  489. self.NameList.append(GetObject("name_sura"))
  490. self.NameList.append(GetObject("name_shaman"))
  491.  
  492. self.GaugeList = []
  493. self.GaugeList.append(GetObject("hth_gauge"))
  494. self.GaugeList.append(GetObject("int_gauge"))
  495. self.GaugeList.append(GetObject("str_gauge"))
  496. self.GaugeList.append(GetObject("dex_gauge"))
  497.  
  498. self.empireName = GetObject("EmpireName")
  499. self.EmpireFlagA = GetObject("EmpireFlag_A")
  500. self.EmpireFlagB = GetObject("EmpireFlag_B")
  501. self.EmpireFlagC = GetObject("EmpireFlag_C")
  502. except:
  503. import exception
  504. exception.Abort("SelectCharacterWindow.LoadBoardDialog.BindObject")
  505.  
  506. self.toolTip = uiToolTip.ToolTip()
  507. self.toolTip.ClearToolTip()
  508.  
  509. self.descIndex = 0
  510. self.descriptionBox = self.DescriptionBox()
  511. self.descriptionBox.Show()
  512. self.my_id.SetText(constInfo.ACCOUNT_NAME)
  513. self.textBoardPrev.SetEvent(ui.__mem_func__(self.PrevDescriptionPage))
  514. self.textBoardNext.SetEvent(ui.__mem_func__(self.NextDescriptionPage))
  515. GetObject("start_button").ShowToolTip = lambda arg=1: self.OverInButton(arg)
  516. GetObject("start_button").HideToolTip = lambda arg=1: self.OverOutButton()
  517. GetObject("exit_button").ShowToolTip = lambda arg=2: self.OverInButton(arg)
  518. GetObject("exit_button").HideToolTip = lambda arg=2: self.OverOutButton()
  519. GetObject("delete_button").ShowToolTip = lambda arg=3: self.OverInButton(arg)
  520. GetObject("delete_button").HideToolTip = lambda arg=3: self.OverOutButton()
  521. GetObject("create_button").ShowToolTip = lambda arg=4: self.OverInButton(arg)
  522. GetObject("create_button").HideToolTip = lambda arg=4: self.OverOutButton()
  523. GetObject("CharacterSlot_0").ShowToolTip = lambda arg=5: self.OverInButton(arg)
  524. GetObject("CharacterSlot_0").HideToolTip = lambda arg=5: self.OverOutButton()
  525. GetObject("CharacterSlot_1").ShowToolTip = lambda arg=6: self.OverInButton(arg)
  526. GetObject("CharacterSlot_1").HideToolTip = lambda arg=6: self.OverOutButton()
  527. GetObject("CharacterSlot_2").ShowToolTip = lambda arg=7: self.OverInButton(arg)
  528. GetObject("CharacterSlot_2").HideToolTip = lambda arg=7: self.OverOutButton()
  529. GetObject("CharacterSlot_3").ShowToolTip = lambda arg=8: self.OverInButton(arg)
  530. GetObject("CharacterSlot_3").HideToolTip = lambda arg=8: self.OverOutButton()
  531. GetObject("prev_button").ShowToolTip = lambda arg=10: self.OverInButton(arg)
  532. GetObject("prev_button").HideToolTip = lambda arg=10: self.OverOutButton()
  533. GetObject("next_button").ShowToolTip = lambda arg=11: self.OverInButton(arg)
  534. GetObject("next_button").HideToolTip = lambda arg=11: self.OverOutButton()
  535.  
  536. for name in self.NameList:
  537. name.SetAlpha(0.0)
  538.  
  539. self.btnStart.SetEvent(ui.__mem_func__(self.StartGame))
  540. self.btnCreate.SetEvent(ui.__mem_func__(self.CreateCharacter))
  541. self.btnExit.SetEvent(ui.__mem_func__(self.ExitSelect))
  542.  
  543. self.CharacterSlot_0.SAFE_SetEvent(self.SelectSlot, 0)
  544. self.CharacterSlot_1.SAFE_SetEvent(self.SelectSlot, 1)
  545. self.CharacterSlot_2.SAFE_SetEvent(self.SelectSlot, 2)
  546. self.CharacterSlot_3.SAFE_SetEvent(self.SelectSlot, 3)
  547.  
  548. if NOT_NEED_DELETE_CODE:
  549. self.btnDelete.SetEvent(ui.__mem_func__(self.PopupDeleteQuestion))
  550. else:
  551. self.btnDelete.SetEvent(ui.__mem_func__(self.InputPrivateCode))
  552.  
  553. self.chrRenderer = self.CharacterRenderer()
  554. self.chrRenderer.SetParent(self.backGroundImg1)
  555. self.chrRenderer.Show()
  556.  
  557. return 1
  558.  
  559. def MakeCharacter(self, index, id, name, race, form, hair):#, acce):
  560. if 0 == id:
  561. return
  562.  
  563. chr.CreateInstance(index)
  564. chr.SelectInstance(index)
  565. chr.SetVirtualID(index)
  566. chr.SetNameString(name)
  567. chr.SetRace(race)
  568. chr.SetArmor(form)
  569. chr.SetHair(hair)
  570. #chr.SetAcce(acce)
  571. chr.Refresh()
  572. chr.SetMotionMode(chr.MOTION_MODE_GENERAL)
  573. chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)
  574. chr.SetRotation(0.0)
  575.  
  576. distance = 50.0
  577. rotRadian = 82.0 * (math.pi*2) / 360.0
  578. x = distance*math.sin(rotRadian) + distance*math.cos(rotRadian)
  579. y = distance*math.cos(rotRadian) - distance*math.sin(rotRadian)
  580.  
  581. chr.SetPixelPosition(int(x), int(y), 30)
  582. self.DiscFace.LoadImage(self.FACE_IMAGE_DICT_3[race])
  583. self.DiscFace.Show()
  584. self.raceName.SetText(self.RACE_NAME[race])
  585. self.raceName.Show()
  586.  
  587. def StartGame(self):
  588. self.toolTip.Hide()
  589.  
  590. if self.sendedChangeNamePacket:
  591. return
  592.  
  593. if self.changeNameFlag:
  594. self.OpenChangeNameDialog()
  595. return
  596.  
  597. if -1 != self.startIndex:
  598. return
  599.  
  600. if musicInfo.selectMusic != "":
  601. snd.FadeLimitOutMusic("BGM/"+musicInfo.selectMusic, systemSetting.GetMusicVolume()*0.05)
  602.  
  603. self.btnStart.SetUp()
  604. self.btnCreate.SetUp()
  605. self.btnDelete.SetUp()
  606. self.btnExit.SetUp()
  607.  
  608. self.btnStart.Disable()
  609. self.btnCreate.Disable()
  610. self.btnDelete.Disable()
  611. self.btnExit.Disable()
  612. self.dlgQuestion.Hide()
  613.  
  614. self.stream.SetCharacterSlot(self.slot)
  615. self.startIndex = self.slot
  616. self.startReservingTime = app.GetTime()
  617. for i in xrange(self.SLOT_COUNT):
  618. if FALSE == chr.HasInstance(i):
  619. continue
  620.  
  621. chr.SelectInstance(i)
  622. if i == self.slot:
  623. self.slot = self.slot
  624. chr.PushOnceMotion(chr.MOTION_INTRO_SELECTED, 0.1)
  625. continue
  626.  
  627. chr.PushOnceMotion(chr.MOTION_INTRO_NOT_SELECTED, 0.1)
  628.  
  629. def OpenChangeNameDialog(self):
  630. import uiCommon
  631. nameInputBoard = uiCommon.InputDialogWithDescription()
  632. nameInputBoard.SetTitle(localeInfo.SELECT_CHANGE_NAME_TITLE)
  633. nameInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputName))
  634. nameInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputName))
  635. nameInputBoard.SetMaxLength(chr.PLAYER_NAME_MAX_LEN)
  636. nameInputBoard.SetBoardWidth(200)
  637. nameInputBoard.SetDescription(localeInfo.SELECT_INPUT_CHANGING_NAME)
  638. nameInputBoard.Open()
  639. nameInputBoard.slot = self.slot
  640. self.nameInputBoard = nameInputBoard
  641.  
  642. def OnChangeName(self, id, name):
  643. self.SelectSlot(id)
  644. self.sendedChangeNamePacket = FALSE
  645. self.PopupMessage(localeInfo.SELECT_CHANGED_NAME)
  646.  
  647. def AcceptInputName(self):
  648. changeName = self.nameInputBoard.GetText()
  649. if not changeName:
  650. return
  651.  
  652. self.sendedChangeNamePacket = TRUE
  653. net.SendChangeNamePacket(self.nameInputBoard.slot, changeName)
  654. return self.CancelInputName()
  655.  
  656. def CancelInputName(self):
  657. self.nameInputBoard.Close()
  658. self.nameInputBoard = None
  659. return TRUE
  660.  
  661. def OnCreateFailure(self, type):
  662. self.sendedChangeNamePacket = FALSE
  663. if 0 == type:
  664. self.PopupMessage(localeInfo.SELECT_CHANGE_FAILURE_STRANGE_NAME)
  665. elif 1 == type:
  666. self.PopupMessage(localeInfo.SELECT_CHANGE_FAILURE_ALREADY_EXIST_NAME)
  667. elif 100 == type:
  668. self.PopupMessage(localeInfo.SELECT_CHANGE_FAILURE_STRANGE_INDEX)
  669.  
  670. def CreateCharacter(self):
  671. self.toolTip.Hide()
  672. for i in xrange(self.SLOT_COUNT):
  673. id = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_ID)
  674. if id == 0:
  675. self.stream.SetCharacterSlot(i)
  676. EMPIRE_MODE = 1
  677. if EMPIRE_MODE:
  678. if self.__AreAllSlotEmpty():
  679. self.stream.SetReselectEmpirePhase()
  680. else:
  681. self.stream.SetCreateCharacterPhase()
  682. else:
  683. self.stream.SetCreateCharacterPhase()
  684.  
  685. break
  686.  
  687. def __AreAllSlotEmpty(self):
  688. for iSlot in xrange(self.SLOT_COUNT):
  689. if 0 != net.GetAccountCharacterSlotDataInteger(iSlot, net.ACCOUNT_CHARACTER_SLOT_ID):
  690. return 0
  691.  
  692. return 1
  693.  
  694. def PopupDeleteQuestion(self):
  695. id = self.GetCharacterSlotID(self.slot)
  696. if 0 == id:
  697. return
  698.  
  699. self.dlgQuestion.Show()
  700. self.dlgQuestion.SetTop()
  701.  
  702. def RequestDeleteCharacter(self):
  703. self.dlgQuestion.Hide()
  704.  
  705. id = self.GetCharacterSlotID(self.slot)
  706. if 0 == id:
  707. self.PopupMessage(localeInfo.SELECT_EMPTY_SLOT)
  708. return
  709.  
  710. net.SendDestroyCharacterPacket(self.slot, "1234567")
  711. self.PopupMessage(localeInfo.SELECT_DELEING)
  712.  
  713. def InputPrivateCode(self):
  714. import uiCommon
  715. privateInputBoard = uiCommon.InputDialogWithDescription()
  716. privateInputBoard.SetTitle(localeInfo.INPUT_PRIVATE_CODE_DIALOG_TITLE)
  717. privateInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrivateCode))
  718. privateInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputPrivateCode))
  719.  
  720. if ENABLE_ENGNUM_DELETE_CODE:
  721. pass
  722. else:
  723. privateInputBoard.SetNumberMode()
  724.  
  725. privateInputBoard.SetSecretMode()
  726. privateInputBoard.SetMaxLength(7)
  727. privateInputBoard.SetBoardWidth(250)
  728. privateInputBoard.SetDescription(localeInfo.INPUT_PRIVATE_CODE_DIALOG_DESCRIPTION)
  729. privateInputBoard.Open()
  730. self.privateInputBoard = privateInputBoard
  731.  
  732. def AcceptInputPrivateCode(self):
  733. privateCode = self.privateInputBoard.GetText()
  734. if not privateCode:
  735. return
  736.  
  737. id = self.GetCharacterSlotID(self.slot)
  738. if 0 == id:
  739. self.PopupMessage(localeInfo.SELECT_EMPTY_SLOT)
  740. return
  741.  
  742. net.SendDestroyCharacterPacket(self.slot, privateCode)
  743. self.PopupMessage(localeInfo.SELECT_DELEING)
  744.  
  745. self.CancelInputPrivateCode()
  746. return TRUE
  747.  
  748. def CancelInputPrivateCode(self):
  749. self.privateInputBoard = None
  750. return TRUE
  751.  
  752. def OnDeleteSuccess(self, slot):
  753. self.PopupMessage(localeInfo.SELECT_DELETED)
  754. self.DeleteCharacter(slot)
  755.  
  756. def OnDeleteFailure(self):
  757. self.PopupMessage(localeInfo.SELECT_CAN_NOT_DELETE)
  758.  
  759. def DeleteCharacter(self, index):
  760. chr.DeleteInstance(index)
  761. self.SelectSlot(self.slot)
  762. self.Refresh()
  763.  
  764. def ExitSelect(self):
  765. self.dlgQuestion.Hide()
  766. if LEAVE_BUTTON_FOR_POTAL:
  767. if app.loggined:
  768. self.stream.SetPhaseWindow(0)
  769. else:
  770. self.stream.setloginphase()
  771. else:
  772. self.stream.SetLoginPhase()
  773.  
  774. self.Hide()
  775.  
  776. def SelectSlot(self, index):
  777. if index < 0:
  778. return
  779.  
  780. if index >= self.SLOT_COUNT:
  781. return
  782.  
  783. snd.PlaySound("sound/ui/click.wav")
  784. chr.DeleteInstance(0)
  785. chr.DeleteInstance(1)
  786. chr.DeleteInstance(2)
  787. chr.DeleteInstance(3)
  788. self.DiscFace.Hide()
  789. self.raceName.Hide()
  790. id = net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_ID)
  791. race = net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_RACE)
  792. form = net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_FORM)
  793. name = net.GetAccountCharacterSlotDataString(index, net.ACCOUNT_CHARACTER_SLOT_NAME)
  794. hair = net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_HAIR)
  795. #acce = net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_ACCE)
  796. if id != 0:
  797. self.MakeCharacter(index, id, name, race, form, hair)#, acce)
  798.  
  799. if index == 0:
  800. self.CharacterSlot_0.Down()
  801. self.CharacterSlot_0_Name.SetFontColor(1.0, 0.6000, 0.3500)
  802. self.CharacterFace_0.LoadImage(self.FACE_IMAGE_DICT_1[race])
  803. self.CharacterSlot_1.SetUp()
  804. self.CharacterSlot_2.SetUp()
  805. self.CharacterSlot_3.SetUp()
  806. self.CharacterSlot_1_Name.SetFontColor(0.8549, 0.8549, 0.8549)
  807. self.CharacterSlot_2_Name.SetFontColor(0.8549, 0.8549, 0.8549)
  808. self.CharacterSlot_3_Name.SetFontColor(0.8549, 0.8549, 0.8549)
  809. elif index == 1:
  810. self.CharacterSlot_1.Down()
  811. self.CharacterSlot_1_Name.SetFontColor(1.0, 0.6000, 0.3500)
  812. self.CharacterFace_1.LoadImage(self.FACE_IMAGE_DICT_1[race])
  813. self.CharacterSlot_0.SetUp()
  814. self.CharacterSlot_2.SetUp()
  815. self.CharacterSlot_3.SetUp()
  816. self.CharacterSlot_0_Name.SetFontColor(0.8549, 0.8549, 0.8549)
  817. self.CharacterSlot_2_Name.SetFontColor(0.8549, 0.8549, 0.8549)
  818. self.CharacterSlot_3_Name.SetFontColor(0.8549, 0.8549, 0.8549)
  819. elif index == 2:
  820. self.CharacterSlot_2.Down()
  821. self.CharacterSlot_2_Name.SetFontColor(1.0, 0.6000, 0.3500)
  822. self.CharacterFace_2.LoadImage(self.FACE_IMAGE_DICT_1[race])
  823. self.CharacterSlot_0.SetUp()
  824. self.CharacterSlot_1.SetUp()
  825. self.CharacterSlot_3.SetUp()
  826. self.CharacterSlot_0_Name.SetFontColor(0.8549, 0.8549, 0.8549)
  827. self.CharacterSlot_1_Name.SetFontColor(0.8549, 0.8549, 0.8549)
  828. self.CharacterSlot_3_Name.SetFontColor(0.8549, 0.8549, 0.8549)
  829. elif index == 3:
  830. self.CharacterSlot_3.Down()
  831. self.CharacterSlot_3_Name.SetFontColor(1.0, 0.6000, 0.3500)
  832. self.CharacterFace_3.LoadImage(self.FACE_IMAGE_DICT_1[race])
  833. self.CharacterSlot_0.SetUp()
  834. self.CharacterSlot_1.SetUp()
  835. self.CharacterSlot_2.SetUp()
  836. self.CharacterSlot_0_Name.SetFontColor(0.8549, 0.8549, 0.8549)
  837. self.CharacterSlot_1_Name.SetFontColor(0.8549, 0.8549, 0.8549)
  838. self.CharacterSlot_2_Name.SetFontColor(0.8549, 0.8549, 0.8549)
  839.  
  840. self.slot = index
  841. chr.SelectInstance(self.slot)
  842.  
  843. for i in xrange(self.CHARACTER_TYPE_COUNT):
  844. self.destNameAlpha[i] = 0.0
  845.  
  846. self.destGauge = [0.0, 0.0, 0.0, 0.0]
  847. id=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_ID)
  848. if 0 != id:
  849. self.btnStart.Show()
  850. self.btnDelete.Show()
  851. self.btnCreate.Hide()
  852. for i in xrange(self.SLOT_COUNT):
  853. id_check = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_ID)
  854. if id_check == 0:
  855. self.btnCreate.Show()
  856.  
  857. playTime=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)
  858. level=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_LEVEL)
  859. race=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_RACE)
  860. valueHTH=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_HTH)
  861. valueINT=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_INT)
  862. valueSTR=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_STR)
  863. valueDEX=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_DEX)
  864. name=net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_NAME)
  865. guildID=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_ID)
  866. guildName=net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_NAME)
  867. self.changeNameFlag=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_CHANGE_NAME_FLAG)
  868.  
  869. job = chr.RaceToJob(race)
  870. if job >= 0 and job < self.CHARACTER_TYPE_COUNT:
  871. self.destNameAlpha[job] = 1.0
  872.  
  873. self.CharacterHTH.SetText(str(valueHTH))
  874. self.CharacterINT.SetText(str(valueINT))
  875. self.CharacterSTR.SetText(str(valueSTR))
  876. self.CharacterDEX.SetText(str(valueDEX))
  877.  
  878. statesSummary = float(valueHTH + valueINT + valueSTR + valueDEX)
  879. if statesSummary > 0.0:
  880. self.destGauge = [
  881. ((float(valueHTH) * 10) / 90) / 10,
  882. ((float(valueINT) * 10) / 90) / 10,
  883. ((float(valueSTR) * 10) / 90) / 10,
  884. ((float(valueDEX) * 10) / 90) / 10
  885. ]
  886.  
  887. event.ClearEventSet(self.descIndex)
  888. self.descIndex = event.RegisterEventSet(self.DESCRIPTION_FILE_NAME[race])
  889. if self.DESCRIPTION_FILE_NAME_LIMIT[race] == 1:
  890. self.textBoardPrev.Show()
  891. self.textBoardNext.Show()
  892. else:
  893. self.textBoardPrev.Hide()
  894. self.textBoardNext.Hide()
  895. else:
  896. self.textBoardPrev.Hide()
  897. self.textBoardNext.Hide()
  898. self.InitCharacterBoard()
  899.  
  900. def PrevDescriptionPage(self):
  901. if event.IsWait(self.descIndex) == TRUE:
  902. if event.GetVisibleStartLine(self.descIndex)-14 >= 0:
  903. event.SetVisibleStartLine(self.descIndex, event.GetVisibleStartLine(self.descIndex)-14)
  904. event.Skip(self.descIndex)
  905. else:
  906. event.Skip(self.descIndex)
  907.  
  908. def NextDescriptionPage(self):
  909. if event.IsWait(self.descIndex) == TRUE:
  910. event.SetVisibleStartLine(self.descIndex, event.GetVisibleStartLine(self.descIndex)+14)
  911. event.Skip(self.descIndex)
  912. else:
  913. event.Skip(self.descIndex)
  914.  
  915. def InitCharacterBoard(self):
  916. self.btnStart.Hide()
  917. self.btnDelete.Hide()
  918. self.btnCreate.Show()
  919.  
  920. self.CharacterHTH.SetText("")
  921. self.CharacterINT.SetText("")
  922. self.CharacterSTR.SetText("")
  923. self.CharacterDEX.SetText("")
  924.  
  925. def OnUpdate(self):
  926. chr.Update()
  927. (xposEventSet, yposEventSet) = self.textBoard.GetGlobalPosition()
  928. event.UpdateEventSet(self.descIndex, xposEventSet+7, -(yposEventSet+7))
  929. self.descriptionBox.SetIndex(self.descIndex)
  930.  
  931. for i in xrange(4):
  932. self.curGauge[i] += (self.destGauge[i] - self.curGauge[i]) / 10.0
  933. if abs(self.curGauge[i] - self.destGauge[i]) < 0.005:
  934. self.curGauge[i] = self.destGauge[i]
  935.  
  936. self.GaugeList[i].SetPercentage(self.curGauge[i], 1.0)
  937. for i in xrange(self.CHARACTER_TYPE_COUNT):
  938. self.curNameAlpha[i] += (self.destNameAlpha[i] - self.curNameAlpha[i]) / 10.0
  939. self.NameList[i].SetAlpha(self.curNameAlpha[i])
  940. for i in xrange(self.SLOT_COUNT):
  941. if FALSE == chr.HasInstance(i):
  942. continue
  943. if -1 != self.startIndex:
  944. if app.GetTime() - self.startReservingTime > 3.0:
  945. if FALSE == self.openLoadingFlag:
  946. chrSlot=self.stream.GetCharacterSlot()
  947. net.DirectEnter(chrSlot)
  948. self.openLoadingFlag = TRUE
  949. import chat
  950. chat.Clear()
  951.  
  952. def PopupMessage(self, msg, func=0):
  953. if not func:
  954. func=self.EmptyFunc
  955.  
  956. self.stream.popupWindow.Close()
  957. self.stream.popupWindow.Open(msg, func, localeInfo.UI_OK)
  958.  
  959. def OverInButton(self, stat):
  960. if stat == 1:
  961. self.toolTip.ClearToolTip()
  962. self.toolTip.AlignHorizonalCenter()
  963. self.toolTip.AutoAppendNewTextLine(uiScriptLocale.SELECT_SELECT, grp.GenerateColor(1.0, 1.0, 0.0, 1.0))
  964. self.toolTip.Show()
  965. elif stat == 2:
  966. self.toolTip.ClearToolTip()
  967. self.toolTip.AlignHorizonalCenter()
  968. self.toolTip.AutoAppendNewTextLine(uiScriptLocale.SELECT_EXIT, grp.GenerateColor(1.0, 1.0, 0.0, 1.0))
  969. self.toolTip.Show()
  970. elif stat == 3:
  971. self.toolTip.ClearToolTip()
  972. self.toolTip.AlignHorizonalCenter()
  973. self.toolTip.AutoAppendNewTextLine(uiScriptLocale.SELECT_DELETE, grp.GenerateColor(1.0, 1.0, 0.0, 1.0))
  974. self.toolTip.Show()
  975. elif stat == 4:
  976. self.toolTip.ClearToolTip()
  977. self.toolTip.AlignHorizonalCenter()
  978. self.toolTip.AutoAppendNewTextLine(uiScriptLocale.SELECT_CREATE, grp.GenerateColor(1.0, 1.0, 0.0, 1.0))
  979. self.toolTip.Show()
  980. elif stat >= 5 and stat <= 9:
  981. playTime = net.GetAccountCharacterSlotDataInteger(stat-5, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)
  982. guildName = net.GetAccountCharacterSlotDataString(stat-5, net.ACCOUNT_CHARACTER_SLOT_GUILD_NAME)
  983.  
  984. self.toolTip.ClearToolTip()
  985. self.toolTip.AlignHorizonalCenter()
  986. if guildName:
  987. self.toolTip.AutoAppendNewTextLine(uiScriptLocale.SELECT_YES_GUILD % (guildName), grp.GenerateColor(1.0, 1.0, 0.0, 1.0), True)
  988. else:
  989. self.toolTip.AutoAppendNewTextLine(uiScriptLocale.SELECT_NO_GUILD, grp.GenerateColor(1.0, 1.0, 0.0, 1.0), True)
  990.  
  991. self.toolTip.AutoAppendNewTextLine(uiScriptLocale.SELECT_PLAYTIME % (playTime), grp.GenerateColor(1.0, 1.0, 0.0, 1.0))
  992. self.toolTip.Show()
  993. elif stat == 10:
  994. self.toolTip.ClearToolTip()
  995. self.toolTip.AlignHorizonalCenter()
  996. self.toolTip.AutoAppendNewTextLine(uiScriptLocale.CREATE_PREV, grp.GenerateColor(1.0, 1.0, 0.0, 1.0))
  997. self.toolTip.Show()
  998. elif stat == 11:
  999. self.toolTip.ClearToolTip()
  1000. self.toolTip.AlignHorizonalCenter()
  1001. self.toolTip.AutoAppendNewTextLine(uiScriptLocale.CREATE_NEXT, grp.GenerateColor(1.0, 1.0, 0.0, 1.0))
  1002. self.toolTip.Show()
  1003.  
  1004. def OverOutButton(self):
  1005. self.toolTip.Hide()
  1006.  
  1007. def EmptyFunc(self):
  1008. pass
  1009.  
  1010. def OnPressExitKey(self):
  1011. self.ExitSelect()
  1012. return TRUE
  1013.  
  1014. def OnPressEscapeKey(self):
  1015. self.ExitSelect()
  1016. return TRUE
Advertisement
Add Comment
Please, Sign In to add comment