void Start() { guiTextCom = GetComponent<GUIText>(); // Register for Koreography Events. This sets up the callback. Koreographer.Instance.RegisterForEventsWithTime(eventID, UpdateText); }
void OnEnable() { gui = GetComponent<GUIText>(); logQueue = new Queue<string>(); stringBuilder = new StringBuilder(); // Application.RegisterLogCallback(LogCallback); }
void Start() { _MainPlayer = MyPlayerController.Instance; _Log = gameObject.AddComponent<GUIText>(); _Log.transform.localPosition = new Vector3(0.1f, 0.9f, 0); _Log.text = CalculateVertexes(); _Log.fontSize = 24; Input.gyro.enabled = true; }
static public int get_pixelOffset(IntPtr l) { try { UnityEngine.GUIText self = (UnityEngine.GUIText)checkSelf(l); pushValue(l, true); pushValue(l, self.pixelOffset); return(2); } catch (Exception e) { return(error(l, e)); } }
void Start () { if (!DebugSettings.inFlightInfo && !DebugSettings.startInOrbit) { gameObject.SetActive(false); return; } guiText = gameObject.GetComponent<GUIText> (); guiText.transform.position = new Vector3 (0.82f, 0.94f, 0f); vessel = FlightGlobals.ActiveVessel; guiText.text = "no vessel"; }
static public int constructor(IntPtr l) { try { UnityEngine.GUIText o; o=new UnityEngine.GUIText(); pushValue(l,true); pushValue(l,o); return 2; } catch(Exception e) { return error(l,e); } }
static public int get_fontStyle(IntPtr l) { try { UnityEngine.GUIText self = (UnityEngine.GUIText)checkSelf(l); pushValue(l, true); pushEnum(l, (int)self.fontStyle); return(2); } catch (Exception e) { return(error(l, e)); } }
public static int constructor(IntPtr l) { try { UnityEngine.GUIText o; o=new UnityEngine.GUIText(); pushValue(l,o); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } }
static public int constructor(IntPtr l) { try { UnityEngine.GUIText o; o = new UnityEngine.GUIText(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
public void SetColors(Color[] listKinfOfColors, GUIText[] listPointsGuiText, GameObject[] listObjectsShield, GameObject[] listObjectsAliens, GameObject ground, Renderer player, GameObject[] listRocks) { if (ScreenColors) { Camera.main.backgroundColor = listKinfOfColors[0]; ground.renderer.material.color = listKinfOfColors[1]; player.material.color = listKinfOfColors[2]; listPointsGuiText[0].color = listKinfOfColors[1]; listPointsGuiText[1].color = listKinfOfColors[1]; listPointsGuiText[2].color = listKinfOfColors[2]; foreach (GameObject item in listObjectsShield) { item.renderer.material.color = listKinfOfColors[1]; } foreach (GameObject item in listObjectsAliens) { item.renderer.material.color = listKinfOfColors[2]; } foreach (GameObject item in listRocks) { item.renderer.material.color = listKinfOfColors[1]; } } else { Camera.main.backgroundColor = Color.black; ground.renderer.material.color = Color.white; player.material.color = Color.white; foreach (GUIText item in listPointsGuiText) { item.color = Color.white; } foreach (GameObject item in listObjectsShield) { item.renderer.material.color = Color.white; } foreach (GameObject item in listObjectsAliens) { item.renderer.material.color = Color.white; } foreach (GameObject item in listRocks) { item.renderer.material.color = Color.white; } } }
private void Awake() { if (Debug.isDebugBuild) { DontDestroyOnLoad(this.gameObject); } else { Destroy(this.gameObject); } m_FpsNextPeriod = Time.realtimeSinceStartup + UPDATE_INTERVAL; m_GUIText = GetComponent<GUIText>(); }
static public int set_fontStyle(IntPtr l) { try { UnityEngine.GUIText self = (UnityEngine.GUIText)checkSelf(l); UnityEngine.FontStyle v; checkEnum(l, 2, out v); self.fontStyle = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_material(IntPtr l) { try { UnityEngine.GUIText self = (UnityEngine.GUIText)checkSelf(l); UnityEngine.Material v; checkType(l, 2, out v); self.material = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_anchor(IntPtr l) { try { UnityEngine.GUIText self = (UnityEngine.GUIText)checkSelf(l); UnityEngine.TextAnchor v; checkEnum(l, 2, out v); self.anchor = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_tabSize(IntPtr l) { try { UnityEngine.GUIText self = (UnityEngine.GUIText)checkSelf(l); float v; checkType(l, 2, out v); self.tabSize = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_pixelOffset(IntPtr l) { try { UnityEngine.GUIText self = (UnityEngine.GUIText)checkSelf(l); UnityEngine.Vector2 v; checkType(l, 2, out v); self.pixelOffset = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static void GUIText_pixelOffset(JSVCall vc) { if (vc.bGet) { UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; var result = _this.pixelOffset; JSApi.setVector2S((int)JSApi.SetType.Rval, result); } else { UnityEngine.Vector2 arg0 = (UnityEngine.Vector2)JSApi.getVector2S((int)JSApi.GetType.Arg); UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; _this.pixelOffset = arg0; } }
static void GUIText_anchor(JSVCall vc) { if (vc.bGet) { UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; var result = _this.anchor; JSApi.setEnum((int)JSApi.SetType.Rval, (int)result); } else { UnityEngine.TextAnchor arg0 = (UnityEngine.TextAnchor)JSApi.getEnum((int)JSApi.GetType.Arg); UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; _this.anchor = arg0; } }
static void GUIText_tabSize(JSVCall vc) { if (vc.bGet) { UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; var result = _this.tabSize; JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result)); } else { System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg); UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; _this.tabSize = arg0; } }
static void GUIText_fontSize(JSVCall vc) { if (vc.bGet) { UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; var result = _this.fontSize; JSApi.setInt32((int)JSApi.SetType.Rval, (System.Int32)(result)); } else { System.Int32 arg0 = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg); UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; _this.fontSize = arg0; } }
static void GUIText_fontStyle(JSVCall vc) { if (vc.bGet) { UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; var result = _this.fontStyle; JSApi.setEnum((int)JSApi.SetType.Rval, (int)result); } else { UnityEngine.FontStyle arg0 = (UnityEngine.FontStyle)JSApi.getEnum((int)JSApi.GetType.Arg); UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; _this.fontStyle = arg0; } }
static void GUIText_richText(JSVCall vc) { if (vc.bGet) { UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; var result = _this.richText; JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result)); } else { System.Boolean arg0 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg); UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; _this.richText = arg0; } }
// fields // properties static void GUIText_text(JSVCall vc) { if (vc.bGet) { UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; var result = _this.text; JSApi.setStringS((int)JSApi.SetType.Rval, result); } else { System.String arg0 = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg); UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; _this.text = arg0; } }
static void GUIText_font(JSVCall vc) { if (vc.bGet) { UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; var result = _this.font; JSMgr.datax.setObject((int)JSApi.SetType.Rval, result); } else { UnityEngine.Font arg0 = (UnityEngine.Font)JSMgr.datax.getObject((int)JSApi.GetType.Arg); UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; _this.font = arg0; } }
static void GUIText_material(JSVCall vc) { if (vc.bGet) { UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; var result = _this.material; JSMgr.datax.setObject((int)JSApi.SetType.Rval, result); } else { UnityEngine.Material arg0 = (UnityEngine.Material)JSMgr.datax.getObject((int)JSApi.GetType.Arg); UnityEngine.GUIText _this = (UnityEngine.GUIText)vc.csObj; _this.material = arg0; } }
// Use this for initialization void Start() { translation = locaKey; textMesh = this.GetComponent<TextMesh>(); textDisplay = this.GetComponent<GUIText>(); if(textMesh != null) { textMesh.text = translation; } if(textDisplay != null) { textDisplay.text = translation; } }
static int get_guiText(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.Component obj = (UnityEngine.Component)o; UnityEngine.GUIText ret = obj.guiText; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index guiText on a nil value" : e.Message)); } }
static int get_guiText(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.GameObject obj = (UnityEngine.GameObject)o; UnityEngine.GUIText ret = obj.guiText; ToLua.PushSealed(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index guiText on a nil value")); } }
public override Status Update () { // Get the gui text if (m_GUIText == null || m_GUIText.gameObject != gameObject.Value) m_GUIText = gameObject.Value != null ? gameObject.Value.GetComponent<GUIText>() : null; // Validate members if (m_GUIText == null) return Status.Error; // Set Color #if !UNITY_4_0_0 && !UNITY_4_1 if (!newColor.isNone) m_GUIText.color = newColor.Value; #else if (!newColor.isNone) m_GUIText.material.color = newColor.Value; #endif return Status.Success; }
protected void Awake() { GameLog._LogText = new string[this.LogLines]; GameLog._LogLines = this.LogLines; if (this.LogLabel == null) { this.LogLabel = this.gameObject.GetComponent<GUIText>(); if (this.LogLabel == null) { this.LogLabel = this.gameObject.AddComponent<GUIText>(); GameLog._LogLabel = this.LogLabel; } } else { GameLog._LogLabel = this.LogLabel; } GameLog._LogLabel.anchor = TextAnchor.LowerLeft; GameLog._LogLabel.alignment = TextAlignment.Left; GameLog._LogLabel.fontSize = 32; GameLog._LogLabel = this.LogLabel; }
public void Awake() { if (TxtLines == null) { TxtLines = new string[TxtLinesCount]; TxtLineEdit = 0; }// fi if (LogEnable) { // Try to find panel for debugoutput. DbgOut.TxtDebug = null; // GameObject goGUI = GameObject.Find("GUI"); // if (goGUI == null){ // DbgOut.Log("DbgOut.Awake - no GUI object retrieved."); // } else { Transform transTxt = this.gameObject.transform.Find(GUITextName); if (transTxt != null) { DbgOut.TxtDebug = transTxt.GetComponent<GUIText>(); DbgOut.Log(null); // I. e. rebuild possibly existing debug text. }// fi // }// fi }// fi }// Awake
// PRIVATE STATIC //-------------------------------------- // Methods //-------------------------------------- ///<summary> /// Use this for initialization ///</summary> void Start () { // _bowlingBallPrefabStateComponent = GetComponent<BowlingBallPrefabStateComponent>(); GameObject scoreGUIText_gameobject = GameObject.Find ("ScoreGUIText"); _score_guitext = scoreGUIText_gameobject.GetComponent<GUIText>(); // _bowlingPinPrefabs_gameobject = GameObject.FindGameObjectsWithTag ("BowlingPinPrefabTag"); }
public static CommandDelegate AlphaBy(GUIText text, float offset, double duration, CommandEase ease = null) { CheckArgumentNonNull(text, "text"); return ChangeBy(text.ToAlphaRef(), offset, duration, ease); }
public static CommandDelegate TintTo(GUIText text, Color endColour, double duration, CommandEase ease = null) { CheckArgumentNonNull(text, "text"); return TintTo(text.ToColorRef(), endColour, duration, ease); }
private void Internal_SetPixelOffset(Vector2 p) { GUIText.INTERNAL_CALL_Internal_SetPixelOffset(this, ref p); }
private static void CheckTextNonNull(GUIText text) { if (text == null) { throw new ArgumentNullException("text"); } }
public void SetShow( bool newShowVal ) { if (newShowVal) { if (line == null || hat == null ) { lineObj = new GameObject("vecdrawLine"); hatObj = new GameObject("vecdrawHat"); labelObj = new GameObject("vecdrawLabel", typeof(GUIText) ); line = lineObj.AddComponent<LineRenderer>(); hat = hatObj.AddComponent<LineRenderer>(); label = labelObj.guiText; line.useWorldSpace = false; hat.useWorldSpace = false; GetShipCenterCoords(); line.material = new Material(Shader.Find("Particles/Additive")); hat.material = new Material(Shader.Find("Particles/Additive")); // This is how font loading would work if other fonts were available in KSP: // Font lblFont = (Font)Resources.Load( "Arial", typeof(Font) ); // SafeHouse.Logger.Log( "lblFont is " + (lblFont == null ? "null" : "not null") ); // _label.font = lblFont; label.fontSize = 12; label.text = labelStr; label.anchor = TextAnchor.MiddleCenter; PutAtShipRelativeCoords(); RenderValues(); } updateHandler.AddObserver( this ); line.enabled = true; hat.enabled = true; label.enabled = true; } else { updateHandler.RemoveObserver( this ); if (label != null) { label.enabled = false; label = null; } if (hat != null) { hat.enabled = false; hat = null; } if (line != null) { line.enabled = false; line = null; } labelObj = null; hatObj = null; lineObj = null; } enable = newShowVal; }
/// <summary> /// Texts the wrap. /// </summary> /// <param name="guiText">Unity text block.</param> /// <param name="lineWidth">Width of the line.</param> public static void TextWrap(GUIText guiText, int lineWidth) { string text = guiText.text; // This will check if text wrapping is necessary or if it is supported. var textSize = guiText.GetScreenRect(); if (textSize.width <= lineWidth || !text.Contains(" ")) { guiText.text = text; return; } // Split the string into separate words var words = text.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); var result = words[0] + " "; for (int i = 1; i < words.Length; ++i) { // Temporary store text with current word. var word = words[i]; string tempSting = result + word + " "; // Calculate new size for GUI text component. guiText.text = tempSting; textSize = guiText.GetScreenRect(); // Use temporary text if it fits otherwise add a new line before current word. if (textSize.width > lineWidth) { result += "\n" + word + " "; } else { result = tempSting; } } // Show result on screen guiText.text = result; }
void Awake() { livesTxt = transform.FindChild("Lives").GetComponent<GUIText>(); scoreTxt = transform.FindChild("Score").GetComponent<GUIText>(); }
// PRIVATE /// <summary> /// _dos the set brittle references. /// /// NOTE: For simplicity, this brittle approach is used instead of alternatives; /// * public transform references, set via dragging from hierarchy items /// * Inversion Of Control (StrangeIoC) where less GameObject-to-GameObject references are needed. /// * Manager dynamically spawning via Instantiate() /// * Etc... /// /// /// NOTE: We could shift this code to a newly created GUIManager. For now its fine. /// /// /// </summary> private void _doSetBrittleReferences() { _scoreGUIText = _doThrowErrorIfNull (GameObject.Find (MainConstants.ScoreGUIText).GetComponent<GUIText>()) as GUIText; _scoreGUIText2 = _doThrowErrorIfNull (GameObject.Find (MainConstants.ScoreGUIText2).GetComponent<GUIText>()) as GUIText; _livesGUIText = _doThrowErrorIfNull (GameObject.Find (MainConstants.LivesGUIText).GetComponent<GUIText>()) as GUIText; _livesGUIText2 = _doThrowErrorIfNull (GameObject.Find (MainConstants.LivesGUIText2).GetComponent<GUIText>()) as GUIText; _promptGUIText = _doThrowErrorIfNull (GameObject.Find (MainConstants.PromptGUIText).GetComponent<GUIText>()) as GUIText; _promptGUIText2 = _doThrowErrorIfNull (GameObject.Find (MainConstants.PromptGUIText2).GetComponent<GUIText>()) as GUIText; }
void RemoveLine(GUIText text) { lines.Remove(text); text.gameObject.Destroy(); }
// Use this for initialization void Start() { textgui = GetComponent<GUIText>(); }
IEnumerator Fade(GUIText text) { float counter = 0; yield return new WaitForSeconds(LifeTime); while (counter < FadeOutTime && text != null) { counter += Time.deltaTime; text.SetColor((1 - (counter / FadeOutTime)) * Alpha, "A"); yield return null; } if (text != null) { text.SetColor(0, "A"); RemoveLine(text); } }
///<summary> /// Use this for initialization ///</summary> override protected void Start () { base.Start(); _healthGUIText = healthGUIText_gameobject.GetComponent<GUIText>(); _healthGUIText2 = healthGUIText2_gameobject.GetComponent<GUIText>(); _scoreGUIText = scoreGUIText_gameObject.GetComponent<GUIText>(); _scoreGUIText2 = scoreGUIText2_gameObject.GetComponent<GUIText>(); _promptGUIText = promptGUIText_gameObject.GetComponent<GUIText>(); _promptGUIText2 = promptGUIText2_gameObject.GetComponent<GUIText>(); _fpsGUIText = fpsGUIText_gameObject.GetComponent<GUIText>(); //CLEAR PROMPT BEFORE ITS FIRST USE _setPromptText (""); }
void showDebugLabel() { if (DebugSettings.labelMagnitudes) { if (debugLabel == null) { var obj = new GameObject ("VectorGraphic debug label"); obj.transform.parent = transform; debugLabel = obj.AddComponent<GUIText> (); } debugLabel.enabled = true; debugLabel.transform.position = EditorLogic.fetch.editorCamera.WorldToViewportPoint (endPoint); if (value.magnitude > 0f) { Vector3 lever = RCSBuildAid.ReferenceMarker.transform.position - transform.position; float angle = Vector3.Angle(lever, value) * Mathf.Deg2Rad; // debugLabel.text = String.Format ("force: {0:0.##}\nlever: {1:0.##}\nsin: {2:0.##}", // value.magnitude, lever.magnitude, Mathf.Sin (angle)); debugLabel.text = string.Format(value.magnitude.ToString("0.##")); } else { debugLabel.text = String.Empty; } } else { if (debugLabel != null) { debugLabel.enabled = false; } } }
// PRIVATE STATIC //-------------------------------------- // Methods //-------------------------------------- ///<summary> /// Use this for initialization ///</summary> override protected void Start () { base.Start(); // GameObject scoreGUIText_gameobject = GameObject.Find ("ScoreGUIText"); _score_guitext = scoreGUIText_gameobject.GetComponent<GUIText>(); // _bowlingPinPrefabs_gameobject = GameObject.FindGameObjectsWithTag ("BowlingPinPrefabTag"); }
private static extern void INTERNAL_CALL_Internal_SetPixelOffset(GUIText self, ref Vector2 p);
public static CommandDelegate AlphaFrom(GUIText text, float startAlpha, double duration, CommandEase ease = null) { CheckArgumentNonNull(text, "text"); return ChangeFrom(text.ToAlphaRef(), startAlpha, duration, ease); }
private void Start() { m_FpsNextPeriod = Time.realtimeSinceStartup + fpsMeasurePeriod; m_GuiText = GetComponent<GUIText>(); }
void Start() { ball = GameObject.Find("Sphere").transform; guiText = GameObject.Find("GUI Text").guiText; }
private static void INTERNAL_CALL_Internal_SetPixelOffset(GUIText self, ref Vector2 p) { throw new NotImplementedException("ăȘă«ăă"); }
private static extern void INTERNAL_CALL_Internal_SetPixelOffset(GUIText self, ref Vector2 p);
/// <summary> /// This will process tags, wrap text and scale sizes to match resolutions. /// </summary> /// <param name="guiText">Unity text block.</param> /// <param name="lineWidth">Width of the line used for text wrapping. (ignored if allowTextWrapping is false)</param> /// <param name="allowTextWrapping">Allow text wrapping.</param> /// <param name="autoScale">Auto scale font and line sizes.</param> /// <param name="smallFontSize">Size of the small font.</param> /// <param name="processTags">Process custom tags.</param> /// <see cref="TextWrap" /> /// <see cref="ProcessTags"/> public static void ProcessText(GUIText guiText, int lineWidth = 400, bool allowTextWrapping = true, bool autoScale = true, int smallFontSize = 9, bool processTags = true) { // Scale according screen resolution. if (autoScale) { lineWidth = (int)(lineWidth * Initialize.Scale); smallFontSize = (int)(smallFontSize * Initialize.Scale); guiText.fontSize = (int)(guiText.fontSize * Initialize.Scale); } // Process custom tags. if (processTags) { guiText.text = ProcessTags(guiText.text, smallFontSize); } // Process text wrapping. if (allowTextWrapping) { TextWrap(guiText, lineWidth); } }