Inheritance: UnityEngine.UI.MaskableGraphic, ILayoutElement
示例#1
1
 public static void Fade(Text element, float fadeTo, float fadeAfter, float timeToFade)
 {
     DOTween.Sequence()
         .AppendInterval(fadeAfter)
         .Append(element.DOFade(fadeTo, timeToFade)
         .SetEase(Ease.InOutExpo));
 }
    void VisualizeDirectories(DirectoryInfo path)
    {
        foreach (Transform item in dirPanel)
        {
            GameObject.Destroy(item.gameObject);
        }
        directoryField.text = path.FullName;
        //float buttonPosition = -buttonSpacing;
        float buttonPosition = AddParentPathButton(-buttonSpacing, path);

        foreach (var dir in GetDirectories(path))
        {
            GameObject buttonObject = Instantiate(dirButton, Vector3.zero, Quaternion.identity) as GameObject;
            buttonObject.SetActive(true);
            buttonObject.transform.SetParent(dirPanel);
            buttonObject.transform.localPosition = new Vector3(0, buttonPosition);
            buttonPosition -= dirButtonHeight + buttonSpacing;

            UnityEngine.UI.Text buttonText = buttonObject.GetComponentInChildren <UnityEngine.UI.Text>();
            buttonObject.name = dir.FullName;
            buttonText.text   = dir.Name;
            Button button = buttonObject.GetComponent <Button>();
            button.onClick.AddListener(delegate { HandleDirButton(buttonObject); });
        }
        dirPanel.sizeDelta = new Vector2(dirPanel.rect.width, Mathf.Max(dirView.rect.height, Mathf.Abs(buttonPosition)));
    }
        protected override void ClearUIComponents()
        {
            BtnClose  = null;
            PageIndex = null;

            mData = null;
        }
示例#4
0
        public override void init(Dictionary <string, string> param)
        {
            this.param = param;

            GameObject g = Resources.Load(GameSetting.PATH_PREFAB + "Text") as GameObject;

            this.rootObject = (GameObject)Instantiate(g, new Vector3(0, 0.5f, -3.2f), Quaternion.identity);

            GameObject canvas = GameObject.Find("Canvas") as GameObject;

            this.rootObject.name             = param ["name"];
            this.rootObject.transform.parent = canvas.transform;

            UnityEngine.UI.Text guiText = this.rootObject.GetComponent <Text> ();

            //Debug.Log (this.param ["anchor"]);
            //Debug.Log (TextEnum.textAnchor (this.param ["anchor"]));
            guiText.alignment = TextEnum.textAnchor(this.param ["anchor"]);

            string color = this.param ["color"];

            Color objColor = ColorX.HexToRGB(color);

            objColor.a    = 0;
            guiText.color = objColor;

            guiText.fontSize = int.Parse(this.param ["fontsize"]);

            this.rootObject.name = this.name;
        }
示例#5
0
文件: UI.cs 项目: Yumeris/PoW-Loader
        public static void Postfix(ref UIMain __instance)
        {
            RectTransform menu = (RectTransform)__instance.transform.Find("Menu");
            //Updating the Credits Button Text
            RectTransform btnMember = (RectTransform)menu.Find("BtnMember");
            RectTransform btn       = (RectTransform)btnMember.Find("Btn");
            RectTransform btn_text  = (RectTransform)btn.Find("Text");

            UnityEngine.UI.Text btn_text_text = (UnityEngine.UI.Text)btn_text.gameObject.GetComponentInChildren(typeof(UnityEngine.UI.Text));
            btn_text_text.text = "Credits";

            /*
             * //Reducing Menu Button Font Size
             * menu.Find("BtnContinue").Find("Btn").Find("Text").GetComponent<Text>().fontSize = 20;
             * menu.Find("BtnNewGame").Find("Btn").Find("Text").GetComponent<Text>().fontSize = 23;
             * menu.Find("BtnLoadGame").Find("Btn").Find("Text").GetComponent<Text>().fontSize = 23;
             * menu.Find("BtnSystem").Find("Btn").Find("Text").GetComponent<Text>().fontSize = 16;
             * menu.Find("BtnQuitGame").Find("Btn").Find("Text").GetComponent<Text>().fontSize = 23;
             */

            //Focing the UI to update itself after all the changes we made. We just force every RectTransform to update itself
            for (int i = 0; i < __instance.transform.childCount; ++i)
            {
                Transform t = __instance.transform.GetChild(i);
                if (t != null && t.GetType() == typeof(RectTransform))
                {
                    RectTransform rt = t as RectTransform;
                    rt.ForceUpdateRectTransforms();
                }
            }
        }
