private void OnGUI() { GUI.DrawTexture(new Rect(Screen.width / 2 - 32, Screen.height / 2 - 32, 64, 64), TargetIcon); if (isShow) { int x = 0; int y = 0; int yOffset = 0; GUI.Box(new Rect(200, 80, 520, 180), "Items"); for (int j = 0; j < mCraftCategory.allTiles.Count; j++) { // Get Tile from current cateogry tiles uteRuntimeBuilder.Tile tile = (uteRuntimeBuilder.Tile)mCraftCategory.allTiles[j]; if (GUI.Button(new Rect(210 + (x * 125), 120 + (y * 125) + yOffset, 120, 125), tile.name)) { // Set selected tile for building runtimeBuilder.SetCurrentTile(tile.mainObject); // Hide list ShowOrHideUI(); } // Draw Tile preview texture GUI.DrawTexture(new Rect(215 + (x * 125), 130 + (y * 125) + yOffset, 110, 110), tile.preview); // Show tile name GUI.Label(new Rect(254 + (x * 125), 100 + (y * 125) + yOffset, 120, 125), tile.name); x++; if (x == 8) { x = 0; y++; } } yOffset += 125; x = 0; } if (!isiOSExample) { GUI.Label(new Rect(Screen.width / 2 + 110, Screen.height - 40, 200, 30), "Press TAB"); } if (Input.mousePosition.y < 150) { return; } // Show/Hide items if (GUI.Button(new Rect(Screen.width / 2 - 100, Screen.height - 60, 200, 50), "Inventory")) { ShowOrHideUI(); } }
private void OnGUI() { GUI.skin = skin; //GUI.Label(new Rect(10,10,100,40),"Build Mode: "+runtimeBuilder.GetCurrentBuildMode()); if (isShow) { int x = 0; int y = 0; int yOffset = 0; GUI.Box(new Rect(0, 80, 1050, 750), "Tiles"); for (int i = 0; i < allCategories.Count; i++) { if (allCategories[i].name.Equals("Street") || allCategories[i].name.Equals("Street_dynamic")) { for (int j = 0; j < allCategories[i].allTiles.Count; j++) { // Get Tile from current cateogry tiles uteRuntimeBuilder.Tile tile = (uteRuntimeBuilder.Tile)allCategories[i].allTiles[j]; GUI.Box(new Rect(10 + (x * 125), 100 + (y * 175) + yOffset, 120, 175), tile.name); if (GUI.Button(new Rect(10 + (x * 125), 240 + (y * 175) + yOffset, 120, 30), "BUY")) { // Set selected tile for building runtimeBuilder.SetCurrentTile(tile.mainObject); // Hide list isShow = false; } // Draw Tile preview texture GUI.DrawTexture(new Rect(15 + (x * 125), 125 + (y * 175) + yOffset, 110, 110), tile.preview); // Show tile name //GUI.Label(new Rect(14+(x*125),100+(y*175)+yOffset,120,125),tile.name); x++; if (x == 8) { x = 0; y++; } } yOffset += 175; x = 0; } } } // Show/Hide items if (GUI.Button(new Rect(450, Screen.height - 70, 200, 70), "ITEMS")) { if (isShow) { isShow = false; } else { isShow = true; // Cancel current Tile runtimeBuilder.CancelCurrentTile(); } } if (GUI.Button(new Rect(10, Screen.height - 70, 200, 70), "Mass Build")) { runtimeBuilder.SetBuildMode(uteRuntimeBuilder.BuildMode.Mass); } if (GUI.Button(new Rect(220, Screen.height - 70, 200, 70), "Normal Build")) { runtimeBuilder.SetBuildMode(uteRuntimeBuilder.BuildMode.Normal); } if (GUI.Button(new Rect(Screen.width - 200, Screen.height - 70, 200, 70), "Rotate")) { runtimeBuilder.RotateCurrentTileLeft(); } }