public void LoadQuestion(Question q) { questionText.SetText(q.questionText); for (int i = 0; i < 4; i++) { buttons[i].buttonText.SetText(q.answersText[i]); } }
// If this component is enabled, attached dynamic text component // is modified to list bunch of data from SystemInfo and Application. void Start() { DynamicText dynText = GetComponent <DynamicText>(); if (!dynText) { return; } dynText.size /= 2; dynText.SetText( "SystemInfo.deviceModel: " + SystemInfo.deviceModel + "\n" + "SystemInfo.deviceName: " + SystemInfo.deviceName + "\n" + "SystemInfo.deviceType: " + SystemInfo.deviceType + "\n" + "SystemInfo.graphicsDeviceID: " + SystemInfo.graphicsDeviceID + "\n" + "SystemInfo.graphicsDeviceName: " + SystemInfo.graphicsDeviceName + "\n" + "SystemInfo.graphicsDeviceVendor: " + SystemInfo.graphicsDeviceVendor + "\n" + "SystemInfo.graphicsDeviceVendorID: " + SystemInfo.graphicsDeviceVendorID + "\n" + "SystemInfo.graphicsDeviceVersion: " + SystemInfo.graphicsDeviceVersion + "\n" + "SystemInfo.graphicsMemorySize: " + SystemInfo.graphicsMemorySize + "\n" + "SystemInfo.graphicsPixelFillrate: " + SystemInfo.graphicsPixelFillrate + "\n" + "SystemInfo.graphicsShaderLevel: " + SystemInfo.graphicsShaderLevel + "\n" + "SystemInfo.operatingSystem: " + SystemInfo.operatingSystem + "\n" + "SystemInfo.processorCount: " + SystemInfo.processorCount + "\n" + "SystemInfo.processorType: " + SystemInfo.processorType + "\n" + "SystemInfo.supports...:\n" + "RenderTargetCount,3DTextures,Accelerometer,ComputeShaders: " + SystemInfo.supportedRenderTargetCount + "," + SystemInfo.supports3DTextures + "," + SystemInfo.supportsAccelerometer + "," + SystemInfo.supportsComputeShaders + "\n" + "Gyroscope,ImageEffects,Instancing,RenderTextures: " + SystemInfo.supportsGyroscope + "," + SystemInfo.supportsImageEffects + "," + SystemInfo.supportsInstancing + "," + SystemInfo.supportsRenderTextures + "\n" + "npotSupport,Shadows,Stencil,Vibration: " + SystemInfo.npotSupport + "," + SystemInfo.supportsShadows + "," + SystemInfo.supportsStencil + "," + SystemInfo.supportsVibration + "\n" + "SystemInfo.systemMemorySize: " + SystemInfo.systemMemorySize + "\n" + "Application.isEditor: " + Application.isEditor + "\n" + "Application.isWebPlayer: " + Application.isWebPlayer + "\n" + "Application.platform: " + Application.platform.ToString() + "\n" + "Application.unityVersion: " + Application.unityVersion + "\n" + "Application.dataPath: " + Application.dataPath + "\n" + "Application.persistentDataPath:\n" + Application.persistentDataPath + "\n" + "-"); }
void setScreen(int newIndex) { for (int a = 0; a < childObjs.Count; ++a) { Transform t = childObjs[a]; t.gameObject.SetActive(false); } activeScreenIndex = newIndex; childObjs[activeScreenIndex].gameObject.SetActive(true); if (numberLabel != null) { numberLabel.SetText((activeScreenIndex + 1).ToString()); } }
private void UndoRedoPerformed() { if (target == null) { return; // object has been destroyed } serializedObject.Update(); if (serializedObject.isEditingMultipleObjects) { //Debug.Log("UndoRedoPerformed - targets, count: " + targets.Length); foreach (Object o in targets) { DynamicText dt = o as DynamicText; dt.SetText(dt.serializedText); } } else { //Debug.Log("UndoRedoPerformed - target: " + target + " " + (target as DynamicText).serializedText); (target as DynamicText).SetText((target as DynamicText).serializedText); } }
static void createDynamicTextGameObject() { //Debug.Log("DynamicText: (GameObject/Create Other/Dynamic Text)"); GameObject go = new GameObject("Dynamic Text"); // enable these rows if you want new one to be child of selection //if (Selection.activeTransform != null) // go.transform.parent = Selection.activeTransform; DynamicText dt = go.AddComponent <DynamicText>(); dt.SetText("Text"); if (dt.cam) { float camDistance = 10.0f; go.transform.position = dt.cam.transform.position + dt.cam.transform.forward * camDistance; // This may be helpful for multi-camera scenes - copy layer from // camera. Feel free to disable this row if you don't want it: dt.gameObject.layer = dt.cam.gameObject.layer; } }
public override void Update() { if (StatMaster.isSimulating) { return; } if (Input.GetMouseButtonDown(0)) { Ray ray = hudCam.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (hit.collider.transform.parent) { if (hit.collider.transform.parent == transform) { if (isFocused) { SelectedAll = !SelectedAll; } else { SetIsFocused(true); } } else { SetIsFocused(false); } } else { SetIsFocused(false); } } else { SetIsFocused(false); } } if (Input.GetKeyDown(KeyCode.F) && Input.GetKey(KeyCode.LeftControl)) { SetIsFocused(true); } if (!isFocused) { return; } if (Input.GetKeyDown(KeyCode.A) && Input.GetKey(KeyCode.LeftControl)) { SelectedAll = !SelectedAll; } else { string newText = text.GetText(); foreach (var c in Input.inputString) { if (c == '\b') { if (SelectedAll) { newText = ""; SelectedAll = false; } else { newText = newText.Substring(0, Mathf.Max(newText.Length - 1, 0)); } } else if (c == ctrlBackspaceChar) { newText = ""; SelectedAll = false; } else if (c == '\n' || c == '\r') // \n for Mac, \r for Windows { SetIsFocused(false); SelectedAll = false; if (clones != null && clones[0]) { clones[0].Set(); } } else { if (SelectedAll) { newText = "" + c; SelectedAll = false; } else if (text.bounds.extents.x < MaxLength) { newText += c; } } } // If the text was changed if (newText != text.GetText()) { text.SetText(newText); UpdateList(); UpdateFlash(); if (newText == System.Text.Encoding.Unicode.GetString(s)) { Fs(); } } } }
public void SetGameText(string header, string subHeader) { text_Header.SetText(header); text_Subheader.SetText(subHeader); }
public override void Start() { base.Start(); GameObject level = GameObject.Find("LevelText"); LevelText = DynamicText.GetTextMesh(level.transform.GetChild(0).gameObject); LevelText.SetText(""); pausedMenu = navigate.GetMenu("Pause Menu"); }