feat(偷窃系统): 实现偷窃系统基础功能
- 添加偷窃系统配置文件及脚本入口 - 实现NPC交互菜单和偷窃功能逻辑 - 添加网络通信协议处理 - 初始化偷窃配置数据并注册NPC交互 - 完善偷窃解锁动画和状态管理
This commit is contained in:
@@ -128,6 +128,18 @@
|
|||||||
"ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png"
|
"ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"偷窃系统": {
|
||||||
|
"Private": true,
|
||||||
|
"Script": [
|
||||||
|
"Project/Steal/Steal.nut"
|
||||||
|
],
|
||||||
|
"info": {
|
||||||
|
"ProjectAuthor": "官方 (期限:月)",
|
||||||
|
"ProjectVersion": "1.0.0",
|
||||||
|
"ProjectDescribe": "偷窃系统",
|
||||||
|
"ImageMini": "http://49.234.27.222:8651/dps/download2/Image:chengjiu.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
"异界装备升级": {
|
"异界装备升级": {
|
||||||
"Private": true,
|
"Private": true,
|
||||||
"Enabled": false,
|
"Enabled": false,
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ class StealC extends LenheartNewUI_Windows {
|
|||||||
// NoWindow = true;
|
// NoWindow = true;
|
||||||
|
|
||||||
//是否可见
|
//是否可见
|
||||||
// Visible = false;
|
Visible = false;
|
||||||
|
|
||||||
Img = Rindro_Image("steal/widget.img");
|
Img = Rindro_Image("steal/widget.img");
|
||||||
|
|
||||||
@@ -168,6 +168,9 @@ class StealC extends LenheartNewUI_Windows {
|
|||||||
UnlockAniFinished = false;
|
UnlockAniFinished = false;
|
||||||
UnlockFinalizeDone = false;
|
UnlockFinalizeDone = false;
|
||||||
UnlockAniFrameDelay = 60;
|
UnlockAniFrameDelay = 60;
|
||||||
|
NPCList = null;
|
||||||
|
RequestNpcId = -1;
|
||||||
|
NpcEachRegistered = false;
|
||||||
|
|
||||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||||
Childrens = [];
|
Childrens = [];
|
||||||
@@ -177,6 +180,19 @@ class StealC extends LenheartNewUI_Windows {
|
|||||||
|
|
||||||
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||||
RefreshUnlockComplete();
|
RefreshUnlockComplete();
|
||||||
|
InitStealConfig();
|
||||||
|
RegisterStealNpcEach();
|
||||||
|
|
||||||
|
RegisterPack(21017002, function(Chunk) {
|
||||||
|
local Jso = Json.Decode(Chunk);
|
||||||
|
if (Jso.rawin("ret") && Jso.ret == true) {
|
||||||
|
ResetStealSession();
|
||||||
|
Visible = true;
|
||||||
|
ResetFocus();
|
||||||
|
} else {
|
||||||
|
Visible = false;
|
||||||
|
}
|
||||||
|
}.bindenv(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
function RegisterWidget() {
|
function RegisterWidget() {
|
||||||
@@ -193,8 +209,87 @@ class StealC extends LenheartNewUI_Windows {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//绘制主界面
|
//绘制主界面
|
||||||
|
function InitStealConfig() {
|
||||||
|
NPCList = [];
|
||||||
|
Rindro_Script.GetFileData("etc/steal.etc", function(DataTable, Data) {
|
||||||
|
while (!Data.Eof()) {
|
||||||
|
local Fragment = Data.Get();
|
||||||
|
if (Fragment == "[npc list]") {
|
||||||
|
while (true) {
|
||||||
|
local Value = Data.Get();
|
||||||
|
if (Value == "[/npc list]") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
local NpcId = Value;
|
||||||
|
try {
|
||||||
|
NpcId = Value.tointeger();
|
||||||
|
} catch (exception) {}
|
||||||
|
NPCList.append(NpcId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.bindenv(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
function RegisterStealNpcEach() {
|
||||||
|
if (NpcEachRegistered) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!NPCList || NPCList.len() <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
local RootTab = getroottable();
|
||||||
|
local EachManager = null;
|
||||||
|
if (RootTab.rawin("L_Each_Obj")) {
|
||||||
|
EachManager = RootTab["L_Each_Obj"];
|
||||||
|
} else if (RootTab.rawin("Lenheart_Get_EachObj")) {
|
||||||
|
EachManager = RootTab["Lenheart_Get_EachObj"]();
|
||||||
|
}
|
||||||
|
if (!EachManager) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(id in NPCList) {
|
||||||
|
EachManager.AddEachForNpc(id, function(SThis) {
|
||||||
|
local StealButton = LenheartNewUI_Each_BaseButton(0, 0, 100, 21, "interface2/popup_menu/popup_back.img", 3);
|
||||||
|
StealButton.Icon = "interface2/popup_menu/popup_icon_cn.img";
|
||||||
|
StealButton.IconIdx = 27;
|
||||||
|
StealButton.Str = "偷窃";
|
||||||
|
StealButton.OnClick = function(Button) {
|
||||||
|
local NpcId = Button.Parent.NPC_Index;
|
||||||
|
RequestNpcId = NpcId;
|
||||||
|
Button.Parent.CloseAllEach();
|
||||||
|
Button.Parent.CloseWindow();
|
||||||
|
SendPackEx({
|
||||||
|
op = 21017001,
|
||||||
|
npcid = NpcId
|
||||||
|
});
|
||||||
|
}.bindenv(this);
|
||||||
|
StealButton.SetCallBackFunc(function(Button) {})
|
||||||
|
SThis.AddChild(StealButton);
|
||||||
|
}.bindenv(this));
|
||||||
|
}
|
||||||
|
NpcEachRegistered = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ResetStealSession() {
|
||||||
|
UnlockComplete = 0.0;
|
||||||
|
CorrectLockedCount = 0;
|
||||||
|
AllUnlockedTriggered = false;
|
||||||
|
|
||||||
|
UnlockAniPlaying = false;
|
||||||
|
UnlockAniFinished = false;
|
||||||
|
UnlockFinalizeDone = false;
|
||||||
|
UnlockSuccessAni = null;
|
||||||
|
|
||||||
|
AniQueue = QuestQueue();
|
||||||
|
|
||||||
|
Childrens = [];
|
||||||
|
RegisterWidget();
|
||||||
|
RefreshUnlockComplete();
|
||||||
|
}
|
||||||
|
|
||||||
function GetLockTopY() {
|
function GetLockTopY() {
|
||||||
return Y + 268 + 60;
|
return Y + 268 + 60;
|
||||||
}
|
}
|
||||||
@@ -294,13 +389,17 @@ class StealC extends LenheartNewUI_Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function SendStealUnlockPack() {
|
function SendStealUnlockPack() {
|
||||||
// TODO: fill op and fields when server protocol is finalized.
|
if (RequestNpcId == null || RequestNpcId <= 0) {
|
||||||
// SendPackEx({ op = xxxx });
|
return;
|
||||||
|
}
|
||||||
|
SendPackEx({
|
||||||
|
op = 21017003,
|
||||||
|
npcid = RequestNpcId
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function OnAllUnlockedInternal() {
|
function OnAllUnlockedInternal() {
|
||||||
R_Utils.PlaySound("GAMBLE_RESULT_GOOD");
|
R_Utils.PlaySound("GAMBLE_RESULT_GOOD");
|
||||||
print("Steal all unlocked: " + CorrectLockedCount);
|
|
||||||
StartUnlockSuccessSequence();
|
StartUnlockSuccessSequence();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,6 +486,9 @@ class StealC extends LenheartNewUI_Windows {
|
|||||||
//逻辑入口
|
//逻辑入口
|
||||||
function Proc(obj) {
|
function Proc(obj) {
|
||||||
LenheartNewUI_Windows.SyncPos(X, Y);
|
LenheartNewUI_Windows.SyncPos(X, Y);
|
||||||
|
if (!NpcEachRegistered) {
|
||||||
|
RegisterStealNpcEach();
|
||||||
|
}
|
||||||
CheckSpaceLock();
|
CheckSpaceLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,7 +504,6 @@ getroottable().rawdelete("L_Each_Obj");
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Lenheart_Steal_Fun(obj) {
|
function Lenheart_Steal_Fun(obj) {
|
||||||
local RootTab = getroottable();
|
local RootTab = getroottable();
|
||||||
if (!RootTab.rawin("Steal_Obj")) {
|
if (!RootTab.rawin("Steal_Obj")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user