|
3金锭
问题大体:我做了一个UI,按照教程里面注册,创建UI,但是UI并没在游戏中正常显示。于是乎我就加了许多logger.info来调试代码,嘿您猜怎么着,客户端init的输出都给他吞了。代码见下,谁能帮我看看QWQ
# -*- coding: utf-8 -*-
import mod.client.extraClientApi as clientApi
ClientSystem = clientApi.GetClientSystemCls()
from modCommon.modConfig import ModName,ModVersion,ServerSystemName,ServerSystemClsPath,ClientSystemName,ClientSystemClsPath,MarkpointUIName,MarkpointUIPyClsPath,MarkpointUIScreenDef
from mod_log import logger as logger
namespace = clientApi.GetEngineNamespace()
system_name = clientApi.GetEngineSystemName()
class MarkpointClientSystem(ClientSystem):
def __init__(self,namespace,system_name):
super(MarkpointClientSystem, self).__init__(self,namespace,system_name)
logger.info("=====Init MarkpointClientSystem=====")# 这里这个根本没有输出!
self.ListenEvent()
def ListenEvent(self):
self.ListenForEvent(namespace, system_name, 'UiInitFinished', self, self.OnUiInitFinished)
def UnListenEvent(self):
self.UnListenForEvent(namespace, system_name, 'UiInitFinished', self, self.OnUiInitFinished)
def OnUiInitFinished(self, args):
logger.info("=====UIInitFinished=====")
clientApi.RegisterUI(ModName, MarkpointUIName, MarkpointUIPyClsPath, MarkpointUIScreenDef)
logger.info("=====UI Registered Successfully=====")
self.mMarkpointUINode = clientApi.CreateUI(ModName, MarkpointUIName,{})
if self.mMarkpointUINode:
logger.info("=====Markpoint UI Node Created=====")
self.mMarkpointUINode.Init()
else:
logger.error("=====Markpoint UI Node Failed to Get=====")
def Destroy(self):
logger.info("=====Destroy MarkpointClientSystem=====")
self.UnListenEvent()球球各位大佬帮我看看,主要是我没看到什么错误,UI方法应该是对的但是疑惑的点在于这个客户端代码都没有被执行……跟其他代码有关系吗(比如modMain?
|
最佳答案
查看完整内容
ui脚本文件名、类名、ui名好像有要求是要一致的
检查下RegisterUI的参数有没有传对,MarkpointUIScreenDef是什么,这里应该是要指向ui的根节点,例如新建的ui0,好像就是ui0.main
|