Jump to content

Can't choose empire (can't select)


Recommended Posts

As it puts in the description, being in the window to choose empire in my case (jinno and shinsoo) does not let me click on either.

I leave the root / introempire.py and the selectempirewindow.py

See if someone finds the fault.

No errors appear on sysser.

INTROEMPIRE

import ui
import net
import wndMgr
import dbg
import app
import event
import _weakref
import localeInfo
import uiScriptLocale
import uiCommon

class SelectEmpireWindow(ui.ScriptWindow):
	class EmpireButton(ui.Window):
		def __init__(self, owner, arg):
			ui.Window.__init__(self)
			self.owner = owner
			self.arg = arg
			
		def OnMouseOverIn(self):
			self.owner.OnOverInEmpire(self.arg)
			
		def OnMouseOverOut(self):
			self.owner.OnOverOutEmpire(self.arg)
			
		def OnMouseLeftButtonDown(self):
			if self.owner.empireID != self.arg:
				self.owner.OnSelectEmpire(self.arg)

	def __init__(self, stream):
		ui.ScriptWindow.__init__(self)
		net.SetPhaseWindow(net.PHASE_WINDOW_EMPIRE, self)

		self.stream = stream
		self.empireID = 1
		self.empireArea = {}
		self.empireAreaButton = {}
		self.empireAreaCurAlpha = { net.EMPIRE_A:0.0, net.EMPIRE_C:0.0 }
		self.empireAreaDestAlpha = { net.EMPIRE_A:0.0, net.EMPIRE_C:0.0 }

	def __del__(self):
		ui.ScriptWindow.__del__(self)
		net.SetPhaseWindow(net.PHASE_WINDOW_EMPIRE, 0)

	def Close(self):
		self.ClearDictionary()
		self.selectButton = None
		self.exitButton = None
		self.empireArea = None

		self.KillFocus()
		self.Hide()

		app.HideCursor()
		event.Destroy()

	def Open(self):
		self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
		self.SetWindowName("SelectEmpireWindow")
		self.Show()	

		self.__LoadScript("d:/ymir work/interface/wybor_krolestwa/SelectEmpireWindow.py")

		self.OnSelectEmpire(self.empireID)
		self.__CreateButtons()
		app.ShowCursor()

	def __CreateButtons(self):
		for key, img in self.empireArea.items():

			img.SetAlpha(0.0)

			(x, y) = img.GetGlobalPosition()
			btn = self.EmpireButton(_weakref.proxy(self), key)
			btn.SetParent(self)
			btn.SetPosition(x, y)
			btn.SetSize(img.GetWidth(), img.GetHeight())
			btn.Show()
			self.empireAreaButton[key] = btn
			
	def OnOverInEmpire(self, arg):
		self.empireAreaDestAlpha[arg] = 1.0

	def OnOverOutEmpire(self, arg):
		if arg != self.empireID:
			self.empireAreaDestAlpha[arg] = 0.0

	def OnSelectEmpire(self, arg):
		for key in self.empireArea.keys():
			self.empireAreaDestAlpha[key] = 0.0
		self.empireAreaDestAlpha[arg] = 1.0
		self.empireID = arg
		
		img = {1: "shinsoo", 3:"jinno"}

	def __LoadScript(self, fileName):
		try:
			pyScrLoader = ui.PythonScriptLoader()
			pyScrLoader.LoadScriptFile(self, fileName)	
		except:
			import exception
			exception.Abort("SelectEmpireWindow.__LoadScript.LoadObject")

		try:
			self.wybieram_jinno = self.GetChild("WybierzJinno")
			self.wybieram_shinsoo = self.GetChild("WybierzShinsoo")
			self.exit = self.GetChild("exit")
			
		except:
			import exception
			exception.Abort("SelectEmpireWindow.__LoadScript.BindObject")					

		self.wybieram_jinno.SetEvent(ui.__mem_func__(self._wybieram_jinno))
		self.wybieram_shinsoo.SetEvent(ui.__mem_func__(self._wybieram_shinsoo))
		self.exit.SetEvent(ui.__mem_func__(self.OnPressExitKey))
		
		
	def _wybieram_jinno(self):
		self.empireID = 3
		self.Wybieranie()
	
	def _wybieram_shinsoo(self):
		self.empireID = 1
		self.Wybieranie()
		
		
	def Wybieranie(self):
		EMPIRE_NAME = {
			net.EMPIRE_A : "Shinsoo", 
			net.EMPIRE_B : "", 
			net.EMPIRE_C : "Jinno" 
		}
		questionDialog = uiCommon.QuestionDialog()
		questionDialog.SetText(" "+EMPIRE_NAME[self.empireID]+"'ya katýlmak istermisin?")
		questionDialog.SetAcceptEvent(ui.__mem_func__(self.__krolestwo_open))
		questionDialog.SetCancelEvent(ui.__mem_func__(self.__krolestwo_close))
		questionDialog.Open()
		self.questionDialog = questionDialog

	def __krolestwo_open(self):
		self.questionDialog.Hide()
		net.SendSelectEmpirePacket(self.empireID)
		self.stream.SetCreateCharacterPhase()

	def __krolestwo_close(self):
		self.questionDialog.Hide()

	def ClickExitButton(self):
		self.stream.SetLoginPhase()

	def OnUpdate(self):
		self.__UpdateAlpha(self.empireArea, self.empireAreaCurAlpha, self.empireAreaDestAlpha)

	def __UpdateAlpha(self, dict, curAlphaDict, destAlphaDict):
		for key, img in dict.items():

			curAlpha = curAlphaDict[key]
			destAlpha = destAlphaDict[key]

			if abs(destAlpha - curAlpha) / 10 > 0.0001:
				curAlpha += (destAlpha - curAlpha) / 7
			else:
				curAlpha = destAlpha

			curAlphaDict[key] = curAlpha
			img.SetAlpha(curAlpha)

	def OnPressEscapeKey(self):
		self.ClickExitButton()
		return TRUE
		
	def OnPressExitKey(self):
		self.ClickExitButton()
		return TRUE

