public void alterOnlinePlayerText(string playerName) { //Define variables GameObject onlinePlayerBox = GameObject.Find("OnlinePlayerContent"); //Check if the player exists, that means we need to remove it if (onlinePlayerDictionary.Keys.Contains(playerName)) { ourGLM.destroyObject(playerName + " Text Label"); onlinePlayerDictionary.Remove(playerName); } else { onlinePlayerDictionary.Add(playerName, ourGLM.createObject("UI/ChatText").GetComponent <Text>()); onlinePlayerBox.GetComponent <RectTransform>().sizeDelta = new Vector2(0, onlinePlayerDictionary.Count * 20); onlinePlayerDictionary[playerName].name = playerName + " Text Label"; onlinePlayerDictionary[playerName].text = playerName; onlinePlayerDictionary[playerName].rectTransform.SetParent(onlinePlayerBox.GetComponent <RectTransform>()); } //Update position of all PlayerNames int i = 0; foreach (string key in onlinePlayerDictionary.Keys) { onlinePlayerDictionary[key].rectTransform.offsetMin = new Vector2(9, -5 + i * 20); onlinePlayerDictionary[key].rectTransform.offsetMax = new Vector2(0, 15 + i * 20); //onlinePlayerDictionary[key].rectTransform.localPosition = new Vector2(0, i * 20); i++; } }
public void HandleResponse(ISFSObject anObjectIn, GameLobbyManager ourGLM) { //Remove formationsPanel ourGLM.destroyObject("FormationsPanel"); //Draw Halfboard ourGLM.getGameManager().drawHexGrid(5); }