Metin2 Hungarian Forum

Metin2 => Szerver készítés => Privát szerverek => Segítség => A témát indította: udvatt108 Dátum 2017-10-28, 23:13:02

Cím: Karakter választó modifikáció
Írta: udvatt108 Dátum 2017-10-28, 23:13:02
Hali!

Valaki tudja, hogy hol kell és mit kell átírni a karakterválasztóban, hogy az ne forgatva váltson karakter nézetet, hanem oldalra "lapozva"? Próbálgattam az alábbi kódban írogatni, de akkor is forog, maximum össze vissza csúszkál. :(

def OnRender(self):
grp.ClearDepthBuffer()

grp.SetGameRenderState()
grp.PushState()
grp.SetOmniLight()

screenWidth = wndMgr.GetScreenWidth()
screenHeight = wndMgr.GetScreenHeight()
newScreenWidth = float(screenWidth - 340)
newScreenHeight = float(screenHeight)

grp.SetViewport(340.0/screenWidth, 0.0, newScreenWidth/screenWidth, newScreenHeight/screenHeight)

app.SetCenterPosition(0.0, 0.0, 0.0)
app.SetCamera(1550.0, 15.0, 180.0, 95.0)
grp.SetPerspective(13.0, newScreenWidth/newScreenHeight, 1000.0, 3000.0)

(x, y) = app.GetCursorPosition()
grp.SetCursorPosition(x, y)

chr.Deform()
chr.Render()

grp.RestoreViewport()
grp.PopState()
grp.SetInterfaceRenderState()
Cím: Re:Karakter választó modifikáció
Írta: 5310pati Dátum 2017-10-28, 23:24:08
Mert nem az felel érte.
Kövesd vissza a gombok alapján:
self.btnLeft.SetEvent(ui.__mem_func__(self.DecreaseSlotIndex))
self.btnRight.SetEvent(ui.__mem_func__(self.IncreaseSlotIndex))

def DecreaseSlotIndex(self):
slotIndex = (self.GetSlotIndex() - 1 + self.SLOT_COUNT) % self.SLOT_COUNT
self.SelectSlot(slotIndex)

def IncreaseSlotIndex(self):
slotIndex = (self.GetSlotIndex() + 1) % self.SLOT_COUNT
self.SelectSlot(slotIndex)

def SelectSlot(self, index):
for i in xrange(self.SLOT_COUNT):
self.destRotation[(i+self.slot)%self.SLOT_COUNT] = self.SLOT_ROTATION[i]

dir = app.GetRotatingDirection(self.destRotation[i], self.curRotation[i])
rot = app.GetDegreeDifference(self.destRotation[i], self.curRotation[i])
Cím: Re:Karakter választó modifikáció
Írta: udvatt108 Dátum 2017-10-28, 23:32:21
Itt sem reagál, de nem is találok ebben onnyira befolyásoló értéket. Inkább az Update részben látok potenciát, te mit gondolsz?

def OnUpdate(self):
chr.Update()

for i in xrange(4):
self.curGauge[i] += (self.destGauge[i] - self.curGauge[i]) / 10.0
if abs(self.curGauge[i] - self.destGauge[i]) < 0.005:
self.curGauge[i] = self.destGauge[i]
self.GaugeList[i].SetPercentage(self.curGauge[i], 1.0)

for i in xrange(self.CHARACTER_TYPE_COUNT):
self.curNameAlpha[i] += (self.destNameAlpha[i] - self.curNameAlpha[i]) / 10.0
self.NameList[i].SetAlpha(self.curNameAlpha[i])

for i in xrange(self.SLOT_COUNT):

if False == chr.HasInstance(i):
continue

chr.SelectInstance(i)

distance = 50.0
rotRadian = self.curRotation[i] * (math.pi*2) / 360.0
x = distance*math.sin(rotRadian) + distance*math.cos(rotRadian)
y = distance*math.cos(rotRadian) - distance*math.sin(rotRadian)
chr.SetPixelPosition(int(x), int(y), 30)

#####

dir = app.GetRotatingDirection(self.destRotation[i], self.curRotation[i])
rot = app.GetDegreeDifference(self.destRotation[i], self.curRotation[i])

if app.DEGREE_DIRECTION_RIGHT == dir:
self.curRotation[i] += rot / 10.0
elif app.DEGREE_DIRECTION_LEFT == dir:
self.curRotation[i] -= rot / 10.0

self.curRotation[i] = (self.curRotation[i] + 360.0) % 360.0

#######################################################
if -1 != self.startIndex:

## Temporary
## BackGroundLoading이 지원 될때까지 임시로..
if app.GetTime() - self.startReservingTime > 3.0:
if False == self.openLoadingFlag:
chrSlot=self.stream.GetCharacterSlot()
net.DirectEnter(chrSlot)
self.openLoadingFlag = True

playTime=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)

import player
player.SetPlayTime(playTime)
import chat
chat.Clear() ## 들어갈때 Chat 을 초기화. 임시 Pos.
## Temporary
#######################################################
Cím: Re:Karakter választó modifikáció
Írta: 5310pati Dátum 2017-10-29, 00:26:20
Azt h ott a megoldás csak nem látod:
distance = 50.0
rotRadian = self.curRotation[i] * (math.pi*2) / 360.0
x = distance*math.sin(rotRadian) + distance*math.cos(rotRadian)
y = distance*math.cos(rotRadian) - distance*math.sin(rotRadian)
chr.SetPixelPosition(int(x), int(y), 30)

SLOT_ROTATION = [135.0, 225.0, 315.0, 45.0]
Cím: Re:Karakter választó modifikáció
Írta: udvatt108 Dátum 2017-10-29, 00:44:34
Szia(sztok)

Az a helyzet, hogy az alap rotációs megoldást pár érték átírásával nem lehet lapozósra váltani.

Ezért úgy döntöttem, hogy újra írom.

Nem volt nagy dolgom, mint hogy a teljes rotációt törölni és a négy slotot "chr.DeleteInstance(x)"-val törölni, aztán slot váltóban "instance/slot" meg mutatni és MakeCharacter funkcióval létrehozni a karaktert.

És lőn világosság. :) Így nincs feleslegen karakter deklarálás, mindig törli az előzőt és az újat mutatja.

Kösz ismét azért.
De 1 órát állítgattam sikertelenül, viszont 20 perc alatt átírtam sikeresen. - Máskor ezzel kezdem. -_-
EhPortal 1.39 © 2025, WebDev