当前位置: 首页>>代码示例>>C#>>正文


C# UI.Text类代码示例

本文整理汇总了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 ();
		}
开发者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


注:本文中的UnityEngine.UI.Text类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。