Advertisement
Guest User

introselect.py

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