Exemple #1
0
    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)
Exemple #2
0
def OnInit():
	random.seed()
	print(sys.path)
	_ctx = Context.GetInstance()
	_ctx.stateMachine = StateMachine()
	_ctx.viewer = Viewer.GetInstance()
	_ctx.viewer.Init()
	_ctx.LoadImages()
Exemple #3
0
    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)
Exemple #4
0
 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 = {}
Exemple #5
0
    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()
Exemple #6
0
def OnFini():
	_ctx = Context.GetInstance()
	_ctx.viewer.Fini()
Exemple #7
0
def OnUpdate(fTime):
	_ctx = Context.GetInstance()
	_ctx.stateMachine.Update(fTime)
	_ctx.viewer.Update(fTime)
Exemple #8
0
 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])
Exemple #9
0
def translate(_x,_z):
	_ctx = Context.GetInstance()
	_x = _ctx.width / 2  + _x
	_z = _ctx.height / 2 - _z
	return _x,_z