Hallo M2DL ich habe diese Varriante vor einer ewigkeit in einen anderen Forum gepupt und Re-Rls es hier nochmal nur besser aufgeteilt.
Einmal zu der änderung die jetzt ehrlich nix großes ist. es blendet die Yang/Gold Anzeige nicht im Client(Python Code) aus sondern wenn die Funktion auf False steht wird nicht einmal mehr die Class(C++) dafür benutzt wodurch die funktion der Game.py 0% registriert das ihr jemals Yang erhalten habt und dem entsprechend Resourcen sparrt.
Dann lasst uns mal los legen.
Client Source
PythonSystem.h
- Search:
- void SetShowSalesTextFlag(int iFlag);
- ADD after this:
- bool IsShowMoneyText();
- void SetShowMoneyTextFlag(int iFlag);
- Search :
- bool bShowSalesText;
- ADD after this :
- bool bShowMoneyText;
- ADD after this:
- bool IsShowMoneyText();
- void SetShowMoneyTextFlag(int iFlag);
- Search :
- bool bShowSalesText;
- ADD after this :
- bool bShowMoneyText;
PythonSystem.cpp
- Search :
- void CPythonSystem::SetShowSalesTextFlag(int iFlag)
- {
- m_Config.bShowSalesText = iFlag == 1 ? true : false;
- }
- ADD after this :
- bool CPythonSystem::IsShowMoneyText()
- {
- return m_Config.bShowMoneyText;
- }
- void CPythonSystem::SetShowMoneyTextFlag(int iFlag)
- {
- m_Config.bShowMoneyText = iFlag == 1 ? true : false;
- }
- Search :
- else if (!stricmp(command, "SHOW_SALESTEXT"))
- m_Config.bShowSalesText = atoi(value) == 1 ? true : false;
- ADD after this:
- else if (!stricmp(command, "SHOW_MONEY_TEXT"))
- m_Config.bShowMoneyText = atoi(value) == 1 ? true : false;
- Search :
- if (m_Config.bShowSalesText == 0)
- fprintf(fp, "SHOW_SALESTEXT %d\n", m_Config.bShowSalesText);
- ADD after this:
- if (m_Config.bShowMoneyText == 0)
- fprintf(fp, "SHOW_MONEY_TEXT %d\n", m_Config.bShowMoneyText);
- Search :
- m_Config.bShowSalesText = true;
- ADD after this:
- m_Config.bShowMoneyText = true;
PythonSystemModule.cpp
- Search :
- PyObject * systemIsShowSalesText(PyObject * poSelf, PyObject * poArgs)
- {
- return Py_BuildValue("i", CPythonSystem::Instance().IsShowSalesText());
- }
- ADD after this:
- PyObject * systemIsShowMoneyText(PyObject * poSelf, PyObject * poArgs)
- {
- return Py_BuildValue("i", CPythonSystem::Instance().IsShowMoneyText());
- }
- Search :
- { "IsShowSalesText", systemIsShowSalesText, METH_VARARGS },
- ADD after this:
- { "SetShowMoneyTextFlag", systemSetMoneyTextFlag, METH_VARARGS},
- { "IsShowMoneyText", systemIsShowMoneyText, METH_VARARGS},
- Search :
- PyObject * systemSetShowSalesTextFlag(PyObject * poSelf, PyObject * poArgs)
- {
- int iFlag;
- if (!PyTuple_GetInteger(poArgs, 0, &iFlag))
- return Py_BuildException();
- CPythonSystem::Instance().SetShowSalesTextFlag(iFlag);
- return Py_BuildNone();
- }
- ADD after this:
- PyObject * systemSetMoneyTextFlag(PyObject * poSelf, PyObject * poArgs)
- {
- int iFlag;
- if (!PyTuple_GetInteger(poArgs, 0, &iFlag))
- return Py_BuildException();
- CPythonSystem::Instance().SetShowMoneyTextFlag(iFlag);
- return Py_BuildNone();
- }
Client Python Part (Buttons/Funktion) zum On/Off Setzten der Config Funktion.
root/uiGameOption.py
Achtet auf die Tabs
- In:
- def __Initialize(self):
- add this:
- self.showyangTextButtonList = []
- In :
- def __Load_BindObject(self):
- add this:
- self.showyangTextButtonList.append(GetObject("yang_on_button"))
- self.showyangTextButtonList.append(GetObject("yang_off_button"))
- In:
- def __Load(self):
- add this:
- self.showyangTextButtonList.append(GetObject("yang_on_button"))
- self.showyangTextButtonList.append(GetObject("yang_off_button"))
- Search for :
- def __OnClickSalesTextOffButton(self):
- systemSetting.SetShowSalesTextFlag(FALSE)
- self.RefreshShowSalesText()
- and add after this:
- def __OnClickMoneyTextOnButton(self):
- systemSetting.SetShowMoneyTextFlag(TRUE)
- self.RefrehMoneySalesText()
- def __OnClickMoneyTextOffButton(self):
- systemSetting.SetShowMoneyTextFlag(FALSE)
- self.RefrehMoneySalesText()
- Search for :
- def RefreshShowSalesText(self):
- if systemSetting.IsShowSalesText():
- self.showsalesTextButtonList[0].Down()
- self.showsalesTextButtonList[1].SetUp()
- else:
- self.showsalesTextButtonList[0].SetUp()
- self.showsalesTextButtonList[1].Down()
- and add after this.
- def RefrehMoneySalesText(self):
- if systemSetting.IsShowMoneyText():
- self.showyangTextButtonList[0].Down()
- self.showyangTextButtonList[1].SetUp()
- else:
- self.showyangTextButtonList[0].SetUp()
- self.showyangTextButtonList[1].Down()
uiscript/gameoptiondialog.py
- Change :
- "name" : "GameOptionDialog",
- "style" : ("movable", "float",),
- "x" : 0,
- "y" : 0,
- "width" : 300,
- "height" : 25*11+8,
- to :
- "name" : "GameOptionDialog",
- "style" : ("movable", "float",),
- "x" : 0,
- "y" : 0,
- "width" : 300,
- "height" : 25*11+8+45,
- Change :
- "name" : "board",
- "type" : "board",
- "x" : 0,
- "y" : 0,
- "width" : 300,
- "height" : 28*11+8,
- to :
- "name" : "board",
- "type" : "board",
- "x" : 0,
- "y" : 0,
- "width" : 300,
- "height" : 28*11+8+45,
- search for
- {
- "name" : "salestext_off_button",
- "type" : "radio_button",
- "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH,
- "y" : 240,
- "text" : uiScriptLocale.OPTION_SALESTEXT_VIEW_OFF,
- "default_image" : ROOT_PATH + "middle_button_01.sub",
- "over_image" : ROOT_PATH + "middle_button_02.sub",
- "down_image" : ROOT_PATH + "middle_button_03.sub",
- },
- ## ÆǸŹ®±¸
- add after the ## ÆǸŹ®±¸ this :
- {
- "name" : "gold_on_off",
- "type" : "text",
- "x" : LINE_LABEL_X,
- "y" : 275+2,
- "text" : "Money Text",
- },
- {
- "name" : "yang_on_button",
- "type" : "radio_button",
- "x" : LINE_DATA_X,
- "y" : 275,
- "text" : uiScriptLocale.OPTION_SALESTEXT_VIEW_ON,
- "default_image" : ROOT_PATH + "middle_button_01.sub",
- "over_image" : ROOT_PATH + "middle_button_02.sub",
- "down_image" : ROOT_PATH + "middle_button_03.sub",
- },
- {
- "name" : "yang_off_button",
- "type" : "radio_button",
- "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH,
- "y" : 275,
- "text" : uiScriptLocale.OPTION_SALESTEXT_VIEW_OFF,
- "default_image" : ROOT_PATH + "middle_button_01.sub",
- "over_image" : ROOT_PATH + "middle_button_02.sub",
- "down_image" : ROOT_PATH + "middle_button_03.sub",
- },
Ich wünsche euch viel spaß damit
@Edit
Code Highlight hinzugefügt fehlende Text Zeilen ergänzt
Danke an "LordZiege" für den Tipp+den Hinweiss das die tabs futsch waren :3
MfG Shay/VenTus