def __init__(self, namespace, systemName): # 首先初始化TutorialClientSystem的基类ClientSystem super(PeaceClientSystem, self).__init__(namespace, systemName) self.DefineEvent(CLIENT_SHOOT_EVENT) self.DefineEvent(CLIENT_R_EVENT) # 鼠标键盘按下 self.ListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), 'OnKeyPressInGame', self, self.onKeypress)
def UnListenEvent(self): self.UnListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), modConfig.OnScriptTickClient, self, self.OnScriptTickClient) self.UnListenForEvent(modConfig.ModName, modConfig.ModServerSystemName, modConfig.CreateEffectEvent, self, self.OnCreateEffect) self.UnListenForEvent(modConfig.ModName, modConfig.ModServerSystemName, modConfig.SetSfxScaleEvent, self, self.OnSetSfxScale) self.UnListenForEvent(modConfig.ModName, modConfig.ModServerSystemName, modConfig.ShowDeleteButtonEvent, self, self.OnShowDeleteButton) self.UnListenForEvent(modConfig.ModName, modConfig.ModServerSystemName, modConfig.RemoveButtonUiEvent, self, self.OnRemoveButtonUi) self.UnListenForEvent(modConfig.ModName, modConfig.ModServerSystemName, modConfig.PlayerAboutEvent, self, self.OnPlayerAbout) self.UnListenForEvent(modConfig.ModName, modConfig.ModServerSystemName, modConfig.CloseAttractSwitchEvent, self, self.OnCloseAttractSwitch)
# -*- coding: utf-8 -*- import math import mod.client.extraClientApi as clientApi from blackHoleScripts.modClient import logger from blackHoleScripts.modCommon import modConfig ClientSystem = clientApi.GetClientSystemCls() SystemName = clientApi.GetEngineSystemName() Namespace = clientApi.GetEngineNamespace() # 组件工厂,用来创建组件 compFactory = clientApi.GetEngineCompFactory() # 客户端系统 class BlackHoleClientSystem(ClientSystem): # 初始化 def __init__(self, namespace, system_name): logger.info( "========================== Init BlackHoleClientSystem ==================================" ) super(BlackHoleClientSystem, self).__init__(namespace, system_name) # 现用初始化父类方式 # ClientSystem.__init__(self, namespace, system_name) 这种方式也可以初始化父类 self.ListenEvent() # 存储序列帧特效实体ID self.frameEntityId = 0 # 保存ui界面节点 self.mDeleteButtonUiNode = None
def Destroy(self): self.UnListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), 'LeftClickBeforeClientEvent', self, self.onKeypress)