Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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
    Look for the "hot control" thing, might help with UnityGUI (for focused component, not mouse-overed).
     
  2. dkozar

    dkozar

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

    you were completely right. This bug was happening with Dialog, but not with simple controls in ResizableDemo. The reason: ButtonGroup container have been stealing mouse clicks from dialog itself because the group had MouseEnabled=true (default value for a container) and resizing process had never started. Now I've changed it to false and it works great.



    This bug will be fixed in eDriven.Gui v1.6 which I'm planning to release very soon. :)

    Aditionally, I made additional improvements:

    As well as Draggable property, Dialog now has totally functional Resizable property (bool) which internally instantiates the resizable plugin.

    Also, Resizable now has the ShowOverlay property. With setting it to false the overlay rendering (drawing resizable handles) could be ommited (like Dialog internally does).

     
  3. UnityCoder

    UnityCoder

    Joined:
    Dec 8, 2011
    Posts:
    534
    @dkozar

    Just before 2 hours i dont know about eDriven. After reading about eDriven on this thread i must say that i missed a very useful thing, which i m looking for in unity3d.OK..No problem, "it's better late than never".

    I have few questions regarding you framework:

    Is there a tree component in your eDriven?. 9If its there its very useful for me)

    Is HTML support is there ? (e.g Webview component in .Net, For loading html pages inside Unity)

    How much limitation for android and Ipad?
     
  4. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Not at the moment, but is definitely doable because the system is built from the start in the way the majority of modern GUI systems are made. I made quite a research (years of research) before building this thing.

    No, the accent of this GUI system is on interactivity (with GUI and with Unity's 3-D world). I've seen some forum threads showcasing plugins that render HTML inside the 3-D world, but can't remember the exact location (also believe it's in beta).

    As I heard, Android is fine, but with iOS having some warnings lately.. so, wouldn't recommend yet (at least until I buy Mac to debug it, which I'm planning to do ASAP :))
     
  5. UnityCoder

    UnityCoder

    Joined:
    Dec 8, 2011
    Posts:
    534
    @dkozar

    Thanks for quick reply,

    Its a humble suggestion for you if you make webview like component for your framework i m sure its Rocks, huge advantge of your framework. Here on this community, so many people are searching here and there for html support in unity3d.

    One more question:

    Is all languages supported in your framework (including RTL Text)? What about superscript and subscript text?

    Can we change skin of all components?
     
    Last edited: Dec 19, 2012
  6. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Here, I've looked it up for you: http://forum.unity3d.com/threads/156665-Coherent-UI-HTML5-based-User-Interface-middleware ;)

    Additionally, this and this.

    HTML rendering is currently not under my radar.

    Note: with GUI systems, there's no one-fits-all solution. GUI systems are versatile and huge. Also, I have to fight my old habit of making things to complex and generic... because we could end up the way some 'overcomplicated' technologies did... :)

    PS. eDriven has the posibility of rendering animated textures (frames of animations, see animated cursors) and the option of finding a mouse click position on each component. So, if somebody comes up with the fast-enough texture redrawing... ;)
     
    Last edited: Dec 19, 2012
  7. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    Edited out, after talking in PM doesn't seem relevant anymore.
     
    Last edited: Dec 19, 2012
  8. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
  9. huodong

    huodong

    Joined:
    Aug 7, 2012
    Posts:
    4
    Dispaly <Box> container-object backgrpund can use this code:
    Code (csharp):
    1.     box.SetStype("showBackground", true);
    2.     box.StyleMapper = "bs";
    Now I use new version eDriven1.6 UIDesigner create UI Layout, how to dispaly <ContainerAdapter> -> container.background ?
     
    Last edited: Dec 24, 2012
  10. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Regarding you example: sure you could do it like this, but the point of using style mapper is not having hardcoded values in your code - such as style value itself the line before.

    So suggesting using the checkbox in style mapper for turning the background on/off :)

    With designer, there's only the style mapper option available, and works the same way. You got to have the mapper available somewhere in your scene, and you should specify its name.

    ps Please add GUI components to the scene while NOT in play mode (tweak their properties in play mode of course). This is because that part of the persistance thing isn't fully covered yet (tweaking components instantiated in play mode).

    Note: depending of the parent value type, only some component properties are actually being applied, for instance Constrain block properties (Left, Right, Top, Bottom) work only when parent having the Absolute layout.
     
  11. huodong

    huodong

    Joined:
    Aug 7, 2012
    Posts:
    4
    Code (csharp):
    1. // Pseudocode
    2. HBox{  HorizontalSpacing = 0  }
    3. .AddChild(btn1, btn2) //  it's ok,
    4.  
    5.  


    Code (csharp):
    1.  
    2. // Use desgener create that
    3. // Add code
    4. void Start() {
    5.     var ui = GetComponent<  ContainerAdapter  >();
    6.     ui.HorizontalSpacing = 0; // No effect ? what went wrong.?:mrgreen:
    7. }
    I want no gap between :D
     
    Last edited: Dec 28, 2012
  12. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    The thing is that ContainerAdapter in designer always instantiates Container (not HBox or VBox).

    HBox and VBox are extending Container giving it a default (horiz/vert box layout).

    You got to know what kind of layout is currently plugged into a container to cast to it:

    Code (csharp):
    1. var adapter = GetComponent<ContainerAdapter>(); // returns the adapter (script)
    2. var container = (Container)adapter.Component; // always referencing the instantiated component
    3. var layout = container.Layout; // referencing container layout
    4.  
    5. layout.HorizontalSpacing = 0;
    btw container by default have the descriptor layout, which in turn instantiates the "real" layout. Perhaps it's better to specify the real one by yourself:

    Code (csharp):
    1. container.Layout = new BoxLayout { HorizontalSpacing = 0 };
     
  13. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Also note that after instantiating container, you might choose between a default "Descriptor mode" ("Adapter mode" is a spelling error that I'm going to fix) and "Full mode".

    Descriptor mode is related to setting component.LayoutDescriptor from C#. It is intended to create some default layout (10px spacing etc.) just by specifying a single enum value.

    However, if you want full control over layout, than you need to use Full mode. There you have a bunch of settings for each kind of layout.

     
  14. dkozar

    dkozar

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

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Added 15 pages to eDriven manual (mostly on Display list and Component Lifecycle).

    Link

     
  16. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Added 15 pages to eDriven Programming Manual - currently 60 pages total.

    Link

     
  17. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    A useful resource for eDriven.Gui component developers!

    In this thread you can find a free Unity package containing open-source scripts for:

    Slider (Adapter + Editor)
    ExampleControl (Control + Adapter + Editor)
    ExampleControl2 (Control + Adapter + Editor)
    Login (Control + Adapter + Editor)

    :)
     
  18. dkozar

    dkozar

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

    Didn't quite understand what the problem is - is it the cleanup or it doesn't work for the 2nd time=

    From what I've seen here, there's no reason for Timer not to work.

    I don't know if timer is static variable, but even then the timer is being instantiated all over again in Start().

    Did you check if getting the "Timer Started!" message at all?

    Here are the Timer internals. You could also call timer.Dispose() it at the end of usage.

    Also, you do weird thing with brackets. Only the function reference is needed when un/subscribing, not the function execution:

    Code (csharp):
    1. void OnDestroy()
    2. {
    3.     timer.Tick -= TickIssued; // here you had some weird stuff. I removed the brackets.
    4.     timer.Stop(); // stop the timer
    5.     timer.Dispose(); // dispose?
    6.     ticksCount = 0; // your internal counter
    7. }
     
    Last edited: Jan 23, 2013
  19. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    More about the Timer class:

    Timers - when running - are being connected to SystemManager's update signal. This means they are being referenced by SystemManager's internal dictionary - and are not garbage collected even after the next Scene is loaded!

    You should always stop your timer before the scene change or it will keep ticking (or keep a (static) reference to it so you could stop it from the another scene). When the timer is stopped, it disconnects from SystemManager (so now it can be garbage collected).

    If the timer is playing and has subscribers from the last scene (TICK event handlers), they will also not get garbage collected since they are referenced by Timer's internal dictionary. :) So, you should also stop listening for timer events before the scene change. Luckily, timer.Dispose() does just that - it disconnects all the event handlers.
     
    Last edited: Jan 23, 2013
  20. Galahad

    Galahad

    Joined:
    Feb 13, 2012
    Posts:
    72
    Hi mr. Danko, thank you for your prompt response.

    What happens is just when the game is reseted the timer ticks do not issue. The prints do work but the timer only work the first time.
    I followed your advice but I'm unable to reference a method without using that brackets:
    Code (csharp):
    1. Assets/Scripts/TimeBasedEvents.cs(63,23): error CS0019: Operator `-=' cannot be applied to operands of type `eDriven.Core.Events.MulticastDelegate' and `method group'
    That's the error when I try to reference just with the method name.
    I guess that I would have to make a delegate of this method but I don't know how to handle delegates. =/
     
  21. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Code (csharp):
    1. timer.Tick += new EventHandler(TickIssued);
    Code (csharp):
    1. timer.Tick -= new EventHandler(TickIssued);
     
  22. Galahad

    Galahad

    Joined:
    Feb 13, 2012
    Posts:
    72
    Hi Mr. Danko, sadly it's not working =/

    Code (csharp):
    1. timer.Tick += new EventHandler(TickIssued);
    results in:
    Code (csharp):
    1. Assets/Scripts/TimeBasedEvents.cs(40,59): error CS0123: A method or delegate `TimeBasedEvents.TickIssued()' parameters do not match delegate `eDriven.Core.Events.EventHandler(eDriven.Core.Events.Event)' parameters
    And casting it does not work as it says that can't convert a void to Event type.
     
  23. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Oh, forgot to add:

    Code (csharp):
    1. timer.Tick += new EventHandler(TickHandler);
    Code (csharp):
    1. private void TickHandler(Event e) {  }
    I.e.:

    Code (csharp):
    1. private void TickHandler(eDriven.Core.Events.Event e) {  }
    That's the signature of ALL event handlers using eDriven's event system.
     
  24. Galahad

    Galahad

    Joined:
    Feb 13, 2012
    Posts:
    72
    This assign method workflow work like a charm, however the Timer ticks are not working =[ I'll try pausing the timer reseting it and playing it again.
     
  25. Galahad

    Galahad

    Joined:
    Feb 13, 2012
    Posts:
    72
    No luck. I'll give up and force the player to close the application after each play through.
     
  26. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Seems you have a problem somewhere in your code.

    I've thrown away everything that's not important, and it works great.

    Code (csharp):
    1. public class TimerTest : MonoBehaviour {
    2.  
    3.     private Timer _timer;
    4.    
    5.     void Start()
    6.     {
    7.         Debug.Log("Start");
    8.         _timer = new Timer(1); // tick each second
    9.         _timer.Tick += TickHandler; // subscribe
    10.         _timer.Start();
    11.     }
    12.  
    13.     void TickHandler(Event e)
    14.     {
    15.         Debug.Log("Tick!");
    16.     }
    17.  
    18.     void OnDestroy()
    19.     {
    20.         Debug.Log("OnDestroy");
    21.         _timer.Tick -= TickHandler; // unsubscribe
    22.         _timer.Stop(); // stop the timer
    23.         _timer.Dispose(); // dispose?
    24.     }
    25. }
    Just attach the script anywhere in the scene, and then load another level. I have 3 levels here and here's the output:

     

    Attached Files:

    YaVeTaL likes this.
  27. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Btw your starting problem (the problem with my TimerDemo1.cs) is that the attached listener is anonymous:

    Code (csharp):
    1. _timer = new Timer(1);
    2. _timer.Tick += delegate
    3.                    {
    4.                        Debug.Log("Timer tick");
    5.                    };
    6. _timer.Start();
    There's no way to unsubscribe from this timer since there's no reference to the method. So this debug call keeps ticking forever (if the timer not stopped) - even when another level loaded.

    Use the anonymous event handlers with caution: they are suitable for a single-scene apps and for demos. In any other case use method names like I did in the previous post, so you can unsubscribe when in need.
     
  28. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    One more thing: I see you've been changing the Delay "live", while the timer was running.

    The thing is that changing Delay resets the timer. Internally the Reset method is being called:

    Code (csharp):
    1. public void Reset()
    2. {
    3.     _time = 0;
    4.     _count = 0;
    5.     if (HasEventListener(RESET))
    6.         DispatchEvent(new Event(RESET));
    7. }
    Calling Reset doesn't stop the timer, but resets the time and count (like a stopwatch).
     
  29. DMerrell

    DMerrell

    Joined:
    Sep 17, 2012
    Posts:
    9
    Mapping Styles to VBox
    I am having trouble applying a style to a VBox. I want a background image in the VBox, and then add check boxes in a column down the box and see the background image under the text in the checkboxes.

    1) I setup a skin
    a. The style Box has all backgrounds assigned my image
    b. The Box Name = “box”

    2) I created a “Box Component Style Mapper”
    a. Id = “menuBox”
    b. default = off
    c. Assigned my skin to Overal Skin
    d. I tried Show Overlay both checked and unchecked
    e. To be safe I assigned ALL Style Names in the mapper to “box”

    3) In my code I create a VBox
    a. StyleMapper = “menuBox”
    b. PercentWidth = 100,
    c. VerticalSpacing = 0,
    d. Padding = 40 // I added a little padding so I can be sure I can see the “menuBox” style in action

    I just get a transparent VBox. This may be too difficult to help without a sample code. I can make a sample project but it will take me some time to pull out the code that does not apply but I will if you need.


    Thank You for your time.
     
  30. dkozar

    dkozar

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

    Yes, I agree this deserves to be explained more in depth. :)

    The thing is that a container style mapper has a switch for switching the background ON/OFF. It's the ShowBackground switch.

    By default, all containers have the background switched OFF. I made it default because of the statistics: most containers have to be transparent (since they are often used for grouping).

    If you want to show the background, you have to switch it ON. You could do it from code (using the SetStyle method) or using a style mapper.


    1. Setting it from code:

    Code (csharp):
    1. container.SetStyle("showBackground", true); // notice the lowercase (the word "show" starts with the lowercase "s")
    Notice that all style names begin with a lowercase.

    In the majority of demos in which I have the toolbar on top, this is being switched ON from code. So toolbars have the white background if not styled the other way (this is the hardcoded style for a container).



    You could override the background style from code:

    Code (csharp):
    1. container.SetStyle("backgroundStyle", _yourGUIStyle);
    I suggest you open the "Drag and drop" demo scene and code (DragDropDemo.cs) to see it yourself.

    In this demo there is a custom skin added to toolbar on top:

    Code (csharp):
    1. HBox hbox = new HBox { Padding = 10, VerticalAlign = VerticalAlign.Middle };
    2. hbox.SetStyle("showBackground", true);
    3. hbox.SetStyle("backgroundStyle", SearchContainerBackgroundStyle.Instance); // <-- referencing a GUIStyle
    4. AddChild(hbox);



    2. Setting it by using a style mapper

    For showing the background, you should find the Show Background checkbox in your style mapper and switch it ON.

    The important thing to note is that components are being drawn in layers. The order of component drawing is as follows:

    1. Component internal stuff
    2. Overlay
    3. Disabled overlay

    Overlay is a layer that - if used - covers the container and is being drawn before the Disabled overlay.
    Disabled overlay is the white-alpha overlay that covers the component when disabled.

    Here is how the component style mapper looks like:



    Container introduces a background, which is a layer that - when used - is being drawn before all the internals.

    This overlay could be used to add border, flare, glare and other visual stuff that will be drawn on top of the container.

    The order of container drawing is as follows:

    1. Background
    2. Component internal stuff
    3. Overlay
    4. Disabled overlay

    Here is how the container style mapper looks like:




    I hope things are a bit clearer now! :)
     
    Last edited: Feb 2, 2013
  31. Ascendion

    Ascendion

    Joined:
    May 13, 2011
    Posts:
    5
    I've got an immediate need for GUI with WYSIWYG layout, but I've got a real problem unloading $250 without knowing if you are going to include the designer in a future release or as a seperate product.. everything looks nice enough in the videos but I need the designer NOW !!! Whats it gonna take to get a beta copy of your Designer ?? (NGUI's idea of WYSIWYG editing is just too clunky for someone coming from a winforms/webforms environment)
     
  32. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    The designer will be included in all the future releases, in fact it already is (its beta version is included into the package). Some people are already using it. If you are looking to use it too, follow these guidelines:

    • Add your components while not in Play mode. That's because the case of persisting (changed properties) of new created components isn't solved yet (with v1.6).
    • Once the component is added, it's safe to tweak it while in play mode (change the properties, layout, child ordering etc.) since these would then be persisted when Play mode stopped.

    Cheers!
     
  33. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    One of the users found a bug that happens when creating a new GUI from scratch (that is having the "blank" stage, without any of the GUI prerequisites).

    There are prerequisites that must be present in the scene to make eDriven.Gui working. The application crashes when some of them are not present. The first one is mandatory, others are optional.

    eDriven.Gui Prerequisites:

    Mandatory:

    1. Font style mapper (a default one). Since eDriven.Gui is all about measuring and auto-layout, the default font has to be set to enable measurement (since using Unitys' low-level CalcSize for texture measurements). Now, even if no components having text are present on screen, the default font is needed simply because there is a Unity bug that requires supplying the font to the measured style even if not using any text. :)

    Optional:

    1. If using sounds (playing audio using audio mappers) the referenced mapper has to be present on screen. Some demos are playing audio on window popup, so removing audio mappers produces errors.

    2. Style mappers: without these everything should work just fine (but with a default, hardcoded skins). But, if you'd like to spice-up your GUI, use these to map GUISkins from your disk to components.

    Also note:

    • Default font mapper must be present in the 1st scene of the application
    • All the other mappers must be present in the scene within they are being referenced
    • The position in the hierarchy tree doesn't meter
    • Mappers don't need to be attached to GUI components
    • I suggest creating a blank GameObject named GUI or so and attach your mappers to it (for organizational purposes)
    • A single exception are audio mappers used by GUI: they should most probably be attached to a camera, to get the stereo sound from the camera itself

    However, the best approach to starting with eDriven.Gui is picking up a demo to start with and build from there (by adding and removing stuff).
     
    Last edited: Feb 3, 2013
  34. DMerrell

    DMerrell

    Joined:
    Sep 17, 2012
    Posts:
    9
    Thank you for that great explaination, it greatly helped me.
     
  35. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    eDriven.Gui 1.7 is now available in the Asset Store.

    Please download the latest version:

    • Designer moved from Beta to RC (Release Candidate)
    • Multiple bug and stability fixes (no designer crashes anymore)
    • Wizard for creating a new GUI from scratch (mapping font/audio prerequisites)
    • Slider and NumericStepper fixes
    • Added additional persistence scenarios (for editing in Play mode)
    • Added components from the Extension Pack 1 (code included)
    • Manual included
    • Additional demos
    Danko :)
     
  36. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    eDriven.Gui is in the 24 hour sale (February 27-28)!!!

    The package is now officially in the 24 hour sale for February 27-28, from 8am GMT to 8am GMT (or midnight PST-midnight PST).

    Please Retweet! :)

    Asset Store link
     
  37. dkozar

    dkozar

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

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    eDriven.Gui 1.8 is now available in the Asset Store.

    Please download the latest version:

    • Designer in RC state (Release Candidate)
    • Bug fixes
    • Internal persistence code completely changed
    • Added additional persistence scenarios:
      - adding new control parented to new control (recursively)
      - moving multiple controls between different levels int the hierarchy view (multiple selection)
      - removing multiple controls (deleting from the hierarchy view)

    You might wanna try before you buy.

    Danko :)
     
  39. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    24H deals just started!

    Don't forget to purchase eDriven.Gui during the next 24 hours because it's 50% off - only $125!!! :)

     
  40. Hays

    Hays

    Joined:
    Mar 5, 2013
    Posts:
    19
    hi Zagreb, i had a problem with dragdrop demo.

    this is my code,and i want use my way to show item move.

    Label label = comp as Label;

    eDriven.Gui.Components.Image img = new eDriven.Gui.Components.Image();
    img.Texture = label.Texture;
    img.Move(comp.Position);

    //img.AddEventListener();

    DragDropManager.DoDrag(comp, dataSource, (MouseEvent)e, img, -15, -15, 0.5f, false);

    when i use "img" to replace null,that had a problem.see pic bellow: $未命名.jpg

    the icon was so far from cusor!!! how can i use it?? forgive my pool english!hope you know my mean!
     
  41. Hays

    Hays

    Joined:
    Mar 5, 2013
    Posts:
    19
  42. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    No problem, I understand your question perfectly well. :)

    What you describe here is a custom drag proxy. You actually do not need to move it manually, as you already noticed, this needs to be supplied to DoDrag method and the manager should use it instead of the blank square and move it automatically.

    Something like this:

    Code (csharp):
    1. using Image=eDriven.Gui.Components.Image;
    Code (csharp):
    1. Image proxy = new Image();
    2. proxy.Texture = Resources.Load("your_texture_path");
    3.  
    4. DragDropManager.DoDrag(comp, dataSource, (MouseEvent)e, proxy, -15, -15, 0.5f, false);
    This should work by itself, however I'll check it tonight because I didn't do much testing with custom drag proxies.
     
    Last edited: Mar 6, 2013
  43. Hays

    Hays

    Joined:
    Mar 5, 2013
    Posts:
    19
    hi dkozar ,I used the way you taught me, but the result is still the same。when i drag the item in my bag,and the icons which i draged was so far away from my cusor. $2222222222222222222222222222.jpg
     
  44. Hays

    Hays

    Joined:
    Mar 5, 2013
    Posts:
    19
    this is my code, i think the code is right.but the result was wrong~~~

    Image proxy = new Image();
    proxy.Texture = (Texture)Resources.Load("Icons/Knife");
    DragDropManager.DoDrag(comp, dataSource, (MouseEvent)e, proxy, -15, -15, 0.5f, false);
     
  45. dkozar

    dkozar

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

    What you've found is a glitch in DragDropManager. Thank you for that! :)

    Seems I didn't use the same pipeline (very bad practice!) with a standard drag proxy (alpha-rectangle) and the custom one, so for a custom one there were 2 lines of code missing.

    They will be implemented in the next free and commercial versions. However, you can handle this issue by applying these 2 lines to your proxy just after you create it:

    Code (csharp):
    1. Image proxy = new Image
    2. {
    3.     Texture = (Texture) Resources.Load("drag_image"),
    4.     // TEMP: handles the DragDropManager missing bounds clonning:
    5.     Bounds = (Rectangle) comp.GlobalBounds.Clone(),
    6.     // TEMP: handles the DragDropManager missing proxy  MouseEnabled turning off:
    7.     MouseEnabled = false
    8. };
    9. DragDropManager.DoDrag(comp, dataSource, (MouseEvent)e, proxy, 0, 0, 0.5f, false);
    Cheers!


     
  46. huodong

    huodong

    Joined:
    Aug 7, 2012
    Posts:
    4
    On designer click MultView Unity will crash. why.:neutral:

    Code (csharp):
    1.  
    2. // Controller
    3.  
    4. class MultViewController : VBox
    5. {
    6.  
    7.     readonly ViewStack _view = new ViewStack
    8.     {
    9.         ScrollContent = false,
    10.         AutoLayout = true,
    11.         MinHeight = 100,
    12.         MaxHeight = 100,
    13.     };
    14. //-------------------------------------------------------------------------
    15.     public MultViewController()
    16.     {
    17.         SelectedIndex = 0;
    18.     }
    19.  
    20.     public int SelectedIndex { get; set; }
    21. //-------------------------------------------------------------------------
    22.     public override void Initialize()
    23.     {
    24.         base.Initialize();
    25.         LayoutDescriptor = LayoutDescriptor.Vertical;
    26.         ScrollContent = false;
    27.         SetStyle("showBackground", true);
    28.     }
    29.  
    30.     protected override void CreateChildren()
    31.     {
    32.         base.CreateChildren();
    33.         _view.SelectedIndex = SelectedIndex;
    34.         base.AddChild(_view);
    35.     }
    36.  
    37.  
    38.     public override DisplayListMember AddChild(DisplayListMember child)
    39.     {
    40.         return _view.AddChild(child);
    41.     }
    42.  
    43.     public override DisplayListMember AddChildAt(int index, DisplayListMember child)
    44.     {
    45.         return _view.AddChildAt(index, child);
    46.     }
    47. }
    48. // Adapter
    49. [Toolbox(Label = "MultView", Group = "VecGUI")]
    50. class MultViewAdapter : ContainerAdapter
    51. {
    52.  
    53.      [Saveable] public int SelectedIndex = 0;
    54.  
    55.     public MultViewAdapter()
    56.     {
    57.     }
    58.  
    59.     public override Component NewInstance()
    60.     {
    61.         return new MultViewController();
    62.     }
    63.  
    64.     public override Type ComponentType
    65.     {
    66.         get { return typeof(MultViewController); }
    67.     }
    68.  
    69.  
    70.     public override void Apply(Component component)
    71.     {
    72.         base.Apply(component);
    73.         var view = (MultViewController) component;
    74.         view.SelectedIndex = SelectedIndex;
    75.     }
    76. }
    77.  
    78.  
    79. // Even so
    80. [Toolbox(Label = "AAAAWhy")]
    81. public class MultViewAdapter : ContainerAdapter
    82. {
    83.   public override Component NewInstance()
    84.   {
    85.     return (Component) new TabNavigator();
    86.   }
    87.  
    88.   public override void Apply(Component component)
    89.   {
    90.     base.Apply(component);
    91.   }
    92. }
    93.  
    94.  
    95.  
    96.  
     
    Last edited: Mar 11, 2013
  47. tomshreds

    tomshreds

    Joined:
    Feb 25, 2013
    Posts:
    32
    Hi,

    I was wondering, some months ago you told us that a "Datagrid" component was in the works after having the editor ready and stable. Is it coming soon?

    Thanks a lot :)
     
  48. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Hi! That's most probably because your adapter needs to extend ComponentAdapter, not a ContainerAdapter.

    ContainerAdapter must be used only for components having the 'direct' children.

    What do you need to accomplish, perhaps I can help?
     
  49. dkozar

    dkozar

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

    Yes, DataGrid will be, but made the mobile/touch support a priority. Just received the iOS gadget, must see what the problems are and how to handle them... :)
     
  50. tomshreds

    tomshreds

    Joined:
    Feb 25, 2013
    Posts:
    32
    Thanks for the response.

    I think I'm having a bug: When I set a dialog to resizable, if I drag it away from its initial position (top-left) then resizes it, it will move back to its origin right when I'll start dragging the edge. (I can make a video if you want).

    Finally I had some technical questions:

    1: Any event for when a dialog is opened? I did not find any. Ah and I also sent a review for your asset, hope you like it :D Also how can I get the component to play with it? Is this supposed to work:

    Dialog dialog = GameObject.Find("EmployeesDiablog").GetComponent<Dialog>();

    2: I'd like to put all events of my stage/dialog in the same file. Do I need to add that file to every component for the events window to show me the methods from the script? Because I added my script as a component on the stage and I can bind events on the stage but not on its children. Any suggestions about this? Thanks!

    3: Can I make a prefab to contain all my GUI stuff and re-use it in other scenes for example?

    Thanks for the great support, using your GUI tools reminds me of how simple it is to work with Windows Forms/.NET. I will go write a review right now.
     
    Last edited: Mar 12, 2013