def RequestbbParticle(self, args): eid = args.get("id") if eid: checkArgs = self.CreateEventData() checkArgs['from'] = clientApi.GetLocalPlayerId() checkArgs['eid'] = eid self.NotifyToServer("RequestbbParticle", checkArgs)
def skip(self, kws): if kws["TouchEvent"] == clientApi.GetMinecraftEnum().TouchEvent.TouchUp: self._cli.NotifyToServer('G_COURT', { 'pid': clientApi.GetLocalPlayerId(), 'name': 'play', 'args': [{}] })
def match(self, kws): if kws["TouchEvent"] == clientApi.GetMinecraftEnum().TouchEvent.TouchUp: if self._court is not None: self._cli.NotifyToServer('G_MATCH', { 'pid': clientApi.GetLocalPlayerId(), 'court': self._court })
def fightover(self, kws): if kws["TouchEvent"] == clientApi.GetMinecraftEnum().TouchEvent.TouchUp: self._cli.NotifyToServer('G_COURT', { 'pid': clientApi.GetLocalPlayerId(), 'name': 'choose', 'args': [1] })
def Destroy(self): logger.info("DESTORY——————————————————————————————————") comp = clientApi.CreateComponent( clientApi.GetLocalPlayerId(), modConfig.ModName, modConfig.scoreComponentClient) comp.setScoreBool(True) comp.setScore(self.score) clientApi.NeedsUpdate(comp) self.score = 0
def __init__(self, namespace, systemName): clientCls.__init__(self, namespace, systemName) self.PlayerId = clientApi.GetLocalPlayerId() self.ListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), "UiInitFinished", self, self.OnUIInitFinished) self.ListenForEvent("SXDtravlesMod", "ServerMain", "chatServerHandler", self, self.chatServerHandler)
def __init__(self, namespace, name, param): ScreenNode.__init__(self, namespace, name, param) # 这个变量保存了控制视野范围的变量 self.mOriginalFov = 1.0 # 这个变量保存了是否显示瞄准界面 self.mShowSight = False # 当前客户端的玩家Id self.mPlayerId = clientApi.GetLocalPlayerId()
def __init__(self, namespace, systemName): ClientSystem.__init__(self, namespace, systemName) logger.info("===== Client Listen =====") self.ListenEvent() # 保存ui界面节点 self.mFpsBattleUINode = None # 拼接ShootComponent的Key self.mShootKey = modConfig.ModName + ":" + modConfig.ClientShootComponent # 获取客户端本地玩家的playerId self.mPlayerId = clientApi.GetLocalPlayerId() # 用于保存在击中后需要释放的实体 self.mHitDestroyIdList = {}
def initialize(self, *args): clientApi.RegisterUI(cfg.MOD_NAMESPACE, cfg.UI_NAMESPACE, cfg.UI_CLASS, cfg.UI_MAIN) self._g = clientApi.CreateUI(cfg.MOD_NAMESPACE, cfg.UI_NAMESPACE, {"isHud": 0}) # type: GUI self._g._cli = self if self._debut: self._g.duel = self.cache if self.info: self._g.real = self.info else: self._g.standby() self.NotifyToServer('G_DEBUT', { 'pid': clientApi.GetLocalPlayerId(), })
def __init__(self, namespace, systemName): # 首先初始化TutorialClientSystem的基类ClientSystem super(snakeGameClientSystem, self).__init__(namespace, systemName) print("==== SnakeGameClientSystem Init ====") self.playerId = clientApi.GetLocalPlayerId() # 在下方直接调用FinalValuable里会报错 self.OnKeyPressStr = snakeGameFinalValuable.OnKeyPress # wasd你懂的,这是键值 self.W = "87" self.A = "65" self.S = "83" self.D = "68" self.ListenEvent()
def __init__(self, namespace, name, param): ScreenNode.__init__(self, namespace, name, param) self.PlayerId = clientApi.GetLocalPlayerId() self.TextCount = 0 self.score = 0 self._textLabelPath = "/bg_img/main_text" self.problemsText = { 1: "铜铃是商代的文物吗?", 2: "青铜鸡是古代神话中呼唤日出的”天鸡”的象征物吗?", 3: "以下说法请判断对错\n三星堆青铜神树不是世界上最早、树株最高的青铜神树 ", 4: "三星堆青铜大立人像被称为铜像之王吗?", 5: "青铜纵目面具不是为世界上年代最早,形体最大的青铜面具。", 6: "青铜戴冠纵目面具是完整的。", 7: "太阳是轮作为太阳的象征接受人们顶礼膜拜的。", 8: "兽面是二号祭祀坑出土的?", 9: "以下说法请判断对错\n三星堆金杖不是世界上最早的金杖。", 10: "戴金面罩青铜人头像是四川广汉三星堆遗址是我国迄今发现的最早的大规模青铜人像遗址出土的?" }
def play(self, kws): if kws["TouchEvent"] == clientApi.GetMinecraftEnum().TouchEvent.TouchUp: if self.duel and self.duel.chain: phase = self.duel.chain.phase if self.selected and phase.turn == self.duel.uid and phase.name == 'MainPhase': if self.last_result[0] != self.selected: cards = {} gambler = self.duel.gamblers[self.duel.uid] for i in self.selected: card = gambler.cards[i] cards.setdefault(card[0], []).append(card) valid = Combo.fromcards(cards, None) self.last_result = self.selected.copy(), valid and cards if not valid: self.SetVisible(self.notice, True) cards = self.last_result[1] if cards: self._cli.NotifyToServer('G_COURT', { 'pid': clientApi.GetLocalPlayerId(), 'name': 'play', 'args': [cards] })
def getPlayerPos(self): comp = self.CreateComponent(clientApi.GetLocalPlayerId(), "Minecraft", "pos") pos = comp.GetPos() self.NeedsUpdate(comp) return list(pos)
# -*- coding: utf-8 -*- import client.extraClientApi as clientApi from ModScripts.modTools import logger import ModScripts.modConfig as modConfig clientCls = clientApi.GetClientSystemCls() comp = clientApi.CreateComponent(clientApi.GetLocalPlayerId(), modConfig.ModName, modConfig.scoreComponentClient) class answerUIClientSystem(clientCls): def __init__(self, namespace, systemName): clientCls.__init__(self, namespace, systemName) self.PlayerId = clientApi.GetLocalPlayerId() self.ListenForEvent(clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), "UiInitFinished", self, self.OnUIInitFinished) self.ListenForEvent("SXDtravlesMod", "ServerMain", "chatServerHandler", self, self.chatServerHandler) def Update(self): if comp.getScoreBool(): self.NotifyToServer("ScoreEvent", {'score': comp.getScore()}) comp.setScoreBool(False) clientApi.NeedsUpdate(comp) # getanswerUI的score pass def Destory(self): pass