Exemplo n.º 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            ChunkSystem.texture = Content.Load <Texture2D>("Dirt_1");
            // Create a new SpriteBatch, which can be used to draw textures
            spriteBatch = new SpriteBatch(GraphicsDevice);
            entityController.CreateEntity(new CameraC());
            Body b = BodyFactory.CreateRectangle(entityController.physicsWorld, ConvertUnits.ToSimUnits((Grid.gridPixelSize)), ConvertUnits.ToSimUnits((Grid.gridPixelSize)), 20f, new Vector2(0, 0), 0, BodyType.Dynamic);

            b.Friction    = 0.1f;
            b.Restitution = 0f;

            entityController.CreateEntity(new PositionC(0, 200, b), new ControllableC(), new TextureC(GraphicsDevice, new Vector2(Grid.gridPixelSize, Grid.gridPixelSize), Color.Black), new VelocityC(), new ForgroundC());

            //entityController.CreateEntity(new PositionC(50, 50, BodyFactory.CreateBody(entityController.physicsWorld, new Vector2(0, 0), 0, BodyType.Static)), new TextureC(GraphicsDevice, new Vector2(50, 50), Color.Black));
            // entityController.CreateEntity(new PositionC(new Vector2(0, 300)), new TextureC(GraphicsDevice, new Vector2(300, 100),Color.Green),new ColliderC(new Rectangle(0,300,300,100)));
            //entityController.CreateEntity(new PositionC(new Vector2(300, 200)), new TextureC(GraphicsDevice, new Vector2(100, 300), Color.Green), new ColliderC(new Rectangle(300, 200, 100, 300)));



            entityController.CreateEntity(new PositionC(0, 60), new TextureC(Content.Load <Texture2D>("Background_Mountain_1"), 3), new BackGroundC(-.9f));
            entityController.CreateEntity(new PositionC(0, 20), new TextureC(Content.Load <Texture2D>("Background_trees_3"), 3), new BackGroundC(-.8f));
            entityController.CreateEntity(new PositionC(0, 35), new TextureC(Content.Load <Texture2D>("Background_trees_2"), 3), new BackGroundC(-.7f));
            entityController.CreateEntity(new PositionC(0, 50), new TextureC(Content.Load <Texture2D>("Background_trees_1"), 3), new BackGroundC(-.6f));

            TextHelper.CreateFont(Content.Load <Texture2D>("Font_1"), "default", GraphicsDevice);

            UIBuilder.Begin(entityController);
            UIBuilder.AttachTexture(Content.Load <Texture2D>("Background_Mountain_1"), 0, 0, 1, 1);
            mainMenu = UIBuilder.Complete();
            // TODO: use this.Content to load your game content here
        }
Exemplo n.º 2
0
        private void InternalHideEntity(EntityInfo entityInfo, object userData)
        {
            IEntity entity = entityInfo.Entity;

            IEntity[] childEntities = entityInfo.GetChildEntities();
            foreach (IEntity childEntity in childEntities)
            {
                HideEntity(childEntity.Id, userData);
            }

            DetachEntity(entity.Id, userData);
            entityInfo.Status = EntityStatus.WillHide;
            entity.OnHide(userData);
            entityInfo.Status = EntityStatus.Hidden;

            EntityGroup entityGroup = (EntityGroup)entity.EntityGroup;

            if (entityGroup == null)
            {
                throw new System.Exception("Entity group is invalid.");
            }

            entityGroup.RemoveEntity(entity);
            if (!m_EntityInfos.Remove(entity.Id))
            {
                throw new System.Exception("Entity info is unmanaged.");
            }

            if (m_HideEntityCompleteEventHandler != null)
            {
                m_HideEntityCompleteEventHandler(this, new HideEntityCompleteEventArgs(entity.Id, entity.EntityAssetName, entityGroup, userData));
            }

            m_RecycleQueue.AddLast(entityInfo);
        }
Exemplo n.º 3
0
        internal void Update()
        {
            Group = Entity.Group;
            var previousModel = Model;

            Model = ModelComponent.Model;
            if (previousModel != Model)
            {
                // When changing the model, we need to regenerate the render meshes
                foreach (var renderMeshes in RenderMeshesList)
                {
                    if (renderMeshes != null)
                    {
                        // TODO: Should we dispose something here?
                        renderMeshes.Clear();
                        renderMeshes.TransformUpdated = false;
                    }
                }
            }
            else
            {
                // When changing the model, we need to regenerate the render meshes
                foreach (var renderMeshes in RenderMeshesList)
                {
                    if (renderMeshes != null)
                    {
                        renderMeshes.TransformUpdated = false;
                    }
                }
            }
        }
