GitHub PullRequestReviewCommentEvent at 2014-02-12 22:19:00
Repository: sp-main
Actor: MattDease
Payload: {"comment":{"url":"https://api.github.com/repos/MattDease/sp-main/pulls/comments/9688933","id":9688933,"diff_hunk":"@@ -17,133 +17,190 @@ private var connectionErrorMsg : String = \"\";\n private var guiObject : GuiClasses [];\n private var guiStatusBar: GuiClasses;\n private var status;\n-var menuSkin : GUISkin;\n-var backTexture : Texture2D;\n+private var menuSkin : GUISkin;\n+private var backTexture : Texture2D;\n+private var refreshTexture : Texture2D;\n+private var createNewOverlayTexture : Texture2D;\n+private var backgroundTexutre : Texture2D;\n \n-function Awake(){\n+private var buttonText = 40;\n+private var bodyText = 50;\n+\n+\n+function Awake() {\n     netScript = GetComponent(Net);\n }\n \n-function Start(){\n+function Start() {\n     menuScript = Menu.script;\n     playerScript = menuScript.playerScript;\n \n     menuSkin = Resources.Load(\"MenuSkin\", GUISkin);\n     backTexture = Resources.Load(\"Textures/gui/back\", Texture2D);\n+    refreshTexture = Resources.Load(\"Textures/gui/refresh\", Texture2D);\n \n-    guiObject = new GuiClasses[4];\n-    for (var y=0; y<guiObject.length; y++){\n+    guiObject = new GuiClasses[5];\n+    for (var y = 0; y < guiObject.length; y++) {\n         guiObject[y] = new GuiClasses();\n     }\n \n     guiStatusBar = new GuiClasses();\n+    backgroundTexutre = Resources.Load(\"Textures/gui/mainMenuBackground\", Texture2D);\n+    createNewOverlayTexture = Resources.Load(\"Textures/gui/createNewOverlay\", Texture2D);\n+\n }\n \n-function OnGUI (){\n-    if(!showMenu){\n+function OnGUI() {\n+    if (!showMenu) {\n         return;\n     }\n+    GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), backgroundTexutre);\n+\n     GUI.skin = menuSkin;\n \n     //Back Button\n-    guiObject[1].textureWidth = Screen.width*0.08;\n-    guiObject[1].textureHeight = Screen.height*0.2;\n+    guiObject[1].textureWidth = Screen.width * 0.08;\n+    guiObject[1].textureHeight = Screen.height * 0.2;\n     guiObject[1].pointLocation = Points.TopLeft;\n     guiObject[1].updateLocation();\n \n-    if(GUI.Button(Rect(guiObject[1].offset.x + Screen.width*0.01,guiObject[1].offset.y - Screen.height*0.01,Screen.width*0.08,Screen.height*0.2), backTexture)){\n+    var labelStyle: GUIStyle = GUI.skin.GetStyle(\"JoinGame\");\n+    labelStyle.fontSize = menuScript.getScale() * buttonText;\n+\n+    if (GUI.Button(Rect(guiObject[1].offset.x + Screen.width * 0.01, guiObject[1].offset.y - Screen.height * 0.01, Screen.width * 0.08, Screen.height * 0.2), backTexture, \"FullImage\")) {\n         leaveFor(menus.main);\n     }\n \n-    guiStatusBar.textureWidth = Screen.width*1;\n-    guiStatusBar.textureHeight = Screen.height*0.147;\n-    guiStatusBar.pointLocation = Points.Center;\n-    guiStatusBar.updateLocation();\n-\n-    //Status Bar\n-    GUI.Box(Rect(guiStatusBar.offset.x + Screen.width*0.01,guiStatusBar.offset.y,Screen.width*0.98,Screen.height*0.12), \"\"+status);\n-\n     //Refresh Button\n     guiObject[0].textureWidth = 170;\n     guiObject[0].textureHeight = 20;\n     guiObject[0].pointLocation = Points.Center;\n     guiObject[0].updateLocation();\n \n-    if(GUI.Button(Rect(guiObject[0].offset.x,guiObject[0].offset.y - 150,170,20),\"Refresh List\")){\n+    if (GUI.Button(Rect(Screen.width - Screen.width * 0.09, guiObject[1].offset.y - Screen.height * 0.01, Screen.width * 0.08, Screen.height * 0.2), refreshTexture, \"FullImage\")) {\n         netScript.FetchHostList(true);\n     }\n \n-    if(GUI.Button(Rect(guiObject[0].offset.x,guiObject[0].offset.y - 130,170,20),\"Toggle Host Filtering\")){\n-        filterHosts = !filterHosts;\n-    }\n-\n-    if(isConnecting){\n-        status=\"Connecting...\";\n-    }\n-\n-    if(connectionErrorMsg){\n-        GUILayout.Label(connectionErrorMsg);\n-    }\n+    // if(connectionErrorMsg){\n+    //     GUILayout.Label(connectionErrorMsg);\n+    // }\n+    //Center for JoinGame Button\n+    guiObject[3].textureWidth = (Screen.width * 1.3) * 0.2;\n+    guiObject[3].textureHeight = Screen.width * 0.2;\n+    guiObject[3].pointLocation = Points.Center;\n+    guiObject[3].updateLocation();\n \n     netScript.FetchHostList(false);\n     hostList = netScript.GetHostList(filterHosts);\n \n-    if(GUI.Button(Rect(guiObject[0].offset.x,guiObject[0].offset.y - 100,170,20),\"\"+(filterHosts ? \"Connectable\" : \"All\") + \" Hosted Games:\")){}\n-    if(hostList.Count){\n-        for (var element : HostData in hostList){\n-            GUILayout.BeginHorizontal();\n-            var name : String = element.gameName + \" \" + element.connectedPlayers + \" / \" + element.playerLimit;\n-            GUILayout.Label(name);\n-            GUILayout.Space(5);\n-            var hostInfo : String = \"[\";\n-            for (var host : String in element.ip){\n-                hostInfo = hostInfo + host + \":\" + element.port + \" \";\n-            }\n-            hostInfo += \"]\";\n-            GUILayout.Label(hostInfo);\n-            GUILayout.Space(5);\n-            GUILayout.FlexibleSpace();\n-            if (Network.peerType == NetworkPeerType.Disconnected && GUI.Button(Rect(guiObject[0].offset.x,guiObject[0].offset.y - 80,170,20),\"Connect\")){\n-                Debug.Log(onConnect);\n-                netScript.connect(element, onConnect);\n-                connectionErrorMsg = \"\";\n-                isConnecting = true;\n+    if (hostList.Count) {\n+        var index = 0;\n+        for (var element: HostData in hostList) {\n+\n+            var name: String = element.gameName + \"\\n\\n \" + element.connectedPlayers + \" / \" + element.playerLimit;\n+\n+            var f_connected: float = element.connectedPlayers;\n+            var f_playerLimit: float = element.playerLimit;\n+            var gamePercentage = f_connected / f_playerLimit;\n+\n+            //TODO: Temp just showing the first five. Need to add some logic in here.\n+            switch (index) {\n+            case 0:\n+\n+                if (Network.peerType == NetworkPeerType.Disconnected && GUI.Button(Rect(guiObject[3].offset.x, guiObject[3].offset.y - guiObject[3].offset.y / 1.4, (Screen.width * 1.3) * 0.2, Screen.width * 0.2), name, \"JoinGame\")) {\n+                    Debug.Log(onConnect);","path":"Assets/Scripts/Menu/LobbyMenu.js","position":146,"original_position":146,"commit_id":"6daef70753523dd1cfc84c91b90cb61e040f7f9e","original_commit_id":"6daef70753523dd1cfc84c91b90cb61e040f7f9e","user":{"login":"MattDease","id":636957,"avatar_url":"https://gravatar.com/avatar/7a61b9759664f6af47cf5d78b256b713?d=https%3A%2F%2Fidenticons.github.com%2F17934630b3cbab43f4e508331a69f17d.png&r=x","gravatar_id":"7a61b9759664f6af47cf5d78b256b713","url":"https://api.github.com/users/MattDease","html_url":"https://github.com/MattDease","followers_url":"https://api.github.com/users/MattDease/followers","following_url":"https://api.github.com/users/MattDease/following{/other_user}","gists_url":"https://api.github.com/users/MattDease/gists{/gist_id}","starred_url":"https://api.github.com/users/MattDease/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MattDease/subscriptions","organizations_url":"https://api.github.com/users/MattDease/orgs","repos_url":"https://api.github.com/users/MattDease/repos","events_url":"https://api.github.com/users/MattDease/events{/privacy}","received_events_url":"https://api.github.com/users/MattDease/received_events","type":"User","site_admin":false},"body":"Remove Debug.Log calls","created_at":"2014-02-12T22:19:00Z","updated_at":"2014-02-12T22:19:00Z","html_url":"https://github.com/MattDease/sp-main/pull/16#discussion_r9688933","pull_request_url":"https://api.github.com/repos/MattDease/sp-main/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/MattDease/sp-main/pulls/comments/9688933"},"html":{"href":"https://github.com/MattDease/sp-main/pull/16#discussion_r9688933"},"pull_request":{"href":"https://api.github.com/repos/MattDease/sp-main/pulls/16"}}}}