Inheritance: MonoBehaviour
 internal Wallpaper(int id, string name, string path, WallHelper.WallpaperStyle? wallpaperStyle)
 {
     this.ID = path.GetHashCode();
     this.Name = name;
     this.Path = path;
     this.WallpaperStyle = wallpaperStyle;
 }
 public TileNode(GameObject tile, WallHelper north, WallHelper east, WallHelper south, WallHelper west)
 {
     this.tile  = tile.GetComponent <TileHelper>();
     this.north = north;
     this.east  = east;
     this.south = south;
     this.west  = west;
 }
 public TileNode(GameObject tile, GameObject north, GameObject east, GameObject south, GameObject west)
 {
     this.tile  = tile.GetComponent <TileHelper>();
     this.north = north.GetComponent <WallHelper>();
     this.east  = east.GetComponent <WallHelper>();
     this.south = south.GetComponent <WallHelper>();
     this.west  = west.GetComponent <WallHelper>();
 }
    //// Use this for initialization
    //void Start()
    //{

    //}

    //// Update is called once per frame
    //void Update()
    //{

    //}
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        WallHelper wall = (WallHelper)target;

        if (GUILayout.Button("Toggle wall"))
        {
            wall.ChangeToggle();
        }

        EditorUtility.SetDirty(target);
    }
    public void BuildMaze()
    {
        maze = new TileNode[width, height];
        GameObject mazeFloorTilesParent = GameObject.Find("MazeTiles");

        GameObject wall       = Instantiate(wallPrefab);
        Vector3    wallScale  = wall.transform.localScale;
        float      wallWidth  = wallScale.x;
        float      wallHeight = wallScale.y;
        float      wallLength = wallScale.z;

        DestroyImmediate(wall);
        Vector3 currentlocation = Vector2.zero;
        Vector3 rowStart        = currentlocation;

        for (int j = 0; j < height; j++)
        {
            currentlocation = rowStart;
            for (int i = 0; i < width; i++)
            {
                WallHelper north = SafeCheckIfWallExists(i, j, Vector2.up);
                WallHelper east  = SafeCheckIfWallExists(i, j, Vector2.right);
                WallHelper south = SafeCheckIfWallExists(i, j, Vector2.down);
                WallHelper west  = SafeCheckIfWallExists(i, j, Vector2.left);
                GameObject tile  = (GameObject)PrefabUtility.InstantiatePrefab(floorPrefab);
                tile.transform.localScale = new Vector3(wallLength, .4f, wallLength);
                tile.transform.SetParent(mazeFloorTilesParent.transform);
                tile.transform.localPosition = currentlocation + new Vector3(0, -.2f, 0);
                tile.name = tile.transform.localPosition.ToString();
                if (north == null)
                {
                    north = MakeNewWall(currentlocation + new Vector3(0f, 0f, -wallLength / 2f), 90f).GetComponent <WallHelper>();
                }
                if (east == null)
                {
                    east = MakeNewWall(currentlocation + new Vector3(wallLength / 2f, 0f, 0f), 0f).GetComponent <WallHelper>();
                }
                if (south == null)
                {
                    south = MakeNewWall(currentlocation + new Vector3(0f, 0f, wallLength / 2f), 90f).GetComponent <WallHelper>();
                }
                if (west == null)
                {
                    west = MakeNewWall(currentlocation + new Vector3(-wallLength / 2f, 0f, 0f), 0f).GetComponent <WallHelper>();
                }

                TileNode currentTile = new TileNode(tile, north, east, south, west);
                currentlocation += new Vector3(1f, 0f, 0f) * wallLength;
                maze[i, j]       = currentTile;
            }
            rowStart = rowStart + new Vector3(0f, 0f, -1f) * wallLength;
        }
    }
    public WallHelper GetWall(Vector2 direction)
    {
        if (direction.x != 0 && direction.y != 0 || direction.magnitude == 0)
        {
            Debug.LogError("Bad direction passed into GetWall");
            return(null);
        }
        direction.Normalize();
        WallHelper wall = direction.x == 1 ? east : direction.x == -1 ? west : direction.y == 1 ? north : south;

        return(wall);
    }
    public void Initialize()
    {
        Walls = FindObjectOfType <WallHelper>();

        WallNodeManagers = new WallNodeManager[4];
        for (int i = 0; i < 4; i++)
        {
            WallNodeManagers[i] = Walls.Walls[i].GetComponent <WallNodeManager>();
        }

        _randomWallIndexes.Shuffle();
        LaserManager.Initialize();
    }
Exemple #8
0
        protected override void CreateChildControls()
        {
            if (string.IsNullOrEmpty(ContextPath))
            {
                return;
            }

            var contextNode = Node.LoadNode(ContextPath);

            if (contextNode == null)
            {
                return;
            }

            int commentCount;
            int likeCount;
            var markupStr = WallHelper.GetCommentControlMarkup(contextNode, out commentCount, out likeCount);

            this.Controls.Add(new Literal {
                Text = markupStr
            });

            this.ChildControlsCreated = true;
        }
