Problema select empire

Totalitatea subiectelor care nu respectă regulamentul impus in sectiunea "Probleme şi Întrebări" vor fi stocate aici.
Închis
Avatar utilizator
adrian.olaru
Nou Venit

Nou Venit
Mesaje: 29
Membru din: 13 Iul 2019, 09:54
Aprecieri: 17  
Mulţumiri: 0
Medalii

*Problemă/Întrebare: PRoblema Select Empire
Tipologie server(PvM / PvP): PvM Medium
*Resursă folosită: * Trinity
*ServerFiles utilizat: Trinity
*Syserr: --
*Poza: --
*Detalii suplimentare:
Salut Just, Dupa cum spune si titlu am o problema legata de select empire.
Am instalat interfata noua merge totul perfect dar are doar doua regate ( rosu si galben ).
Cum pot sa modific sa fac din galben - albastru, adica sa fie Rosu si Albastru.

Acesta e introempire.py
import ui
import net
import dbg
import grp
import app
import event
import wndMgr
import _weakref
import uiToolTip
import localeInfo
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("twix_work/selectempirewindow/selectempirewindow.py"):
dbg.TraceError("SelectEmpireWindow.Open - __LoadScript Error")
return

self.__CreateButtons()
app.ShowCursor()

def __CreateButtons(self):
for key, img in self.empireArea.items():
(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
#3 Regate by [Tupeu]
def OnOverInEmpire(self, arg):
if arg == 1:
self.ascalon.LoadImage('twix_work/selectempirewindow/mildos_1.tga')
elif arg == 2:
self.mildos.LoadImage('twix_work/selectempirewindow/ascalon_1.tga')

def OnOverOutEmpire(self, arg):
if arg == 1:
self.ascalon.LoadImage('twix_work/selectempirewindow/mildos_0.tga')
elif arg == 2:
self.mildos.LoadImage('twix_work/selectempirewindow/ascalon_0.tga')

def OnSelectEmpire(self, arg):
self.empireID = arg
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.exitButton = self.GetChild("exit_button")
self.ascalon = GetObject("Ascalon")
self.mildos = GetObject("Mildos")
self.empireArea[1] = self.ascalon
self.empireArea[2] = self.mildos
except:
import exception
exception.Abort("SelectEmpireWindow.__LoadScript.BindObject")

self.exitButton.SetEvent(ui.__mem_func__(self.ClickExitButton))

return 1

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

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()
Si acesta selectempirewindow.py
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" :
(
{
"name" : "Background",
"type" : "expanded_image",

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

"horizontal_align" : "center",
"vertical_align" : "center",

"image" : "twix_work/loginwindow/background.tga",

"x_scale" : float(SCREEN_WIDTH) / 1366.0,
"y_scale" : float(SCREEN_HEIGHT) / 768.0,

"children" :
(
{
"name" : "Ascalon",
"type" : "expanded_image",

"x" : -350,
"y" : 0,

"horizontal_align" : "center",
"vertical_align" : "center",
"width" : 308,
"height" : 154,
"image" : "twix_work/selectempirewindow/mildos_0.tga",
},
{
"name" : "Mildos",
"type" : "expanded_image",

"x" : 350,
"y" : 0,
"width" : 308,
"height" : 154,
"horizontal_align" : "center",
"vertical_align" : "center",

"image" : "twix_work/selectempirewindow/ascalon_0.tga",
},
{
"name" : "Blue",
"type" : "expanded_image",
"width" : 308,
"height" : 154,
"x" : 0,
"y" : 0,

"horizontal_align" : "center",
"vertical_align" : "center",

"image" : "twix_work/selectempirewindow/blue_0.tga",
},
),
},
{
"name" : "exit_button",
"type" : "button",

"x" : SCREEN_WIDTH - 110,
"y" : 10,

"default_image" : "twix_work/loginwindow/button_0.tga",
"over_image" : "twix_work/loginwindow/button_1.tga",
"down_image" : "twix_work/loginwindow/button_2.tga",

"children" :
(
{
"name" : "exit_text",
"type" : "text",

"x" : 36,
"y" : 7,

"text" : uiScriptLocale.LOGIN_EXIT,
"color" : 0xffe8b478,
},
),
},
),
}
}

## 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"
},
{
"type" : "expanded_image",

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

"image" : "d:/ymir work/ui/intro/empire/empireflag_c.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",
},

),
},
),
}
Ultima oară modificat 12 Noi 2020, 08:47 de către adrian.olaru, modificat 1 dată în total.
Avatar utilizator
SkyLine
Membru Club

Membru Club
Mesaje: 2655
Membru din: 12 Dec 2013, 23:37
Server: Miraj2-Online
Regat: Jinno
Aprecieri: 520  
Mulţumiri: 987  
Discord: Copiază ID
 Contact:
Medalii

1. Te rog sa-ti editezi topicul si sa folosesti modelul de postare : probleme/model-postare-intrebare-sau-pr ... 67107.html . Ai 24h la dispozitie.

2. self.ascalon = GetObject("Ascalon")
self.mildos = GetObject("Mildos")
self.empireArea[1] = self.ascalon
self.empireArea[2] = self.mildos

Din ceea ce vad, astea 2 linii fac legatura cu regatul pe care-l alegi :

self.empireArea[1] = self.ascalon
self.empireArea[2] = self.mildos

Celelalte 2 fac legatura cu imaginile lor din client

Vezi pe unde mai ai, prin client "self.empireArea[1]" sau "self.ascalon"... respectiv si la celalalt ... si revino cu reply

Sanse ar fi sa fie ceva legat si de scriptul asta :

def OnSelectEmpire(self, arg):
self.empireID = arg
net.SendSelectEmpirePacket(self.empireID)
self.stream.SetCreateCharacterPhase()
Avatar utilizator
adrian.olaru
Nou Venit

Nou Venit
Mesaje: 29
Membru din: 13 Iul 2019, 09:54
Aprecieri: 17  
Mulţumiri: 0
Medalii

Am inteles, Revin cu edit!
Avatar utilizator
adrian.olaru
Nou Venit

Nou Venit
Mesaje: 29
Membru din: 13 Iul 2019, 09:54
Aprecieri: 17  
Mulţumiri: 0
Medalii

Rezolvat, T/C
Avatar utilizator
SkyLine
Membru Club

Membru Club
Mesaje: 2655
Membru din: 12 Dec 2013, 23:37
Server: Miraj2-Online
Regat: Jinno
Aprecieri: 520  
Mulţumiri: 987  
Discord: Copiază ID
 Contact:
Medalii

Arhivat

[ Postat de pe Android ] Imagine
Închis

Înapoi la “Arhivă Probleme şi Întrebări”

  • Informaţie
  • Cine este conectat

    Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 92 vizitatori