Compare commits
	
		
			No commits in common. "dd69f0a65b6f986978e0698eaebd46c665d9977c" and "d0000d2fb917fd1637f63ea2d9715be251804f13" have entirely different histories.
		
	
	
		
			dd69f0a65b
			...
			d0000d2fb9
		
	
		
							
								
								
									
										
											BIN
										
									
								
								Yosin_Engine.exe
								
								
								
								
							
							
						
						
									
										
											BIN
										
									
								
								Yosin_Engine.exe
								
								
								
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -6,16 +6,16 @@ | |||
| */ | ||||
| class Layer extends Actor { | ||||
| 
 | ||||
|     // constructor(...) { | ||||
|     //     local C_Object; | ||||
|     //     if (vargv.len() == 0) { | ||||
|     //         C_Object = LayerActor_Create(); | ||||
|     //         base.constructor(C_Object); | ||||
|     //     } else { | ||||
|     //         C_Object = vargv[0]; | ||||
|     //         base.constructor(C_Object, true); | ||||
|     //     } | ||||
|     // } | ||||
|     constructor(...) { | ||||
|         local C_Object; | ||||
|         if (vargv.len() == 0) { | ||||
|             C_Object = LayerActor_Create(); | ||||
|             base.constructor(C_Object); | ||||
|         } else { | ||||
|             C_Object = vargv[0]; | ||||
|             base.constructor(C_Object, true); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     //设置图层裁剪区域 | ||||
|     function SetClipRect(x, y, w, h) { | ||||
|  |  | |||
|  | @ -24,21 +24,10 @@ function print(Object) { | |||
| /* | ||||
|  * @函数作用: 深拷贝Table | ||||
|  */ | ||||
| // function sq_DeepCopy(original) { | ||||
| //     local Ret = Json.Encode(original); | ||||
| //     Ret = Json.Decode(Ret); | ||||
| //     return Ret; | ||||
| // } | ||||
| function sq_DeepCopy(original) { | ||||
|     local RetTable = clone(original); | ||||
|     foreach(Key, Value in original) { | ||||
|         if (typeof Value == "table") { | ||||
|             RetTable[Key] = sq_DeepCopy(Value); | ||||
|         } else if (typeof Value == "array") { | ||||
|             RetTable[Key] = sq_DeepCopy(Value); | ||||
|         } | ||||
|     } | ||||
|     return RetTable; | ||||
|     local Ret = Json.Encode(original); | ||||
|     Ret = Json.Decode(Ret); | ||||
|     return Ret; | ||||
| } | ||||
| 
 | ||||
| /* | ||||
|  |  | |||
|  | @ -25,20 +25,9 @@ class Yosin_BaseWindow extends Layer { | |||
|     Y = null; | ||||
|     B_Y = null; | ||||
| 
 | ||||
|     function _typeof() { | ||||
|         return "Yosin_BaseWindow"; | ||||
|     } | ||||
| 
 | ||||
|     //构造函数 | ||||
|     constructor(IsWindowFlag = false) { | ||||
|         local ObjectBuf; | ||||
|         //如果是游戏窗口类 则以Layer为基类 否则以Actor为基类 | ||||
|         if (IsWindowFlag) { | ||||
|             ObjectBuf = LayerActor_Create(); | ||||
|             base.constructor(ObjectBuf); | ||||
|         } else { | ||||
|     constructor() { | ||||
|         //构造函数 创建一个空Actor | ||||
|         base.constructor(); | ||||
|         } | ||||
| 
 | ||||
|         //子控件list初始化 | ||||
|         UI_Childrens = []; | ||||
|  | @ -122,6 +111,8 @@ class Yosin_BaseWindow extends Layer { | |||
|             if (Window.UpdateFunc) Window.UpdateFunc(Window, Dt); | ||||
|             Window.Proc(Dt); | ||||
|         } | ||||
|         //显示才调用Update | ||||
|         if (Visible) base.OnUpdate(Dt); | ||||
|     } | ||||
|     //同步坐标 | ||||
|     function SyncPos(X, Y) { | ||||
|  | @ -199,10 +190,9 @@ class Yosin_Window extends Yosin_BaseWindow { | |||
|         Y = gY; | ||||
| 
 | ||||
|         //调用原生方法 | ||||
|         base.constructor(true); | ||||
|         base.constructor(); | ||||
| 
 | ||||
|         SetSize(Width, Height); | ||||
|         SyncPos(X, Y); | ||||
|     } | ||||
| 
 | ||||
|     //切换到最上层窗口 即得到焦点时 全局窗口才调用 子窗口请不要调用此函数 | ||||
|  | @ -341,8 +331,6 @@ class Yosin_Window extends Yosin_BaseWindow { | |||
|         //调用原生方法 | ||||
|         base.OnMouseWheel(Flag, MousePos_X, MousePos_Y); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| //创建窗口 | ||||
|  | @ -378,8 +366,6 @@ function _Yosin_Windows_Logic_(Dt, Ui_Layer) { | |||
|         } | ||||
|         //无论窗口是否显示都需要调用Proc | ||||
|         Window.Proc(Dt); | ||||
|         //无论是否显示都调用Update | ||||
|         Window.OnUpdate(Dt); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -51,15 +51,6 @@ class _AssetManager_ { | |||
|                             DataTable.growtype[i].name <- name; | ||||
|                         } | ||||
|                     } | ||||
|                     //默认时装 | ||||
|                     else if (Key == "[default avatar]") { | ||||
|                         DataTable.default_avatar <- []; | ||||
|                         while (true) { | ||||
|                             local Ret = Data.Get(); | ||||
|                             if (Ret == "[/default avatar]") break; | ||||
|                             DataTable.default_avatar.append(Ret); | ||||
|                         } | ||||
|                     } | ||||
|                     //基础属性 | ||||
|                     else if (Key == "[HP MAX]]" || Key == "[MP MAX]]" || Key == "[physical attack]]" || Key == "[physical defense]]" || Key == "[magical attack]]" || Key == "[magical defense]]" || Key == "[inventory limit]]" || Key == "[MP regen speed]]" || Key == "[move speed]]" || Key == "[attack speed]]" || Key == "[cast speed]]" || Key == "[hit recovery]]" || Key == "[jump power]]" || Key == "[weight]]" || Key == "[jump speed]]") { | ||||
|                         local RealKey = Key.slice(1, Key.len() - 1); | ||||
|  | @ -124,11 +115,7 @@ class _AssetManager_ { | |||
|         EquipmentList = ScriptData.GetFileData("equipment/equipment.lst", function(DataTable, Data) { | ||||
|             while (!Data.Eof()) { | ||||
|                 local Key = Data.Get(); | ||||
|                 //注册装备列表 路径写入 数据未读取 | ||||
|                 DataTable.rawset(Key, { | ||||
|                     Path = Data.Get(), | ||||
|                     Data = null | ||||
|                 }); | ||||
|                 DataTable.rawset(Key, Data.Get()); | ||||
|             } | ||||
|             if (_DEBUG_) print("加载装备List完成, 共" + DataTable.len() + "个"); | ||||
|         }); | ||||
|  | @ -154,9 +141,7 @@ class _AssetManager_ { | |||
|     function GetEquipment(Idx) { | ||||
|         //如果没有这件装备则返回 | ||||
|         if (!(EquipmentList.rawin(Idx))) return; | ||||
|         //如果装备数据已经读取过存在了则直接返回 | ||||
|         if (EquipmentList[Idx].Data) return EquipmentList[Idx].Data; | ||||
|         local Path = EquipmentList[Idx].Path; | ||||
|         local Path = EquipmentList[Idx]; | ||||
|         local m_data = ScriptData.GetFileData("equipment/" + Path, function(DataTable, Data) { | ||||
|             DataTable.DirPath <- DataTable.filepath.slice(0, DataTable.filepath.lastfind("/") + 1); | ||||
|             while (!Data.Eof()) { | ||||
|  | @ -218,7 +203,6 @@ class _AssetManager_ { | |||
|                 } | ||||
|             } | ||||
|         }); | ||||
|         EquipmentList[Idx].Data = m_data; | ||||
|         return m_data; | ||||
|     } | ||||
| } | ||||
|  | @ -232,7 +232,9 @@ class Character_Animation extends Actor { | |||
|     } | ||||
| 
 | ||||
|     //初始化 | ||||
|     function Init(SlotType = false) { | ||||
|     function Init(...) { | ||||
|         local SlotType = false; | ||||
|         if (vargv.len() > 0) SlotType = vargv[0]; | ||||
|         //读取并设置 等待Ani | ||||
|         ReadAndSetAni("WaitingAni", "waiting motion", SlotType); | ||||
|         //读取并设置 移动Ani | ||||
|  |  | |||
|  | @ -43,14 +43,14 @@ class GameItem.Equipment extends GameItem.Item { | |||
|                 local EquInfo = AssetManager.GetEquipment(vargv[0]); | ||||
|                 if (EquInfo) { | ||||
|                     Idx = vargv[0]; | ||||
|                     if (EquInfo.rawin("name")) Name = EquInfo["name"]; | ||||
|                     if (EquInfo.rawin("type")) GetRealEquipmentType(EquInfo["type"].path); | ||||
|                     if (EquInfo.rawin("minimum level")) Minimum_level = EquInfo["minimum level"]; | ||||
|                     if (EquInfo.rawin("grade")) Grade = EquInfo["grade"]; | ||||
|                     if (EquInfo.rawin("usable_job")) Job = EquInfo["usable_job"]; | ||||
|                     if (EquInfo.rawin("icon")) Icon = EquInfo["icon"]; | ||||
|                     if (EquInfo.rawin("Ani")) Animation_Job = EquInfo["Ani"]; | ||||
|                     if (EquInfo.rawin("DirPath")) DirPath = EquInfo["DirPath"]; | ||||
|                     Name = EquInfo["name"]; | ||||
|                     GetRealEquipmentType(EquInfo["type"].path); | ||||
|                     Minimum_level = EquInfo["minimum level"]; | ||||
|                     Grade = EquInfo["grade"]; | ||||
|                     Job = EquInfo["usable_job"]; | ||||
|                     Icon = EquInfo["icon"]; | ||||
|                     Animation_Job = EquInfo["Ani"]; | ||||
|                     DirPath = EquInfo["DirPath"]; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -36,10 +36,6 @@ class GameObject.Character extends GameObject.ActiveObject { | |||
|         Addchild(AnimationManager); | ||||
|         AnimationManager.Init(); | ||||
| 
 | ||||
|         foreach(EquId in Info.default_avatar) { | ||||
|             local EquObj = GameItem.Equipment(EquId); | ||||
|             ChangeEquipment(EquObj); | ||||
|         } | ||||
|         //构造属性对象 | ||||
|         // Attribute = AttributeClass(); | ||||
|     } | ||||
|  | @ -112,15 +108,12 @@ class GameObject.Character extends GameObject.ActiveObject { | |||
| 
 | ||||
| //通过职业和装备列表来构造一个角色 | ||||
| GameObject.CreateCharacter <- function(Job = 0, EquIdList = []) { | ||||
| 
 | ||||
|     //构造角色 | ||||
|     local Character = GameObject.Character(); | ||||
|     Character.Init(Job); | ||||
|     foreach(EquId in EquIdList) { | ||||
|         if (EquId > 0) { | ||||
|         local EquObj = GameItem.Equipment(EquId); | ||||
|         Character.ChangeEquipment(EquObj); | ||||
|     } | ||||
|     } | ||||
|     return Character; | ||||
| } | ||||
|  | @ -26,7 +26,6 @@ class MySocket extends Socket { | |||
|             State = 1; | ||||
|         }.bindenv(this)); | ||||
|         BindFunc(SOCKET_CALLBACK_TYPE.onReceive, function(PacketId, Str) { | ||||
|             // print("收到消息:" + PacketId + " " + Str); | ||||
|             //如果存在对应处理逻辑 | ||||
|             if (PackHandler.rawin(PacketId)) { | ||||
|                 //将字符画序列化json | ||||
|  | @ -58,10 +57,8 @@ class MySocket extends Socket { | |||
| 
 | ||||
|     //发包 | ||||
|     function Send(PacketId, Jso) { | ||||
|         local SendObject; | ||||
|         if (typeof Jso == "table") SendObject = Json.Encode(Jso); //table转json字符串 字符串包 | ||||
|         else if (typeof Jso == "blob") SendObject = Jso; //字节流包 | ||||
|         else SendObject = ""; //空包 | ||||
|         Socket_SendPacket(getroottable()._MySocket_.Client, PacketId, SendObject); | ||||
|         //将json序列化字符串 | ||||
|         local Str = Json.Encode(Jso); | ||||
|         Socket_SendPacket(getroottable()._MySocket_.Client, PacketId, Str); | ||||
|     } | ||||
| } | ||||
|  | @ -6,8 +6,8 @@ | |||
| */ | ||||
| function InitGame() { | ||||
|     //初始化Socekt连接 | ||||
|     MySocket("192.168.200.15", 19003); | ||||
|     // MySocket("127.0.0.1", 19666); | ||||
|     // MySocket("192.168.200.24", 19666); | ||||
|     MySocket("127.0.0.1", 19666); | ||||
| 
 | ||||
|     //设定全局默认音量 | ||||
|     _Globa_Audio_Volume_ = 0.1; | ||||
|  |  | |||
|  | @ -11,9 +11,14 @@ function TestStage() { | |||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0); | ||||
|     // local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0); | ||||
| 
 | ||||
| 
 | ||||
|     local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0); | ||||
|     local T = { | ||||
|         Background = 0 | ||||
|     } | ||||
|     Window.Init(T); | ||||
| 
 | ||||
|     // local Fontobj = Font(); | ||||
| 
 | ||||
|  | @ -49,28 +54,4 @@ function TestStage() { | |||
|     // Charc.SetAnimation("RestAni"); | ||||
|     // Charc.SetZOrder(99999999); | ||||
|     // MapObj.Addchild(Charc); | ||||
| 
 | ||||
| 
 | ||||
|     // local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0); | ||||
|     // local T = { | ||||
|     //     Background = 1, | ||||
|     //     Charc = [{ | ||||
|     //         Job = 0, | ||||
|     //         Ava = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] | ||||
|     //     }, { | ||||
|     //         Job = 0, | ||||
|     //         Ava = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] | ||||
|     //     }, { | ||||
|     //         Job = 0, | ||||
|     //         Ava = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] | ||||
|     //     }, { | ||||
|     //         Job = 0, | ||||
|     //         Ava = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] | ||||
|     //     }, { | ||||
|     //         Job = 0, | ||||
|     //         Ava = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023] | ||||
|     //     }] | ||||
|     // }; | ||||
|     // Window.Init(T); | ||||
| 
 | ||||
| } | ||||
|  | @ -9,44 +9,19 @@ class Yosin_DragButton extends Yosin_CommonUi { | |||
|     Path = ""; | ||||
|     //索引 | ||||
|     Idx = 0; | ||||
|     //方向 | ||||
|     Direction = true; | ||||
| 
 | ||||
|     //按钮 | ||||
|     Button = null; | ||||
| 
 | ||||
|     //变动位置回调函数 | ||||
|     OnChange = null; | ||||
| 
 | ||||
|     //鼠标相对位置 | ||||
|     M_Xpos = null; | ||||
|     M_Ypos = null; | ||||
|     //未移动时的初始坐标 | ||||
|     BasePos = null; | ||||
|     //移动Flag | ||||
|     MoveFlag = false; | ||||
|     //最大移动值 | ||||
|     Max_Move_Value = 0; | ||||
|     //移动值 | ||||
|     Move_Value = 0; | ||||
|     //侦测值 | ||||
|     Detect_Value = 0; | ||||
| 
 | ||||
|     constructor(X, Y, W, H, Path, Idx, Direction = true, UnavailableFlag = true) { | ||||
|         this.Path = Path; | ||||
|         this.Idx = Idx; | ||||
|         this.Direction = Direction; | ||||
|         base.constructor(X, Y, W, H); | ||||
| 
 | ||||
|         Button = Yosin_SplicingButton(0, 0, W, H, Path, Idx, Direction, UnavailableFlag); | ||||
|         Button.DownSimulateOffset = false; | ||||
|         AddUIChild(Button); | ||||
| 
 | ||||
|         BasePos = { | ||||
|             x = X, | ||||
|             y = Y | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     //override | ||||
|  | @ -54,55 +29,5 @@ class Yosin_DragButton extends Yosin_CommonUi { | |||
|     function OnMouseLbDown(MousePos_X, MousePos_Y) { | ||||
|         base.OnMouseLbDown(MousePos_X, MousePos_Y); | ||||
| 
 | ||||
|         if (isInRect) { | ||||
|             MoveFlag = true; | ||||
|             M_Xpos = MousePos_X; //原始鼠标位置数据 | ||||
|             M_Ypos = MousePos_Y; | ||||
|             B_X = X; //原始窗口位置 | ||||
|             B_Y = Y; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     //override | ||||
|     function OnMouseProc(MousePos_X, MousePos_Y) { | ||||
|         //调用原生方法 | ||||
|         base.OnMouseProc(MousePos_X, MousePos_Y); | ||||
| 
 | ||||
|         //移动 | ||||
|         if (MoveFlag) { | ||||
|             //左键拖动 | ||||
|             if (Direction) { | ||||
|                 Move_Value = B_X + (MousePos_X - M_Xpos); | ||||
|                 if (!(Move_Value >= (0 + BasePos.x) && Move_Value <= (Max_Move_Value - Width + BasePos.x))) { | ||||
|                     X = Move_Value; | ||||
|                     DragLogic((Move_Value - Localtion_X).tofloat() / (Max_Move_Value - Width + BasePos.x - Localtion_X).tofloat()); | ||||
|                 } | ||||
|             } else { | ||||
|                 Move_Value = B_Y + (MousePos_Y - M_Ypos); | ||||
|                 if (Move_Value >= (0 + BasePos.y) && Move_Value <= (Max_Move_Value - Height + BasePos.y)) { | ||||
|                     Y = (Move_Value); | ||||
|                     DragLogic((Move_Value - Localtion_Y).tofloat() / (Max_Move_Value - Height + BasePos.y - Localtion_Y).tofloat()); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             SyncPos(X, Y); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     //拖动逻辑 | ||||
|     function DragLogic(Value) { | ||||
|         Detect_Value = Value; | ||||
|         if (OnChange) OnChange(Value); | ||||
|     } | ||||
| 
 | ||||
|     //鼠标左键弹起回调 | ||||
|     function OnMouseLbUp(MousePos_X, MousePos_Y) { | ||||
|         base.OnMouseLbUp(MousePos_X, MousePos_Y); | ||||
|         MoveFlag = false; | ||||
|     } | ||||
| 
 | ||||
|     //设置最大移动值 | ||||
|     function SetMaxMoveValue(Value) { | ||||
|         Max_Move_Value = Value; | ||||
|     } | ||||
| } | ||||
|  | @ -4,7 +4,7 @@ | |||
| 创建日期:2024-12-13	23:17 | ||||
| 文件用途: | ||||
| */ | ||||
| //滚动条 | ||||
| //基础按钮 | ||||
| class Yosin_ScrollBar extends Yosin_CommonUi { | ||||
|     //控制器 | ||||
|     Controller = null; | ||||
|  | @ -14,22 +14,18 @@ class Yosin_ScrollBar extends Yosin_CommonUi { | |||
| 
 | ||||
|     //上按钮 | ||||
|     UpButton = null; | ||||
|     //滚动按钮 | ||||
|     ScrollButton = null; | ||||
|     //下按钮 | ||||
|     DownButton = null; | ||||
| 
 | ||||
|     //回调函数 | ||||
|     OnChange = null; | ||||
| 
 | ||||
|     //Path | ||||
|     Path = "sprite/interface/lenheartwindowcommon.img"; | ||||
| 
 | ||||
|     constructor(X, Y, H, S_H) { | ||||
|     constructor(X, Y, H, gSize) { | ||||
|         base.constructor(X, Y, 9, H > 26 ? H : 26); | ||||
| 
 | ||||
|         Controller = { | ||||
|             CurPos = 0, | ||||
|             Size = gSize | ||||
|         } | ||||
| 
 | ||||
|         //上按钮 | ||||
|  | @ -41,9 +37,6 @@ class Yosin_ScrollBar extends Yosin_CommonUi { | |||
|         AddUIChild(UpButton); | ||||
| 
 | ||||
|         //滚动条 | ||||
|         ScrollButton = Yosin_DragButton(0, 13, 9, S_H, Path, 184, false, false); | ||||
|         ScrollButton.SetMaxMoveValue(Height - 26); | ||||
|         AddUIChild(ScrollButton); | ||||
| 
 | ||||
|         //下按钮 | ||||
|         DownButton = Yosin_BaseButton(0, Height - 13, 9, 13, Path, 22); | ||||
|  | @ -57,11 +50,6 @@ class Yosin_ScrollBar extends Yosin_CommonUi { | |||
| 
 | ||||
|     function Proc(Dt) { | ||||
|         base.Proc(Dt); | ||||
|         Controller.CurPos = ScrollButton.Detect_Value; | ||||
|     } | ||||
| 
 | ||||
|     function SetChangeCallBack(Func) { | ||||
|         ScrollButton.OnChange = Func; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -19,9 +19,6 @@ class _Login_Window extends Yosin_Window { | |||
| 
 | ||||
|     BackGroundMusic = null; | ||||
| 
 | ||||
|     //信息 | ||||
|     PackInfo = null; | ||||
| 
 | ||||
|     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { | ||||
|         base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); | ||||
| 
 | ||||
|  | @ -33,35 +30,6 @@ class _Login_Window extends Yosin_Window { | |||
| 
 | ||||
|         //播放音乐 | ||||
|         PlayBackgroundMusic(); | ||||
| 
 | ||||
|         //注册登录回调包 | ||||
|         MySocket.RegisterHandler(2, function(Jso) { | ||||
|             //登录成功 | ||||
|             if (Jso.state) { | ||||
|                 HUD_Message(500, 200, "登录成功,正在进入游戏..."); | ||||
|                 MySocket.Send(9, null); | ||||
|             } else { | ||||
|                 HUD_Message(500, 200, "登录失败"); | ||||
|             } | ||||
|         }.bindenv(this)); | ||||
| 
 | ||||
|         //注册获取角色列表回包 | ||||
|         MySocket.RegisterHandler(10, function(Jso) { | ||||
|             PackInfo = Jso; | ||||
|         }.bindenv(this)); | ||||
|         //注册获取角色列表的装备回包 | ||||
|         MySocket.RegisterBinaryHandler(10, function(Blob) { | ||||
|             Blob.readn('i'); | ||||
|             foreach(info in PackInfo.charac) { | ||||
|                 info.equip <- []; | ||||
|                 for (local i = 0; i< 15; i++) { | ||||
|                     local value = Blob.readn('i'); | ||||
|                     info.equip.append(value); | ||||
|                 } | ||||
|             } | ||||
|             local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0); | ||||
|             Window.Init(PackInfo); | ||||
|         }.bindenv(this)); | ||||
|     } | ||||
| 
 | ||||
|     function PlayBackgroundMusic() { | ||||
|  | @ -94,9 +62,7 @@ class _Login_Window extends Yosin_Window { | |||
|         }.bindenv(this); | ||||
| 
 | ||||
|         //登录按钮文本 | ||||
|         local LoginTextActor = FontAssetManager.GenerateNormal("登录", true, { | ||||
|             color = sq_RGBA(200, 195, 169, 255) | ||||
|         }); | ||||
|         local LoginTextActor = FontAssetManager.GenerateNormal("登录", sq_RGBA(200, 195, 169, 255), true); | ||||
|         LoginTextActor.SetPosition(26, 4); | ||||
|         LoginButton.Addchild(LoginTextActor); | ||||
|         AddUIChild(LoginButton); | ||||
|  | @ -111,9 +77,7 @@ class _Login_Window extends Yosin_Window { | |||
|             }) | ||||
|         }.bindenv(this); | ||||
|         //注册按钮文本 | ||||
|         local RegisterTextActor = FontAssetManager.GenerateNormal("注册", true, { | ||||
|             color = sq_RGBA(200, 195, 169, 255) | ||||
|         }); | ||||
|         local RegisterTextActor = FontAssetManager.GenerateNormal("注册", sq_RGBA(200, 195, 169, 255), true); | ||||
|         RegisterTextActor.SetPosition(26, 4); | ||||
|         RegisterButton.Addchild(RegisterTextActor); | ||||
|         AddUIChild(RegisterButton); | ||||
|  | @ -143,15 +107,11 @@ class _Login_Window extends Yosin_Window { | |||
|         LoginText.Addchild(LoginTexttip); | ||||
| 
 | ||||
|         //账号 | ||||
|         local AccountTextActor = FontAssetManager.GenerateNormal("账号:", false, { | ||||
|             color = sq_RGBA(200, 195, 169, 255) | ||||
|         }); | ||||
|         local AccountTextActor = FontAssetManager.GenerateNormal("账号:", sq_RGBA(200, 195, 169, 255), false); | ||||
|         AccountTextActor.SetPosition(720, 241); | ||||
|         Addchild(AccountTextActor); | ||||
|         //密码 | ||||
|         local PasswordTextActor = FontAssetManager.GenerateNormal("密码:", false, { | ||||
|             color = sq_RGBA(200, 195, 169, 255) | ||||
|         }); | ||||
|         local PasswordTextActor = FontAssetManager.GenerateNormal("密码:", sq_RGBA(200, 195, 169, 255), false); | ||||
|         PasswordTextActor.SetPosition(720, 281); | ||||
|         Addchild(PasswordTextActor); | ||||
|     } | ||||
|  |  | |||
|  | @ -82,16 +82,16 @@ class _Select_Character_SettingBackground_Window extends Yosin_Window { | |||
|     //选择背景按钮集合 | ||||
|     SettingBackgroundButtonList = null; | ||||
| 
 | ||||
|     //背景对象 | ||||
|     Background = null; | ||||
| 
 | ||||
|     ScrollObject = null; | ||||
| 
 | ||||
|     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { | ||||
|         base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); | ||||
|         SettingBackgroundButtonList = []; | ||||
| 
 | ||||
|         SetClipRect(5, 9, gWidth, gHeight - 9); | ||||
|         // SetClipRect(-gWidth, 0, gWidth, gHeight + 20); | ||||
|         // SetClipRect(0, 0, 1066, 600); | ||||
|         // ShowBorder(true); | ||||
|         // SetLayerOpacity(1); | ||||
|     } | ||||
| 
 | ||||
|     function Init() { | ||||
|  | @ -102,72 +102,25 @@ class _Select_Character_SettingBackground_Window extends Yosin_Window { | |||
|     function RegisterDraw() { | ||||
|         //背景 | ||||
|         Background = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/setup/setup.img", 17); | ||||
|         Background.SetPosition(X, Y); | ||||
|         Background.SetZOrder(-10); | ||||
|         Background.SetVisible(false); | ||||
|         //因为裁切原因 所以要添加到父对象中 | ||||
|         Parent.Addchild(Background); | ||||
|         Addchild(Background); | ||||
| 
 | ||||
|         for (local i = 0; i< 24; i++) { | ||||
|             local Buf = _Select_Character_SettingBackground_Object_Window(5 + (101 * (i % 2)), 9 + (61 * (i / 2)), 91, 51, i); | ||||
|             SettingBackgroundButtonList.push(Buf); | ||||
|             //如果是父对象默认构造的默认是勾选状态 | ||||
|             if (i == Parent.Info.loginImg) { | ||||
|             if (i == Parent.Info.Background) { | ||||
|                 Buf.SelectMask.SetVisible(true); | ||||
|                 Buf.SelectFlag = true; | ||||
|             } | ||||
|             AddUIChild(Buf); | ||||
|         } | ||||
| 
 | ||||
|         ScrollObject = Yosin_ScrollBar(Width - 13, 5, Height - 8, 20); | ||||
|         ScrollObject.SetChangeCallBack(function(Value) { | ||||
|             foreach(Pos, Button in SettingBackgroundButtonList) { | ||||
|                 Button.SetPosition(5 + (101 * (Pos % 2)), 9 + (61 * (Pos / 2)) - Value * (61 * 12)); | ||||
|             } | ||||
|         }.bindenv(this)); | ||||
|         AddUIChild(ScrollObject); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     //override | ||||
|     //设置是否可见 通过重载设置可见同步Background的可见性 | ||||
|     function SetVisible(Flag) { | ||||
|         base.SetVisible(Flag); | ||||
|         if (Flag) { | ||||
|             if (Background) Background.SetVisible(true); | ||||
|         } else { | ||||
|             if (Background) Background.SetVisible(false); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| //角色 | ||||
| class _Select_Character_Chr extends Yosin_Window { | ||||
|     //是否为独立窗口 | ||||
|     IsIndependent = false; | ||||
| 
 | ||||
|     Info = null; | ||||
| 
 | ||||
|     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { | ||||
|         base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); | ||||
|         RegisterDraw(); | ||||
|     } | ||||
| 
 | ||||
|     function Init(Info) { | ||||
|         this.Info = Info; | ||||
|         RegisterCharac(); | ||||
|     } | ||||
| 
 | ||||
|     function RegisterDraw() { | ||||
|         local Magic = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 10); | ||||
|         Addchild(Magic); | ||||
|     } | ||||
| 
 | ||||
|     function RegisterCharac() { | ||||
|         local Charc = GameObject.CreateCharacter(Info.job, Info.equip); | ||||
|         Charc.SetAnimation("RestAni"); | ||||
|         Charc.SetPosition(48, 12, 0); | ||||
|         Addchild(Charc); | ||||
|     //逻辑入口 | ||||
|     function Proc(Dt) { | ||||
|         SyncPos(X, Y); | ||||
|         base.Proc(Dt); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -188,8 +141,6 @@ class _Select_Character_Window extends Yosin_Window { | |||
|     SettingBackgroundWindow = null; | ||||
|     //背景图片 | ||||
|     BackGround = null; | ||||
|     //角色遮罩栏 | ||||
|     CharacterMaskBox = null; | ||||
| 
 | ||||
|     //信息 | ||||
|     Info = null; | ||||
|  | @ -206,9 +157,6 @@ class _Select_Character_Window extends Yosin_Window { | |||
|         //注册绘制 | ||||
|         RegisterDraw(); | ||||
|         //注册控件 | ||||
|         // for (local i = 0; i< 50; i++) { | ||||
|         //     RegisterWidget(); | ||||
|         // } | ||||
|         RegisterWidget(); | ||||
|         //注册窗口 | ||||
|         RegisterWindow(); | ||||
|  | @ -233,13 +181,6 @@ class _Select_Character_Window extends Yosin_Window { | |||
|         AddUIChild(SettingBackgroundWindow); | ||||
|         //先添加为子对象 因为子对象需要用到父对象 | ||||
|         SettingBackgroundWindow.Init(); | ||||
| 
 | ||||
|         //角色对象 | ||||
|         for (local i = 0; i< 5; i++) { | ||||
|             local Buf = _Select_Character_Chr("选择角色角色对象" + i, 190 + (i * 144), ((i % 2) ? 15 : 0) + 225, 126, 208, 0); | ||||
|             if (i< Info.charac.len()) Buf.Init(Info.charac[i]); | ||||
|             AddUIChild(Buf); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     function RegisterWidget() { | ||||
|  | @ -251,9 +192,7 @@ class _Select_Character_Window extends Yosin_Window { | |||
|         }.bindenv(this); | ||||
|         AddUIChild(SettingButton); | ||||
|         //登录按钮文本 | ||||
|         local LoginTextActor = FontAssetManager.GenerateNormal("背景设置", true, { | ||||
|             color = sq_RGBA(221, 197, 147, 255) | ||||
|         }); | ||||
|         local LoginTextActor = FontAssetManager.GenerateNormal("背景设置", sq_RGBA(221, 197, 147, 255), true); | ||||
|         LoginTextActor.SetPosition(23, 3); | ||||
|         LoginTextActor.SetUpdateFunc(function(Text, Dt) { | ||||
|             if (Text.Parent.State == 1 || Text.Parent.State == 2) { | ||||
|  | @ -264,6 +203,14 @@ class _Select_Character_Window extends Yosin_Window { | |||
|         }) | ||||
|         SettingButton.Addchild(LoginTextActor); | ||||
| 
 | ||||
| 
 | ||||
|         // local TestButton = Yosin_ScrollBar(300, 200, 50, 100); | ||||
|         // AddUIChild(TestButton); | ||||
|         // local TestButton = Yosin_SplicingButton(200, 200, 77, 68, "sprite/interface/lenheartwindowcommon.img", 184, false, false); | ||||
|         // TestButton.DownSimulateOffset = false; | ||||
|         local TestButton = Yosin_DragButton(200, 200, 9, 120, "sprite/interface/lenheartwindowcommon.img", 184, false, false); | ||||
|         // TestButton.SetScale(5.0, 5.0); | ||||
|         AddUIChild(TestButton); | ||||
|     } | ||||
| 
 | ||||
|     //切换背景 | ||||
|  | @ -273,18 +220,23 @@ class _Select_Character_Window extends Yosin_Window { | |||
|             BackGround = null; | ||||
|         } | ||||
|         BackGround = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/background/large/background_large_event.img", Idx); | ||||
|         BackGround.SetZOrder(-100); | ||||
|         BackGround.SetZOrder(-10); | ||||
| 
 | ||||
|         /* | ||||
| 
 | ||||
|                 BackGround = Layer(); | ||||
|         BackGround.Addchild(CL_SpriteObject("sprite/interface2/selectcharacter_ver2/background/large/background_large_event.img", Idx)); | ||||
|         BackGround.SetZOrder(-10); | ||||
|         BackGround.SetPosition(100, 100); | ||||
|         BackGround.SetClipRect(0, 0, 200, 200); | ||||
| 
 | ||||
|         */ | ||||
|         Addchild(BackGround); | ||||
|     } | ||||
| 
 | ||||
|     function RegisterDraw() { | ||||
|         //大背景 根据玩家的设定背景决定 | ||||
|         ChangeBackground(Info.loginImg); | ||||
| 
 | ||||
|         //角色遮罩栏 | ||||
|         CharacterMaskBox = Yosin_NineBoxStretch(-4, 330, 1074, 680, "sprite/interface/lenheartwindowcommon.img", 0); | ||||
|         AddUIChild(CharacterMaskBox); | ||||
| 
 | ||||
|         ChangeBackground(Info.Background); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ class HUD_Message extends Yosin_Window { | |||
|         horizontalMargin = 20, | ||||
|         // 垂直边距 | ||||
|         verticalMargin = 20, | ||||
|     }) { | ||||
|     } ) { | ||||
| 
 | ||||
|         local title = info.rawin("title") ? info.title  : "公告"; | ||||
|         local horizontalMargin = info.rawin("horizontalMargin") ? info.horizontalMargin  : 20; | ||||
|  | @ -59,16 +59,17 @@ class HUD_Message extends Yosin_Window { | |||
|         local verticalMargin = 50 + verticalMargin * 2; | ||||
|         cacheH = messageTextActor.GetSize().h + verticalMargin; | ||||
| 
 | ||||
|         print("cacheW:" + cacheW.tostring()); | ||||
|         print("cacheH:" + cacheH.tostring()); | ||||
| 
 | ||||
|         // 默认构造数据 | ||||
|         base.constructor("公告或信息弹窗" + clock().tostring(), gX, gY, cacheW, cacheH, 20); | ||||
|         base.constructor("公告或信息弹窗" + clock().tostring() , gX, gY, cacheW, cacheH, 20); | ||||
| 
 | ||||
| 
 | ||||
|         //注册控件 | ||||
|         RegisterWidget(); | ||||
|         //注册绘制 | ||||
|         RegisterDraw(); | ||||
| 
 | ||||
|         ResetFocus(); | ||||
|     } | ||||
| 
 | ||||
|     function RegisterWidget() { | ||||
|  | @ -83,10 +84,9 @@ class HUD_Message extends Yosin_Window { | |||
|         AddUIChild(titleBackground); | ||||
| 
 | ||||
|         //确认按钮 | ||||
|         local confirmButton = Yosin_BaseButton(cacheW / 2 - 28, cacheH - 15, 56, 24 "sprite/interface/lenheartwindowcommon.img", 12); | ||||
|         local confirmButton = Yosin_BaseButton( cacheW / 2  - 28, cacheH - 15, 56, 24 "sprite/interface/lenheartwindowcommon.img", 12); | ||||
|         confirmButton.OnClick = function(Button) { | ||||
|             //关闭本窗口 | ||||
|             CloseWindow(); | ||||
|             this.RemoveSelf(); | ||||
|         }.bindenv(this); | ||||
|         AddUIChild(confirmButton); | ||||
| 
 | ||||
|  | @ -96,10 +96,9 @@ class HUD_Message extends Yosin_Window { | |||
|         confirmButton.Addchild(confirmTextActor); | ||||
| 
 | ||||
|         //关闭按钮 | ||||
|         local closeButton = Yosin_BaseButton(cacheW - 15, 5, 10, 9 "sprite/interface/lenheartwindowcommon.img", 42); | ||||
|         local closeButton = Yosin_BaseButton( cacheW - 15, 5, 10, 9 "sprite/interface/lenheartwindowcommon.img", 42); | ||||
|         closeButton.OnClick = function(Button) { | ||||
|             //关闭本窗口 | ||||
|             CloseWindow(); | ||||
|             this.RemoveSelf(); | ||||
|         }.bindenv(this); | ||||
|         AddUIChild(closeButton); | ||||
| 
 | ||||
|  | @ -110,7 +109,7 @@ class HUD_Message extends Yosin_Window { | |||
| 
 | ||||
|         local titleX = cacheW / 2 - titleTextActor.GetSize().w / 2; | ||||
|         // 绘制标题 | ||||
|         titleTextActor.SetPosition(titleX, 2); | ||||
|         titleTextActor.SetPosition( titleX , 2); | ||||
|         Addchild(titleTextActor); | ||||
| 
 | ||||
| 
 | ||||
|  | @ -118,7 +117,7 @@ class HUD_Message extends Yosin_Window { | |||
|         local messageY = cacheH / 2 - messageTextActor.GetSize().h / 2; | ||||
| 
 | ||||
|         // 绘制内容 | ||||
|         messageTextActor.SetPosition(messageX, messageY); | ||||
|         messageTextActor.SetPosition( messageX , messageY ); | ||||
|         Addchild(messageTextActor); | ||||
| 
 | ||||
|     } | ||||
|  |  | |||
|  | @ -9,14 +9,12 @@ | |||
| 
 | ||||
| 
 | ||||
| function main(args) { | ||||
| 
 | ||||
| 
 | ||||
|     local Game = GameWindow(); | ||||
|     Game.title = "Yosin & Kiwano"; | ||||
|     Game.bg_color = [255.0, 255.0, 255.0, 255.0]; | ||||
|     Game.size = [1066, 600]; | ||||
|     Game.v_sync = false; | ||||
|     Game.frame_interval = 10000; | ||||
|     // Game.debug_mode = true; | ||||
|     Game.debug_mode = true; | ||||
|     Game.Run(LoginStage); | ||||
| } | ||||
		Loading…
	
		Reference in New Issue