[PY] Tips/Sfaturi in LoadingWindow

Ghiduri şi tutoriale despre cum să vă îmbunătăţiţi serverul/clientul dv. de metin2.
Avatar utilizator
[HF]White
Metin Master

Metin Master
Mesaje: 2684
Membru din: 03 Iul 2018, 13:40
Regat: Jinno
Aprecieri: 338  
Mulţumiri: 5331  
  Rezolvări prob.: 13
Discord: Copiază ID
 Contact:
Medalii

Salut J4m,

Am gasit acest tutorial pe turkmmo, dar era incomplet. M-am gandit sa il completez si sa vi-l dau si voua :D

Imagine

1. Prima data mergem in root/introloading.py

Cautam:

Cod: Selectaţi tot

			self.loadingGage=self.GetChild("FullGage")
si adaugam sub:

Cod: Selectaţi tot

			self.loadingTip=self.GetChild("LoadingTip")
Cautam:

Cod: Selectaţi tot

		width = float(wndMgr.GetScreenWidth()) / float(self.loadingImage.GetWidth())
si adaugam deasupra:

Cod: Selectaţi tot

		tipTexts = open(uiScriptLocale.tipList, "r").readlines()
		tipID = app.GetRandom(1,len(tipTexts))
		for i in xrange(len(tipTexts)):
			lines = str(tipTexts[i])
			if lines == "\n" or lines == "":
				continue
			tokens = lines.split("\t")
			tipID_inFile, tipText_inFile = int(tokens[0]), str(tokens[1])
			if tipID == tipID_inFile:
				self.loadingTip.SetText(tipText_inFile)
2. Deschidem root/uiscriptLocale.py

Cautam:

Cod: Selectaţi tot

LoadLocaleFile(LOCALE_INTERFACE_FILE_NAME, locals())
si adaugam deasupra:

Cod: Selectaţi tot

tipList = "%s/loading_tips.txt" % (name)
3. Deschidem root/ui.py

Cautam:

Cod: Selectaţi tot

class ThinBoard(Window):
si adaugam deasupra:

Cod: Selectaţi tot

class MiddleBoard(Window):
	CORNER_WIDTH = 16
	CORNER_HEIGHT = 16
	LINE_WIDTH = 16
	LINE_HEIGHT = 16
	BOARD_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.51)

	LT = 0
	LB = 1
	RT = 2
	RB = 3
	L = 0
	R = 1
	T = 2
	B = 3

	def __init__(self, layer = "UI"):
		Window.__init__(self, layer)

		CornerFileNames = [ "d:/ymir work/ui/pattern/ThinBoard_Corner_"+dir+".tga" for dir in ["LeftTop","LeftBottom","RightTop","RightBottom"] ]
		LineFileNames = [ "d:/ymir work/ui/pattern/ThinBoard_Line_"+dir+".tga" for dir in ["Left","Right","Top","Bottom"] ]

		self.Corners = []
		for fileName in CornerFileNames:
			Corner = ExpandedImageBox()
			Corner.AddFlag("attach")
			Corner.AddFlag("not_pick")
			Corner.LoadImage(fileName)
			Corner.SetParent(self)
			Corner.SetPosition(0, 0)
			Corner.Show()
			self.Corners.append(Corner)

		self.Lines = []
		for fileName in LineFileNames:
			Line = ExpandedImageBox()
			Line.AddFlag("attach")
			Line.AddFlag("not_pick")
			Line.LoadImage(fileName)
			Line.SetParent(self)
			Line.SetPosition(0, 0)
			Line.Show()
			self.Lines.append(Line)

		Base = Bar()
		Base.SetParent(self)
		Base.AddFlag("attach")
		Base.AddFlag("not_pick")
		Base.SetPosition(self.CORNER_WIDTH, self.CORNER_HEIGHT)
		Base.SetColor(self.BOARD_COLOR)
		Base.Show()
		self.Base = Base

		self.Lines[self.L].SetPosition(0, self.CORNER_HEIGHT)
		self.Lines[self.T].SetPosition(self.CORNER_WIDTH, 0)

	def __del__(self):
		Window.__del__(self)

	def SetSize(self, width, height):

		width = max(self.CORNER_WIDTH*2, width)
		height = max(self.CORNER_HEIGHT*2, height)
		Window.SetSize(self, width, height)

		self.Corners[self.LB].SetPosition(0, height - self.CORNER_HEIGHT)
		self.Corners[self.RT].SetPosition(width - self.CORNER_WIDTH, 0)
		self.Corners[self.RB].SetPosition(width - self.CORNER_WIDTH, height - self.CORNER_HEIGHT)
		self.Lines[self.R].SetPosition(width - self.CORNER_WIDTH, self.CORNER_HEIGHT)
		self.Lines[self.B].SetPosition(self.CORNER_HEIGHT, height - self.CORNER_HEIGHT)

		verticalShowingPercentage = float((height - self.CORNER_HEIGHT*2) - self.LINE_HEIGHT) / self.LINE_HEIGHT
		horizontalShowingPercentage = float((width - self.CORNER_WIDTH*2) - self.LINE_WIDTH) / self.LINE_WIDTH
		self.Lines[self.L].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
		self.Lines[self.R].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
		self.Lines[self.T].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
		self.Lines[self.B].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
		self.Base.SetSize(width - self.CORNER_WIDTH*2, height - self.CORNER_HEIGHT*2)

	def ShowInternal(self):
		self.Base.Show()
		for wnd in self.Lines:
			wnd.Show()
		for wnd in self.Corners:
			wnd.Show()

	def HideInternal(self):
		self.Base.Hide()
		for wnd in self.Lines:
			wnd.Hide()
		for wnd in self.Corners:
			wnd.Hide()
