def OnUpdate(self, fTime): _ctx = Context.GetInstance() if Aurora.app().StartLogin(_ctx.userName, _ctx.password): self.stateMachine.ChangeState(self.stateMachine.ES_Running) else: print("Login Failed") self.stateMachine.ChangeState(self.stateMachine.ES_Failed)
def OnInit(): random.seed() print(sys.path) _ctx = Context.GetInstance() _ctx.stateMachine = StateMachine() _ctx.viewer = Viewer.GetInstance() _ctx.viewer.Init() _ctx.LoadImages()
def ResetScreen(self): _ctx = Context.GetInstance() flag = 0 if _ctx.fullscreen: flag = pygame.FULLSCREEN self.screen = pygame.display.set_mode((_ctx.width, _ctx.height), flag, 32)
def Init(self): pygame.init() self.ResetScreen() pygame.display.set_caption('Aurora Client Viewer') self.background_position = [0, 0] _ctx = Context.GetInstance() self.background_image = pygame.image.load( _ctx.rootDir + "images/beijing.jpg").convert() self.entities = {}
def DoUpdate(self, fTime): bExit = False for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: bExit = True elif event.key == pygame.K_F11: _ctx = Context.GetInstance() _ctx.fullscreen = not _ctx.fullscreen _ctx.viewer.ResetScreen() else: self.OnKeyDownEvent(event) elif event.type == pygame.QUIT: bExit = True self.OnUpdate(fTime) if bExit: Aurora.app().Stop()
def OnFini(): _ctx = Context.GetInstance() _ctx.viewer.Fini()
def OnUpdate(fTime): _ctx = Context.GetInstance() _ctx.stateMachine.Update(fTime) _ctx.viewer.Update(fTime)
def Draw(self, screen): _ctx = Context.GetInstance() _img = _ctx.GetKTImage(self.imageIdx) width = _img.get_width() / 2 if _img: screen.blit(_img, [self.x - width, self.y - width])
def translate(_x,_z): _ctx = Context.GetInstance() _x = _ctx.width / 2 + _x _z = _ctx.height / 2 - _z return _x,_z