class ReselectEmpireWindow(SelectEmpireWindow):
	def ClickSelectButton(self):
		net.SendSelectEmpirePacket(self.empireID)
		self.stream.SetCreateCharacterPhase()

	def ClickExitButton(self):
		self.stream.SetSelectCharacterPhase()

        
 //////////////////////////////////////////////////////////////////////////////
SELECTEMPIREWINDOW

window = {
	"name" : "SelectEmpireWindow",
	"x" : 0,
	"y" : 0,
	"width" : SCREEN_WIDTH,
	"height" : SCREEN_HEIGHT,
	"children" :
	(
		{
			"name" : "BackGround",
			"type" : "expanded_image",
			"x" : 0,
			"y" : 0,
			"x_scale" : float(SCREEN_WIDTH) / 1280.0,
			"y_scale" : float(SCREEN_HEIGHT) / 720.0,
			"image" : "d:/ymir work/interface/wybor_krolestwa/tlo.jpg",
			"children" :
			(
		{"name":"LogoSerwera","type":"image","x":20,"y":-210,"horizontal_align":"center","image":"d:/ymir work/interface/logowanie/logo.tga","horizontal_align":"center","vertical_align":"center",},
				{
					"name":"Shinsoo",
					"type":"image",
					"x" : -200,
					"y":SCREEN_HEIGHT/9,
					"horizontal_align":"center",
					"vertical_align":"center",
					"image":"d:/ymir work/interface/wybor_krolestwa/shinsoo.tga",
					"children":
					(
						{
							"name" : "WybierzShinsoo",
							"type" : "button",
							"x" : 0,
							"y":135,
							"horizontal_align":"center",
							"default_image" : "d:/ymir work/interface/wybor_krolestwa/wybierz_01.tga",
							"over_image" :  "d:/ymir work/interface/wybor_krolestwa/wybierz_02.tga",
							"down_image" : "d:/ymir work/interface/wybor_krolestwa/wybierz_02.tga",
						},
					),
				},
				{
					"name":"Jinno",
					"type":"image",
					"x" : 200,
					"y":SCREEN_HEIGHT/9,
					"horizontal_align":"center",
					"vertical_align":"center",
					"image":"d:/ymir work/interface/wybor_krolestwa/jinno.tga",
					"children":
					(
						{
							"name" : "WybierzJinno",
							"type" : "button",
							"x" : 0,
							"y":135,
							"horizontal_align":"center",
							"default_image" : "d:/ymir work/interface/wybor_krolestwa/wybierz_01.tga",
							"over_image" :  "d:/ymir work/interface/wybor_krolestwa/wybierz_02.tga",
							"down_image" : "d:/ymir work/interface/wybor_krolestwa/wybierz_02.tga",
						},
					),
				},
		{"name":"exit","type":"button","x":50,"y":15,"default_image":"d:/ymir work/interface/logowanie/wyjdz_01.tga","over_image":"d:/ymir work/interface/logowanie/wyjdz_02.tga","down_image":"d:/ymir work/interface/logowanie/wyjdz_02.tga", "horizontal_align":"right",},
			),
		},
	),
}

 

