Jump to content

How To Format the Play Time in Select Character


Recommended Posts

  • Active Member

Preview:

 

Spoiler

151317354be67a5bc3b1ea1ec6b95b4eabcf4f.p151317B1sGmSe.png.6d32807779651364c244d2151317f874f525119da723b8a9f0f551f5432c.p151317XQiTBKl.png.257a3b6fc77aab32950220


 

Code:

 

    #Exygo's function

	    def timp_frumos(self, minute):

	        #import math # modulul math se presupune a fi deja importat sus

	        self.ore = minute / 60

	        if minute  <= 60:

	            return uiScriptLocale.EXYGO_TIME_FORMAT_MINUTE % (minute)

	        else:

	            if self.ore <= 24:

	                return uiScriptLocale.EXYGO_TIME_FORMAT_HOURS_AND_MINUTES % (self.ore, minute - 60 * self.ore) # Ingeniozitate maa!

	            else:

	                self.zile = self.ore / 24

	                return uiScriptLocale.EXYGO_TIME_FORMAT_DAYS_AND_HOURS % (self.zile, self.ore - 24 * self.zile) # Ingeniozitate maa!


 
self.PlayTime.SetText(self.timp_frumos(playTime))

And the part for locale_xx/locale_interface.txt
Install this youself! No guide for noobs yet! :)
EXYGO_TIME_FORMAT_MINUTE	%s minute(s)
EXYGO_TIME_FORMAT_HOURS_AND_MINUTES	%s hour(s) and %s minute(s)
EXYGO_TIME_FORMAT_DAYS_AND_HOURS	%s day(s) and %s hour(s)

Hint: introselect.py

* This little part of code was wrote by Exygo(me)

  • Love 2
Link to comment
Share on other sites

More easier way, use existing function (already in localeInfo.py):

In introSelect.py change "self.PlayTime.SetText(str(playTime))" to "self.PlayTime.SetText(str(localeInfo.SecondToDHM(playTime*60)))"

Furthermore in locale_xx\localale\xx\ui\selectcharacterwindow.py :

Spoiler

change this block:


				{
					"name" : "character_play_time",
					"type" : "text",

					"x" : 17,
					"y" : 76 + 100 - 21 + BOARD_ITEM_ADD_POSITION,

					"text" : uiScriptLocale.SELECT_PLAYTIME,

					"children" :
					(
						{
							"name" : "character_play_time_slot",
							"type" : "image",

							"x" : 83,
							"y" : -2,

							"image" : "d:/ymir work/ui/public/Parameter_Slot_03.sub",
						},
						{
							"name" : "character_play_time_value",
							"type" : "text",

							"x" : 83 + 91/2,
							"y" : 0,

							"text" : "",

							"text_horizontal_align" : "center",
						},
					),
				},

to this:


				{
					"name" : "character_play_time",
					"type" : "text",

					"x" : 17,
					"y" : 76 + 100 - 21 + BOARD_ITEM_ADD_POSITION,

					"text" : uiScriptLocale.SELECT_PLAYTIME,

					"children" :
					(
						{
							"name" : "character_play_time_slot",
							"type" : "image",

							"x" : 43,
							"y" : -2,

							"image" : "d:/ymir work/ui/public/Parameter_Slot_05.sub",
						},
						{
							"name" : "character_play_time_value",
							"type" : "text",

							"x" : 43 + 130/2,
							"y" : 0,

							"text" : "",

							"text_horizontal_align" : "center",
						},
					),
				},

 

Result:

D1eMhg.png

Regards

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 2
Link to comment
Share on other sites

  • Active Member
12 hours ago, wezt said:

More easier way, use existing function (already in localeInfo.py):

In introSelect.py change "self.PlayTime.SetText(str(playTime))" to "self.PlayTime.SetText(str(localeInfo.SecondToDHM(playTime*60)))"

Regards

Dammit! Didn't know there is already a function ...

Link to comment
Share on other sites

  • 7 months later...

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.