//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // *- Private Instance Variables //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Awake //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Awake() { if (m_rDebugTextRenderer != null) { if (m_rDebugTextRenderer.GetComponent <MultiLanguageTextDisplay>() != null) { m_rDebugTextRenderer.GetComponent <MultiLanguageTextDisplay>().enabled = false; } m_rDebugTextRenderer.text = Camera.main.aspect.ToString(); } if (Camera.main.aspect >= 0.5f && Camera.main.aspect < 0.6f) // 16:9 Resolution { m_rSceneTransform.localPosition = m_v16By09Position; m_rSceneTransform.localScale = m_v16By09Scale; } else { m_rSceneTransform.localPosition = m_v16By10Position; m_rSceneTransform.localScale = m_v16By10Scale; } //else if(Camera.main.aspect >= 1.5f) //{ // Debug.Log("3:2"); //} //else //{ // Debug.Log("4:3"); //} }
public static GameObject CreateWorldText(string text, Color color) { GameObject canvasGO = new GameObject("CANVAS" + count++); Canvas canvas = canvasGO.AddComponent <Canvas>(); canvas.renderMode = RenderMode.WorldSpace; canvas.GetComponent <RectTransform>().position = Vector3.zero; canvas.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 1000); canvas.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 1000); GameObject textGO = new GameObject("TEXT" + count++); textGO.transform.SetParent(canvasGO.transform); UnityEngine.UI.Text textUI = textGO.AddComponent <UnityEngine.UI.Text>(); textUI.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 5000); textUI.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 5000); textUI.transform.localScale *= 0.004f; textUI.text = text; textUI.fontSize = 75; textUI.color = color; textUI.alignment = TextAnchor.MiddleCenter; textUI.font = Resources.Load <Font>("Fonts/unispace bd"); return(canvasGO); }
private IEnumerator updateTimer() { timerStatus += 1; cText.GetComponent <FadeScript>().FadeOut(); yield return(new WaitForSeconds(2)); cText.text = script.Lines[timerStatus]; cText.GetComponent <FadeScript>().FadeIn(); }
public void caseClick() { flara.GetComponent <AudioSource>().Play(); foreach (Image image in images) { if ((licz > 0) && (licz < 800)) { ilosc = Random.Range(1, 8); PlayerPrefs.SetInt("random1111", ilosc); iloscdropu.text = "x" + ilosc; item.GetComponent <Image>().sprite = item1; item.GetComponent <Image>().color = color; if (PlayerPrefs.GetInt("jezyk") == 0) { nazwa_przedmiotu.text = "Rotten egg"; } else if (PlayerPrefs.GetInt("jezyk") == 1) { nazwa_przedmiotu.text = "Zgnile jajco"; } PlayerPrefs.SetFloat("1111", 1111); nazwa_przedmiotu.GetComponent <Text>().color = Niebieski; ilosccc.gameObject.GetComponent <Text>().color = Niebieski; podswietlenie.GetComponent <SpriteRenderer>().color = Niebieski; //itemek.baseilosc1 = itemek.baseilosc1 + ilosc; } if ((licz >= 800) && (licz <= 1600)) { ilosc = Random.Range(1, 2); PlayerPrefs.SetInt("random2222", ilosc); iloscdropu.text = "x" + ilosc; item.GetComponent <Image>().sprite = item2; item.GetComponent <Image>().color = color; if (PlayerPrefs.GetInt("jezyk") == 0) { nazwa_przedmiotu.text = "Delicious sweet"; } else if (PlayerPrefs.GetInt("jezyk") == 1) { nazwa_przedmiotu.text = "Pyszny cukierek"; } PlayerPrefs.SetFloat("2222", 2222); nazwa_przedmiotu.GetComponent <Text>().color = Zloty; particleflary.GetComponent <ParticleSystem>().startColor = Zloty; ilosccc.gameObject.GetComponent <Text>().color = Zloty; podswietlenie.GetComponent <SpriteRenderer>().color = Zloty; } } }
public void ToggleMode() { if (Utilites.scoreMode == Utilites.ScoreMode.fadeEqDie) { Utilites.scoreMode = Utilites.ScoreMode.fadeIsNotTheEnd; modeText.GetComponent <UnityEngine.UI.Text>().text = "fading is not the end"; } else if (Utilites.scoreMode == Utilites.ScoreMode.fadeIsNotTheEnd) { Utilites.scoreMode = Utilites.ScoreMode.fadeEqDie; modeText.GetComponent <UnityEngine.UI.Text>().text = "fading = the end"; } }
/// <summary> /// Triggers the wave counter animation. /// </summary> protected void TriggerWaveCounterAnimation() { if (waveNumber != null && waveRoundText != null) { Animator number = waveNumber.GetComponent <Animator>(); Animator roundText = waveRoundText.GetComponent <Animator>(); Animator boss = bossText.GetComponent <Animator>(); Animator special = specialWaveText.GetComponent <Animator>(); waveNumber.text = GameManager.GameManagerInstance.Wave.ToString(); if (waveTextPermanent != null) { waveTextPermanent.text = GameManager.GameManagerInstance.Wave.ToString(); } if (boss != null && GameManager.GameManagerInstance.IsBossWave) { boss.SetTrigger("WaveStarted"); } else if (GameManager.GameManagerInstance.IsCurrentlySpecialWave) { special.SetTrigger("WaveStarted"); } else { number.SetTrigger("WaveStarted"); } roundText.SetTrigger("WaveStarted"); } }
//This uses the returned string[] from nodeData.playerComments to create the UIs for each comment //It first cleans, then it instantiates new options public void SetOptions(string[] opts) { //Destroy the current options foreach (UnityEngine.UI.Text op in currentOptions) { Destroy(op.gameObject); } //Clean the variable currentOptions = new List <UnityEngine.UI.Text>(); //Create the options for (int i = 0; i < opts.Length; i++) { //This is just one way of creating endless options for Unity's UI class //Normally, you'd have an absolute number of options and you wouldn't have the need of doing this GameObject newOp = Instantiate(playerText.gameObject, playerText.transform.position, Quaternion.identity) as GameObject; newOp.SetActive(true); newOp.transform.SetParent(playerText.transform.parent, true); //newOp.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, 20 - (20 * i)); newOp.GetComponent <RectTransform>().anchoredPosition = new Vector2(playerText.GetComponent <RectTransform>().anchoredPosition.x, playerText.GetComponent <RectTransform>().anchoredPosition.y + (-25 * i)); newOp.GetComponent <RectTransform>().localScale = Vector3.one; newOp.GetComponent <UnityEngine.UI.Text>().text = opts[i]; currentOptions.Add(newOp.GetComponent <UnityEngine.UI.Text>()); } }
/// <summary> /// Função que atualiza as informações do prefab atrelado /// </summary> /// <param name="glossaryElement"></param> public void UpdatePrefabs(GlossaryElement glossaryElement) { headerText.text = glossaryElement.expression; headerText.GetComponent <PlayVideoOnMouseOver>().video = glossaryElement.expressionVideo; contentText.text = glossaryElement.meaning; contentText.GetComponent <PlayVideoOnMouseOver>().video = glossaryElement.meaningVideo; }
public void Start() { canvasTransform = canvas.GetComponent <RectTransform>(); player = GameObject.FindGameObjectWithTag("MainCamera"); text.text = String.Format("(Space) Interact with {0}", StringUtils.SpaceCase(itemType.ToString())); RectTransform textRectTransform = text.GetComponent <RectTransform>(); RectTransform imageRectTransform = image.GetComponent <RectTransform>(); imageRectTransform.sizeDelta = new Vector2(text.preferredWidth + 10f, imageRectTransform.rect.height); }
/// <summary> /// Event if ZED is disconnected /// </summary> void ZEDDisconnected() { warning.SetActive(true); warning.transform.GetChild(0).gameObject.SetActive(true); text.GetComponent <RectTransform>().localPosition = Vector3.zero; text.text = ZEDLogMessage.Error2Str(ZEDLogMessage.ERROR.ZED_IS_DISCONNECETD); text.alignment = TextAnchor.MiddleCenter; text.fontSize = 200; warning.layer = 30; }
public static void StretchText(UnityEngine.UI.Text _text) { TextGenerator generator = new TextGenerator(); var settings = _text.GetGenerationSettings(Vector2.zero); settings.generateOutOfBounds = true; float offsetWidth = _text.fontSize / 2; float width = generator.GetPreferredWidth(_text.text, settings) / _text.pixelsPerUnit + offsetWidth; RectTransform rt = _text.GetComponent <RectTransform>(); rt.sizeDelta = new Vector2(width, rt.sizeDelta.y); }
public UGUINode DrawImage(ImgNode image, UGUINode parent) { UGUINode node = PSDImportUtility.InstantiateItem(GroupType.TEXT, image.Name, parent); UnityEngine.UI.Text myText = node.InitComponent <Text>(); PSDImportUtility.SetPictureOrLoadColor(image, myText); RectTransform rectTransform = myText.GetComponent <RectTransform>(); AdjustImage(image, myText.fontSize); rectTransform.sizeDelta = new Vector2(image.rect.width, image.rect.height); rectTransform.anchoredPosition = new Vector2(image.rect.x, image.rect.y); return(node); }
// Start is called before the first frame update public void Init() { dataManager = DataManager.GetInstance(); url = dataManager.GetAWSURL(); itemNameList = dataManager.GetItemNameList(); itemIndex = GameObject.Find("DataManager").GetComponent <DataManager>().GetItemIndex(); animationTimes = dataManager.GetAnimationTimes(); palyTimes = dataManager.GetPlayTimes(); initTitleText(itemIndex); all_knn_results = new All_Knn_Results(); all_knn_results = this.dataManager.GetAll_Knn_Results(); initPoseNameText("종합"); this.ResultText.text = all_knn_results.GetEvaluation(); ResultText.GetComponent <ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize; ResultGraphIndex = 0; if (!Directory.Exists(Application.dataPath + "/Resources/Transforms/RecordData/")) { Directory.CreateDirectory(Application.dataPath + "/Resources/Transforms/RecordData/"); } // File.Create(Application.dataPath + "/Resources/Transforms/RecordData/" + fileName + ".txt"); FileStream fs = new FileStream(Application.dataPath + "/Resources/Transforms/RecordData/hou.txt", FileMode.OpenOrCreate, FileAccess.Write); StreamWriter writer = new StreamWriter(fs, System.Text.Encoding.Unicode); for (int i = 0; i < animationTimes.Count; i++) { writer.WriteLine("교정운동" + (i + 1).ToString()); for (int j = 0; j < animationTimes[i].Length - 1; j++) { writer.WriteLine("디바이스 번호 : " + j.ToString() + ",오류 시간 값 : " + animationTimes[i][j].ToString("0.00")); } writer.WriteLine("전체 수행 시간 : " + palyTimes[i].ToString("0.00")); } writer.Close(); }
public static void StretchDropdown(Dropdown _dropdown) { TextGenerator generator = new TextGenerator(); UnityEngine.UI.Text textComponent = _dropdown.captionText; var settings = textComponent.GetGenerationSettings(Vector2.zero); settings.generateOutOfBounds = true; float offsetWidth = textComponent.fontSize / 2 + Mathf.Abs(textComponent.GetComponent <RectTransform>().sizeDelta.x); float width = generator.GetPreferredWidth(textComponent.text, settings) / textComponent.pixelsPerUnit + offsetWidth; RectTransform rt = _dropdown.GetComponent <RectTransform>(); rt.sizeDelta = new Vector2(width, rt.sizeDelta.y); }
private IEnumerator GenerateRandomLevelEnumerator() { for (int j = 0; j < 1000; j++) { Camera.main.transform.position = Vector3.Lerp(cameraTarget.position, cameraStart, coTime); cameraTarget.localScale = Vector3.Lerp(new Vector3(25, 25, 1), cameraTarget.localScale, coTime); coTime -= Time.deltaTime / 2; if (coTime <= 0.5) { //set bg to faded current color //Color col = cameraTarget.GetComponent<Renderer>().material.color; //Color.RGBToHSV(col, out float h, out float s, out float v); //Camera.main.backgroundColor = Color.HSVToRGB(h, 0.25f, v); //clear existing objects //while (Container.childCount > 0) // Destroy(Container.GetChild(0)); foreach (Transform child in Container) { Destroy(child.gameObject); } //reset cam pos Camera.main.transform.position = new Vector3(0, 0, -10); int newPlanets = Random.Range(1, 3); numStableOrbitsRequired = Random.Range(2, 5); //re-enable stableorbit texts; stableOrbitCounter.text = numStableOrbitsRequired.ToString(); stableOrbitCounter.enabled = true; stableOrbitText.enabled = true; stableOrbitText.GetComponent <FadeOut>().ResetFade(); for (int i = 0; i < newPlanets; i++) { float mass = Random.Range(50, 200); //Color color = Random.ColorHSV(0, 1, 0.5f, 0.75f, 1, 1, 0, 0); Color color = Color.black; GameObject planet = Instantiate(Resources.Load("Planet")) as GameObject; planet.GetComponent <GravitySource>().PostConstruct(mass, color); planet.name += i; planet.transform.SetParent(Container); planet.transform.position = (Vector2)Random.insideUnitSphere * 4; } yield break;//quit coroutine } yield return(null); } }
/// <summary> /// Initialises the script /// </summary> void Start() { sm_islandsOwned.Clear(); m_scoreOutline = scoreText.GetComponent <UnityEngine.UI.Outline>(); m_scoreTransform = scoreText.GetComponent <RectTransform>(); scoreText.gameObject.SetActive(false); m_nodes = transform.parent.GetComponentsInChildren <IslandDiscoveryNode>(); foreach (var node in m_nodes) { node.SetTrigger(this); } var islands = transform.parent.GetComponentsInChildren <SpriteRenderer>(); foreach (var island in islands) { if (island.CompareTag("Island")) { m_islands.Add(island); } } if (m_islands.Count == 0) { Debug.LogError("No associated island sprite"); } if (m_nodes.Length == 0) { Debug.LogError("No associated nodes"); } m_canvas = GetComponent <Canvas>(); m_canvas.enabled = false; }
// Get components from the Unity scene private void FindTextComponents() { addScoreButton = addScoreButton.GetComponent <UnityEngine.UI.Button>(); status = status.GetComponent <UnityEngine.UI.Text>(); displayScore = displayScore.GetComponent <UnityEngine.UI.Text>(); displayScoreLabel = displayScoreLabel.GetComponent <UnityEngine.UI.Text>(); usernameInput = usernameInput.GetComponent <UnityEngine.UI.InputField>(); fileName = fileName.GetComponent <UnityEngine.UI.Text>(); fileName.enabled = false; // Invisible text view to store the file name for the highscores score = score.GetComponent <UnityEngine.UI.Text>(); for (int i = 0; i < TOTAL_SCORES; i++) { names[i] = names[i].GetComponent <UnityEngine.UI.Text>(); scores[i] = scores[i].GetComponent <UnityEngine.UI.Text>(); } }
// Start is called before the first frame update void Start() { // buy_sound = GameObject.FindGameObjectWithTag("sound"); grafika_itemu_object.GetComponent <Image>().sprite = grafika; cena_textobject.GetComponent <Text>().text = cena.ToString(); PlayerPrefs.GetInt(obramowka.name, 0); play = GameObject.FindGameObjectWithTag("Player"); if ((PlayerPrefs.GetInt(obramowka.name) == 0) && (cena == 0)) { play.GetComponent <SpriteRenderer>().sprite = grafika; obramowka.GetComponent <Image>().color = wybrany; PlayerPrefs.SetInt(obramowka.name, 1); PlayerPrefs.SetString("wybraned", obramowka.name); } }
// Update is called once per frame void Update() { time_duration += Time.deltaTime; if (extra_Life != null && !extra_Life.activeInHierarchy) { if (time_duration >= bonus_TimeTarget) { time_duration += Cow_controller.instances.Count * bonus_secPerCow; bonus_Text.gameObject.SetActive(true); bonus_Text.text = "Bonus " + Cow_controller.instances.Count + " cows x " + bonus_secPerCow + " sec"; bonus_Text.GetComponent <Animator>().SetTrigger("Show"); bonus_TimeTarget = time_duration + bonus_everySecs; } } comp_timeDisplay.UpdateDisplay(time_duration); }
//-------------------------------------------------------------------------------- #region Private Methods void UpdatePrompt() { if (!gameObject.activeInHierarchy) { return; } RectTransform promptR = prompt.GetComponent <RectTransform>(); string promptStr; if (demoScript.interpreter.NeedMoreInput()) { promptStr = ". . . > "; promptR.sizeDelta = new Vector2(60, promptR.sizeDelta.y); } else if (demoScript.interpreter.Running()) { promptStr = null; } else { promptStr = "> "; promptR.sizeDelta = new Vector2(25, promptR.sizeDelta.y); } prompt.text = promptStr; RectTransform inputR = input.GetComponent <RectTransform>(); inputR.anchoredPosition = new Vector2(promptR.sizeDelta.x, inputR.anchoredPosition.y); if (promptStr == null) { input.DeactivateInputField(); input.gameObject.SetActive(false); } else { input.gameObject.SetActive(true); input.ActivateInputField(); } }
private void OnTriggerEnter(Collider other) { if (_triggered) { return; } Switcher switcher = gameObject.GetComponent <Switcher>(); if (switcher) { switcher.Switch(); } var countdown = _text.GetComponent <CountDown>(); countdown.SetTimeCount(5); countdown.StartCount(); StartCoroutine("TriggerExplodsion"); _triggered = true; }
public UINode DrawImage(Image image, UINode parent) { UINode node = PSDImportUtility.InstantiateItem(PSDImporterConst.PREFAB_PATH_TEXT, image.name, parent); UnityEngine.UI.Text myText = node.GetComponent <Text>(); PSDImportUtility.SetPictureOrLoadColor(image, myText); float size; if (float.TryParse(image.arguments[2], out size)) { myText.fontSize = (int)size; } myText.text = image.arguments[3]; RectTransform rectTransform = myText.GetComponent <RectTransform>(); rectTransform.sizeDelta = new Vector2(image.size.width, image.size.height); rectTransform.anchoredPosition = new Vector2(image.position.x, image.position.y); return(node); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Draw Button Name Option //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected void DrawButtonNameOption() { UnityEngine.UI.Text textComponent = Target.TextRenderer; if (textComponent != null) { if (textComponent.GetComponent <MultiLanguageTextDisplay>() == null) { string name = EditorGUILayout.TextField("Button Label: ", textComponent.text); if (name != textComponent.text) { textComponent.text = name; } int fontSize = DrawChangeableIntegerOption("Font Size: ", textComponent.fontSize, tooltip: "Size of the Button Text Font"); if (fontSize != textComponent.fontSize) { textComponent.fontSize = fontSize; } AddSpaces(3); } } }
// Update is called once per frame void Update() { if (Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0) { transform.Translate(new Vector3(Input.GetAxis("Horizontal") * speed * Time.deltaTime, 0, Input.GetAxis("Vertical") * speed * Time.deltaTime), Space.Self); //transform.Translate(new Vector3(Input.GetAxis("Horizontal")*speed*Time.deltaTime,0,Input.GetAxis("Vertical")*speed*Time.deltaTime)); } if (Input.GetAxis("Mouse X") != 0 || Input.GetAxis("Mouse Y") != 0) { Mycamera.transform.Rotate(Input.GetAxis("Mouse Y") * rotateSpeed * Time.deltaTime, 0, 0); transform.Rotate(0, Input.GetAxis("Mouse X") * rotateSpeed * Time.deltaTime, 0); //Mycamera.transform.rotation = Quaternion.Euler(Mycamera.transform.rotation.eulerAngles.x, Mycamera.transform.rotation.eulerAngles.y,0); } if (Input.GetKeyDown(KeyCode.E)) { RaycastHit hit; Physics.Raycast(Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0)), out hit); if (hit.collider) { if (hit.distance < interactdist) { PersonAI p = hit.collider.GetComponent <PersonAI>(); if (p) { p.state = 1; } dialogText.text = playerdialogs[currentdialog]; currentdialog++; if (currentdialog >= playerdialogs.Length) { currentdialog = 0; } dialogText.gameObject.SetActive(true); dialogText.GetComponent <dialog>().curTime = 0; AudioSource.PlayClipAtPoint(growls[Random.Range(0, growls.Length)], transform.position, 0.3f); talkcount++; } } } if (talkcount > 2) { canKill = true; } if (canKill && (level2 || level3)) { fkey.SetActive(true); if (Input.GetKeyDown(KeyCode.F)) { RaycastHit hit; Physics.Raycast(Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0)), out hit); if (hit.collider) { if (hit.distance < interactdist) { PersonAI p = hit.collider.GetComponent <PersonAI>(); if (p) { p.state = 1; } p.GetComponent <AudioSource>().enabled = false; swipe.SetActive(true); GetComponent <AudioSource>().Play(); killcount++; } } } } if (talkcount >= talkneeded) { fade.GetComponent <fadeout>().enabled = true; if (fade.GetComponent <UnityEngine.UI.RawImage>().color.a >= 1) { Application.LoadLevel(nextlevel); } } if (killcount >= killneeded) { fade.GetComponent <fadeout>().enabled = true; if (fade.GetComponent <UnityEngine.UI.RawImage>().color.a >= 1) { Application.LoadLevel(nextlevel); } } }
void Awake() { _plabelText = GameObject.Find("Points").GetComponent<Text>(); _plabelBackText = GameObject.Find("PointsBack").GetComponent<Text>(); stockFont = _plabelText.GetComponent<Text>().fontSize; }
private float timeToHide = -2.0f; // Time to hide the countdown // Use this for initialization void Start() { timeRemaining = startTime; Countdown = Countdown.GetComponent <UnityEngine.UI.Text>(); }
public void caseClick() { flara.GetComponent <AudioSource>().Play(); foreach (Image image in images) { if ((licz > 0) && (licz < 300)) { ilosc = Random.Range(1, 8); PlayerPrefs.SetInt("random1", ilosc); iloscdropu.text = "x" + ilosc; item.GetComponent <Image>().sprite = item1; item.GetComponent <Image>().color = color; if (PlayerPrefs.GetInt("jezyk") == 0) { nazwa_przedmiotu.text = "Pipe"; } else if (PlayerPrefs.GetInt("jezyk") == 1) { nazwa_przedmiotu.text = "Fajke"; } PlayerPrefs.SetFloat("1", 1); nazwa_przedmiotu.GetComponent <Text>().color = Niebieski; ilosccc.gameObject.GetComponent <Text>().color = Niebieski; podswietlenie.GetComponent <SpriteRenderer>().color = Niebieski; //itemek.baseilosc1 = itemek.baseilosc1 + ilosc; } if ((licz >= 300) && (licz < 600)) { ilosc = Random.Range(1, 8); PlayerPrefs.SetInt("random2", ilosc); iloscdropu.text = "x" + ilosc; item.GetComponent <Image>().sprite = item2; item.GetComponent <Image>().color = color; if (PlayerPrefs.GetInt("jezyk") == 0) { nazwa_przedmiotu.text = "Speaker"; } else if (PlayerPrefs.GetInt("jezyk") == 1) { nazwa_przedmiotu.text = "Głośnik"; } PlayerPrefs.SetFloat("2", 2); nazwa_przedmiotu.GetComponent <Text>().color = Niebieski; ilosccc.gameObject.GetComponent <Text>().color = Niebieski; podswietlenie.GetComponent <SpriteRenderer>().color = Niebieski; // itemek.baseilosc2 = itemek.baseilosc2 + ilosc; } if ((licz >= 600) && (licz < 900)) { ilosc = Random.Range(1, 8); PlayerPrefs.SetInt("random3", ilosc); iloscdropu.text = "x" + ilosc; item.GetComponent <Image>().sprite = item3; item.GetComponent <Image>().color = color; if (PlayerPrefs.GetInt("jezyk") == 0) { nazwa_przedmiotu.text = "Losser's headphones"; } else if (PlayerPrefs.GetInt("jezyk") == 1) { nazwa_przedmiotu.text = "Słuchawki przegrywa"; } PlayerPrefs.SetFloat("3", 3); nazwa_przedmiotu.GetComponent <Text>().color = Niebieski; ilosccc.gameObject.GetComponent <Text>().color = Niebieski; podswietlenie.GetComponent <SpriteRenderer>().color = Niebieski; // itemek.baseilosc3 = itemek.baseilosc3 + ilosc; } if ((licz >= 900) && (licz < 1200)) { ilosc = Random.Range(1, 8); PlayerPrefs.SetInt("random4", ilosc); iloscdropu.text = "x" + ilosc; item.GetComponent <Image>().sprite = item4; item.GetComponent <Image>().color = color; if (PlayerPrefs.GetInt("jezyk") == 0) { nazwa_przedmiotu.text = "Camera"; } else if (PlayerPrefs.GetInt("jezyk") == 1) { nazwa_przedmiotu.text = "Aparat słabiaka"; } PlayerPrefs.SetFloat("4", 4); nazwa_przedmiotu.GetComponent <Text>().color = Niebieski; ilosccc.gameObject.GetComponent <Text>().color = Niebieski; podswietlenie.GetComponent <SpriteRenderer>().color = Niebieski; // itemek.baseilosc4 = itemek.baseilosc4 + ilosc; } if ((licz >= 1200) && (licz < 1350)) { ilosc = Random.Range(1, 3); PlayerPrefs.SetInt("random5", ilosc); iloscdropu.text = "x" + ilosc; item.GetComponent <Image>().sprite = item5; item.GetComponent <Image>().color = color; if (PlayerPrefs.GetInt("jezyk") == 0) { nazwa_przedmiotu.text = "Megaphone"; } else if (PlayerPrefs.GetInt("jezyk") == 1) { nazwa_przedmiotu.text = "Megafon głośności"; } PlayerPrefs.SetFloat("5", 5); nazwa_przedmiotu.GetComponent <Text>().color = Fioletowy; particleflary.GetComponent <ParticleSystem>().startColor = Fioletowy; ilosccc.gameObject.GetComponent <Text>().color = Fioletowy; podswietlenie.GetComponent <SpriteRenderer>().color = Fioletowy; // itemek.baseilosc5 = itemek.baseilosc5 + ilosc; } if ((licz >= 1350) && (licz < 1500)) { ilosc = Random.Range(1, 3); PlayerPrefs.SetInt("random6", ilosc); iloscdropu.text = "x" + ilosc; item.GetComponent <Image>().sprite = item6; item.GetComponent <Image>().color = color; if (PlayerPrefs.GetInt("jezyk") == 0) { nazwa_przedmiotu.text = "Apple phone"; } else if (PlayerPrefs.GetInt("jezyk") == 1) { nazwa_przedmiotu.text = "Jabłkowy telefon"; } PlayerPrefs.SetFloat("6", 6); nazwa_przedmiotu.GetComponent <Text>().color = Fioletowy; particleflary.GetComponent <ParticleSystem>().startColor = Fioletowy; ilosccc.gameObject.GetComponent <Text>().color = Fioletowy; podswietlenie.GetComponent <SpriteRenderer>().color = Fioletowy; // itemek.baseilosc6 = itemek.baseilosc6 + ilosc; } if ((licz >= 1500) && (licz < 1550)) { ilosc = Random.Range(1, 2); PlayerPrefs.SetInt("random7", ilosc); iloscdropu.text = "x" + ilosc; item.GetComponent <Image>().sprite = item7; item.GetComponent <Image>().color = color; if (PlayerPrefs.GetInt("jezyk") == 0) { nazwa_przedmiotu.text = "Cool cup"; } else if (PlayerPrefs.GetInt("jezyk") == 1) { nazwa_przedmiotu.text = "Puchar prawilności"; } PlayerPrefs.SetFloat("7", 7); nazwa_przedmiotu.GetComponent <Text>().color = Zloty; particleflary.GetComponent <ParticleSystem>().startColor = Zloty; ilosccc.gameObject.GetComponent <Text>().color = Zloty; podswietlenie.GetComponent <SpriteRenderer>().color = Zloty; // itemek.baseilosc7 = itemek.baseilosc7 + ilosc; } if ((licz >= 1550) && (licz <= 1600)) { ilosc = Random.Range(1, 2); PlayerPrefs.SetInt("random8", ilosc); iloscdropu.text = "x" + ilosc; item.GetComponent <Image>().sprite = item8; item.GetComponent <Image>().color = color; if (PlayerPrefs.GetInt("jezyk") == 0) { nazwa_przedmiotu.text = "Fast glasses"; } else if (PlayerPrefs.GetInt("jezyk") == 1) { nazwa_przedmiotu.text = "Okulary szybkosci"; } PlayerPrefs.SetFloat("8", 8); nazwa_przedmiotu.GetComponent <Text>().color = Zloty; particleflary.GetComponent <ParticleSystem>().startColor = Zloty; ilosccc.gameObject.GetComponent <Text>().color = Zloty; podswietlenie.GetComponent <SpriteRenderer>().color = Zloty; // itemek.baseilosc7 = itemek.baseilosc7 + ilosc; } } }
static void TryUpdateButton(GameObject oobj, Font font) { SGK.QualityConfig.ButtonConfig[] cfgs = SGK.QualityConfig.GetInstance().buttonConfig; var rt = oobj.GetComponent <RectTransform>(); if (rt == null) { return; } UnityEngine.UI.Image image = oobj.GetComponent <UnityEngine.UI.Image>(); if (image != null) { do { /* * if (image.sprite == SGK.QualityConfig.GetInstance().closeButtonSprite) { * image.SetNativeSize(); * var listener = image.gameObject.GetComponent<UGUIClickEventListener>(); * if (listener != null) { * listener.disableTween = false; * } * break; ; * } */ for (int x = 0; x < cfgs.Length; x++) { if (image.sprite == cfgs[x].sprite) { var size = rt.sizeDelta; if (size.y != image.sprite.textureRect.height) { size.y = image.sprite.textureRect.height; rt.sizeDelta = size; } for (int n = 0; n < rt.childCount; n++) { Transform crt = rt.GetChild(n); UnityEngine.UI.Text text = crt.gameObject.GetComponent <UnityEngine.UI.Text>(); if (text != null) { text.font = font; text.fontSize = 22; text.color = Color.black; var shadow = text.GetComponent <UnityEngine.UI.Shadow>(); if (shadow != null) { DestroyImmediate(shadow, true); } } } EditorUtility.SetDirty(oobj); break; } } } while (false); } for (int n = 0; n < rt.childCount; n++) { Transform crt = rt.GetChild(n); TryUpdateButton(crt.gameObject, font); } }
// Use this for initialization void Start() { text.GetComponent <Score>().ResetScore(); }
void Start() { hostNameInput.GetComponent <InputField>().text = GameManager.Instance.ServerIP; }
void Start() { text = text.GetComponent <Text> (); text2 = text2.GetComponent <Text> (); text_g = text; }