Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.53 KB | None | 0 0
  1. diff --git a/modules/client_options/game.otui b/modules/client_options/game.otui
  2. index 63d73613..2e3918c2 100644
  3. --- a/modules/client_options/game.otui
  4. +++ b/modules/client_options/game.otui
  5. @@ -27,6 +27,10 @@ Panel
  6.      !text: tr('Show left panel')
  7.  
  8.    OptionCheckBox
  9. +    id: showExtraRightPanel
  10. +    !text: tr('Show an extra right panel')
  11. +
  12. +  OptionCheckBox
  13.      id: displayNames
  14.      !text: tr('Display creature names')
  15.  
  16. diff --git a/modules/client_options/options.lua b/modules/client_options/options.lua
  17. index 9ca73fa2..7182f7f3 100644
  18. --- a/modules/client_options/options.lua
  19. +++ b/modules/client_options/options.lua
  20. @@ -15,6 +15,10 @@ local defaultOptions = {
  21.    showPrivateMessagesInConsole = true,
  22.    showPrivateMessagesOnScreen = true,
  23.    showLeftPanel = false,
  24. +  
  25. +showExtraRightPanel
  26. +
  27. + = false,
  28.    foregroundFrameRate = 61,
  29.    backgroundFrameRate = 201,
  30.    painterEngine = 0,
  31. @@ -198,6 +202,8 @@ function setOption(key, value, force)
  32.      audioPanel:getChildById('musicSoundVolumeLabel'):setText(tr('Music volume: %d', value))
  33.    elseif key == 'showLeftPanel' then
  34.      modules.game_interface.getLeftPanel():setOn(value)
  35. +  elseif key == 'showExtraRightPanel' then
  36. +    modules.game_interface.getRightExtraPanel():setOn(value)
  37.    elseif key == 'backgroundFrameRate' then
  38.      local text, v = value, value
  39.      if value <= 0 or value >= 201 then text = 'max' v = 0 end
  40. diff --git a/modules/game_interface/gameinterface.lua b/modules/game_interface/gameinterface.lua
  41. index 09930e27..1f7aaa36 100644
  42. --- a/modules/game_interface/gameinterface.lua
  43. +++ b/modules/game_interface/gameinterface.lua
  44. @@ -4,6 +4,9 @@ gameRootPanel = nil
  45.  gameMapPanel = nil
  46.  gameRightPanel = nil
  47.  gameLeftPanel = nil
  48. +
  49. +
  50. +gameExtraRightPanel = nil
  51.  gameBottomPanel = nil
  52.  logoutButton = nil
  53.  mouseGrabberWidget = nil
  54. @@ -41,6 +44,7 @@ function init()
  55.    gameRootPanel:lower()
  56.    gameRootPanel.onGeometryChange = updateStretchShrink
  57.    gameRootPanel.onFocusChange = stopSmartWalk
  58. +  gameRootPanel.onDrop = checkMiniWindowDrops
  59.  
  60.    mouseGrabberWidget = gameRootPanel:getChildById('mouseGrabber')
  61.    mouseGrabberWidget.onMouseRelease = onMouseGrabberRelease
  62. @@ -49,8 +53,10 @@ function init()
  63.    gameMapPanel = gameRootPanel:getChildById('gameMapPanel')
  64.    gameRightPanel = gameRootPanel:getChildById('gameRightPanel')
  65.    gameLeftPanel = gameRootPanel:getChildById('gameLeftPanel')
  66. +  
  67. +
  68. +  gameExtraRightPanel = gameRootPanel:getChildById('gameExtraRightPanel')
  69.    gameBottomPanel = gameRootPanel:getChildById('gameBottomPanel')
  70. -  connect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange })
  71.  
  72.    logoutButton = modules.client_topmenu.addLeftButton('logoutButton', tr('Exit'),
  73.      '/images/topbuttons/logout', tryLogout, true)
  74. @@ -59,6 +65,8 @@ function init()
  75.  
  76.    bindKeys()
  77.  
  78. +  connect(rootWidget, {onDrop = checkMiniWindowDrops})
  79. +
  80.    if g_game.isOnline() then
  81.      show()
  82.    end
  83. @@ -791,6 +799,10 @@ function getLeftPanel()
  84.    return gameLeftPanel
  85.  end
  86.  
  87. +function getRightExtraPanel()
  88. +  return gameExtraRightPanel
  89. +end
  90. +
  91.  function getBottomPanel()
  92.    return gameBottomPanel
  93.  end
  94. @@ -866,3 +878,18 @@ end
  95.  function limitZoom()
  96.    limitedZoom = true
  97.  end
  98. +
  99. +function checkMiniWindowDrops(widget, draggedWidget, mousePos)
  100. +  if draggedWidget:getClassName() == 'UIMiniWindow' then
  101. +    local middle = g_window.getWidth() / 2
  102. +    local moveToLeft = mousePos.x < middle
  103. +    if moveToLeft and gameLeftPanel:isVisible() then
  104. +      gameLeftPanel:onDrop(draggedWidget, mousePos)
  105. +    elseif not moveToLeft and gameExtraRightPanel:isVisible() then
  106. +      gameExtraRightPanel:onDrop(draggedWidget, mousePos)
  107. +    elseif not moveToLeft and gameRightPanel:isVisible() then
  108. +      gameRightPanel:onDrop(draggedWidget, mousePos)
  109. +    end
  110. +  end
  111. +end
  112. +
  113. diff --git a/modules/game_interface/gameinterface.otui b/modules/game_interface/gameinterface.otui
  114. index 9196a223..ca4e7afe 100644
  115. --- a/modules/game_interface/gameinterface.otui
  116. +++ b/modules/game_interface/gameinterface.otui
  117. @@ -53,11 +53,23 @@ UIWidget
  118.        visible: false
  119.  
  120.    GameSidePanel
  121. -    id: gameRightPanel
  122. +    id: gameExtraRightPanel
  123.      anchors.right: parent.right
  124.      anchors.top: parent.top
  125.      anchors.bottom: parent.bottom
  126.      focusable: false
  127. +    visible: true
  128. +    on: true
  129. +    $!on:
  130. +      width: 0
  131. +      visible: false
  132. +
  133. +  GameSidePanel
  134. +    id: gameRightPanel
  135. +    anchors.right: prev.left
  136. +    anchors.top: parent.top
  137. +    anchors.bottom: parent.bottom
  138. +    focusable: false
  139.      on: true
  140.  
  141.    Splitter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement