コード例 #1
0
    def show(self):
        techs = [
            tech for tech in g.pl.techs.values()
            if tech.available() and not tech.done
        ]
        techs.sort(key=lambda tech: i18n.lex_sorting_form(tech.spec.name))
        self.list = [_("CPU Pool"), task.get_current("jobs").name] + \
                    [_("Research %s") % tech.name for tech in techs]
        self.key_list = ["cpu_pool", "jobs"] + [tech.id for tech in techs]
        self.listbox.key_list = self.key_list

        self.dirty_count = True
        return super(ResearchScreen, self).show()
コード例 #2
0
ファイル: player.py プロジェクト: xeddmc/singularity
    def get_job_info(self, cpu_time, partial_cash=None):
        if partial_cash == None:
            partial_cash = self.partial_cash

        assert partial_cash >= 0

        cash_per_cpu = task.get_current("jobs").get_profit()

        raw_cash = partial_cash + cash_per_cpu * cpu_time

        new_cash, new_partial_cash = divmod(raw_cash, g.seconds_per_day)

        return new_cash, new_partial_cash
コード例 #3
0
    def on_select(self, description_pane, key):
        if key in g.pl.techs:
            description = g.pl.techs[key].get_info()
        elif key == "cpu_pool":
            template = "%s\n---\n%s"
            cpu_pool = task.get_current("cpu_pool")
            description = template % (cpu_pool.name, cpu_pool.description)
        elif key == "jobs":
            template = "%s\n" + _("%s money per CPU per day.") + "\n---\n%s"
            job = task.get_current("jobs")
            profit = job.get_profit()
            description = template % (job.name, profit, job.description)
        else:
            description = ""

        text.Text(self.description_pane, (0, 0), (-1, -1),
                  text=description,
                  background_color="pane_background",
                  text_size=18,
                  align=constants.LEFT,
                  valign=constants.TOP,
                  borders=constants.ALL)