public override bool DrawSubContainer(int currentFrame, vBugBaseWindow parent) { VerticalActivitySlice slice = VerticalSliceDatabase.GetSlice(currentFrame); bool succes = false; if (slice != null && slice.humanInput != null && slice.humanInput.providersData != null) { foreach (HumanInputProviderData provider in slice.humanInput.providersData) { if (provider == null) continue; if (provider.providerType == "XBoxControllerInputProvider" && provider.basicInput != null) { DrawVirtualController(provider, parent); succes = true; break; } } } if (!succes) EditorHelper.DrawNA(new Rect(0, 0, parent.position.width, parent.position.height), "XBox controller data not available"); return true; }
public virtual bool DrawSubContainer(int currentFrame, vBugBaseWindow parent) { throw new NotImplementedException(); }
public virtual bool DrawMainContainer(Rect mainRect, int currentFrame, vBugBaseWindow parent) { throw new NotImplementedException(); }
private void DrawVirtualController(HumanInputProviderData data, vBugBaseWindow parent) { //Rect xboxRect = VisualResources.DrawXBoxControllerBG(); }
private void DrawVirtualKeyboard(HumanInputProviderData data, vBugBaseWindow parent) { Texture2D normal = VisualResources.keyboardNormal; Texture2D down = VisualResources.keyboardDown; Texture2D hold = VisualResources.keyboardHold; Texture2D up = VisualResources.keyboardUp; float x = 0; float y = 0; float halfHeight = buttonSizeY / 2; Rect minRect = GUILayoutUtility.GetRect(parent.position.width, (spacing + buttonSizeY) * (layout.Length + 1)); float maxWidth = buttonSizeX * 17.5f; float startX = (minRect.width / 2f) - (maxWidth / 2f); float startY = minRect.y + (halfHeight); GUIStyle style = EditorHelper.styleLabelKeyboard; for (int r = 0; r < layout.Length; r++) { Key[] row = layout[r]; for (int e = 0; e < row.Length; e++) { Key key = row[e]; float width = Mathf.Floor(buttonSizeX * key.scale); if (e == row.Length - 1) width = maxWidth - x; if (!string.IsNullOrEmpty(key.primLabel) && key.primCode != KeyCode.None) { Rect btnRect = new Rect(startX + x, startY + y, width, buttonSizeY); VisualResources.DrawTexture(btnRect, GetKeyColor(key.primCode, key.secCode, data, normal, down, hold, up)); if(!string.IsNullOrEmpty(key.secLabel)) { GUI.contentColor = new Color(0.75f, 0.75f, 0.75f); GUI.Label(new Rect(startX + x, startY + y, width, halfHeight), key.secLabel, style); GUI.contentColor = Color.white; GUI.Label(new Rect(startX + x, startY + y + halfHeight, width, halfHeight), key.primLabel, style); } else { GUI.Label(btnRect, key.primLabel, style); } } x += width + spacing; } x = 0; y += buttonSizeY + spacing; } }