Edited by ilovegreendays
Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

import ui
import net
import wndMgr
import dbg
import app
import event
import _weakref
import uiScriptLocale

LOCALE_PATH = "uiscript/"+uiScriptLocale.CODEPAGE+"_"

class SelectEmpireWindow(ui.ScriptWindow):

    class EmpireButton(ui.Window):
        def __init__(self, owner, arg):
            ui.Window.__init__(self)
            self.owner = owner
            self.arg = arg
        def OnMouseOverIn(self):
            self.owner.OnOverInEmpire(self.arg)
        def OnMouseOverOut(self):
            self.owner.OnOverOutEmpire(self.arg)
        def OnMouseLeftButtonDown(self):
            self.owner.OnSelectEmpire(self.arg)

    def __init__(self, stream):
        print "NEW EMPIRE WINDOW  ----------------------------------------------------------------------------"
        ui.ScriptWindow.__init__(self)
        net.SetPhaseWindow(net.PHASE_WINDOW_EMPIRE, self)

        self.stream=stream
        self.descIndex=0
        self.empireArea = {}
        self.empireAreaButton = {}

    def __del__(self):
        ui.ScriptWindow.__del__(self)
        net.SetPhaseWindow(net.PHASE_WINDOW_EMPIRE, 0)
        print "---------------------------------------------------------------------------- DELETE EMPIRE WINDOW"

    def Close(self):
        print "---------------------------------------------------------------------------- CLOSE EMPIRE WINDOW"        

        self.ClearDictionary()
        self.exitButton = None
        self.empireArea = None
        self.empireAreaButton = None

        self.KillFocus()
        self.Hide()

        app.HideCursor()
        event.Destroy()

    def Open(self):
        print "OPEN EMPIRE WINDOW ----------------------------------------------------------------------------"

        self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
        self.SetWindowName("SelectEmpireWindow")
        self.Show()    

        if not self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "SelectEmpireWindow.py"):
            dbg.TraceError("SelectEmpireWindow.Open - __LoadScript Error")
            return

        self.__CreateButtons()
        app.ShowCursor()

    def __CreateButtons(self):
        for key, img in self.empireArea.items():

            #img.SetAlpha(0.0)

            (x, y) = img.GetGlobalPosition()
            btn = self.EmpireButton(_weakref.proxy(self), key)
            btn.SetParent(self)
            btn.SetPosition(x, y)
            btn.SetSize(img.GetWidth(), img.GetHeight())
            btn.Show()
            self.empireAreaButton[key] = btn

    def OnOverInEmpire(self, arg):
        if arg == 1:
            self.shinsoo.LoadImage('locale/hu/ui/shinsoo_jasne.tga')
        else:
            self.jinno.LoadImage('locale/hu/ui/jinno_jasne.tga')
            
    def OnOverOutEmpire(self, arg):
        if arg == 1:
            self.shinsoo.LoadImage('locale/hu/ui/shinsoo_ciemne.tga')
        else:
            self.jinno.LoadImage('locale/hu/ui/jinno_ciemne.tga')
            
    def OnSelectEmpire(self, arg):
        arg1 = arg
        if arg1 == 2:
            arg1 = 3
        self.empireID = arg1
        net.SendSelectEmpirePacket(self.empireID)
        self.stream.SetCreateCharacterPhase()

    def __LoadScript(self, fileName):
        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self, fileName)    
        except:
            import exception
            exception.Abort("SelectEmpireWindow.__LoadScript.LoadObject")

        try:
            GetObject=self.GetChild
            self.shinsoo = GetObject("Shinsoo")
            self.jinno = GetObject("Jinno")
            self.empireArea[1] = self.shinsoo
            self.empireArea[2] = self.jinno
        except:
            import exception
            exception.Abort("SelectEmpireWindow.__LoadScript.BindObject")                    

        return 1

    def OnUpdate(self):
        pass

    def OnPressEscapeKey(self):
        self.ClickExitButton()
        return TRUE
        
    def OnPressExitKey(self):
        self.ClickExitButton()
        return TRUE