Exemplo n.º 4
0
        public IActionResult Create([FromBody] EntityGroup group)
        {
            this.Context.Groups.Add(group);
            this.Context.SaveChanges();

            return(this.Ok(group));
        }
Exemplo n.º 5
0
        private void InternalHideEntity(EntityInfo entityInfo, object userData)
        {
            IEntity entity = entityInfo.Entity;

            IEntity[] childEntities = entityInfo.GetChildEntities();
            foreach (IEntity childEntity in childEntities)
            {
                HideEntity(childEntity.Id, userData);
            }

            DetachEntity(entity.Id, userData);
            entityInfo.Status = EntityStatus.WillHide;
            entity.OnHide(userData);
            entityInfo.Status = EnityStatus.Hidden;

            EntityGroup entityGroup = (EntityGroup)entity.EntityGroup;

            entityGroup.RemoveEntity(entity);
            if (!m_EntityInfos.Remove(entity.Id))
            {
                throw;
            }

            m_HideEntityCompleteEventHandler();

            m_RecycleQueue.AddLast(entityInfo);
        }
 public ShowEntityInfo()
 {
     m_SerialId    = 0;
     m_EntityId    = 0;
     m_EntityGroup = null;
     m_UserData    = null;
 }
        public OperationResult CreateEntityGroup(AdvEntityGroupEditModel editModel)
        {
            try
            {
                var core = _coreHelper.GetCore();

                var groupCreate = core.EntityGroupCreate("EntitySearch", editModel.Name);

                if (editModel.AdvEntityItemModels.Any())
                {
                    EntityGroup entityGroup = core.EntityGroupRead(groupCreate.EntityGroupMUId);

                    var nextItemUid = entityGroup.EntityGroupItemLst.Count;

                    foreach (var entityItem in editModel.AdvEntityItemModels)
                    {
                        entityGroup.EntityGroupItemLst.Add(new EntityItem(entityItem.Name,
                                                                          entityItem.Description, nextItemUid.ToString(), "created"));
                        nextItemUid++;
                    }

                    core.EntityGroupUpdate(entityGroup);
                }



                return(new OperationResult(true, $"{groupCreate.EntityGroupMUId} created successfully"));
            }
            catch (Exception exception)
            {
                return(new OperationResult(false, "Searchable list creation failed"));
            }
        }
 public OperationResult CreateEntityGroup(AdvEntitySelectableGroupEditModel editModel)
 {
     try
     {
         eFormCore.Core core        = _coreHelper.GetCore();
         EntityGroup    groupCreate = core.EntityGroupCreate(Constants.FieldTypes.EntitySelect, editModel.Name);
         if (editModel.AdvEntitySelectableItemModels.Any())
         {
             var entityGroup = core.EntityGroupRead(groupCreate.MicrotingUUID);
             var nextItemUid = entityGroup.EntityGroupItemLst.Count;
             foreach (var entityItem in editModel.AdvEntitySelectableItemModels)
             {
                 core.EntitySelectItemCreate(entityGroup.Id, entityItem.Name, entityItem.DisplayIndex, nextItemUid.ToString());
                 //entityGroup.EntityGroupItemLst.Add(new EntityItem(entityItem.Name,
                 //    entityItem.Description, nextItemUid.ToString(), Constants.WorkflowStates.Created));
                 nextItemUid++;
             }
             //core.EntityGroupUpdate(entityGroup);
         }
         return(new OperationResult(true, LocaleHelper.GetString("ParamCreatedSuccessfully", groupCreate.MicrotingUUID)));
     }
     catch (Exception)
     {
         return(new OperationResult(false, LocaleHelper.GetString("SelectableListCreationFailed")));
     }
 }