示例#6
0
    // Use this for initialization
    void Start()
    {
        mailObjects = myoEvents.GetComponent <JSONReader> ().mailList;
        textbox     = gameObject.GetComponent <UnityEngine.UI.Text>();

        textbox.text = "Hello World TYhis is maillll";
    }
            public UIText(UnityEngine.UI.Text text)
            {
                fontName    = text.font.name;
                fontSize    = text.fontSize;
                align       = text.alignment.ToString();
                this.text   = text.text;
                this.size.x = text.rectTransform.sizeDelta.x;
                this.size.y = text.rectTransform.sizeDelta.y;

                parentName = text.transform.parent.name;
                name       = text.transform.name;

                anchorMin.x = text.rectTransform.anchorMin.x;
                anchorMin.y = 1 - text.rectTransform.anchorMin.y;
                anchorMax.x = text.rectTransform.anchorMax.x;
                anchorMax.y = 1 - text.rectTransform.anchorMax.y;

                pivot.x = text.rectTransform.pivot.x;
                pivot.y = 1 - text.rectTransform.pivot.y;

                tint  = ColorUtility.ToHtmlStringRGB(text.color);
                alpha = text.color.a;

                anchoredPosition.x = text.rectTransform.anchoredPosition.x;
                anchoredPosition.y = -text.rectTransform.anchoredPosition.y;

                scaleFactor.x = text.transform.localScale.x;
                scaleFactor.y = text.transform.localScale.y;
            }
示例#8
0
 public override void BindComponents(GameObject viewObject)
 {
     mCloseButton = viewObject.transform.Find("mCloseButton").GetComponent <UnityEngine.UI.Button>();
     mLoginText   = viewObject.transform.Find("mLoginText").GetComponent <UnityEngine.UI.Text>();
     mInputField  = viewObject.transform.Find("mInputField").GetComponent <UnityEngine.UI.InputField>();
     mLoginButton = viewObject.transform.Find("mLoginButton").GetComponent <UnityEngine.UI.Button>();
 }
示例#9
0
    // Use this for initialization
    void Start()
    {
        GameManager gameManager = GameManager.Instance();

        UnityEngine.UI.Text displayText = GetComponent <UnityEngine.UI.Text>();
        displayText.text = gameManager.GetScore(player).ToString();
    }
示例#10
0
    //just print out a bunch of information onto the screen.
    void Update()
    {
        double pctOfLightSpeed = (state.PlayerVelocity / state.SpeedOfLight) * 100;
        string msg             = "Current % of C: " + pctOfLightSpeed.ToString("n1")
                                 + "\n\nCurrent Speed: " + state.PlayerVelocity.ToString("n2");

        UnityEngine.UI.Text text = infoPanel.GetComponentInChildren <UnityEngine.UI.Text> ();
        text.text = msg;
        if (pctOfLightSpeed > 99)
        {
            speedPanelChildren [0].SetActive(true);
            speedPanelChildren [2].SetActive(true);
            speedPanelChildren [4].SetActive(true);
        }
        else if (pctOfLightSpeed > 75)
        {
            speedPanelChildren [0].SetActive(true);
            speedPanelChildren [2].SetActive(true);
            speedPanelChildren [4].SetActive(false);
        }
        else if (pctOfLightSpeed > 50)
        {
            speedPanelChildren [0].SetActive(true);
            speedPanelChildren [2].SetActive(false);
            speedPanelChildren [4].SetActive(false);
        }
        else
        {
            speedPanelChildren [0].SetActive(false);
            speedPanelChildren [2].SetActive(false);
            speedPanelChildren [4].SetActive(false);
        }
    }
示例#11
0
 protected override void ClearUIComponents()
 {
     TvMedalDay       = null;
     TvMedalName      = null;
     BtnMedalReceived = null;
     mData            = null;
 }
示例#12
0
 public Text(UnityEngine.UI.Text text)
 {
     this.text = text; if (text)
     {
         root = text.transform.root;
     }
 }
示例#13
0
    // Use this for initialization
    void Start()
    {
        timePassed = 30;
        oddOrEven  = 0;

        score = GetComponent <UnityEngine.UI.Text>();
    }
