VegaS1234

[Python] Management graphic mode

May 28th, 2017
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.72 KB | None | 0 0
  1. #root/uiSystem.py:
  2. #1.) Search:
  3.     def OnPressExitKey(self):
  4.         self.Close()
  5.         return TRUE
  6. #2.) Add after function:
  7.     if app.ENABLE_GRAPHIC_MODE:
  8. ###################################################################
  9. # title_name        : Features for graphic mode
  10. # date_created      : 2017.01.04
  11. # author            : VegaS
  12. ###################################################################
  13.         def IsActiveModeGraphic(self):
  14.             idx = open("enbconvertor.ini", "r").readlines()
  15.  
  16.             if int(idx[1][-2]) > 0:
  17.                 return TRUE
  18.  
  19.             return FALSE
  20.  
  21.         def __ClickSystemModeButton(self):
  22.             import dbg, os, app, localeInfo
  23.  
  24.             if self.IsActiveModeGraphic():
  25.                 dam = 0
  26.             else:
  27.                 dam = 1
  28.  
  29.             idxCurMode = "EnableProxyLibrary=%d" % (dam)
  30.             f = []
  31.             getLine = 2
  32.  
  33.             if os.path.exists("enbconvertor.ini"):
  34.                 idx = open("enbconvertor.ini", "r")
  35.  
  36.                 for it in idx:
  37.                     f.append(it)
  38.                 idx.close()
  39.  
  40.             while len(f) < int(getLine):
  41.                 f.append("")
  42.  
  43.             f[int(getLine)-1] = str(idxCurMode)
  44.             idx = open("enbconvertor.ini", "w")
  45.  
  46.             for it in f:
  47.                 idx.write(it)
  48.                 if (len(it) > 0 and it[-1:] != "\n") or len(it) == 0:
  49.                     idx.write("\n")
  50.  
  51.             idx.close()
  52.             self.Close()
  53.  
  54.             if dam > 0:
  55.                 dbg.LogBox(localeInfo.GRAPHIC_MODE_ENABLE)
  56.             else:
  57.                 dbg.LogBox(localeInfo.GRAPHIC_MODE_DISABLE)
  58.  
  59.             dbg.LogBox(localeInfo.GRAPHIC_MODE_RESTART)
  60.             os.system('start metin2client.exe') ### Change with your name of application.
  61.             app.Exit()
  62.            
  63. #1.) Search:
  64.         self.GetChild("exit_button").SAFE_SetEvent(self.__ClickExitButton)
  65. #2.) Add bellow:
  66.         if app.ENABLE_GRAPHIC_MODE:
  67.             self.GetChild("system_mode_button").SAFE_SetEvent(self.__ClickSystemModeButton)
  68.  
  69. #locale/en/locale_game.txt:
  70. GRAPHIC_MODE_ENABLE [i] The graphic mode was enabled.
  71. GRAPHIC_MODE_DISABLE    [i] The graphic mode was disabled.
  72. GRAPHIC_MODE_RESTART    [i] Client will restart.
  73.  
  74. #locale/en/ui/systemdialog.py
  75.                 {
  76.                     "name" : "system_mode_button",
  77.                     "type" : "button",
  78.                     "x" : 10, # Position X
  79.                     "y" : 5, # Position Y
  80.                     "text" : "Graphic Mode (Enable/Disable)",
  81.                     "default_image" : ROOT + "XLarge_Button_01.sub",
  82.                     "over_image" : ROOT + "XLarge_Button_02.sub",
  83.                     "down_image" : ROOT + "XLarge_Button_03.sub",
  84.                 },
  85.                
  86. //@Src/Client/UserInterface/Locale_inc.h
  87. #define ENABLE_GRAPHIC_MODE
  88.  
  89. //@Src/Client/UserInterface/PythonApplicationModule.cpp
  90. //1.) Search:
  91. #ifdef ENABLE_COSTUME_SYSTEM
  92.     PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM",  1);
  93. #else
  94.     PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM",  0);
  95. #endif
  96. //2.) Add bellow:
  97. #ifdef ENABLE_GRAPHIC_MODE
  98.     PyModule_AddIntConstant(poModule, "ENABLE_GRAPHIC_MODE",    1);
  99. #else
  100.     PyModule_AddIntConstant(poModule, "ENABLE_GRAPHIC_MODE",    0);
  101. #endif
Advertisement
Add Comment
Please, Sign In to add comment