Exemplo n.º 9
0
        //------------------------------ Entity Dashboard Query ------------------------------//
        public static IQueryable <EntityGroup> GetEntityDashboard()
        {
            var careers = db.Careers.Include(e => e.Employee.EmployeeStatus.Select(c => c.EmployeeStatus))
                          .Where(e =>
                                 //Select all active employees
                                 (e.Employee.EmployeeStatus.GroupBy(x => x.EmployeeID)
                                  .Select(y => y.OrderByDescending(i => i.EffectiveDate)
                                          .FirstOrDefault()).Select(c => c.EmployeeStatus.Name).FirstOrDefault() == "Active") ||
                                 //OR all contract employees
                                 (e.Employee.EmployeeStatus.GroupBy(x => x.EmployeeID)
                                  .Select(y => y.OrderByDescending(i => i.EffectiveDate)
                                          .FirstOrDefault()).Select(c => c.EmployeeStatus.Name).FirstOrDefault() == "Contractor"))
                          // AND Select most recent career records
                          .Include(x => x.Employee)
                          .GroupBy(x => x.EmployeeID)
                          .Select(y => y.OrderByDescending(i => i.EffectiveDate)
                                  .FirstOrDefault());

            IQueryable <EntityGroup> data = from employee in careers
                                            group employee by new { employee.BudgetArea.Abbreviation, employee.Department.Name } into EntityGroup
                                     select new EntityGroup()
            {
                BudgetArea = EntityGroup.Key.Abbreviation,
                Department = EntityGroup.Key.Name,
                BAreaCount = EntityGroup.Count(),
                DeptCount  = EntityGroup.Count(),
                Employees  = careers.Where(e => e.Department.Name.Equals(EntityGroup.Key.Name)).Select(e => e.Employee).ToList()
            };



            return(data);
        }
 internal RankingMatchmakerQueueTask(RankingMatchmaker <T> matchmaker, EntityGroup <T> entities, EventHandler <MatchmakingStateChangedEventArgs <T> > callback)
 {
     this.matchmaker       = matchmaker;
     this.Entities         = entities;
     this.Callback         = callback;
     this.MatchmakingState = MatchmakingState.Pending;
 }
        public OperationDataResult <List <CommonDictionaryTextModel> > GetEntityGroupDictionary(string entityGroupUid)
        {
            try
            {
                eFormCore.Core core = _coreHelper.GetCore();

                EntityGroup entityGroup = core.EntityGroupRead(entityGroupUid);

                List <CommonDictionaryTextModel> mappedEntityGroupDict = new List <CommonDictionaryTextModel>();

                foreach (EntityItem entityGroupItem in entityGroup.EntityGroupItemLst)
                {
                    mappedEntityGroupDict.Add(new CommonDictionaryTextModel()
                    {
                        Id   = entityGroupItem.Id.ToString(),
                        Text = entityGroupItem.Name
                    });
                }

                return(new OperationDataResult <List <CommonDictionaryTextModel> >(true, mappedEntityGroupDict));
            }
            catch (Exception)
            {
                return(new OperationDataResult <List <CommonDictionaryTextModel> >(false,
                                                                                   LocaleHelper.GetString("ErrorWhileObtainSelectableList")));
            }
        }
Exemplo n.º 12
0
        private void LoadEntitySuccessCallback(string entityAssetName, object entityAsset, float duration, object userData)
        {
            ShowEntityInfo showEntityInfo = (ShowEntityInfo)userData;

            if (showEntityInfo == null)
            {
                throw new GameFrameworkException("Show entity info is invalid.");
            }

            m_EntitiesBeingLoaded.Remove(showEntityInfo.EntityId);
            if (m_EntitiesToReleaseOnLoad.Contains(showEntityInfo.EntityId))
            {
                Log.Debug("Release entity '{0}' on loading success.", showEntityInfo.EntityId.ToString());
                m_EntitiesToReleaseOnLoad.Remove(showEntityInfo.EntityId);
                m_EntityHelper.ReleaseEntity(entityAsset, null);
                return;
            }

            EntityGroup entityGroup = (EntityGroup)GetEntityGroup(showEntityInfo.EntityGroupName);

            if (entityGroup == null)
            {
                throw new GameFrameworkException(string.Format("Entity group '{0}' is not exist.", showEntityInfo.EntityGroupName));
            }

            EntityInstanceObject entityInstanceObject = new EntityInstanceObject(entityAssetName, entityAsset, m_EntityHelper.InstantiateEntity(entityAsset), m_EntityHelper);

            entityGroup.RegisterEntityInstanceObject(entityInstanceObject, true);

            InternalShowEntity(showEntityInfo.EntityId, entityAssetName, showEntityInfo.EntityGroupName, entityInstanceObject.Target, true, duration, showEntityInfo.UserData);
        }