示例#14
0
    /// <summary>
    /// Updates the current frame quality
    /// </summary>
    public void OnFrameQualityChanged(ImageTargetBuilder.FrameQuality frameQuality)
    {
        Color red   = new Color(0.65f, 0.23f, 0.23f, 1f);
        Color green = new Color(0.28f, 0.63f, 0.19f, 1f);

        Debug.Log("Frame quality changed: " + frameQuality.ToString());
        mFrameQuality = frameQuality;
        GameObject BuilderBtn    = BuilderBtnImg.gameObject;
        GameObject BuilderBtnMsg = BuilderBtn.transform.Find("RawMessage").gameObject;

        ui.Text BuilderBtnTxt = BuilderBtnMsg.GetComponent <ui.Text>();

        if (mFrameQuality == ImageTargetBuilder.FrameQuality.FRAME_QUALITY_LOW)
        {
            // set colour to red and show low quality message
            BuilderBtnImg.color = red;
            BuilderBtnMsg.SetActive(true);

            Debug.Log("Low camera image quality");
        }
        else
        {
            // set colour to green and hide the low quality message
            BuilderBtnImg.color = green;
            BuilderBtnMsg.SetActive(false);
        }
    }
示例#15
0
        /// <summary>Tweens a Text's alpha color to the given value.
        /// Also stores the Text as the tween's target so it can be used for filtered operations</summary>
        /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
        public static TweenerCore <Color, Color, ColorOptions> DOFade(this Text target, float endValue, float duration)
        {
            TweenerCore <Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);

            t.SetTarget(target);
            return(t);
        }
示例#16
0
		// 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;
		}
示例#17
0
	void Start () 
    {
        Message1 = GetComponent<UnityEngine.UI.Text>();
        Message1.text = "";
        Text1_day = "+1Day! Score+100";
        
	}
示例#18
0
 void SetColor(Transform _transform, Color _color)
 {
     mText = _transform.GetComponent<Text> ();
     if (mText != null){
         mText.color = _color;
     }
     mLight = _transform.GetComponent<Light>();
     if (mLight != null){
         mLight.color = _color;
     }
     mImage = _transform.GetComponent<Image> ();
     if (mImage != null) {
         mImage.color = _color;
     }
     mSpriteRender = _transform.GetComponent<SpriteRenderer> ();
     if (mSpriteRender != null) {
         mSpriteRender.color = _color;
     }
     if (_transform.GetComponent<Renderer>() != null) {
         mMat = _transform.GetComponent<Renderer>().material;
         if (mMat != null) {
             mMat.color = _color;
         }
     }
     if (includeChilds) {
         for (int i = 0; i < _transform.childCount; ++i) {
             Transform child = _transform.GetChild(i);
             SetColor(child, _color);
         }
     }
 }
示例#19
0
    async void Start()
    {
        // UI の取得
        this.textBattery    = GameObject.Find("TextBattery").GetComponent <Text>();
        this.textCollision  = GameObject.Find("TextCollision").GetComponent <Text>();
        this.textFlat       = GameObject.Find("TextFlat").GetComponent <Text>();
        this.textPositionID = GameObject.Find("TextPositionID").GetComponent <Text>();
        this.textStandardID = GameObject.Find("TextStandardID").GetComponent <Text>();
        this.textButton     = GameObject.Find("TextButton").GetComponent <Text>();
        this.textAngle      = GameObject.Find("TextAngle").GetComponent <Text>();
        this.textDoubleTap  = GameObject.Find("TextDoubleTap").GetComponent <Text>();
        this.textPose       = GameObject.Find("TextPose").GetComponent <Text>();
        this.textShake      = GameObject.Find("TextShake").GetComponent <Text>();
        this.textSpeed      = GameObject.Find("TextSpeed").GetComponent <Text>();

        // Cube の接続
        var peripheral = await new NearestScanner().Scan();

        cube = await new CubeConnecter().Connect(peripheral);
        // モーター速度の読み取りをオンにする
        await cube.ConfigMotorRead(true);

        // コールバック登録
        cube.collisionCallback.AddListener("Sample_Sensor", OnCollision);          // 衝突イベント
        cube.slopeCallback.AddListener("Sample_Sensor", OnSlope);                  // 傾きイベント
        cube.buttonCallback.AddListener("Sample_Sensor", OnPressButton);           // ボタンイベント
        cube.idCallback.AddListener("Sample_Sensor", OnUpdateID);                  // 座標角度イベント
        cube.standardIdCallback.AddListener("Sample_Sensor", OnUpdateStandardId);  // standardIdイベント
        cube.idMissedCallback.AddListener("Sample_Sensor", OnMissedID);            // 座標角度 missedイベント
        cube.standardIdMissedCallback.AddListener("Sample_Sensor", OnMissedID);    // standardId missedイベント
        cube.poseCallback.AddListener("Sample_Sensor", OnPose);                    // 姿勢イベント
        cube.doubleTapCallback.AddListener("Sample_Sensor", OnDoubleTap);          // ダブルタップイベント
        cube.shakeCallback.AddListener("Sample_Sensor", OnShake);                  //
        cube.motorSpeedCallback.AddListener("Sample_Sensor", OnSpeed);             //
    }
