Merge remote-tracking branch 'origin/dong' into yi

This commit is contained in:
WONIU 2024-12-27 15:37:09 +08:00
commit e22be02576
12 changed files with 194 additions and 154 deletions

Binary file not shown.

BIN
ffi-8.dll

Binary file not shown.

View File

@ -9,41 +9,6 @@ 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对象
@ -75,16 +40,11 @@ class TextActor extends CL_BaseObject {
//设置文本内容
function SetText(str) {
TextActor_SetText(this.C_Object, str);
if (OutlineChild) {
foreach(obj in OutlineChild) {
obj.SetText(str);
}
}
}
//设置描边
function SetOutline(width, color = Color.Black, cap = CapStyle.Square, line_join = LineJoinStyle.Round, dash = DashStyle.Solid) {
TextActor_SetOutLine(this.C_Object, width, color, cap, line_join, dash);
function SetOutline(color = Color.Black, flag = true) {
TextActor_SetOutLine(this.C_Object, color, flag);
}
// //设置描边

View File

@ -211,6 +211,8 @@ class Yosin_Window extends Yosin_BaseWindow {
//是否为独立窗口
IsIndependent = true;
//是否为顶层窗口
IsTop = false;
//是否为图层窗口
IsLayer = false;
@ -241,14 +243,14 @@ class Yosin_Window extends Yosin_BaseWindow {
this.Visible = true;
//遍历全局窗口数组将自己移除重新添加在末尾
foreach(Index, WindowObj in _SYS_WINDOW_LIST_) {
WindowObj.SetZOrder(10000000 + Index);
WindowObj.SetZOrder(10000000 + Index + (WindowObj.IsTop ? 10000000 : 0));
if (WindowObj.ObjectId == this.ObjectId) {
_SYS_WINDOW_LIST_.remove(Index);
break;
}
}
_SYS_WINDOW_LIST_.append(this);
SetZOrder(10000000 + _SYS_WINDOW_LIST_.len());
SetZOrder(10000000 + _SYS_WINDOW_LIST_.len() + (IsTop ? 10000000 : 0));
}
/*

View File

@ -369,11 +369,10 @@ class Character_Animation extends Actor {
//初始化名字
function InitName() {
//创建名字对象
Name = FontAssetManager.GenerateNormal("", false, {
Name = FontAssetManager.GenerateNormal("", true, {
color = sq_RGBA(209, 185, 148, 255),
alignment = TextAlign.Center
});
Name.SetPosition(ENUM_RINDRO_JOB_TITLE_HEIGHT[Parent.Job]);
Name.SetPosition(ENUM_RINDRO_JOB_TITLE_HEIGHT[Parent.Job].x, ENUM_RINDRO_JOB_TITLE_HEIGHT[Parent.Job].y);
Name.SetZOrder(80000);
Addchild(Name);
}

View File

@ -10,8 +10,8 @@ class _FontAssetManager_ {
//初始化字体
function InitFont() {
//普通宋体小字
Font.PreLoad("Fonts/GasinamuNew.ttf");
Font("gasinamuM", 11.5).Register(0);
Font.PreLoad("Fonts/Gasinamu.ttf");
Font("gasinamu", 11.5).Register(0);
}
constructor() {
@ -28,7 +28,7 @@ class _FontAssetManager_ {
local TextActor = TextActor(0, style);
TextActor.SetText(text);
if (stroke)
TextActor.SetOutline(3.0);
TextActor.SetOutline();
return TextActor;
}
}

View File

@ -23,6 +23,8 @@ function InitGame() {
_IMouse_();
//初始化控制器
_GameController_();
//初始化顶部工具条UI
Sq_CreateWindow(_Top_tool, "窗口顶部工具条", 208, 0, 650, 20, 0);
//预加载
Animation("ui/charactercreate/dust.ani");

View File

@ -10,59 +10,71 @@ function TestStage() {
T.Enter();
// local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
// //大背景
// local BackGround = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbackground.img", 14);
// 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 TownObj = Town(2);
// 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 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);
// 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);
// local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0);
// local T = {
// loginImg = 1,
// charac = [{
// lv = 90,
// name = "测试角色1",
// job = 0,
// equip = [101020001, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023, 609590003]
// }, {
// lv = 90,
// name = "测试角色2",
// job = 0,
// equip = [101020023, 601500059, 601550059, 601560057, 601570052, 601520051, 601500059, 601510058, 601530050, 601540059, 601580022, 609590003]
// }, {
// lv = 90,
// name = "测试角色3",
// job = 0,
// equip = [101020026, 601500058, 601550058, 601560056, 601570051, 601520050, 601500058, 601510057, 601530049, 601540058, 601580021, 609590003]
// }, {
// lv = 90,
// name = "测试角色4",
// job = 0,
// equip = [101020037, 601500061, 601550061, 601560059, 601570054, 601520053, 601500061, 601510060, 601530052, 601540061, 601580024, 609590003]
// }, {
// lv = 90,
// name = "测试角色5",
// 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);

View File

@ -213,8 +213,8 @@ class _Select_Character_Chr extends Yosin_CommonUi {
local Charc = GameObject.CreateCharacter(Info.job, Info.equip);
Charc.SetAnimation("RestAni");
Charc.SetPosition(64, 156, 0);
Charc.SetName(Info.lv + "级 " + Info.name);
Charc.AnimationManager.Name.MoveBy(0, 180);
Charc.SetName(Info.lv + " 级 " + Info.name);
Charc.AnimationManager.Name.MoveBy(21 - Charc.AnimationManager.Name.GetSize().w / 2, 180);
Addchild(Charc);
}

View File

@ -14,7 +14,7 @@ enum BottomLightAniType {
}
// 获取职业信息
function getJobInfo( job ) {
function getJobInfo(job) {
local T = {};
switch (job) {
case CHARACTERJOB.SWORDMAN: // 男鬼剑士 d
@ -200,7 +200,7 @@ function getJobInfo( job ) {
function getJobEnum(index) {
local jobList = [CHARACTERJOB.SWORDMAN, CHARACTERJOB.AT_SWORDMAN, CHARACTERJOB.AT_FIGHTER, CHARACTERJOB.FIGHTER, CHARACTERJOB.GUNNER, CHARACTERJOB.AT_GUNNER, CHARACTERJOB.AT_MAGE, CHARACTERJOB.MAGE, CHARACTERJOB.PRIEST, CHARACTERJOB.AT_PRIEST, CHARACTERJOB.THIEF, CHARACTERJOB.KNIGHT, CHARACTERJOB.DEMONIC_LANCER, CHARACTERJOB.GUN_BLADER, CHARACTERJOB.ARCHER, CHARACTERJOB.DEMONIC_SWORDMAN,CHARACTERJOB.CREATOR_MAGE ];
local jobList = [CHARACTERJOB.SWORDMAN, CHARACTERJOB.AT_SWORDMAN, CHARACTERJOB.AT_FIGHTER, CHARACTERJOB.FIGHTER, CHARACTERJOB.GUNNER, CHARACTERJOB.AT_GUNNER, CHARACTERJOB.AT_MAGE, CHARACTERJOB.MAGE, CHARACTERJOB.PRIEST, CHARACTERJOB.AT_PRIEST, CHARACTERJOB.THIEF, CHARACTERJOB.KNIGHT, CHARACTERJOB.DEMONIC_LANCER, CHARACTERJOB.GUN_BLADER, CHARACTERJOB.ARCHER, CHARACTERJOB.DEMONIC_SWORDMAN, CHARACTERJOB.CREATOR_MAGE];
return jobList[index];
}
@ -249,12 +249,12 @@ class _CreateCharacter extends Yosin_Window {
// 创建角色回包
MySocket.RegisterHandler(4, function(Jso) {
if (NoticeBox) NoticeBox.CloseWindow();
if (Jso.type == 0){
if (Jso.type == 0) {
// 创建成功.
//关闭创建界面
NoticeBox.DestroyWindow();
DestroyWindow();
}else{
} else {
// 创建失败.
NoticeBox = _Yosin_MessageBox("创建失败.");
}
@ -319,12 +319,12 @@ class _CreateCharacter extends Yosin_Window {
headList.OnClick = changJob.bindenv(this);
// 职业介绍
infoWidget = _CreateCharacter_SelectBaseInfo(140, 400);
infoWidget = _CreateCharacter_SelectBaseInfo(140, 400);
AddUIChild(infoWidget);
infoWidget.SetJob(getJobInfo(CHARACTERJOB.SWORDMAN));
// 创建职业
infoWidget.OnClick = function () {
infoWidget.OnClick = function() {
enter.SetVisible(true);
}.bindenv(this);
@ -359,7 +359,7 @@ class _CreateCharacter extends Yosin_Window {
AddUIChild(enter);
// 确定
enter.OnClick = function (enterName) {
enter.OnClick = function(enterName) {
local jobEnum = getJobEnum(jobIndex);
MySocket.Send(7, {
name = enterName,
@ -391,7 +391,7 @@ class _CreateCharacter extends Yosin_Window {
dustAni.SetVisible(false);
auraAni.SetVisible(false);
switch (info.ani){
switch (info.ani) {
case BottomLightAniType.light:
lightAni.SetVisible(true);
break;
@ -407,7 +407,7 @@ class _CreateCharacter extends Yosin_Window {
// 开始切换动画
if (changJobAniClock == null) {
if (changJobAniClock == null) {
changJobAniClock = clock();
}
changNextJobAniClock = clock();
@ -422,7 +422,7 @@ class _CreateCharacter extends Yosin_Window {
return;
}
}else {
} else {
if (changJobAniClock == null) {
print("NUll");
return;
@ -431,14 +431,14 @@ class _CreateCharacter extends Yosin_Window {
// 动画的前90%后10%,慢
local ani_progress = Math.sq_GetAccel(0, 100, clock() - (next ? changNextJobAniClock : changJobAniClock), 0.3, false);
if (ani_progress >= 90){
ani_progress = Math.sq_GetAccel(0, 10, clock() - (next ? changNextJobAniClock : changJobAniClock), 0.7, false) + 90 ;
if (ani_progress >= 90) {
ani_progress = Math.sq_GetAccel(0, 10, clock() - (next ? changNextJobAniClock : changJobAniClock), 0.7, false) + 90;
}
local x = ani_progress * 5.0;
if (progressBlock != null) progressBlock(ani_progress);
if (ani_progress >= 100){
if (ani_progress >= 100) {
if (doneBlock != null) doneBlock();
}
}
@ -449,11 +449,11 @@ class _CreateCharacter extends Yosin_Window {
changJobAniController(function(ani_progress) {
local x = ani_progress * 5.0;
jobImg.SetPosition( 0 - x, 0);
jobImg.SetOpacity( (100.0 - ani_progress.tofloat()) / 100.0 );
}.bindenv(this), function () {
jobImg.SetPosition(0 - x, 0);
jobImg.SetOpacity((100.0 - ani_progress.tofloat()) / 100.0);
}.bindenv(this), function() {
changJobAniClock = null;
}.bindenv(this),false );
}.bindenv(this), false);
}
// 切换职业动画
@ -469,23 +469,23 @@ class _CreateCharacter extends Yosin_Window {
// 动画的前90%透明度进度为50%后10%透明度进度为剩下的50%
local opacity = ani_progress.tofloat() / 180.0;
if (opacity > 0.5) opacity = (ani_progress.tofloat() - 90.0) / 20.0 + 0.5;
nextJobImg.SetOpacity( opacity );
nextJobImg.SetOpacity(opacity);
}.bindenv(this), function () {
}.bindenv(this), function() {
changNextJobAniClock = null;
local jobEnum = getJobEnum(jobIndex);
jobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", jobEnum ));
jobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", jobEnum));
jobImg.SetOpacity(1);
jobImg.SetPosition(0, 0);
if (jobIndex < 16) {
if (jobIndex< 16) {
nextJobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", getJobEnum(jobIndex + 1)));
nextJobImg.SetOpacity(0);
nextJobImg.SetPosition(500, 0);
}
}.bindenv(this) );
}.bindenv(this));
}
@ -521,7 +521,7 @@ class _CreateCharacter_SelectBaseInfo extends Yosin_Window {
OnClick = null;
constructor(gX, gY ) {
constructor(gX, gY) {
base.constructor("创建角色职业介绍信息", gX, gY, 278, 600, 0);
// 职业图标
@ -565,8 +565,8 @@ class _CreateCharacter_SelectBaseInfo extends Yosin_Window {
}
function SetJob(jobInfoMap) {
icon.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/charactermark.img", jobInfoMap.index));
name.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/charctertitle.img", jobInfoMap.nameIndex));
icon.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/charactermark.img", jobInfoMap.index));
name.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/charctertitle.img", jobInfoMap.nameIndex));
jobInfo.SetText(jobInfoMap.info);
jobChangeText.SetText("■ 转职:" + jobInfoMap.changJob);
@ -596,7 +596,7 @@ class _CreateCharacter_SelectBaseHeadList extends Yosin_Window {
local headX = 0;
local headY = 0;
for (local i = 0; i < 17; i++) {
for (local i = 0; i< 17; i++) {
local jobEnum = getJobEnum(i);
local headButton = HeadButton(headX, headY, jobEnum, getJobInfo(jobEnum).name);
headButton.tag = i;
@ -611,14 +611,14 @@ class _CreateCharacter_SelectBaseHeadList extends Yosin_Window {
}
// 点击事件回调
for (local i = 0; i < buttonList.len(); i++) {
for (local i = 0; i< buttonList.len(); i++) {
local headButton = buttonList[i];
headButton.OnClick = function (b) {
headButton.OnClick = function(b) {
if (clickOff) return;
for (local t = 0; t < buttonList.len(); t++) {
for (local t = 0; t< buttonList.len(); t++) {
local button = buttonList[t];
button.state = 0;
button.ChangeFrame();
@ -681,7 +681,7 @@ class HeadButton extends Yosin_CommonUi {
base.constructor(X, Y, 62, 62);
// 角色头像
Character = CL_SpriteObject( "sprite/interface2/charactercreatever2/characterbtn.img", imageId)
Character = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbtn.img", imageId)
Character.SetPosition(0, 0);
Addchild(Character);
@ -689,10 +689,10 @@ class HeadButton extends Yosin_CommonUi {
jobNameText = FontAssetManager.GenerateNormal(name, true, {
color = sq_RGBA(194, 160, 53, 255)
});
jobNameText.SetPosition( 31 - jobNameText.GetSize().w / 2 , 45);
jobNameText.SetPosition(31 - jobNameText.GetSize().w / 2, 45);
Addchild(jobNameText);
CharacterCover = CL_SpriteObject( "sprite/interface2/charactercreatever2/characterbtn.img", 0)
CharacterCover = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbtn.img", 0)
CharacterCover.SetPosition(0, 0);
Addchild(CharacterCover);
@ -715,7 +715,7 @@ class HeadButton extends Yosin_CommonUi {
//不可用
if (state == 3) {
Character.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/characterbtn.img", imageId + 1));
Character.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/characterbtn.img", imageId + 1));
CharacterCover.SetVisible(false);
yellowBox.SetVisible(false);
blueBox.SetVisible(false);
@ -727,7 +727,7 @@ class HeadButton extends Yosin_CommonUi {
CharacterCover.SetVisible(false);
yellowBox.SetVisible(false);
blueBox.SetVisible(true);
}else{
} else {
CharacterCover.SetVisible(true);
yellowBox.SetVisible(false);
blueBox.SetVisible(false);
@ -806,7 +806,7 @@ class _create_Character_enterName extends Yosin_Window {
checkButton.SetUpdateFunc(function(button, Dt) {
if (button.Parent.name.len() > 0) {
button.State = 0;
}else{
} else {
button.State = 3;
}
})
@ -840,17 +840,17 @@ class _create_Character_enterName extends Yosin_Window {
affirmButton = Yosin_BaseButton(473, 338, 46, 24 "sprite/interface/lenheartwindowcommon.img", 400);
affirmButton.State = 3;
affirmButton.SetUpdateFunc(function(button, Dt) {
if (button.Parent.name != button.Parent.checkName && button.State != 3) {
if (button.Parent.name != button.Parent.checkName && button.State != 3) {
button.State = 3;
}
})
//点击事件回调
affirmButton.OnClick = function(Button) {
if (OnClick != null) OnClick(Button.Parent.checkName);
if (OnClick != null) OnClick(Button.Parent.checkName);
}.bindenv(this);
//按钮文本
local affirmTextActor = FontAssetManager.GenerateNormal("确认", true, {
color = sq_RGBA(153,128,71, 255)
color = sq_RGBA(153, 128, 71, 255)
});
affirmTextActor.SetPosition(11, 4);
affirmButton.Addchild(affirmTextActor);
@ -866,7 +866,7 @@ class _create_Character_enterName extends Yosin_Window {
}.bindenv(this);
//按钮文本
local cancelTextActor = FontAssetManager.GenerateNormal("取消", true, {
color = sq_RGBA(153,128,71, 255)
color = sq_RGBA(153, 128, 71, 255)
});
cancelTextActor.SetPosition(11, 4);
cancelButton.Addchild(cancelTextActor);
@ -878,12 +878,12 @@ class _create_Character_enterName extends Yosin_Window {
// 昵称重复检查回包
MySocket.RegisterHandler(3, function(Jso) {
if (Parent.NoticeBox) Parent.NoticeBox.CloseWindow();
if (Jso.type == 0){
if (Jso.type == 0) {
// 可以使用的ID 确认按钮可以使用.
Parent.NoticeBox = _Yosin_MessageBox("可以使用的ID.");
checkName = name;
affirmButton.State = 0;
}else{
} else {
// 名称重复.
Parent.NoticeBox = _Yosin_MessageBox("名称重复.");
}
@ -899,14 +899,4 @@ class _create_Character_enterName extends Yosin_Window {
}
}
}

View File

@ -7,11 +7,19 @@
class _Top_tool extends Yosin_Window {
//是否为独立窗口
IsIndependent = false;
timeTextActor = null;
//是否可见
// Visible = false;
//是否为顶层窗口
// IsTop = true;
//窗口位置
WindowPos = null;
WindowMoveFlag = false;
BaseCursorWPos = null;
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
@ -19,6 +27,8 @@ class _Top_tool extends Yosin_Window {
RegisterDraw();
//注册控件
RegisterWidget();
WindowPos = Sq_GetWindowRect();
}
function RegisterWidget() {
@ -43,12 +53,21 @@ class _Top_tool extends Yosin_Window {
// 最小化
local minButton = _Top_tool_Button(576, 1, 22, 16 "sprite/interface/lenheartwindowcommon.img", 618);
minButton.OnClick = function(Button) {
Sq_ShowWindow(6);
}.bindenv(this);
AddUIChild(minButton);
// 最大化
local maxButton = _Top_tool_Button(598, 1, 22, 16 "sprite/interface/lenheartwindowcommon.img", 628);
maxButton.OnClick = function(Button) {
Sq_ShowWindow(3);
}.bindenv(this);
AddUIChild(maxButton);
// 关闭
local closeButton = _Top_tool_Button(620, 1, 22, 16 "sprite/interface/lenheartwindowcommon.img", 624);
closeButton.OnClick = function(Button) {
Sq_CloseWindow();
}.bindenv(this);
AddUIChild(closeButton);
}
@ -63,7 +82,7 @@ class _Top_tool extends Yosin_Window {
local timeStr = "";
if (date.hour >= 12) {
timeStr = "PM " + (date.hour - 12).tostring() + ":" + date.min.tostring();
}else{
} else {
timeStr = "AM " + date.hour.tostring() + ":" + date.min.tostring();
}
return timeStr;
@ -75,12 +94,70 @@ class _Top_tool extends Yosin_Window {
SyncPos(X, Y);
base.Proc(Dt);
if (time() % 60 == 0){
if (time() % 60 == 0) {
timeTextActor.SetText(getTimeString());
}
//如果事件在窗口内
if (Math.IsIntersectRect(Yosin_Cursor.X, Yosin_Cursor.Y, 1, 1, X, Y, Width, Height)) {
if (!Visible) ResetFocus();
} else {
Visible = false;
}
}
//override
//鼠标事件回调
function OnMouseProc(MousePos_X, MousePos_Y) {
base.OnMouseProc(MousePos_X, MousePos_Y);
//设定拖动逻辑
if (WindowMoveFlag) {
local pos = Sq_GetCursorPos();
local WX = pos.x - M_Xpos;
local WY = pos.y - M_Ypos;
M_Xpos = pos.x;
M_Ypos = pos.y;
WindowPos.left += WX;
WindowPos.top += WY;
Sq_SetCursorPos(WindowPos.left + BaseCursorWPos.x, WindowPos.top + BaseCursorWPos.y);
Sq_SetWindowPos(WindowPos.left, WindowPos.top);
}
}
//override
//鼠标左键单击回调
function OnMouseLbDown(MousePos_X, MousePos_Y) {
base.OnMouseLbDown(MousePos_X, MousePos_Y);
//如果点击事件在窗口内
if (Math.IsIntersectRect(Yosin_Cursor.X, Yosin_Cursor.Y, 1, 1, X, Y, Width, Height)) {
WindowMoveFlag = true;
local pos = Sq_GetCursorPos();
M_Xpos = pos.x; //原始鼠标位置数据
M_Ypos = pos.y;
BaseCursorWPos = {
x = MousePos_X,
y = MousePos_Y
};
}
}
//override
//鼠标左键弹起回调
function OnMouseLbUp(MousePos_X, MousePos_Y) {
//调用原生方法
base.OnMouseLbUp(MousePos_X, MousePos_Y);
if (WindowMoveFlag) {
WindowMoveFlag = false;
M_Xpos = null;
M_Ypos = null;
BaseCursorWPos = null;
}
}
}
@ -102,7 +179,4 @@ class _Top_tool_Button extends Yosin_BaseButton {
border.SetVisible(isLBDown);
}
}
}

View File

@ -10,6 +10,7 @@
function main(args) {
local Game = GameWindow();
Game.title = "Yosin & Kiwano";
Game.bg_color = [255.0, 255.0, 255.0, 255.0];