예제 #1
0
 public void HandleResponse(ISFSObject anObjectIn, GameLobbyManager ourGLM)
 {
     foreach (string playerName in anObjectIn.GetUtfStringArray("PlayerNameArray"))
     {
         ourGLM.getUserInterface().alterOnlinePlayerText(playerName);
     }
 }
        public void HandleResponse(ISFSObject anObjectIn, GameLobbyManager ourGLM)
        {
            //Define variables
            GameObject formationsPanel = ourGLM.createObject("UI/FormationsPanel");

            formationsPanel.name = "FormationsPanel";
            formationsPanel.transform.SetParent(GameObject.Find("Canvas").transform);
            formationsPanel.transform.localPosition = new Vector3();

            if (anObjectIn.GetInt("NumberOfFormations") > 0)
            {
                string[] formationButtonNames = anObjectIn.GetUtfStringArray("FormationNames");
                for (int i = 0; i < formationButtonNames.Length; i++)
                {
                    Transform aFormationButton = formationsPanel.transform.FindChild("New 1v1 Formation");
                    aFormationButton.GetComponentInChildren <Text>().text = formationButtonNames[i];
                    aFormationButton.name = formationButtonNames[i];

                    //Add Button Event Listener and Button to the ButtonDictionary
                    ourGLM.getUserInterface().getButtonDictionary().Add(aFormationButton.GetComponent <Button>(), new GetFormationButtonHandler());
                    aFormationButton.GetComponent <Button>().onClick.AddListener(() => { ourGLM.buttonClicked(aFormationButton.GetComponent <Button>()); });
                }
            }
        }
예제 #3
0
        public void HandleResponse(ISFSObject anObjectIn, GameLobbyManager ourGLM)
        {
            //Define variables
            GameObject  chatBox      = GameObject.Find("ChatContent");
            List <Text> chatTextList = ourGLM.getUserInterface().getChatTextLabel();

            chatTextList.Add(ourGLM.createObject("UI/ChatText").GetComponent <Text>());
            chatBox.GetComponent <RectTransform>().sizeDelta = new Vector2(0, chatTextList.Count * 20);

            //Determine the Y-Position for the Chat Content rect to look at
            int posY;

            if (chatBox.GetComponent <RectTransform>().rect.height > 250)
            {
                posY = (int)chatBox.GetComponent <RectTransform>().rect.height - 250;
            }
            else
            {
                posY = 0;
            }

            //Update ChatContent position
            chatBox.GetComponent <RectTransform>().localPosition = new Vector2(0, posY);

            //Create new Chat Messag to display
            chatTextList.Last().name = "ChatTextLabel " + chatTextList.Count;
            chatTextList.Last().text = anObjectIn.GetUtfString("ChatText");
            chatTextList.Last().rectTransform.SetParent(chatBox.GetComponent <RectTransform>());

            //Update position of all chat messages
            for (int i = 0; i < chatTextList.Count; i++)
            {
                chatTextList[i].rectTransform.offsetMin = new Vector2(9, -25 + (chatTextList.Count - i) * 20);
                chatTextList[i].rectTransform.offsetMax = new Vector2(0, -5 + (chatTextList.Count - i) * 20);
            }
        }
 public void HandleResponse(ISFSObject anObjectIn, GameLobbyManager ourGLM)
 {
     ourGLM.getUserInterface().alterOnlinePlayerText(anObjectIn.GetUtfString("PlayerName"));
 }