示例#20
0
        void Start()
        {
            timerText = GameObject.Find("Play Timer").GetComponent<Text>();
            canvas = this.GetComponent<Canvas>();

            canvas.enabled = true;
        }
		public void Start()
		{
			// Resource Manager Component
			_ResourceManager = GameObject.FindGameObjectWithTag("DataManager").GetComponent<ResourceControll.ResourceManager>();

			// Image Component
			_Icon = this.transform.FindChild("Icon").GetComponent<Image>();
			
			// Text Component
			_CountText = this.transform.FindChild("Count Text").GetComponent<Text>();

			// Text Component
			_DescribedText = this.transform.FindChild("Described").GetComponent<Text>();


			// SETTING
			_Icon.sprite = Resources.Load<Sprite>("Sprites/Icon/" + _Index.ToString());

			if(_Article > 0)
				_CountText.text = ": " + "+ " + _Article.ToString();
			else
				_CountText.text = ": " + _Article.ToString();

			_DescribedText.text = _Described;

			this.transform.localScale = new Vector3(3.0f, 3.0f, 3.0f);
		}
 void Start()
 {
     var b = gameObject.GetComponent<Button>();
     _label = GetComponentInChildren<Text>();
     _label.text = ConnectiveType.GetText();
     b.onClick.AddListener(() => Click());
 }
示例#23
0
 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);
 }
示例#24
0
 /// <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 = "";
 }
示例#25
0
 void Change()
 {
     if (textUI == null) {
         textUI = this.GetComponent<UnityEngine.UI.Text> ();
     }
     textUI.text = textBefore+Texts.GetText(whatIsThis)+textAfter;
 }
示例#26
0
 void Start()
 {
     m_backtext      = transform.parent.gameObject.GetComponent <UnityEngine.UI.Text>();
     m_text          = GetComponent <UnityEngine.UI.Text>();
     m_text.text     = "";
     m_backtext.text = m_text.text;
 }
示例#27
0
文件: ScoreUI.cs 项目: joouur/3DPONG
        // 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());
        }
示例#28
0
        void Start()
        {
            m_text = gameObject.GetComponent<Text>();
            m_text.color = m_myColour;

            m_myWords = "Score!";
        }
示例#29
0
		protected override void Init()
		{
			uiText = GetComponent<Text>();
			AddUpdater(enabledName, UpdateEnabled);
			AddUpdater(textName, UpdateText);
			AddUpdater(colorName, UpdateColor);
		}
示例#30
0
		//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);
			
		}
示例#31
0
文件: Score.cs 项目: e-ucm/QuizDemo
 void Start()
 {
     S = this;
     this.uiScore = GetComponentInParent<UnityEngine.UI.Text>();
     score = PlayerPrefs.GetInt("LevelScore");
     this.DisplayScore();
 }
示例#32
0
 // Use this for initialization
 void Start()
 {
     Game.Stopwatch.Reset();
     Game.Stopwatch.Start();
     text = GetComponent<UnityEngine.UI.Text>();
     stringBuffer = new StringBuilder(8);
 }
示例#33
0
	// 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 ();
		}
示例#34
0
	void Awake ()
	{
		if (Instance != null && Instance != this)
		{
			Destroy(gameObject);
		}
		Instance = this;

		DontDestroyOnLoad(gameObject);

		startTime = Time.time;

		Tasks = Resources.Load<TasksResource>("Tasks");

		Grid = new GridDefinition();

		ClockGO = GameObject.Find("Time");
		ClockText = ClockGO.GetComponent<TextMesh>();
		DayGO = GameObject.Find("Day");
		DayText = DayGO.GetComponent<TextMesh>();
		TimeBarGO = GameObject.Find("TimeBar");

		scoreText = ScoreObject.GetComponent<UnityEngine.UI.Text>();
		highScoreText = HighScoreObject.GetComponent<UnityEngine.UI.Text>();
		completedTasksText = CompletedTasksObject.GetComponent<UnityEngine.UI.Text>();

		highScore = ReadHighScore();

		highScoreText.text = "High Score: " + highScore.ToString();

		lastSpawnTime = 0.0f;
	}
        // 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);
            }
        }
