public void UpdateTweetViewSize(TweetView tweetView) { var tweetViewIndex = _instances.IndexOf(tweetView); if (tweetViewIndex < 0) { Debug.LogError("Can't find TweetView index"); return; } var nextTweetView = _instances[(tweetViewIndex + 1) % _instances.Count]; if (nextTweetView.transform.localPosition.y > tweetView.transform.localPosition.y) { return; } var diff = tweetView.transform.localPosition.y - tweetView.GetHeight() - nextTweetView.transform.localPosition.y; foreach (var instance in _instances) { if (instance == tweetView) { continue; } if (instance.transform.localPosition.y < tweetView.transform.localPosition.y) { instance.transform.Translate(Vector3.up * diff); } } }
public void OnTweetViewRemoved(TweetView tweetView) { var tweetViewIndex = _instances.IndexOf(tweetView); if (tweetViewIndex < 0) { Debug.LogError("Can't find TweetView index"); return; } var height = tweetView.GetHeight(); var border = tweetView.transform.localPosition.y; _instances.RemoveAt(tweetViewIndex); tweetView.DeinitTweet(); tweetView.PlayerCommentView.DeinitTweet(); _pool.ReturnObjectToPool(tweetView.GetComponent <PoolObject>()); var instanceOffset = Vector3.up * height; foreach (var instance in _instances) { if (instance.transform.localPosition.y < border) { instance.transform.Translate(instanceOffset); } } HideAllReplies(); }