Compare commits

...

2 Commits

Author SHA1 Message Date
Lenheart 3e8159c100 整体渲染大改 2025-01-03 19:49:49 +08:00
Lenheart 0ce2de0b59 临时存档推 2025-01-02 19:19:36 +08:00
23 changed files with 430 additions and 92 deletions

Binary file not shown.

BIN
opencv_world4100.dll Normal file

Binary file not shown.

View File

@ -4,7 +4,7 @@
创建日期:2024-05-07 23:25
文件用途:动画类
*/
class Animation extends Actor {
class Animation extends CL_SpriteObject {
//Ani是否可用
IsUsability = true;
@ -34,6 +34,15 @@ class Animation extends Actor {
//Ani路径
AniPath = null;
//是否描边
IsOutline = false;
//描边颜色
OutlineColor = null;
//描边对象List
OutlineList = null;
//当前描边对象
CurrentOutline = null;
//附加选项
AdditionalOptions = null;
@ -48,6 +57,8 @@ class Animation extends Actor {
SpriteArr = [];
//帧数组
FrameArr = [];
//描边对象List
OutlineList = [];
//判断是否有特殊处理
if (vargv.len() > 1) {
@ -110,27 +121,22 @@ class Animation extends Actor {
AnimationFlag = Buf.Flag;
FrameArr = Buf.Frame;
foreach(FrameObj in FrameArr) {
local Spritebuf;
local SpriteFramebuf;
//img路径判空
if (FrameObj.Img_Path) {
//如果有附加处理 格式化
if (AdditionalOptions && AdditionalOptions.rawin("ImgFormat")) FrameObj.Img_Path = AdditionalOptions["ImgFormat"](FrameObj.Img_Path);
Spritebuf = CL_SpriteObject("sprite/" + FrameObj.Img_Path, FrameObj.Img_Index);
//线性减淡
if ("GRAPHIC_EFFECT_LINEARDODGE" in FrameObj.Flag) {
Spritebuf.SetMode(0);
}
SpriteFramebuf = CL_SpriteFrameObject("sprite/" + FrameObj.Img_Path, FrameObj.Img_Index);
//坐标
Spritebuf.SetPosition(FrameObj.Pos);
SpriteFramebuf.SetPosition(FrameObj.Pos);
} else {
Spritebuf = CL_SpriteObject();
SpriteFramebuf = CL_SpriteFrameObject("sprite/interface/base.img", 0);
}
SpriteArr.append(Spritebuf);
SpriteArr.append(SpriteFramebuf);
}
} else {
error("创建Ani失败,找不到Ani数据");
@ -164,14 +170,53 @@ class Animation extends Actor {
return FrameArr[CurrentFrameIndex];
}
//设置描边
function SetOutline(Flag, Color = 0xffffffff) {
IsOutline = Flag;
//如果是开启
if (Flag) {
//如果没有创建过描边对象就创建
if (OutlineList.len() == 0) {
foreach(FrameSf in SpriteArr) {
local OutlineCanvasObj = FrameSf.CreateOutLine(Color);
// OutlineCanvasObj.SetZOrder(-1);
// OutlineCanvasObj.SetPosition(-1, -1);
// OutlineCanvasObj.SetPosition(-FrameSf.GetSize().w / 2, -FrameSf.GetSize().h);
OutlineList.push(OutlineCanvasObj);
}
}
//先把当前帧的描边对象设置上
AddOutlineChild();
} else {
//移除当前描边对象
if (CurrentOutline) {
Removechild(CurrentOutline);
}
}
}
//添加描边子对象
function AddOutlineChild() {
//如果有上一个描边对象先移除
if (CurrentOutline) {
Removechild(CurrentOutline);
}
//如果没有添加为子对象则添加
local OutlineCanvasObj = OutlineList[CurrentFrameIndex];
if (OutlineCanvasObj.Parent == null) {
CurrentOutline = OutlineCanvasObj;
Addchild(CurrentOutline);
}
}
function FlushFrame(Index) {
//同步当前帧
CurrentFrameIndex = Index;
//移除上一帧
if (CurrentFrame) Removechild(CurrentFrame);
//当前帧更换为本帧
CurrentFrame = SpriteArr[CurrentFrameIndex];
Addchild(SpriteArr[CurrentFrameIndex]);
SetFrame(CurrentFrame);
local FrameInfo = FrameArr[CurrentFrameIndex];
local FlagBuf = FrameInfo.Flag;
@ -188,6 +233,12 @@ class Animation extends Actor {
if ("IMAGE_RATE" in FlagBuf) {
SetScale(FlagBuf.IMAGE_RATE.x, FlagBuf.IMAGE_RATE.y);
}
//线性减淡
if ("GRAPHIC_EFFECT_LINEARDODGE" in FrameInfo.Flag) {
SetMode(0);
}
//如果有描边
if (IsOutline) AddOutlineChild();
//Ani对象的大小同步为精灵帧对象的大小
if (CurrentFrame) SetSize(CurrentFrame.GetSize());

View File

@ -169,11 +169,9 @@ class GlobaData {
if (!Buf) {
Buf = "";
} else {
Buf = "<" + Before + "::" + Buf + "`" + getroottable()._Script_Data_.GetLoadString(Buf) + "`>";
Buf = getroottable()._Script_Data_.GetLoadString(Buf);
}
Buf = Buf + "\r\n";
out += Buf;
break;
return Buf;
}
case 2: {
IO.seek(-4, 'c');

View File

@ -46,6 +46,11 @@ class CL_SpriteObject extends CL_BaseObject {
Sprite_SetMode(this.C_Object, Mode);
}
//设置描边
function SetOutline(Flag, Color = 0xffffffff) {
Sprite_SetOutline(this.C_Object, Flag, Color);
}
//设置裁切
function SetCropRect(Parameter1, Parameter2, ...) {
if (vargv.len() == 0) {

View File

@ -9,6 +9,10 @@ class CL_SpriteFrameObject extends CL_BaseObject {
ImgPath = null;
ImgIndex = null;
function _typeof() {
return "SpriteFrame";
}
constructor(...) {
if (vargv.len() == 2) {
ImgPath = vargv[0];
@ -20,4 +24,26 @@ class CL_SpriteFrameObject extends CL_BaseObject {
// base.constructor(C_Object);
}
//重写获取大小
function GetSize() {
return SpriteFrame_GetSize(this.C_Object);
}
//重写设置坐标
function SetPosition(Value, ...) {
if (vargv.len() == 0) {
X = Value.x;
Y = Value.y;
SpriteFrame_SetPosition(this.C_Object, Value);
} else if (vargv.len() == 1) {
X = Value;
Y = vargv[0];
SpriteFrame_SetPosition(this.C_Object, Value, vargv[0]);
}
}
//返回一个画布精灵
function CreateOutLine(Color) {
return CL_SpriteObject(SpriteFrame_CreateOutLine(this.C_Object, Color));
}
}

View File

@ -7,7 +7,7 @@
//游戏逻辑函数Map
_Game_Logic_Func_ <- {};
function _Yosin_Game_Logic_(Dt, GameLister) {
function _Yosin_Game_Logic_(Dt, GameListener) {
//Socket连接嗅探处理包
foreach(SocketObj in _Socket_Map_) {
SocketObj.DispatchPacket();
@ -15,6 +15,6 @@ function _Yosin_Game_Logic_(Dt, GameLister) {
//游戏逻辑函数
foreach(Key, Func in _Game_Logic_Func_) {
Func(Dt, GameLister);
Func(Dt, GameListener);
}
}

View File

@ -398,6 +398,8 @@ function _Yosin_Windows_Logic_(Dt, Ui_Layer) {
//鼠标点击Flag
_Mouse_Click_Flag <- {};
_Yosin_Cursor();
//特殊鼠标逻辑
_Yosin_Mouse_Logic_Func_ <- {};
//鼠标逻辑入口
function _Yosin_Windows_Mouse_Logic_(MouseState, Wheel, MousePos_X, MousePos_Y) {
@ -468,9 +470,19 @@ function _Yosin_Windows_Mouse_Logic_(MouseState, Wheel, MousePos_X, MousePos_Y)
break;
}
}
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Window.X, Window.Y, Window.Width, Window.Height)) return;
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Window.X, Window.Y, Window.Width, Window.Height)) break;
}
}
//可注册的除窗口外的其他事件
foreach(Func in _Yosin_Mouse_Logic_Func_) {
local ret = Func(MouseState, Wheel, MousePos_X, MousePos_Y);
if (ret == true) return;
}
}
//注册鼠标逻辑函数
function Reg_Yosin_Mouse_Logic(Flag, Func) {
_Yosin_Mouse_Logic_Func_.rawset(Flag, Func);
}
//输入逻辑函数Map

View File

@ -4,9 +4,9 @@
创建日期:2024-12-18 13:41
文件用途:
*/
class _Yosin_Cursor extends Actor {
class _Yosin_Cursor extends CL_SpriteObject {
Object = null;
CurrentFrame = null;
_Mouse_Click_Flag = null;
@ -26,11 +26,8 @@ class _Yosin_Cursor extends Actor {
//更换鼠标指针
function Change(Frame) {
if (Object) {
Removechild(Object);
}
Object = Frame;
Addchild(Frame);
CurrentFrame = Frame;
SetFrame(Frame);
}
//事件

View File

@ -64,6 +64,7 @@ l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\StaticObjectClass.
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\ActiveObjectClass.nut
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\PassiveObjectClass.nut
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\MonsterObjectClass.nut
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\NpcObjectClass.nut
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\CharacterObjectClass.nut
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\CharacterObjectClass_AI.nut

View File

@ -16,6 +16,8 @@ class _AssetManager_ {
TownList = null;
//装备列表
EquipmentList = null;
//NPC列表
NpcList = null;
function InitMapList() {
MapList = ScriptData.GetFileData("map/map.lst", function(DataTable, Data) {
@ -136,6 +138,20 @@ class _AssetManager_ {
});
}
function InitNpcList() {
NpcList = ScriptData.GetFileData("npc/npc.lst", function(DataTable, Data) {
while (!Data.Eof()) {
local Key = Data.Get();
//注册NPC列表 路径写入 数据未读取
DataTable.rawset(Key, {
Path = Data.Get(),
Data = null
});
}
if (_DEBUG_) print("加载NPCList完成, 共" + DataTable.len() + "个");
});
}
function InitTownList() {
TownList = ScriptData.GetFileData("town/town.lst", function(DataTable, Data) {
while (!Data.Eof()) {
@ -159,6 +175,8 @@ class _AssetManager_ {
InitCharacter();
//初始化装备列表
InitEquipmentList();
//初始化NPC列表
InitNpcList();
getroottable().AssetManager <- this;
@ -250,4 +268,51 @@ class _AssetManager_ {
EquipmentList[Idx].Data = m_data;
return m_data;
}
//Public::
//获取NPC信息
function GetNpc(Idx) {
//如果没有这个NPC则返回
if (!(NpcList.rawin(Idx))) return;
//如果NPC数据已经读取过存在了则直接返回
if (NpcList[Idx].Data) return NpcList[Idx].Data;
local Path = NpcList[Idx].Path;
local m_data = ScriptData.GetFileData("npc/" + Path, function(DataTable, Data) {
DataTable.DirPath <- DataTable.filepath.slice(0, DataTable.filepath.lastfind("/") + 1);
while (!Data.Eof()) {
local Pack = Data.Get();
//各种头像
if (Pack == "[small face]" || Pack == "[big face]" || Pack == "[popup face]") {
local RealKey = Pack.slice(1, Pack.find(" face")) + "_face";
DataTable[RealKey] <- {
img = Data.Get().tolower(),
idx = Data.Get()
}
} else if (Pack == "[field animation]") {
DataTable.field_animation <- DataTable.DirPath + Data.Get().tolower();
} else if (Pack == "[field wav]") {
DataTable.field_wav <- Data.Get();
} else if (Pack == "[popup wav]") {
DataTable.popup_wav <- [Data.Get(), Data.Get()];
} else if (Pack == "[name]") {
DataTable.name <- Data.Get();
} else if (Pack == "[field name]") {
DataTable.field_name <- Data.Get();
}
//功能
else if (Pack == "[role]") {
DataTable.role <- {};
while (true) {
local Ret = Data.Get();
if (Ret == "[/role]") break;
DataTable.role.rawset(Ret.slice(1, -1).tolower(), Data.Get());
}
}
}
});
NpcList[Idx].Data = m_data;
return m_data;
}
}

View File

@ -11,7 +11,7 @@ class _FontAssetManager_ {
function InitFont() {
//普通宋体小字
// Font.PreLoad("新宋体");
Font("宋体", 11.5).Register(0);
Font("宋体", 11.5).Register(0);
}
constructor() {

View File

@ -64,6 +64,7 @@ class GameObject.Character extends GameObject.ActiveObject {
//分配控制器
Controller = Object_Controller(this);
}

View File

@ -0,0 +1,88 @@
/*
文件名:NpcObjectClass.nut
路径:User/Object/ActiveObject/NpcObjectClass.nut
创建日期:2024-12-28 11:11
文件用途:NPC类
*/
class GameObject.NPC extends GameObject.BaseClass {
//ID
Id = 0;
//信息
Info = null;
//Ani动画
Ani = null;
//名字
Name = null;
//识别高度
IdentifyHeight = 0;
//识别宽度
IdentifyWidth = 0;
//是否悬停
IsHover = false;
function _typeof() {
return "npc";
}
//初始化装配
function InitAssembly(IndexKey, SetKey, Func) {
if (Info.rawin(IndexKey)) {
this[SetKey] = Func(Info[IndexKey]);
}
}
constructor(Id) {
this.Id = Id;
base.constructor();
Info = AssetManager.GetNpc(Id);
if (Info) {
//构造Ani
InitAssembly("field_animation", "Ani", function(Data) {
local Ani = Animation(Data);
Addchild(Ani);
local Size = Ani.GetSize();
IdentifyHeight = Size.h;
IdentifyWidth = Size.w;
return Ani;
});
//构造名字
InitAssembly("name", "Name", function(Data) {
//创建名字对象
local NameObj = FontAssetManager.GenerateNormal(Data, true, {
color = sq_RGBA(242, 209, 175, 255),
});
local Height = Ani ? Ani.GetSize().h : 0;
NameObj.SetPosition(0 - (NameObj.GetSize().w / 2), -Height - 25);
NameObj.SetZOrder(80000);
Addchild(NameObj);
return NameObj;
});
}
}
function OnMouseLogic(MouseState, Wheel, MousePos_X, MousePos_Y) {
//悬停事件
if (!IsHover) {
IsHover = true;
//设置Ani描边
Ani.SetOutline(true, sq_RGBA(155, 255, 0, 250));
//设置鼠标
Yosin_Cursor.ChangeActive(120, 4);
}
}
function OutMouseLogic() {
//悬停事件
if (IsHover) {
IsHover = false;
Ani.SetOutline(false);
//设置鼠标
Yosin_Cursor.Change(0);
}
}
}

View File

@ -202,7 +202,7 @@ class Map extends Actor {
local realpath = m_data.dirpath + path.tolower();
local TileObj = Tile(realpath);
TileObj.SetAnchor(0.0, 0.0);
TileObj.SetPosition(pos * 224, -120 - m_data.background_pos);
TileObj.SetPosition(pos * 224, -200 - m_data.background_pos);
LayerObject.bottom.Addchild(TileObj);
}
//默认地板 + 摄像机偏移 + 默认需要有一个40的添加地板
@ -220,7 +220,7 @@ class Map extends Actor {
local TileObj = Tile(realpath);
TileObj.SetAnchor(0.0, 0.0);
//根据基础地板的数量判断是第几排
TileObj.SetPosition((pos % NormalTileCount) * 224, 560 - 120 - m_data.background_pos + ((pos / NormalTileCount) * 40));
TileObj.SetPosition((pos % NormalTileCount) * 224, 560 - 200 - m_data.background_pos + ((pos / NormalTileCount) * 40));
LayerObject.bottom.Addchild(TileObj);
}
}
@ -266,6 +266,21 @@ class Map extends Actor {
}
//初始化NPC
function InitNPC() {
if (!m_data.rawin("npc")) return;
local Arr = [];
foreach(pos, info in m_data.npc) {
local NPCobj = GameObject.NPC(info.id);
NPCobj.SetDirection(info.direction);
NPCobj.SetPosition(info.xpos, info.ypos, info.zpos);
Arr.push(NPCobj);
AddObject(NPCobj);
}
//构造完成直接赋值对象
m_data.npc = Arr;
}
//添加对象
function AddObject(obj, IsPlayer = false) {
@ -287,6 +302,8 @@ class Map extends Actor {
BackGroundMusic[SoundName] <- BgMusic;
}
}
} else if (typeof obj == "npc") {
LayerObject.normal.Addchild(obj);
}
}
@ -373,6 +390,10 @@ class Map extends Actor {
InitBackgroundAnimation();
//初始化场景Ani
InitAnimation();
//初始化NPC
InitNPC();
//注册鼠标判定逻辑
Reg_Yosin_Mouse_Logic("MapMLg_" + C_Object, OnMouseLogic.bindenv(this));
//设置摄像机的最大可行区域
m_camera.MovableAreaX = m_length;
@ -398,6 +419,36 @@ class Map extends Actor {
}
}
function OnMouseLogic(MouseState, Wheel, MousePos_X, MousePos_Y) {
//判断是人物所在的地图
if (ClientCharacter && this.C_Object == ClientCharacter.MySelfMap.C_Object) {
local Arr = [];
//遍历全部NPC位置
foreach(index, Npcobj in m_data.npc) {
//获取NPC的屏幕位置
local NPCpos = Npcobj.GetWorldPosition();
//在屏幕中的才添加比对 这里只判断了X轴
if (NPCpos.x > -20 && NPCpos.y< 1086) {
Arr.push(NPCpos.x - Npcobj.IdentifyWidth / 2);
Arr.push(NPCpos.y - Npcobj.IdentifyHeight);
Arr.push(Npcobj.IdentifyWidth);
Arr.push(Npcobj.IdentifyHeight);
}
}
local Index = Math.PointIsInWhichRectangle(MousePos_X, MousePos_Y, Arr);
//有事件发生的NPC对象
if (Index != -1) {
return m_data.npc[Index].OnMouseLogic(MouseState, Wheel, MousePos_X, MousePos_Y);
} else {
foreach(Npcobj in m_data.npc) {
Npcobj.OutMouseLogic();
}
return null;
}
}
return null;
}
//判断区域是否可行
function CheckMovableArea(gx, gxoffset, gy, gyoffset) {
local pos = {

View File

@ -10,6 +10,7 @@ class Tile extends CL_SpriteObject {
function InitData(path) {
m_data = ScriptData.GetFileData(path, function(DataTable, Data) {
DataTable.pos <- 0;
while (!Data.Eof()) {
local Pack = Data.Get();
if (Pack == "[IMAGE]") {
@ -42,4 +43,19 @@ class Tile extends CL_SpriteObject {
}
}
}
//设置坐标
function SetPosition(Value, ...) {
if (vargv.len() == 0) {
Value.y += m_data.pos;
X = Value.x;
Y = Value.y;
BaseObject_SetPosition(this.C_Object, Value);
} else if (vargv.len() == 1) {
vargv[0] += m_data.pos;
X = Value;
Y = vargv[0];
BaseObject_SetPosition(this.C_Object, Value, vargv[0]);
}
}
}

View File

@ -10,8 +10,8 @@ function InitGame() {
// MySocket("127.0.0.1", 19666);
//设定全局默认音量
_Globa_Audio_Volume_ = 0.1;
_Globa_Sound_Volume_ = 0.3;
_Globa_Audio_Volume_ = 0.03;
_Globa_Sound_Volume_ = 0.03;
Script();

View File

@ -10,71 +10,58 @@ function TestStage() {
T.Enter();
// local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
// //大背景
// local BackGround = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbackground.img", 14);
// local BackGround = CL_SpriteObject("sprite/map/npc/2019_halloween_blossom_normal.img", 0);
// BackGround.SetPosition(300, 150);
// BackGround.SetOutline(true);
// T.Addchild(BackGround);
// //登录按钮文本
// local TextActor = TextActor(0, {
// color = sq_RGBA(186, 147, 97, 255)
// });
// TextActor.SetText("测试文字");
// TextActor.SetPosition(200, 200);
// TextActor.SetZOrder(1000000);
// TextActor.SetOutline();
// T.Addchild(TextActor);
// local Fontobj = Font();
// local NPCobj = GameObject.NPC(2);
// NPCobj.SetPosition(400, 400, 0);
// T.Addchild(NPCobj);
// local TownObj = Town(1);
// // local MapObj = Map("map/cataclysm/town/seria_room/elvengard.map");
// // // local MapObj = Map("map/cataclysm/town/hendonmyre/new_backstreet_2.map");
// // // local MapObj = Map("map/cataclysm/town/seria_room/elvengard.map");
// // // local MapObj = Map("map/cataclysm/town/sainthorn_heaven/sainthorn_heaven_ship_rear_down.map");
// // T.Addchild(MapObj);
// local Charc = GameObject.CreateCharacter(0, [101590007, 27675, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]);
// // Charc.SetPosition(356, 250, 0);
// // Charc.SetAnimation("RestAni");
// TownObj.AddObject(Charc, true);
// ClientCharacter = Charc;
local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0);
local T = {
loginImg = 1,
charac = [{
lv = 90,
name = "倾泪寒倾泪寒倾泪寒倾泪寒倾泪寒倾泪寒倾泪寒倾泪寒倾泪寒倾泪寒倾泪寒",
job = 0,
equip = [101020001, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023, 609590003]
}, {
lv = 90,
name = "倾泪寒222",
job = 0,
equip = [101020023, 601500059, 601550059, 601560057, 601570052, 601520051, 601500059, 601510058, 601530050, 601540059, 601580022, 609590003]
}, {
lv = 90,
name = "Kina",
job = 0,
equip = [101020026, 601500058, 601550058, 601560056, 601570051, 601520050, 601500058, 601510057, 601530049, 601540058, 601580021, 609590003]
}, {
lv = 90,
name = "测试角色",
job = 0,
equip = [101020037, 601500061, 601550061, 601560059, 601570054, 601520053, 601500061, 601510060, 601530052, 601540061, 601580024, 609590003]
}, {
lv = 90,
name = "测试角色2号",
job = 0,
equip = [601020007, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023, 609590003]
}]
};
Window.Init(T);
// local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0);
// local T = {
// loginImg = 1,
// charac = [{
// lv = 90,
// name = "倾泪寒",
// job = 0,
// equip = [101020001, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023, 609590003]
// }, {
// lv = 90,
// name = "倾泪寒222",
// job = 0,
// equip = [101020023, 601500059, 601550059, 601560057, 601570052, 601520051, 601500059, 601510058, 601530050, 601540059, 601580022, 609590003]
// }, {
// lv = 90,
// name = "Kina",
// job = 0,
// equip = [101020026, 601500058, 601550058, 601560056, 601570051, 601520050, 601500058, 601510057, 601530049, 601540058, 601580021, 609590003]
// }, {
// lv = 90,
// name = "测试角色",
// job = 0,
// equip = [101020037, 601500061, 601550061, 601560059, 601570054, 601520053, 601500061, 601510060, 601530052, 601540061, 601580024, 609590003]
// }, {
// lv = 90,
// name = "测试角色2号",
// job = 0,
// equip = [601020007, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023, 609590003]
// }]
// };
// Window.Init(T);
// local Actorobj = Actor();
// Actorobj.ShowBorder(true);
@ -93,4 +80,5 @@ function TestStage() {
// print(ObjectCount);
// Sq_CreateWindow(_CreateCharacter, "创建角色界面窗口", 0, 0, 1066, 600, 0);
}

View File

@ -7,9 +7,16 @@
class _IMouse_ extends _Yosin_Cursor {
NormalC = null;
//普通状态0
//普通状态0 //动态状态1
State = 0;
//当前帧数编号
Idx = 0;
//动态帧 当前帧数
ActiveCurrentFrame = 0;
//动态帧 总帧数
ActiveFrameCount = 0;
//动态帧 Timer
ActiveFrameTimer = 0;
constructor() {
NormalC = [];
@ -26,12 +33,15 @@ class _IMouse_ extends _Yosin_Cursor {
//更换为0号指针
Change(0);
//注册Proc
_Game_Logic_Func_._IMouse_Proc <- Proc.bindenv(this);
}
//初始化普通鼠标指针
function InitSprite() {
for (local i = 0; i< 254; i++) {
local Sp = CL_SpriteObject("sprite/interface/newstyle/windows/cursor.img", i);
local Sp = CL_SpriteFrameObject("sprite/interface/newstyle/windows/cursor.img", i);
NormalC.push(Sp);
}
}
@ -43,6 +53,14 @@ class _IMouse_ extends _Yosin_Cursor {
base.Change(Sp);
}
//更换动态鼠标指针
function ChangeActive(Idx, Count) {
State = 1;
this.Idx = Idx;
this.ActiveFrameCount = Count;
this.ActiveCurrentFrame = 0;
}
function OnMouseProc(MousePos_X, MousePos_Y) {
}
@ -62,4 +80,18 @@ class _IMouse_ extends _Yosin_Cursor {
Change(0);
}
}
function Proc(Dt, Listener) {
if (State == 1) {
ActiveFrameTimer += Dt;
if (ActiveFrameTimer >= 160) {
ActiveFrameTimer = 0;
ActiveCurrentFrame += 1;
if (ActiveCurrentFrame >= ActiveFrameCount) ActiveCurrentFrame = 0;
local Sp = NormalC[Idx + ActiveCurrentFrame];
base.Change(Sp);
}
}
}
}

View File

@ -486,7 +486,10 @@ class _Select_Character_Window extends Yosin_Window {
BackGroundMusic.Pause();
}
SetVisible(false);
//TODO 发送进入游戏请求
//发送进入游戏请求
MySocket.Send(PACKET_ID.SELECT_CHARACTER, {
cid = UpCharacterList[CurrentSelectCharacterIdx].Info.cid
})
}.bindenv(this);
AddUIChild(StartButton);
}
@ -522,8 +525,6 @@ class _Select_Character_Window extends Yosin_Window {
LockBox.SetPosition(54 + (i * 142), 10);
CharacterMaskBox.Addchild(LockBox);
}
}

View File

@ -254,6 +254,7 @@ class _CreateCharacter extends Yosin_Window {
//关闭创建界面
NoticeBox.DestroyWindow();
DestroyWindow();
MySocket.Send(PACKET_ID.QUERY_CHARACTER_LIST, null);
} else {
// 创建失败.
NoticeBox = _Yosin_MessageBox("创建失败.");
@ -363,7 +364,7 @@ class _CreateCharacter extends Yosin_Window {
local jobEnum = getJobEnum(jobIndex);
MySocket.Send(7, {
name = enterName,
gkb = jobEnum,
job = jobEnum,
})
}.bindenv(this);

View File

@ -13,7 +13,9 @@ enum PACKET_ID {
CHANGE_PASSWORD = 5
//查询账号中的角色列表
QUERY_CHARACTER_LIST = 9
//选择角色
SELECT_CHARACTER = 11
//更换角色位置
CHANGE_CHARACTER_POSITION = 13
CHANGE_CHARACTER_POSITION = 10
}

View File

@ -238,5 +238,8 @@
},
"User/UI/Window/3_Top_tool.nut": {
"description": "顶部工具条"
},
"User/Object/ActiveObject/NpcObjectClass.nut": {
"description": "NPC对象"
}
}