Exemplo n.º 13
0
        public void Link_LinksCorrectly()
        {
            //Arrange
            var entity   = new Entity("valid");
            var entities = new Entities()
            {
                entity
            };
            var entityGroup = new EntityGroup("group");

            entityGroup.AddEntity(new Entity("invalid"), "0");
            entityGroup.AddEntity(entity, "1");
            var entityGroups = new EntityGroups()
            {
                entityGroup
            };
            var linker = new EntityGroupsLinker(entityGroups);

            //Act
            entityGroups = linker.Link(entities);

            //Assert
            Assert.AreEqual(1, entityGroups.Single().EntitySubscriptions.Where(s => s.Entity.Name == "valid").Count());
            Assert.AreEqual(0, entityGroups.Single().EntitySubscriptions.Where(s => s.Entity.Name == "invalid").Count());
        }
        public OperationDataResult <EntityGroup> GetEntityGroupExternally(string entityGroupUid, string token, string callerURL)
        {
            // Do some validation of the token. For now token is not valid
            //bool tokenIsValid = false;
            ExchangeIdToken         idToken = new ExchangeIdToken(token);
            IdTokenValidationResult result  = idToken.Validate(callerURL);

            if (result.IsValid)
            {
                try
                {
                    eFormCore.Core core = _coreHelper.GetCore();

                    EntityGroup entityGroup = core.EntityGroupRead(entityGroupUid);

                    return(new OperationDataResult <EntityGroup>(true, entityGroup));
                }
                catch (Exception)
                {
                    return(new OperationDataResult <EntityGroup>(false,
                                                                 LocaleHelper.GetString("ErrorWhileObtainSelectableList")));
                }
            }
            else
            {
                return(new OperationDataResult <EntityGroup>(false,
                                                             LocaleHelper.GetString("ErrorWhileObtainSelectableList")));
            }
        }
Exemplo n.º 15
0
 public ShowEntityInfo(int serialId, int entityId, EntityGroup entityGroup, object userData)
 {
     m_SerialId    = serialId;
     m_EntityId    = entityId;
     m_EntityGroup = entityGroup;
     m_UserData    = userData;
 }
Exemplo n.º 16
0
 public virtual Entities Join(EntityGroup g, string pname, string lname = null)
 {
     object key = ObjectKey;
     if (!string.IsNullOrEmpty(lname))
     {
         PropertyInfo l = GetType().GetProperty(lname);
         if (l != null)
         {
             key = l.GetValue(this);
         }
     }
     if (g == null || string.IsNullOrEmpty(pname) || key == null)
     {
         return null;
     }
     object k = key;
     //if (g.HasHash(pname))
     //{
     //    Hashtable h = g.GetHashtable(pname);
     //    if (h.ContainsKey(k))
     //    {
     //        object entity = h[k];
     //        rlt.Add(entity as Entity);
     //    }
     //}
     //else
     //{
         Entities rlt = JoinInternal(g, pname, k);
     //}
     return rlt;
 }
Exemplo n.º 17
0
 private void RemoveEntityGroup(EntityGroup g)
 {
     if (EconomyTest.Instance != null)
     {
         EconomyTest.Instance.RemoveEntityGroup(g);
     }
 }
Exemplo n.º 18
0
    private bool SearchForTarget()
    {
        Debug.BeginDeepProfile("TargetSearch");
        NearGroups.Clear();
        WorldEventManager.Instance.GetEntityGroupsNearPoint(CurrentChunk, 8, NearGroups);
        EntityGroup targetDecide = null;

        foreach (EntityGroup g in NearGroups)
        {
            if (g.Type == GroupType.SoldierPatrol)
            {
                targetDecide  = g;
                RunFromTarget = true;
                break;
            }
            if (g.Type == GroupType.BanditPatrol)
            {
            }
            else
            {
                //Any trader group
                targetDecide = g;
            }
        }
        Debug.EndDeepProfile("TargetSearch");

        TargetGroup = targetDecide;
        if (targetDecide != null)
        {
            return(true);
        }


        return(false);
    }