示例#36
0
 void Start()
 {
     text += " ";
     textCTRL = GetComponent<Text> ();
     letters = text.ToCharArray ();
     print (letters[0]);
 }
示例#37
0
 void Start()
 {
     m_backtext = transform.parent.gameObject.GetComponent<UnityEngine.UI.Text>();
     m_text = GetComponent<UnityEngine.UI.Text>();
     m_text.text = "0";
     m_backtext.text = m_text.text;
 }
示例#38
0
 // Use this for initialization
 void Start()
 {
     panelText = GetComponentInChildren<UnityEngine.UI.Text>();
     if (currentConvo) {
         currentNode = currentConvo.conversationXml.GetElementsByTagName("ContentNode")[0];
     }
 }
示例#39
0
文件: Skill.cs 项目: SanhedrinExt/DnD
 public virtual void Start()
 {
     LastUse = DateTime.Now;
     CooldownTimer = r_Cooldown;
     m_ButtonCooldown = m_Button.transform.FindChild("Text Cooldown").GetComponent<Text>();
     button = m_Button.GetComponent<Button>();
 }
示例#40
0
        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);
        }
示例#41
0
        protected virtual void Update() {
            if (_text == null)
                _text = GetComponent<Text>();

            _text.text = _format.IsNullOrEmpty() ? _number.ToString() : _number.ToString(_format);

        }
示例#42
0
 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;
 }
示例#43
0
        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));
            }
        }
示例#44
0
        //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();
        }
示例#45
0
 private void Start()
 {
     m_FpsNextPeriod = Time.realtimeSinceStartup + fpsMeasurePeriod;
     m_Text = GetComponent<Text>();
     Debug.Log("Start FPS Measurement");
     UnityAnalytics.StartFPSMeasurement();
 }
        /// <summary>
        /// Script starting callback.
        /// </summary>
        void Start()
        {
            mText = GetComponent<Text>();
            mText.text = Translator.getString(id);

            Translator.addLanguageChangedListener(OnLanguageChanged);
        }
 protected override void ClearUIComponents()
 {
     Title         = null;
     HotFixDesText = null;
     ConfirmBtn    = null;
     CancleBtn     = null;
     mData         = null;
 }
示例#48
0
    public void AddTryList(string s)
    {
        Transform item = TryListBox.Add();

        UnityEngine.UI.Text t = item.GetComponent <UnityEngine.UI.Text>();

        t.text = s;
    }
示例#49
0
 // Use this for initialization
 void Start()
 {
     textDisp      = GetComponent <Text>();
     textDisp.text = iniString;
     texts         = System.IO.File.ReadAllLines(@"C:\Users\Mark\Desktop\TestRead.txt");
     //texts = System.IO.File.ReadAllLines(@file);
     StartCoroutine(read());
 }
示例#50
0
 protected override void OnInit()
 {
     base.OnInit();
     Template_button = Go.GetComponent <UnityEngine.UI.Button>();
     Text_go         = Go.transform.Find("Text").gameObject;
     Text_text       = Text_go.GetComponent <UnityEngine.UI.Text>();
     Template_button.onClick.AddListener(OnClick);
 }
示例#51
0
 //int count = 1;
 void Start()
 {
     //StartCoroutine (WebImage());
     tt  = text.GetComponent <UnityEngine.UI.Text> ();
     url = "http://192.168.0.7:8080/Pictures/structure.jpg";
     //plane = GetComponent<Renderer> ();
     //web = new WWW (url);
 }
示例#52
0
 protected override void ClearUIComponents()
 {
     txtTips   = null;
     loadingfg = null;
     imgPoint  = null;
     txtPrg    = null;
     mData     = null;
 }
示例#53
0
 private void UpdateTimeGUI()
 {
     if (guiTimeText)
     {
         UnityEngine.UI.Text uiText = guiTimeText.GetComponent <UnityEngine.UI.Text>();
         uiText.text = jsonTime["local"].str;
     }
 }
示例#54
0
        public override UGUINode DrawImage(Data.ImgNode image, UGUINode parent)
        {
            UGUINode node = CreateRootNode(image.Name, AdjustTextRect(image.rect, image.fontSize), parent);

            UnityEngine.UI.Text myText = node.InitComponent <Text>();
            PSDImporterUtility.SetPictureOrLoadColor(image, myText);
            return(node);
        }
 protected override void ClearUIComponents()
 {
     ItemIdDropdown = null;
     Query          = null;
     Home           = null;
     ActivityText   = null;
     mData          = null;
 }
