diff --git a/Meridian59.Ogre.Client/Constants.h b/Meridian59.Ogre.Client/Constants.h index d5e3b83c..b5c1f80d 100644 --- a/Meridian59.Ogre.Client/Constants.h +++ b/Meridian59.Ogre.Client/Constants.h @@ -334,8 +334,13 @@ #define UI_IMAGE_BRANDING_OPENMERIDIAN "" #define UI_IMAGE_LOCKBUTTON_UNLOCKED_NORMAL "TaharezLook/WindowLockButtonUnlockedNormal" #define UI_IMAGE_LOCKBUTTON_UNLOCKED_HOVER "TaharezLook/WindowLockButtonUnlockedHover" +#define UI_IMAGE_LOCKBUTTON_UNLOCKED_PUSHED "TaharezLook/WindowLockButtonUnlockedPushed" #define UI_IMAGE_LOCKBUTTON_LOCKED_NORMAL "TaharezLook/WindowLockButtonLockedNormal" #define UI_IMAGE_LOCKBUTTON_LOCKED_HOVER "TaharezLook/WindowLockButtonLockedHover" +#define UI_IMAGE_LOCKBUTTON_LOCKED_PUSHED "TaharezLook/WindowLockButtonLockedPushed" +#define UI_IMAGE_RESETBUTTON_NORMAL "TaharezLook/WindowResetButtonNormal" +#define UI_IMAGE_RESETBUTTON_HOVER "TaharezLook/WindowResetButtonHover" +#define UI_IMAGE_RESETBUTTON_PUSHED "TaharezLook/WindowResetButtonPushed" /* prefixe */ #define UI_NAMEPREFIX_STATICICON "CEGUI/StaticIcon/" @@ -370,6 +375,7 @@ #define UI_NAME_STATUSBAR_MTIMEVAL "StatusBar.MTimeValue" #define UI_NAME_STATUSBAR_ROOMDESC "StatusBar.RoomDescription" #define UI_NAME_STATUSBAR_ROOMVAL "StatusBar.RoomValue" +#define UI_NAME_STATUSBAR_RESET "StatusBar.Reset" #define UI_NAME_STATUSBAR_LOCK "StatusBar.Lock" #define UI_NAME_ONLINEPLAYERS_WINDOW "OnlinePlayers" #define UI_NAME_ONLINEPLAYERS_LIST "OnlinePlayers.List" diff --git a/Meridian59.Ogre.Client/ControllerUI.cpp b/Meridian59.Ogre.Client/ControllerUI.cpp index bc09889e..ee4570fa 100644 --- a/Meridian59.Ogre.Client/ControllerUI.cpp +++ b/Meridian59.Ogre.Client/ControllerUI.cpp @@ -322,10 +322,11 @@ namespace Meridian59 { namespace Ogre // switch lock image StatusBar::Lock->setProperty(UI_PROPNAME_NORMALIMAGE, UI_IMAGE_LOCKBUTTON_LOCKED_NORMAL); StatusBar::Lock->setProperty(UI_PROPNAME_HOVERIMAGE, UI_IMAGE_LOCKBUTTON_LOCKED_HOVER); - StatusBar::Lock->setProperty(UI_PROPNAME_PUSHEDIMAGE, UI_IMAGE_LOCKBUTTON_LOCKED_NORMAL); + StatusBar::Lock->setProperty(UI_PROPNAME_PUSHEDIMAGE, UI_IMAGE_LOCKBUTTON_LOCKED_PUSHED); - // update tooltip - StatusBar::Lock->setTooltipText("Interface is currently locked. \n You can't move or resize windows. \n Click to unlock."); + // update tooltips + StatusBar::Lock->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::UILOCKED_TOOLTIP)); + StatusBar::Reset->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::UIRESETLOCKED_TOOLTIP)); // disable dragging of actionbuttons for (size_t i = 0; i < ACTIONBUTTONS; i++) @@ -359,10 +360,11 @@ namespace Meridian59 { namespace Ogre // switch lock image StatusBar::Lock->setProperty(UI_PROPNAME_NORMALIMAGE, UI_IMAGE_LOCKBUTTON_UNLOCKED_NORMAL); StatusBar::Lock->setProperty(UI_PROPNAME_HOVERIMAGE, UI_IMAGE_LOCKBUTTON_UNLOCKED_HOVER); - StatusBar::Lock->setProperty(UI_PROPNAME_PUSHEDIMAGE, UI_IMAGE_LOCKBUTTON_UNLOCKED_NORMAL); + StatusBar::Lock->setProperty(UI_PROPNAME_PUSHEDIMAGE, UI_IMAGE_LOCKBUTTON_UNLOCKED_PUSHED); - // update tooltip - StatusBar::Lock->setTooltipText("Interface is currently unlocked. \n You can move or resize windows. \n Click to lock."); + // update tooltips + StatusBar::Lock->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::UIUNLOCKED_TOOLTIP)); + StatusBar::Reset->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::UIRESET_TOOLTIP)); // enable dragging of actionbuttons for (size_t i = 0; i < ACTIONBUTTONS; i++) @@ -636,6 +638,71 @@ namespace Meridian59 { namespace Ogre } }; + void ControllerUI::ResetLayout() + { + OgreClient::Singleton->Config->ResetUIElements(); + + // avatar + Avatar::Window->setPosition(OgreClient::Singleton->Config->UILayoutAvatar->getPosition()); + Avatar::Window->setSize(OgreClient::Singleton->Config->UILayoutAvatar->getSize()); + + // target + Target::Window->setPosition(OgreClient::Singleton->Config->UILayoutTarget->getPosition()); + Target::Window->setSize(OgreClient::Singleton->Config->UILayoutTarget->getSize()); + + // minimap + MiniMap::Window->setPosition(OgreClient::Singleton->Config->UILayoutMinimap->getPosition()); + MiniMap::Window->setSize(OgreClient::Singleton->Config->UILayoutMinimap->getSize()); + + // roomenchantments + RoomEnchantments::Window->setPosition(OgreClient::Singleton->Config->UILayoutRoomEnchantments->getPosition()); + RoomEnchantments::Window->setSize(OgreClient::Singleton->Config->UILayoutRoomEnchantments->getSize()); + + // chat + Chat::Window->setPosition(OgreClient::Singleton->Config->UILayoutChat->getPosition()); + Chat::Window->setSize(OgreClient::Singleton->Config->UILayoutChat->getSize()); + + // inventory + Inventory::Window->setPosition(OgreClient::Singleton->Config->UILayoutInventory->getPosition()); + Inventory::Window->setSize(OgreClient::Singleton->Config->UILayoutInventory->getSize()); + + // spells + Spells::Window->setPosition(OgreClient::Singleton->Config->UILayoutSpells->getPosition()); + Spells::Window->setSize(OgreClient::Singleton->Config->UILayoutSpells->getSize()); + + // skills + Skills::Window->setPosition(OgreClient::Singleton->Config->UILayoutSkills->getPosition()); + Skills::Window->setSize(OgreClient::Singleton->Config->UILayoutSkills->getSize()); + + // actions + Actions::Window->setPosition(OgreClient::Singleton->Config->UILayoutActions->getPosition()); + Actions::Window->setSize(OgreClient::Singleton->Config->UILayoutActions->getSize()); + + // attributes + Attributes::Window->setPosition(OgreClient::Singleton->Config->UILayoutAttributes->getPosition()); + Attributes::Window->setSize(OgreClient::Singleton->Config->UILayoutAttributes->getSize()); + + // mainbuttonsleft + MainButtonsLeft::Window->setPosition(OgreClient::Singleton->Config->UILayoutMainButtonsLeft->getPosition()); + MainButtonsLeft::Window->setSize(OgreClient::Singleton->Config->UILayoutMainButtonsLeft->getSize()); + + // mainbuttonsright + MainButtonsRight::Window->setPosition(OgreClient::Singleton->Config->UILayoutMainButtonsRight->getPosition()); + MainButtonsRight::Window->setSize(OgreClient::Singleton->Config->UILayoutMainButtonsRight->getSize()); + + // actionbuttons + ActionButtons::Window->setPosition(OgreClient::Singleton->Config->UILayoutActionButtons->getPosition()); + ActionButtons::Window->setSize(OgreClient::Singleton->Config->UILayoutActionButtons->getSize()); + + // onlineplayers + OnlinePlayers::Window->setPosition(OgreClient::Singleton->Config->UILayoutOnlinePlayers->getPosition()); + OnlinePlayers::Window->setSize(OgreClient::Singleton->Config->UILayoutOnlinePlayers->getSize()); + + // roomobjects + RoomObjects::Window->setPosition(OgreClient::Singleton->Config->UILayoutRoomObjects->getPosition()); + RoomObjects::Window->setSize(OgreClient::Singleton->Config->UILayoutRoomObjects->getSize()); + }; + void ControllerUI::SaveLayoutToConfig() { if (!IsInitialized) diff --git a/Meridian59.Ogre.Client/ControllerUI.h b/Meridian59.Ogre.Client/ControllerUI.h index 962358f1..91533c97 100644 --- a/Meridian59.Ogre.Client/ControllerUI.h +++ b/Meridian59.Ogre.Client/ControllerUI.h @@ -71,6 +71,7 @@ namespace Meridian59 { namespace Ogre static void PasteFromClipboard(::CEGUI::Window* EditBox); static void CopyToClipboard(::CEGUI::Window* EditBox, bool Cut); static void SaveLayoutToConfig(); + static void ResetLayout(); static void OnDataPropertyChanged(Object^ sender, PropertyChangedEventArgs^ e); static void InjectMousePosition(float x, float y); static void InjectMouseWheelChange(float z); @@ -273,6 +274,7 @@ namespace Meridian59 { namespace Ogre static ::CEGUI::Window* MTimeValue = nullptr; static ::CEGUI::Window* RoomDescription = nullptr; static ::CEGUI::Window* RoomValue = nullptr; + static ::CEGUI::PushButton* Reset = nullptr; static ::CEGUI::PushButton* Lock = nullptr; static void Initialize(); @@ -1645,6 +1647,7 @@ namespace Meridian59 { namespace Ogre static bool OnMoodAngryClicked(const CEGUI::EventArgs& e); static bool OnSafetyClicked(const CEGUI::EventArgs& e); static bool OnPlayersClicked(const CEGUI::EventArgs& e); + static bool OnResetClicked(const CEGUI::EventArgs& e); static bool OnLockClicked(const CEGUI::EventArgs& e); static bool OnFPSClicked(const CEGUI::EventArgs& e); }; diff --git a/Meridian59.Ogre.Client/Language.cpp b/Meridian59.Ogre.Client/Language.cpp index 11e99bd9..936136a4 100644 --- a/Meridian59.Ogre.Client/Language.cpp +++ b/Meridian59.Ogre.Client/Language.cpp @@ -51,13 +51,17 @@ const char* EN_TOOLTIPS_ONLINEPLAYER[] = const char* EN_TOOLTIPS_STATUSBAR[] = { - "Frames per second - Higher is better (more fluid Gameplay).", // 0 - "Your Connectionspeed to the Server. Lower value means faster connection.", // 1 - "The number of players online. Click me to show the list of online Players.", // 2 - "Shows the actual mood of your character.", // 3 - "If you change your safety to Off you can attack inocent players.", // 4 - "Here you can see the actual Meridian 59 time.", // 5 - "This shows you the actual room / area name, in which you actually are." // 6 + "Frames per second - Higher is better (more fluid Gameplay).", // 0 + "Your Connectionspeed to the Server. Lower value means faster connection.", // 1 + "The number of players online. Click me to show the list of online Players.", // 2 + "Shows the actual mood of your character.", // 3 + "If you change your safety to Off you can attack inocent players.", // 4 + "Here you can see the actual Meridian 59 time.", // 5 + "This shows you the actual room / area name, in which you actually are.", // 6 + "Interface is currently locked. \n You can't move or resize windows. \n Click to unlock.", // 7 + "Interface is currently unlocked. \n You can move or resize windows. \n Click to lock.", // 8 + "Click to restore the UI layout to its default.", // 9 + "Unable to restore the UI layout to its default position while UI is locked." // 10 }; const char* EN_DESCRIPTIONS_STATUSBAR[] = @@ -200,7 +204,14 @@ const char* DE_TOOLTIPS_STATUSBAR[] = "Zeigt die aktuelle Stimmung Deines Characters an.", // 3 "Wenn Du Deine Sicherheit auf Aus stellst, kannst Du unschuldige Spieler angreifen", // 4 "Hier siehst Du die aktuelle Meridian 59 Zeit.", // 5 - "Zeigt Dir den aktuellen Raum / Bereich an, indem Du Dich befindest." // 6 + "Zeigt Dir den aktuellen Raum / Bereich an, indem Du Dich befindest.", // 6 + "Das Layout der Benutzeroberfläche ist momentan geschützt. \n Elemente können nicht " \ + "verschoben oder angepasst werden. \n Klicken, um das Layout freizugeben.", // 7 + "Das Layout der Benutzeroberfläche ist momentan nicht geschützt. \n Elemente können " \ + "verschoben und angepasst werden. \n Klicken, um das Layout zu schützen.", // 8 + "Klicken, um das ursprüngliche Layout der Benutzeroberfläche wiederherzustellen.", // 9 + "Das Layout der Benutzeroberfläche kann nicht zurückgesetzt werden, solange es " \ + "geschützt ist." // 10 }; const char* DE_DESCRIPTIONS_STATUSBAR[] = diff --git a/Meridian59.Ogre.Client/Language.h b/Meridian59.Ogre.Client/Language.h index 196f39a2..958eef41 100644 --- a/Meridian59.Ogre.Client/Language.h +++ b/Meridian59.Ogre.Client/Language.h @@ -75,13 +75,17 @@ namespace LANGSTR_TOOLTIP_STATUSBAR { enum Enum { - FPS_TOOLTIP = 0, - PING_TOOLTIP = 1, - PLAYERCOUNT_TOOLTIP = 2, - MOOD_TOOLTIP = 3, - SAFETY_TOOLTIP = 4, - TIME_TOOLTIP = 5, - ROOM_TOOLTIP = 6 + FPS_TOOLTIP = 0, + PING_TOOLTIP = 1, + PLAYERCOUNT_TOOLTIP = 2, + MOOD_TOOLTIP = 3, + SAFETY_TOOLTIP = 4, + TIME_TOOLTIP = 5, + ROOM_TOOLTIP = 6, + UILOCKED_TOOLTIP = 7, + UIUNLOCKED_TOOLTIP = 8, + UIRESET_TOOLTIP = 9, + UIRESETLOCKED_TOOLTIP = 10 }; } diff --git a/Meridian59.Ogre.Client/OgreClientConfig.cpp b/Meridian59.Ogre.Client/OgreClientConfig.cpp index 4a7bdfea..793ce57e 100644 --- a/Meridian59.Ogre.Client/OgreClientConfig.cpp +++ b/Meridian59.Ogre.Client/OgreClientConfig.cpp @@ -21,6 +21,11 @@ namespace Meridian59 { namespace Ogre { OgreClientConfig::OgreClientConfig() : Config() + { + ResetUIElements(); + }; + + void OgreClientConfig::ResetUIElements() { UILayoutAvatar = new ::CEGUI::URect( ::CEGUI::Vector2<::CEGUI::UDim>(::CEGUI::UDim(0.0f, 2.0f), ::CEGUI::UDim(0.0f, 25.0f)), diff --git a/Meridian59.Ogre.Client/OgreClientConfig.h b/Meridian59.Ogre.Client/OgreClientConfig.h index 7f516911..fbb4d106 100644 --- a/Meridian59.Ogre.Client/OgreClientConfig.h +++ b/Meridian59.Ogre.Client/OgreClientConfig.h @@ -302,5 +302,6 @@ namespace Meridian59 { namespace Ogre ActionButtonList^ GetActionButtonSetByName(CLRString^ Name); void AddOrUpdateActionButtonSet(ActionButtonList^ Buttons); + void ResetUIElements(); }; };}; diff --git a/Meridian59.Ogre.Client/UIStatusBar.cpp b/Meridian59.Ogre.Client/UIStatusBar.cpp index ab461e87..f0eb7f7a 100644 --- a/Meridian59.Ogre.Client/UIStatusBar.cpp +++ b/Meridian59.Ogre.Client/UIStatusBar.cpp @@ -23,6 +23,7 @@ namespace Meridian59 { namespace Ogre MTimeValue = static_cast(Window->getChild(UI_NAME_STATUSBAR_MTIMEVAL)); RoomDescription = static_cast(Window->getChild(UI_NAME_STATUSBAR_ROOMDESC)); RoomValue = static_cast(Window->getChild(UI_NAME_STATUSBAR_ROOMVAL)); + Reset = static_cast(Window->getChild(UI_NAME_STATUSBAR_RESET)); Lock = static_cast(Window->getChild(UI_NAME_STATUSBAR_LOCK)); // attach listener to Data @@ -53,6 +54,9 @@ namespace Meridian59 { namespace Ogre // subscribe players click PlayersValue->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(UICallbacks::StatusBar::OnPlayersClicked)); + // subscribe ui reset click + Reset->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(UICallbacks::StatusBar::OnResetClicked)); + // subscribe ui lock click Lock->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(UICallbacks::StatusBar::OnLockClicked)); @@ -81,11 +85,13 @@ namespace Meridian59 { namespace Ogre void ControllerUI::StatusBar::ApplyLanguage() { + const bool LOCKED = OgreClient::Singleton->Config->UILocked; + // Set Tooltips for selected language FPSDescription->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::FPS_TOOLTIP)); FPSValue->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::FPS_TOOLTIP)); - RTTDescription->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::FPS_TOOLTIP)); - RTTValue->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::FPS_TOOLTIP)); + RTTDescription->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::PING_TOOLTIP)); + RTTValue->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::PING_TOOLTIP)); PlayersDescription->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::PLAYERCOUNT_TOOLTIP)); PlayersValue->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::PLAYERCOUNT_TOOLTIP)); MoodDescription->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::MOOD_TOOLTIP)); @@ -100,6 +106,19 @@ namespace Meridian59 { namespace Ogre RoomDescription->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::ROOM_TOOLTIP)); RoomValue->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::ROOM_TOOLTIP)); + if (LOCKED) + { + Lock->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::UILOCKED_TOOLTIP)); + Reset->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::UIRESETLOCKED_TOOLTIP)); + } + else + { + Lock->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::UIUNLOCKED_TOOLTIP)); + Reset->setTooltipText(GetLangTooltipStatusBar(LANGSTR_TOOLTIP_STATUSBAR::UIRESET_TOOLTIP)); + } + + ControllerUI::StatusBar::Reset->setDisabled(LOCKED); + ControllerUI::ApplyLock(); // Set Descriptions for selected language /*FPSDescription->setText(GetLangDescriptionStatusBar(LANGSTR_DESCRIPTION_STATUSBAR::FPS_DESCRIPTION)); RTTDescription->setText(GetLangDescriptionStatusBar(LANGSTR_DESCRIPTION_STATUSBAR::PING_DESCRIPTION)); @@ -242,12 +261,21 @@ namespace Meridian59 { namespace Ogre return true; }; + bool UICallbacks::StatusBar::OnResetClicked(const CEGUI::EventArgs& e) + { + ControllerUI::ResetLayout(); + + return true; + }; + bool UICallbacks::StatusBar::OnLockClicked(const CEGUI::EventArgs& e) { // flip lock in config OgreClient::Singleton->Config->UILocked = !OgreClient::Singleton->Config->UILocked; + ControllerUI::StatusBar::Reset->setDisabled(OgreClient::Singleton->Config->UILocked); + // update ui locking ControllerUI::ApplyLock(); diff --git a/Resources/ui/imagesets/TaharezLook.imageset b/Resources/ui/imagesets/TaharezLook.imageset index 633c1ef6..59da0d8e 100644 --- a/Resources/ui/imagesets/TaharezLook.imageset +++ b/Resources/ui/imagesets/TaharezLook.imageset @@ -185,10 +185,15 @@ - - - - + + + + + + + + + diff --git a/Resources/ui/imagesets/TaharezLook.png b/Resources/ui/imagesets/TaharezLook.png index 128f423f..dcc1d4e1 100644 Binary files a/Resources/ui/imagesets/TaharezLook.png and b/Resources/ui/imagesets/TaharezLook.png differ diff --git a/Resources/ui/layouts/Meridian59.layout b/Resources/ui/layouts/Meridian59.layout index 411ebc49..815fe999 100644 --- a/Resources/ui/layouts/Meridian59.layout +++ b/Resources/ui/layouts/Meridian59.layout @@ -657,12 +657,23 @@ + + + + + + + + + + + - +