public void AddStoryTile(StoryData data) { Debug.Log("Add Story Tile"); RectTransform content = scrollView.content; float contentY = content.anchoredPosition.y; RectTransform tileTransfrom = Main.UIManager.InstantiateUI("UI/StoryTile", content); tileTransfrom.anchoredPosition = new Vector2(0, contentY); StoryTile storyTile = tileTransfrom.GetComponent <StoryTile>(); if (storyTile != null) { storyTile.SetStoryData(data); } }
public void AddNewStoryTile() { Debug.Log("Add New Story Tile"); RectTransform content = scrollView.content; RectTransform tileTransfrom = Main.UIManager.InstantiateUI("UI/StoryTile", content); tileTransfrom.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 50, tileTransfrom.sizeDelta.y); StoryTile storyTile = tileTransfrom.GetComponent <StoryTile>(); if (storyTile != null) { storyTile.SetStoryData(Main.storyDataManager.NewStory()); storyTile.onSelected.AddListener(StorySelected); } }