using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using System.Web.Http.Results; using MongoDB.Bson; using MongoDB.Driver; using Newtonsoft.Json.Linq; using ShadowEditor.Model.Scene; using ShadowEditor.Server.Base; using ShadowEditor.Server.Helpers; namespace ShadowEditor.Server.Controllers { /// /// (所有)资源控制器 /// public class AssetsController : ApiBase { /// /// 获取信息列表 /// /// [HttpGet] public JsonResult List() { var mongo = new MongoHelper(); // 获取所有类别 var sceneCount = mongo.Count(Constant.SceneCollectionName); var meshCount = mongo.Count(Constant.MeshCollectionName); var mapCount = mongo.Count(Constant.MapCollectionName); var materialCount = mongo.Count(Constant.MaterialCollectionName); var audioCount = mongo.Count(Constant.AudioCollectionName); var animationCount = mongo.Count(Constant.AnimationCollectionName); var particleCount = mongo.Count(Constant.ParticleCollectionName); var prefabCount = mongo.Count(Constant.PrefabCollectionName); var characterCount = mongo.Count(Constant.CharacterCollectionName); var screenshotCount = mongo.Count(Constant.ScreenshotCollectionName); var videoCount = mongo.Count(Constant.VideoCollectionName); return Json(new { Code = 200, Msg = "Get Successfully!", sceneCount, meshCount, mapCount, materialCount, audioCount, animationCount, particleCount, prefabCount, characterCount, screenshotCount, videoCount, }); } } }