- add MeshPort peer-to-peer overlay networking SDK, C++ integration, and Python bindings - add item actions quick use/split/delete/lock overlay window (mt_item_actions) - add shop name range and NPC name visibility settings to system display options - support battlepass ticket activation and month validation in mt_battlepass - support boss tracking teleport destination button in mt_bosses - support asynchronous account registration cancellation and pending login cancellation - update AVA2 item conversion for attr lock scrolls and battlepass tickets - update .gitignore for local build outputs and caches
53 lines
1.9 KiB
C++
53 lines
1.9 KiB
C++
// PORT: native transport owns routing; Python displays status and handles pending-login cancellation.
|
|
static const char* c_szMeshPortScript = R"PY(# -*- coding: utf-8 -*-
|
|
import app
|
|
import ui
|
|
import wndMgr
|
|
import player
|
|
import introLogin
|
|
import net
|
|
import _mt_meshport as native
|
|
|
|
|
|
class NetworkNotice(ui.Window):
|
|
def __init__(self):
|
|
ui.Window.__init__(self)
|
|
self.label = ui.TextLine()
|
|
self.label.SetHorizontalAlignCenter()
|
|
self.hideAt = 0
|
|
self.Show()
|
|
|
|
def OnUpdate(self):
|
|
event = native.event()
|
|
if event:
|
|
messages = {1: '正在组网,等待动态分配 IP...',
|
|
2: '组网成功', 3: '组网连接失败,请检查网络后重试'}
|
|
self.label.SetText(player.AutoHuntLocalize(messages[event]))
|
|
self.label.SetPackedFontColor(0xff66ee88 if event == 2 else 0xffffdd77)
|
|
self.label.SetPosition(wndMgr.GetScreenWidth() / 2, 32)
|
|
self.label.Show()
|
|
self.label.SetTop()
|
|
self.hideAt = app.GetTime() + (65 if event == 1 else 6)
|
|
if self.hideAt and app.GetTime() >= self.hideAt:
|
|
self.label.Hide()
|
|
self.hideAt = 0
|
|
|
|
|
|
notice = NetworkNotice()
|
|
|
|
# Original login popup uses the focus callback for its Cancel button. Stop only
|
|
# the account/game transports still preparing; leave established sessions and
|
|
# background channel queries alone. No credentials or Connect methods are wrapped.
|
|
def _wrap_cancel(method):
|
|
def Cancel(self, *args):
|
|
if net.CancelPendingLogin():
|
|
notice.label.Hide()
|
|
notice.hideAt = 0
|
|
return method(self, *args)
|
|
return Cancel
|
|
|
|
introLogin.LoginWindow.SetPasswordEditLineFocus = _wrap_cancel(introLogin.LoginWindow.SetPasswordEditLineFocus)
|
|
introLogin.LoginWindow.OnPressExitKey = _wrap_cancel(introLogin.LoginWindow.OnPressExitKey)
|
|
introLogin.LoginWindow.Close = _wrap_cancel(introLogin.LoginWindow.Close)
|
|
)PY";
|