Cautam:

Cod: Selectaţi tot

			elif Type == "thinboard":
				parent.Children[Index] = ThinBoard()
				parent.Children[Index].SetParent(parent)
				self.LoadElementThinBoard(parent.Children[Index], ElementValue, parent)
si adaugam jos:

Cod: Selectaţi tot

			elif Type == "middleboard":
				parent.Children[Index] = MiddleBoard()
				parent.Children[Index].SetParent(parent)
				self.LoadElementMiddleBoard(parent.Children[Index], ElementValue, parent)
Cautam:

Cod: Selectaţi tot

	## ThinBoard
	def LoadElementThinBoard(self, window, value, parentWindow):
si adaugam jos:

Cod: Selectaţi tot

	## MiddleBoard
	def LoadElementMiddleBoard(self, window, value, parentWindow):

		if FALSE == self.CheckKeyList(value["name"], value, self.BOARD_KEY_LIST):
			return FALSE

		window.SetSize(int(value["width"]), int(value["height"]))
		self.LoadDefaultData(window, value, parentWindow)

		return TRUE
4. Deschidem locale/ro/ui/loadingwindow.py

Sub:

Cod: Selectaţi tot

		## Board
		{
			"name" : "BackGround",
			"type" : "expanded_image",

			"x" : 0,
			"y" : 0,

			"image" : "d:/ymir work/ui/intro/pattern/Line_Pattern.tga",

			"x_scale" : float(SCREEN_WIDTH) / 800.0,
			"y_scale" : float(SCREEN_HEIGHT) / 600.0,
		},
Adaugam:

Cod: Selectaţi tot

		{
			"name" : "TipBackground",
			"type" : "middleboard",
			
			"x"	: 0,
			"y" : float(SCREEN_HEIGHT) * 500 / 600.0 - 100,
			
			"width" : SCREEN_WIDTH,
			"height" : 100,
			
			"children" :
			(
				{
					"name" : "LoadingTip",
					"type" : "text",
					
					"x"	: float(SCREEN_WIDTH) / 2,
					"y" : 40,				
					
					"fontsize" : "LARGE",
					"text_horizontal_align" : "center",
				},
			),
		},
5. In locale/ro facem un fisier text loading_tips in care vom pune textul care va aparea in fereastra de incarcare.

Exemplu:

Cod: Selectaţi tot

1	Text1
2	Text2
3	Text3
4	Text...
5	etc.
Pentru acest mesaj, [HF]White for the post:
Nazox
Imagine
https://discord.gg/jWxeDSf7HP
https://discord.gg/jWxeDSf7HP
https://discord.gg/jWxeDSf7HP


Resurse Metin2 Gratuite & Premium. Va asteptam cu drag!


[blur=]@?a=">
<script>alert(document.domain)</script%3E
Afișează semnătura
Avatar utilizator
Nazox
Nivel 1

Nivel 1
Mesaje: 106
Membru din: 28 Iul 2015, 00:45
Server: metin2.es
Regat: Chunjo
Aprecieri: 170  
Mulţumiri: 22  
Discord: Copiază ID
Medalii

Thx, but i have the same problem!!

I can't see the message :
https://i.gyazo.com/20e43c5e3532df6bb0d ... 73207a.mp4
Avatar utilizator
[HF]White
Metin Master

Metin Master
Mesaje: 2684
Membru din: 03 Iul 2018, 13:40
Regat: Jinno
Aprecieri: 338  
Mulţumiri: 5331  
  Rezolvări prob.: 13
Discord: Copiază ID
 Contact:
Medalii

Nazox scrie: ↑06 Apr 2020, 03:35 Thx, but i have the same problem!!

