#include "SunClientPrecompiledHeader.h" #include "OptionItem.h" #include "TextureListInfoHandleManager.h" #include "TextureListInfoParser.h" #include "Mouse.h" ////////////////////////////////////////////////////////////////////////////////////////// cOptionComboItem::cOptionComboItem() { m_ItemIndex = 0; } void cOptionComboItem::SetNext() { ++m_ItemIndex; if( m_ItemIndex >= m_ItemArray.size() ) m_ItemIndex = 0; } void cOptionComboItem::SetPrev() { --m_ItemIndex; if( m_ItemIndex >= m_ItemArray.size() ) m_ItemIndex = m_ItemArray.size()-1; } void cOptionComboItem::Render( const RECT& DestRect ) { DWORD font_ID = StrToWzID("st11"); g_pSunRenderer->x_pManagerTextOut->StartToUseFont(font_ID); RECT TitleRect = DestRect; TitleRect.left += 10; TitleRect.top -= 1; g_pSunRenderer->x_pManagerTextOut->DrawText( GetTitleText().c_str(), &TitleRect, 0xFFFFFFFF, WzColor_RGBA(0, 0, 0, 0), TP_HLEFT | TP_VCENTER); int ItemOffsetX = 261; int ItemOffsetY = 2; int ItemWidth = 118; int ItemHeight = 18; RECT ItemRect; ItemRect.left = DestRect.left + ItemOffsetX; ItemRect.top = DestRect.top + ItemOffsetY; ItemRect.right = ItemRect.left + ItemWidth; ItemRect.bottom = ItemRect.top + ItemHeight; g_pSunRenderer->x_pManagerTextOut->DrawText( m_ItemArray[m_ItemIndex].c_str(), &ItemRect, WzColor_RGBA(255,246,104,255), WzColor_RGBA(0, 0, 0, 0), TP_HCENTER | TP_VCENTER); g_pSunRenderer->x_pManagerTextOut->EndUseFont(); } ////////////////////////////////////////////////////////////////////////////////////////// cOptionGaugeItem::cOptionGaugeItem() : m_Range(10) , m_Position(10) , m_iMovePosition(MOVE_NONE) { } void cOptionGaugeItem::SetNext() { ++m_Position; if( m_Position >= m_Range ) m_Position = m_Range; } void cOptionGaugeItem::SetPrev() { --m_Position; if( m_Position >= m_Range ) m_Position = 0; } void cOptionGaugeItem::Render( const RECT& DestRect ) { DWORD font_ID = StrToWzID("st11"); g_pSunRenderer->x_pManagerTextOut->StartToUseFont(font_ID); { RECT TitleRect = DestRect; TitleRect.left += 10; g_pSunRenderer->x_pManagerTextOut->DrawText( GetTitleText().c_str(), &TitleRect, 0xFFFFFFFF, WzColor_RGBA(0, 0, 0, 0), TP_HLEFT | TP_VCENTER); } g_pSunRenderer->x_pManagerTextOut->EndUseFont(); int ItemOffsetX = 261; int ItemOffsetY = 3; int ItemWidth = 118; int ItemHeight = 18; RECT ItemRect; ItemRect.left = DestRect.left + (ItemOffsetX+3); ItemRect.top = DestRect.top+ (ItemOffsetY+3); //ItemRect.right = ItemRect.left + ItemWidth; //ItemRect.bottom = ItemRect.top + ItemHeight; BASE_TextureListInfo* tex_info = NULL; HANDLE tex_handle = TextureListInfoHandleManager::Instance()->GetTexture(10009, tex_info); if( tex_info != NULL && tex_handle != INVALID_HANDLE_VALUE ) { float DrawWidth = (float)m_Position / (float)m_Range * (float)ItemWidth; float SrcWidth = (float)m_Position / (float)m_Range * (float)tex_info->tex_size.right; if(SrcWidth >= (float)tex_info->tex_size.right) { SrcWidth = (float)tex_info->tex_size.right; } if( DrawWidth >= (float)tex_info->tex_size.right) { DrawWidth = (float)tex_info->tex_size.right; } g_pSunRenderer->RenderTexture(tex_handle, (float)ItemRect.left, (float)ItemRect.top, (float)DrawWidth, (float)11, (float)tex_info->tex_size.left, (float)tex_info->tex_size.top, (float)SrcWidth, (float)tex_info->tex_size.bottom, NULL); RECT SubRect; SubRect.left = (ItemRect.left + tex_info->tex_size.right/2) - 8; SubRect.top = ItemRect.top + 1; SubRect.bottom = SubRect.top + tex_info->tex_size.bottom; SubRect.right = SubRect.left + tex_info->tex_size.right/2; DWORD font_ID = StrToWzID("st08"); g_pSunRenderer->x_pManagerTextOut->StartToUseFont(font_ID); float InScale = (float)m_Position/(float)m_Range; int InPercent = (int)(InScale * 100); Sprintf(m_strItemPercentGauge,"%d%%",InPercent); g_pSunRenderer->x_pManagerTextOut->DrawText( m_strItemPercentGauge, &SubRect, 0xFFFFFFFF, WzColor_RGBA(0, 0, 0, 0), TP_HLEFT | TP_VCENTER , ETS_SHADOW); g_pSunRenderer->x_pManagerTextOut->EndUseFont(); } } ////////////////////////////////////////////////////////////////////////////////////////// cOptionCategory::cOptionCategory( const std::string& Title ) : m_Title(Title) , m_Expended(true) { } void cOptionCategory::Render( const RECT& DestRect ) { { BASE_TextureListInfo* tex_info = NULL; HANDLE tex_handle = TextureListInfoHandleManager::Instance()->GetTexture(10010, tex_info); if( tex_info != NULL && tex_handle != INVALID_HANDLE_VALUE ) { g_pSunRenderer->RenderTexture(tex_handle, (float)DestRect.left+2, (float)DestRect.top-1, (float)(DestRect.right-DestRect.left), (float)(DestRect.bottom-DestRect.top), (float)tex_info->tex_size.left, (float)tex_info->tex_size.top, (float)tex_info->tex_size.right, (float)tex_info->tex_size.bottom, NULL); } } { BASE_TextureListInfo* tex_info = NULL; HANDLE tex_handle = TextureListInfoHandleManager::Instance()->GetTexture( IsExpended() == false ? 10002 : 10003, tex_info); if( tex_info != NULL && tex_handle != INVALID_HANDLE_VALUE ) { g_pSunRenderer->RenderTexture(tex_handle, (float)DestRect.left+2, (float)DestRect.top+1, (float)20, (float)20, (float)tex_info->tex_size.left, (float)tex_info->tex_size.top, (float)tex_info->tex_size.right, (float)tex_info->tex_size.bottom, NULL); } } { RECT dest = DestRect; dest.left += 24; dest.right -= 24; dest.top -= 1; DWORD font_ID = StrToWzID("st11"); g_pSunRenderer->x_pManagerTextOut->StartToUseFont(font_ID); g_pSunRenderer->x_pManagerTextOut->DrawText( m_Title.c_str(), &dest, WzColor_RGBA(217,117,0,255), WzColor_RGBA(0, 0, 0, 0), TP_HLEFT | TP_VCENTER); g_pSunRenderer->x_pManagerTextOut->EndUseFont(); } } cOptionCategory::~cOptionCategory() { for (int i = 0 ; i < (int)m_OptionCategory.size() ; ++i) { delete m_OptionCategory[i]; m_OptionCategory[i] = NULL; } m_OptionCategory.clear(); } #include "GameOption.h" namespace nOptionFacade { nOptionType::eOptionTypeIndex GetOptionTypeIndexFromOptionID( DWORD OptionID ) { switch( OptionID ) { case 100: return nOptionType::MAX; //分辨率 case 101: return nOptionType::MAX; //配置分辨率 case 102: return nOptionType::TEXTURE_QUALITY; //纹理品质 case 103: return nOptionType::EFFECT_QUALITY; //效果品质 case 104: return nOptionType::LOD_LEVEL; //细节描述范围(LOD) case 105: return nOptionType::GAMMA_VALUE; //亮度设置(伽玛设置) case 106: return nOptionType::SHOW_SHADOW; //阴影效果 case 107: return nOptionType::USE_BLUR; //辉光效应 case 108: return nOptionType::USE_FOG; //雾效果 case 109: return nOptionType::USE_TILE_BLENDING; //贴图效果 case 110: return nOptionType::USE_MAP_DISTANCE_VIEW; //远景效果 case 111: return nOptionType::USE_VOLUME_LIGHT; //光源效果 case 112: return nOptionType::CULLING_DISTANCE_VALUE; //物距(卷曲范围) case 113: return nOptionType::USE_MULTITHREAD; //多线程 #ifdef _NA_007865_20141403_LIGHTMAP_BUILD_EXCLUDE_OBJECTS case 114: return nOptionType::SHADOW_DISTANCE; //影子街 #endif //_NA_007865_20141403_LIGHTMAP_BUILD_EXCLUDE_OBJECTS case 200: return nOptionType::DAMAGE_TEXT_OUTPUT; //损失值表示 case 201: return nOptionType::SHOW_NPC_NAME; //npc名 case 202: return nOptionType::SHOW_MONSTERINFO; //怪兽信息 case 203: return nOptionType::SHOW_PLAYER_NAME; //其他玩家名称 case 204: return nOptionType::HIDE_COSTUME; //隐藏皮肤 case 205: return nOptionType::SHOW_MY_RENDER_INFO; //我的id case 206: return nOptionType::SHOW_PLAYER_GRADE; //其他玩家等级 case 207: return nOptionType::USE_HELP; //信息阅览室 case 208: return nOptionType::SHOW_PLAYER_PETNAME; //帕特人 case 209: return nOptionType::SHOW_VENDOR_TITLE; //个体店名 case 210: return nOptionType::SHOW_PLAYER_GUILD; //基尔特人 case 211: return nOptionType::NOTIFY_DROP_ITEM; //显示掉落物品5秒 case 212: return nOptionType::NOTIFY_PICKUP_ITEM; //收到物品通知 case 213: return nOptionType::USE_PLAY_MOVIE; //开场影片 case 214: return nOptionType::SHOW_PLAYERS; //不同玩家角色 case 215: return nOptionType::SHOW_VENDERS; //个人商店卡通 case 216: return nOptionType::SHOW_WING; //从地面显示翅膀 case 217: return nOptionType::USE_AUTO_MOVE; //攻机者机动 case 218: return nOptionType::USE_AUTO_TARGET; //自动目标 case 219: return nOptionType::USE_FORWARD_TARGET; //前方优先目标 case 220: return nOptionType::USE_FIXED_TARGET; //近距优先目标 case 221: return nOptionType::USE_SKILLQUEUEING; //技能q营 #ifdef _YJ_PK_OPTION_001120 case 222: return nOptionType::USE_PK_WITH_CONTROL_KEY; //总是按PK键 #endif //_YJ_PK_OPTION_001120 case 223: return nOptionType::MOUSE_SENS_VALUE; //控制鼠标灵敏度 case 224: return nOptionType::MOUSE_VIEW_SPEED_VALUE; //视点切换速度 case 225: return nOptionType::MOUSE_VIEW_SENS_VALUE; //鼠标视点速度 case 226: return nOptionType::CAMERA_VIEW_HEIGHT_OFFSET; //调整角色视点 case 227: return nOptionType::USE_CHANGE_EYE_MOUSE; //鼠标左/右反转 case 228: return nOptionType::USE_MOVE_TO_CAMERA; //向相机方向移动 case 229: return nOptionType::USE_SPRING_CAMERA; //弹簧相机旋转 case 230: return nOptionType::USE_EXTENSION_CAMERA_DISTANCE; //放大相机距离 case 231: return nOptionType::USE_BLOCK_TRADE; //禁止交易 case 232: return nOptionType::USE_BLOCK_WHISPER; //屏蔽私聊 case 233: return nOptionType::PICKING_FRIEND; //阻止选择其他玩家 case 234: return nOptionType::USE_BLOCK_CHANNEL_INVITE; //屏蔽通道邀请 case 235: return nOptionType::USE_FIXED_UI_POSITION; //锁定界面大小 #ifdef _NA_008678_20160203_ADD_HEIM_TRADINGVOLUME_NOTIFICATION_OPTION case 236: return nOptionType::HEIM_TRADINGVOLUME; //海姆成交量通告 #endif // _NA_008678_20160203_ADD_HEIM_NOTIFICATION_OPTION case 300: return nOptionType::BGM_VOLUME; //背景音 case 301: return nOptionType::AMBIENT_VOLUME; //环境效果音 case 302: return nOptionType::EFFECT_VOLUME; //系统特效音 case 303: return nOptionType::USE_SYSTEM_VOICE; //语音警告 case 304: return nOptionType::USE_NPC_VOICE; //npc语音 case 305: return nOptionType::SYSTEM_VOLUME; //系统音量 case 306: return nOptionType::SPEAKER_VOLUME; //喇叭音量 #ifdef _NA_000000_20140408_SkILL_USE_AFTER_AUTOATTACK_OPTION //case 405: return nOptionType::SKILL_USE_AFTER_AUTOATTACK; //使用技能后自动攻击 #endif //_NA_000000_20140408_SkILL_USE_AFTER_AUTOATTACK_OPTION #ifdef _20220411_AUTO_AIM case 500: return nOptionType::QUICK_AUTO_AIM; //喇叭音量 #endif } return nOptionType::MAX; } void RestoreOptionValue( cOptionItem* pItem ) { CGameOption* pGameOption = CGameOption::Instance(); if( pItem->GetOptionID() == 101 ) { //分辨率列表 pItem->SetItemValue( pGameOption->GetGameOption().GetScreenIndex() ); } else if( pItem->GetOptionID() == 100 ) { //分辨率 pItem->SetItemValue( pGameOption->GetGameOption().GetScreenMode() ); } else { if( pItem->GetOptionTypeIndex() == nOptionType::GAMMA_VALUE || pItem->GetOptionTypeIndex() == nOptionType::CULLING_DISTANCE_VALUE ) { pItem->SetItemValue( (DWORD)pGameOption->GetGameOption().GetOptionValueFloat( pItem->GetOptionTypeIndex() ) ); } else if( pItem->GetOptionTypeIndex() != nOptionType::MAX ) { pItem->SetItemValue( pGameOption->GetGameOption().GetOptionValue( pItem->GetOptionTypeIndex() ) ); } else { pItem = pItem; } } } void SetOptionValue( cOptionItem* pItem ) { CGameOption* pGameOption = CGameOption::Instance(); if( pItem->GetOptionID() == 101 ) { pGameOption->SetScreenIndex( pItem->GetItemValue() ); } else if( pItem->GetOptionID() == 100 ) { pGameOption->SetScreenMode( (OptionParam::OptionScreenMode)pItem->GetItemValue() ); } else { if( pItem->GetOptionTypeIndex() == nOptionType::GAMMA_VALUE || pItem->GetOptionTypeIndex() == nOptionType::CULLING_DISTANCE_VALUE ) { pGameOption->GetGameOption().SetOptionValue( pItem->GetOptionTypeIndex(), pItem->GetItemValue() * 100 ); } else if( pItem->GetOptionTypeIndex() != nOptionType::MAX ) { pGameOption->GetGameOption().SetOptionValue( pItem->GetOptionTypeIndex(), pItem->GetItemValue() ); } else { pItem = pItem; } } } int GetCurrentOption( DWORD OptionID ) { return 0; } };