Exemple #9
0
        protected override void CreateChildControls()
        {
            if (this.ContextNode == null)
            {
                return;
            }

            if (ShowExecutionTime)
            {
                Timer.Start();
            }

            var control = Page.LoadControl("/Root/Global/renderers/Wall/Wall.ascx");

            this.Controls.Add(control);

            _workspaceIsWallContainer = control.FindControlRecursive("WorkspaceIsWallContainer") as PlaceHolder;
            var portletContextNodeLink = control.FindControlRecursive("PortletContextNodeLink") as System.Web.UI.WebControls.HyperLink;
            var configureWorkspaceWall = control.FindControlRecursive("ConfigureWorkspaceWall") as Button;

            if (_workspaceIsWallContainer != null && configureWorkspaceWall != null)
            {
                _workspaceIsWallContainer.Visible = false;

                var ws = this.ContextNode as Workspace;
                if (ws != null && !ws.IsWallContainer && ws.Security.HasPermission(PermissionType.Save))
                {
                    _workspaceIsWallContainer.Visible = true;
                    if (portletContextNodeLink != null)
                    {
                        portletContextNodeLink.Text        = ws.DisplayName;
                        portletContextNodeLink.NavigateUrl = ws.Path;
                    }

                    configureWorkspaceWall.Click += ConfigureWorkspaceWall_Click;
                }
            }

            var postsPlaceholder = control.FindControlRecursive("Posts");

            List <PostInfo> posts;

            using (new OperationTrace("Wall - Gather posts"))
            {
                var postInfos = GatherPosts();
                posts = postInfos == null ? new List <PostInfo>() : postInfos.Take(PageSize).ToList();
            }
            using (new OperationTrace("Wall - Posts markup"))
            {
                postsPlaceholder.Controls.Add(new Literal {
                    Text = WallHelper.GetWallPostsMarkup(this.ContextNode.Path, posts)
                });
            }

            if (ShowExecutionTime)
            {
                Timer.Stop();
            }

            base.CreateChildControls();
            this.ChildControlsCreated = true;
        }
Exemple #10
0
        protected override void CreateChildControls()
        {
            if (this.ContextNode == null)
            {
                return;
            }

            if (ShowExecutionTime)
            {
                Timer.Start();
            }

            // gather posts for this content
            List <PostInfo> posts;

            posts = DataLayer.GetPostsForContent(this.ContextNode).ToList();

            string postsMarkup;

            postsMarkup = WallHelper.GetWallPostsMarkup(this.ContextNode.Path, posts);

            CommentInfo contentCommentInfo;
            LikeInfo    contentLikeInfo;

            var settings = new QuerySettings()
            {
                EnableAutofilters = FilterStatus.Disabled
            };
            var allCommentsAndLikes = ContentQuery.Query(ContentRepository.SafeQueries.InTreeAndTypeIs, settings,
                                                         this.ContextNode.Path, new[] { "Comment", "Like" }).Nodes.ToList();

            var commentNodeTypeId = NodeType.GetByName("Comment").Id;
            var likeTypeId        = NodeType.GetByName("Like").Id;

            var commentsForPost         = allCommentsAndLikes.Where(c => c.NodeTypeId == commentNodeTypeId).ToList();
            var likesForPostAndComments = allCommentsAndLikes.Where(l => l.NodeTypeId == likeTypeId).ToList();
            var likesForPost            = likesForPostAndComments.Where(l => RepositoryPath.GetParentPath(RepositoryPath.GetParentPath(l.Path)) == this.ContextNode.Path).ToList();

            var commentMarkupStr = WallHelper.GetCommentMarkupStr();

            // get comments for this content
            contentCommentInfo = new CommentInfo(commentsForPost, likesForPostAndComments, commentMarkupStr);

            // get likes for this content
            contentLikeInfo = new LikeInfo(likesForPost, this.ContextNode.Id);

            var markupStr = WallHelper.GetContentWallMarkup(
                this.ContextNode,
                contentCommentInfo.HiddenCommentsMarkup,
                contentCommentInfo.CommentsMarkup,
                contentCommentInfo.CommentCount,
                contentLikeInfo,
                postsMarkup);

            this.Controls.Add(new Literal {
                Text = markupStr
            });

            if (ShowExecutionTime)
            {
                Timer.Stop();
            }

            base.CreateChildControls();
            this.ChildControlsCreated = true;
        }
