Hi everyone,
I’m making a dialog system whereby the user is shown a series of dialog boxes one after each other. Each dialog box contains a background texture, a player avatar and some text. I used the GUILayout system to display each dialog box. When a new box is added, I fade it in and then after some predefined time I fade it out and finally remove it from the screen. The last step I require is to move the boxes underneath the one deleted smoothly to the top.
Can anyone show how to do this please? This is the current code to display the dialog boxes;
GUILayout.BeginArea(_dialogBounds);
GUILayout.BeginVertical();
for(int i = 0; i < _dialogBoxes.Count; i++){
GUI.color = _dialogBoxes[i].Color;
float boxWidth = _dialogBounds.width - (i * _indentation);
dialogStyle.margin.left = i * _indentation;
GUILayout.BeginHorizontal(dialogStyle, GUILayout.MaxWidth(boxWidth));
_dialogBoxes[i].CurrentRectangle = GUILayoutUtility.GetLastRect();
GUILayout.Box(_dialogBoxes[i].Avatar, dialogImageStyle);
Components.Label(GUILayoutUtility.GetRect(new GUIContent(_dialogBoxes[i].Text), dialogLabelStyle), _dialogBoxes[i].Text, dialogLabelStyle, true, false);
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
GUILayout.EndArea();
This is the current output;