Advertisement
Guest User

Untitled

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