Merge remote-tracking branch 'origin/dong' into yi
This commit is contained in:
commit
ba47018537
Binary file not shown.
BIN
Yosin_Engine.exe
BIN
Yosin_Engine.exe
Binary file not shown.
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
// 使用 IntelliSense 了解相关属性。
|
||||||
|
// 悬停以查看现有属性的描述。
|
||||||
|
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "squirrel",
|
||||||
|
"request": "attach",
|
||||||
|
"name": "Server",
|
||||||
|
"port": 2222
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "squirrel",
|
||||||
|
"request": "attach",
|
||||||
|
"name": "Client",
|
||||||
|
"port": 2222
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
sqr/Core/ENUM/ENUM_KEY.nut
|
||||||
|
sqr/Core/ENUM/enum_system.nut
|
||||||
|
sqr/Core/BaseTool/BaseTool.nut
|
||||||
|
sqr/Core/BaseTool/Math.nut
|
||||||
|
sqr/Core/BaseTool/String.nut
|
||||||
|
sqr/Core/BaseTool/BlobExClass.nut
|
||||||
|
sqr/Core/BaseTool/JsonClass/JsonClass.nut
|
||||||
|
sqr/Core/BaseTool/JsonClass/Json.nut
|
||||||
|
sqr/Core/BaseClass/ScriptManager/ScriptManager.nut
|
||||||
|
sqr/Core/BaseClass/ScriptManager/InitAni.nut
|
||||||
|
sqr/Core/BaseClass/Game_Window_Class.nut
|
||||||
|
sqr/Core/BaseClass/BaseObject.nut
|
||||||
|
sqr/Core/BaseClass/AudioClass.nut
|
||||||
|
sqr/Core/BaseClass/StageClass.nut
|
||||||
|
sqr/Core/BaseClass/ActorObject.nut
|
||||||
|
sqr/Core/BaseClass/LayerObject.nut
|
||||||
|
sqr/Core/BaseClass/UserStorage.nut
|
||||||
|
sqr/Core/BaseClass/SpriteObject/SpriteFrameClass.nut
|
||||||
|
sqr/Core/BaseClass/SpriteObject/SpriteClass.nut
|
||||||
|
sqr/Core/BaseClass/TextObject/Font.nut
|
||||||
|
sqr/Core/BaseClass/TextObject/TextActor.nut
|
||||||
|
sqr/Core/BaseClass/AnimationClass/AnimationClass.nut
|
||||||
|
|
||||||
|
sqr/Core/ExtraCalss/Socket/Socket.nut
|
||||||
|
|
||||||
|
sqr/Core/Game_Proc/Game_Proc.nut
|
||||||
|
|
||||||
|
sqr/Core/UI_Class/UI_Cursor.nut
|
||||||
|
sqr/Core/UI_Class/UI_Core.nut
|
||||||
|
sqr/Core/UI_Class/UI_Widget.nut
|
||||||
|
|
||||||
|
|
||||||
|
sqr/User/_ENUM/global_object.nut
|
||||||
|
sqr/User/_ENUM/enum_music.nut
|
||||||
|
sqr/User/_ENUM/enum_packet.nut
|
||||||
|
sqr/User/_ENUM/enum_game.nut
|
||||||
|
|
||||||
|
sqr/User/Socket/Socket.nut
|
||||||
|
|
||||||
|
sqr/User/Asset/AssetManager.nut
|
||||||
|
sqr/User/Asset/FontAsset.nut
|
||||||
|
sqr/User/Asset/Character/Animation.nut
|
||||||
|
|
||||||
|
sqr/User/Asset/Item/Item.nut
|
||||||
|
sqr/User/Asset/Item/Equipment.nut
|
||||||
|
|
||||||
|
sqr/User/Object/StateMachine/StateMachineClass.nut
|
||||||
|
|
||||||
|
sqr/User/Object/Object/BaseObject.nut
|
||||||
|
sqr/User/Object/Object/AnimationObject.nut
|
||||||
|
sqr/User/Object/Map/TileObject.nut
|
||||||
|
sqr/User/Object/Map/MapObject.nut
|
||||||
|
|
||||||
|
sqr/User/Object/ActiveObject/GameObjectClass.nut
|
||||||
|
sqr/User/Object/ActiveObject/StaticObjectClass.nut
|
||||||
|
sqr/User/Object/ActiveObject/ActiveObjectClass.nut
|
||||||
|
sqr/User/Object/ActiveObject/PassiveObjectClass.nut
|
||||||
|
sqr/User/Object/ActiveObject/MonsterObjectClass.nut
|
||||||
|
sqr/User/Object/ActiveObject/CharacterObjectClass.nut
|
||||||
|
sqr/User/Object/ActiveObject/CharacterObjectClass_AI.nut
|
||||||
|
|
||||||
|
sqr/User/Socket/Socket.nut
|
||||||
|
|
||||||
|
sqr/User/Stage/LodingStage.nut
|
||||||
|
sqr/User/Stage/TestStage.nut
|
||||||
|
|
||||||
|
sqr/User/UI/Widget/IMouse.nut
|
||||||
|
sqr/User/UI/Widget/InputBox.nut
|
||||||
|
sqr/User/UI/Widget/Drag_Button.nut
|
||||||
|
sqr/User/UI/Widget/Scroll_Bar.nut
|
||||||
|
sqr/User/UI/Widget/Text_Button.nut
|
||||||
|
|
||||||
|
sqr/User/UI/Window/0_Login.nut
|
||||||
|
sqr/User/UI/Window/1_Select_Character.nut
|
||||||
|
sqr/User/UI/Window/2_create_Character.nut
|
||||||
|
sqr/User/UI/Window/233_HUD_Message.nut
|
||||||
|
|
||||||
|
|
||||||
|
sqr/User/main.nut
|
||||||
|
|
@ -37,6 +37,10 @@ class Animation extends Actor {
|
||||||
//附加选项
|
//附加选项
|
||||||
AdditionalOptions = null;
|
AdditionalOptions = null;
|
||||||
|
|
||||||
|
function _typeof() {
|
||||||
|
return "animation";
|
||||||
|
}
|
||||||
|
|
||||||
constructor(...) {
|
constructor(...) {
|
||||||
base.constructor();
|
base.constructor();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
文件用途:音频类
|
文件用途:音频类
|
||||||
*/
|
*/
|
||||||
if (!(getroottable().rawin("_Globa_Audio_Volume_"))) _Globa_Audio_Volume_ <- 1.0;
|
if (!(getroottable().rawin("_Globa_Audio_Volume_"))) _Globa_Audio_Volume_ <- 1.0;
|
||||||
if (!(getroottable().rawin("_SoundEffect_List_"))) _SoundEffect_List_ <- [];
|
if (!(getroottable().rawin("_Globa_Sound_Volume_"))) _Globa_Sound_Volume_ <- 1.0;
|
||||||
class Sound extends CL_BaseObject {
|
class Audio extends CL_BaseObject {
|
||||||
//名称
|
//名称
|
||||||
Name = null;
|
Name = null;
|
||||||
//路径
|
//路径
|
||||||
|
|
@ -57,24 +57,6 @@ class Sound extends CL_BaseObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SoundEffect extends Sound {
|
|
||||||
|
|
||||||
constructor(Name) {
|
|
||||||
base.constructor(Name);
|
|
||||||
|
|
||||||
//加入全局临时音效组
|
|
||||||
JoinSoundEffect();
|
|
||||||
//默认调用播放
|
|
||||||
Play();
|
|
||||||
}
|
|
||||||
|
|
||||||
//加入全局临时音效组
|
|
||||||
function JoinSoundEffect() {
|
|
||||||
_SoundEffect_List_.append(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class AudioControlClass {
|
class AudioControlClass {
|
||||||
|
|
||||||
//当前播放音乐集合
|
//当前播放音乐集合
|
||||||
|
|
@ -82,10 +64,6 @@ class AudioControlClass {
|
||||||
//音源库
|
//音源库
|
||||||
MusicList = null;
|
MusicList = null;
|
||||||
|
|
||||||
//销毁临时音效的时间Flag
|
|
||||||
CloseSoundEffectTimeFlag = 0;
|
|
||||||
//销毁临时音效的间隔时间 //5秒一次
|
|
||||||
CloseSoundEffectTime = 5000;
|
|
||||||
//销毁音乐的时间Flag
|
//销毁音乐的时间Flag
|
||||||
CloseMusicTimeFlag = 0;
|
CloseMusicTimeFlag = 0;
|
||||||
//销毁音乐的间隔时间 //5秒一次
|
//销毁音乐的间隔时间 //5秒一次
|
||||||
|
|
@ -164,25 +142,10 @@ class AudioControlClass {
|
||||||
//移除音乐(淡出)
|
//移除音乐(淡出)
|
||||||
RemoveMusic(dt);
|
RemoveMusic(dt);
|
||||||
|
|
||||||
//销毁临时音效
|
|
||||||
CloseSoundEffect(dt);
|
|
||||||
//销毁音乐
|
//销毁音乐
|
||||||
CloseMusic(dt);
|
CloseMusic(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
function CloseSoundEffect(dt) {
|
|
||||||
CloseSoundEffectTimeFlag += dt;
|
|
||||||
if (CloseSoundEffectTimeFlag >= CloseSoundEffectTime) {
|
|
||||||
for (local i = 0; i< _SoundEffect_List_.len(); i++) {
|
|
||||||
local SoundEffectObj = _SoundEffect_List_[i];
|
|
||||||
//播放完成销毁资源
|
|
||||||
if (!SoundEffectObj.IsPlaying()) {
|
|
||||||
_SoundEffect_List_.remove(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CloseSoundEffectTimeFlag = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function CloseMusic(dt) {
|
function CloseMusic(dt) {
|
||||||
CloseMusicTimeFlag += dt;
|
CloseMusicTimeFlag += dt;
|
||||||
|
|
@ -212,7 +175,7 @@ if (!(getroottable().rawin("AudioControl"))) _Global_AudioControl_ <- AudioContr
|
||||||
|
|
||||||
//播放临时音效
|
//播放临时音效
|
||||||
function Sq_PlaySoundEffect(Name) {
|
function Sq_PlaySoundEffect(Name) {
|
||||||
return SoundEffect(Name);
|
return Sound_PlayEffect(Name.tolower(), _Globa_Sound_Volume_);
|
||||||
}
|
}
|
||||||
|
|
||||||
//全局音效逻辑
|
//全局音效逻辑
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
*/
|
*/
|
||||||
class CL_BaseObject {
|
class CL_BaseObject {
|
||||||
|
|
||||||
|
X = 0;
|
||||||
|
Y = 0;
|
||||||
//父对象
|
//父对象
|
||||||
Parent = null;
|
Parent = null;
|
||||||
//子对象数组
|
//子对象数组
|
||||||
|
|
@ -187,10 +189,15 @@ class CL_BaseObject {
|
||||||
}
|
}
|
||||||
//设置坐标
|
//设置坐标
|
||||||
function SetPosition(Value, ...) {
|
function SetPosition(Value, ...) {
|
||||||
if (vargv.len() == 0)
|
if (vargv.len() == 0) {
|
||||||
|
X = Value.x;
|
||||||
|
Y = Value.y;
|
||||||
BaseObject_SetPosition(this.C_Object, Value);
|
BaseObject_SetPosition(this.C_Object, Value);
|
||||||
else if (vargv.len() == 1)
|
} else if (vargv.len() == 1) {
|
||||||
|
X = Value;
|
||||||
|
Y = vargv[0];
|
||||||
BaseObject_SetPosition(this.C_Object, Value, vargv[0]);
|
BaseObject_SetPosition(this.C_Object, Value, vargv[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//移动坐标
|
//移动坐标
|
||||||
function MoveTo(Value, ...) {
|
function MoveTo(Value, ...) {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@ class CL_SpriteObject extends CL_BaseObject {
|
||||||
|
|
||||||
SpriteFrame = null;
|
SpriteFrame = null;
|
||||||
|
|
||||||
|
function _typeof() {
|
||||||
|
return "sprite";
|
||||||
|
}
|
||||||
|
|
||||||
constructor(...) {
|
constructor(...) {
|
||||||
local C_Object;
|
local C_Object;
|
||||||
//创建空精灵
|
//创建空精灵
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,44 @@
|
||||||
*/
|
*/
|
||||||
class TextActor extends CL_BaseObject {
|
class TextActor extends CL_BaseObject {
|
||||||
|
|
||||||
|
//不需要Update函数
|
||||||
|
NoUpdate = true;
|
||||||
|
|
||||||
|
OutlineChild = null;
|
||||||
|
Strokeoffsets = [{
|
||||||
|
x = 1,
|
||||||
|
y = 0
|
||||||
|
}, // 右
|
||||||
|
{
|
||||||
|
x = 1,
|
||||||
|
y = 1
|
||||||
|
}, // 右上
|
||||||
|
{
|
||||||
|
x = 0,
|
||||||
|
y = 1
|
||||||
|
}, // 上
|
||||||
|
{
|
||||||
|
x = -1,
|
||||||
|
y = 1
|
||||||
|
}, // 左上
|
||||||
|
{
|
||||||
|
x = -1,
|
||||||
|
y = 0
|
||||||
|
}, // 左
|
||||||
|
{
|
||||||
|
x = -1,
|
||||||
|
y = -1
|
||||||
|
}, // 左下
|
||||||
|
{
|
||||||
|
x = 0,
|
||||||
|
y = -1
|
||||||
|
}, // 下
|
||||||
|
{
|
||||||
|
x = 1,
|
||||||
|
y = -1
|
||||||
|
} // 右下
|
||||||
|
];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @函数作用: 构造文本精灵
|
* @函数作用: 构造文本精灵
|
||||||
* @参数 font 可传入全局font Id 或 传入 font对象
|
* @参数 font 可传入全局font Id 或 传入 font对象
|
||||||
|
|
@ -37,6 +75,11 @@ class TextActor extends CL_BaseObject {
|
||||||
//设置文本内容
|
//设置文本内容
|
||||||
function SetText(str) {
|
function SetText(str) {
|
||||||
TextActor_SetText(this.C_Object, str);
|
TextActor_SetText(this.C_Object, str);
|
||||||
|
if (OutlineChild) {
|
||||||
|
foreach(obj in OutlineChild) {
|
||||||
|
obj.SetText(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置描边
|
//设置描边
|
||||||
|
|
@ -44,6 +87,19 @@ class TextActor extends CL_BaseObject {
|
||||||
TextActor_SetOutLine(this.C_Object, width, color, cap, line_join, dash);
|
TextActor_SetOutLine(this.C_Object, width, color, cap, line_join, dash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// //设置描边
|
||||||
|
// function SetOutline(style) {
|
||||||
|
// OutlineChild = [];
|
||||||
|
// for (local i = 0; i< 8; i++) {
|
||||||
|
// style.color = 0xff000000;
|
||||||
|
// local buf = FontAssetManager.GenerateNormal("", false, style);
|
||||||
|
// buf.SetPosition(Strokeoffsets[i]);
|
||||||
|
// buf.SetZOrder(-1);
|
||||||
|
// OutlineChild.push(buf);
|
||||||
|
// Addchild(buf);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
//设置填充颜色
|
//设置填充颜色
|
||||||
function SetFillColor(Color) {
|
function SetFillColor(Color) {
|
||||||
TextActor_SetFillColor(this.C_Object, Color);
|
TextActor_SetFillColor(this.C_Object, Color);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
*/
|
*/
|
||||||
_DEBUG_ <- true;
|
_DEBUG_ <- true;
|
||||||
|
|
||||||
|
|
||||||
enum MouseButton {
|
enum MouseButton {
|
||||||
Left ///< 鼠标左键
|
Left ///< 鼠标左键
|
||||||
Right ///< 鼠标右键
|
Right ///< 鼠标右键
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
创建日期:2024-11-08 03:25
|
创建日期:2024-11-08 03:25
|
||||||
文件用途:UI核心类
|
文件用途:UI核心类
|
||||||
*/
|
*/
|
||||||
|
//UI层Actor
|
||||||
|
_UiObject_ <- null;
|
||||||
//窗口队列
|
//窗口队列
|
||||||
_SYS_WINDOW_LIST_ <- [];
|
_SYS_WINDOW_LIST_ <- [];
|
||||||
//基础窗口类 所有UI类继承与本类
|
//基础窗口类 所有UI类继承与本类
|
||||||
|
|
@ -25,6 +27,13 @@ class Yosin_BaseWindow extends Layer {
|
||||||
Y = null;
|
Y = null;
|
||||||
B_Y = null;
|
B_Y = null;
|
||||||
|
|
||||||
|
//宽度
|
||||||
|
Width = null;
|
||||||
|
//高度
|
||||||
|
Height = null;
|
||||||
|
//调试模式显示精灵
|
||||||
|
DeBugSprite = null;
|
||||||
|
|
||||||
function _typeof() {
|
function _typeof() {
|
||||||
return "Yosin_BaseWindow";
|
return "Yosin_BaseWindow";
|
||||||
}
|
}
|
||||||
|
|
@ -159,6 +168,15 @@ class Yosin_BaseWindow extends Layer {
|
||||||
Removechild(gChild);
|
Removechild(gChild);
|
||||||
// gChild.Parent = this;
|
// gChild.Parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//开启Debug模式
|
||||||
|
function OpenDeBug() {
|
||||||
|
DeBugSprite = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 257);
|
||||||
|
DeBugSprite.SetSize(Width, Height);
|
||||||
|
DeBugSprite.SetZOrder(300000);
|
||||||
|
DeBugSprite.SetOpacity(0.35);
|
||||||
|
Addchild(DeBugSprite);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -166,15 +184,9 @@ class Yosin_BaseWindow extends Layer {
|
||||||
class Yosin_Window extends Yosin_BaseWindow {
|
class Yosin_Window extends Yosin_BaseWindow {
|
||||||
//窗口名称
|
//窗口名称
|
||||||
ObjectId = null;
|
ObjectId = null;
|
||||||
//宽度
|
|
||||||
Width = null;
|
|
||||||
//高度
|
|
||||||
Height = null;
|
|
||||||
//标题高度
|
//标题高度
|
||||||
TitleH = null;
|
TitleH = null;
|
||||||
|
|
||||||
//调试模式
|
|
||||||
DeBugMode = false;
|
|
||||||
//鼠标相对位置
|
//鼠标相对位置
|
||||||
M_Xpos = null;
|
M_Xpos = null;
|
||||||
M_Ypos = null;
|
M_Ypos = null;
|
||||||
|
|
@ -272,11 +284,6 @@ class Yosin_Window extends Yosin_BaseWindow {
|
||||||
this.DestroyFlag = true;
|
this.DestroyFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//开启Debug模式
|
|
||||||
function OpenDeBug() {
|
|
||||||
ShowBorder(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//override
|
//override
|
||||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||||
if (!Visible) return;
|
if (!Visible) return;
|
||||||
|
|
@ -363,21 +370,21 @@ function Sq_CreateWindow(ClassName, gObjectId, gX, gY, gWidth, gHeight, gTitleH)
|
||||||
|
|
||||||
//窗口逻辑入口 C回调
|
//窗口逻辑入口 C回调
|
||||||
function _Yosin_Windows_Logic_(Dt, Ui_Layer) {
|
function _Yosin_Windows_Logic_(Dt, Ui_Layer) {
|
||||||
local UiObject = Actor(Ui_Layer);
|
_UiObject_ = Actor(Ui_Layer);
|
||||||
//遍历窗口队列 如果可见则调用Show
|
//遍历窗口队列 如果可见则调用Show
|
||||||
for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||||
local Window = _SYS_WINDOW_LIST_[i];
|
local Window = _SYS_WINDOW_LIST_[i];
|
||||||
//根据是否显示 决定是否添加到舞台
|
//根据是否显示 决定是否添加到舞台
|
||||||
if (!Window.Visible && Window.ParentFlag) {
|
if (!Window.Visible && Window.ParentFlag) {
|
||||||
Window.ParentFlag = null;
|
Window.ParentFlag = null;
|
||||||
UiObject.Removechild(Window);
|
_UiObject_.Removechild(Window);
|
||||||
if (Window.DestroyFlag) {
|
if (Window.DestroyFlag) {
|
||||||
_SYS_WINDOW_LIST_.remove(i);
|
_SYS_WINDOW_LIST_.remove(i);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
} else if (Window.Visible && (!Window.ParentFlag)) {
|
} else if (Window.Visible && (!Window.ParentFlag)) {
|
||||||
Window.ParentFlag = true;
|
Window.ParentFlag = true;
|
||||||
UiObject.Addchild(Window);
|
_UiObject_.Addchild(Window);
|
||||||
}
|
}
|
||||||
//无论窗口是否显示都需要调用Proc
|
//无论窗口是否显示都需要调用Proc
|
||||||
Window.Proc(Dt);
|
Window.Proc(Dt);
|
||||||
|
|
@ -388,8 +395,11 @@ function _Yosin_Windows_Logic_(Dt, Ui_Layer) {
|
||||||
|
|
||||||
//鼠标点击Flag
|
//鼠标点击Flag
|
||||||
_Mouse_Click_Flag <- {};
|
_Mouse_Click_Flag <- {};
|
||||||
|
_Yosin_Cursor();
|
||||||
//鼠标逻辑入口
|
//鼠标逻辑入口
|
||||||
function _Yosin_Windows_Mouse_Logic_(MouseState, Wheel, MousePos_X, MousePos_Y) {
|
function _Yosin_Windows_Mouse_Logic_(MouseState, Wheel, MousePos_X, MousePos_Y) {
|
||||||
|
|
||||||
|
Yosin_Cursor.Event(MouseState, Wheel, MousePos_X, MousePos_Y);
|
||||||
//克隆一遍窗口列表
|
//克隆一遍窗口列表
|
||||||
local WindowListF = clone(_SYS_WINDOW_LIST_);
|
local WindowListF = clone(_SYS_WINDOW_LIST_);
|
||||||
WindowListF.reverse();
|
WindowListF.reverse();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
/*
|
||||||
|
文件名:UI_Cursor.nut
|
||||||
|
路径:Core/UI_Class/UI_Cursor.nut
|
||||||
|
创建日期:2024-12-18 13:41
|
||||||
|
文件用途:
|
||||||
|
*/
|
||||||
|
class _Yosin_Cursor extends Actor {
|
||||||
|
|
||||||
|
Object = null;
|
||||||
|
|
||||||
|
_Mouse_Click_Flag = null;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
base.constructor();
|
||||||
|
_Mouse_Click_Flag = {};
|
||||||
|
|
||||||
|
getroottable().Yosin_Cursor <- this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化
|
||||||
|
function Init() {
|
||||||
|
//鼠标层级高于一切
|
||||||
|
SetZOrder(20000000);
|
||||||
|
_UiObject_.Addchild(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//更换鼠标指针
|
||||||
|
function Change(Frame) {
|
||||||
|
if (Object) {
|
||||||
|
Removechild(Object);
|
||||||
|
}
|
||||||
|
Object = Frame;
|
||||||
|
Addchild(Frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
//事件
|
||||||
|
function Event(MouseState, Wheel, MousePos_X, MousePos_Y) {
|
||||||
|
switch (MouseState) {
|
||||||
|
//常规或者拖动事件
|
||||||
|
case 0x305: {
|
||||||
|
SetPosition(MousePos_X, MousePos_Y);
|
||||||
|
OnMouseProc(MousePos_X, MousePos_Y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//左键按下
|
||||||
|
case 0x101: {
|
||||||
|
_Mouse_Click_Flag.LbFlag <- true;
|
||||||
|
OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//左键松开
|
||||||
|
case 0x001: {
|
||||||
|
//左键单击
|
||||||
|
if (_Mouse_Click_Flag.LbFlag == true) {
|
||||||
|
_Mouse_Click_Flag.LbFlag <- false;
|
||||||
|
OnMouseLbClick(MousePos_X, MousePos_Y);
|
||||||
|
}
|
||||||
|
OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//右键按下
|
||||||
|
case 0x102: {
|
||||||
|
_Mouse_Click_Flag.RbFlag <- true;
|
||||||
|
OnMouseRbDown(MousePos_X, MousePos_Y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//右键松开
|
||||||
|
case 0x002: {
|
||||||
|
//右键单击
|
||||||
|
if (_Mouse_Click_Flag.RbFlag == true) {
|
||||||
|
_Mouse_Click_Flag.RbFlag <- false;
|
||||||
|
OnMouseRbClick(MousePos_X, MousePos_Y);
|
||||||
|
}
|
||||||
|
OnMouseRbUp(MousePos_X, MousePos_Y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//中键按下
|
||||||
|
case 0x103: {
|
||||||
|
_Mouse_Click_Flag.MbFlag <- true;
|
||||||
|
OnMouseMbDown(MousePos_X, MousePos_Y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//中键松开
|
||||||
|
case 0x003: {
|
||||||
|
//中键单击
|
||||||
|
if (_Mouse_Click_Flag.MbFlag == true) {
|
||||||
|
_Mouse_Click_Flag.MbFlag <- false;
|
||||||
|
OnMouseMbClick(MousePos_X, MousePos_Y);
|
||||||
|
}
|
||||||
|
OnMouseMbUp(MousePos_X, MousePos_Y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//滚轮事件
|
||||||
|
case 0x406: {
|
||||||
|
OnMouseWheel(Wheel, MousePos_X, MousePos_Y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//鼠标事件回调
|
||||||
|
function OnMouseProc(MousePos_X, MousePos_Y) {}
|
||||||
|
//鼠标左键按下回调
|
||||||
|
function OnMouseLbDown(MousePos_X, MousePos_Y) {}
|
||||||
|
//鼠标左键单击回调
|
||||||
|
function OnMouseLbClick(MousePos_X, MousePos_Y) {}
|
||||||
|
//鼠标左键弹起回调
|
||||||
|
function OnMouseLbUp(MousePos_X, MousePos_Y) {}
|
||||||
|
//鼠标右键按下回调
|
||||||
|
function OnMouseRbDown(MousePos_X, MousePos_Y) {}
|
||||||
|
//鼠标右键单击回调
|
||||||
|
function OnMouseRbClick(MousePos_X, MousePos_Y) {}
|
||||||
|
//鼠标右键弹起回调
|
||||||
|
function OnMouseRbUp(MousePos_X, MousePos_Y) {}
|
||||||
|
//鼠标中键按下回调
|
||||||
|
function OnMouseMbDown(MousePos_X, MousePos_Y) {}
|
||||||
|
//鼠标中键单击回调
|
||||||
|
function OnMouseMbClick(MousePos_X, MousePos_Y) {}
|
||||||
|
//鼠标中键弹起回调
|
||||||
|
function OnMouseMbUp(MousePos_X, MousePos_Y) {}
|
||||||
|
//鼠标滚轮事件回调
|
||||||
|
function OnMouseWheel(Wheel, MousePos_X, MousePos_Y) {}
|
||||||
|
}
|
||||||
|
|
@ -11,8 +11,6 @@ class Yosin_CommonUi extends Yosin_BaseWindow {
|
||||||
|
|
||||||
Localtion_X = 0;
|
Localtion_X = 0;
|
||||||
Localtion_Y = 0;
|
Localtion_Y = 0;
|
||||||
Width = null;
|
|
||||||
Height = null;
|
|
||||||
|
|
||||||
isLBDown = false;
|
isLBDown = false;
|
||||||
//是否悬停
|
//是否悬停
|
||||||
|
|
@ -48,10 +46,6 @@ class Yosin_CommonUi extends Yosin_BaseWindow {
|
||||||
local Pos = GetWorldPosition();
|
local Pos = GetWorldPosition();
|
||||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) {
|
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) {
|
||||||
isLBDown = true;
|
isLBDown = true;
|
||||||
//如果有配置按键音效
|
|
||||||
if (OnClickSound) {
|
|
||||||
Sq_PlaySoundEffect(OnClickSound);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
base.OnMouseLbDown(MousePos_X, MousePos_Y);
|
base.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||||
}
|
}
|
||||||
|
|
@ -66,6 +60,10 @@ class Yosin_CommonUi extends Yosin_BaseWindow {
|
||||||
local Pos = GetWorldPosition();
|
local Pos = GetWorldPosition();
|
||||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) {
|
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) {
|
||||||
if (OnClick) OnClick(this);
|
if (OnClick) OnClick(this);
|
||||||
|
//如果有配置按键音效
|
||||||
|
if (OnClickSound) {
|
||||||
|
Sq_PlaySoundEffect(OnClickSound);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
base.OnMouseLbClick(MousePos_X, MousePos_Y);
|
base.OnMouseLbClick(MousePos_X, MousePos_Y);
|
||||||
}
|
}
|
||||||
|
|
@ -170,7 +168,7 @@ class Yosin_EmeStretch extends Yosin_CommonUi {
|
||||||
SpriteList[1].SetPosition(SpriteList[0].GetSize().w, 0);
|
SpriteList[1].SetPosition(SpriteList[0].GetSize().w, 0);
|
||||||
SpriteList[1].SetScale(ScaleRate, ScaleRateH);
|
SpriteList[1].SetScale(ScaleRate, ScaleRateH);
|
||||||
SpriteList[2].SetPosition(SpriteList[0].GetSize().w + ScaleW, 0);
|
SpriteList[2].SetPosition(SpriteList[0].GetSize().w + ScaleW, 0);
|
||||||
if (H != SpriteList[1].GetSize().h) {
|
if (H != SpriteList[1].GetSize().h) {
|
||||||
SpriteList[0].SetScale(1, ScaleRateH);
|
SpriteList[0].SetScale(1, ScaleRateH);
|
||||||
SpriteList[2].SetScale(1, ScaleRateH);
|
SpriteList[2].SetScale(1, ScaleRateH);
|
||||||
}
|
}
|
||||||
|
|
@ -184,7 +182,7 @@ class Yosin_EmeStretch extends Yosin_CommonUi {
|
||||||
SpriteList[1].SetPosition(0, SpriteList[0].GetSize().h);
|
SpriteList[1].SetPosition(0, SpriteList[0].GetSize().h);
|
||||||
SpriteList[1].SetScale(ScaleRateW, ScaleRate);
|
SpriteList[1].SetScale(ScaleRateW, ScaleRate);
|
||||||
SpriteList[2].SetPosition(0, SpriteList[0].GetSize().h + ScaleH);
|
SpriteList[2].SetPosition(0, SpriteList[0].GetSize().h + ScaleH);
|
||||||
if (W != SpriteList[1].GetSize().w) {
|
if (W != SpriteList[1].GetSize().w) {
|
||||||
SpriteList[0].SetScale(ScaleRateW, ScaleRateH);
|
SpriteList[0].SetScale(ScaleRateW, ScaleRateH);
|
||||||
SpriteList[2].SetScale(ScaleRateW, ScaleRateH);
|
SpriteList[2].SetScale(ScaleRateW, ScaleRateH);
|
||||||
}
|
}
|
||||||
|
|
@ -204,7 +202,7 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi {
|
||||||
|
|
||||||
constructor(X, Y, W, H, Path, Idx) {
|
constructor(X, Y, W, H, Path, Idx) {
|
||||||
base.constructor(X, Y, W, H);
|
base.constructor(X, Y, W, H);
|
||||||
DrawBackground( W, H, Path, Idx);
|
DrawBackground(W, H, Path, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -249,7 +247,7 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi {
|
||||||
|
|
||||||
// 左边
|
// 左边
|
||||||
local backgroundLeft = CL_SpriteObject(path, imgId + 3);
|
local backgroundLeft = CL_SpriteObject(path, imgId + 3);
|
||||||
backgroundLeft.SetPosition(x, y + cornerHeight );
|
backgroundLeft.SetPosition(x, y + cornerHeight);
|
||||||
backgroundLeft.SetScale(1, scaleH);
|
backgroundLeft.SetScale(1, scaleH);
|
||||||
Addchild(backgroundLeft);
|
Addchild(backgroundLeft);
|
||||||
|
|
||||||
|
|
@ -270,7 +268,7 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi {
|
||||||
// 下边
|
// 下边
|
||||||
local backgroundBottom = CL_SpriteObject(path, imgId + 7);
|
local backgroundBottom = CL_SpriteObject(path, imgId + 7);
|
||||||
backgroundBottom.SetPosition(cornerWidth, height - cornerHeight);
|
backgroundBottom.SetPosition(cornerWidth, height - cornerHeight);
|
||||||
backgroundBottom.SetScale( scaleW , 1);
|
backgroundBottom.SetScale(scaleW, 1);
|
||||||
Addchild(backgroundBottom);
|
Addchild(backgroundBottom);
|
||||||
|
|
||||||
// 右下角
|
// 右下角
|
||||||
|
|
|
||||||
|
|
@ -1,73 +1,79 @@
|
||||||
sqr/Core/ENUM/ENUM_KEY.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\ENUM\ENUM_KEY.nut
|
||||||
sqr/Core/ENUM/enum_system.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\ENUM\enum_system.nut
|
||||||
sqr/Core/BaseTool/BaseTool.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseTool\BaseTool.nut
|
||||||
sqr/Core/BaseTool/Math.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseTool\Math.nut
|
||||||
sqr/Core/BaseTool/String.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseTool\String.nut
|
||||||
sqr/Core/BaseTool/BlobExClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseTool\BlobExClass.nut
|
||||||
sqr/Core/BaseTool/JsonClass/JsonClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseTool\JsonClass\JsonClass.nut
|
||||||
sqr/Core/BaseTool/JsonClass/Json.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseTool\JsonClass\Json.nut
|
||||||
sqr/Core/BaseClass/ScriptManager/ScriptManager.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\ScriptManager\ScriptManager.nut
|
||||||
sqr/Core/BaseClass/ScriptManager/InitAni.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\ScriptManager\InitAni.nut
|
||||||
sqr/Core/BaseClass/Game_Window_Class.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\Game_Window_Class.nut
|
||||||
sqr/Core/BaseClass/BaseObject.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\BaseObject.nut
|
||||||
sqr/Core/BaseClass/AudioClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\AudioClass.nut
|
||||||
sqr/Core/BaseClass/StageClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\StageClass.nut
|
||||||
sqr/Core/BaseClass/ActorObject.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\ActorObject.nut
|
||||||
sqr/Core/BaseClass/LayerObject.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\LayerObject.nut
|
||||||
sqr/Core/BaseClass/UserStorage.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\UserStorage.nut
|
||||||
sqr/Core/BaseClass/SpriteObject/SpriteFrameClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\SpriteObject\SpriteFrameClass.nut
|
||||||
sqr/Core/BaseClass/SpriteObject/SpriteClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\SpriteObject\SpriteClass.nut
|
||||||
sqr/Core/BaseClass/TextObject/Font.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\TextObject\Font.nut
|
||||||
sqr/Core/BaseClass/TextObject/TextActor.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\TextObject\TextActor.nut
|
||||||
sqr/Core/BaseClass/AnimationClass/AnimationClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\BaseClass\AnimationClass\AnimationClass.nut
|
||||||
|
|
||||||
sqr/Core/ExtraCalss/Socket/Socket.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\ExtraCalss\Socket\Socket.nut
|
||||||
|
|
||||||
sqr/Core/Game_Proc/Game_Proc.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\Game_Proc\Game_Proc.nut
|
||||||
|
|
||||||
sqr/Core/UI_Class/UI_Core.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\UI_Class\UI_Cursor.nut
|
||||||
sqr/Core/UI_Class/UI_Widget.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\UI_Class\UI_Core.nut
|
||||||
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\Core\UI_Class\UI_Widget.nut
|
||||||
|
|
||||||
|
|
||||||
sqr/User/_ENUM/enum_game.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\_ENUM\global_object.nut
|
||||||
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\_ENUM\enum_music.nut
|
||||||
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\_ENUM\enum_packet.nut
|
||||||
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\_ENUM\enum_game.nut
|
||||||
|
|
||||||
sqr/User/Socket/Socket.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Socket\Socket.nut
|
||||||
|
|
||||||
sqr/User/Asset/AssetManager.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Asset\AssetManager.nut
|
||||||
sqr/User/Asset/FontAsset.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Asset\FontAsset.nut
|
||||||
sqr/User/Asset/Character/Animation.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Asset\Character\Animation.nut
|
||||||
|
|
||||||
sqr/User/Asset/Item/Item.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Asset\Item\Item.nut
|
||||||
sqr/User/Asset/Item/Equipment.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Asset\Item\Equipment.nut
|
||||||
|
|
||||||
sqr/User/Object/StateMachine/StateMachineClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\StateMachine\StateMachineClass.nut
|
||||||
|
|
||||||
sqr/User/Object/Object/BaseObject.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\Object\BaseObject.nut
|
||||||
sqr/User/Object/Object/AnimationObject.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\Object\AnimationObject.nut
|
||||||
sqr/User/Object/Map/TileObject.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\Map\TileObject.nut
|
||||||
sqr/User/Object/Map/MapObject.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\Map\MapObject.nut
|
||||||
|
|
||||||
sqr/User/Object/ActiveObject/GameObjectClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\GameObjectClass.nut
|
||||||
sqr/User/Object/ActiveObject/StaticObjectClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\StaticObjectClass.nut
|
||||||
sqr/User/Object/ActiveObject/ActiveObjectClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\ActiveObjectClass.nut
|
||||||
sqr/User/Object/ActiveObject/PassiveObjectClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\PassiveObjectClass.nut
|
||||||
sqr/User/Object/ActiveObject/MonsterObjectClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\MonsterObjectClass.nut
|
||||||
sqr/User/Object/ActiveObject/CharacterObjectClass.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\CharacterObjectClass.nut
|
||||||
sqr/User/Object/ActiveObject/CharacterObjectClass_AI.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\CharacterObjectClass_AI.nut
|
||||||
|
|
||||||
sqr/User/Socket/Socket.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Socket\Socket.nut
|
||||||
|
|
||||||
sqr/User/Stage/LodingStage.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Stage\LodingStage.nut
|
||||||
sqr/User/Stage/TestStage.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Stage\TestStage.nut
|
||||||
|
|
||||||
sqr/User/UI/Widget/InputBox.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Widget\IMouse.nut
|
||||||
sqr/User/UI/Widget/Drag_Button.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Widget\InputBox.nut
|
||||||
sqr/User/UI/Widget/Scroll_Bar.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Widget\Drag_Button.nut
|
||||||
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Widget\Scroll_Bar.nut
|
||||||
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Widget\Text_Button.nut
|
||||||
|
|
||||||
sqr/User/UI/Window/0_Login.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Window\0_Login.nut
|
||||||
sqr/User/UI/Window/1_Select_Character.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Window\1_Select_Character.nut
|
||||||
sqr/User/UI/Window/2_create_Character.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Window\2_create_Character.nut
|
||||||
sqr/User/UI/Window/233_HUD_Message.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Window\233_HUD_Message.nut
|
||||||
|
|
||||||
|
|
||||||
sqr/User/main.nut
|
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\main.nut
|
||||||
|
|
@ -53,9 +53,69 @@ class Character_Animation extends Actor {
|
||||||
//光环
|
//光环
|
||||||
AuroraAni = null;
|
AuroraAni = null;
|
||||||
|
|
||||||
|
//名字
|
||||||
|
Name = null;
|
||||||
|
|
||||||
|
ENUM_RINDRO_JOB_TITLE_HEIGHT = [
|
||||||
|
//男鬼剑士
|
||||||
|
{
|
||||||
|
x = -18,
|
||||||
|
y = -154
|
||||||
|
},
|
||||||
|
//女格斗
|
||||||
|
{
|
||||||
|
x = -18,
|
||||||
|
y = -140
|
||||||
|
},
|
||||||
|
//男神枪手
|
||||||
|
{
|
||||||
|
x = -20,
|
||||||
|
y = -168
|
||||||
|
},
|
||||||
|
//女魔法师
|
||||||
|
{
|
||||||
|
x = -22,
|
||||||
|
y = -126
|
||||||
|
},
|
||||||
|
//男圣职者
|
||||||
|
{
|
||||||
|
x = -22,
|
||||||
|
y = -166
|
||||||
|
},
|
||||||
|
//女神枪手
|
||||||
|
{
|
||||||
|
x = -18,
|
||||||
|
y = -156
|
||||||
|
},
|
||||||
|
//女暗夜使者
|
||||||
|
{
|
||||||
|
x = -20,
|
||||||
|
y = -154
|
||||||
|
},
|
||||||
|
//男格斗家
|
||||||
|
{
|
||||||
|
x = -21,
|
||||||
|
y = -160
|
||||||
|
},
|
||||||
|
//男魔法师
|
||||||
|
{
|
||||||
|
x = -21,
|
||||||
|
y = -140
|
||||||
|
},
|
||||||
|
//黑暗武士
|
||||||
|
{
|
||||||
|
x = -18,
|
||||||
|
y = -154
|
||||||
|
},
|
||||||
|
//缔造者
|
||||||
|
{
|
||||||
|
x = -22,
|
||||||
|
y = -126
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
base.constructor();
|
base.constructor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//同步单部位动画
|
//同步单部位动画
|
||||||
|
|
@ -233,6 +293,13 @@ class Character_Animation extends Actor {
|
||||||
|
|
||||||
//初始化
|
//初始化
|
||||||
function Init(SlotType = false) {
|
function Init(SlotType = false) {
|
||||||
|
//初始化Ani
|
||||||
|
InitAni(SlotType);
|
||||||
|
//初始化名字
|
||||||
|
InitName();
|
||||||
|
}
|
||||||
|
|
||||||
|
function InitAni(SlotType) {
|
||||||
//读取并设置 等待Ani
|
//读取并设置 等待Ani
|
||||||
ReadAndSetAni("WaitingAni", "waiting motion", SlotType);
|
ReadAndSetAni("WaitingAni", "waiting motion", SlotType);
|
||||||
//读取并设置 移动Ani
|
//读取并设置 移动Ani
|
||||||
|
|
@ -299,6 +366,23 @@ class Character_Animation extends Actor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//初始化名字
|
||||||
|
function InitName() {
|
||||||
|
//创建名字对象
|
||||||
|
Name = FontAssetManager.GenerateNormal("", false, {
|
||||||
|
color = sq_RGBA(209, 185, 148, 255),
|
||||||
|
alignment = TextAlign.Center
|
||||||
|
});
|
||||||
|
Name.SetPosition(ENUM_RINDRO_JOB_TITLE_HEIGHT[Parent.Job]);
|
||||||
|
Name.SetZOrder(80000);
|
||||||
|
Addchild(Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置名字
|
||||||
|
function SetName(Name) {
|
||||||
|
this.Name.SetText(Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//设置Ani
|
//设置Ani
|
||||||
function SetAnimation(Ani) {
|
function SetAnimation(Ani) {
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,18 @@ class GameObject.Character extends GameObject.ActiveObject {
|
||||||
//属性对象
|
//属性对象
|
||||||
Attribute = null;
|
Attribute = null;
|
||||||
|
|
||||||
|
//名字
|
||||||
|
Name = "无名字";
|
||||||
|
|
||||||
|
//职业编号
|
||||||
|
Job = 0;
|
||||||
|
|
||||||
|
|
||||||
function Init(Idx) {
|
function Init(Idx) {
|
||||||
//初始化动画组
|
//初始化动画组
|
||||||
CurrentAni = [];
|
CurrentAni = [];
|
||||||
|
//设置职业编号
|
||||||
|
this.Job = Idx;
|
||||||
//获取角色职业信息
|
//获取角色职业信息
|
||||||
Info = sq_DeepCopy(AssetManager.CharacterInfoList[Idx]);
|
Info = sq_DeepCopy(AssetManager.CharacterInfoList[Idx]);
|
||||||
base.Init(Info);
|
base.Init(Info);
|
||||||
|
|
@ -111,6 +119,13 @@ class GameObject.Character extends GameObject.ActiveObject {
|
||||||
ChangeEquipment(Equ);
|
ChangeEquipment(Equ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置名字
|
||||||
|
function SetName(Name) {
|
||||||
|
this.Name = Name;
|
||||||
|
AnimationManager.SetName(Name);
|
||||||
|
base.SetName(Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//通过职业和装备列表来构造一个角色
|
//通过职业和装备列表来构造一个角色
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@ function InitGame() {
|
||||||
// MySocket("127.0.0.1", 19666);
|
// MySocket("127.0.0.1", 19666);
|
||||||
|
|
||||||
//设定全局默认音量
|
//设定全局默认音量
|
||||||
_Globa_Audio_Volume_ = 0.1;
|
_Globa_Audio_Volume_ = 0.3;
|
||||||
|
_Globa_Sound_Volume_ = 0.3;
|
||||||
|
|
||||||
Script();
|
Script();
|
||||||
|
|
||||||
|
|
@ -18,6 +19,15 @@ function InitGame() {
|
||||||
_AssetManager_();
|
_AssetManager_();
|
||||||
//初始化字体
|
//初始化字体
|
||||||
_FontAssetManager_();
|
_FontAssetManager_();
|
||||||
|
//初始化鼠标
|
||||||
|
_IMouse_();
|
||||||
|
|
||||||
|
//预加载
|
||||||
|
Animation("ui/charactercreate/dust.ani");
|
||||||
|
Animation("ui/charactercreate/firedust.ani");
|
||||||
|
Animation("ui/charactercreate/dust.ani");
|
||||||
|
Animation("ui/charactercreate/aura.ani");
|
||||||
|
|
||||||
|
|
||||||
//进入下一个场景
|
//进入下一个场景
|
||||||
TestStage();
|
TestStage();
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ function TestStage() {
|
||||||
T.Enter();
|
T.Enter();
|
||||||
|
|
||||||
|
|
||||||
// local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
|
|
||||||
local Window = Sq_CreateWindow(_CreateCharacter, "创建角色", 0, 0, 1066, 600, 0);
|
local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -55,24 +55,48 @@ function TestStage() {
|
||||||
// local T = {
|
// local T = {
|
||||||
// loginImg = 1,
|
// loginImg = 1,
|
||||||
// charac = [{
|
// charac = [{
|
||||||
|
// lv = 90,
|
||||||
|
// name = "测试角色1",
|
||||||
// job = 0,
|
// job = 0,
|
||||||
// equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]
|
// equip = [101020001, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023, 609590003]
|
||||||
// }, {
|
// }, {
|
||||||
|
// lv = 90,
|
||||||
|
// name = "测试角色2",
|
||||||
// job = 0,
|
// job = 0,
|
||||||
// equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]
|
// equip = [101020023, 601500059, 601550059, 601560057, 601570052, 601520051, 601500059, 601510058, 601530050, 601540059, 601580022, 609590003]
|
||||||
// }, {
|
// }, {
|
||||||
|
// lv = 90,
|
||||||
|
// name = "测试角色3",
|
||||||
// job = 0,
|
// job = 0,
|
||||||
// equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]
|
// equip = [101020026, 601500058, 601550058, 601560056, 601570051, 601520050, 601500058, 601510057, 601530049, 601540058, 601580021, 609590003]
|
||||||
// }, {
|
// }, {
|
||||||
|
// lv = 90,
|
||||||
|
// name = "测试角色4",
|
||||||
// job = 0,
|
// job = 0,
|
||||||
// equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]
|
// equip = [101020037, 601500061, 601550061, 601560059, 601570054, 601520053, 601500061, 601510060, 601530052, 601540061, 601580024, 609590003]
|
||||||
// }, {
|
// }, {
|
||||||
|
// lv = 90,
|
||||||
|
// name = "测试角色5",
|
||||||
// job = 0,
|
// job = 0,
|
||||||
// equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]
|
// equip = [601020007, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023, 609590003]
|
||||||
// }]
|
// }]
|
||||||
// };
|
// };
|
||||||
// Window.Init(T);
|
// Window.Init(T);
|
||||||
|
|
||||||
|
// local Actorobj = Actor();
|
||||||
|
// Actorobj.ShowBorder(true);
|
||||||
|
// Actorobj.SetSize(1500, 100);
|
||||||
|
// local Name = FontAssetManager.GenerateNormal("是的呢参加考试你打", true, {
|
||||||
|
// color = sq_RGBA(209, 185, 148, 255),
|
||||||
|
// alignment = TextAlign.Center,
|
||||||
|
// wrap_width = 50
|
||||||
|
// });
|
||||||
|
// Name.ShowBorder(true);
|
||||||
|
// Name.SetSize(1500, 100);
|
||||||
|
// Name.SetPosition(200, 200);
|
||||||
|
// Actorobj.Addchild(Name);
|
||||||
|
// T.Addchild(Actorobj);
|
||||||
|
|
||||||
// print(ObjectCount);
|
// print(ObjectCount);
|
||||||
|
|
||||||
// Sq_CreateWindow(_CreateCharacter, "创建角色界面窗口", 0, 0, 1066, 600, 0);
|
// Sq_CreateWindow(_CreateCharacter, "创建角色界面窗口", 0, 0, 1066, 600, 0);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
文件名:IMouse.nut
|
||||||
|
路径:User/UI/Widget/IMouse.nut
|
||||||
|
创建日期:2024-12-18 14:03
|
||||||
|
文件用途:
|
||||||
|
*/
|
||||||
|
class _IMouse_ extends _Yosin_Cursor {
|
||||||
|
|
||||||
|
NormalC = null;
|
||||||
|
//普通状态0
|
||||||
|
State = 0;
|
||||||
|
Idx = 0;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
NormalC = [];
|
||||||
|
base.constructor();
|
||||||
|
getroottable().IMouse <- this;
|
||||||
|
|
||||||
|
//关闭系统鼠标
|
||||||
|
Sq_ShowCursor(false);
|
||||||
|
|
||||||
|
//调用父类初始化 将自己添加为UI层子对象
|
||||||
|
Init();
|
||||||
|
//初始化所有普通图标
|
||||||
|
InitSprite();
|
||||||
|
|
||||||
|
//更换为0号指针
|
||||||
|
Change(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化普通鼠标指针
|
||||||
|
function InitSprite() {
|
||||||
|
for (local i = 0; i< 254; i++) {
|
||||||
|
local Sp = CL_SpriteObject("sprite/interface/newstyle/windows/cursor.img", i);
|
||||||
|
NormalC.push(Sp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//更换普通鼠标指针
|
||||||
|
function Change(Idx) {
|
||||||
|
State = 0;
|
||||||
|
this.Idx = Idx;
|
||||||
|
local Sp = NormalC[Idx];
|
||||||
|
base.Change(Sp);
|
||||||
|
}
|
||||||
|
|
||||||
|
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//按下
|
||||||
|
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||||
|
//普通状态的点击效果
|
||||||
|
if (Idx == 0) {
|
||||||
|
Change(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//抬起
|
||||||
|
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||||
|
//普通状态的点击效果
|
||||||
|
if (Idx == 1) {
|
||||||
|
Change(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -43,7 +43,7 @@ class _Login_Window extends Yosin_Window {
|
||||||
//登录成功
|
//登录成功
|
||||||
if (Jso.state) {
|
if (Jso.state) {
|
||||||
NoticeBox = _Yosin_MessageBox("登录成功,正在进入游戏...");
|
NoticeBox = _Yosin_MessageBox("登录成功,正在进入游戏...");
|
||||||
MySocket.Send(9, null);
|
MySocket.Send(PACKET_ID.QUERY_CHARACTER_LIST, null);
|
||||||
} else {
|
} else {
|
||||||
NoticeBox = _Yosin_MessageBox("登录失败");
|
NoticeBox = _Yosin_MessageBox("登录失败");
|
||||||
}
|
}
|
||||||
|
|
@ -62,19 +62,21 @@ class _Login_Window extends Yosin_Window {
|
||||||
local value = Blob.readn('i');
|
local value = Blob.readn('i');
|
||||||
info.equip.append(value);
|
info.equip.append(value);
|
||||||
}
|
}
|
||||||
|
// print(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
//关闭登录界面
|
//关闭登录界面
|
||||||
NoticeBox.CloseWindow();
|
NoticeBox.DestroyWindow();
|
||||||
CloseWindow();
|
DestroyWindow();
|
||||||
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);
|
||||||
|
Window.BackGroundMusic = this.BackGroundMusic;
|
||||||
}.bindenv(this));
|
}.bindenv(this));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function PlayBackgroundMusic() {
|
function PlayBackgroundMusic() {
|
||||||
// BackGroundMusic = Sound("SoundPacks/Loop.ogg");
|
BackGroundMusic = Audio(MUSIC.M_CHARACTER_SELECT);
|
||||||
// BackGroundMusic.Play();
|
BackGroundMusic.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
function MusicLogic() {
|
function MusicLogic() {
|
||||||
|
|
@ -93,9 +95,11 @@ class _Login_Window extends Yosin_Window {
|
||||||
|
|
||||||
//登录按钮
|
//登录按钮
|
||||||
local LoginButton = Yosin_BaseButton(770, 410, 77, 24 "sprite/interface/lenheartwindowcommon.img", 90);
|
local LoginButton = Yosin_BaseButton(770, 410, 77, 24 "sprite/interface/lenheartwindowcommon.img", 90);
|
||||||
|
LoginButton.OnClickSound = SOUND.CLICK_BUTTON4;
|
||||||
//点击事件回调
|
//点击事件回调
|
||||||
LoginButton.OnClick = function(Button) {
|
LoginButton.OnClick = function(Button) {
|
||||||
MySocket.Send(1, {
|
// sqdbg_break();
|
||||||
|
MySocket.Send(PACKET_ID.LOGIN, {
|
||||||
account = AccountInputBox.str,
|
account = AccountInputBox.str,
|
||||||
password = PasswordInputBox.str
|
password = PasswordInputBox.str
|
||||||
})
|
})
|
||||||
|
|
@ -111,9 +115,10 @@ class _Login_Window extends Yosin_Window {
|
||||||
|
|
||||||
//注册按钮
|
//注册按钮
|
||||||
local RegisterButton = Yosin_BaseButton(865, 410, 77, 24 "sprite/interface/lenheartwindowcommon.img", 90);
|
local RegisterButton = Yosin_BaseButton(865, 410, 77, 24 "sprite/interface/lenheartwindowcommon.img", 90);
|
||||||
|
RegisterButton.OnClickSound = SOUND.CLICK_BUTTON1;
|
||||||
//点击事件回调
|
//点击事件回调
|
||||||
RegisterButton.OnClick = function(Button) {
|
RegisterButton.OnClick = function(Button) {
|
||||||
MySocket.Send(3, {
|
MySocket.Send(PACKET_ID.REGISTER, {
|
||||||
account = AccountInputBox.str,
|
account = AccountInputBox.str,
|
||||||
password = PasswordInputBox.str
|
password = PasswordInputBox.str
|
||||||
})
|
})
|
||||||
|
|
@ -162,14 +167,12 @@ class _Login_Window extends Yosin_Window {
|
||||||
});
|
});
|
||||||
PasswordTextActor.SetPosition(720, 281);
|
PasswordTextActor.SetPosition(720, 281);
|
||||||
Addchild(PasswordTextActor);
|
Addchild(PasswordTextActor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//逻辑入口
|
//逻辑入口
|
||||||
function Proc(Dt) {
|
function Proc(Dt) {
|
||||||
MusicLogic();
|
if (Visible) MusicLogic();
|
||||||
|
|
||||||
SyncPos(X, Y);
|
SyncPos(X, Y);
|
||||||
base.Proc(Dt);
|
base.Proc(Dt);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ class _Select_Character_SettingBackground_Window extends Yosin_Window {
|
||||||
SettingBackgroundButtonList = [];
|
SettingBackgroundButtonList = [];
|
||||||
|
|
||||||
SetClipRect(5, 9, gWidth, gHeight - 9);
|
SetClipRect(5, 9, gWidth, gHeight - 9);
|
||||||
|
SetZOrder(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Init() {
|
function Init() {
|
||||||
|
|
@ -109,7 +110,7 @@ class _Select_Character_SettingBackground_Window extends Yosin_Window {
|
||||||
//背景
|
//背景
|
||||||
Background = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/setup/setup.img", 17);
|
Background = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/setup/setup.img", 17);
|
||||||
Background.SetPosition(X, Y);
|
Background.SetPosition(X, Y);
|
||||||
Background.SetZOrder(-10);
|
// Background.SetZOrder(-10);
|
||||||
Background.SetVisible(false);
|
Background.SetVisible(false);
|
||||||
//因为裁切原因 所以要添加到父对象中
|
//因为裁切原因 所以要添加到父对象中
|
||||||
Parent.Addchild(Background);
|
Parent.Addchild(Background);
|
||||||
|
|
@ -153,31 +154,168 @@ class _Select_Character_Chr extends Yosin_CommonUi {
|
||||||
IsIndependent = false;
|
IsIndependent = false;
|
||||||
|
|
||||||
Info = null;
|
Info = null;
|
||||||
|
Idx = null;
|
||||||
|
|
||||||
|
//悬停框
|
||||||
|
RectMask = null;
|
||||||
|
//选中框
|
||||||
|
SelectMask = null;
|
||||||
|
//选中状态
|
||||||
|
SelectFlag = false;
|
||||||
|
|
||||||
|
//鼠标相对位置
|
||||||
|
M_Xpos = null;
|
||||||
|
M_Ypos = null;
|
||||||
|
//移动Flag
|
||||||
|
MoveFlag = false;
|
||||||
|
//鼠标移动位置
|
||||||
|
M_Move_Xpos = 0;
|
||||||
|
M_Move_Ypos = 0;
|
||||||
|
|
||||||
|
|
||||||
constructor(gX, gY, gWidth, gHeight) {
|
constructor(gX, gY, gWidth, gHeight) {
|
||||||
base.constructor(gX, gY, gWidth, gHeight);
|
base.constructor(gX, gY, gWidth, gHeight);
|
||||||
RegisterDraw();
|
RegisterDraw();
|
||||||
|
|
||||||
|
// OpenDeBug();
|
||||||
}
|
}
|
||||||
|
|
||||||
function Init(Info) {
|
function Init(Info, Idx) {
|
||||||
this.Info = Info;
|
this.Info = Info;
|
||||||
|
this.Idx = Idx;
|
||||||
RegisterCharac();
|
RegisterCharac();
|
||||||
}
|
}
|
||||||
|
|
||||||
function RegisterDraw() {
|
function RegisterDraw() {
|
||||||
|
//魔法阵
|
||||||
local Magic = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 10);
|
local Magic = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 10);
|
||||||
|
Magic.SetPosition(3, 136);
|
||||||
Addchild(Magic);
|
Addchild(Magic);
|
||||||
|
|
||||||
|
//悬停框
|
||||||
|
RectMask = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 1);
|
||||||
|
RectMask.SetMode(0);
|
||||||
|
RectMask.SetPosition(3, 0);
|
||||||
|
RectMask.SetVisible(false);
|
||||||
|
Addchild(RectMask);
|
||||||
|
|
||||||
|
//选中框
|
||||||
|
SelectMask = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 1);
|
||||||
|
SelectMask.SetMode(0);
|
||||||
|
SelectMask.SetPosition(3, 0);
|
||||||
|
SelectMask.SetVisible(false);
|
||||||
|
Addchild(SelectMask);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function RegisterCharac() {
|
function RegisterCharac() {
|
||||||
|
if (!Info) return;
|
||||||
local Charc = GameObject.CreateCharacter(Info.job, Info.equip);
|
local Charc = GameObject.CreateCharacter(Info.job, Info.equip);
|
||||||
Charc.SetAnimation("RestAni");
|
Charc.SetAnimation("RestAni");
|
||||||
Charc.SetPosition(48, 12, 0);
|
Charc.SetPosition(64, 156, 0);
|
||||||
|
Charc.SetName(Info.lv + "级 " + Info.name);
|
||||||
|
Charc.AnimationManager.Name.MoveBy(0, 180);
|
||||||
Addchild(Charc);
|
Addchild(Charc);
|
||||||
// print(Charc.AnimationManager.Children.len());
|
}
|
||||||
|
|
||||||
|
function SetIdxPosition(Idx) {
|
||||||
|
this.Idx = Idx;
|
||||||
|
SetPosition(184 + (Idx * 142), ((Idx % 2) ? 13 : 0) + 93)
|
||||||
|
SelectMask.SetVisible(false);
|
||||||
|
SelectFlag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标事件回调
|
||||||
|
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||||
|
base.OnMouseProc(MousePos_X, MousePos_Y);
|
||||||
|
if (isInRect) {
|
||||||
|
RectMask.SetVisible(true);
|
||||||
|
} else {
|
||||||
|
RectMask.SetVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设定拖动逻辑
|
||||||
|
if (MoveFlag) {
|
||||||
|
M_Move_Xpos = B_X - (M_Xpos - MousePos_X);
|
||||||
|
M_Move_Ypos = B_Y - (M_Ypos - MousePos_Y);
|
||||||
|
//左键拖动
|
||||||
|
SetPosition(M_Move_Xpos, M_Move_Ypos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标左键单击回调
|
||||||
|
function OnMouseLbClick(MousePos_X, MousePos_Y) {
|
||||||
|
base.OnMouseLbClick(MousePos_X, MousePos_Y);
|
||||||
|
if (isInRect) {
|
||||||
|
//遍历父对象中的所有按钮 还原其他按钮
|
||||||
|
foreach(Button in Parent.UpCharacterList) {
|
||||||
|
Button.SelectMask.SetVisible(false);
|
||||||
|
Button.SelectFlag = false;
|
||||||
|
}
|
||||||
|
//设置自身选中状态
|
||||||
|
SelectMask.SetVisible(true);
|
||||||
|
SelectFlag = true;
|
||||||
|
Parent.CurrentSelectCharacterIdx = Idx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标左键按下回调
|
||||||
|
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;
|
||||||
|
SetZOrder(100000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标左键弹起回调
|
||||||
|
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||||
|
base.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||||
|
if (MoveFlag) {
|
||||||
|
|
||||||
|
MoveFlag = false;
|
||||||
|
M_Xpos = null;
|
||||||
|
M_Ypos = null;
|
||||||
|
B_X = null;
|
||||||
|
B_Y = null;
|
||||||
|
|
||||||
|
//有移动才走替换位置逻辑
|
||||||
|
if (M_Move_Xpos != 0 || M_Move_Ypos != 0) {
|
||||||
|
//遍历父对象中的所有按钮 还原其他按钮
|
||||||
|
foreach(Button in Parent.UpCharacterList) {
|
||||||
|
if (Button.isInRect) {
|
||||||
|
//记录自身原本位置
|
||||||
|
local OldIdx = this.Idx;
|
||||||
|
//设置自身到达位置
|
||||||
|
SetIdxPosition(Button.Idx);
|
||||||
|
//设置对方的位置
|
||||||
|
Button.SetIdxPosition(OldIdx);
|
||||||
|
//发送替换位置包
|
||||||
|
SendReplaceCharacterPos(OldIdx, Button.Idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
M_Move_Xpos = M_Move_Ypos = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function SendReplaceCharacterPos(OldIdx, NewIdx) {
|
||||||
|
MySocket.Send(PACKET_ID.CHANGE_CHARACTER_POSITION, {
|
||||||
|
oldidx = OldIdx,
|
||||||
|
newidx = NewIdx
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _Select_Character_Window extends Yosin_Window {
|
class _Select_Character_Window extends Yosin_Window {
|
||||||
//调试模式
|
//调试模式
|
||||||
// DeBugMode = true;
|
// DeBugMode = true;
|
||||||
|
|
@ -198,12 +336,18 @@ class _Select_Character_Window extends Yosin_Window {
|
||||||
//角色遮罩栏
|
//角色遮罩栏
|
||||||
CharacterMaskBox = null;
|
CharacterMaskBox = null;
|
||||||
|
|
||||||
|
//上排角色对象
|
||||||
|
UpCharacterList = null;
|
||||||
|
//当前选中角色Idx
|
||||||
|
CurrentSelectCharacterIdx = 0;
|
||||||
|
|
||||||
//信息
|
//信息
|
||||||
Info = null;
|
Info = 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);
|
||||||
|
UpCharacterList = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function Init(gInfo) {
|
function Init(gInfo) {
|
||||||
|
|
@ -220,14 +364,6 @@ class _Select_Character_Window extends Yosin_Window {
|
||||||
//注册窗口
|
//注册窗口
|
||||||
RegisterWindow();
|
RegisterWindow();
|
||||||
// OpenDeBug();
|
// OpenDeBug();
|
||||||
|
|
||||||
//播放音乐
|
|
||||||
PlayBackgroundMusic();
|
|
||||||
}
|
|
||||||
|
|
||||||
function PlayBackgroundMusic() {
|
|
||||||
// BackGroundMusic = Sound("SoundPacks/Loop.ogg");
|
|
||||||
// BackGroundMusic.Play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function MusicLogic() {
|
function MusicLogic() {
|
||||||
|
|
@ -243,8 +379,17 @@ 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(190 + (i * 144), ((i % 2) ? 15 : 0) + 225, 126, 208);
|
//角色框背景
|
||||||
if (i< Info.charac.len()) Buf.Init(Info.charac[i]);
|
local CharBg = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 4);
|
||||||
|
CharBg.SetMode(0);
|
||||||
|
CharBg.SetPosition(184 + (i * 142) + 3, ((i % 2) ? 13 : 0) + 93);
|
||||||
|
CharBg.SetZOrder(-10);
|
||||||
|
Addchild(CharBg);
|
||||||
|
|
||||||
|
local Buf = _Select_Character_Chr(184 + (i * 142), ((i % 2) ? 13 : 0) + 93, 132, 208);
|
||||||
|
if (i< Info.charac.len()) Buf.Init(Info.charac[i], i);
|
||||||
|
else Buf.Init(null, i);
|
||||||
|
UpCharacterList.push(Buf);
|
||||||
AddUIChild(Buf);
|
AddUIChild(Buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -257,20 +402,93 @@ class _Select_Character_Window extends Yosin_Window {
|
||||||
SettingBackgroundWindow.SetVisible(!SettingBackgroundWindow.Visible)
|
SettingBackgroundWindow.SetVisible(!SettingBackgroundWindow.Visible)
|
||||||
}.bindenv(this);
|
}.bindenv(this);
|
||||||
AddUIChild(SettingButton);
|
AddUIChild(SettingButton);
|
||||||
//登录按钮文本
|
//背景设置按钮文本
|
||||||
local LoginTextActor = FontAssetManager.GenerateNormal("背景设置", true, {
|
local BgSettingTextActor = FontAssetManager.GenerateNormal("背景设置", true, {
|
||||||
color = sq_RGBA(221, 197, 147, 255)
|
color = sq_RGBA(221, 197, 147, 255)
|
||||||
});
|
});
|
||||||
LoginTextActor.SetPosition(23, 3);
|
BgSettingTextActor.SetPosition(23, 3);
|
||||||
LoginTextActor.SetUpdateFunc(function(Text, Dt) {
|
BgSettingTextActor.SetUpdateFunc(function(Text, Dt) {
|
||||||
if (Text.Parent.State == 1 || Text.Parent.State == 2) {
|
if (Text.Parent.State == 1 || Text.Parent.State == 2) {
|
||||||
Text.SetFillColor(sq_RGBA(255, 255, 184, 255));
|
Text.SetFillColor(sq_RGBA(255, 255, 184, 255));
|
||||||
} else if (Text.Parent.State == 0) {
|
} else if (Text.Parent.State == 0) {
|
||||||
Text.SetFillColor(sq_RGBA(221, 197, 147, 255));
|
Text.SetFillColor(sq_RGBA(221, 197, 147, 255));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
SettingButton.Addchild(LoginTextActor);
|
SettingButton.Addchild(BgSettingTextActor);
|
||||||
|
|
||||||
|
|
||||||
|
//创建角色按钮
|
||||||
|
local CreateButton = Yosin_SplicingButton(316, 560, 59, 24 "sprite/interface/lenheartwindowcommon.img", 172, true, false);
|
||||||
|
//创建角色按钮文本
|
||||||
|
local CreateTextActor = FontAssetManager.GenerateNormal("创建角色", false, {
|
||||||
|
color = sq_RGBA(186, 147, 97, 255)
|
||||||
|
});
|
||||||
|
CreateButton.OnClick = function(Button) {
|
||||||
|
local Window = Sq_CreateWindow(_CreateCharacter, "创建角色界面窗口", 0, 0, 1066, 600, 0);
|
||||||
|
Window.ResetFocus();
|
||||||
|
}.bindenv(this);
|
||||||
|
AddUIChild(CreateButton);
|
||||||
|
CreateTextActor.SetPosition(6, 5);
|
||||||
|
CreateTextActor.SetZOrder(100000);
|
||||||
|
CreateTextActor.SetUpdateFunc(function(Text, Dt) {
|
||||||
|
if (Text.Parent.State == 1 || Text.Parent.State == 2) {
|
||||||
|
Text.SetFillColor(sq_RGBA(18, 71, 130, 255));
|
||||||
|
} else if (Text.Parent.State == 0) {
|
||||||
|
Text.SetFillColor(sq_RGBA(186, 147, 97, 255));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
CreateButton.Addchild(CreateTextActor);
|
||||||
|
|
||||||
|
|
||||||
|
//删除角色按钮
|
||||||
|
local DeleteButton = Yosin_SplicingButton(384, 560, 59, 24 "sprite/interface/lenheartwindowcommon.img", 172, true, false);
|
||||||
|
//删除角色按钮文本
|
||||||
|
local DeleteTextActor = FontAssetManager.GenerateNormal(" 删除", false, {
|
||||||
|
color = sq_RGBA(186, 147, 97, 255)
|
||||||
|
});
|
||||||
|
AddUIChild(DeleteButton);
|
||||||
|
DeleteTextActor.SetPosition(6, 5);
|
||||||
|
DeleteTextActor.SetZOrder(100000);
|
||||||
|
DeleteTextActor.SetUpdateFunc(function(Text, Dt) {
|
||||||
|
if (Text.Parent.State == 1 || Text.Parent.State == 2) {
|
||||||
|
Text.SetFillColor(sq_RGBA(18, 71, 130, 255));
|
||||||
|
} else if (Text.Parent.State == 0) {
|
||||||
|
Text.SetFillColor(sq_RGBA(186, 147, 97, 255));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
DeleteButton.Addchild(DeleteTextActor);
|
||||||
|
|
||||||
|
//结束游戏按钮
|
||||||
|
local CloseButton = Yosin_SplicingButton(702, 560, 59, 24 "sprite/interface/lenheartwindowcommon.img", 172, true, false);
|
||||||
|
//结束游戏按钮文本
|
||||||
|
local CloseTextActor = FontAssetManager.GenerateNormal("结束游戏", false, {
|
||||||
|
color = sq_RGBA(186, 147, 97, 255)
|
||||||
|
});
|
||||||
|
AddUIChild(CloseButton);
|
||||||
|
CloseTextActor.SetPosition(6, 5);
|
||||||
|
CloseTextActor.SetZOrder(100000);
|
||||||
|
CloseTextActor.SetUpdateFunc(function(Text, Dt) {
|
||||||
|
if (Text.Parent.State == 1 || Text.Parent.State == 2) {
|
||||||
|
Text.SetFillColor(sq_RGBA(18, 71, 130, 255));
|
||||||
|
} else if (Text.Parent.State == 0) {
|
||||||
|
Text.SetFillColor(sq_RGBA(186, 147, 97, 255));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
CloseButton.Addchild(CloseTextActor);
|
||||||
|
|
||||||
|
|
||||||
|
//开始游戏按钮
|
||||||
|
local StartButton = Yosin_BaseButton(475, 546, 118, 47 "sprite/interface2/selectcharacter/selectcharacter.img", 7);
|
||||||
|
//点击事件回调
|
||||||
|
StartButton.OnClick = function(Button) {
|
||||||
|
//停止背景音乐
|
||||||
|
if (BackGroundMusic) {
|
||||||
|
BackGroundMusic.Pause();
|
||||||
|
}
|
||||||
|
SetVisible(false);
|
||||||
|
//TODO 发送进入游戏请求
|
||||||
|
}.bindenv(this);
|
||||||
|
AddUIChild(StartButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
//切换背景
|
//切换背景
|
||||||
|
|
@ -289,16 +507,29 @@ class _Select_Character_Window extends Yosin_Window {
|
||||||
ChangeBackground(Info.loginImg);
|
ChangeBackground(Info.loginImg);
|
||||||
|
|
||||||
//角色遮罩栏
|
//角色遮罩栏
|
||||||
CharacterMaskBox = Yosin_NineBoxStretch(-4, 330, 1074, 680, "sprite/interface/lenheartwindowcommon.img", 0);
|
CharacterMaskBox = Yosin_NineBoxStretch(-4, 320, 1074, 680, "sprite/interface/lenheartwindowcommon.img", 0);
|
||||||
AddUIChild(CharacterMaskBox);
|
AddUIChild(CharacterMaskBox);
|
||||||
|
|
||||||
|
|
||||||
|
for (local i = 0; i< 7; i++) {
|
||||||
|
//魔法阵
|
||||||
|
local Magic = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 10);
|
||||||
|
Magic.SetPosition(54 + (i * 142), 146);
|
||||||
|
CharacterMaskBox.Addchild(Magic);
|
||||||
|
|
||||||
|
//锁框
|
||||||
|
local LockBox = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 16);
|
||||||
|
LockBox.SetPosition(54 + (i * 142), 10);
|
||||||
|
CharacterMaskBox.Addchild(LockBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//逻辑入口
|
//逻辑入口
|
||||||
function Proc(Dt) {
|
function Proc(Dt) {
|
||||||
MusicLogic();
|
if (Visible) MusicLogic();
|
||||||
|
|
||||||
SyncPos(X, Y);
|
SyncPos(X, Y);
|
||||||
base.Proc(Dt);
|
base.Proc(Dt);
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ class _Yosin_MessageBox extends Yosin_Window {
|
||||||
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) {
|
confirmButton.OnClick = function(Button) {
|
||||||
//关闭本窗口
|
//关闭本窗口
|
||||||
CloseWindow();
|
DestroyWindow();
|
||||||
}.bindenv(this);
|
}.bindenv(this);
|
||||||
AddUIChild(confirmButton);
|
AddUIChild(confirmButton);
|
||||||
|
|
||||||
|
|
@ -99,7 +99,7 @@ class _Yosin_MessageBox extends Yosin_Window {
|
||||||
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) {
|
closeButton.OnClick = function(Button) {
|
||||||
//关闭本窗口
|
//关闭本窗口
|
||||||
CloseWindow();
|
DestroyWindow();
|
||||||
}.bindenv(this);
|
}.bindenv(this);
|
||||||
AddUIChild(closeButton);
|
AddUIChild(closeButton);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
文件名:enum_music.nut
|
||||||
|
路径:User/_ENUM/enum_music.nut
|
||||||
|
创建日期:2024-12-19 01:36
|
||||||
|
文件用途:枚举音乐
|
||||||
|
*/
|
||||||
|
enum MUSIC {
|
||||||
|
M_CHARACTER_SELECT = "music/characterSelectStage.ogg"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
enum SOUND {
|
||||||
|
BUTTON_01 = "sounds/UI/button_01.ogg"
|
||||||
|
BUTTON_02 = "sounds/UI/button_02.ogg"
|
||||||
|
BUTTON_03 = "sounds/UI/button_03.ogg"
|
||||||
|
BUTTON_04 = "sounds/UI/button_04.ogg"
|
||||||
|
BUTTON_05 = "sounds/UI/button_05.ogg"
|
||||||
|
BUTTON_06 = "sounds/UI/button_06.ogg"
|
||||||
|
CLICK_BUTTON1 = "sounds/UI/click1.ogg"
|
||||||
|
CLICK_BUTTON2 = "sounds/UI/click2.ogg"
|
||||||
|
CLICK_BUTTON3 = "sounds/UI/click3.ogg"
|
||||||
|
CLICK_BUTTON4 = "sounds/UI/click4.ogg"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
文件名:enum_packet.nut
|
||||||
|
路径:User/_ENUM/enum_packet.nut
|
||||||
|
创建日期:2024-12-18 18:44
|
||||||
|
文件用途:包ID枚举
|
||||||
|
*/
|
||||||
|
enum PACKET_ID {
|
||||||
|
// 登录
|
||||||
|
LOGIN = 1
|
||||||
|
//注册
|
||||||
|
REGISTER = 3
|
||||||
|
//修改密码
|
||||||
|
CHANGE_PASSWORD = 5
|
||||||
|
//查询账号中的角色列表
|
||||||
|
QUERY_CHARACTER_LIST = 9
|
||||||
|
//更换角色位置
|
||||||
|
CHANGE_CHARACTER_POSITION = 13
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
/*
|
||||||
|
文件名:global_object.nut
|
||||||
|
路径:User/_ENUM/global_object.nut
|
||||||
|
创建日期:2024-12-18 19:03
|
||||||
|
文件用途:全局对象
|
||||||
|
*/
|
||||||
|
|
||||||
|
//客户端角色对象
|
||||||
|
ClientCharacter <- null;
|
||||||
|
|
@ -176,8 +176,22 @@
|
||||||
"User/UI/Window/1_Select_Character.nut": {
|
"User/UI/Window/1_Select_Character.nut": {
|
||||||
"description": "选择角色界面"
|
"description": "选择角色界面"
|
||||||
},
|
},
|
||||||
|
"User/UI/Widget/Text_Button.nut": {
|
||||||
|
"description": "文本按钮"
|
||||||
|
},
|
||||||
"User/UI/Window/2_Create_Character.nut": {
|
"User/UI/Window/2_Create_Character.nut": {
|
||||||
"description": "创建角色"
|
"description": "创建角色"
|
||||||
|
},
|
||||||
|
"User/UI/Widget/IMouse.nut": {
|
||||||
|
"description": "鼠标"
|
||||||
|
},
|
||||||
|
"User/_ENUM/enum_packet.nut": {
|
||||||
|
"description": "包枚举"
|
||||||
|
},
|
||||||
|
"User/_ENUM/global_object.nut": {
|
||||||
|
"description": "全局对象表"
|
||||||
|
},
|
||||||
|
"User/_ENUM/enum_music.nut": {
|
||||||
|
"description": "音乐枚举"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue