def Update(self): self.timeTick += 1 if self.canGoAnswerBool: logger.info("可以答题") self.NotifyToServer("canAnswerEvent", {}) self.canGoAnswerBool = False # if self.narratorSayListBool.count(1) == 10: # self.canGoAnswerBool = True # logger.info("执行canGoAnswerBool == True") # self.teacherCanAnswerBool = False # clientApi.GetUI( # modConfig.ModName, modConfig.dialogUI).setRemove() if self.timeTick >= 1500 + 3600: if self.timeTick % 1800 == 0: self.timeCount += 1 if self.timeCount == 6: self.timeCount = 1 if clientApi.GetUI(modConfig.ModName, modConfig.dialogUI ) == None and self.teacherCanAnswerBool: clientApi.RegisterUI(modConfig.ModName, modConfig.dialogUI, modConfig.dialogUIclsPath, modConfig.dialogUIDef) locaUI = clientApi.CreateUI(modConfig.ModName, modConfig.dialogUI, {"isHud": 1}) locaUI.SetText( "/bg_img/main_text", "老师: " + self.TeacherTextList[self.timeCount])
def ApproachEntityClientEventHandler(self, args): # logger.info("ApproachEntityClientEventHandler_________") for i in range(10): if args['entityId'] == self.narratorListId[i]: # logger.info(self.TextDict[i + 1]) if self.narratorSayListBool.count(1) == 10: self.canGoAnswerBool = True logger.info("执行canGoAnswerBool == True") self.teacherCanAnswerBool = False clientApi.GetUI(modConfig.ModName, modConfig.dialogUI).setRemove() if clientApi.GetUI(modConfig.ModName, modConfig.dialogUI) == None: # comp = CreateComponent( # clientApi.GetLocalPlayerId(), "Minecraft", "operation") # # 不响应屏幕拖动 # comp.SetCanDrag(False) # self.NeedsUpdate(comp) clientApi.RegisterUI(modConfig.ModName, modConfig.dialogUI, modConfig.dialogUIclsPath, modConfig.dialogUIDef) locaUI = clientApi.CreateUI(modConfig.ModName, modConfig.dialogUI, {"isHud": 1}) locaUI.SetText("/bg_img/main_text", self.TextDict[i + 1]) self.narratorSayListBool[i] = 1 logger.info(self.narratorSayListBool) logger.info(self.narratorSayListBool.count(1)) self.NotifyToServer( "progressEvent", {'val': self.narratorSayListBool.count(1)}) self.NotifyToServer("TeacherTextEvent", {"text": self.TextDict[i + 1]})
def chatServerHandler(self, args): if args['message'] == "开始答题": clientApi.RegisterUI(modConfig.ModName, modConfig.answerUI, modConfig.answerUIclsPath, modConfig.answerUIDef) locaUI = clientApi.CreateUI(modConfig.ModName, modConfig.answerUI, {"isHud": 1})
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 OnUIInitFinished(self, args): logger.info("OnUIInitFinished : %s", args) # 注册UI 详细解释参照《UI API》 clientApi.RegisterUI(modConfig.ModName, modConfig.FpsBattleUIName, modConfig.FpsBattleUIPyClsPath, modConfig.FpsBattleUIScreenDef) # 创建UI 详细解释参照《UI API》 clientApi.CreateUI(modConfig.ModName, modConfig.FpsBattleUIName, {"isHud": 1}) self.mFpsBattleUINode = clientApi.GetUI(modConfig.ModName, modConfig.FpsBattleUIName) if self.mFpsBattleUINode: self.mFpsBattleUINode.Init() else: logger.error("create ui %s failed!" % modConfig.FpsBattleUIScreenDef) logger.info("change model datiangou") # 客户端换上模型大天狗并循环播放动作大天狗跑步 modelComp = self.CreateComponent(self.mPlayerId, modConfig.Minecraft, modConfig.ModelCompClient) modelComp.modelName = modConfig.DatiangouModel modelComp.aniName = modConfig.DatiangouRunAnim modelComp.isLoop = True self.NeedsUpdate(modelComp)
def answerUIEventHandler(self): clientApi.RegisterUI(modConfig.ModName, modConfig.dialogUI, modConfig.dialogUIclsPath, modConfig.dialogUIDef) locaUI = clientApi.CreateUI(modConfig.ModName, modConfig.dialogUI, {"isHud": 0})
def answerUIEventHandler(self, args): self.teacherCanAnswerBool = False clientApi.RegisterUI(modConfig.ModName, modConfig.answerUI, modConfig.answerUIclsPath, modConfig.answerUIDef) locaUI = clientApi.CreateUI(modConfig.ModName, modConfig.answerUI, {"isHud": 1})