Example #1
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);
        }