/// <summary> /// Adds new space. /// </summary> /// <param name="height">The height.</param> /// <returns>The created element.</returns> public SpaceElement Space(float height) { SpaceElement element = new SpaceElement(); element.Init(height); OnAddElement(element); return(element); }
public static dynamic GetTSObject(SpaceElement dynObject) { if (dynObject is null) { return(null); } return(dynObject.teklaObject); }
private static void LoadElements() { asteroids = new asteroid[20]; stars = new SpaceElement[60]; Random k = new Random(); for (int i = 0; i < asteroids.Length; i++) { int[] kk = new int[4]; kk[0] = k.Next(Width); kk[1] = k.Next(Height); //position kk[2] = k.Next(5, 20); //size kk[3] = k.Next(1, 5); //speed double ang = k.Next(); asteroids[i] = new asteroid(new Point(kk[0], kk[1]), new Size(kk[2], kk[2]), ang, (byte)kk[3]); } for (int i = 0; i < stars.Length; i++) { stars[i] = new SpaceElement(new Point(k.Next(Width), k.Next(Height))); } }
public CannonTower(SpaceElement parent) : base(parent) { }
/// <summary> /// 空间隐私设置 /// </summary> /// <param name="element"></param> /// <param name="userID">该用户的ID</param> /// <returns></returns> public bool IsSpaceElementShow(SpaceElement element, int userID) { if (userID <= 0) { ThrowError(new InvalidParamError("userID")); return(false); } User user = UserBO.Instance.GetUser(userID); if (user == null) { return(false); } int currentUserID = UserBO.Instance.GetCurrentUserID(); if (currentUserID == userID) { return(true); } switch (element) { case SpaceElement.Album: { if (user.AlbumPrivacy == SpacePrivacyType.All) { return(true); } else if (user.AlbumPrivacy == SpacePrivacyType.Friend) { if (FriendBO.Instance.IsFriend(currentUserID, userID)) { return(true); } } else { return(false); } } break; case SpaceElement.Blog: { if (user.BlogPrivacy == SpacePrivacyType.All) { return(true); } else if (user.BlogPrivacy == SpacePrivacyType.Friend) { if (FriendBO.Instance.IsFriend(currentUserID, userID)) { return(true); } } else { return(false); } } break; case SpaceElement.Board: { if (user.BoardPrivacy == SpacePrivacyType.All) { return(true); } else if (user.BoardPrivacy == SpacePrivacyType.Friend) { if (FriendBO.Instance.IsFriend(currentUserID, userID)) { return(true); } } else { return(false); } } break; case SpaceElement.Doing: { if (user.DoingPrivacy == SpacePrivacyType.All) { return(true); } else if (user.DoingPrivacy == SpacePrivacyType.Friend) { if (FriendBO.Instance.IsFriend(currentUserID, userID)) { return(true); } } else { return(false); } } break; case SpaceElement.Feed: { if (user.FeedPrivacy == SpacePrivacyType.All) { return(true); } else if (user.FeedPrivacy == SpacePrivacyType.Friend) { if (FriendBO.Instance.IsFriend(currentUserID, userID)) { return(true); } } else { return(false); } } break; case SpaceElement.Friend: { if (user.FriendListPrivacy == SpacePrivacyType.All) { return(true); } else if (user.FriendListPrivacy == SpacePrivacyType.Friend) { if (FriendBO.Instance.IsFriend(currentUserID, userID)) { return(true); } } else { return(false); } } break; case SpaceElement.Information: { if (user.InformationPrivacy == SpacePrivacyType.All) { return(true); } else if (user.InformationPrivacy == SpacePrivacyType.Friend) { if (FriendBO.Instance.IsFriend(currentUserID, userID)) { return(true); } } else { return(false); } } break; case SpaceElement.Share: { if (user.SharePrivacy == SpacePrivacyType.All) { return(true); } else if (user.SharePrivacy == SpacePrivacyType.Friend) { if (FriendBO.Instance.IsFriend(currentUserID, userID)) { return(true); } } else { return(false); } } break; case SpaceElement.Space: { if (user.SpacePrivacy == SpacePrivacyType.All) { return(true); } else if (user.SpacePrivacy == SpacePrivacyType.Friend) { if (FriendBO.Instance.IsFriend(currentUserID, userID)) { return(true); } } else { return(false); } } break; } return(true); }
public CannonTower(SpaceElement parent) : base(parent) { }