Hello
First, you have to know this guide was made with extended highlights for 3 slots! Possible to the syntaxes are differents, so need a glass of brain to implement it. :awesome:
Bitte melden Sie sich an, um dieses Bild zu sehen.
Bitte melden Sie sich an, um diesen Link zu sehen.
With this modification you will be able to set the color of the animation for the items in the activate function. Here are some predefined colors from the binary of GF.
- Orange
- White (Original)
- Red
- Green
- Yellow
- Aqua
- Pink (almost purple)
Bitte melden Sie sich an, um dieses Bild zu sehen.
/'Pride of the daggers' by Step/
So, let's start!
1. EterPythonLib\PythonSlotWindow.h
Paste this enum into the UI namespace:
Below a little in the SlotWindow class already, search the TSlot type definition and extend w/ a new variable(below of the bActive):
Still in this file add a new argument to the ActivateSlot function like this way:
Done.
2. EterPythonLib\PythonSlotWindow.cpp
Search this function: void CSlotWindow::ClearSlot(TSlot * pSlot) and extend with the following line below to the bActive:
Now search this function void CSlotWindow::ActivateSlot, and add the new argument as in the header file:
And inside the function paste this above the bActive = TRUE:
Jump to the void CSlotWindow::OnRender function and search this if-statement: if (rSlot.bActive)
This is a complicate step, because there are many solutions exists, so I show my code to see how I did.
- if (rSlot.bActive)
- {
- BYTE byItemSize = rSlot.byyPlacedItemSize - 1;
- if (byItemSize < 0 || byItemSize > 2)
- byItemSize = 0;
- if (m_pSlotActiveEffect[byItemSize])
- {
- int ix = m_rect.left + rSlot.ixPosition;
- int iy = m_rect.top + rSlot.iyPosition;
- m_pSlotActiveEffect[byItemSize]->SetPosition(ix, iy);
- m_pSlotActiveEffect[byItemSize]->SetDiffuseColorByType(rSlot.byToggleColorType);
- m_pSlotActiveEffect[byItemSize]->Render();
- }
- }
Done.
3. EterPythonLib\PythonWindow.h
Search the following class-definition
And define these functions below of the SetRenderingMode(Be carefull! CAniImageBox class!!!):
Done.
4. EterPythonLib\PythonWindow.cpp
Paste the followings above of the void CAniImageBox::SetDelay function:
- struct FSetDiffuseColor
- {
- float fr, fg, fb, fa;
- void operator () (CGraphicExpandedImageInstance * pInstance)
- {
- pInstance->SetDiffuseColor(fr, fg, fb, fa);
- }
- };
- void CAniImageBox::SetDiffuseColor(float fR, float fG, float fB, float fA)
- {
- FSetDiffuseColor setDiffuseColor;
- setDiffuseColor.fr = fR;
- setDiffuseColor.fg = fG;
- setDiffuseColor.fb = fB;
- setDiffuseColor.fa = fA;
- for_each(m_ImageVector.begin(), m_ImageVector.end(), setDiffuseColor);
- }
- void CAniImageBox::SetDiffuseColorByType(BYTE byColorType)
- {
- float fr = 1.0f, fg = 1.0f, fb = 1.0f, fa = 1.0f;
- switch (byColorType)
- {
- case COLOR_TYPE_ORANGE:
- fr = 1.0f; fg = 0.34509805f; fb = 0.035294119f; fa = 0.5f;
- break;
- case COLOR_TYPE_WHITE:
- fr = 1.0f; fg = 1.0f; fb = 1.0f; fa = 0.5f;
- break;
- case COLOR_TYPE_RED:
- fr = 1.0f; fg = 0.0f; fb = 0.0f; fa = 0.5f;
- break;
- case COLOR_TYPE_GREEN:
- fr = 0.0f; fg = 1.0f; fb = 0.0f; fa = 0.5f;
- break;
- case COLOR_TYPE_YELLOW:
- fr = 1.0f; fg = 1.0f; fb = 0.0f; fa = 0.5f;
- break;
- case COLOR_TYPE_SKY:
- fr = 0.0f; fg = 1.0f; fb = 1.0f; fa = 0.5f;
- break;
- case COLOR_TYPE_PINK:
- fr = 1.0f; fg = 0.0f; fb = 1.0f; fa = 0.5f;
- break;
- default:
- return;
- break;
- }
- SetDiffuseColor(fr, fg, fb, fa);
- }
Done.
5. EterPythonLib\PythonWindowManagerModule.cpp
Replace the whole PyObject * wndMgrActivateSlot function w/ this:
- PyObject * wndMgrActivateSlot(PyObject * poSelf, PyObject * poArgs)
- {
- UI::CWindow * pWin;
- if (!PyTuple_GetWindow(poArgs, 0, &pWin))
- return Py_BuildException();
- int iSlotIndex;
- if (!PyTuple_GetInteger(poArgs, 1, &iSlotIndex))
- return Py_BuildException();
- int iColorType;
- if (!PyTuple_GetInteger(poArgs, 2, &iColorType))
- iColorType = UI::COLOR_TYPE_WHITE;
- if (!pWin->IsType(UI::CSlotWindow::Type()) || (iColorType < UI::COLOR_TYPE_ORANGE || iColorType >= UI::COLOR_TYPE_MAX))
- return Py_BuildException();
- UI::CSlotWindow * pSlotWin = (UI::CSlotWindow *)pWin;
- pSlotWin->ActivateSlot(iSlotIndex, iColorType);
- return Py_BuildNone();
- }
Scroll down to the bottom of the file and paste these constants:
- PyModule_AddIntConstant(poModule, "COLOR_TYPE_ORANGE", UI::COLOR_TYPE_ORANGE);
- PyModule_AddIntConstant(poModule, "COLOR_TYPE_WHITE", UI::COLOR_TYPE_WHITE);
- PyModule_AddIntConstant(poModule, "COLOR_TYPE_RED", UI::COLOR_TYPE_RED);
- PyModule_AddIntConstant(poModule, "COLOR_TYPE_GREEN", UI::COLOR_TYPE_GREEN);
- PyModule_AddIntConstant(poModule, "COLOR_TYPE_YELLOW", UI::COLOR_TYPE_YELLOW);
- PyModule_AddIntConstant(poModule, "COLOR_TYPE_SKY", UI::COLOR_TYPE_SKY);
- PyModule_AddIntConstant(poModule, "COLOR_TYPE_PINK", UI::COLOR_TYPE_PINK);
- PyModule_AddIntConstant(poModule, "COLOR_TYPE_MAX", UI::COLOR_TYPE_MAX);
Done & Build.
6. bin\ui.py
Usage:
This is my code for the newly picked or got items, the animation will be yellow.
- def __HighlightSlot_Refresh(self):
- if not self.wndItem:
- return
- for i in xrange(self.wndItem.GetSlotCount()):
- slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
- if slotNumber in self.listHighlightedSlot:
- self.wndItem.ActivateSlot(i, wndMgr.COLOR_TYPE_YELLOW)
- ##Belt
- if self.wndBelt.wndBeltInventoryLayer.IsShow():
- for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
- slot = item.BELT_INVENTORY_SLOT_START + i
- slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(slot)
- if slotNumber in self.listHighlightedSlot:
- self.wndBelt.wndBeltInventorySlot.ActivateSlot(slot, wndMgr.COLOR_TYPE_YELLOW)
I hope you are understandig everything as well, and I hope you like it
I'm using this long time ago, so if I did something wrong please don't rekt me, I'm human, I do mistakes, but now I hope I didn't
Raw4Tabs: Bitte melden Sie sich an, um diesen Link zu sehen.