Exemple #11
0
        protected override void CreateChildControls()
        {
            if (this.ContextNode == null)
            {
                return;
            }

            if (ShowExecutionTime)
            {
                Timer.Start();
            }

            // gather posts for this content
            List <PostInfo> posts;

            using (new OperationTrace("Wall - Gather posts"))
            {
                posts = DataLayer.GetPostsForContent(this.ContextNode).ToList();
            }
            string postsMarkup;

            using (new OperationTrace("Wall - Posts markup"))
            {
                postsMarkup = WallHelper.GetWallPostsMarkup(this.ContextNode.Path, posts);
            }

            CommentInfo contentCommentInfo;
            LikeInfo    contentLikeInfo;

            using (new OperationTrace("Wall - Gather content comments"))
            {
                var commentsAndLikesQuery = "+TypeIs:(Comment Like) +InTree:\"" + this.ContextNode.Path + "\"";
                var settings = new QuerySettings()
                {
                    EnableAutofilters = false
                };
                var allCommentsAndLikes = ContentQuery.Query(commentsAndLikesQuery, settings).Nodes.ToList();

                var commentNodeTypeId = NodeType.GetByName("Comment").Id;
                var likeTypeId        = NodeType.GetByName("Like").Id;

                var commentsForPost         = allCommentsAndLikes.Where(c => c.NodeTypeId == commentNodeTypeId).ToList();
                var likesForPostAndComments = allCommentsAndLikes.Where(l => l.NodeTypeId == likeTypeId).ToList();
                var likesForPost            = likesForPostAndComments.Where(l => RepositoryPath.GetParentPath(RepositoryPath.GetParentPath(l.Path)) == this.ContextNode.Path).ToList();

                var commentMarkupStr = WallHelper.GetCommentMarkupStr();

                // get comments for this content
                contentCommentInfo = new CommentInfo(commentsForPost, likesForPostAndComments, commentMarkupStr);

                // get likes for this content
                contentLikeInfo = new LikeInfo(likesForPost, this.ContextNode.Id);
            }

            using (new OperationTrace("Wall - Content comments markup"))
            {
                var markupStr = WallHelper.GetContentWallMarkup(
                    this.ContextNode,
                    contentCommentInfo.HiddenCommentsMarkup,
                    contentCommentInfo.CommentsMarkup,
                    contentCommentInfo.CommentCount,
                    contentLikeInfo,
                    postsMarkup);

                this.Controls.Add(new Literal {
                    Text = markupStr
                });
            }

            if (ShowExecutionTime)
            {
                Timer.Stop();
            }

            base.CreateChildControls();
            this.ChildControlsCreated = true;
        }
Exemple #12
0
        protected override void CreateChildControls()
        {
            if (this.ContextNode == null)
            {
                return;
            }

            if (ShowExecutionTime)
            {
                Timer.Start();
            }

            System.Web.UI.Control control = null;
            try
            {
                var viewHead = NodeHead.Get(ControlPath);
                if (viewHead != null && SecurityHandler.HasPermission(viewHead, PermissionType.RunApplication))
                {
                    control = Page.LoadControl(ControlPath);
                    this.Controls.Add(control);
                }
            }
            catch (Exception ex)
            {
                SnLog.WriteException(ex);
                this.Controls.Add(new System.Web.UI.LiteralControl(ex.Message));
                return;
            }

            if (control == null)
            {
                return;
            }

            _workspaceIsWallContainer = control.FindControlRecursive("WorkspaceIsWallContainer") as PlaceHolder;
            var portletContextNodeLink = control.FindControlRecursive("PortletContextNodeLink") as System.Web.UI.WebControls.HyperLink;
            var configureWorkspaceWall = control.FindControlRecursive("ConfigureWorkspaceWall") as Button;

            if (_workspaceIsWallContainer != null && configureWorkspaceWall != null)
            {
                _workspaceIsWallContainer.Visible = false;

                var ws = this.ContextNode as Workspace;
                if (ws != null && !ws.IsWallContainer && ws.Security.HasPermission(PermissionType.Save))
                {
                    _workspaceIsWallContainer.Visible = true;
                    if (portletContextNodeLink != null)
                    {
                        portletContextNodeLink.Text        = System.Web.HttpUtility.HtmlEncode(Content.Create(ws).DisplayName);
                        portletContextNodeLink.NavigateUrl = ws.Path;
                    }

                    configureWorkspaceWall.Click += ConfigureWorkspaceWall_Click;
                }
            }

            var postsPlaceholder = control.FindControlRecursive("Posts");

            List <PostInfo> posts;

            var postInfos = GatherPosts();

            posts = postInfos == null ? new List <PostInfo>() : postInfos.Take(PageSize).ToList();

            postsPlaceholder.Controls.Add(new Literal {
                Text = WallHelper.GetWallPostsMarkup(this.ContextNode.Path, posts)
            });

            if (ShowExecutionTime)
            {
                Timer.Stop();
            }

            base.CreateChildControls();
            this.ChildControlsCreated = true;
        }
    public bool isConnected(Vector2 direction)
    {
        WallHelper wall = GetWall(direction);

        return(wall == null? false : !wall.IsToggled());
    }
 public Wallpaper(string name, string path, WallHelper.WallpaperStyle? wallpaperStyle) : this(path.GetHashCode(), name, path, wallpaperStyle)
 { }