void when_executing() { Pool pool = null; Entity entity = null; IExecuteSystem system = null; before = () => { pool = TestHelper.CreateCorePool(); entity = pool.CreateEntity().AddHealth(1); system = (IExecuteSystem)pool.CreateSystem(new CheckHealthSystem()); }; it["flags entities destroy when health 0 or less"] = () => { // when entity.ReplaceHealth(0); system.Execute(); // then entity.flagDestroy.should_be_true(); }; it["doesn't flag entities destroy when health greater 0"] = () => { // when entity.ReplaceHealth(2); system.Execute(); // then entity.flagDestroy.should_be_false(); }; }
private double MonitorExecuteSystemDuration(IExecuteSystem aSystem) { _stopwatch.Reset(); _stopwatch.Start(); aSystem.Execute(); _stopwatch.Stop(); return(_stopwatch.Elapsed.TotalMilliseconds); }
double monitorSystemExecutionDuration(IExecuteSystem system) { _stopwatch.Reset(); _stopwatch.Start(); system.Execute(); _stopwatch.Stop(); return(_stopwatch.Elapsed.TotalMilliseconds); }
public static UploadServerData GetUploadServer(IExecuteSystem es, String albumId, String groupId = null) { var method = new GetUploadServer { AlbumId = albumId, GroupId = groupId }; return(es.Execute(method)); }
public static Int32 DeleteAlbum(IExecuteSystem es, String albumId, String groupId) { var method = new DeleteAlbum { AlbumId = albumId, GroupId = groupId }; return(es.Execute(method)); }
public static Int32 GetAlbumCount(IExecuteSystem es, String userId, String groupId) { var method = new GetAlbumsCount { UserId = userId, GroupId = groupId }; return(es.Execute(method)); }
public static String Add(IExecuteSystem es, String userId, String text, Boolean?follow = null) { var method = new Add { UserId = userId, Text = text, Follow = follow }; return(es.Execute(method)); }
public static List <IsMemberResult> IsMember(IExecuteSystem es, String groupId, List <String> userIds) { var method = new IsMember { GroupId = groupId, UserIds = userIds }; return(es.Execute(method)); }
public static User Get(IExecuteSystem es, List <String> userIds, List <String> fields = null, String nameCase = null) { var method = new Get { UserIds = userIds, Fields = fields, NameCase = nameCase }; return(es.Execute(method)); }
public static String AddTopic(IExecuteSystem es, String groupId, String title, String text = null, Boolean?fromGroup = null, List <String> attachments = null) { var method = new AddTopic { GroupId = groupId, Title = title, Text = text, FromGroup = fromGroup, Attachments = attachments }; return(es.Execute(method)); }
public static List <Album> GetAlbums(IExecuteSystem es, String owner, List <String> ids = null, UInt32?offset = null, UInt32?count = null, Boolean?needSystem = null, Boolean?needCovers = null, Boolean?photoSizes = null) { var method = new GetAlbums { OwnerId = owner, AlbumIds = ids, Offset = offset, Count = count, NeedSystem = needSystem, NeedCovers = needCovers, PhotoSizes = photoSizes }; return(es.Execute(method)); }
public static List <Group> Get(IExecuteSystem es, String userId, Boolean?extended = true, String filter = null, List <String> fields = null, Int32?count = null, Int32?offset = null) { var method = new Get { Count = count, Extended = extended, Fields = fields, Filter = filter, Offset = offset, UserId = userId }; return(es.Execute(method)); }
public static String AddComment(IExecuteSystem es, String groupId, String topicId, String text = null, List <String> attachments = null, Boolean?fromGroup = null, Int32?stickerId = null, String commentGuid = null) { var method = new AddComment { GroupId = groupId, TopicId = topicId, Text = text, Attachments = attachments, FromGroup = fromGroup, StickerId = stickerId, GuidComment = commentGuid }; return(es.Execute(method)); }
public static List <User> Get(IExecuteSystem es, String userId, String order, List <String> fields = null, List <String> lists = null, Int32?count = null, Int32?offset = null, String nameCase = null) { var method = new Get { UserId = userId, Order = order, Lists = lists, Count = count, Offset = offset, Fields = fields, NameCase = nameCase }; return(es.Execute(method)); }
/// <summary> /// 删除系统 /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public Observer RemoveSystem <T>() { IInitSystem initSystem = null; foreach (IInitSystem item in _systemInitList) { if (item.GetType() == typeof(T)) { initSystem = item; break; } } if (initSystem != null) { _systemInitList.Remove(initSystem); } //ISystem reactiveSystem = null; int index = -1; for (int i = 0; i < _systemReactiveDic.Count; i++) { if (_systemReactiveDic[i].CurrentSystem.GetType() == typeof(T)) { index = i; break; } } if (index > 0) { _systemReactiveDic.RemoveAt(index); } IExecuteSystem executeSystem = null; foreach (IExecuteSystem item in _systemExecuteList) { if (item.GetType() == typeof(T)) { executeSystem = item; break; } } if (executeSystem != null) { _systemExecuteList.Remove(executeSystem); } return(this); }
public static String CreateComment(IExecuteSystem es, String owner, String photo, String message, List <String> attaches = null, Boolean?fromGroup = null, String replyToComment = null, String stickerId = null) { var method = new CreateComment { OwnerId = owner, PhotoId = photo, Message = message, Attachments = attaches, FromGroup = fromGroup, ReplyToComment = replyToComment, StickerId = stickerId }; return(es.Execute(method)); }
public static String Send(IExecuteSystem es, String userId, String message, String domain = null, String chatId = null, List <String> userIds = null, Guid?unique = null, Double?lat = null, Double? @long = null, List <String> attach = null) { var method = new Send { UserId = userId, Domain = domain, ChatId = chatId, UserIds = userIds, Message = message, Unique = unique, Lat = lat, Long = @long, Attachment = attach }; return(es.Execute(method)); }
public static List <PhotoComment> GetComments(IExecuteSystem es, String owner, String photo, Boolean?needLikes = null, Int32?offset = null, Int32?count = null, String sort = null, Boolean?extended = null) { var method = new GetComments { OwnerId = owner, PhotoId = photo, NeedLikes = needLikes, Offset = offset, Count = count, Sort = sort, Extended = extended }; return(es.Execute(method)); }
public static Album CreateAlbum(IExecuteSystem es, String title, String groupId = null, String descr = null, String privacyView = null, String privacyComment = null, Boolean?uploadByAdmins = null, Boolean?commentsDisabled = null) { var method = new CreateAlbum { Title = title, GroupId = groupId, Description = descr, PrivacyView = privacyView, PrivacyComment = privacyComment, UploadByAdmins = uploadByAdmins, CommentsDisabled = commentsDisabled }; return(es.Execute(method)); }
public static List <Photo> Save(IExecuteSystem es, String albumId, String server, String photosList, String hash, String groupId = null, Double?latitude = null, Double?longitude = null, String caption = null) { var method = new Save() { AlbumId = albumId, GroupId = groupId, Server = server, PhotosList = photosList, Hash = hash, Latitude = latitude, Longitude = longitude, Caption = caption }; return(es.Execute(method)); }
void when_executing() { Pool corePool = null; Pool inputPool = null; Pool bulletPool = null; IExecuteSystem system = null; before = () => { corePool = TestHelper.CreateCorePool(); inputPool = TestHelper.CreateInputPool(); bulletPool = TestHelper.CreateBulletsPool(); system = (IExecuteSystem)inputPool.CreateSystem(new ProcessCollisionSystem()); }; it["destroys bullet and damages other in CollisionComponent"] = () => { // given var bullet = bulletPool.CreateEntity().AddDamage(5); var enemy = corePool.CreateEntity().AddHealth(10); inputPool.CreateEntity().AddCollision(bullet, enemy); // when system.Execute(); // then bullet.flagDestroy.should_be_true(); enemy.flagDestroy.should_be_false(); enemy.health.value.should_be(5); inputPool.GetEntities(InputMatcher.Collision).Length.should_be(0); }; it["doesn't set other's health less than 0"] = () => { // given var bullet = bulletPool.CreateEntity().AddDamage(20); var enemy = corePool.CreateEntity().AddHealth(10); inputPool.CreateEntity().AddCollision(bullet, enemy); // when system.Execute(); // then enemy.health.value.should_be(0); }; }
private static void Execute(IExecuteSystem system, IEntity entity, float deltaTime) { switch (system) { case IUpdateSystem updateSystem: updateSystem.Execute(entity, deltaTime); break; case IFixedUpdateSystem fixedUpdateSystem: fixedUpdateSystem.Execute(entity, deltaTime); break; case ILateUpdateSystem lateUpdateSystem: lateUpdateSystem.Execute(entity, deltaTime); break; default: throw new ArgumentException($"Unknown execute system type: {system?.GetType()}."); } }
public static List <Photo> Get(IExecuteSystem es, String owner, String album, List <String> ids = null, Boolean?rev = null, Boolean?extended = null, String feedType = null, DateTime?feed = null, Boolean?photoSizes = null, Int32?offset = null, Int32?count = null) { var method = new Get { OwnerId = owner, AlbumId = album, PhotoIds = ids, Rev = rev, Extended = extended, FeedType = feedType, Feed = feed, PhotoSizes = photoSizes, Offset = offset, Count = count }; return(es.Execute(method)); }
double monitorSystemExecutionDuration(IExecuteSystem system) { _stopwatch.Reset(); _stopwatch.Start(); system.Execute(); _stopwatch.Stop(); return _stopwatch.Elapsed.TotalMilliseconds; }