class ReselectEmpireWindow(SelectEmpireWindow):
    def ClickSelectButton(self):
        net.SendSelectEmpirePacket(self.empireID)
        self.stream.SetCreateCharacterPhase()

    def ClickExitButton(self):
        self.stream.SetSelectCharacterPhase()
 

 

#####################################################

 

import uiScriptLocale

ROOT_PATH = "d:/ymir work/ui/public/"
LOCALE_PATH = uiScriptLocale.EMPIRE_PATH

ATALS_X = SCREEN_WIDTH * (282) / 800
ATALS_Y = SCREEN_HEIGHT * (170) / 600

window = {
    "name" : "SelectCharacterWindow",

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

    "width" : SCREEN_WIDTH,
    "height" : SCREEN_HEIGHT,

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

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

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

            "rect" : (0.0, 0.0, float(SCREEN_WIDTH - 128) / 128.0, float(SCREEN_HEIGHT - 128 - 42*2) / 128.0),
        },

        ## Alpha
        {
            "name" : "Alpha",
            "type" : "expanded_image",

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

            "image" : "d:/ymir work/ui/intro/select/background_alpha.sub",

            "x_scale" : float(SCREEN_WIDTH) / 100.0,
            "y_scale" : float(SCREEN_HEIGHT) / 69.0,
        },

        ## Top & Bottom Line
        {
            "name" : "Top_Line",
            "type" : "expanded_image",

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

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

            "rect" : (0.0, 0.0, float(SCREEN_WIDTH - 50) / 50.0, 0.0),
        },
        {
            "name" : "Bottom_Line",
            "type" : "expanded_image",

            "x" : 0,
            "y" : SCREEN_HEIGHT - 42,

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

            "rect" : (0.0, 0.0, float(SCREEN_WIDTH - 50) / 50.0, 0.0),
        },

        ## Title
        {
            "name" : "Title",
            "type" : "expanded_image",

            "x" : SCREEN_WIDTH * (410 - 346/2) / 800,
            "y" : SCREEN_HEIGHT * (114 - 136/2) / 600,
            "x_scale" : float(SCREEN_WIDTH) / 800.0,
            "y_scale" : float(SCREEN_HEIGHT) / 600.0,

            "image" : LOCALE_PATH+"title.sub"
        },

        ## Atlas
        {
            "name" : "Atlas",
            "type" : "image",

            "x" : ATALS_X,
            "y" : ATALS_Y,

            "image" : "d:/ymir work/ui/intro/empire/atlas.sub",

            "children" :
            (
                ## Empire Image
                {
                    "name" : "EmpireArea_A",
                    "type" : "expanded_image",

                    "x" : 43,
                    "y" : 201,

                    "image" : "d:/ymir work/ui/intro/empire/empirearea_a.sub"
                },
                {
                    "name" : "EmpireArea_B",
                    "type" : "expanded_image",

                    "x" : 17,
                    "y" : 16,

                    "image" : "d:/ymir work/ui/intro/empire/empirearea_b.sub"
                },
                {
                    "name" : "EmpireArea_C",
                    "type" : "expanded_image",

                    "x" : 314,
                    "y" : 33,

                    "image" : "d:/ymir work/ui/intro/empire/empirearea_c.sub"
                },

                ## Empire Flag
                {
                    "name" : "EmpireAreaFlag_A",
                    "type" : "expanded_image",

                    "x" : 167,
                    "y" : 235,

                    "image" : "d:/ymir work/ui/intro/empire/empireareaflag_a.sub"
                },
                {
                    "name" : "EmpireAreaFlag_B",
                    "type" : "expanded_image",

                    "x" : 70,
                    "y" : 42,

                    "image" : "d:/ymir work/ui/intro/empire/empireareaflag_b.sub"
                },
                {
                    "name" : "EmpireAreaFlag_C",
                    "type" : "expanded_image",

                    "x" : 357,
                    "y" : 78,

                    "image" : "d:/ymir work/ui/intro/empire/empireareaflag_c.sub"
                },
            ),
        },

        ## Buttons
        {
            "name" : "left_button",
            "type" : "button",

            "x" : ATALS_X + 160,
            "y" : ATALS_Y + 340,

            "default_image" : "d:/ymir work/ui/intro/select/left_button_01.sub",
            "over_image" : "d:/ymir work/ui/intro/select/left_button_02.sub",
            "down_image" : "d:/ymir work/ui/intro/select/left_button_03.sub",
        },
        {
            "name" : "right_button",
            "type" : "button",

            "x" : ATALS_X + 160 + 130,
            "y" : ATALS_Y + 340,

            "default_image" : "d:/ymir work/ui/intro/select/right_button_01.sub",
            "over_image" : "d:/ymir work/ui/intro/select/right_button_02.sub",
            "down_image" : "d:/ymir work/ui/intro/select/right_button_03.sub",
        },

        ## Character Board
        {
            "name" : "empire_board",
            "type" : "thinboard",

            "x" : SCREEN_WIDTH * (40) / 800,
            "y" : SCREEN_HEIGHT * (211) / 600,

            "width" : 208,
            "height" : 314,

            "children" :
            (
                ## Bar
                {
                    "name" : "flag_board",
                    "type" : "bar",

                    "x" : 24,
                    "y" : 17,
                    "width" : 159,
                    "height" : 119,

                    "children" :
                    (
                        ## Empire Flag
                        {
                            "name" : "EmpireFlag_A",
                            "type" : "expanded_image",

                            "x" : 0,
                            "y" : 0,
                            "horizontal_align" : "center",
                            "vertical_align" : "center",

                            "image" : "d:/ymir work/ui/intro/empire/empireflag_a.sub"
                        },
                        {
                            "name" : "EmpireFlag_B",
                            "type" : "expanded_image",

                            "x" : 0,
                            "y" : 0,
                            "horizontal_align" : "center",
                            "vertical_align" : "center",

                            "image" : "d:/ymir work/ui/intro/empire/empireflag_b.sub"
                        },
                        {
                            "name" : "EmpireFlag_C",
                            "type" : "expanded_image",

                            "x" : 0,
                            "y" : 0,
                            "horizontal_align" : "center",
                            "vertical_align" : "center",

                            "image" : "d:/ymir work/ui/intro/empire/empireflag_c.sub"
                        },
                    ),

                },
                {
                    "name" : "text_board",
                    "type" : "bar",

                    "x" : 10,
                    "y" : 146,

                    "width" : 189,
                    "height" : 122,

                    "children" :
                    (
                        {
                            "name" : "prev_text_button",
                            "type" : "button",

                            "x" : 95,
                            "y" : 95,

                            "text" : uiScriptLocale.EMPIRE_PREV,

                            "default_image" : ROOT_PATH + "Small_Button_01.sub",
                            "over_image" : ROOT_PATH + "Small_Button_02.sub",
                            "down_image" : ROOT_PATH + "Small_Button_03.sub",
                        },
                        {
                            "name" : "next_text_button",
                            "type" : "button",

                            "x" : 140,
                            "y" : 95,

                            "text" : uiScriptLocale.EMPIRE_NEXT,

                            "default_image" : ROOT_PATH + "Small_Button_01.sub",
                            "over_image" : ROOT_PATH + "Small_Button_02.sub",
                            "down_image" : ROOT_PATH + "Small_Button_03.sub",
                        },
                        {
                            "name" : "right_line",
                            "type" : "line",

                            "x" : 189-1,
                            "y" : -1,

                            "width" : 0,
                            "height" : 122,

                            "color" : 0xffAAA6A1,
                        },
                        {
                            "name" : "bottom_line",
                            "type" : "line",

                            "x" : 0,
                            "y" : 122-1,

                            "width" : 189,
                            "height" : 0,

                            "color" : 0xffAAA6A1,
                        },
                        {
                            "name" : "left_line",
                            "type" : "line",

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

                            "width" : 0,
                            "height" : 122-1,

                            "color" : 0xff2A2521,
                        },
                        {
                            "name" : "top_line",
                            "type" : "line",

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

                            "width" : 189,
                            "height" : 0,

                            "color" : 0xff2A2521,
                        },
                    ),
                },

                ## Buttons
                {
                    "name" : "select_button",
                    "type" : "button",

                    "x" : 14,
                    "y" : 277,

                    "text" : uiScriptLocale.EMPIRE_SELECT,

                    "default_image" : ROOT_PATH + "Large_Button_01.sub",
                    "over_image" : ROOT_PATH + "Large_Button_02.sub",
                    "down_image" : ROOT_PATH + "Large_Button_03.sub",
                },
                {
                    "name" : "exit_button",
                    "type" : "button",

                    "x" : 105,
                    "y" : 277,

                    "text" : uiScriptLocale.EMPIRE_EXIT,

                    "default_image" : ROOT_PATH + "Large_Button_01.sub",
                    "over_image" : ROOT_PATH + "Large_Button_02.sub",
                    "down_image" : ROOT_PATH + "Large_Button_03.sub",
                },

            ),
        },
    ),
}
 

