...
 
Commits (3)
......@@ -278,17 +278,17 @@ var MenuEditorLayer = ccui.Layout.extend(/** @lends MenuEditorLayer# */{
updateWorldList.addClickEventListener(this._updateWorldList.bind(this));
var updateWorldListAlign = new ccui.RelativeLayoutParameter();
updateWorldListAlign.setAlign(ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_CENTER);
updateWorldListAlign.setAlign(ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_BOTTOMALIGN);
updateWorldListAlign.setRelativeToWidgetName("worldSelect");
updateWorldListAlign.setMargin(0, 0, MenuEditorLayer.SEPARATOR, 0);
updateWorldList.setLayoutParameter(updateWorldListAlign);
this.addChild(updateWorldList);
this._selectWorldLayer = new SelectWorldEditorLayer(this, this._redrawWorld);
this._selectWorldLayer = new SelectWorldEditorLayer(this, this._redrawWorld, false, SelectWorldEditorLayer.Gravity.VERTICAL);
var worldLayerAlign = new ccui.RelativeLayoutParameter();
worldLayerAlign.setAlign(ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_CENTER);
worldLayerAlign.setAlign(ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_TOPALIGN);
worldLayerAlign.setRelativeName("worldSelect");
worldLayerAlign.setRelativeToWidgetName("menu");
worldLayerAlign.setMargin(0, 0, 1.5*MenuEditorLayer.SEPARATOR, 0);
......@@ -303,7 +303,7 @@ var MenuEditorLayer = ccui.Layout.extend(/** @lends MenuEditorLayer# */{
var infoAlign = new ccui.RelativeLayoutParameter();
infoAlign.setAlign(ccui.RelativeLayoutParameter.LOCATION_BELOW_CENTER);
infoAlign.setMargin(0, MenuEditorLayer.SEPARATOR, 0, 0);
infoAlign.setMargin(0, 1.5*MenuEditorLayer.SEPARATOR, 0, 0);
infoAlign.setRelativeName("info");
infoAlign.setRelativeToWidgetName("menu");
showInfoButton.setLayoutParameter(infoAlign);
......@@ -1088,8 +1088,8 @@ var MenuEditorLayer = ccui.Layout.extend(/** @lends MenuEditorLayer# */{
var layer = new WorldInfoLayer();
var infoAlign = new ccui.RelativeLayoutParameter();
infoAlign.setAlign(ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_TOPALIGN);
infoAlign.setMargin(0, 0, MenuEditorLayer.SEPARATOR, 0);
infoAlign.setAlign(ccui.RelativeLayoutParameter.LOCATION_BELOW_RIGHTALIGN);
infoAlign.setMargin(0, 2*MenuEditorLayer.SEPARATOR, 0, 0);
infoAlign.setRelativeToWidgetName("info");
layer.setLayoutParameter(infoAlign);
......
......@@ -27,8 +27,9 @@ var SelectWorldEditorLayer = ccui.Layout.extend(/** @lends SelectWorldEditorLaye
_selectCallback: null,
_loadingLayer: null,
_gravity: 0,
ctor: function(target, callback, loadLocalWorlds)
ctor: function(target, callback, loadLocalWorlds, gravity)
{
this._super();
this.setLayoutType(ccui.Layout.RELATIVE);
......@@ -36,25 +37,42 @@ var SelectWorldEditorLayer = ccui.Layout.extend(/** @lends SelectWorldEditorLaye
if (loadLocalWorlds === undefined)
loadLocalWorlds = false;
if (gravity === undefined)
gravity = SelectWorldEditorLayer.Gravity.HORIZONTAL;
this._worldList = new WorldList(this._onLoadWorldList, this, loadLocalWorlds);
this._target = target;
this._selectCallback = callback;
this._gravity = gravity;
this._groupSelect = new pmui.ComboBox([], this, this._selectGroupOnSelect, 15, 0, this._selectGroupOnShow, this._selectGroupOnClose);
this._worldSelect = new pmui.ComboBox([], this, this._selectWorldOnSelect, 15, 0, this._selectWorldOnShow, this._selectWorldOnClose);
var groupAlign = new ccui.RelativeLayoutParameter();
groupAlign.setAlign(ccui.RelativeLayoutParameter.PARENT_RIGHT_CENTER_VERTICAL);
var worldAlign = new ccui.RelativeLayoutParameter();
if (gravity === SelectWorldEditorLayer.Gravity.HORIZONTAL)
{
groupAlign.setAlign(ccui.RelativeLayoutParameter.PARENT_RIGHT_CENTER_VERTICAL);
worldAlign.setAlign(ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_CENTER);
worldAlign.setMargin(0, 0, SelectWorldEditorLayer.SEPARATOR, 0);
}
else
{
groupAlign.setAlign(ccui.RelativeLayoutParameter.PARENT_TOP_RIGHT);
worldAlign.setAlign(ccui.RelativeLayoutParameter.LOCATION_BELOW_RIGHTALIGN);
worldAlign.setMargin(0, SelectWorldEditorLayer.SEPARATOR, 0, 0);
}
groupAlign.setRelativeName("group");
groupAlign.setMargin(0, 0, 0, 0);
this._groupSelect.setLayoutParameter(groupAlign);
var worldAlign = new ccui.RelativeLayoutParameter();
worldAlign.setAlign(ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_CENTER);
worldAlign.setRelativeName("world");
worldAlign.setRelativeToWidgetName("group");
worldAlign.setMargin(0, 0, SelectWorldEditorLayer.SEPARATOR, 0);
this._worldSelect.setLayoutParameter(worldAlign);
this.addChild(this._worldSelect, 1);
......@@ -90,9 +108,16 @@ var SelectWorldEditorLayer = ccui.Layout.extend(/** @lends SelectWorldEditorLaye
_updateSize: function(updateParent)
{
var width = this._groupSelect.getContentSize().width + this._worldSelect.getContentSize().width +
SelectWorldEditorLayer.SEPARATOR;
var height = Math.max(this._worldSelect.getContentSize().height, this._groupSelect.getContentSize().height);
if (this._gravity === SelectWorldEditorLayer.Gravity.HORIZONTAL)
{
var width = this._groupSelect.getContentSize().width + this._worldSelect.getContentSize().width + SelectWorldEditorLayer.SEPARATOR;
var height = Math.max(this._worldSelect.getContentSize().height, this._groupSelect.getContentSize().height);
}
else
{
var width = Math.max(this._groupSelect.getContentSize().width, this._worldSelect.getContentSize().width);
var height = this._worldSelect.getContentSize().height + this._groupSelect.getContentSize().height + SelectWorldEditorLayer.SEPARATOR;
}
this.setContentSize(width, height);
......@@ -303,4 +328,8 @@ var SelectWorldEditorLayer = ccui.Layout.extend(/** @lends SelectWorldEditorLaye
}
});
SelectWorldEditorLayer.SEPARATOR = 10;
SelectWorldEditorLayer.SEPARATOR = 8;
SelectWorldEditorLayer.Gravity = {
HORIZONTAL: 0,
VERTICAL: 1
};
......@@ -95,7 +95,7 @@ var ClassControlLayer = ccui.Layout.extend(/** @lends ClassControlLayer# */{
this.addChild(editLevel);
var selectWorldLayer = new SelectWorldEditorLayer(this, null, true);
var selectWorldLayer = new SelectWorldEditorLayer(this, null, true, SelectWorldEditorLayer.Gravity.HORIZONTAL);
var worldLayerAlign = new ccui.RelativeLayoutParameter();
worldLayerAlign.setAlign(ccui.RelativeLayoutParameter.PARENT_TOP_RIGHT);
......
......@@ -393,7 +393,7 @@ pmui.ComboBox.SEPARATOR = 10.0;
* @default
* @type {Number}
*/
pmui.ComboBox.DEFAULT_WIDTH =130.0;
pmui.ComboBox.DEFAULT_WIDTH = 130.0;
/**
* Default height of {@link pmui.ComboBox}.
* @const
......