本文整理汇总了C#中UnityEngine.UI.Text类的典型用法代码示例。如果您正苦于以下问题:C# Text类的具体用法?C# Text怎么用?C# Text使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Text类属于UnityEngine.UI命名空间,在下文中一共展示了Text类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 ();
}
开发者ID:julianpoy,项目名称:HackPoly2016,代码行数:34,代码来源:GameManager.cs
示例2: Start
void Start()
{
timerText = GameObject.Find("Play Timer").GetComponent<Text>();
canvas = this.GetComponent<Canvas>();
canvas.enabled = true;
}
开发者ID:JonathanHunter,项目名称:CardNinjas,代码行数:7,代码来源:CardTimer.cs
示例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);
}
开发者ID:dwinings,项目名称:ggj16_team_winings,代码行数:7,代码来源:TowerPallet.cs
示例4: Start
// Use this for initialization
void Start()
{
panelText = GetComponentInChildren<UnityEngine.UI.Text>();
if (currentConvo) {
currentNode = currentConvo.conversationXml.GetElementsByTagName("ContentNode")[0];
}
}
开发者ID:drcaramelsyrup,项目名称:quasaria,代码行数:8,代码来源:Panel.cs
示例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);
}
}
开发者ID:CanPayU,项目名称:SuperSwungBall,代码行数:28,代码来源:ChallengeController.cs
示例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();
}
开发者ID:Danton19,项目名称:DrillUnity,代码行数:30,代码来源:GameManager.cs
示例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);
}
开发者ID:MitchLindsay,项目名称:red-havoc,代码行数:26,代码来源:TilePreview.cs
示例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;
}
开发者ID:AaronClaros,项目名称:Pray-for-Play,代码行数:8,代码来源:PlayerActions.cs
示例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());
}
开发者ID:joouur,项目名称:3DPONG,代码行数:34,代码来源:ScoreUI.cs
示例10: Start
void Start()
{
m_text = gameObject.GetComponent<Text>();
m_text.color = m_myColour;
m_myWords = "Score!";
}
开发者ID:patferguson,项目名称:Storms-Project,代码行数:7,代码来源:AnnouncerText.cs
示例11: Init
protected override void Init()
{
uiText = GetComponent<Text>();
AddUpdater(enabledName, UpdateEnabled);
AddUpdater(textName, UpdateText);
AddUpdater(colorName, UpdateColor);
}
开发者ID:K-Yoshiki,项目名称:menko,代码行数:7,代码来源:ViewText.cs
示例12: Start
void Start()
{
S = this;
this.uiScore = GetComponentInParent<UnityEngine.UI.Text>();
score = PlayerPrefs.GetInt("LevelScore");
this.DisplayScore();
}
开发者ID:e-ucm,项目名称:QuizDemo,代码行数:7,代码来源:Score.cs
示例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);
}
开发者ID:Kulgann,项目名称:SGJ2016,代码行数:28,代码来源:GameManager.cs
示例14: Start
// Use this for initialization
void Start()
{
Game.Stopwatch.Reset();
Game.Stopwatch.Start();
text = GetComponent<UnityEngine.UI.Text>();
stringBuffer = new StringBuilder(8);
}
开发者ID:SirJson,项目名称:BerlinMiniJamNov15,代码行数:8,代码来源:UIStopwatch.cs
示例15: Start
private void Start()
{
m_FpsNextPeriod = Time.realtimeSinceStartup + fpsMeasurePeriod;
m_Text = GetComponent<Text>();
Debug.Log("Start FPS Measurement");
UnityAnalytics.StartFPSMeasurement();
}
开发者ID:Dawnwoodgames,项目名称:LotsOfTowers,代码行数:7,代码来源:FPSCounter.cs
示例16: Start
/// <summary>
/// Initialises the script
/// </summary>
void Start()
{
m_backText = GetComponent<UnityEngine.UI.Text>();
m_frontText = transform.GetChild(0).GetComponent<UnityEngine.UI.Text>();
m_backText.text = "";
m_frontText.text = "";
}
开发者ID:ActionAtSea,项目名称:action-at-sea,代码行数:10,代码来源:GUIGameState.cs
示例17: ButtonObject
public ButtonObject(string buttonImageFileName, string text, Action onClick)
{
Go = Resources.Load(Settings.Instance.PREFAB_PATH + "Button") as GameObject;
// Go.SetActive(false);
Go = GameObject.Instantiate<GameObject>(Go);
_image = Go.GetComponent<Image>();
Sprite sprite = Resources.Load<Sprite>(Settings.Instance.UI_IMAGE_PATH + buttonImageFileName);
if (_image && sprite)
{
_image.sprite = sprite;
}
else
{
Debug.Log("Do not find image file");
}
_text = Go.GetComponentInChildren<Text>();
_text.text = text;
_button = Go.GetComponent<Button>();
if(_button)
{
_button.onClick.AddListener(new UnityEngine.Events.UnityAction(onClick));
}
}
开发者ID:weimingtom,项目名称:SVNovelEngine,代码行数:28,代码来源:ButtonObject.cs
示例18: Change
void Change()
{
if (textUI == null) {
textUI = this.GetComponent<UnityEngine.UI.Text> ();
}
textUI.text = textBefore+Texts.GetText(whatIsThis)+textAfter;
}
开发者ID:yarus777,项目名称:PingPong,代码行数:7,代码来源:LangItem.cs
示例19: WriteText
IEnumerator WriteText()
{
char[] charsToWrite = fullText.ToCharArray();
Text[] characters = new Text[charsToWrite.Length];
for (int i = 0; i < charsToWrite.Length; i++)
{
characters[i] = CreateCharacter(charsToWrite[i]).GetComponent<Text>();
characters[i].color = Color.clear;
Parent(characters[i].gameObject, characterHolder);
}
for (int i = 0; i < charsToWrite.Length; i++)
{
float timer = 0;
while ((timer += Time.deltaTime) < secondsPerCharacter)
{
yield return null;
}
//Parent(CreateCharacter(charsToWrite[i]), characterHolder);
if (soundEnabled && !SILENT_CHARACTERS.Contains(charsToWrite[i]))
{
sound.Stop();
sound.PlaySong(0);
}
characters[i].color = new Color(255, 255, 255, characterAlpha);
}
Destroy(this.gameObject, lingerDuration);
yield break;
}
开发者ID:JonathanHunter,项目名称:Nullptr,代码行数:28,代码来源:TextWriter.cs
示例20: Start
void Start()
{
var b = gameObject.GetComponent<Button>();
_label = GetComponentInChildren<Text>();
_label.text = ConnectiveType.GetText();
b.onClick.AddListener(() => Click());
}
开发者ID:Harriet92,项目名称:TemporalRPGSystem,代码行数:7,代码来源:ConnectiveComponent.cs
注:本文中的UnityEngine.UI.Text类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论