My code is it and working. Only jinno and shinsoo.

Link to comment
Share on other sites

  • 3 weeks later...
On 2/22/2020 at 6:51 PM, ilovegreendays said:

Thx, but i want to know why my code didnt work :(

ah Yes u make a lots of mistake but i can show u what Follow this!

So take ur original introempire.py (with 3 kingdoms)

and search for 

net.EMPIRE_B : uiScriptLocale.EMPIREDESC_B,

and delet it

after this search for

self.empireAreaCurAlpha = { net.EMPIRE_A:0.0, net.EMPIRE_B:0.0, net.EMPIRE_C:0.0 }

and delete: net.EMPIRE_B:0.0,

search for

 self.empireArea[net.EMPIRE_B] = GetObject("EmpireArea_B"

and delete it

Search for the line

def ClickLeftButton(self):
self.empireID-=1
if self.empireID<1:
self.empireID=3

and instead of self.empireID=3 Put 2 (The number)

Search for the line

self.OnSelectEmpire(self.empireID)

def ClickRightButton(self):
self.empireID+=1
if self.empireID>3:
self.empireID=1

and againe instead of if self.empireid>3: put 2 (the same like before)

And the last search for :

self.empireID=app.GetRandom(1, 3) And instead of 3 put 2

self.empireID=app.GetRandom(1, 2) Should look like this

After u done this u have the problem with selecting no?

 

Go to -> selectempirewindow.py and search for this -> "name" : "EmpireFlag_B" <- and delete it.

 

Go to -> uiscript and delete the description of B - chunjoo

 

and i think that is it of course u need to go to the source of the game and modify there but idk yet..... i`m not that good at the Source ....

 

Just follow what i left here and if is something wrong let me know 

Edited by ilgryu
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.