Skip to content

Instantly share code, notes, and snippets.

@JonRurka
Last active August 29, 2015 14:10
Show Gist options
  • Save JonRurka/11df75b2c93da1c07d87 to your computer and use it in GitHub Desktop.
Save JonRurka/11df75b2c93da1c07d87 to your computer and use it in GitHub Desktop.
[Serializable]
public struct REPLInfo
{
public int ID;
public string Name;
public List<string> Text;
public Vector2 ScrollPos;
public REPLInfo(int id, string name)
{
ID = id;
Name = name;
Text = new List<string>();
ScrollPos = new Vector2();
}
public void AddText(string text)
{
Text.Add("> " + text);
}
public void SetScrollPos(Vector2 newPos)
{
ScrollPos = newPos;
DConsole.Log("Scoll bar pos set to " + newPos + ", " + ScrollPos);
}
public override string ToString()
{
string result = string.Empty;
foreach (string str in Text)
{
result += str + "\n";
}
return result;
}
}
public List<REPLInfo> PlayerREPL = new List<REPLInfo>();
void Start () {
PlayerREPL.Add(new REPLInfo(PlayerREPL.Count, GameManager.Instance.PlayerName));
DConsole.Log(PlayerREPL[0].ScrollPos);
PlayerREPL[0].SetScrollPos(new Vector2(1, 1));
DConsole.Log(PlayerREPL[0].ScrollPos);
}
--Log output--
(0٫0, 0٫0)
Scoll bar pos set to (1٫0, 1٫0), (1٫0, 1٫0)
(0٫0, 0٫0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment