Exemplo n.º 1
0
        private static void ShowEntity(this EntityComponent entityComponent, Type logicType, string entityGroup, int priority, int entityId = -1)
        {
            IDataTable <DREntity> dtEntity = GameEntry.DataTable.GetDataTable <DREntity>();
            DREntity drEntity = dtEntity.GetDataRow(entityId);

            if (drEntity == null)
            {
                Log.Warning("Can not load entity id '{0}' from data table.", entityId);
                return;
            }

            entityComponent.ShowEntity(GenerateSerialId(entityComponent), logicType, AssetUtility.GetEntityAsset(drEntity.AssetName), entityGroup, priority);
        }
Exemplo n.º 2
0
        private static void ShowEntity(this EntityComponent entityComponent, Type logicType, string entityGroup, int priority, EntityData data)
        {
            if (data == null)
            {
                Log.Warning("Data is invalid.");
                return;
            }

            IDataTable <DREntity> dtEntity = GameEntry.DataTable.GetDataTable <DREntity>();
            DREntity drEntity = dtEntity.GetDataRow(data.TypeId);

            if (drEntity == null)
            {
                Log.Warning("Can not load entity id '{0}' from data table.", data.TypeId.ToString());
                return;
            }

            entityComponent.ShowEntity(data.Id, logicType, AssetUtility.GetEntityAsset(drEntity.AssetName), entityGroup, priority, data);
        }
Exemplo n.º 3
0
        public static async Task <T> ShowEntityAsync <T>(this EntityComponent entityComponent, string entityGroup, int priority, EntityData data, string pathFormat) where T : EntityLogic
        {
            if (data == null)
            {
                Log.Warning("Data is invalid.");
                return(null);
            }

            IDataTable <DREntity> dtEntity = GameEntry.DataTable.GetDataTable <DREntity>();
            DREntity drEntity = dtEntity.GetDataRow(data.TypeId);

            if (drEntity == null)
            {
                Log.Warning("Can not load entity id '{0}' from data table.", data.TypeId.ToString());
                return(null);
            }

            EntityLogic entity = await entityComponent.ShowEntityAsync(data.Id, typeof(T), AssetUtility.GetFullPath(pathFormat, drEntity.AssetName), entityGroup, priority, data);

            return((T)entity);
        }