I am trying to implement Official Environment Effect Options [REVERSED] By @ Mali
When I try to open "System Options" in the game settings, it does not open and nothing happens.
The game does not crash, but I receive this error.
Would anyone have any pointers as to what may be causing this issue? Your help would be much appreciated!
Here is the client syserr.txt file.
0323 23:01:23219 :: Traceback (most recent call last):
0323 23:01:23219 :: File "ui.py", line 1348, in CallEvent
0323 23:01:23219 :: File "ui.py", line 87, in __call__
0323 23:01:23219 :: File "ui.py", line 69, in __call__
0323 23:01:23220 :: File "uiSystem.py", line 120, in __ClickSystemOptionButton
0323 23:01:23220 :: File "uiSystemOption.py", line 29, in __init__
0323 23:01:23220 :: File "uiSystemOption.py", line 109, in __Load
0323 23:01:23220 :: AttributeError
0323 23:01:23220 :: :
0323 23:01:23220 :: 'OptionDialog' object has no attribute 'Close'
0323 23:01:23220 ::
And here is my root/uiSystemOption.py file.
I marked the code I added.
import dbg
import ui
import snd
import systemSetting
import net
import chat
import app
import localeInfo
import constInfo
import chrmgr
import player
import musicInfo
import uiSelectMusic
import background
if app.__BL_ENVIRONMENT_EFFECT_OPTION__: #Code I Added
import uiPhaseCurtain #Code I Added
MUSIC_FILENAME_MAX_LEN = 25
blockMode = 0
class OptionDialog(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__Initialize()
self.__Load()
if app.__BL_ENVIRONMENT_EFFECT_OPTION__: #Code I Added
self.curtain = uiPhaseCurtain.PhaseCurtain() #Code I Added
self.curtain.speed = 0.03 #Code I Added
self.curtain.Hide() #Code I Added
def __del__(self):
ui.ScriptWindow.__del__(self)
print " -------------------------------------- DELETE SYSTEM OPTION DIALOG"
def __Initialize(self):
self.tilingMode = 0
self.titleBar = 0
self.changeMusicButton = 0
self.selectMusicFile = 0
self.ctrlMusicVolume = 0
self.ctrlSoundVolume = 0
self.musicListDlg = 0
self.tilingApplyButton = 0
self.cameraModeButtonList = []
self.fogModeButtonList = []
self.tilingModeButtonList = []
self.ctrlShadowQuality = 0
if app.__BL_ENVIRONMENT_EFFECT_OPTION__: #Code I Added
self.nightModeButtonList = [] #Code I Added
self.snowModeButtonList = [] #Code I Added
self.snowTextureModeButtonList = [] #Code I Added
def Destroy(self):
self.ClearDictionary()
self.__Initialize()
print " -------------------------------------- DESTROY SYSTEM OPTION DIALOG"
def __Load_LoadScript(self, fileName):
try:
pyScriptLoader = ui.PythonScriptLoader()
pyScriptLoader.LoadScriptFile(self, fileName)
except:
import exception
exception.Abort("System.OptionDialog.__Load_LoadScript")
def __Load_BindObject(self):
try:
GetObject = self.GetChild
self.titleBar = GetObject("titlebar")
self.selectMusicFile = GetObject("bgm_file")
self.changeMusicButton = GetObject("bgm_button")
self.ctrlMusicVolume = GetObject("music_volume_controller")
self.ctrlSoundVolume = GetObject("sound_volume_controller")
self.cameraModeButtonList.append(GetObject("camera_short"))
self.cameraModeButtonList.append(GetObject("camera_long"))
self.fogModeButtonList.append(GetObject("fog_level0"))
self.fogModeButtonList.append(GetObject("fog_level1"))
self.fogModeButtonList.append(GetObject("fog_level2"))
self.tilingModeButtonList.append(GetObject("tiling_cpu"))
self.tilingModeButtonList.append(GetObject("tiling_gpu"))
self.tilingApplyButton=GetObject("tiling_apply")
if app.__BL_ENVIRONMENT_EFFECT_OPTION__: #Code I Added
self.nightModeButtonList.append(GetObject("night_mode_off")) #Code I Added
self.nightModeButtonList.append(GetObject("night_mode_on")) #Code I Added
self.snowModeButtonList.append(GetObject("snow_mode_off")) #Code I Added
self.snowModeButtonList.append(GetObject("snow_mode_on")) #Code I Added
self.snowTextureModeButtonList.append(GetObject("snow_texture_mode_off")) #Code I Added
self.snowTextureModeButtonList.append(GetObject("snow_texture_mode_on")) #Code I Added
#self.ctrlShadowQuality = GetObject("shadow_bar")
except:
import exception
exception.Abort("OptionDialog.__Load_BindObject")
def __Load(self):
self.__Load_LoadScript("uiscript/systemoptiondialog.py")
self.__Load_BindObject()
self.SetCenterPosition()
self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
self.ctrlMusicVolume.SetSliderPos(float(systemSetting.GetMusicVolume()))
self.ctrlMusicVolume.SetEvent(ui.__mem_func__(self.OnChangeMusicVolume))
self.ctrlSoundVolume.SetSliderPos(float(systemSetting.GetSoundVolume()) / 5.0)
self.ctrlSoundVolume.SetEvent(ui.__mem_func__(self.OnChangeSoundVolume))
# self.ctrlShadowQuality.SetSliderPos(float(systemSetting.GetShadowLevel()) / 5.0)
# self.ctrlShadowQuality.SetEvent(ui.__mem_func__(self.OnChangeShadowQuality))
self.changeMusicButton.SAFE_SetEvent(self.__OnClickChangeMusicButton)
self.cameraModeButtonList[0].SAFE_SetEvent(self.__OnClickCameraModeShortButton)
self.cameraModeButtonList[1].SAFE_SetEvent(self.__OnClickCameraModeLongButton)
self.fogModeButtonList[0].SAFE_SetEvent(self.__OnClickFogModeLevel0Button)
self.fogModeButtonList[1].SAFE_SetEvent(self.__OnClickFogModeLevel1Button)
self.fogModeButtonList[2].SAFE_SetEvent(self.__OnClickFogModeLevel2Button)
self.tilingModeButtonList[0].SAFE_SetEvent(self.__OnClickTilingModeCPUButton)
self.tilingModeButtonList[1].SAFE_SetEvent(self.__OnClickTilingModeGPUButton)
self.tilingApplyButton.SAFE_SetEvent(self.__OnClickTilingApplyButton)
self.__SetCurTilingMode()
self.__ClickRadioButton(self.fogModeButtonList, constInfo.GET_FOG_LEVEL_INDEX())
self.__ClickRadioButton(self.cameraModeButtonList, constInfo.GET_CAMERA_MAX_DISTANCE_INDEX())
if app.__BL_ENVIRONMENT_EFFECT_OPTION__: #Code I Added
self.nightModeButtonList[0].SAFE_SetEvent(self.__OnClickNightModeOffButton) #Code I Added
self.nightModeButtonList[1].SAFE_SetEvent(self.__OnClickNightModeOnButton) #Code I Added
self.__InitNightModeOption() #Code I Added
self.snowModeButtonList[0].SAFE_SetEvent(self.__OnClickSnowModeOffButton) #Code I Added
self.snowModeButtonList[1].SAFE_SetEvent(self.__OnClickSnowModeOnButton) #Code I Added
self.__InitSnowModeOption() #Code I Added
self.snowTextureModeButtonList[0].SAFE_SetEvent(self.__OnClickSnowTextureModeOffButton) #Code I Added
self.snowTextureModeButtonList[1].SAFE_SetEvent(self.__OnClickSnowTextureModeOnButton) #Code I Added
self.__InitSnowTextureModeOption() #Code I Added
if musicInfo.fieldMusic==musicInfo.METIN2THEMA:
self.selectMusicFile.SetText(uiSelectMusic.DEFAULT_THEMA)
else:
self.selectMusicFile.SetText(musicInfo.fieldMusic[:MUSIC_FILENAME_MAX_LEN])
def __OnClickTilingModeCPUButton(self):
self.__NotifyChatLine(localeInfo.SYSTEM_OPTION_CPU_TILING_1)
self.__NotifyChatLine(localeInfo.SYSTEM_OPTION_CPU_TILING_2)
self.__NotifyChatLine(localeInfo.SYSTEM_OPTION_CPU_TILING_3)
self.__SetTilingMode(0)
def __OnClickTilingModeGPUButton(self):
self.__NotifyChatLine(localeInfo.SYSTEM_OPTION_GPU_TILING_1)
self.__NotifyChatLine(localeInfo.SYSTEM_OPTION_GPU_TILING_2)
self.__NotifyChatLine(localeInfo.SYSTEM_OPTION_GPU_TILING_3)
self.__SetTilingMode(1)
def __OnClickTilingApplyButton(self):
self.__NotifyChatLine(localeInfo.SYSTEM_OPTION_TILING_EXIT)
if 0==self.tilingMode:
background.EnableSoftwareTiling(1)
else:
background.EnableSoftwareTiling(0)
net.ExitGame()
def __OnClickChangeMusicButton(self):
if not self.musicListDlg:
self.musicListDlg=uiSelectMusic.FileListDialog()
self.musicListDlg.SAFE_SetSelectEvent(self.__OnChangeMusic)
self.musicListDlg.Open()
def __ClickRadioButton(self, buttonList, buttonIndex):
try:
selButton=buttonList[buttonIndex]
except IndexError:
return
for eachButton in buttonList:
eachButton.SetUp()
selButton.Down()
def __SetTilingMode(self, index):
self.__ClickRadioButton(self.tilingModeButtonList, index)
self.tilingMode=index
def __SetCameraMode(self, index):
constInfo.SET_CAMERA_MAX_DISTANCE_INDEX(index)
self.__ClickRadioButton(self.cameraModeButtonList, index)
def __SetFogLevel(self, index):
constInfo.SET_FOG_LEVEL_INDEX(index)
self.__ClickRadioButton(self.fogModeButtonList, index)
def __OnClickCameraModeShortButton(self):
self.__SetCameraMode(0)
def __OnClickCameraModeLongButton(self):
self.__SetCameraMode(1)
def __OnClickFogModeLevel0Button(self):
self.__SetFogLevel(0)
def __OnClickFogModeLevel1Button(self):
self.__SetFogLevel(1)
def __OnClickFogModeLevel2Button(self):
self.__SetFogLevel(2)
def __OnChangeMusic(self, fileName):
self.selectMusicFile.SetText(fileName[:MUSIC_FILENAME_MAX_LEN])
if musicInfo.fieldMusic != "":
snd.FadeOutMusic("BGM/"+ musicInfo.fieldMusic)
if fileName==uiSelectMusic.DEFAULT_THEMA:
musicInfo.fieldMusic=musicInfo.METIN2THEMA
else:
musicInfo.fieldMusic=fileName
musicInfo.SaveLastPlayFieldMusic()
if musicInfo.fieldMusic != "":
snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
def OnChangeMusicVolume(self):
pos = self.ctrlMusicVolume.GetSliderPos()
snd.SetMusicVolume(pos * net.GetFieldMusicVolume())
systemSetting.SetMusicVolume(pos)
def OnChangeSoundVolume(self):
pos = self.ctrlSoundVolume.GetSliderPos()
snd.SetSoundVolumef(pos)
systemSetting.SetSoundVolumef(pos)
def OnChangeShadowQuality(self):
pos = self.ctrlShadowQuality.GetSliderPos()
systemSetting.SetShadowLevel(int(pos / 0.2))
def OnCloseInputDialog(self):
self.inputDialog.Close()
self.inputDialog = None
return True
def OnCloseQuestionDialog(self):
self.questionDialog.Close()
self.questionDialog = None
return True
def OnPressEscapeKey(self):
self.Close()
return True
def Show(self):
ui.ScriptWindow.Show(self)
def Close(self):
self.__SetCurTilingMode()
self.Hide()
def __SetCurTilingMode(self):
if background.IsSoftwareTiling():
self.__SetTilingMode(0)
else:
self.__SetTilingMode(1)
def __NotifyChatLine(self, text):
chat.AppendChat(chat.CHAT_TYPE_INFO, text)
if app.__BL_ENVIRONMENT_EFFECT_OPTION__: #Code I Added from here to the end of text
def __InitNightModeOption(self):
self.NightModeOn = systemSetting.GetNightModeOption()
self.__ClickRadioButton(self.nightModeButtonList, self.NightModeOn)
background.SetNightModeOption(self.NightModeOn)
def __InitSnowModeOption(self):
self.SnowModeOn = systemSetting.GetSnowModeOption()
self.__ClickRadioButton(self.snowModeButtonList, self.SnowModeOn)
background.SetSnowModeOption(self.SnowModeOn)
def __InitSnowTextureModeOption(self):
self.SnowTextureModeOn = systemSetting.GetSnowTextureModeOption()
self.__ClickRadioButton(self.snowTextureModeButtonList, self.SnowTextureModeOn)
background.SetSnowTextureModeOption(self.SnowTextureModeOn)
def __OnClickNightModeOffButton(self):
self.__ClickRadioButton(self.nightModeButtonList, 0)
self.__SetNightMode(0)
def __OnClickNightModeOnButton(self):
self.__ClickRadioButton(self.nightModeButtonList, 1)
self.__SetNightMode(1)
def __OnClickSnowModeOffButton(self):
self.__ClickRadioButton(self.snowModeButtonList, 0)
self.__SetSnowMode(0)
def __OnClickSnowModeOnButton(self):
self.__ClickRadioButton(self.snowModeButtonList, 1)
self.__SetSnowMode(1)
def __OnClickSnowTextureModeOffButton(self):
self.__ClickRadioButton(self.snowTextureModeButtonList, 0)
self.__SetSnowTextureMode(0)
def __OnClickSnowTextureModeOnButton(self):
self.__ClickRadioButton(self.snowTextureModeButtonList, 1)
self.__SetSnowTextureMode(1)
def __SetSnowMode(self, index):
systemSetting.SetSnowModeOption(index)
background.SetSnowModeOption(index)
background.EnableSnowMode(index)
def __SetSnowTextureMode(self, index):
systemSetting.SetSnowTextureModeOption(index)
background.SetSnowTextureModeOption(index)
background.EnableSnowTextureMode()
def __SetNightMode(self, index):
systemSetting.SetNightModeOption(index)
background.SetNightModeOption(index)
if not background.GetDayMode():
return
if not background.IsBoomMap():
return
if 1 == index:
self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToDark)
else:
self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToLight)
def __DayMode_OnCompleteChangeToLight(self):
background.ChangeEnvironmentData(0)
self.curtain.FadeIn()
def __DayMode_OnCompleteChangeToDark(self):
background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
background.ChangeEnvironmentData(1)
self.curtain.FadeIn()