curses UI improvements
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# The lenght of one game cycle in milliseconds
|
# The lenght of one game cycle in milliseconds
|
||||||
ticklenght = 0.005
|
ticklenght = 0.005
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from config import *
|
from config import *
|
||||||
from mayorgotchi import Mayorgotchi
|
from mayorgotchi import Mayorgotchi
|
||||||
@@ -19,7 +20,7 @@ class Kinggotchi:
|
|||||||
result = 'I am Kinggotchi '+str(self.name)+'.\nIn my Kingdom live '+str(self.all_tamagotchis())+' Tamagotichs.\nIn my Kingdom '+str(self.all_dead())+' Tamagotchis have died so far.\n\nThese are the '+str(len(self.myvillages))+' Villages in my Kingdom:\n'
|
result = 'I am Kinggotchi '+str(self.name)+'.\nIn my Kingdom live '+str(self.all_tamagotchis())+' Tamagotichs.\nIn my Kingdom '+str(self.all_dead())+' Tamagotchis have died so far.\n\nThese are the '+str(len(self.myvillages))+' Villages in my Kingdom:\n'
|
||||||
|
|
||||||
for n in self.myvillages:
|
for n in self.myvillages:
|
||||||
result += '-------------------------------------------------------------------------------\n'
|
# result += '-----------------------------------------------------------------------------------------\n'
|
||||||
result += n.give_overview()
|
result += n.give_overview()
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from tamagotchi import Tamagotchi
|
from tamagotchi import Tamagotchi
|
||||||
import names
|
import names
|
||||||
@@ -21,7 +22,7 @@ class Mayorgotchi:
|
|||||||
self.mygotchis.remove(n)
|
self.mygotchis.remove(n)
|
||||||
|
|
||||||
def give_status(self,show_pct):
|
def give_status(self,show_pct):
|
||||||
result = 'I am Mayorgotchi ' + self.name + '.\nIn my Village '+str(self.graveyard)+' Tamagotchis died so far.\nThese are the '+str(len(self.mygotchis))+' Tamagotchis living in my Village:\n\n'
|
result = 'I am Mayorgotchi ' + self.name + '.\nIn my Village live '+str(len(self.mygotchis))+' Tamagotchis.\nIn my Village '+str(self.graveyard)+' Tamagotchis died so far.\n\n'
|
||||||
for n in self.mygotchis:
|
for n in self.mygotchis:
|
||||||
if show_pct:
|
if show_pct:
|
||||||
result += n.status_pct()
|
result += n.status_pct()
|
||||||
@@ -30,10 +31,9 @@ class Mayorgotchi:
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def give_overview(self):
|
def give_overview(self):
|
||||||
result = 'I am Mayorgotchi ' + self.name + '.\nThere are ' + str(len(self.mygotchis)) + ' Tamagotchis in my Village\nThere are ' + str(self.graveyard) + ' Tamagotchis in the graveyard.\nOccupation in my Village:\n'
|
result = ''
|
||||||
tmp = self.get_status_list()
|
tmp = self.get_status_list()
|
||||||
|
result += 'Village of Mayor {0:10} Population:{1:5} Dead:{2:5} Idle:{3:5} Eating:{4:5} Sleeping:{5:5} Bathing:{6:5} Playing:{7:5} Working:{8:5}\n'.format(self.name,str(len(self.mygotchis)),str(self.graveyard),str(len(tmp[0])), str(len(tmp[1])), str(len(tmp[2])), str(len(tmp[3])), str(len(tmp[4])), str(len(tmp[5])))
|
||||||
result += 'Idle:{0:5} Eating:{1:5} Sleeping:{2:5} Bathing:{3:5} Playing:{4:5} Working:{5:5}\n'.format(str(len(tmp[0])), str(len(tmp[1])), str(len(tmp[2])), str(len(tmp[3])), str(len(tmp[4])), str(len(tmp[5])))
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
def get_status_list(self):
|
def get_status_list(self):
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
class Tamagotchi:
|
class Tamagotchi:
|
||||||
status = ''
|
status = ''
|
||||||
|
|||||||
5
test.py
5
test.py
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from mayorgotchi import Mayorgotchi
|
from mayorgotchi import Mayorgotchi
|
||||||
from kinggotchi import Kinggotchi
|
from kinggotchi import Kinggotchi
|
||||||
@@ -37,10 +38,10 @@ while True:
|
|||||||
win.addstr(0,0,'Tamagotchi Colony (alpha) - currently at tick '+str(ticks)+'.\n')
|
win.addstr(0,0,'Tamagotchi Colony (alpha) - currently at tick '+str(ticks)+'.\n')
|
||||||
|
|
||||||
if kingdomview:
|
if kingdomview:
|
||||||
win.addstr(2,0,'[q]:exit [p]:pause [v]:switch between Kingdom/Village view\n')
|
win.addstr(2,0,'[q]:Exit [p]:Pause [v]:Village View\n')
|
||||||
win.addstr(4,0,king.show_kingdom())
|
win.addstr(4,0,king.show_kingdom())
|
||||||
else:
|
else:
|
||||||
win.addstr(2,0,'[q]:exit [p]:pause [v]:switch between Kingdom/Village view [n/m]:previous/next Village\n')
|
win.addstr(2,0,'[q]:Exit [p]:Pause [v]:Kingdom View [n/m]:Previous/Next Village\n')
|
||||||
win.addstr(4,0,king.myvillages[villagenr].give_status(percentage))
|
win.addstr(4,0,king.myvillages[villagenr].give_status(percentage))
|
||||||
|
|
||||||
king.step()
|
king.step()
|
||||||
|
|||||||
Reference in New Issue
Block a user