Exemple #1
0
        static void BuildActualGUIEntities <T>(T contextHolder, IEntityFactory generateEntityFactory)
        {
            //create the main GUI widget and relative entity
            var holder = SveltoGUIHelper.Create <DisplayNameDescriptorHolder>(
                new EGID(0, ExclusiveGroups.DisplayName), (contextHolder as UnityContext).transform,
                generateEntityFactory);

            //extract all the entities from its nested widgets
            var index = SveltoGUIHelper.CreateAll <ButtonEntityDescriptorHolder>(1,
                                                                                 ExclusiveGroups.DisplayName, holder.transform, generateEntityFactory);

            index = SveltoGUIHelper.CreateAll <LocalizedTextDescriptorHolder>(index,
                                                                              ExclusiveGroups.DisplayName, holder.transform, generateEntityFactory);

            index = SveltoGUIHelper.CreateAll <InputFieldDescriptorHolder>(index,
                                                                           ExclusiveGroups.DisplayName, holder.transform, generateEntityFactory);

            SveltoGUIHelper.CreateAll <DisplayNameFeedbackLabelDescriptorHolder>(index,
                                                                                 ExclusiveGroups.DisplayName, holder.transform, generateEntityFactory);
        }
Exemple #2
0
 /// <summary>
 /// An EntityDescriptorHolder is a special Svelto.ECS hybrid class dedicated to the unity platform. Once attached to a gameobject
 /// it automatically retrieves implementors from the hierarchy.
 ///     This pattern is usually useful for guis where complex hierarchy of gameobjects are necessary, but
 /// otherwise you should always create entities in factories. In the mini examples repository is possible
 ///     to find a more advanced GUI example
 /// The gui of this project is ultra simple and is all managed by one entity only. This way won't do
 /// for a complex GUI.
 /// Note that creating an entity to manage a complex gui like this, is OK only for such a simple scenario
 /// otherwise a widget-like design should be adopted.
 /// </summary>
 /// <param name="contextHolder"></param>
 void BuildGUIEntitiesFromScene(UnityContext contextHolder, IEntityFactory entityFactory)
 {
     SveltoGUIHelper.Create <HudEntityDescriptorHolder>(ECSGroups.HUD, contextHolder.transform, entityFactory
                                                        , true);
 }