public static IHtmlControl GetNewsView(SiteState state, LightObject currentUser, TopicStorage topic, out string description) { LightObject news = topic.Topic; description = BasketballHlp.GetDescriptionForNews(news); DateTime localTime = (news.Get(ObjectType.ActFrom) ?? DateTime.UtcNow).ToLocalTime(); int publisherId = news.Get(NewsType.PublisherId); LightObject publisher = context.UserStorage.FindUser(publisherId); IHtmlControl editPanel = null; if (currentUser != null && (currentUser.Id == publisherId || currentUser.Get(BasketballUserType.IsModerator))) { editPanel = ViewNewsHlp.GetNewsEditPanel(state, topic); } IHtmlControl moderatorPanel = GetModeratorPanel(state, currentUser, topic, localTime); return(new HPanel( Decor.Title(news.Get(NewsType.Title)), new HLabel(localTime.ToString(Decor.timeFormat)).Block().FontBold(), new HTextView(news.Get(NewsType.Text)).PositionRelative().Overflow("hidden"), new HPanel( new HLabel("Добавил:").MarginRight(5), new HLink(UrlHlp.ShopUrl("user", publisherId), publisher?.Get(UserType.Login)) ), new HLink(news.Get(NewsType.OriginUrl), news.Get(NewsType.OriginName)), ViewTagHlp.GetViewTagsPanel(context.Tags.TagBox, topic.Topic), editPanel, moderatorPanel, ViewCommentHlp.GetCommentsPanel(context.MessageConnection, state, currentUser, topic, topic.MessageLink.AllRows) )); }
public static void InsertMessageAndUpdate(IDataLayer commentConnection, TopicStorage topic, LightObject currentUser, int?whomId, string content) { MessageHlp.InsertMessage(commentConnection, topic.TopicId, currentUser.Id, whomId, content); topic.UpdateMessages(); context.UpdateLastComments(commentConnection == context.ForumConnection); //hack if (commentConnection == context.ForumConnection) { context.FabricConnection.GetScalar("", "Update light_object Set act_till=@modifyTime Where obj_id=@topicId", new DbParameter("modifyTime", DateTime.UtcNow), new DbParameter("topicId", topic.TopicId) ); int?sectionId = topic.Topic.GetParentId(ForumSectionType.TopicLinks); if (sectionId != null) { context.Forum.ForSection(sectionId.Value).Update(); } } }
public static IHtmlControl GetArticleListView(SiteState state, LightObject currentUser, int pageNumber) { int[] allArticleIds = context.Articles.AllObjectIds; int pageCount = BinaryHlp.RoundUp(allArticleIds.Length, articleCountOnPage); int curPos = pageNumber * articleCountOnPage; if (curPos < 0 || curPos >= allArticleIds.Length) { return(new HPanel()); } int[] articleIds = ArrayHlp.GetRange(allArticleIds, curPos, Math.Min(articleCountOnPage, allArticleIds.Length - curPos) ); LightObject[] articleList = ArrayHlp.Convert(articleIds, delegate(int id) { return(new LightObject(context.Articles, id)); } ); IHtmlControl[] items = GetArticleItems(state, articleList); return(new HPanel( Decor.Title("Статьи").MarginBottom(15), new HPanel( new HPanel( items ), ViewJumpHlp.JumpBar("/stati", context.Articles.AllObjectIds.Length, articleCountOnPage, pageNumber) ) )); }
public override void Prepare() { //KWEngine.BuildTerrainModel("TerrainTest", @".\textures\heightmap256.png", @".\textures\sand_diffuse.dds", 10, 1, 10, 10, 10); KWEngine.BuildTerrainModel("TerrainTest", @".\textures\heightmapterraintest2x2.png", @".\textures\sand_diffuse.dds", 15, 5, 15, 10, 10); KWEngine.LoadModelFromFile("UBot", @".\models\jumpandrun\ubot.fbx"); FOV = 90; SetAmbientLight(1, 1, 1, 0.25f); SetTextureSkybox(@".\textures\skybox_mipmaptest.jpg"); SetTextureBackgroundBrightnessMultiplier(4); Immovable t = new Immovable(); t.SetModel("TerrainTest"); t.IsCollisionObject = true; t.SetPosition(5, 0, 0); //t.SetPositionY(1); AddGameObject(t); //CreateFreeFloatPlayer(); CreateUBotPlayer(); LightObject sun = new LightObject(LightType.Sun, false); sun.SetPosition(100, 100, 100); sun.SetColor(1, 1, 1, 1); AddLightObject(sun); DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond; //DebugShowCoordinateSystemGrid = GridType.GridXZ; }
public override void Prepare() { KWEngine.LoadModelFromFile("ConvexHull", @".\models\convexhull.glb"); KWEngine.LoadModelFromFile("Paddle", @".\models\paddle.obj"); FOV = 90; SetAmbientLight(1, 1, 1, 0.2f); SetCameraPosition(0, 0, 25); SetCameraTarget(0, 0, 0); SetTextureSkybox(@".\textures\skybox1.dds"); SetTextureBackgroundBrightnessMultiplier(4); LightObject sun = new LightObject(LightType.Sun, false); sun.SetPosition(30, 30, 30); sun.SetColor(1, 1, 1, 0.8f); AddLightObject(sun); DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond; DebugShowCoordinateSystemGrid = GridType.GridXY; //DebugShowHitboxes = true; CreateTestScene(); }
private void CheckOneLightFile(string path, int op) { Scene scene = EditorSceneManager.OpenScene(path); string relativePath = path.Replace(FilePathHelper.GetProjectPath(), ""); LightObject lightObj = new LightObject(); lightObj.hasLight = false; GameObject[] goList = SceneManager.GetActiveScene().GetRootGameObjects(); foreach (GameObject go in goList) { if (go != null) { LookupAllLight(go.transform, lightObj, op); } } if (lightObj.hasLight) { lightObj.obj = AssetDatabase.LoadAssetAtPath(relativePath, typeof(Object)); lightObj.path = path; _lightObjects.Add(lightObj); } if (op == 2 && lightObj.hasLight) { EditorSceneManager.SaveScene(scene); } }
// op=1查找,op=2替换, op=3详细 private void LookupAllLight(Transform tf, LightObject lightObj, int op) { if (op == 1 && lightObj.hasLight) { return; } Light light = tf.GetComponent <Light>(); //SceneLight sl = tf.GetComponent<SceneLight>(); //ShadowConfig sc = tf.GetComponent<ShadowConfig>(); //if (light != null && sl != null && sc != null && (light.enabled || sl.lit == null || sc.lit == null)) { if (light != null && light.enabled == true) { lightObj.hasLight = true; if (op == 2) { light.enabled = false; //sl.lit = light; //sc.lit = light; } else if (op == 3) { lightObj.details.Add(tf.gameObject); } } foreach (Transform item in tf) { LookupAllLight(item, lightObj, op); } }
private void ModifySingleLight(LightObject lightObject) { //string filename = FilePathHelper.GetFileName(dfMaterialObject.path); string filename = Path.GetFileNameWithoutExtension(lightObject.path); Scene scene = EditorSceneManager.GetActiveScene(); if (scene.name != filename) { scene = EditorSceneManager.OpenScene(lightObject.path); } GameObject[] goList = scene.GetRootGameObjects(); foreach (GameObject go in goList) { if (go != null) { LookupAllLight(go.transform, lightObject, 2); } } EditorSceneManager.SaveScene(scene); for (int i = 0; i < _lightObjects.Count; i++) { if (lightObject.path == _lightObjects[i].path) { _lightObjects.RemoveAt(i); } } }
public override void Prepare() { FOV = 90; SetAmbientLight(1, 1, 1, 0.25f); SetTextureSkybox(@".\textures\skybox_mipmaptest.jpg"); SetTextureBackgroundBrightnessMultiplier(4); t.SetModel("KWCube"); t.IsCollisionObject = true; t.SetPosition(0, 1, 0); t.SetScale(2); AddGameObject(t); _sphere.SetModel("KWSphere"); _sphere.SetPosition(0, 0, 0); _sphere.SetColor(1, 0, 0); AddGameObject(_sphere); //CreateFreeFloatPlayer(); //CreateUBotPlayer(); LightObject sun = new LightObject(LightType.Sun, false); sun.SetPosition(100, 100, 100); sun.SetColor(1, 1, 1, 1); AddLightObject(sun); SetCameraPosition(0, 10, 20); SetCameraTarget(0, 0, 0); DebugShowCoordinateSystemGrid = GridType.GridXZ; }
public override void Act(KeyboardState ks, MouseState ms) { if (ks[Key.Escape]) { CurrentWindow.SetWorld(new GameWorldStart()); return; } if (_player != null) { SetCameraPosition(_player.Position.X, 0, 50); SetCameraTarget(_player.Position.X, 0, 0); UpdateSunPosition(); } if (ks[Key.O] && GetCurrentTimeInMilliseconds() - _lastspawn > 500) { LightObject newLight = new LightObject(LightType.Point, true); newLight.SetPosition(0, 5, 5); newLight.SetNearAndFarBounds(1, 20); AddLightObject(newLight); _testlights.Add(newLight); _lastspawn = GetCurrentTimeInMilliseconds(); } if (ks[Key.P] && GetCurrentTimeInMilliseconds() - _lastspawn > 300) { if (_testlights.Count > 0) { RemoveLightObject(_testlights[_testlights.Count - 1]); _testlights.Remove(_testlights[_testlights.Count - 1]); } _lastspawn = GetCurrentTimeInMilliseconds(); } }
public void TestStart() { try { LightObject lightObject = new LightObject(); LightObject dummy = new LightObject(); dummy.PutInt(1, 1000); dummy.PutInt(2, 10); LightObject dummy2 = new LightObject(); dummy2.PutInt(1, 1000); dummy2.PutInt(2, 10); dummy.PutObject(1, dummy2); lightObject.PutObject(2, dummy); lightObject.PutObject(3, dummy2); byte[] data = lightObject.Serialize(); LightObject coveredObject = LightObject.Deserialize(data); coveredObject.GetInt(1); Debugs.Log(coveredObject); } catch (Exception e) { Debugs.Log(e); } }
/// <summary> /// Durchsucht die Liste der LightObject-Instanzen nach einem Objekt mit dem gegebenen Namen /// </summary> /// <param name="name">Name des gesuchten Objekts</param> /// <returns>Gesuchtes Objekt oder null (falls nicht gefunden)</returns> public LightObject GetLightObjectByName(string name) { name = name.Trim(); LightObject l = _lightObjects.FirstOrDefault(lo => lo.Name == name); return(l); }
public override void Prepare() { FOV = 30; SetAmbientLight(1, 1, 1, 0.3f); SetCameraPosition(0, 50, 0); SetCameraTarget(0, 0, 0); LightObject sun = new LightObject(LightType.Sun, true); sun.SetPosition(30, 30, 30); sun.SetColor(1, 1, 1, 0.75f); //DebugShadowLight = sun; AddLightObject(sun); DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond; DebugShowCoordinateSystemGrid = GridType.GridXZ; //DebugShowHitboxes = true; //KWEngine.Projection = ProjectionType.Orthographic; CreateTestScene(); //CreateFreeFloatPlayer(); }
internal void Light() { allLights = LightObject.GetLights(); DirectionalLights.Clear(); PointLights.Clear(); SpotLights.Clear(); for (int i = 0; i < allLights.Count; i++) { if (allLights[i].type == LightType.Spot) { //if (l.cookie == null) // l.cookie = DefaultSpotCookie; SpotLights.Add(allLights[i]); } else if (allLights[i].type == LightType.Point) { PointLights.Add(allLights[i]); } else if (allLights[i].type == LightType.Directional) { DirectionalLights.Add(allLights[i]); } if (UseAlloyLight) { allLights[i].light.GetOrAddComponent <AlloyAreaLight>().UpdateBinding(); } } }
protected virtual void CreateLightRequest(LightObject light) { try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(BaseUri); request.Method = "POST"; request.ContentType = "application/json"; //request.Headers.Add("content-type", "application/json"); ///string json = "{\"command\":\"on\"}"; string json = JsonConvert.SerializeObject(light); //Serialize json object to string request.ContentLength = json.Length; //Get length of json Stream stream = request.GetRequestStream(); //Create stream mainlabel.Text = "Reached Write + " + json; stream.Write(Encoding.UTF8.GetBytes(json), 0, json.Length); //Write PUT request HttpWebResponse response = (HttpWebResponse)request.GetResponse(); //Get response to make sure json object is sent } catch (Exception e) { label2.Text = e.Message; string message = e.Message; //await DisplayAlert("DisplayAlert", $"{message}", "OK"); } }
public static IHtmlControl GetNewsListView(SiteState state, LightObject currentUser, int pageNumber) { //int pageCount = BinaryHlp.RoundUp(allNewsIds.Length, newsCountOnPage); //int curPos = pageNumber * newsCountOnPage; //if (curPos < 0 || curPos >= allNewsIds.Length) // return null; //int[] newsIds = ArrayHlp.GetRange(allNewsIds, curPos, Math.Min(newsCountOnPage, allNewsIds.Length - curPos)); //LightHead[] newsList = ArrayHlp.Convert(newsIds, delegate (int id) //{ return new LightHead(context.News, id); } //); int[] allNewsIds = context.News.AllObjectIds; IHtmlControl[] items = GetNewsItems(state, allNewsIds, pageNumber); if (items == null) { return(null); } //string title = StringHlp.IsEmpty(tag) ? "Новости" : "Теги"; return(new HPanel( Decor.Title("Новости"), //Decor.Subtitle(string.Format("Тег — {0}", tag)), new HPanel( new HPanel( items ), ViewJumpHlp.JumpBar("/novosti", allNewsIds.Length, newsCountOnPage, pageNumber) ) )); }
private void BaseInit() { BuildingInit(); light = GetComponentInChildren <LightObject>(); tag = "Base"; spawn = position + new Vector3(1, 0, 0); }
public static IHtmlControl GetMainView(SiteState state, LightObject currentUser) { return(new HPanel( ViewNewsHlp.GetActualNewsBlock(state, currentUser), ViewArticleHlp.GetActualArticleBlock(state, currentUser) ).PaddingLeft(15) .MediaSmartfon(new HStyle().PaddingLeft(5))); }
static IHtmlControl GetUserRedoPanel(SiteState state, LightObject user) { return(new HPanel( Decor.PropertyEdit("editUserName", "Ваше имя (*):", user.Get(UserType.FirstName)), Decor.PropertyEdit("editUserEmail", "Email (*):", user.Get(UserType.Email)), Decor.PropertyEdit("editUserCountry", "Страна:", user.Get(BasketballUserType.Country)), Decor.PropertyEdit("editUserCity", "Город:", user.Get(BasketballUserType.City)), Decor.PropertyEdit("editUserInterests", "Интересы:", user.Get(BasketballUserType.Interests)), Decor.PropertyEdit("editUserAboutMe", "О себе:", user.Get(BasketballUserType.AboutMe)), Decor.PropertyEdit("editUserCommunity", "На basketball.ru с:", user.Get(BasketballUserType.CommunityMember)), Decor.Button("Сохранить") .Event("user_edit_save", "userContainer", delegate(JsonData json) { string name = json.GetText("editUserName"); string email = json.GetText("editUserEmail"); string country = json.GetText("editUserCountry"); string city = json.GetText("editUserCity"); string interests = json.GetText("editUserInterests"); string aboutMe = json.GetText("editUserAboutMe"); string community = json.GetText("editUserCommunity"); WebOperation operation = state.Operation; if (!operation.Validate(email, "Не задана электронная почта")) { return; } if (!operation.Validate(!email.Contains("@"), "Некорректный адрес электронной почты")) { return; } if (!operation.Validate(name, "Не задано имя")) { return; } LightObject editUser = DataBox.LoadObject(context.UserConnection, UserType.User, user.Id); editUser.Set(UserType.FirstName, name); editUser.Set(UserType.Email, email); editUser.Set(BasketballUserType.Country, country); editUser.Set(BasketballUserType.City, city); editUser.Set(BasketballUserType.Interests, interests); editUser.Set(BasketballUserType.AboutMe, aboutMe); editUser.Set(BasketballUserType.CommunityMember, community); editUser.Set(ObjectType.ActTill, DateTime.UtcNow); editUser.Box.Update(); context.UserStorage.Update(); state.BlockHint = ""; } ) ).EditContainer("userContainer")); }
private void Send(Socket handler, LightObject data) { // Convert the string data to byte data using ASCII encoding. byte[] byteData = data.Serialize(); // Begin sending the data to the remote device. handler.BeginSend(byteData, 0, byteData.Length, 0, new AsyncCallback(SendCallback), handler); }
private void Update() { time += Time.deltaTime; if (time > 0.75f) { time = 0; LightObject lightObj = null; if (freeLights.Count == 0) { lightObj = new LightObject() { light = (GameObject.Instantiate(lightPrefab) as GameObject).GetComponent <Light>() }; } else { lightObj = freeLights[freeLights.Count - 1]; freeLights.RemoveAt(freeLights.Count - 1); } lightObj.lifeTime = 60.0f; workingLights.Add(lightObj); lightObj.light.intensity = 1; lightObj.light.color = new Color(Random.Range(0.1f, 1.0f), Random.Range(0.1f, 1.0f), Random.Range(0.1f, 1.0f)); lightObj.light.transform.position = transform.position; lightObj.light.gameObject.SetActive(true); lightObj.light.GetComponent <Rigidbody>().isKinematic = false; lightObj.light.GetComponent <Rigidbody>().AddForce(transform.up * 1000, ForceMode.Acceleration); if (JCDSCamera.instance != null) { JCDSCamera.instance.CollectLights(); } } int numLights = workingLights.Count; for (int i = 0; i < numLights; ++i) { LightObject lightObj = workingLights[i]; lightObj.lifeTime -= Time.deltaTime; if (lightObj.lifeTime < 1.0f) { lightObj.light.intensity -= 0.5f * Time.deltaTime; } if (lightObj.lifeTime < 0.0f && lightObj.light.intensity <= 0) { lightObj.light.GetComponent <Rigidbody>().isKinematic = true; lightObj.light.gameObject.SetActive(false); workingLights.RemoveAt(i); freeLights.Add(lightObj); --numLights; --i; } } }
public LightObject Serialize() { LightObject sendObj = new LightObject(); sendObj.PutInt(0, seq); sendObj.PutInt(1, (int)eProtocolType); WriteLightObject(); return(sendObj); }
protected override void SceneInitialization(IContextState context, RenderEngine engine, ElementTag camera) { var smanager = Context.GetSystemManager(); smanager.CreateSystem <DefaultInputSystem>(); smanager.CreateSystem <ZoomToAllObjectsSystem>(); smanager.CreateSystem <MovingSystem>(); smanager.CreateSystem <CollidingSystem>(); smanager.CreateSystem <DefaultOrthographicCameraSystem>(); smanager.CreateSystem <LightsSystem>(); // smanager.CreateSystem<MovementSystem>(); // smanager.CreateSystem<EmptyAnimationSystem>(); // smanager.CreateSystem<MeshAnimationSystem>(); // smanager.CreateSystem<StickOnHeightMapSystem>(); // smanager.CreateSystem<ObjectMovementSystem>(); // smanager.CreateSystem<Systems.TerrainGeneratorSystem>(); // smanager.CreateSystem<Physics.Engine.PhysicalSystem>(); smanager .CreateSystem <RenderSystem>() .Init(engine.Graphics) // .CreateNested<SkyGradientColoringRenderTechnique>() // .CreateNested<SkyPlaneWithParallaxRenderTechnique>() // .CreateNested<TerrainRenderTechnique>()// //.CreateNested<Toolkit.D3D.CameraViews.CameraViewsRenderTechnique<CustomRenderProperties>>() //.CreateNested<OITTriangleColoredVertexRenderTechnique<ToolkitRenderProperties>>() .CreateNested <TriangleColoredVertexRenderTechnique <ToolkitRenderProperties> >() .CreateNested <TriangleTexturedVertexRenderTechnique <ToolkitRenderProperties> >() .CreateNested <LineVertexRenderTechnique <ToolkitRenderProperties> >() //.CreateNested<CudaTestTechniques<ToolkitRenderProperties>>() .CreateNested <SpherePointRenderTechnique <ToolkitRenderProperties> >() //.CreateNested<AminRenderTechniqueSystem>() ; //smanager // .CreateSystem<AminRenderSystem>() // .Init(device);Context var manager = Context.GetEntityManager(); cameraObject = CameraObject.UpdateOrthographic <RenderSystem>(camera, Context, Surface); LightObject.CreateAmbientLight(manager, 0.2f); //0.05f LightObject.CreateFollowCameraDirectLight(manager, System.Numerics.Vector3.UnitZ, 0.8f); //0.95f CoordinateSystem = CoordinateSystemLinesGameObject.Create(context, false); Loaded?.Invoke(); //VisualSphereObject.SphereGeo(Context, ElementTag.New($"Point"), new VisualSphereObject.Data { // Center = new Vector3(10, 20, 10), // Color = V4Colors.Yellow, // Radius = 10 //}); }
static IHtmlControl GetActualPublicationPanel(SiteState state) { return(new HPanel( Decor.Subtitle("Обсуждаемое").MarginBottom(10).MarginTop(5), new HGrid <RowLink>(context.LastPublicationComments, delegate(RowLink comment) { int topicId = comment.Get(MessageType.ArticleId); TopicStorage topic = null; string url = ""; if (context.News.ObjectById.Exist(topicId)) { topic = context.NewsStorages.ForTopic(topicId); url = UrlHlp.ShopUrl("news", topic?.TopicId); } else if (context.Articles.ObjectById.Exist(topicId)) { topic = context.ArticleStorages.ForTopic(topicId); url = UrlHlp.ShopUrl("article", topic?.TopicId); } if (topic == null || topic.Topic == null) { return new HPanel(); } int userId = comment.Get(MessageType.UserId); LightObject user = context.UserStorage.FindUser(userId); DateTime localTime = comment.Get(MessageType.CreateTime).ToLocalTime(); string replyUrl = string.Format("{0}#reply{1}", url, comment.Get(MessageType.Id)); return new HPanel( new HPanel( new HLabel(localTime.ToString("HH:mm")).MarginRight(5) .Title(localTime.ToString(Decor.timeFormat)), new HLabel(user?.Get(UserType.Login)) ), new HLink(url, topic.Topic.Get(TopicType.Title) ).MarginRight(5), new HLink( replyUrl, "", new HBefore().ContentIcon(13, 13).Background("/images/full.gif", "no-repeat", "bottom").VAlign(-2) //new HImage("/images/full.gif").VAlign(-2) ) //ViewNewsHlp.GetCommentElement(topic.MessageLink.AllRows.Length, url) ).MarginBottom(6); }, new HRowStyle() ).FontSize("90%") ).Padding(15, 15, 10, 15).MarginBottom(5).Background(Decor.pageBackground)); }
public override void Prepare() { KWEngine.LoadModelFromFile("AK47", @".\models\ak47.obj"); DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond; FOV = 90; SetAmbientLight(1, 1, 1, 0.5f); Player p = new Player(); p.SetModel("KWCube"); p.SetScale(1, 2, 1); p.SetPosition(0, 1, 0); p.IsCollisionObject = true; p.FPSEyeOffset = 0; AddGameObject(p); SetFirstPersonObject(p); Immovable floor = new Immovable(); floor.SetModel("KWCube"); floor.SetScale(50, 2, 50); floor.SetPosition(0, -1, 0); floor.IsCollisionObject = true; floor.IsShadowCaster = true; floor.SetTexture(@".\textures\sand_diffuse.dds"); floor.SetTextureRepeat(10, 10); AddGameObject(floor); Immovable shadowCaster = new Immovable(); shadowCaster.SetModel("KWCube"); shadowCaster.IsShadowCaster = true; shadowCaster.SetPosition(0, 3, 2); shadowCaster.SetScale(2); shadowCaster.SetTexture(@".\textures\mpanel_diffuse.dds"); AddGameObject(shadowCaster); SetFirstPersonObjectItemModel("AK47", true, true); SetFirstPersonObjectItemModelViewOffset(0.5f, -1, 0f); SetFirstPersonObjectItemModelRotation(0, 0, 0); SetFirstPersonObjectItemModelScale(1.25f); SetTextureSkybox(@".\textures\skybox3.dds"); LightObject l1 = new LightObject(LightType.Sun, true); l1.SetPosition(50, 100, 50); l1.SetColor(1, 0, 0, 5); //l1.SetDistanceMultiplier(10); AddLightObject(l1); //DebugShadowLight = l1; }
/// <summary> /// Fügt ein Lichtobjekt hinzu /// </summary> /// <param name="l">Objekt</param> public void AddLightObject(LightObject l) { if (!_lightObjects.Contains(l)) { _lightObjectsTBA.Add(l); } else { throw new Exception("This light already exists in this world."); } }
public static bool IsBanned(LightObject user) { DateTime?bannedUntil = user.Get(BasketballUserType.BannedUntil); if (bannedUntil != null && bannedUntil.Value > DateTime.UtcNow) { return(true); } return(false); }
public static bool NoRedactor(LightObject user) { DateTime?noRedactorUntil = user.Get(BasketballUserType.NotRedactorUntil); if (noRedactorUntil != null && noRedactorUntil.Value > DateTime.UtcNow) { return(true); } return(false); }
static IHtmlControl GetRedoAvatarPanel(LightObject user) { return(new HPanel( new HFileUploader("/avatarupload", "Выбрать аватар", user.Id), Decor.Button("Удалить аватар").MarginTop(5).Event("avatar_delete", "", delegate { File.Delete(UrlHlp.ImagePath(Path.Combine("users", user.Id.ToString(), "avatar.png"))); } ) ).MarginTop(5)); }
public static IHtmlControl AvatarBlock(LightObject user) { string imageUrl = UrlHlp.ImageUrl(string.Format("users/{0}/avatar.png", user.Id)); if (imageUrl.EndsWith("placeholder.png")) { imageUrl = UrlHlp.ImageUrl("no_avatar.gif"); } return(new HPanel().InlineBlock().Size(Decor.AvatarSize, Decor.AvatarSize) .Background(imageUrl, "no-repeat", "center").CssAttribute("background-size", "100%")); }
public LightLayer(string Name, LightObject custom, Canvas _Canvas) { name = Name; fig = custom; fig.parentLayer = this; theCanvas = _Canvas; tweenFig = new LightObject(true); type = 5; firstKF = 0; lastKF = 19; keyFrames = new List<KeyFrame>(); LightFrame first = new LightFrame(firstKF), last = new LightFrame(lastKF); foreach (StickJoint j in first.Joints) j.ParentFigure = fig; foreach (StickJoint j in last.Joints) j.ParentFigure = fig; keyFrames.Add(first); keyFrames.Add(last); }
internal static RhinoObject CreateRhinoObjectHelper(IntPtr pRhinoObject) { if (IntPtr.Zero == pRhinoObject) return null; uint sn = UnsafeNativeMethods.CRhinoObject_RuntimeSN(pRhinoObject); if (sn < 1) return null; int type = UnsafeNativeMethods.CRhinoRhinoObject_GetRhinoObjectType(pRhinoObject); if (type < 0) return null; RhinoObject rc; switch (type) { case idxCRhinoPointObject: //1 rc = new PointObject(sn); break; case idxCRhinoCurveObject: //2 rc = new CurveObject(sn); break; case idxCRhinoMeshObject: //3 rc = new MeshObject(sn); break; case idxCRhinoBrepObject: //4 rc = new BrepObject(sn); break; case idxCRhinoPointCloudObject: //5 rc = new PointCloudObject(sn); break; case idxCRhinoAnnotationTextObject: //6 rc = new TextObject(sn); break; case idxCRhinoSurfaceObject: //7 rc = new SurfaceObject(sn); break; case idxCRhinoInstanceObject: //8 rc = new InstanceObject(sn); break; case idxCRhinoHatchObject: //9 rc = new HatchObject(sn); break; case idxCRhinoDetailViewObject: //10 rc = new DetailViewObject(sn); break; case idxCRhinoClippingPlaneObject: //11 rc = new ClippingPlaneObject(sn); break; case idxCRhinoTextDot: //12 rc = new TextDotObject(sn); break; case idxCRhinoGripObject: //13 rc = new GripObject(sn); break; #if USING_V5_SDK case idxCRhinoExtrusionObject: //14 rc = new ExtrusionObject(sn); break; #endif case idxCRhinoLinearDimension: //15 rc = new LinearDimensionObject(sn); break; case idxCRhinoAnnotationObject: //16 rc = new AnnotationObjectBase(sn); break; case idxCRhinoLight: //17 rc = new LightObject(sn); break; case idxCRhinoMorphControl: //18 rc = new MorphControlObject(sn); break; case idxCRhinoRadialDimension: //19 rc = new RadialDimensionObject(sn); break; case idxCRhinoAngularDimension: //20 rc = new AngularDimensionObject(sn); break; default: rc = new RhinoObject(sn); break; } return rc; }