Search Unity

eDriven Q&A

Discussion in 'Assets and Asset Store' started by dkozar, Aug 22, 2012.

  1. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Currently the list events are not being routed back to combo box. I'll sure have to implement it.

    Meanwhile, what you should do is to find the List as a child of the stage used by popup manager:

    Code (csharp):
    1. foreach (DisplayListMember child in PopupManagerStage.Instance.Children)
    2. {
    3.     if (child is List)
    4.         ((List) child).MouseOver += YourMouseOverHandler;
    5. }
    The list is created lazily, the first time a combo box is being opened. After closing the combo, the list is still around (but not on stage) so you can hold the reference to it.

    PopupManagerStage is in eDriven.Gui.Stages namespace.

    This is a known bug and here's the temporary workaround: http://forum.unity3d.com/threads/148424-eDriven-Q-amp-A/page14?p=1224971&viewfull=1#post1224971
     
  2. rufreakde

    rufreakde

    Joined:
    Jan 16, 2013
    Posts:
    36
    Hey Danko,

    I bought your Product :p There are some new questions from my side now XD

    1. I still cant lookup your declarations is this normal?
    2. I create two windows in one c# file where is the new stage created ( so I can modify the LayoutDescriptor of both)? Because I need one window oriented in Top Right and the 2nd one oriented at BottomLeft.
     
  3. rufreakde

    rufreakde

    Joined:
    Jan 16, 2013
    Posts:
    36
    Note: I know that the Layout-descriptor only changes children positions and size and so on thaths why I want to know where the new stages are created (Its stage3 because its my 3rd script) And I never work with the editor! I Script XD
     
  4. rufreakde

    rufreakde

    Joined:
    Jan 16, 2013
    Posts:
    36
    Hey Danko,

    now I have another question I try to display Images (I change them) and display them behind the buttons.
    But I cant size them right I though I could use percent to size it like the parent (the button)

    Code (csharp):
    1.     void CreateButton(string _Text, string _StyleMapper, int _PosX, int _PosY, int _Data, HBox _Parent)
    2.     {
    3.         ar_GemSpellButtons[_Data] = new Button
    4.         {
    5.             Text            = _Text,
    6.             StyleMapper     = _StyleMapper,
    7.             X               = f_XbuttonBorder + f_buttonWidth2 + f_XbuttonBorder + (f_buttonWidth + f_XbuttonSpaces) * _PosX,
    8.             Y               = f_YbuttonBorder + f_buttonPHeight + f_YbuttonBorder + (f_buttonHeight + f_YbuttonBorder) * _PosY,
    9.             Width           = f_buttonWidth,
    10.             Height          = f_buttonHeight,
    11.             IncludeInLayout = false,
    12.             Data            = _Data
    13.         };
    14.         _Parent.AddContentChild(ar_GemSpellButtons[_Data]);
    15.        
    16.          ar_Images[_Data] = new Image
    17.          {
    18.             //Width     = f_buttonWidth,
    19.             //Height    = f_buttonHeight,
    20.             PercentWidth= 100,
    21.             PercentHeight= 100,
    22.             IncludeInLayout = false,
    23.             Texture = gt_EmptyGemIco,
    24.             Tooltip = ar_GemSpellButtons[_Data].Text
    25.          };
    26.         ar_GemSpellButtons[_Data].AddChild(ar_Images[_Data]);
    27.     }
    Thanks in advance! :D
     
  5. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Great! :)

    1. 2. please post your code, I'm not quite sure what are you doing.

    PS. Try not to use LayoutDescriptors: usethe Layout property instead. This is because LayoutDescriptor is removed from the future versions (it was just meant to be the time saver anyway). With Layout you pass the instance of a newly created layout object (for instance new BoxLayout()) and you can then fully customize it.
     
  6. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Ah, you mean the GuiLookup class? Yes, it works only with the editor approach, and is meant for iterating Adapters in order to find components.

    This approach you really don't need with scripting because you can keep references by yourself.
     
  7. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
  8. prebelo

    prebelo

    Joined:
    Sep 5, 2013
    Posts:
    11
    Hey Danko!

    I have a little problem with this overlay that I'm writing that will cover the entire screen of my application. To sum it up, I have an overlay that is the parent of all my boxes, sliders, buttons and whatnot that I'm building in my scene. I wanna be able to darken the scene so the first thing I used was the Alpha property and it was fine.

    The problem is that I wanna be able to do a Blend Mode Multiply which is something like this:

    "Multiply blend mode multiplies the numbers for each pixel of the top layer with the corresponding pixel for the bottom layer. The result is a darker picture."

    Is it possible to multiply each pixel thats "underneath" my overlay with the color Black? If so, how can I do this?

    Thanks in advance!
     
  9. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Unfortunately, it isn't possible because it doesn't use filters or such (uses IMGUI at low-level and IMGUI doesn't provide anything than alphas).
     
  10. eventropy

    eventropy

    Joined:
    Oct 4, 2012
    Posts:
    255
    Hey Danko
    Thanks for being so responsive on this thread. I've got a problem that has to do with horizontal scroll bars. I think you mentioned that you improved support for scroll bars in the next version (looking forward to that by the way!) but for now I need to get this working with the current version. Basically, I've found that when child content is set to have a PercentHeight of 100, horizontal scrollbars display but do not respond to clicks. I can explain best with an example. If you run the following you will get a horizontal scroll bar that doesn't work at all. BUT if you uncomment out the 'PercentHeight = 90' line things work again.

    Code (csharp):
    1.  
    2.     public class TestScrollbarsGui : Gui
    3.     {
    4.         protected override void OnInitialize()
    5.         {
    6.             base.OnInitialize();
    7.  
    8.             Stage.Padding = 0;
    9.         }
    10.  
    11.         Container GetSubPanel()
    12.         {
    13.             var panel = new Box
    14.             {
    15.                 Width = 1500,
    16.                 //PercentHeight = 90, // uncomment this to get scroll bar to work
    17.                 PercentHeight = 100,
    18.                 BackgroundColor = Color.green,
    19.             };
    20.             panel.EnableBackground(true);
    21.  
    22.             var label = new Label
    23.             {
    24.                 Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus egestas varius adipiscing. Cras sit amet interdum est. In in arcu at nulla fermentum gravida. Praesent non iaculis enim. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Ut at placerat metus, sed feugiat nisi. Suspendisse facilisis, lacus vitae convallis egestas, tellus leo ornare nibh, ac placerat erat lorem sed ante. Aenean elit lacus, mollis nec purus nec, tristique vestibulum justo. Maecenas volutpat justo ligula, eu tristique turpis rhoncus et. Nunc adipiscing tempus tortor, quis tincidunt felis. Cras commodo enim vitae justo molestie, vitae adipiscing mi molestie. Phasellus volutpat ut sapien facilisis auctor. Vivamus ut massa et sapien lobortis varius at ut nunc. Curabitur lacinia cursus erat vel dignissim. Maecenas ullamcorper metus quis massa pellentesque, ac pretium nibh iaculis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; ",
    25.             };
    26.  
    27.             panel.AddChild(label);
    28.             return panel;
    29.         }
    30.  
    31.         protected override void CreateChildren()
    32.         {
    33.             base.CreateChildren();
    34.  
    35.             var panel = new Box
    36.             {
    37.                 Width = 400,
    38.                 Height = 400,
    39.             };
    40.             panel.ScrollContent = true;
    41.             panel.LayoutDescriptor = LayoutDescriptor.Absolute;
    42.  
    43.             panel.AddChild(GetSubPanel());
    44.  
    45.             AddChild(panel);
    46.         }
    47.     }
    48.  
    49.  
    50.  
     
  11. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Hey,

    It's all about the awful "processing order" bug. See, Unity IMGUI doesn't handle the overlapping stuff properly.

    It is most visible if scrollbars are being rendered on top of clickable controls: scrollbars do not work.

    That is the main reason why I did the complete rewrite of container and scrollviews for the v1.12 (building my own scrollbars). The additional reason is that I don't want to depend on any scrollview logic, because I'm planning to wrap the framework around the next "low-level" GUI system someday :)
     
  12. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Guys, this forum thread became too huge, so I created the eDriven forum at the address:

    forum.edrivengui.com

    Please use it for asking questions!

    This way each answer will in the separate thread and easily searchable. :)

    (I'm currently separating all the answers from the Q&A thread to separate threads...)
     
    Last edited: Oct 1, 2013
  13. ScrappyRMH

    ScrappyRMH

    Joined:
    Apr 11, 2011
    Posts:
    48
    Finally! Thanks!
     
  14. rufreakde

    rufreakde

    Joined:
    Jan 16, 2013
    Posts:
    36
    Thanks for your quick reply Danko,
    Well I hope this post won't get to long xD
    -> Everything works perfectly the only thing is the Oriantation of the two Mainboxes :D
    -> and i dont realy know how to use the normal layout :(

    Code (csharp):
    1.     /*******************
    2.      * CODING AREA GUI *
    3.      *******************/
    4.    
    5.     #region INIT
    6.     protected override void OnInitialize()
    7.     {
    8.         base.OnInitialize();
    9.         GetOptionsGuiValues();
    10.        
    11. //Mainbox 1 Top Right
    12.         hB_TopRightBox.Layout = new BoxLayout()
    13.         {
    14.             HorizontalAlign = HorizontalAlign.Right,
    15.             VerticalAlign = VerticalAlign.Top
    16.         };
    17. //Mainbox 2 Bottom Left
    18.         hB_BottomLeftBox[0].Layout = new BoxLayout()
    19.         {
    20.             HorizontalAlign = HorizontalAlign.Left,
    21.             VerticalAlign = VerticalAlign.Bottom
    22.         };
    23.        
    24.         Debug.LogError("!___! EDriven GUi Loaded Completely !___!");
    25.     }  
    26.     #endregion
    27.    
    28.     #region GET OTHER SCRIPTS  
    29.     void GetGladiatorValues()
    30.     {
    31.         //Debug.Log("i got called and choose a gladiator now");
    32.         GameObject[] Players    =   GameObject.FindGameObjectsWithTag("Player");
    33.         foreach (GameObject Player in Players)
    34.                 if(Player.GetComponent<CGladiator>().IsMine)
    35.                 {
    36.                     //Debug.Log("yeah found my gladiator");
    37.                     cg_MyGladiator = Player.GetComponent<CGladiator>();
    38.                     //Debug.Log("TR " + this.ToString() + "Gladiator dead= " + cg_MyGladiator.IsDead());
    39.                 }
    40.     }
    41.    
    42.     void GetOptionsGuiValues()
    43.     {
    44.         co_MyOptions = gameObject.GetComponent<COptionsGui>();
    45.         this.ResizeTopRight(co_MyOptions.f_GuiScale);
    46.     }
    47.     #endregion
    48.    
    49.     #region CREATE THE GUI
    50.     override protected void CreateChildren()
    51.     {  
    52.         //get Gladiator
    53.         GetGladiatorValues();  
    54.        
    55.         #region TOP RIGHT GUI
    56.         base.CreateChildren();
    57.         LayoutDescriptor = LayoutDescriptor.HorizontalTopRight;
    58.         //Boxes
    59.         hB_TopRightBox =    HBoxCreatonForAll(hB_TopRightBox,null,0f,0f,f_TopRightBoxWidth,f_TopRightBoxHeight,s_TopRightBox, LayoutDescriptor.Absolute, true);
    60.         //Label
    61.         ar_LabelsTopRight[0] = LabelCreationTopRight(ar_LabelsTopRight[0],hB_TopRightBox,0,"Teamstats");
    62.         ar_LabelsTopRight[1] = LabelCreationTopRight(ar_LabelsTopRight[1],hB_TopRightBox,1,"Kills");
    63.         ar_LabelsTopRight[2] = LabelCreationTopRight(ar_LabelsTopRight[2],hB_TopRightBox,2,"Deaths");
    64.         ar_LabelsTopRight[3] = LabelCreationTopRight(ar_LabelsTopRight[3],hB_TopRightBox,3,"Assist");
    65.         #endregion
    66.        
    67.        
    68.         #region BOT LEFT GUI
    69.         base.CreateChildren();
    70.        
    71.         //Boxes
    72.         hB_BottomLeftBox[0] = HBoxCreatonForAll(hB_BottomLeftBox[0],null,0f,0f,f_bl_BoxWidth,f_bl_BoxHeight,s_BottomRightBox, LayoutDescriptor.Absolute, true);
    73.         hB_BottomLeftBox[1] = HBoxCreatonForAll(hB_BottomLeftBox[1],hB_BottomLeftBox[0],f_bl_XBorderSpacing                                                 ,f_bl_YVerticalSpacing,f_bl_LabelBoxWidth   ,f_bl_LabelBoxHeight,s_EmptySkin, LayoutDescriptor.Absolute, false);       
    74.         hB_BottomLeftBox[2] = HBoxCreatonForAll(hB_BottomLeftBox[2],hB_BottomLeftBox[0],f_bl_XBorderSpacing + (f_bl_LabelBoxWidth + f_bl_XHorizontalSpacing),f_bl_YVerticalSpacing,f_bl_LabelBoxWidth   ,f_bl_LabelBoxHeight,s_EmptySkin, LayoutDescriptor.Absolute, false);
    75.         hB_BottomLeftBox[3] = HBoxCreatonForAll(hB_BottomLeftBox[3],hB_BottomLeftBox[0],f_bl_XBorderSpacing + (f_bl_LabelBoxWidth + f_bl_XHorizontalSpacing) * 2,f_bl_YVerticalSpacing,f_bl_LabelBoxWidth,f_bl_LabelBoxHeight,s_EmptySkin, LayoutDescriptor.Absolute, false);
    76.         //Label
    77.         int i = 0;
    78.         int t = 1;
    79.         for (int y=0; y<15; y++)
    80.         {  
    81.             LabelCreationBottomLeft(hB_BottomLeftBox[t],y,i,0f);
    82.             i++;
    83.             if(i > 4) {i=0; t++;}
    84.         }
    85.  
    86.         #endregion
    87.        
    88.        
    89.     }
    90.     #endregion
    91.    
    92.     #region CREATE FUNCTIONS()
    93.     HBox HBoxCreatonForAll(HBox _Child ,HBox _Parent,float _PosX, float _PosY, float _Width, float _Height, string _StyleMapper, LayoutDescriptor _LayoutDescriptor, bool _IncludeLayout)
    94.     {
    95.         _Child = new HBox
    96.                 {
    97.                     X           =   _PosX,
    98.                     Y           =   _PosY,
    99.                     Width       =   _Width,
    100.                     Height      =   _Height,
    101.                     StyleMapper =   _StyleMapper,
    102.                     IncludeInLayout = _IncludeLayout
    103.                 };
    104.         if(_LayoutDescriptor != LayoutDescriptor.Absolute)
    105.         {
    106.             _Child.LayoutDescriptor = _LayoutDescriptor;
    107.             Debug.Log("Child : " + _Child + " " + "LayoutD " + _LayoutDescriptor);
    108.         }
    109.        
    110.         if(_Parent == null)
    111.         {
    112.             AddChildAt(0,_Child);
    113.         }
    114.         else
    115.             _Parent.AddContentChild(_Child);
    116.  
    117.         return _Child;
    118.     }
    119.    
    120.     Label LabelCreationTopRight(Label _Child ,HBox _Parent, int _Count, string _Title)
    121.     {
    122.         //Debug.Log("index :" + _Count);
    123.         _Child = new Label
    124.                 {
    125.                     Text            = _Title,
    126.                     X               = f_TopRightLabelX + (f_labelWidth * _Count),
    127.                     Y               = f_TopRightLabelY,
    128.                     Width           = f_labelWidth,
    129.                     Height          = f_labelHeight,
    130.                     IncludeInLayout = false,
    131.                     Id              = _Title
    132.                 }; 
    133.         //Debug.Log(" Counter " + _Count + " Parent " + _Parent + " Child " + _Child.Id);
    134.         _Parent.AddContentChild(_Child);
    135.         i_TopRightLabelCount++;
    136.        
    137.         //Debug.Log("pos x " + _Child.X);
    138.        
    139.         return _Child;
    140.     }
    141.    
    142.     bool LabelCreationBottomLeft(HBox _Parent, int _Counter, int _BreakPoint, float _VerticalSpacer)
    143.     {
    144.         //Debug.Log("int Counter :" + _Counter + " " + _Parent.ToString());
    145.                 ar_bl_label[_Counter] = new Label
    146.                             {
    147.                                 Text            = "Error",
    148.                                 Width           = f_bl_LabelWidth,
    149.                                 Height          = f_bl_LabelHeight,
    150.                                 Y               = f_bl_LabelHeight * _BreakPoint,
    151.                                 X               = _VerticalSpacer,
    152.                                 IncludeInLayout = false
    153.                             };
    154.         _Parent.AddContentChild(ar_bl_label[_Counter]);
    155.         return true;
    156.     }
    157.     #endregion
    158.    
    159.     #region UPDATING FUNCTIONS ()
    160.    
    161.     public void ResizeTopRight(float _GuiScale)
    162.     {
    163.        
    164.         hB_TopRightBox.Width        =   f_TopRightBoxWidth      * _GuiScale;
    165.         hB_TopRightBox.Height       =   f_TopRightBoxHeight     * _GuiScale;
    166.        
    167.         for( int i = 0; i< i_TopRightLabelCount+1; i++)
    168.         {
    169.             //Debug.Log("i " + i);
    170.            
    171.             ar_LabelsTopRight[i].X          =   (f_TopRightLabelX + (f_labelWidth * i)) * _GuiScale;
    172.             ar_LabelsTopRight[i].Y          =   f_TopRightLabelY        * _GuiScale;
    173.             //Debug.Log("X " + ar_LabelsTopRight[i].X + " Y " + ar_LabelsTopRight[i].Y);
    174.            
    175.             ar_LabelsTopRight[i].Width      =   f_labelWidth    * _GuiScale;
    176.             ar_LabelsTopRight[i].Height     =   f_labelHeight   * _GuiScale;
    177.         }
    178.        
    179.     }
    180.     public void ResizeBottomLeft(float _GuiScale)
    181.     {
    182.         //Debug.Log("resize the gui " + f_GuiScale);
    183.        
    184.         hB_BottomLeftBox[0].Width   = f_bl_BoxWidth             * _GuiScale;
    185.         hB_BottomLeftBox[0].Height  = f_bl_BoxHeight            * _GuiScale;
    186.        
    187.         hB_BottomLeftBox[1].Width   = f_bl_LabelBoxWidth        * _GuiScale;
    188.         hB_BottomLeftBox[1].Height  = f_bl_LabelBoxHeight       * _GuiScale;
    189.         hB_BottomLeftBox[1].X       = f_bl_XBorderSpacing       * _GuiScale;
    190.         hB_BottomLeftBox[1].Y       = f_bl_YVerticalSpacing     * _GuiScale;
    191.  
    192.         hB_BottomLeftBox[2].Width   = f_bl_LabelBoxWidth        * _GuiScale;
    193.         hB_BottomLeftBox[2].Height  = f_bl_LabelBoxHeight       * _GuiScale;
    194.         hB_BottomLeftBox[2].X       = (f_bl_XBorderSpacing + f_bl_LabelBoxWidth + f_bl_XHorizontalSpacing) * _GuiScale;
    195.         hB_BottomLeftBox[2].Y       = f_bl_YVerticalSpacing     * _GuiScale;
    196.        
    197.         hB_BottomLeftBox[3].Width   = f_bl_LabelBoxWidth        * _GuiScale;
    198.         hB_BottomLeftBox[3].Height  = f_bl_LabelBoxHeight       * _GuiScale;
    199.         hB_BottomLeftBox[3].X       = (f_bl_XBorderSpacing + f_bl_LabelBoxWidth + f_bl_XHorizontalSpacing + f_bl_LabelBoxWidth + f_bl_XHorizontalSpacing) * _GuiScale;
    200.         hB_BottomLeftBox[3].Y       = f_bl_YVerticalSpacing     * _GuiScale;
    201.        
    202.         for ( int i=0; i<15; i++)
    203.         {
    204.             ar_bl_label[i].Width        = f_bl_LabelWidth * _GuiScale;
    205.             ar_bl_label[i].Height       = f_bl_LabelHeight * _GuiScale;
    206.             ar_bl_label[i].Y            = (f_bl_LabelHeight * (i % 5)) * _GuiScale;
    207.         }
    208.     }
    209.    
    210.     void LateUpdate()
    211.     {
    212.         ar_LabelsTopRight[0].Text = cg_MyGladiator.IsDead().ToString();
    213.         ar_LabelsTopRight[1].Text = cg_MyGladiator.Kills.ToString();
    214.         ar_LabelsTopRight[2].Text = cg_MyGladiator.Deaths.ToString();
    215.         //aLabelTR[3].Text = cg_MyGladiator.Assists.ToString();
    216.        
    217.         ar_Damage = cg_MyGladiator.GetDamageValueArray();
    218.         ar_BonusDamage = cg_MyGladiator.GetDamageBonusValueArray();
    219.         ar_Defence = cg_MyGladiator.GetDefenseValueArray();
    220.        
    221.         if(ar_Damage.Length >= 5)
    222.         {
    223.         for (int i=0; i<15; i++)
    224.             {
    225.                 if(i <5)
    226.                 ar_bl_label[i].Text = ar_Damage[i % 5].ToString();
    227.                 else if(i>=5  i<10)
    228.                 ar_bl_label[i].Text = ar_BonusDamage[i % 5].ToString();
    229.                 else if(i>=10)
    230.                 ar_bl_label[i].Text = ar_Defence[i % 5].ToString();
    231.             }
    232.         }
    233.     }
    234.    
    235.     #endregion
     
    Last edited: Oct 1, 2013
  15. rufreakde

    rufreakde

    Joined:
    Jan 16, 2013
    Posts:
    36
    Damn didn't see the new Forum I will post there xD

    ähh if I get the permission XD
     
    Last edited: Oct 1, 2013
  16. rufreakde

    rufreakde

    Joined:
    Jan 16, 2013
    Posts:
    36
    Well i implemented the class Image2 but its the same thing as the normal Image class?

    my code:
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. namespace eDriven.Gui.Components
    4. {
    5.     /// <summary>
    6.     /// Copyright © Danko Kozar 2010-2013. All rights reserved.
    7.     /// </summary>
    8.     public class Image2 : Component
    9.     {
    10.         private bool _textureChanged;
    11.         private UnityEngine.Texture _texture;
    12.         /// <summary>
    13.         /// The icon texture
    14.         /// </summary>
    15.         public virtual UnityEngine.Texture Texture
    16.         {
    17.             get { return _texture; }
    18.             set
    19.             {
    20.                 if (value != _texture)
    21.                 {
    22.                     _texture = value;
    23.                     _textureChanged = true;
    24.                     InvalidateProperties();
    25.                     InvalidateSize();
    26.                 }
    27.             }
    28.         }
    29.  
    30.         private float _aspectRatio;
    31.  
    32.         /// <summary>
    33.         /// Image aspect ratio
    34.         /// </summary>
    35.         public float AspectRatio
    36.         {
    37.             get
    38.             {
    39.                 return _aspectRatio;
    40.             }
    41.             set
    42.             {
    43.                 _aspectRatio = value;
    44.                 InvalidateSize();
    45.             }
    46.         }
    47.  
    48.         /// <summary>
    49.         /// Image scale mode
    50.         /// </summary>
    51.         public UnityEngine.ScaleMode ScaleMode = UnityEngine.ScaleMode.ScaleToFit;
    52.  
    53.         /// <summary>
    54.         /// Alpha blend
    55.         /// </summary>
    56.         public bool AlphaBlend = true;
    57.  
    58.         protected override void Render()
    59.         {
    60.             if (null != Texture)
    61.                 GUI.DrawTexture(RenderingRect, Texture, ScaleMode, AlphaBlend, _aspectRatio);
    62.         }
    63.  
    64.         public Image2()
    65.         {
    66.             MinWidth = 20;
    67.             MinHeight = 20;
    68.             FocusEnabled = false;
    69.         }
    70.  
    71.         protected override void CommitProperties()
    72.         {
    73.             base.CommitProperties();
    74.  
    75.             if (_textureChanged)
    76.             {
    77.                 _textureChanged = false;
    78.  
    79.                 float w = _texture.width;
    80.                 float h = _texture.height;
    81.  
    82.                 AspectRatio = w/h;
    83.  
    84.                 if (null != _texture) {
    85.                     MinWidth = Width = w;
    86.                     MinHeight = Height = h;
    87.                     InitializeContent();
    88.                 }
    89.             }
    90.         }
    91.         /*
    92.             protected override void Measure()
    93.             {
    94.                 if (null != _texture)
    95.                 {
    96.                     MeasuredWidth = _texture.width;
    97.                     MeasuredHeight = _texture.height;
    98.                     MeasuredMinWidth = _texture.width;
    99.                     MeasuredMinHeight = _texture.height;
    100.                 }
    101.             }
    102.         */
    103.     }
    104. }
     
  17. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Please remove lines 85 and 86 where the Width and Height are set.

    Setting Width and Height explicitly works against the percent width and height.
     
  18. rufreakde

    rufreakde

    Joined:
    Jan 16, 2013
    Posts:
    36
    removed but now there is no picture shouldn't i change this lines to a percent width and height method relative to the parent?
     
  19. rufreakde

    rufreakde

    Joined:
    Jan 16, 2013
    Posts:
    36
    Okay now i use the explicity setting of width and height but calculate the real width and height manually works fine :)

    Thanks Danko

    (ps: using Layout instead of LayoutDescriptor since it won't be awailable in 1.12 anymore :p)
     
  20. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Last edited: Oct 1, 2013
  21. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    eDriven.Gui 2.0 is still pending in the Asset Store.

    Meanwhile, take a look at some of the new features.

    eDriven.Gui is on sale until Dec 31 - get it for $125 instead of $200!!!

     
  22. eventropy

    eventropy

    Joined:
    Oct 4, 2012
    Posts:
    255
    Is there a list of new features / bug fixes we can look at?
     
  23. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Many things have changed, although the most of the API is the same.

    Old bugs will vanish, and perhaps some new bugs will appear.

    However, I'll squash them as soon as reported since I'll now have regular updates (no such a long refactoring process as this one: promise!).

    I'll write about all the new features in the series of articles in my blog.

    You're all welcome to join the forum because it is the main source of information on how to work with eDriven.
     
  24. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
  25. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Last edited: Jan 11, 2014
  26. foq1978

    foq1978

    Joined:
    Aug 5, 2009
    Posts:
    41
    I have just got eDriven, and I must say it looks very, very interesting and complete!
    I do have a question, though: how hard it would be to implement a hierarchical tree component (one of those where you can expand and collapse sub-items, instead of an ordinary list)?

    Thank you very much and keep up the great work!
     
  27. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Trees are usually implemented as a vertical stack of child components (renderers), where each renderer is shifted to the right proportional to its depth in the tree (i.e. Depth * 16 px).

    So it wouldn't be hard... You just have to add multiple children to a single parent (the tree object) having the absolute layout, and then position each child (row) using the X, Y, Width and Height properties.

    A bit harder is dynamic tree where clicking the node expands the node and loads its children dynamically.
     
  28. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
  29. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    eDriven.Gui CRAZY PRICE DROP:

    Only $50 - until March 31!!!!!

    *** You DON'T wanna miss THAT!!! ***

    >>> Read more <<<

    $edrivengui_featured.png
     
  30. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
  31. Grespon

    Grespon

    Joined:
    Apr 13, 2012
    Posts:
    388
    Hi,
    Is there an easy and quick way to make a menu kind of thing just like applications, with dropdown items?
     
  32. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Hi,

    The answer is yes: eDriven has PopupManager, which is responsible for raising popups.

    Docs: http://edriven.dankokozar.com/api/2-0/html/T_eDriven_Gui_Managers_PopupManager.htm

    Popups are normal components being rendered in the special layer that is always above all the other layers (stages).

    Instead of:

    Code (CSharp):
    1. AddChild(child);
    ... you should use:

    Code (CSharp):
    1. PopupManager.Instance.AddPopup(child);
    This ensures that your component is pushed to the top layer (any component could be pushed to a popup layer: dialog, list, button etc.).

    You should build each part of the drop down menu as a separate list.

    Depending of the menu item clicked, you add another list as a popup using the above method.

    Then you adjust its coordinates using the coordinates of previous item clicked.

    You could subscribe to a special event of each popup that fires when the screen is clicked, but outside of the popup: MOUSE_DOWN_OUTSIDE. Then you remove the popup (or all of them).

    Please download the free version and search the projects for demos using the MOUSE_DOWN_OUTSIDE event.

    You could find more insights on PopupManager here:

    http://forum.edrivengui.com/index.php?search/976/&q=popupmanager&o=date

    Cheers!
     
  33. jason-fisher

    jason-fisher

    Joined:
    Mar 19, 2014
    Posts:
    133
    Will this be compatible with Unity 5?
     
    foq1978 likes this.
  34. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    There's no reason not to.

    You could always download the free package here and test it: http://edrivengui.com/free/

    Cheers!
     
  35. jason-fisher

    jason-fisher

    Joined:
    Mar 19, 2014
    Posts:
    133
    Great. I believe this is the best approach for rapid development when your game/application needs anything beyond settings/play/start. I would love to see the ability to render to a texture/sprite for floating in-game menus, like you might use on the Oculus (search for VRGUI for an example with source).

    Maybe the asset would get more exposure if it was positioned as an 'app builder' or UI workflow solution. The GUI terminology is muddied in Unityland.
     
  36. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    I was actually planning to create a 3D renderer, using the Unity sprite system. However, this was put "on hold" because of the lack of funding. There are too few people like yourself, understanding the true nature of GUI programming and API!

    Perhaps true, but I wanted it to be in the same category as other major GUI systems.
     
  37. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410