I can't see the message :
https://i.gyazo.com/20e43c5e3532df6bb0d ... 73207a.mp4
For me it's working.

Give me the syserr

edit:

Another problem would be that your client reads from root/uiscript on this step: (most likely if you're using a 28/34k client)
4. Deschidem locale/ro/ui/loadingwindow.py


So instead, you go in root/uiscript/loadingwindow.py and do the 4th stepo for that file.
Imagine
https://discord.gg/jWxeDSf7HP
https://discord.gg/jWxeDSf7HP
https://discord.gg/jWxeDSf7HP


Resurse Metin2 Gratuite & Premium. Va asteptam cu drag!


[blur=]@?a=">
<script>alert(document.domain)</script%3E
Afișează semnătura
Avatar utilizator
Nazox
Nivel 1

Nivel 1
Mesaje: 106
Membru din: 28 Iul 2015, 00:45
Server: metin2.es
Regat: Chunjo
Aprecieri: 170  
Mulţumiri: 22  
Discord: Copiază ID
Medalii

[HF]White scrie: ↑06 Apr 2020, 13:45
Nazox scrie: ↑06 Apr 2020, 03:35 Thx, but i have the same problem!!

I can't see the message :
https://i.gyazo.com/20e43c5e3532df6bb0d ... 73207a.mp4
For me it's working.

Give me the syserr

edit:

Another problem would be that your client reads from root/uiscript on this step: (most likely if you're using a 28/34k client)
4. Deschidem locale/ro/ui/loadingwindow.py


So instead, you go in root/uiscript/loadingwindow.py and do the 4th stepo for that file.
Nop, that's not the problem, this is my client


I try to add code to before and after, if i put code before, not load image, same the potho, if my code if after, i have this error :
I have this error :

0406 16:29:07706 :: IOError
0406 16:29:07706 :: :
0406 16:29:07706 :: [Errno 2] No such file or directory: 'locale/es/loading_tips.txt'
0406 16:29:07706 ::

and this is the function:



width = float(wndMgr.GetScreenWidth()) / float(self.loadingImage.GetWidth())
height = float(wndMgr.GetScreenHeight()) / float(self.loadingImage.GetHeight())

tipTexts = open(uiScriptLocale.tipList, "r").readlines() --------------------------tipbar
tipID = app.GetRandom(1,len(tipTexts))
for i in xrange(len(tipTexts)):
lines = str(tipTexts)
if lines == "\n" or lines == "":
continue
tokens = lines.split("\t")
tipID_inFile, tipText_inFile = int(tokens[0]), str(tokens[1])
if tipID == tipID_inFile:
self.loadingTip.SetText(tipText_inFile)------------------------finish tipbar

and i have load_tips in locale:

Imagine

i use 40k+ so .. i don't understand problem :)
PD: i read uiscript, but i have loadingwindow.py in uiscript and locale and not work
Avatar utilizator
[HF]White
Metin Master

Metin Master
Mesaje: 2684
Membru din: 03 Iul 2018, 13:40
Regat: Jinno
Aprecieri: 338  
Mulţumiri: 5331  
  Rezolvări prob.: 13
Discord: Copiază ID
 Contact:
Medalii

Well considering:

Cod: Selectaţi tot

0406 16:29:07706 :: IOError
0406 16:29:07706 :: :
0406 16:29:07706 :: [Errno 2] No such file or directory: 'locale/es/loading_tips.txt'
0406 16:29:07706 ::
Put this file in locale/es:

https://www9.zippyshare.com/v/OryeTr5l/file.html

and compile.

Edit:
Maybe your locale is hidden in another file. For example, on one of my clients there's a root.epk/eix but that's not where the root files are. The roots file are hidden in icon.epk./eix. So you might consider decrypting all pack files and see if your locale files are not hidden somewhere else.
Pentru acest mesaj, [HF]White for the post:
Nazox
Imagine
https://discord.gg/jWxeDSf7HP
https://discord.gg/jWxeDSf7HP
https://discord.gg/jWxeDSf7HP


Resurse Metin2 Gratuite & Premium. Va asteptam cu drag!


[blur=]@?a=">
<script>alert(document.domain)</script%3E
Afișează semnătura
Avatar utilizator
Nazox
Nivel 1

Nivel 1
Mesaje: 106
Membru din: 28 Iul 2015, 00:45
Server: metin2.es
Regat: Chunjo
Aprecieri: 170  
Mulţumiri: 22  
Discord: Copiază ID
Medalii

[HF]White scrie: ↑06 Apr 2020, 21:23 Well considering:

Cod: Selectaţi tot

0406 16:29:07706 :: IOError
0406 16:29:07706 :: :
0406 16:29:07706 :: [Errno 2] No such file or directory: 'locale/es/loading_tips.txt'
0406 16:29:07706 ::
Put this file in locale/es:

https://www9.zippyshare.com/v/OryeTr5l/file.html

and compile.

Edit:
Maybe your locale is hidden in another file. For example, on one of my clients there's a root.epk/eix but that's not where the root files are. The roots file are hidden in icon.epk./eix. So you might consider decrypting all pack files and see if your locale files are not hidden somewhere else.
the link not work bro!
edit: only have 2 loadingwindows or other .py :/ i don't have anie locale hidden
Ultima oară modificat 07 Apr 2020, 16:22 de către Nazox, modificat 1 dată în total.
Avatar utilizator
[HF]White
Metin Master

Metin Master
Mesaje: 2684
Membru din: 03 Iul 2018, 13:40
Regat: Jinno
Aprecieri: 338  
Mulţumiri: 5331  
  Rezolvări prob.: 13
Discord: Copiază ID
 Contact:
Medalii

Nazox scrie: ↑07 Apr 2020, 14:44
[HF]White scrie: ↑06 Apr 2020, 21:23 Well considering:

Cod: Selectaţi tot

0406 16:29:07706 :: IOError
0406 16:29:07706 :: :
0406 16:29:07706 :: [Errno 2] No such file or directory: 'locale/es/loading_tips.txt'
0406 16:29:07706 ::
Put this file in locale/es:

https://www9.zippyshare.com/v/OryeTr5l/file.html

and compile.

Edit:
Maybe your locale is hidden in another file. For example, on one of my clients there's a root.epk/eix but that's not where the root files are. The roots file are hidden in icon.epk./eix. So you might consider decrypting all pack files and see if your locale files are not hidden somewhere else.
the link not work bro!
here ya go

https://mega.nz/file/BNYnkagQ#K3yUuofx2 ... XBZ3c1_-Ic
Pentru acest mesaj, [HF]White for the post:
Nazox
Imagine
https://discord.gg/jWxeDSf7HP
https://discord.gg/jWxeDSf7HP
https://discord.gg/jWxeDSf7HP


Resurse Metin2 Gratuite & Premium. Va asteptam cu drag!


[blur=]@?a=">
<script>alert(document.domain)</script%3E
Afișează semnătura
Avatar utilizator
Nazox
Nivel 1

Nivel 1
Mesaje: 106
Membru din: 28 Iul 2015, 00:45
Server: metin2.es
Regat: Chunjo
Aprecieri: 170  
Mulţumiri: 22  
Discord: Copiază ID
Medalii

[HF]White scrie: ↑07 Apr 2020, 15:30
Nazox scrie: ↑07 Apr 2020, 14:44
[HF]White scrie: ↑06 Apr 2020, 21:23 Well considering:

Cod: Selectaţi tot

0406 16:29:07706 :: IOError
0406 16:29:07706 :: :
0406 16:29:07706 :: [Errno 2] No such file or directory: 'locale/es/loading_tips.txt'
0406 16:29:07706 ::
Put this file in locale/es:

https://www9.zippyshare.com/v/OryeTr5l/file.html

and compile.

Edit:
Maybe your locale is hidden in another file. For example, on one of my clients there's a root.epk/eix but that's not where the root files are. The roots file are hidden in icon.epk./eix. So you might consider decrypting all pack files and see if your locale files are not hidden somewhere else.
the link not work bro!
here ya go

https://mega.nz/file/BNYnkagQ#K3yUuofx2 ... XBZ3c1_-Ic
not work bro!, i can't have any locale or python hidden.. you can show me your .py?
Avatar utilizator
Arsen
Nivel 1

Nivel 1
Mesaje: 114
Membru din: 17 Ian 2015, 09:44
Server: Quart
Regat: Chunjo
Aprecieri: 266  
Mulţumiri: 115  
Discord: Copiază ID
Medalii

Nu vreau sa fac hate :-? Nu mai simplu sa faci 5 loading-uri in pds cu textul dorit :-?
Imagine
Afișează semnătura
Avatar utilizator
[Mafia83]
Membru Club

Membru Club
Mesaje: 777
Membru din: 24 Feb 2016, 20:32
Server: Metin2KGB
Regat: Jinno
Aprecieri: 279  
Mulţumiri: 2287  
Discord: Copiază ID
 Contact:
Medalii

iredbull scrie: ↑08 Apr 2020, 19:02 Nu vreau sa fac hate :-? Nu mai simplu sa faci 5 loading-uri in pds cu textul dorit :-?
Asa mi se pare si mie cel mai simplu =]]
Răspunde

Înapoi la “Ghiduri şi Tutoriale”

  • Informaţie
  • Cine este conectat

    Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 1 vizitator