本文整理汇总了C#中UnityEngine.UI.Text类的典型用法代码示例。如果您正苦于以下问题:C# Text类的具体用法?C# Text怎么用?C# Text使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Text类属于UnityEngine.UI命名空间,在下文中一共展示了Text类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start () {
//Scale our camera accordingly
gameOver = false;
//Set our time to normal speed
Time.timeScale = 1;
//Get our player
user = GameObject.Find ("Player").GetComponent<Player>();
//Get our Hud
hud = GameObject.FindGameObjectWithTag ("PlayerHUD").GetComponent<UnityEngine.UI.Text> ();
//get our bg music
bgFight = GameObject.Find ("BgSong").GetComponent<AudioSource> ();
deathSound = GameObject.Find ("Death").GetComponent<AudioSource> ();
deathPlayed = false;
//Defeated enemies is one for score calculation at start
defeatedEnemies = 0;
//Total spawned enemies is one because we check for it to spawn enemies, and zero would get it stuck
totalSpawnedEnemies = 0;
//Set score to zero
score = 0;
//Show our score and things
hud.text = ("Enemies Defeated: " + defeatedEnemies + "\nHighest Score: " + score);
//Spawn an enemies
//invokeEnemies ();
}
示例2: Start
void Start()
{
timerText = GameObject.Find("Play Timer").GetComponent<Text>();
canvas = this.GetComponent<Canvas>();
canvas.enabled = true;
}
示例3: Start
public void Start() {
palletCamera = Camera.main;
towerCostText = GetComponentInChildren<Text>();
transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
towerCostText.transform.SetParent(transform);
towerCostText.transform.localPosition = new Vector3(palletTextOffset, 0f, 0f);
}
示例4: Start
// Use this for initialization
void Start()
{
panelText = GetComponentInChildren<UnityEngine.UI.Text>();
if (currentConvo) {
currentNode = currentConvo.conversationXml.GetElementsByTagName("ContentNode")[0];
}
}
示例5: Start
// Use this for initialization
void Start()
{
if (this.player == null)
return;
this.stats_panel = transform.Find("Stats").gameObject;
this.undefined_panel = transform.Find("Undefined").gameObject;
this.name_text = transform.Find("Name").GetComponent<Text>();
this.defi_text = transform.Find("Defi").Find("Text").GetComponent<Text>();
this.name_text.text = this.player.Name;
this.defi_text.text = "Defi";
//this.manager = GameObject.Find("Manager").GetComponent<PhiManager>();
InstantiateSwungMen();
SetUpStats();
this.buy = transform.Find("Buy").GetComponent<Button>();
this.unlocked = Settings.Instance.Default_player.ContainsKey(this.player.UID);
if (this.unlocked)
{
this.undefined_panel.SetActive(false);
BoughtButton();
}
else
{
this.swungMen.SetActive(false);
}
}
示例6: InitGame
//Initializes the game for each level.
public void InitGame()
{
Instantiate (canvas);
mainCamera = GameObject.Find ("Main Camera 2");
//set Level number
levelNumber = GameObject.Find ("LevelNumber").GetComponent<Text> ();
levelNumber.text = "Level "+ level;
//player reference and lifeText setup
playerRef = GameObject.Find ("Player");
playerController = playerRef.GetComponent<PlayerController>();
playerController.score = score;
prePlayerLife = playerController.life;
levelImage = GameObject.Find ("LevelImage");
faderScreen = GameObject.Find ("FaderScreen");
Color.TryParseHexString ("#870000E4", out redSplashColor);
Color.TryParseHexString ("#001187E4", out blueSplashColor);
screenSplash = faderScreen.GetComponent<Image> ();
screenSplash.color = redSplashColor;
levelImage.SetActive (false);
faderScreen.SetActive (false);
playerLifeText = GameObject.Find ("LifePlayer").GetComponent<Text>();
playerScoreText = GameObject.Find ("ScorePlayer").GetComponent<Text>();
//Call the SetupScene function of the BoardManager script, pass it current level number.
boardScript.SetupScene(level);
allBlocks = GameObject.Find ("Blocks");
isGameOver=false;
InitLights();
}
示例7: SetStat
private void SetStat(Text text, Image icon, int statValue)
{
string statText = "";
if (statValue > 0)
{
statText = "+" + statValue.ToString();
SetColor(text, colorPositive);
SetColor(icon, colorPositive);
}
else if (statValue < 0)
{
statText = statValue.ToString();
SetColor(text, colorNegative);
SetColor(icon, colorNegative);
}
else
{
statText = "0";
SetColor(text, colorNeutral);
SetColor(icon, colorNeutral);
}
SetText(text, statText);
}
示例8: Start
// Use this for initialization
void Start () {
anim = GetComponent<Animator> ();
spellCanvas = GameObject.Find("Canvas Spell").GetComponent<Transform>();
spellCanvas.gameObject.SetActive (false);
spellText = spellCanvas.FindChild("Text").GetComponent<Text>();
spellText.font = GameManager.instance.readable_Font;
}
示例9: Awake
// Use this for initialization
public void Awake()
{
if (Instance != null)
{
Debug.Log("ScoreUI is already in play. Deleting old Instantiating new.");
Destroy(gameObject);
}
else
Instance = this;
pScore = 0;
aScore = 0;
fScore = 0;
WinnerScreen.enabled = false;
PlayerScore = GameObject.Find("PlayerScore").GetComponent<Text>();
AIScore = GameObject.Find("AIScore").GetComponent<Text>();
Speed = GameObject.Find("SpeedT").GetComponent<Text>();
TimeS = GameObject.Find("TimeP").GetComponent<Text>();
Bounces = GameObject.Find("BounceT").GetComponent<Text>();
SongName = GameObject.Find("SongNameT").GetComponent<Text>();
ScoresComplete = GameObject.Find("ScoresTXT").GetComponent<Text>();
Winn = GameObject.Find("Winner").GetComponent<Text>();
C_Score = "";
ScoresComplete.text = C_Score;
round = 0;
rA = 0;
rP = 0;
playTime = 0.0f;
bounces = 0;
StartCoroutine(timeSet());
}
示例10: Start
void Start()
{
m_text = gameObject.GetComponent<Text>();
m_text.color = m_myColour;
m_myWords = "Score!";
}
示例11: Init
protected override void Init()
{
uiText = GetComponent<Text>();
AddUpdater(enabledName, UpdateEnabled);
AddUpdater(textName, UpdateText);
AddUpdater(colorName, UpdateColor);
}
示例12: Start
void Start()
{
S = this;
this.uiScore = GetComponentInParent<UnityEngine.UI.Text>();
score = PlayerPrefs.GetInt("LevelScore");
this.DisplayScore();
}
示例13: InitGame
//Initializes the game for each level.
void InitGame()
{
//While doingSetup is true the player can't move, prevent player from moving while title card is up.
doingSetup = true;
//Get a reference to our image LevelImage by finding it by name.
levelImage = GameObject.Find("LevelImage");
//Get a reference to our text LevelText's text component by finding it by name and calling GetComponent.
levelText = GameObject.Find("LevelText").GetComponent<Text>();
//Set the text of levelText to the string "Day" and append the current level number.
levelText.text = "Da ritual beginz...";
//Set levelImage to active blocking player's view of the game board during setup.
levelImage.SetActive(true);
//Call the HideLevelImage function with a delay in seconds of levelStartDelay.
Invoke("HideLevelImage", levelStartDelay);
//Clear any Enemy objects in our List to prepare for next level.
enemies.Clear();
//Call the SetupScene function of the BoardManager script, pass it current level number.
boardScript.SetupScene(level);
}
示例14: Start
// Use this for initialization
void Start()
{
Game.Stopwatch.Reset();
Game.Stopwatch.Start();
text = GetComponent<UnityEngine.UI.Text>();
stringBuffer = new StringBuilder(8);
}
示例15: Start
private void Start()
{
m_FpsNextPeriod = Time.realtimeSinceStartup + fpsMeasurePeriod;
m_Text = GetComponent<Text>();
Debug.Log("Start FPS Measurement");
UnityAnalytics.StartFPSMeasurement();
}