// ================================================================ // // 残機アイコン(ねこの顔)を作る. protected FaceIcon create_face_icon() { FaceIcon icon = GameObject.Instantiate(this.uiFaceIconPrefab).GetComponent <FaceIcon>(); icon.GetComponent <RectTransform>().SetParent(this.uiCanvas.GetComponent <RectTransform>()); icon.GetComponent <RectTransform>().SetSiblingIndex(0); return(icon); }
void Start() { Navi.face_icon_base_position.x = -Screen.width / 2.0f + FaceIcon.WIDTH / 2.0f + 10.0f; Navi.face_icon_base_position.y = -Screen.height / 2.0f + FaceIcon.HEIGHT / 2.0f + 30.0f; for (int i = SceneControl.LIFE_COUNT - 1; i >= 0; i--) { FaceIcon face_icon = this.create_face_icon(); Vector2 position = Navi.face_icon_base_position + new Vector2(0.0f, 25.0f * i); face_icon.setPosition(position); this.face_icons.Add(face_icon); } }
// Update is called once per frame void Update() { if (textString != null)// && Input.GetKeyDown(KeyCode.Space)) { if (textString == textComponent.text && Input.GetKeyDown(KeyCode.Space)) { textString = null; if (Textbox_Controller.textSize == 0) { textComponent.gameObject.SetActive(false); background.gameObject.SetActive(false); EventHandler.isBusy = false; Textbox_Controller.isClosing = true; } ContinueButton.gameObject.SetActive(false); NameTag.SetActive(false); Face.gameObject.SetActive(false); } } else if (Textbox_Controller.text[0] != null) { textString = Textbox_Controller.text[0]; //Textbox_Controller.text[0] = null; for (int Count = 0; Count < Textbox_Controller.textSize - 1; Count++) { Textbox_Controller.text[Count] = Textbox_Controller.text[Count + 1]; } Textbox_Controller.text[Textbox_Controller.textSize - 1] = null; Textbox_Controller.textSize--; //textComponent.text = textString; string[] newString = textString.Split('\t'); string nameTag; string FaceIcon; nameTag = (newString.Length == 3 && newString[0][0] != '0') ? newString[0] : null; FaceIcon = (newString.Length == 3 && newString[1][0] != '0') ? newString[1] : null; textString = newString[newString.Length - 1]; textComponent.text = ""; StartCoroutine(ShowLetters()); textComponent.gameObject.SetActive(true); background.gameObject.SetActive(true); if (nameTag != null) { NameTagText.text = nameTag; NameTag.SetActive(true); } if (FaceIcon != null) { Face.sprite = Resources.Load <Sprite>("Sprites/Faces/" + FaceIcon.Trim()); if (Face.sprite == null) { Debug.LogError("Not found" + FaceIcon); } Face.gameObject.SetActive(true); } } else { Textbox_Controller.isClosing = false; } }