示例#56
0
    void Start()
    {
        UnityEngine.UI.Text textWidget = GetComponentInChildren <UnityEngine.UI.Text>();
        int    cost = monster.GetComponent <TerrorCost>().cost;
        string name = monster.GetComponent <MonsterName>().name;

        textWidget.text = string.Format("{0}\n{1}", name, cost);
    }
示例#57
0
 // Use this for initialization
 void Start()
 {
     panelText = GetComponentInChildren <UnityEngine.UI.Text>();
     if (currentConvo)
     {
         currentNode = currentConvo.conversationXml.GetElementsByTagName("ContentNode")[0];
     }
 }
示例#58
0
 private void AssignColorsToSelection(GameObject gameObject, ColorSet colorSet)
 {
     recursiveLevel++;
     if (gameObject.GetComponent <UnityEngine.UI.Button>())
     {
         UnityEngine.UI.Button button = gameObject.GetComponent <UnityEngine.UI.Button>();
         SetColorBlock(button, colorSet);
         SetDetailColor(gameObject, colorSet);
     }
     else if (gameObject.GetComponent <UnityEngine.UI.InputField>())
     {
         UnityEngine.UI.InputField input = gameObject.GetComponent <UnityEngine.UI.InputField>();
         SetColorBlock(input, colorSet);
         input.selectionColor      = colorSet.highlighted;
         input.textComponent.color = colorSet.pressed;
         input.placeholder.color   = colorSet.highlighted;
     }
     else if (gameObject.GetComponent <UnityEngine.UI.Scrollbar>())
     {
         UnityEngine.UI.Scrollbar sb = gameObject.GetComponent <UnityEngine.UI.Scrollbar>();
         SetColorBlock(sb, colorSet);
         gameObject.GetComponent <UnityEngine.UI.Image>().color = colorSet.disabled;
     }
     else if (gameObject.GetComponent <UnityEngine.UI.Slider>())
     {
         UnityEngine.UI.Slider slider = gameObject.GetComponent <UnityEngine.UI.Slider>();
         SetColorBlock(slider, colorSet);
         slider.fillRect.gameObject.GetComponent <UnityEngine.UI.Image>().color = colorSet.normal;
         SetTextColorRecursive(gameObject, colorSet);
     }
     else if (gameObject.GetComponent <UnityEngine.UI.Toggle>())
     {
         UnityEngine.UI.Toggle toggle = gameObject.GetComponent <UnityEngine.UI.Toggle>();
         SetColorBlock(toggle, colorSet);
         toggle.graphic.color = colorSet.normal;
         SetTextColorRecursive(gameObject, colorSet);
     }
     else if (gameObject.transform.childCount > 0) // Recursive search for components
     {
         for (int i = 0; i < gameObject.transform.childCount; i++)
         {
             AssignColorsToSelection(gameObject.transform.GetChild(i).gameObject, colorSet);
         }
     }
     else if (recursiveLevel == 1)
     {
         if (gameObject.GetComponent <UnityEngine.UI.Image>())
         {
             UnityEngine.UI.Image image = gameObject.GetComponent <UnityEngine.UI.Image>();
             image.color = colorSet.normal;
         }
         else if (gameObject.GetComponent <UnityEngine.UI.Text>())
         {
             UnityEngine.UI.Text text = gameObject.GetComponent <UnityEngine.UI.Text>();
             text.color = colorSet.normal;
         }
     }
 }
示例#59
0
 protected override void ClearUIComponents()
 {
     Info               = null;
     HotContenText      = null;
     HotFixedSlider     = null;
     HotFixedSliderText = null;
     HotFixedInfoText   = null;
     mData              = null;
 }
示例#60
0
 // Use this for initialization
 void Start()
 {
     zombiesCount          = 0;
     humanCount            = 0;
     contaminatedCount     = 0;
     zombiesCountText      = (UnityEngine.UI.Text)GameObject.Find("ZombiesCountText").GetComponent <Text>();
     humansCountText       = (UnityEngine.UI.Text)GameObject.Find("HumansCountText").GetComponent <Text>();
     contaminatedCountText = (UnityEngine.UI.Text)GameObject.Find("ContaminedCountText").GetComponent <Text>();
 }