Exemplo n.º 19
0
        /// <summary>
        /// 实体管理器轮询。
        /// </summary>
        /// <param name="elapseSeconds">逻辑流逝时间,以秒为单位。</param>
        /// <param name="realElapseSeconds">真实流逝时间,以秒为单位。</param>
        internal override void Update(float elapseSeconds, float realElapseSeconds)
        {
            while (m_RecycleQueue.Count > 0)
            {
                RecycleNode recycleNode = m_RecycleQueue.First.Value;
                recycleNode.TickCount++;
                if (recycleNode.TickCount <= 1)
                {
                    break;
                }

                m_RecycleQueue.RemoveFirst();
                EntityInfo  entityInfo  = recycleNode.EntityInfo;
                IEntity     entity      = entityInfo.Entity;
                EntityGroup entityGroup = (EntityGroup)entity.EntityGroup;
                if (entityGroup == null)
                {
                    throw new GameFrameworkException("Entity group is invalid.");
                }

                entityInfo.Status = EntityStatus.WillRecycle;
                entity.OnRecycle();
                entityInfo.Status = EntityStatus.Recycled;
                entityGroup.UnspawnEntity(entity);
            }

            foreach (KeyValuePair <string, EntityGroup> entityGroup in (Dictionary <string, EntityGroup>)m_EntityGroups)
            {
                entityGroup.Value.Update(elapseSeconds, realElapseSeconds);
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// Recursively enumerate entities in the registry tree
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="excludeEntities"></param>
        /// <param name="excludeUserJobs"></param>
        /// <returns></returns>
        /// <remarks>
        /// The function enumerates nodes of a subtree of the registry,
        /// returning parent items first, then immediate children in their
        /// appropriate order by the field 'Number'.
        /// Certain entities are excluded but their children are still
        /// included in the search!
        /// </remarks>
        private IEnumerable <Entity> EnumerateChildrenForSerialize(Entity entity, EntityGroup entityGroupMask, bool excludeUserJobs)
        {
            /*
             * // Make sure it's not a simple user job
             * // TODO: exclude user jobs is an ad-hoc solution
             * // maybe filtering on name prefixes?
             * if (excludeUserJobs &&
             *  entity.EntityType == EntityType.JobInstance &&
             *  (((JobInstance)entity).ScheduleType != ScheduleType.Recurring ||
             *   ((JobInstance)entity).JobExecutionStatus != JobExecutionState.Scheduled))
             * {
             *  yield break;
             * }
             */

            // See if this particular type of entity is included by the mask
            if ((entity.EntityGroup & entityGroupMask) != 0)
            {
                yield return(entity);
            }

            // Even if it's excluded, return children.
            // Some exports (layout) might require exporting certain security
            // objects (user-mydb mapping)
            entity.LoadAllChildren(true);
            foreach (Entity e in entity.EnumerateAllChildren().OrderBy(ei => ei.Number))
            {
                foreach (Entity ee in EnumerateChildrenForSerialize(e, entityGroupMask, excludeUserJobs))
                {
                    yield return(ee);
                }
            }
        }
 public void Clear()
 {
     m_SerialId    = 0;
     m_EntityId    = 0;
     m_EntityGroup = null;
     m_UserData    = null;
 }
Exemplo n.º 22
0
        public DtoActionResult UpdateGroup(EntityGroup group)
        {
            var u = GetGroup(group.Id);

            if (u == null)
            {
                return new DtoActionResult {
                           ErrorMessage = "Group Not Found", Id = 0
                }
            }
            ;
            var validationResult = ValidateGroup(group, false);
            var actionResult     = new DtoActionResult();

            if (validationResult.Success)
            {
                _uow.GroupRepository.Update(group, group.Id);

                _uow.Save();
                actionResult.Success = true;
                actionResult.Id      = group.Id;
            }
            else
            {
                actionResult.ErrorMessage = validationResult.ErrorMessage;
            }

            return(actionResult);
        }
Exemplo n.º 23
0
        public DtoActionResult Put(int id, EntityGroup group)
        {
            group.Id = id;
            var result = _groupServices.UpdateGroup(group);

            if (result == null)
            {
                return new DtoActionResult()
                       {
                           ErrorMessage = "Result Was Null"
                       }
            }
            ;
            if (result.Success)
            {
                var auditLog = new EntityAuditLog();

                auditLog.ObjectType = "Group";
                auditLog.ObjectId   = result.Id;
                auditLog.ObjectName = group.Name;
                auditLog.ObjectJson = JsonConvert.SerializeObject(group);
                auditLog.UserId     = _userId;
                auditLog.AuditType  = EnumAuditEntry.AuditType.Update;
                _auditLogService.AddAuditLog(auditLog);
            }
            return(result);
        }
Exemplo n.º 24
0
    public void RemoveEntityGroup(EntityGroup g)
    {
        GameObject obj = Caravans[g];

        Caravans.Remove(g);
        Destroy(obj.gameObject);
    }
Exemplo n.º 25
0
    public static Entity GetEntity(EntityGroup type, int id)
    {
        Entity entity = null;

        entitys[type].TryGetValue(id, out entity);

        return(entity);
    }
Exemplo n.º 26
0
 public Unicast(int computerId, string direction, int userId, int groupId)
 {
     _direction = direction;
     _computer  = new ServiceComputer().GetComputer(computerId);
     _group     = new ServiceGroup().GetGroup(groupId);
     _userId    = userId;
     _uow       = new UnitOfWork();
 }
Exemplo n.º 27
0
 private void InitializeMembers()
 {
     this.parentEntity = null;
     this.childrenType = EntityType.Unknown;
     this.entityGroup  = Registry.EntityGroup.Unknown;
     this.text         = null;
     this.columns      = new DataControlFieldCollection();
 }
Exemplo n.º 28
0
 public void AddEntityGroup(EntityGroup group)
 {
     if (EntityGroups == null)
     {
         EntityGroups = new List <EntityGroup>();
     }
     EntityGroups.Add(group);
 }
Exemplo n.º 29
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     RequiresAuthorization(AuthorizationStrings.GroupRead);
     GroupEntity = !string.IsNullOrEmpty(Request.QueryString["groupId"])
        ? Call.GroupApi.Get(Convert.ToInt32(Request.QueryString["groupId"]))
        : null;
 }
Exemplo n.º 30
0
        public async Task <string> Save(JObject data)
        {
            dynamic groupDto     = data;
            int     groupId      = groupDto.GroupId;
            int     entityTypeId = groupDto.EntityTypeId;
            string  groupName    = groupDto.Name;

            if (!AuthorizeManager.AuthorizeActionOnEntityId(groupId, (int)EntityIdentity.Group,
                                                            (int)ActionKey.EditGroup))
            {
                throw new KhodkarInvalidException(LanguageManager.ToAsErrorMessage(ExceptionKey.InvalidAccessToEditGroup, groupName));
            }

            JArray sremovedListArray = groupDto.RemovedList;
            var    removedList       = sremovedListArray.ToObject <List <int> >();
            JArray addedListArray    = groupDto.AddedList;
            var    addedList         = addedListArray.ToObject <List <int> >();

            foreach (var item in addedList)
            {
                if (entityTypeId == 101)
                {
                    var group = new EntityGroup()
                    {
                        GroupId      = groupId,
                        EntityTypeId = entityTypeId,
                        LinkId       = item
                    };
                    _contentManagementContext.EntityGroups.Add(group);
                }
                else
                {
                    var group = new EntityGroup()
                    {
                        GroupId              = groupId,
                        EntityTypeId         = entityTypeId,
                        MasterDataKeyValueId = item
                    };
                    _contentManagementContext.EntityGroups.Add(group);
                }
            }

            if (removedList.Count > 0)
            {
                if (entityTypeId == 101)
                {
                    _contentManagementContext.EntityGroups.Where(eg => removedList.Contains(eg.LinkId ?? 0) && eg.GroupId == groupId).Delete();
                }
                else
                {
                    _contentManagementContext.EntityGroups.Where(eg => removedList.Contains(eg.MasterDataKeyValueId ?? 0) && eg.GroupId == groupId).Delete();
                }
            }

            await _contentManagementContext.SaveChangesAsync();

            return(entityTypeId == 101 ? "link":"masterData");
        }
Exemplo n.º 31
0
        public int CompareTo(EntityViewModel other)
        {
            if (EntityGroup.ToLower().Equals("capsule"))
            {
                return(-2);
            }

            return(string.Compare(EntityGroup, other.EntityGroup, StringComparison.Ordinal));
        }
Exemplo n.º 32
0
        public static string GetChildDetailsUrl(this Entity entity, EntityGroup group, EntityType entityType, Guid guid)
        {
            string url = String.Format(
                "~/{0}/{1}Details.aspx?guid={2}",
                group.ToString().ToLower(),
                entityType.ToString(),
                guid.ToString());

            return url;
        }
Exemplo n.º 33
0
        public EntityGroup CreateComponentGroup(int[] componentIndices)
        {
            var entityGroup = new EntityGroup();

            for (int i = 0; i < parent.Count; i++)
            {
                var entity = parent[i];
                entityGroup.UpdateEntity(entity, IsComponentGroupValid(entity, componentIndices));
            }

            return entityGroup;
        }
Exemplo n.º 34
0
        public EntityGroup CreateEntityGroup(EntityGroups groups)
        {
            var entityGroup = new EntityGroup();

            for (int i = 0; i < parent.Count; i++)
            {
                var entity = parent[i];
                entityGroup.UpdateEntity(entity, IsEntityGroupValid(entity, groups));
            }

            return entityGroup;
        }
Exemplo n.º 35
0
        public static string GetDetailsUrl(EntityType entityType, EntityGroup group, Guid guid)
        {
            string url = string.Empty;

            OverrideEntityGroup(entityType, ref group);

            url = String.Format(
                "~/{0}/{1}Details.aspx?guid={2}",
                group.ToString().ToLower(),
                entityType.ToString(),
                guid.ToString());

            return url;
        }
Exemplo n.º 36
0
        protected override void OnLoad(EventArgs e)
        {
            entityGroupMask = EntityGroup.None;
            string dir = Request.AppRelativeCurrentExecutionFilePath;
            if (dir.Length > 2)
            {
                int idx = dir.IndexOf('/', 2);
                if (idx > 2)
                {
                    dir = dir.Substring(2, idx - 2);
                    Enum.TryParse<EntityGroup>(dir, true, out entityGroupMask);
                }
            }

            Entity entity = ((IEntityForm)Page).Item;

            this.AppRelativeTemplateSourceDirectory = Page.AppRelativeTemplateSourceDirectory;

            Entity ep = entity.Parent;

            Panel p = new Panel();
            p.CssClass = "Path";

            while (ep != null)
            {
                HyperLink link = new HyperLink();
                link.Text = ep.Name;
                link.NavigateUrl = ep.GetDetailsUrl(entityGroupMask);

                Image img = new Image();
                img.ImageAlign = ImageAlign.Middle;
                img.ImageUrl = String.Format("~/Icons/Small/{0}.gif", ep.EntityType);

                p.Controls.AddAt(0, new LiteralControl("&nbsp;&nbsp;&nbsp;►&nbsp;&nbsp;&nbsp;"));
                p.Controls.AddAt(0, link);
                p.Controls.AddAt(0, new LiteralControl("&nbsp;&nbsp;"));
                p.Controls.AddAt(0, img);

                ep = ep.Parent;
            }

            p.Controls.AddAt(0, new LiteralControl("►&nbsp;&nbsp;&nbsp;"));
            this.Controls.Add(p);

            base.OnLoad(e);
        }
Exemplo n.º 37
0
        void UdgOnGridLoad()
        {
            users = StorageManager.Instance.CreateOrGet("Users");
            roles = StorageManager.Instance.CreateOrGet("UserRoles");
            UserRole admin = roles.AddEntity<UserRole>(new UserRole { RoleName = "Administrator" });
            UserRole power = roles.AddEntity<UserRole>(new UserRole { RoleName = "PowerUser" });
            for (int i = 0; i < 10; i++)
            {
                users.AddEntity<User>(new User
                {
                    Username = "******" + i,
                    Password = "******" + i,
                    RoleId = i % 2 == 0 ? admin.ObjectKey : power.ObjectKey
                });
            }

            udg.Gv.DataSource = roles.GetEntities<UserRole>(); //users.GetEntities<User>();
            udg.Gv.CellClick += Gv_CellClick;
        }
Exemplo n.º 38
0
 private static Entities JoinInternal(EntityGroup g, string pname, object k)
 {
     var rlt = new Entities();
     Entities list = g.GetEntities();
     PropertyInfo info = null;
     foreach (Entity i in list)
     {
         if (info == null)
         {
             Type type = i.GetType();
             info = type.GetProperty(pname);
         }
         if (k.Equals(info.GetValue(i)))
         {
             rlt.Add(i);
         }
     }
     return rlt;
 }
Exemplo n.º 39
0
 private void udg_OnGridLoad()
 {
     articles = StorageManager.Instance.CreateOrGet("Articles");
     tags = StorageManager.Instance.CreateOrGet("Tags");
     var ts = new Tag[3];
     ts[0] = tags.AddEntity<Tag>(new Tag {Name = "news"});
     ts[1] = tags.AddEntity<Tag>(new Tag {Name = "adv"});
     ts[2] = tags.AddEntity<Tag>(new Tag {Name = "depth"});
     for (int i = 0; i < 10; i++)
     {
         Article a = articles.AddEntity<Article>(new Article {Caption = "cap_" + i, Content = "content_" + i});
         for (int j = 0; j <= i%3; j++)
         {
             a.Tags.AddJoint(ts[j].ObjectKey);
         }
     }
     articles.Link();
     udg.Gv.DataSource = articles.GetEntities<Article>();
     udg.Gv.CellClick += GvDetails_CellClick;
 }
Exemplo n.º 40
0
 /// <summary>
 /// Overrides the default entity group
 /// </summary>
 /// <param name="entityType"></param>
 /// <param name="group"></param>
 /// <remarks>
 /// This function is used by the web interface. Certain entities are listed only
 /// under one group (Hardware, Federation etc.) and when clicked, the administrator
 /// has to be redirected to the correct web page.
 /// </remarks>
 private static void OverrideEntityGroup(EntityType entityType, ref EntityGroup group)
 {
     switch (entityType)
     {
         case EntityType.Cluster:
         case EntityType.MachineRole:
         case EntityType.ServerVersion:
         case EntityType.Machine:
         case EntityType.Domain:
         case EntityType.Federation:
         case EntityType.DatabaseDefinition:
         case EntityType.RemoteDatabase:
         case EntityType.FileGroup:
         case EntityType.DeploymentPackage:
         case EntityType.DatabaseVersion:
         case EntityType.DistributedPartitionedView:
             break;
         case EntityType.ServerInstance:
         case EntityType.DiskVolume:
             group = EntityGroup.Cluster;
             break;
         case EntityType.Slice:
         case EntityType.Partition:
             group = EntityGroup.Federation;
             break;
         case EntityType.DatabaseInstance:
         case EntityType.DatabaseInstanceFileGroup:
         case EntityType.DatabaseInstanceFile:
         case EntityType.UserDatabaseInstance:
             group = EntityGroup.Layout;
             break;
         case EntityType.QueueDefinition:
         case EntityType.QueueInstance:
         case EntityType.JobDefinition:
         case EntityType.JobInstance:
             group = EntityGroup.Jobs;
             break;
         case EntityType.UserGroup:
         case EntityType.User:
             group = EntityGroup.Security;
             break;
         default:
             throw new NotImplementedException();
     }
 }
Exemplo n.º 41
0
        public static string GetParentDetailsUrl(this Entity entity, EntityGroup group)
        {
            string url = String.Format(
                "~/{0}/{1}Details.aspx?guid={2}",
                group.ToString(),
                entity.ParentReference.Value.EntityType.ToString(),
                entity.ParentReference.Guid.ToString());

            return url;
        }
Exemplo n.º 42
0
 public static string GetDetailsUrl(this Entity entity, EntityGroup group)
 {
     return GetDetailsUrl(entity.EntityType, group, entity.Guid);
 }
Exemplo n.º 43
0
 private void InitializeMembers()
 {
     this.parentEntity = null;
     this.childrenType = EntityType.Unknown;
     this.entityGroup = Registry.EntityGroup.None;
     this.text = null;
     this.columns = new DataControlFieldCollection();
 }
Exemplo n.º 44
0
 public static bool Contains(this EntityGroupMask mask, EntityGroup group)
 {
     return ((uint)mask & (1 << (int)group)) != 0;
 }
Exemplo n.º 45
0
 /// <summary>
 /// Creates a new instance of <see cref="GizmoBase"/>.
 /// </summary>
 /// <param name="group">The entity group of the gizmo</param>
 protected GizmoBase(EntityGroup group = DefaultGroup)
 {
     EntityGroup = group;
 }
Exemplo n.º 46
0
        public static async Task SaveScene(EngineContext engineContext)
        {
            var oldState = engineContext.EntityManager.State;
            engineContext.EntityManager.State = GameState.Saving;
            await Scheduler.Current.NextFrame();
            await Scheduler.Current.NextFrame();
            await Scheduler.Current.NextFrame();

            var contentManager = new AssetManager(new AssetSerializerContextGenerator(engineContext.PackageManager, ParameterContainerExtensions.DefaultSceneSerializerSelector));

            var entities = engineContext.EntityManager.Entities.ToArray();
            var sceneData = new EntityGroup { Entities = entities.ToList() };
            contentManager.Url.Set(sceneData, "/sync/package_scene.hotei#");
            contentManager.Save(sceneData);

            engineContext.EntityManager.State = GameState.Running;
        }
Exemplo n.º 47
0
        private static void PrepareLightGroups(RenderDrawContext context, FastList<RenderView> renderViews, RenderView renderView, RenderViewLightData renderViewData, ShadowMapRenderer shadowMapRenderer, EntityGroup group)
        {
            foreach (var activeRenderer in renderViewData.ActiveRenderers)
            {
                // Find lights
                var lightRenderer = activeRenderer.LightRenderer;
                var lightCollection = activeRenderer.LightGroup.FindLightCollectionByGroup(group);

                var processLightsParameters = new LightGroupRendererBase.ProcessLightsParameters
                {
                    Context = context,
                    ViewIndex = renderViewData.ViewIndex,
                    View = renderView,
                    Views = renderViews,
                    LightCollection = lightCollection,
                    LightType = activeRenderer.LightGroup.LightType,
                    LightStart = 0,
                    LightEnd = lightCollection.Count,
                    ShadowMapRenderer = shadowMapRenderer,
                    ShadowMapTexturesPerLight = renderViewData.LightComponentsWithShadows,
                };

                lightRenderer.ProcessLights(processLightsParameters);
            }
        }
Exemplo n.º 48
0
 protected virtual void SaveEntities(EntityGroup entities)
 {
     string name = EntityGroupName(entities);
     if (!Directory.Exists(name))
     {
         Directory.CreateDirectory(RootDir + name);
     }
     Entities list = entities.GetEntities();
     foreach (Entity i in list)
     {
         SaveEntity(i);
     }
 }
Exemplo n.º 49
0
 private string EntityGroupName(EntityGroup eg)
 {
     return string.Concat(eg.Name, "_", eg.GetType().Name, "_", eg.ObjectKey);
 }
Exemplo n.º 50
0
 public void Process(EntityGroup group)
 {
     SaveEntities(group);
 }
Exemplo n.º 51
0
 public void DropEntityGroup(EntityGroup group)
 {
     if (group == null)
     {
         return;
     }
     string dir = EntityGroupName(group);
     dir.RmDir();
     ObjectPoolManager.Remove(group);
 }