159 lines
3.4 KiB
C
159 lines
3.4 KiB
C
|
|
#pragma once
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
|
|||
|
|
static SQInteger Create_Button(HSQUIRRELVM v)
|
|||
|
|
{
|
|||
|
|
SQInteger Top = sq_gettop(v);
|
|||
|
|
if (Top <= 0)
|
|||
|
|
{
|
|||
|
|
sq_throwerror(v, _SST("Incorrect function argument"));
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SquirrelButtonPtr Button = new SquirrelButton();
|
|||
|
|
|
|||
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΨһID
|
|||
|
|
uint64_t UUID = Button->GetObjectID();
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Map<61><70><EFBFBD><EFBFBD>
|
|||
|
|
ActorPtrMapObject[UUID] = Button;
|
|||
|
|
|
|||
|
|
sq_pushinteger(v, UUID);
|
|||
|
|
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ð<EFBFBD>ť״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
|||
|
|
static SQInteger Button_Load_Texture(HSQUIRRELVM v)
|
|||
|
|
{
|
|||
|
|
SQInteger Top = sq_gettop(v);
|
|||
|
|
if (Top <= 0)
|
|||
|
|
{
|
|||
|
|
sq_throwerror(v, _SST("Incorrect function argument"));
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SQInteger ActorUUID;
|
|||
|
|
sq_getinteger(v, 2, &ActorUUID);
|
|||
|
|
|
|||
|
|
const SQChar* Path;
|
|||
|
|
sq_getstring(v, 3, &Path);
|
|||
|
|
|
|||
|
|
SQInteger Frame;
|
|||
|
|
sq_getinteger(v, 4, &Frame);
|
|||
|
|
|
|||
|
|
if (ActorPtrMapObject.count(ActorUUID)) {
|
|||
|
|
SquirrelButtonPtr Button = dynamic_cast<SquirrelButton*>(ActorPtrMapObject[ActorUUID].Get());
|
|||
|
|
|
|||
|
|
TexturePtr t = SquirrelClassEx::GetTexturePtrByImg((char*)Path, Frame);
|
|||
|
|
Button->SetFrame(t);
|
|||
|
|
sq_pushbool(v, true);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
sq_pushbool(v, false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ť
|
|||
|
|
static SQInteger Button_Init(HSQUIRRELVM v)
|
|||
|
|
{
|
|||
|
|
SQInteger Top = sq_gettop(v);
|
|||
|
|
if (Top <= 0)
|
|||
|
|
{
|
|||
|
|
sq_throwerror(v, _SST("Incorrect function argument"));
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SQInteger ActorUUID;
|
|||
|
|
sq_getinteger(v, 2, &ActorUUID);
|
|||
|
|
|
|||
|
|
if (ActorPtrMapObject.count(ActorUUID)) {
|
|||
|
|
SquirrelButtonPtr Button = dynamic_cast<SquirrelButton*>(ActorPtrMapObject[ActorUUID].Get());
|
|||
|
|
Button->Init();
|
|||
|
|
sq_pushbool(v, true);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
sq_pushbool(v, false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F>жϰ<D0B6>ť<EFBFBD>Ƿ<C7B7><F1B1BBB5><EFBFBD>
|
|||
|
|
static SQInteger Button_IsPress(HSQUIRRELVM v)
|
|||
|
|
{
|
|||
|
|
SQInteger Top = sq_gettop(v);
|
|||
|
|
if (Top <= 0)
|
|||
|
|
{
|
|||
|
|
sq_throwerror(v, _SST("Incorrect function argument"));
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SQInteger ActorUUID;
|
|||
|
|
sq_getinteger(v, 2, &ActorUUID);
|
|||
|
|
|
|||
|
|
SQInteger Type;
|
|||
|
|
sq_getinteger(v, 3, &Type);
|
|||
|
|
|
|||
|
|
if (ActorPtrMapObject.count(ActorUUID)) {
|
|||
|
|
SquirrelButtonPtr Button = dynamic_cast<SquirrelButton*>(ActorPtrMapObject[ActorUUID].Get());
|
|||
|
|
sq_pushbool(v, Button->IsPress(Type));
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
sq_pushnull(v);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>жϰ<D0B6>ť<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ͣ
|
|||
|
|
static SQInteger Button_IsHover(HSQUIRRELVM v)
|
|||
|
|
{
|
|||
|
|
SQInteger Top = sq_gettop(v);
|
|||
|
|
if (Top <= 0)
|
|||
|
|
{
|
|||
|
|
sq_throwerror(v, _SST("Incorrect function argument"));
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SQInteger ActorUUID;
|
|||
|
|
sq_getinteger(v, 2, &ActorUUID);
|
|||
|
|
|
|||
|
|
if (ActorPtrMapObject.count(ActorUUID)) {
|
|||
|
|
SquirrelButtonPtr Button = dynamic_cast<SquirrelButton*>(ActorPtrMapObject[ActorUUID].Get());
|
|||
|
|
sq_pushbool(v, Button->IsHover());
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
sq_pushnull(v);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>Ƴ<EFBFBD><C6B3>Լ<EFBFBD><D4BC><EFBFBD>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
static SQInteger Button_RemoveZorder(HSQUIRRELVM v)
|
|||
|
|
{
|
|||
|
|
SQInteger Top = sq_gettop(v);
|
|||
|
|
if (Top <= 0)
|
|||
|
|
{
|
|||
|
|
sq_throwerror(v, _SST("Incorrect function argument"));
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SQInteger ActorUUID;
|
|||
|
|
sq_getinteger(v, 2, &ActorUUID);
|
|||
|
|
|
|||
|
|
if (ActorPtrMapObject.count(ActorUUID)) {
|
|||
|
|
SquirrelButtonPtr Button = dynamic_cast<SquirrelButton*>(ActorPtrMapObject[ActorUUID].Get());
|
|||
|
|
Button->RemoveZorder();
|
|||
|
|
sq_pushbool(v, true);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
sq_pushnull(v);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return 1;
|
|||
|
|
}
|