Merge remote-tracking branch 'origin/dong' into yi
# Conflicts: # sqr/folder-alias.json
This commit is contained in:
		
						commit
						6e72ab4310
					
				|  | @ -3,3 +3,4 @@ SoundPacks/ | ||||||
| Yosin_Game_Reloading.Sign | Yosin_Game_Reloading.Sign | ||||||
| Script.pvf | Script.pvf | ||||||
| Yosin_Engine.pdb | Yosin_Engine.pdb | ||||||
|  | *.pvf | ||||||
|  |  | ||||||
							
								
								
									
										
											BIN
										
									
								
								Yosin_Engine.exe
								
								
								
								
							
							
						
						
									
										
											BIN
										
									
								
								Yosin_Engine.exe
								
								
								
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -11,10 +11,14 @@ class Animation extends Actor { | ||||||
| 
 | 
 | ||||||
|     //当前帧数 |     //当前帧数 | ||||||
|     CurrentFrameIndex = 0; |     CurrentFrameIndex = 0; | ||||||
|  |     //总帧数 | ||||||
|  |     TotalFrameIndex = 0; | ||||||
|     //当前帧时间 |     //当前帧时间 | ||||||
|     CurrentIndexT = 0; |     CurrentIndexT = 0; | ||||||
|     //当前帧 |     //当前帧 | ||||||
|     CurrentFrame = null; |     CurrentFrame = null; | ||||||
|  |     //下帧延迟 | ||||||
|  |     NextFrameDelay = 9999999; | ||||||
|     //状态机对象(只有存在时才有KeyFlag) |     //状态机对象(只有存在时才有KeyFlag) | ||||||
|     StateMachine = null; |     StateMachine = null; | ||||||
| 
 | 
 | ||||||
|  | @ -102,12 +106,13 @@ class Animation extends Actor { | ||||||
|             AnimationFlag = Buf.Flag; |             AnimationFlag = Buf.Flag; | ||||||
|             FrameArr = Buf.Frame; |             FrameArr = Buf.Frame; | ||||||
|             foreach(FrameObj in FrameArr) { |             foreach(FrameObj in FrameArr) { | ||||||
|  |                 local Spritebuf; | ||||||
|  |                 //img路径判空 | ||||||
|  |                 if (FrameObj.Img_Path) { | ||||||
|                     //如果有附加处理 格式化 |                     //如果有附加处理 格式化 | ||||||
|                     if (AdditionalOptions && AdditionalOptions.rawin("ImgFormat")) FrameObj.Img_Path = AdditionalOptions["ImgFormat"](FrameObj.Img_Path); |                     if (AdditionalOptions && AdditionalOptions.rawin("ImgFormat")) FrameObj.Img_Path = AdditionalOptions["ImgFormat"](FrameObj.Img_Path); | ||||||
| 
 | 
 | ||||||
|                 local SpriteFramebuf = CL_SpriteFrameObject("sprite/" + FrameObj.Img_Path, FrameObj.Img_Index); |                     Spritebuf = CL_SpriteObject("sprite/" + FrameObj.Img_Path, FrameObj.Img_Index); | ||||||
|                 local Spritebuf = CL_SpriteObject(); |  | ||||||
|                 Spritebuf.SetFrame(SpriteFramebuf); |  | ||||||
| 
 | 
 | ||||||
|                     //线性减淡 |                     //线性减淡 | ||||||
|                     if ("GRAPHIC_EFFECT_LINEARDODGE" in FrameObj.Flag) { |                     if ("GRAPHIC_EFFECT_LINEARDODGE" in FrameObj.Flag) { | ||||||
|  | @ -116,7 +121,9 @@ class Animation extends Actor { | ||||||
| 
 | 
 | ||||||
|                     //坐标 |                     //坐标 | ||||||
|                     Spritebuf.SetPosition(FrameObj.Pos); |                     Spritebuf.SetPosition(FrameObj.Pos); | ||||||
| 
 |                 } else { | ||||||
|  |                     Spritebuf = CL_SpriteObject(); | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|                 SpriteArr.append(Spritebuf); |                 SpriteArr.append(Spritebuf); | ||||||
|  | @ -127,10 +134,13 @@ class Animation extends Actor { | ||||||
| 
 | 
 | ||||||
|         //初始化完毕 如果是第一次初始化 而非重新构造 设置大小为第0帧大小否则天空 地板等依靠大小的初始化会有问题 |         //初始化完毕 如果是第一次初始化 而非重新构造 设置大小为第0帧大小否则天空 地板等依靠大小的初始化会有问题 | ||||||
|         if (CurrentIndexT == 0) SetSize(SpriteArr[0].GetSize()); |         if (CurrentIndexT == 0) SetSize(SpriteArr[0].GetSize()); | ||||||
|  |         //记录总帧数 | ||||||
|  |         TotalFrameIndex = FrameArr.len(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //被添加时  要刷新一下当前帧 |     //被添加时  要刷新一下当前帧 | ||||||
|     function OnAddchild(Parent) { |     function OnAddchild(Parent) { | ||||||
|  |         base.OnAddchild(Parent); | ||||||
|         FlushFrame(0); |         FlushFrame(0); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -159,7 +169,9 @@ class Animation extends Actor { | ||||||
|         CurrentFrame = SpriteArr[CurrentFrameIndex]; |         CurrentFrame = SpriteArr[CurrentFrameIndex]; | ||||||
|         Addchild(SpriteArr[CurrentFrameIndex]); |         Addchild(SpriteArr[CurrentFrameIndex]); | ||||||
| 
 | 
 | ||||||
|         local FlagBuf = FrameArr[CurrentFrameIndex].Flag; |         local FrameInfo = FrameArr[CurrentFrameIndex]; | ||||||
|  |         local FlagBuf = FrameInfo.Flag; | ||||||
|  |         NextFrameDelay = FrameInfo.Delay; | ||||||
|         //关键帧 |         //关键帧 | ||||||
|         if ("SET_FLAG" in FlagBuf) { |         if ("SET_FLAG" in FlagBuf) { | ||||||
|             if (StateMachine && StateMachine.State != -1) StateMachine.ChangeAniKeyFlag(FlagBuf.SET_FLAG); |             if (StateMachine && StateMachine.State != -1) StateMachine.ChangeAniKeyFlag(FlagBuf.SET_FLAG); | ||||||
|  | @ -179,17 +191,16 @@ class Animation extends Actor { | ||||||
| 
 | 
 | ||||||
|     //override |     //override | ||||||
|     function OnUpdate(dt) { |     function OnUpdate(dt) { | ||||||
| 
 |  | ||||||
|         //可用性检查 |         //可用性检查 | ||||||
|         if (IsUsability) { |         if (IsUsability) { | ||||||
|             //累加当前帧时间 |             //累加当前帧时间 | ||||||
|             CurrentIndexT += dt; |             CurrentIndexT += dt; | ||||||
| 
 | 
 | ||||||
|             //当前帧时间 超过 当前帧延迟就需要切换帧了 |             //当前帧时间 超过 当前帧延迟就需要切换帧了 | ||||||
|             if (CurrentIndexT >= FrameArr[CurrentFrameIndex].Delay) { |             if (CurrentIndexT >= NextFrameDelay) { | ||||||
|                 CurrentIndexT = 0; |                 CurrentIndexT = 0; | ||||||
|                 //如果当前帧小于总帧数就切换 |                 //如果当前帧小于总帧数就切换 | ||||||
|                 if (CurrentFrameIndex<(FrameArr.len() - 1)) { |                 if (CurrentFrameIndex<(TotalFrameIndex - 1)) { | ||||||
|                     FlushFrame(CurrentFrameIndex + 1); |                     FlushFrame(CurrentFrameIndex + 1); | ||||||
|                 } |                 } | ||||||
|                 //说明播放完毕了 |                 //说明播放完毕了 | ||||||
|  | @ -206,10 +217,8 @@ class Animation extends Actor { | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|         } |         } | ||||||
| 
 |         //Animation类下只会有精灵 因此不需要对子对象进行更新 | ||||||
|         base.OnUpdate(dt); |         // base.OnUpdate(dt); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -20,6 +20,8 @@ class CL_BaseObject { | ||||||
|     Var = null; |     Var = null; | ||||||
|     //销毁状态 |     //销毁状态 | ||||||
|     DestroyFlag = false; |     DestroyFlag = false; | ||||||
|  |     //不需要Update函数 | ||||||
|  |     NoUpdate = false; | ||||||
| 
 | 
 | ||||||
|     constructor(C_Object, ...) { |     constructor(C_Object, ...) { | ||||||
|         Children = {}; |         Children = {}; | ||||||
|  | @ -36,6 +38,7 @@ class CL_BaseObject { | ||||||
| 
 | 
 | ||||||
|     //被调用 |     //被调用 | ||||||
|     function OnUpdate(dt) { |     function OnUpdate(dt) { | ||||||
|  |         if (NoUpdate) return; | ||||||
|         ExistingTime += dt; |         ExistingTime += dt; | ||||||
| 
 | 
 | ||||||
|         //如果CallBack函数存在则调用 |         //如果CallBack函数存在则调用 | ||||||
|  | @ -64,12 +67,7 @@ class CL_BaseObject { | ||||||
| 
 | 
 | ||||||
|     //添加子对象 |     //添加子对象 | ||||||
|     function Addchild(Child) { |     function Addchild(Child) { | ||||||
|         Children[Child.GetId()] <- Child; |  | ||||||
|         Child.Parent = this.weakref(); |  | ||||||
|         //给自己解引用计数 |  | ||||||
| 
 |  | ||||||
|         Child.OnAddchild(this); |         Child.OnAddchild(this); | ||||||
|         BaseObject_Addchild(this.C_Object, Child.C_Object); |  | ||||||
|     } |     } | ||||||
|     //移除子对象 |     //移除子对象 | ||||||
|     function Removechild(Child) { |     function Removechild(Child) { | ||||||
|  | @ -88,8 +86,10 @@ class CL_BaseObject { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //被添加 |     //被添加 | ||||||
|     function OnAddchild(Parent) { |     function OnAddchild(ParentObj) { | ||||||
| 
 |         ParentObj.Children[GetId()] <- this; | ||||||
|  |         this.Parent = ParentObj.weakref(); | ||||||
|  |         BaseObject_Addchild(ParentObj.C_Object, this.C_Object); | ||||||
|     } |     } | ||||||
|     //被移除 |     //被移除 | ||||||
|     function OnRemove(Parent) { |     function OnRemove(Parent) { | ||||||
|  |  | ||||||
|  | @ -19,6 +19,9 @@ class Layer extends Actor { | ||||||
| 
 | 
 | ||||||
|     //设置图层裁剪区域 |     //设置图层裁剪区域 | ||||||
|     function SetClipRect(x, y, w, h) { |     function SetClipRect(x, y, w, h) { | ||||||
|  |         if (!IsLayer) { | ||||||
|  |             print("SetClipRect:窗口不是图层窗口"); | ||||||
|  |         } | ||||||
|         LayerActor_SetClipRect(this.C_Object, x, y, w, h); |         LayerActor_SetClipRect(this.C_Object, x, y, w, h); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -189,12 +189,12 @@ function InitPvfAni(Ro) { | ||||||
|         //调用的第几个Img |         //调用的第几个Img | ||||||
|         local Index_Buf = Ro.GetShort(); |         local Index_Buf = Ro.GetShort(); | ||||||
|         //如果等于-1说明是img路径为空 |         //如果等于-1说明是img路径为空 | ||||||
|         if (Index_Buf != 65535) { |         if (Index_Buf != -1) { | ||||||
|             FrameObject.Img_Path <- AniObject.Img_List[Index_Buf].tolower(); |             FrameObject.Img_Path <- AniObject.Img_List[Index_Buf].tolower(); | ||||||
|             //Img中的PNG下标 |             //Img中的PNG下标 | ||||||
|             FrameObject.Img_Index <- Ro.GetUShort(); |             FrameObject.Img_Index <- Ro.GetUShort(); | ||||||
|         } else { |         } else { | ||||||
|             FrameObject.Img_Path <- ""; |             FrameObject.Img_Path <- null; | ||||||
|             FrameObject.Img_Index <- 0; |             FrameObject.Img_Index <- 0; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -6,12 +6,14 @@ | ||||||
| */ | */ | ||||||
| class CL_SpriteFrameObject extends CL_BaseObject { | class CL_SpriteFrameObject extends CL_BaseObject { | ||||||
| 
 | 
 | ||||||
|  |     ImgPath = null; | ||||||
|  |     ImgIndex = null; | ||||||
| 
 | 
 | ||||||
|     constructor(...) { |     constructor(...) { | ||||||
|         if (vargv.len() == 2) { |         if (vargv.len() == 2) { | ||||||
|             local Path = vargv[0]; |             ImgPath = vargv[0]; | ||||||
|             local Index = vargv[1]; |             ImgIndex = vargv[1]; | ||||||
|             C_Object = SpriteFrame_Create(Path, Index); |             C_Object = SpriteFrame_Create(ImgPath, ImgIndex); | ||||||
|         } else { |         } else { | ||||||
|             C_Object = vargv[0]; |             C_Object = vargv[0]; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -319,20 +319,19 @@ class Math { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function sq_GetAccel(sv, ev, currentRate, maxRate, increaseFeature) { |     function sq_GetAccel(sv, ev, currentRate, maxRate, increaseFeature) { | ||||||
| 
 |  | ||||||
|         local rate = currentRate.tofloat() / maxRate.tofloat(); |         local rate = currentRate.tofloat() / maxRate.tofloat(); | ||||||
| 
 |  | ||||||
|         local varyValue = ev - sv; |         local varyValue = ev - sv; | ||||||
| 
 | 
 | ||||||
|         local increaseRate = 1.0; |         local increaseRate = 1.0; | ||||||
| 
 |  | ||||||
|         if (increaseFeature) { |         if (increaseFeature) { | ||||||
|             increaseRate = pow(50, rate) / 50; //慢->快 |             increaseRate = pow(50, rate) / 50; //慢->快 | ||||||
|         } else { |         } else { | ||||||
|             increaseRate = pow(rate, 0.05); |             // 修正后的减速逻辑计算,例如采用线性变换结合幂次运算来实现更合理的减速效果 | ||||||
|  |             // 先将rate映射到一个更合适的范围(这里从[0,1]映射到[0.1, 1],可调整) | ||||||
|  |             local mappedRate = rate * 0.9 + 0.1; | ||||||
|  |             increaseRate = pow(mappedRate, 2); // 幂次可调整,这里取2来让减速更明显,可根据实际情况修改 | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|         return sv + varyValue * increaseRate; |         return sv + varyValue * increaseRate; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -184,6 +184,9 @@ class Yosin_Window extends Yosin_BaseWindow { | ||||||
|     //是否为独立窗口 |     //是否为独立窗口 | ||||||
|     IsIndependent = true; |     IsIndependent = true; | ||||||
| 
 | 
 | ||||||
|  |     //是否为图层窗口 | ||||||
|  |     IsLayer = false; | ||||||
|  | 
 | ||||||
|     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { |     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { | ||||||
|         ObjectId = gObjectId; |         ObjectId = gObjectId; | ||||||
|         //宽度 |         //宽度 | ||||||
|  | @ -199,7 +202,7 @@ class Yosin_Window extends Yosin_BaseWindow { | ||||||
|         Y = gY; |         Y = gY; | ||||||
| 
 | 
 | ||||||
|         //调用原生方法 |         //调用原生方法 | ||||||
|         base.constructor(true); |         base.constructor(IsLayer); | ||||||
| 
 | 
 | ||||||
|         SetSize(Width, Height); |         SetSize(Width, Height); | ||||||
|         SyncPos(X, Y); |         SyncPos(X, Y); | ||||||
|  |  | ||||||
|  | @ -69,4 +69,5 @@ sqr/User/UI/Window/1_Select_Character.nut | ||||||
| sqr/User/UI/Window/2_create_Character.nut | sqr/User/UI/Window/2_create_Character.nut | ||||||
| sqr/User/UI/Window/233_HUD_Message.nut | sqr/User/UI/Window/233_HUD_Message.nut | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| sqr/User/main.nut | sqr/User/main.nut | ||||||
|  | @ -191,6 +191,18 @@ class _AssetManager_ { | ||||||
|                     Ret = Data.Get(); |                     Ret = Data.Get(); | ||||||
|                     DataTable.type.index <- Ret.tointeger(); |                     DataTable.type.index <- Ret.tointeger(); | ||||||
|                 } |                 } | ||||||
|  |                 //光环效果 | ||||||
|  |                 else if (Pack == "[aurora graphic effects]") { | ||||||
|  |                     DataTable.aurora_effects <- []; | ||||||
|  |                     local Count = Data.Get(); | ||||||
|  |                     for (local i = 0; i< Count; i++) { | ||||||
|  |                         local T = { | ||||||
|  |                             type = Data.Get(), | ||||||
|  |                             path = Data.Get().tolower() | ||||||
|  |                         } | ||||||
|  |                         DataTable.aurora_effects.push(T); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|                 //Ani |                 //Ani | ||||||
|                 else if (Pack == "[animation job]") { |                 else if (Pack == "[animation job]") { | ||||||
|                     local Job = Data.Get().slice(1, -1); |                     local Job = Data.Get().slice(1, -1); | ||||||
|  |  | ||||||
|  | @ -50,6 +50,9 @@ class Character_Animation extends Actor { | ||||||
|     //普通攻击Ani |     //普通攻击Ani | ||||||
|     AttackAni = null; |     AttackAni = null; | ||||||
| 
 | 
 | ||||||
|  |     //光环 | ||||||
|  |     AuroraAni = null; | ||||||
|  | 
 | ||||||
|     constructor() { |     constructor() { | ||||||
|         base.constructor(); |         base.constructor(); | ||||||
| 
 | 
 | ||||||
|  | @ -57,7 +60,6 @@ class Character_Animation extends Actor { | ||||||
| 
 | 
 | ||||||
|     //同步单部位动画 |     //同步单部位动画 | ||||||
|     function SyncAnimationBySlot(Type, AniObj, Src) { |     function SyncAnimationBySlot(Type, AniObj, Src) { | ||||||
| 
 |  | ||||||
|         this[AniObj][Type] <- []; |         this[AniObj][Type] <- []; | ||||||
| 
 | 
 | ||||||
|         //如果有时装就初始化Ani |         //如果有时装就初始化Ani | ||||||
|  | @ -113,8 +115,6 @@ class Character_Animation extends Actor { | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|         return this[AniObj][Type]; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //读取并设置Ani |     //读取并设置Ani | ||||||
|  | @ -275,6 +275,30 @@ class Character_Animation extends Actor { | ||||||
|         // ReadAndSetAttackAni(); |         // ReadAndSetAttackAni(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     function InitAuroa() { | ||||||
|  |         //光环 | ||||||
|  |         local Info = Parent.aurora; | ||||||
|  |         //如果有光环 | ||||||
|  |         if (AuroraAni) { | ||||||
|  |             foreach(Ani in AuroraAni) { | ||||||
|  |                 Removechild(Ani); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         AuroraAni = []; | ||||||
|  | 
 | ||||||
|  |         foreach(Effect in Info.Aurora_effects) { | ||||||
|  |             local AniBuf = Animation(Effect.path); | ||||||
|  |             AuroraAni.append(AniBuf); | ||||||
|  |             Addchild(AniBuf); | ||||||
|  |             //front | ||||||
|  |             if (Effect.type == 1) { | ||||||
|  |                 AniBuf.SetZOrder(100000); | ||||||
|  |             } else { | ||||||
|  |                 AniBuf.SetZOrder(-100000); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
|     //设置Ani |     //设置Ani | ||||||
|     function SetAnimation(Ani) { |     function SetAnimation(Ani) { | ||||||
|  | @ -295,7 +319,7 @@ class Character_Animation extends Actor { | ||||||
|             CurrentAni = this[Ani]; |             CurrentAni = this[Ani]; | ||||||
|         } |         } | ||||||
|         //重置Ani 并添加子对象 |         //重置Ani 并添加子对象 | ||||||
|         foreach(AniGroup in CurrentAni) { |         foreach(Key, AniGroup in CurrentAni) { | ||||||
|             foreach(AniObj in AniGroup) { |             foreach(AniObj in AniGroup) { | ||||||
|                 AniObj.Reset(); |                 AniObj.Reset(); | ||||||
|                 Addchild(AniObj); |                 Addchild(AniObj); | ||||||
|  |  | ||||||
|  | @ -27,6 +27,8 @@ class GameItem.Equipment extends GameItem.Item { | ||||||
|     Description = ""; |     Description = ""; | ||||||
|     //文件路径 |     //文件路径 | ||||||
|     DirPath = null; |     DirPath = null; | ||||||
|  |     //光环特效 | ||||||
|  |     Aurora_effects = null; | ||||||
| 
 | 
 | ||||||
|     //装备属性 |     //装备属性 | ||||||
|     Property = null; |     Property = null; | ||||||
|  | @ -51,6 +53,7 @@ class GameItem.Equipment extends GameItem.Item { | ||||||
|                     if (EquInfo.rawin("icon")) Icon = EquInfo["icon"]; |                     if (EquInfo.rawin("icon")) Icon = EquInfo["icon"]; | ||||||
|                     if (EquInfo.rawin("Ani")) Animation_Job = EquInfo["Ani"]; |                     if (EquInfo.rawin("Ani")) Animation_Job = EquInfo["Ani"]; | ||||||
|                     if (EquInfo.rawin("DirPath")) DirPath = EquInfo["DirPath"]; |                     if (EquInfo.rawin("DirPath")) DirPath = EquInfo["DirPath"]; | ||||||
|  |                     if (EquInfo.rawin("aurora_effects")) Aurora_effects = EquInfo["aurora_effects"]; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | @ -73,6 +76,7 @@ class GameItem.Equipment extends GameItem.Item { | ||||||
|         else if (EType == "shoes avatar") SetRealEquipmentType("shoes", "avatar"); |         else if (EType == "shoes avatar") SetRealEquipmentType("shoes", "avatar"); | ||||||
|         else if (EType == "breast avatar") SetRealEquipmentType("breast", "avatar"); |         else if (EType == "breast avatar") SetRealEquipmentType("breast", "avatar"); | ||||||
|         else if (EType == "face avatar") SetRealEquipmentType("face", "avatar"); |         else if (EType == "face avatar") SetRealEquipmentType("face", "avatar"); | ||||||
|  |         else if (EType == "aurora avatar") SetRealEquipmentType("aurora", "aurora"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //穿戴装备回调 |     //穿戴装备回调 | ||||||
|  |  | ||||||
|  | @ -16,6 +16,7 @@ class GameObject.Character extends GameObject.ActiveObject { | ||||||
|     pants = null; //下装 |     pants = null; //下装 | ||||||
|     shoes = null; //鞋子 |     shoes = null; //鞋子 | ||||||
|     weapon = null; //武器 |     weapon = null; //武器 | ||||||
|  |     aurora = null; //光环 | ||||||
| 
 | 
 | ||||||
|     //动画对象管理器 |     //动画对象管理器 | ||||||
|     AnimationManager = null; |     AnimationManager = null; | ||||||
|  | @ -100,6 +101,8 @@ class GameObject.Character extends GameObject.ActiveObject { | ||||||
|         //如果是武器或者时装则同步动画 |         //如果是武器或者时装则同步动画 | ||||||
|         if (Equ.SlotType == "weapon" || Equ.Type == "avatar") { |         if (Equ.SlotType == "weapon" || Equ.Type == "avatar") { | ||||||
|             AnimationManager.Init(Equ.SlotType); |             AnimationManager.Init(Equ.SlotType); | ||||||
|  |         } else if (Equ.Type == "aurora") { | ||||||
|  |             AnimationManager.InitAuroa(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     //切换装备列表 |     //切换装备列表 | ||||||
|  |  | ||||||
|  | @ -53,24 +53,27 @@ function TestStage() { | ||||||
| 
 | 
 | ||||||
|     // local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0); |     // local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0); | ||||||
|     // local T = { |     // local T = { | ||||||
|     //     Background = 1, |     //     loginImg = 1, | ||||||
|     //     Charc = [{ |     //     charac = [{ | ||||||
|     //         Job = 0, |     //         job = 0, | ||||||
|     //         Ava = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] |     //         equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] | ||||||
|     //     }, { |     //     }, { | ||||||
|     //         Job = 0, |     //         job = 0, | ||||||
|     //         Ava = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] |     //         equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] | ||||||
|     //     }, { |     //     }, { | ||||||
|     //         Job = 0, |     //         job = 0, | ||||||
|     //         Ava = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] |     //         equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] | ||||||
|     //     }, { |     //     }, { | ||||||
|     //         Job = 0, |     //         job = 0, | ||||||
|     //         Ava = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] |     //         equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] | ||||||
|     //     }, { |     //     }, { | ||||||
|     //         Job = 0, |     //         job = 0, | ||||||
|     //         Ava = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] |     //         equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] | ||||||
|     //     }] |     //     }] | ||||||
|     // }; |     // }; | ||||||
|     // Window.Init(T); |     // Window.Init(T); | ||||||
| 
 | 
 | ||||||
|  |     // print(ObjectCount); | ||||||
|  | 
 | ||||||
|  |     // Sq_CreateWindow(_CreateCharacter, "创建角色界面窗口", 0, 0, 1066, 600, 0); | ||||||
| } | } | ||||||
|  | @ -22,6 +22,9 @@ class _Login_Window extends Yosin_Window { | ||||||
|     //信息 |     //信息 | ||||||
|     PackInfo = null; |     PackInfo = null; | ||||||
| 
 | 
 | ||||||
|  |     //公告框 | ||||||
|  |     NoticeBox = null; | ||||||
|  | 
 | ||||||
|     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { |     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { | ||||||
|         base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); |         base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); | ||||||
| 
 | 
 | ||||||
|  | @ -36,12 +39,13 @@ class _Login_Window extends Yosin_Window { | ||||||
| 
 | 
 | ||||||
|         //注册登录回调包 |         //注册登录回调包 | ||||||
|         MySocket.RegisterHandler(2, function(Jso) { |         MySocket.RegisterHandler(2, function(Jso) { | ||||||
|  |             if (NoticeBox) NoticeBox.CloseWindow(); | ||||||
|             //登录成功 |             //登录成功 | ||||||
|             if (Jso.state) { |             if (Jso.state) { | ||||||
|                 HUD_Message(500, 200, "登录成功,正在进入游戏..."); |                 NoticeBox = _Yosin_MessageBox("登录成功,正在进入游戏..."); | ||||||
|                 MySocket.Send(9, null); |                 MySocket.Send(9, null); | ||||||
|             } else { |             } else { | ||||||
|                 HUD_Message(500, 200, "登录失败"); |                 NoticeBox = _Yosin_MessageBox("登录失败"); | ||||||
|             } |             } | ||||||
|         }.bindenv(this)); |         }.bindenv(this)); | ||||||
| 
 | 
 | ||||||
|  | @ -59,6 +63,10 @@ class _Login_Window extends Yosin_Window { | ||||||
|                     info.equip.append(value); |                     info.equip.append(value); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  | 
 | ||||||
|  |             //关闭登录界面 | ||||||
|  |             NoticeBox.CloseWindow(); | ||||||
|  |             CloseWindow(); | ||||||
|             local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0); |             local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0); | ||||||
|             Window.Init(PackInfo); |             Window.Init(PackInfo); | ||||||
|         }.bindenv(this)); |         }.bindenv(this)); | ||||||
|  | @ -154,6 +162,7 @@ class _Login_Window extends Yosin_Window { | ||||||
|         }); |         }); | ||||||
|         PasswordTextActor.SetPosition(720, 281); |         PasswordTextActor.SetPosition(720, 281); | ||||||
|         Addchild(PasswordTextActor); |         Addchild(PasswordTextActor); | ||||||
|  | 
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -58,6 +58,8 @@ class _Select_Character_SettingBackground_Object_Window extends Yosin_CommonUi { | ||||||
|     function OnMouseLbClick(MousePos_X, MousePos_Y) { |     function OnMouseLbClick(MousePos_X, MousePos_Y) { | ||||||
|         base.OnMouseLbClick(MousePos_X, MousePos_Y); |         base.OnMouseLbClick(MousePos_X, MousePos_Y); | ||||||
|         if (isInRect) { |         if (isInRect) { | ||||||
|  |             //必须是在框的范围内 | ||||||
|  |             if (MousePos_Y > Parent.Y && MousePos_Y<(Parent.Y + Parent.Height)) { | ||||||
|                 //遍历父对象中的所有按钮 还原其他按钮 |                 //遍历父对象中的所有按钮 还原其他按钮 | ||||||
|                 foreach(Button in Parent.SettingBackgroundButtonList) { |                 foreach(Button in Parent.SettingBackgroundButtonList) { | ||||||
|                     Button.SelectMask.SetVisible(false); |                     Button.SelectMask.SetVisible(false); | ||||||
|  | @ -70,12 +72,16 @@ class _Select_Character_SettingBackground_Object_Window extends Yosin_CommonUi { | ||||||
|                 Parent.Parent.ChangeBackground(Idx); |                 Parent.Parent.ChangeBackground(Idx); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |     } | ||||||
| } | } | ||||||
| class _Select_Character_SettingBackground_Window extends Yosin_Window { | class _Select_Character_SettingBackground_Window extends Yosin_Window { | ||||||
| 
 | 
 | ||||||
|     //是否为独立窗口 |     //是否为独立窗口 | ||||||
|     IsIndependent = false; |     IsIndependent = false; | ||||||
| 
 | 
 | ||||||
|  |     //是否为图层窗口 | ||||||
|  |     IsLayer = true; | ||||||
|  | 
 | ||||||
|     //是否可见 |     //是否可见 | ||||||
|     Visible = false; |     Visible = false; | ||||||
| 
 | 
 | ||||||
|  | @ -122,7 +128,7 @@ class _Select_Character_SettingBackground_Window extends Yosin_Window { | ||||||
|         ScrollObject = Yosin_ScrollBar(Width - 13, 5, Height - 8, 20); |         ScrollObject = Yosin_ScrollBar(Width - 13, 5, Height - 8, 20); | ||||||
|         ScrollObject.SetChangeCallBack(function(Value) { |         ScrollObject.SetChangeCallBack(function(Value) { | ||||||
|             foreach(Pos, Button in SettingBackgroundButtonList) { |             foreach(Pos, Button in SettingBackgroundButtonList) { | ||||||
|                 Button.SetPosition(5 + (101 * (Pos % 2)), 9 + (61 * (Pos / 2)) - Value * (61 * 12)); |                 Button.SyncPos(5 + (101 * (Pos % 2)), 9 + (61 * (Pos / 2)) - Value * (61 * 12)); | ||||||
|             } |             } | ||||||
|         }.bindenv(this)); |         }.bindenv(this)); | ||||||
|         AddUIChild(ScrollObject); |         AddUIChild(ScrollObject); | ||||||
|  | @ -142,14 +148,14 @@ class _Select_Character_SettingBackground_Window extends Yosin_Window { | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| //角色 | //角色 | ||||||
| class _Select_Character_Chr extends Yosin_Window { | class _Select_Character_Chr extends Yosin_CommonUi { | ||||||
|     //是否为独立窗口 |     //是否为独立窗口 | ||||||
|     IsIndependent = false; |     IsIndependent = false; | ||||||
| 
 | 
 | ||||||
|     Info = null; |     Info = null; | ||||||
| 
 | 
 | ||||||
|     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { |     constructor(gX, gY, gWidth, gHeight) { | ||||||
|         base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); |         base.constructor(gX, gY, gWidth, gHeight); | ||||||
|         RegisterDraw(); |         RegisterDraw(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -168,6 +174,7 @@ class _Select_Character_Chr extends Yosin_Window { | ||||||
|         Charc.SetAnimation("RestAni"); |         Charc.SetAnimation("RestAni"); | ||||||
|         Charc.SetPosition(48, 12, 0); |         Charc.SetPosition(48, 12, 0); | ||||||
|         Addchild(Charc); |         Addchild(Charc); | ||||||
|  |         // print(Charc.AnimationManager.Children.len()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | @ -236,7 +243,7 @@ class _Select_Character_Window extends Yosin_Window { | ||||||
| 
 | 
 | ||||||
|         //角色对象 |         //角色对象 | ||||||
|         for (local i = 0; i< 5; i++) { |         for (local i = 0; i< 5; i++) { | ||||||
|             local Buf = _Select_Character_Chr("选择角色角色对象" + i, 190 + (i * 144), ((i % 2) ? 15 : 0) + 225, 126, 208, 0); |             local Buf = _Select_Character_Chr(190 + (i * 144), ((i % 2) ? 15 : 0) + 225, 126, 208); | ||||||
|             if (i< Info.charac.len()) Buf.Init(Info.charac[i]); |             if (i< Info.charac.len()) Buf.Init(Info.charac[i]); | ||||||
|             AddUIChild(Buf); |             AddUIChild(Buf); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ | ||||||
| 文件用途: 公告或信息弹窗 | 文件用途: 公告或信息弹窗 | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| class HUD_Message extends Yosin_Window { | class _Yosin_MessageBox extends Yosin_Window { | ||||||
|     //调试模式 |     //调试模式 | ||||||
|     // DeBugMode = true; |     // DeBugMode = true; | ||||||
| 
 | 
 | ||||||
|  | @ -23,7 +23,7 @@ class HUD_Message extends Yosin_Window { | ||||||
|     titleTextActor = null; |     titleTextActor = null; | ||||||
|     messageTextActor = null; |     messageTextActor = null; | ||||||
| 
 | 
 | ||||||
|     constructor(gX, gY, message, info = { |     constructor(message, gX = 418, gY = 200, info = { | ||||||
|         // 标题 |         // 标题 | ||||||
|         title = "公告", |         title = "公告", | ||||||
|         // 水平边距 |         // 水平边距 | ||||||
|  | @ -60,7 +60,7 @@ class HUD_Message extends Yosin_Window { | ||||||
|         cacheH = messageTextActor.GetSize().h + verticalMargin; |         cacheH = messageTextActor.GetSize().h + verticalMargin; | ||||||
| 
 | 
 | ||||||
|         // 默认构造数据 |         // 默认构造数据 | ||||||
|         base.constructor("公告或信息弹窗" + clock().tostring(), gX, gY, cacheW, cacheH, 20); |         base.constructor("公告或信息弹窗" + clock().tostring(), gX ? gX : 418, gY ? gY : 200, cacheW, cacheH, 20); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         //注册控件 |         //注册控件 | ||||||
|  |  | ||||||
|  | @ -17,6 +17,6 @@ function main(args) { | ||||||
|     Game.size = [1066, 600]; |     Game.size = [1066, 600]; | ||||||
|     Game.v_sync = false; |     Game.v_sync = false; | ||||||
|     Game.frame_interval = 10000; |     Game.frame_interval = 10000; | ||||||
|     // Game.debug_mode = true; |     Game.debug_mode = true; | ||||||
|     Game.Run(LoginStage); |     Game.Run(LoginStage); | ||||||
| } | } | ||||||
|  | @ -173,7 +173,11 @@ | ||||||
|     "User/UI/Window/233_HUD_Message.nut": { |     "User/UI/Window/233_HUD_Message.nut": { | ||||||
|         "description": "公告弹窗" |         "description": "公告弹窗" | ||||||
|     }, |     }, | ||||||
|  |     "User/UI/Window/1_Select_Character.nut": { | ||||||
|  |         "description": "选择角色界面" | ||||||
|  |     }, | ||||||
|     "User/UI/Window/2_Create_Character.nut": { |     "User/UI/Window/2_Create_Character.nut": { | ||||||
|         "description": "创建角色" |         "description": "创建角色" | ||||||
|     } |     } | ||||||
|  |      | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue