| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | /* | 
					
						
							|  |  |  |  | 文件名:2_create_Character.nut | 
					
						
							|  |  |  |  | 路径:User/UI/Window/2_create_Character.nut | 
					
						
							|  |  |  |  | 创建日期:2024-12-15	17:40 | 
					
						
							|  |  |  |  | 文件用途: 创建角色 | 
					
						
							|  |  |  |  | */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | // 底部光动画类型 | 
					
						
							|  |  |  |  | enum BottomLightAniType { | 
					
						
							|  |  |  |  |     light | 
					
						
							|  |  |  |  |     firedust | 
					
						
							|  |  |  |  |     dust | 
					
						
							|  |  |  |  |     aura | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // 获取职业信息 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  | function getJobInfo(job) { | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     local T = {}; | 
					
						
							|  |  |  |  |     switch (job) { | 
					
						
							|  |  |  |  |         case CHARACTERJOB.SWORDMAN: // 男鬼剑士 d | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 0, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 0, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.dust, | 
					
						
							|  |  |  |  |                 name = "鬼剑士", | 
					
						
							|  |  |  |  |                 info = "借助凝聚在左手上鬼神之力压制敌人的鬼剑士。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "剑魂 / 鬼泣 / 狂战士 / 阿修罗" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.FIGHTER: // 女格斗家 d | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 1, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 1, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.dust, | 
					
						
							|  |  |  |  |                 name = "格斗家", | 
					
						
							|  |  |  |  |                 info = "注重身体各不为的锻炼,并熟练运用它们攻击敌人的武道家。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "气功师 / 散打 / 街霸 / 柔道家" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.GUNNER: // 男神枪手 d | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 2, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 2, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.dust, | 
					
						
							|  |  |  |  |                 name = "神枪手", | 
					
						
							|  |  |  |  |                 info = "生活在天界的神枪手,是善于利用枪械压制敌人的战士。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "漫游枪手 / 枪炮师 / 机械师 / 弹药专家 / 合金战士" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.MAGE: // 女魔法师 l | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 3, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 3, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.light, | 
					
						
							|  |  |  |  |                 name = "魔法师", | 
					
						
							|  |  |  |  |                 info = "善用魔法力量攻击敌人的魔族。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "元素师 / 召唤师 / 战斗法师 / 魔道学者 / 小魔女" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.PRIEST: // 男圣职者 l | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 4, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 4 // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.light, | 
					
						
							|  |  |  |  |                 name = "光职者", | 
					
						
							|  |  |  |  |                 info = "心怀正义,为惩恶扬善甘愿接收严苛训练的勇士。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "光明骑士 / 蓝拳使者 / 驱魔师 / 惩戒者" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.AT_GUNNER: // 女神枪手 f | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 5, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 2, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.firedust, | 
					
						
							|  |  |  |  |                 name = "神枪手", | 
					
						
							|  |  |  |  |                 info = "生活在天界的神枪手,是善于利用枪械压制敌人的战士。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "漫游枪手 / 枪炮师 / 机械师 / 弹药专家" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.THIEF: // 暗夜使者 a | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 6, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 5, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.aura, | 
					
						
							|  |  |  |  |                 name = "暗夜使者", | 
					
						
							|  |  |  |  |                 info = "用敏捷身手执行特别人物的暗精灵成员。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "暗星 / 黑夜术士 / 忍者 / 影武者" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.AT_FIGHTER: // 男格斗家 f | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 7, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 1, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.firedust, | 
					
						
							|  |  |  |  |                 name = "格斗家", | 
					
						
							|  |  |  |  |                 info = "注重身体各不为的锻炼,并熟练运用它们攻击敌人的武道家。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "气功师 / 散打 / 街霸 / 柔道家" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.AT_MAGE: // 男魔法师 a | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 8, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 3, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.aura, | 
					
						
							|  |  |  |  |                 name = "魔法师", | 
					
						
							|  |  |  |  |                 info = "善用魔法力量攻击敌人的魔族。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "元素爆破师 / 冰洁师 / 猩红法师 / 逐风者 / 次元行者" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.DEMONIC_SWORDMAN: // 黑暗武士 a | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 9, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 10, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.aura, | 
					
						
							|  |  |  |  |                 name = " 黑暗武士", | 
					
						
							|  |  |  |  |                 info = "跨越时空之门,超越界限之力的剑士。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "黑暗武士" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.CREATOR_MAGE: // 缔造者 l | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 10, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 11, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.light, | 
					
						
							|  |  |  |  |                 name = " 缔造者", | 
					
						
							|  |  |  |  |                 info = "从异次元裂缝中获得强大力量的魔法师。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "缔造者" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.AT_SWORDMAN: // 女鬼剑士 d | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 11, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 0, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.dust, | 
					
						
							|  |  |  |  |                 name = "鬼剑士", | 
					
						
							|  |  |  |  |                 info = "同样拥有鬼手,却能实战不同的魔力。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "驭剑士 / 暗殿骑士 / 契魔者 / 流浪武士 / 刃影" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.KNIGHT: // 守护者 l | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 12, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 6, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.light, | 
					
						
							|  |  |  |  |                 name = "守护者", | 
					
						
							|  |  |  |  |                 info = "穿越各个次元,在战场上驰骋的少女。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "精灵骑士 / 混沌魔灵 / 帕拉丁 / 龙骑士" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.DEMONIC_LANCER: // 魔枪士 d | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 13, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 7, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.dust, | 
					
						
							|  |  |  |  |                 name = "魔枪士", | 
					
						
							|  |  |  |  |                 info = "使用蕴含魔力的长枪,专研枪术的战士。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "征战者 / 决战者 / 狩猎者 / 暗枪士" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.AT_PRIEST: // 女圣职者 l | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 14, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 4, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.light, | 
					
						
							|  |  |  |  |                 name = "光职者", | 
					
						
							|  |  |  |  |                 info = "心怀正义,为惩恶扬善甘愿接收严苛训练的勇士。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "光明骑士 / 正义审判者 / 驱魔师 / 除恶者" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.GUN_BLADER: // 枪剑士 d | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 15, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 8, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.dust, | 
					
						
							|  |  |  |  |                 name = "枪剑士", | 
					
						
							|  |  |  |  |                 info = "执着枪与剑的浪漫的天界人。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "暗刃 / 特工 / 战线佣兵 / 源能专家" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         case CHARACTERJOB.ARCHER: // 弓箭手 l | 
					
						
							|  |  |  |  |             T = { | 
					
						
							|  |  |  |  |                 index = 16, // 索引 | 
					
						
							|  |  |  |  |                 nameIndex = 9, // 名称索引 | 
					
						
							|  |  |  |  |                 ani = BottomLightAniType.light, | 
					
						
							|  |  |  |  |                 name = "弓箭手", | 
					
						
							|  |  |  |  |                 info = "为了守护家园,携弓箭走上冒险之旅的神界人。", // 介绍 | 
					
						
							|  |  |  |  |                 changJob = "缪斯 / 旅人 / 猎人 / 妖护使" // 转职 | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |         default: | 
					
						
							|  |  |  |  |             break; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     return T; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | function getJobEnum(index) { | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |     local jobList = [CHARACTERJOB.SWORDMAN, CHARACTERJOB.AT_SWORDMAN, CHARACTERJOB.AT_FIGHTER, CHARACTERJOB.FIGHTER, CHARACTERJOB.GUNNER, CHARACTERJOB.AT_GUNNER, CHARACTERJOB.AT_MAGE, CHARACTERJOB.MAGE, CHARACTERJOB.PRIEST, CHARACTERJOB.AT_PRIEST, CHARACTERJOB.THIEF, CHARACTERJOB.KNIGHT, CHARACTERJOB.DEMONIC_LANCER, CHARACTERJOB.GUN_BLADER, CHARACTERJOB.ARCHER, CHARACTERJOB.DEMONIC_SWORDMAN, CHARACTERJOB.CREATOR_MAGE]; | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     return jobList[index]; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | //创建角色 | 
					
						
							|  |  |  |  | class _CreateCharacter extends Yosin_Window { | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  |     //调试模式 | 
					
						
							|  |  |  |  |     // DeBugMode = true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     //不是窗口 | 
					
						
							|  |  |  |  |     // NoWindow = true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     //是否可见 | 
					
						
							|  |  |  |  |     // Visible = false; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     BackGround = null; | 
					
						
							| 
									
										
										
										
											2024-12-18 08:54:32 +08:00
										 |  |  |  |     headList = null; | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     jobImg = null; | 
					
						
							|  |  |  |  |     nextJobImg = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     infoWidget = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     topLightObj = null; | 
					
						
							|  |  |  |  |     lightAni = null; | 
					
						
							|  |  |  |  |     dustAni = null; | 
					
						
							|  |  |  |  |     firedustAni = null; | 
					
						
							|  |  |  |  |     auraAni = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |     enter = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     changJobAniClock = null; | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |     changNextJobAniClock = null; | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |     jobIndex = 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     NoticeBox = null; | 
					
						
							| 
									
										
										
										
											2024-12-18 08:54:32 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-03 19:47:36 +08:00
										 |  |  |  |     //临时创建角色 | 
					
						
							|  |  |  |  |     TempCharacter = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  |     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { | 
					
						
							|  |  |  |  |         base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         //注册绘制 | 
					
						
							|  |  |  |  |         RegisterDraw(); | 
					
						
							|  |  |  |  |         //注册控件 | 
					
						
							|  |  |  |  |         RegisterWidget(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 创建角色回包 | 
					
						
							| 
									
										
										
										
											2025-01-03 19:47:36 +08:00
										 |  |  |  |         MySocket.RegisterHandler(PACKET_ID.CREATE_CHARACTER_CALLBACK, function(Jso) { | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |             if (NoticeBox) NoticeBox.CloseWindow(); | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             if (Jso.type == 0) { | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |                 // 创建成功. | 
					
						
							|  |  |  |  |                 //关闭创建界面 | 
					
						
							|  |  |  |  |                 NoticeBox.DestroyWindow(); | 
					
						
							|  |  |  |  |                 DestroyWindow(); | 
					
						
							| 
									
										
										
										
											2025-01-03 19:49:49 +08:00
										 |  |  |  |                 MySocket.Send(PACKET_ID.QUERY_CHARACTER_LIST, null); | 
					
						
							| 
									
										
										
										
											2025-01-03 19:47:36 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |                 local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0); | 
					
						
							|  |  |  |  |                 Window.AddUpCharacter(TempCharacter); | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |                 // 创建失败. | 
					
						
							|  |  |  |  |                 NoticeBox = _Yosin_MessageBox("创建失败."); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         }.bindenv(this)); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |     function RegisterDraw() { | 
					
						
							|  |  |  |  |         //大背景 | 
					
						
							|  |  |  |  |         BackGround = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbackground.img", 0); | 
					
						
							|  |  |  |  |         Addchild(BackGround); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 人物图片 | 
					
						
							|  |  |  |  |         jobImg = CL_SpriteObject("sprite/interface2/charactercreatever2/basecharctertitle.img", 0); | 
					
						
							|  |  |  |  |         jobImg.SetPosition(0, 0); | 
					
						
							|  |  |  |  |         Addchild(jobImg); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 下一个人物图片 | 
					
						
							|  |  |  |  |         nextJobImg = CL_SpriteObject("sprite/interface2/charactercreatever2/basecharctertitle.img", 11); | 
					
						
							|  |  |  |  |         nextJobImg.SetPosition(500, 0); | 
					
						
							|  |  |  |  |         nextJobImg.SetOpacity(0); | 
					
						
							|  |  |  |  |         Addchild(nextJobImg); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 光动画 ui/charactercreate/topdodge.ani | 
					
						
							|  |  |  |  |         topLightObj = Animation("ui/charactercreate/topdodge.ani"); | 
					
						
							|  |  |  |  |         topLightObj.SetPosition(0, 0); | 
					
						
							|  |  |  |  |         Addchild(topLightObj); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 底部光动画 | 
					
						
							|  |  |  |  |         lightAni = Animation("ui/charactercreate/dust.ani"); | 
					
						
							|  |  |  |  |         lightAni.SetPosition(0, 0); | 
					
						
							|  |  |  |  |         // lightAni.SetVisible(false); | 
					
						
							|  |  |  |  |         Addchild(lightAni); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         firedustAni = Animation("ui/charactercreate/firedust.ani"); | 
					
						
							|  |  |  |  |         firedustAni.SetPosition(0, 0); | 
					
						
							|  |  |  |  |         firedustAni.SetVisible(false); | 
					
						
							|  |  |  |  |         Addchild(firedustAni); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         dustAni = Animation("ui/charactercreate/dust.ani"); | 
					
						
							|  |  |  |  |         dustAni.SetPosition(0, 0); | 
					
						
							|  |  |  |  |         dustAni.SetVisible(false); | 
					
						
							|  |  |  |  |         Addchild(dustAni); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         auraAni = Animation("ui/charactercreate/aura.ani"); | 
					
						
							|  |  |  |  |         auraAni.SetPosition(0, 0); | 
					
						
							|  |  |  |  |         auraAni.SetVisible(false); | 
					
						
							|  |  |  |  |         Addchild(auraAni); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     function RegisterWidget() { | 
					
						
							|  |  |  |  |         //头像 | 
					
						
							| 
									
										
										
										
											2024-12-18 08:54:32 +08:00
										 |  |  |  |         headList = _CreateCharacter_SelectBaseHeadList(135, 40); | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         AddUIChild(headList); | 
					
						
							|  |  |  |  |         headList.OnClick = changJob.bindenv(this); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 职业介绍 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         infoWidget = _CreateCharacter_SelectBaseInfo(140, 400); | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         AddUIChild(infoWidget); | 
					
						
							|  |  |  |  |         infoWidget.SetJob(getJobInfo(CHARACTERJOB.SWORDMAN)); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 创建职业 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         infoWidget.OnClick = function() { | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |             enter.SetVisible(true); | 
					
						
							|  |  |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 返回按钮 | 
					
						
							|  |  |  |  |         local backButton = Yosin_BaseButton(986, 30, 45, 12 "sprite/interface2/charactercreatever2/common_add.img", 0); | 
					
						
							|  |  |  |  |         //点击事件回调 | 
					
						
							|  |  |  |  |         backButton.OnClick = function(Button) { | 
					
						
							|  |  |  |  |             CloseWindow(); | 
					
						
							|  |  |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         local backText = FontAssetManager.GenerateNormal("返回", true, { | 
					
						
							|  |  |  |  |             color = sq_RGBA(159, 137, 80, 255) | 
					
						
							|  |  |  |  |         }); | 
					
						
							|  |  |  |  |         backText.SetUpdateFunc(function(Text, Dt) { | 
					
						
							|  |  |  |  |             if (Text.Parent.State == 1 || Text.Parent.State == 2) { | 
					
						
							|  |  |  |  |                 Text.SetFillColor(sq_RGBA(225, 218, 126, 255)); | 
					
						
							|  |  |  |  |             } else if (Text.Parent.State == 0) { | 
					
						
							|  |  |  |  |                 Text.SetFillColor(sq_RGBA(159, 137, 80, 255)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         }) | 
					
						
							|  |  |  |  |         backText.SetPosition(16, -2.5); | 
					
						
							|  |  |  |  |         backButton.Addchild(backText); | 
					
						
							|  |  |  |  |         AddUIChild(backButton); | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 输入名字 | 
					
						
							|  |  |  |  |         enter = _create_Character_enterName(); | 
					
						
							|  |  |  |  |         enter.SetVisible(false); | 
					
						
							|  |  |  |  |         AddUIChild(enter); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 确定 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         enter.OnClick = function(enterName) { | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |             local jobEnum = getJobEnum(jobIndex); | 
					
						
							| 
									
										
										
										
											2025-01-03 19:47:36 +08:00
										 |  |  |  |             TempCharacter = { | 
					
						
							|  |  |  |  |                 lv = 1, | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |                 name = enterName, | 
					
						
							| 
									
										
										
										
											2025-01-03 19:49:49 +08:00
										 |  |  |  |                 job = jobEnum, | 
					
						
							| 
									
										
										
										
											2025-01-03 19:47:36 +08:00
										 |  |  |  |                 equip = [] | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             MySocket.Send(PACKET_ID.CREATE_CHARACTER, { | 
					
						
							|  |  |  |  |                 name = enterName, | 
					
						
							|  |  |  |  |                 job = jobEnum, | 
					
						
							|  |  |  |  |             }); | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     // 切换职业 | 
					
						
							|  |  |  |  |     function changJob(index) { | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |         if (index == jobIndex) return; | 
					
						
							| 
									
										
										
										
											2024-12-18 08:54:32 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         local jobEnum = getJobEnum(index); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |         jobIndex = index; | 
					
						
							| 
									
										
										
										
											2024-12-18 08:54:32 +08:00
										 |  |  |  |         // 切换背景 | 
					
						
							|  |  |  |  |         BackGround.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/characterbackground.img", jobEnum)); | 
					
						
							|  |  |  |  |         nextJobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", jobEnum)); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         local info = getJobInfo(jobEnum); | 
					
						
							|  |  |  |  |         //  切换介绍 | 
					
						
							|  |  |  |  |         infoWidget.SetJob(getJobInfo(jobEnum)); | 
					
						
							|  |  |  |  |         // 切换底部光动画 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         lightAni.SetVisible(false); | 
					
						
							|  |  |  |  |         firedustAni.SetVisible(false); | 
					
						
							|  |  |  |  |         dustAni.SetVisible(false); | 
					
						
							|  |  |  |  |         auraAni.SetVisible(false); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         switch (info.ani) { | 
					
						
							| 
									
										
										
										
											2024-12-18 08:54:32 +08:00
										 |  |  |  |             case BottomLightAniType.light: | 
					
						
							|  |  |  |  |                 lightAni.SetVisible(true); | 
					
						
							|  |  |  |  |                 break; | 
					
						
							|  |  |  |  |             case BottomLightAniType.firedust: | 
					
						
							|  |  |  |  |                 firedustAni.SetVisible(true); | 
					
						
							|  |  |  |  |             case BottomLightAniType.dust: | 
					
						
							|  |  |  |  |                 dustAni.SetVisible(true); | 
					
						
							|  |  |  |  |                 break; | 
					
						
							|  |  |  |  |             case BottomLightAniType.aura: | 
					
						
							|  |  |  |  |                 auraAni.SetVisible(true); | 
					
						
							|  |  |  |  |                 break; | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 08:54:32 +08:00
										 |  |  |  |         //  开始切换动画 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         if (changJobAniClock == null) { | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |             changJobAniClock = clock(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         changNextJobAniClock = clock(); | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |     // 切换动画控制 | 
					
						
							|  |  |  |  |     function changJobAniController(progressBlock, doneBlock, next = true) { | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |         if (next) { | 
					
						
							|  |  |  |  |             if (changNextJobAniClock == null) { | 
					
						
							|  |  |  |  |                 print("NextNull"); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |             if (changJobAniClock == null) { | 
					
						
							|  |  |  |  |                 print("NUll"); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 08:54:32 +08:00
										 |  |  |  |         // 动画的前90%,快,后10%,慢 | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |         local ani_progress = Math.sq_GetAccel(0, 100, clock() - (next ? changNextJobAniClock : changJobAniClock), 0.3, false); | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         if (ani_progress >= 90) { | 
					
						
							|  |  |  |  |             ani_progress = Math.sq_GetAccel(0, 10, clock() - (next ? changNextJobAniClock : changJobAniClock), 0.7, false) + 90; | 
					
						
							| 
									
										
										
										
											2024-12-18 08:54:32 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |         local x = ani_progress * 5.0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |         if (progressBlock != null) progressBlock(ani_progress); | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         if (ani_progress >= 100) { | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |             if (doneBlock != null) doneBlock(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// 切换当前职业动画 | 
					
						
							|  |  |  |  |     function changCurrnentJobAni() { | 
					
						
							|  |  |  |  |         if (changJobAniClock == null) return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         changJobAniController(function(ani_progress) { | 
					
						
							|  |  |  |  |             local x = ani_progress * 5.0; | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             jobImg.SetPosition(0 - x, 0); | 
					
						
							|  |  |  |  |             jobImg.SetOpacity((100.0 - ani_progress.tofloat()) / 100.0); | 
					
						
							|  |  |  |  |         }.bindenv(this), function() { | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |             changJobAniClock = null; | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         }.bindenv(this), false); | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     // 切换职业动画 | 
					
						
							|  |  |  |  |     function changNextJobAni() { | 
					
						
							|  |  |  |  |         if (changNextJobAniClock == null) return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         changJobAniController(function(ani_progress) { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             local x = ani_progress * 5.0; | 
					
						
							|  |  |  |  |             nextJobImg.SetPosition(500 - x, 0); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             // 动画的前90%,透明度进度为50%,后10%,透明度进度为剩下的50% | 
					
						
							|  |  |  |  |             local opacity = ani_progress.tofloat() / 180.0; | 
					
						
							|  |  |  |  |             if (opacity > 0.5) opacity = (ani_progress.tofloat() - 90.0) / 20.0 + 0.5; | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             nextJobImg.SetOpacity(opacity); | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         }.bindenv(this), function() { | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |             changNextJobAniClock = null; | 
					
						
							| 
									
										
										
										
											2024-12-18 08:54:32 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |             local jobEnum = getJobEnum(jobIndex); | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             jobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", jobEnum)); | 
					
						
							| 
									
										
										
										
											2024-12-18 08:54:32 +08:00
										 |  |  |  |             jobImg.SetOpacity(1); | 
					
						
							|  |  |  |  |             jobImg.SetPosition(0, 0); | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             if (jobIndex< 16) { | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |                 nextJobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", getJobEnum(jobIndex + 1))); | 
					
						
							| 
									
										
										
										
											2024-12-18 08:54:32 +08:00
										 |  |  |  |                 nextJobImg.SetOpacity(0); | 
					
						
							|  |  |  |  |                 nextJobImg.SetPosition(500, 0); | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         }.bindenv(this)); | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     //逻辑入口 | 
					
						
							|  |  |  |  |     function Proc(Dt) { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         SyncPos(X, Y); | 
					
						
							|  |  |  |  |         base.Proc(Dt); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |         changCurrnentJobAni(); | 
					
						
							|  |  |  |  |         changNextJobAni(); | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | //选择创建基础介绍 | 
					
						
							|  |  |  |  | class _CreateCharacter_SelectBaseInfo extends Yosin_Window { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     //是否为独立窗口 | 
					
						
							|  |  |  |  |     IsIndependent = false; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     icon = null; | 
					
						
							|  |  |  |  |     name = null; | 
					
						
							|  |  |  |  |     jobInfo = null; | 
					
						
							|  |  |  |  |     jobChangeText = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     OnClick = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |     constructor(gX, gY) { | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         base.constructor("创建角色职业介绍信息", gX, gY, 278, 600, 0); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 职业图标 | 
					
						
							|  |  |  |  |         icon = CL_SpriteObject("sprite/interface2/charactercreatever2/charactermark.img", 0); | 
					
						
							|  |  |  |  |         icon.SetPosition(0, 0); | 
					
						
							|  |  |  |  |         Addchild(icon); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         //职业名称 | 
					
						
							|  |  |  |  |         name = CL_SpriteObject("sprite/interface2/charactercreatever2/charctertitle.img", 0); | 
					
						
							|  |  |  |  |         name.SetPosition(55, 10); | 
					
						
							|  |  |  |  |         Addchild(name); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 职业介绍 | 
					
						
							|  |  |  |  |         jobInfo = FontAssetManager.GenerateNormal("职业介绍", false, { | 
					
						
							|  |  |  |  |             color = sq_RGBA(194, 160, 53, 255) | 
					
						
							|  |  |  |  |         }); | 
					
						
							|  |  |  |  |         jobInfo.SetPosition(0, 52); | 
					
						
							|  |  |  |  |         Addchild(jobInfo); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         local jobChangeTextY = 52 + jobInfo.GetSize().h + 5; | 
					
						
							|  |  |  |  |         // 转职 | 
					
						
							|  |  |  |  |         jobChangeText = FontAssetManager.GenerateNormal("■ 转职:转职名 / 转职名", true, { | 
					
						
							|  |  |  |  |             color = sq_RGBA(194, 160, 53, 255) | 
					
						
							|  |  |  |  |         }); | 
					
						
							|  |  |  |  |         jobChangeText.SetPosition(0, jobChangeTextY); | 
					
						
							|  |  |  |  |         Addchild(jobChangeText); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         //创建角色按钮 | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |         local createButton = Yosin_SplicingButton(59, jobChangeTextY + 30, 160, 36, "sprite/interface/lenheartwindowcommon.img", 172, true, false); | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         //点击事件回调 | 
					
						
							|  |  |  |  |         createButton.OnClick = function(Button) { | 
					
						
							|  |  |  |  |             if (OnClick) OnClick(); | 
					
						
							|  |  |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |  |         // 按钮文本 | 
					
						
							|  |  |  |  |         local createText = CL_SpriteObject("sprite/interface2/charactercreatever2/charctertitle.img", 12); | 
					
						
							|  |  |  |  |         createText.SetPosition(42.5, 8); | 
					
						
							| 
									
										
										
										
											2024-12-18 13:46:38 +08:00
										 |  |  |  |         createText.SetZOrder(10000); | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         createButton.Addchild(createText); | 
					
						
							|  |  |  |  |         AddUIChild(createButton); | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     function SetJob(jobInfoMap) { | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         icon.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/charactermark.img", jobInfoMap.index)); | 
					
						
							|  |  |  |  |         name.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/charctertitle.img", jobInfoMap.nameIndex)); | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         jobInfo.SetText(jobInfoMap.info); | 
					
						
							|  |  |  |  |         jobChangeText.SetText("■ 转职:" + jobInfoMap.changJob); | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | //选择创建基础角色头像列表 | 
					
						
							|  |  |  |  | class _CreateCharacter_SelectBaseHeadList extends Yosin_Window { | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     //是否为独立窗口 | 
					
						
							|  |  |  |  |     IsIndependent = false; | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     // 点击关闭 | 
					
						
							|  |  |  |  |     clickOff = false; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     OnClick = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     buttonList = []; | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     constructor(gX, gY) { | 
					
						
							|  |  |  |  |         base.constructor("所有的职业头像", gX, gY, 278, 350, 0); | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         local headX = 0; | 
					
						
							|  |  |  |  |         local headY = 0; | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         for (local i = 0; i< 17; i++) { | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |             local jobEnum = getJobEnum(i); | 
					
						
							|  |  |  |  |             local headButton = HeadButton(headX, headY, jobEnum, getJobInfo(jobEnum).name); | 
					
						
							|  |  |  |  |             headButton.tag = i; | 
					
						
							|  |  |  |  |             AddUIChild(headButton); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             buttonList.push(headButton); | 
					
						
							|  |  |  |  |             headX = headX + 67; | 
					
						
							|  |  |  |  |             if (i % 4 == 3) { | 
					
						
							|  |  |  |  |                 headX = 0; | 
					
						
							|  |  |  |  |                 headY = headY + 67; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         // 点击事件回调 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         for (local i = 0; i< buttonList.len(); i++) { | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |             local headButton = buttonList[i]; | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             headButton.OnClick = function(b) { | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |                 if (clickOff) return; | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |                 for (local t = 0; t< buttonList.len(); t++) { | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |                     local button = buttonList[t]; | 
					
						
							|  |  |  |  |                     button.state = 0; | 
					
						
							|  |  |  |  |                     button.ChangeFrame(); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 headButton.state = 2; | 
					
						
							|  |  |  |  |                 headButton.ChangeFrame(); | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |                 if (OnClick) OnClick(headButton.tag); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             }.bindenv(this); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         local button = buttonList[0]; | 
					
						
							|  |  |  |  |         button.state = 2; | 
					
						
							|  |  |  |  |         button.ChangeFrame(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | //头像按钮 | 
					
						
							|  |  |  |  | class HeadButton extends Yosin_CommonUi { | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     DeBugMode = true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  |     // 角色名称 | 
					
						
							|  |  |  |  |     name = ""; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     // 图像id | 
					
						
							|  |  |  |  |     imageId = 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     // 状态 0:普通 1:悬停 2:按下 3:不可用 | 
					
						
							|  |  |  |  |     state = 0; | 
					
						
							|  |  |  |  |     spriteState = 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |     tag = 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     // 角色头像 | 
					
						
							|  |  |  |  |     Character = null; | 
					
						
							|  |  |  |  |     jobNameText = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     // 角色头像覆盖 | 
					
						
							|  |  |  |  |     CharacterCover = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     yellowBox = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     blueBox = null; | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     constructor(X, Y, jobEnum, name, state = 0) { | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         this.name = name; | 
					
						
							|  |  |  |  |         this.state = state; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 计算图像id | 
					
						
							|  |  |  |  |         this.imageId = jobEnum * 2 + 3; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         base.constructor(X, Y, 62, 62); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 角色头像 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         Character = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbtn.img", imageId) | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         Character.SetPosition(0, 0); | 
					
						
							|  |  |  |  |         Addchild(Character); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 转职 | 
					
						
							|  |  |  |  |         jobNameText = FontAssetManager.GenerateNormal(name, true, { | 
					
						
							|  |  |  |  |             color = sq_RGBA(194, 160, 53, 255) | 
					
						
							|  |  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         jobNameText.SetPosition(31 - jobNameText.GetSize().w / 2, 45); | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         Addchild(jobNameText); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         CharacterCover = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbtn.img", 0) | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         CharacterCover.SetPosition(0, 0); | 
					
						
							|  |  |  |  |         Addchild(CharacterCover); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         yellowBox = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbtn.img", 2); | 
					
						
							|  |  |  |  |         yellowBox.SetPosition(0, 0); | 
					
						
							|  |  |  |  |         yellowBox.SetVisible(false); | 
					
						
							|  |  |  |  |         Addchild(yellowBox); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         blueBox = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbtn.img", 1); | 
					
						
							|  |  |  |  |         blueBox.SetPosition(0, 0); | 
					
						
							|  |  |  |  |         blueBox.SetVisible(false); | 
					
						
							|  |  |  |  |         Addchild(blueBox); | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         ChangeFrame(); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     function ChangeFrame() { | 
					
						
							|  |  |  |  |         if (spriteState == state) return; | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |         spriteState = state; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  |         //不可用 | 
					
						
							|  |  |  |  |         if (state == 3) { | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             Character.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/characterbtn.img", imageId + 1)); | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |             CharacterCover.SetVisible(false); | 
					
						
							|  |  |  |  |             yellowBox.SetVisible(false); | 
					
						
							|  |  |  |  |             blueBox.SetVisible(false); | 
					
						
							|  |  |  |  |         } else if (state == 2) { | 
					
						
							|  |  |  |  |             CharacterCover.SetVisible(false); | 
					
						
							|  |  |  |  |             yellowBox.SetVisible(true); | 
					
						
							|  |  |  |  |             blueBox.SetVisible(false); | 
					
						
							|  |  |  |  |         } else if (state == 1) { | 
					
						
							|  |  |  |  |             CharacterCover.SetVisible(false); | 
					
						
							|  |  |  |  |             yellowBox.SetVisible(false); | 
					
						
							|  |  |  |  |             blueBox.SetVisible(true); | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |             CharacterCover.SetVisible(true); | 
					
						
							|  |  |  |  |             yellowBox.SetVisible(false); | 
					
						
							|  |  |  |  |             blueBox.SetVisible(false); | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     function Proc(Dt) { | 
					
						
							|  |  |  |  |         //不可用 | 
					
						
							|  |  |  |  |         if (state == 3) { | 
					
						
							|  |  |  |  |             return; | 
					
						
							|  |  |  |  |         } else { | 
					
						
							|  |  |  |  |             //按下 | 
					
						
							|  |  |  |  |             if (isLBDown) { | 
					
						
							| 
									
										
										
										
											2024-12-18 07:02:27 +08:00
										 |  |  |  |                 // state = 2; | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |             //悬停 | 
					
						
							|  |  |  |  |             else if (isInRect) { | 
					
						
							|  |  |  |  |                 if (state == 2) return; | 
					
						
							|  |  |  |  |                 state = 1; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             //普通 | 
					
						
							|  |  |  |  |             else { | 
					
						
							|  |  |  |  |                 if (state == 2) return; | 
					
						
							|  |  |  |  |                 state = 0; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         ChangeFrame(); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  | // 输入角色名称 | 
					
						
							|  |  |  |  | class _create_Character_enterName extends Yosin_Window { | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |     nameInputBox = null; | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |     //是否为独立窗口 | 
					
						
							|  |  |  |  |     IsIndependent = false; | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |     affirmButton = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |     OnClick = null; | 
					
						
							| 
									
										
										
										
											2024-12-15 21:37:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |     // 检查过的名称 | 
					
						
							|  |  |  |  |     checkName = null; | 
					
						
							|  |  |  |  |     // 当前名称 | 
					
						
							|  |  |  |  |     name = null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |     constructor() { | 
					
						
							|  |  |  |  |         base.constructor("输入角色名称", 0, 0, 1066, 600, 0); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         //背景 | 
					
						
							|  |  |  |  |         local background = Yosin_NineBoxStretch(-2, 0, 1070, 604, "sprite/interface/lenheartwindowcommon.img", 97); | 
					
						
							|  |  |  |  |         AddUIChild(background); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         //背景 | 
					
						
							|  |  |  |  |         local background = Yosin_NineBoxStretch(413, 228, 240, 140, "sprite/interface/lenheartwindowcommon.img", 97); | 
					
						
							|  |  |  |  |         AddUIChild(background); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 标题文字 | 
					
						
							|  |  |  |  |         local title = CL_SpriteObject("sprite/interface2/charactercreatever2/charctertitle.img", 13); | 
					
						
							|  |  |  |  |         title.SetPosition(477.5, 240); | 
					
						
							|  |  |  |  |         Addchild(title); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 输入框 | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |         local nameInputBox = Yosin_InputBox(433, 270, 150); | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |         AddUIChild(nameInputBox); | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |         nameInputBox.SetUpdateFunc(function(inputBox, Dt) { | 
					
						
							|  |  |  |  |             inputBox.Parent.name = inputBox.str; | 
					
						
							|  |  |  |  |         }) | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 重复检查按钮 | 
					
						
							|  |  |  |  |         local checkButton = Yosin_BaseButton(593, 267, 46, 24 "sprite/interface/lenheartwindowcommon.img", 400); | 
					
						
							|  |  |  |  |         checkButton.State = 3; | 
					
						
							|  |  |  |  |         checkButton.SetUpdateFunc(function(button, Dt) { | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |             if (button.Parent.name.len() > 0) { | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |                 button.State = 0; | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |                 button.State = 3; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         }) | 
					
						
							|  |  |  |  |         //点击事件回调 | 
					
						
							|  |  |  |  |         checkButton.OnClick = function(Button) { | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-03 19:47:36 +08:00
										 |  |  |  |             MySocket.Send(PACKET_ID.NICKNAME_REPEAT_CHECK, { | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |                 name = nameInputBox.str, | 
					
						
							|  |  |  |  |             }) | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |  |         //按钮文本 | 
					
						
							|  |  |  |  |         local checkTextActor = FontAssetManager.GenerateNormal("重复", true, { | 
					
						
							|  |  |  |  |             color = sq_RGBA(200, 195, 169, 255) | 
					
						
							|  |  |  |  |         }); | 
					
						
							|  |  |  |  |         checkTextActor.SetPosition(11, 4); | 
					
						
							|  |  |  |  |         checkButton.Addchild(checkTextActor); | 
					
						
							|  |  |  |  |         AddUIChild(checkButton); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         //提示文本 | 
					
						
							|  |  |  |  |         local tipTextActor = FontAssetManager.GenerateNormal("最多可以输入2~6个汉字、12个英文字符。", true, { | 
					
						
							|  |  |  |  |             color = sq_RGBA(200, 195, 169, 255) | 
					
						
							|  |  |  |  |             wrap_width = 150, | 
					
						
							|  |  |  |  |         }); | 
					
						
							|  |  |  |  |         tipTextActor.SetPosition(458, 300); | 
					
						
							|  |  |  |  |         Addchild(tipTextActor); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |         // 确认按钮 | 
					
						
							|  |  |  |  |         affirmButton = Yosin_BaseButton(473, 338, 46, 24 "sprite/interface/lenheartwindowcommon.img", 400); | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |         affirmButton.State = 3; | 
					
						
							|  |  |  |  |         affirmButton.SetUpdateFunc(function(button, Dt) { | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             if (button.Parent.name != button.Parent.checkName && button.State != 3) { | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |                 button.State = 3; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         }) | 
					
						
							|  |  |  |  |         //点击事件回调 | 
					
						
							|  |  |  |  |         affirmButton.OnClick = function(Button) { | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             if (OnClick != null) OnClick(Button.Parent.checkName); | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |  |         //按钮文本 | 
					
						
							|  |  |  |  |         local affirmTextActor = FontAssetManager.GenerateNormal("确认", true, { | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             color = sq_RGBA(153, 128, 71, 255) | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |         }); | 
					
						
							|  |  |  |  |         affirmTextActor.SetPosition(11, 4); | 
					
						
							|  |  |  |  |         affirmButton.Addchild(affirmTextActor); | 
					
						
							|  |  |  |  |         AddUIChild(affirmButton); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |         // 取消按钮 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |         local cancelButton = Yosin_BaseButton(533, 338, 46, 24 "sprite/interface/lenheartwindowcommon.img", 400); | 
					
						
							|  |  |  |  |         //点击事件回调 | 
					
						
							|  |  |  |  |         cancelButton.OnClick = function(button) { | 
					
						
							|  |  |  |  |             nameInputBox.str = ""; | 
					
						
							|  |  |  |  |             button.Parent.SetVisible(false); | 
					
						
							|  |  |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |  |         //按钮文本 | 
					
						
							|  |  |  |  |         local cancelTextActor = FontAssetManager.GenerateNormal("取消", true, { | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             color = sq_RGBA(153, 128, 71, 255) | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |         }); | 
					
						
							|  |  |  |  |         cancelTextActor.SetPosition(11, 4); | 
					
						
							|  |  |  |  |         cancelButton.Addchild(cancelTextActor); | 
					
						
							|  |  |  |  |         AddUIChild(cancelButton); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 昵称重复检查回包 | 
					
						
							| 
									
										
										
										
											2025-01-03 19:47:36 +08:00
										 |  |  |  |         MySocket.RegisterHandler(PACKET_ID.NICKNAME_REPEAT_CHECK_CALLBACK, function(Jso) { | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |             if (Parent.NoticeBox) Parent.NoticeBox.CloseWindow(); | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             if (Jso.type == 0) { | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |                 // 可以使用的ID 确认按钮可以使用. | 
					
						
							|  |  |  |  |                 Parent.NoticeBox = _Yosin_MessageBox("可以使用的ID."); | 
					
						
							|  |  |  |  |                 checkName = name; | 
					
						
							|  |  |  |  |                 affirmButton.State = 0; | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  |                 // 名称重复. | 
					
						
							|  |  |  |  |                 Parent.NoticeBox = _Yosin_MessageBox("名称重复."); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         }.bindenv(this)); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     //逻辑入口 | 
					
						
							|  |  |  |  |     function Proc(Dt) { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         SyncPos(X, Y); | 
					
						
							|  |  |  |  |         base.Proc(Dt); | 
					
						
							| 
									
										
										
										
											2024-12-25 11:36:28 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-19 17:32:03 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-27 15:27:02 +08:00
										 |  |  |  | } |