public void jump(int hp, int mp, GameSkillResutlType type, GameSkillOtherEffect otherType, OnEventOver over) { clear(); gameObject.SetActive(true); onEventOver = over; jumpCount = 0; RectTransform trans = GetComponent <RectTransform>(); position = trans.anchoredPosition; string str = GameDefine.getBigInt(hp.ToString()); if (mp != 0) { str = GameDefine.getBigInt(mp.ToString()); } float ox = 6.0f * str.Length / 2.0f; for (int i = 0; i < str.Length; i++) { GameObject obj = Instantiate <GameObject>(Resources.Load <GameObject>("Prefab/TextUI")); trans = obj.GetComponent <RectTransform>(); trans.SetParent(transform); trans.anchoredPosition = new Vector2(-ox + i * 6.0f, 0.0f); trans.localScale = new Vector3(0.5f, 0.5f, 0.5f); GameBattleJumpHPUIText jumpText = obj.GetComponent <GameBattleJumpHPUIText>(); jumpText.jump(-i * 0.1f, onJumpOver); Text text = obj.GetComponent <Text>(); text.text = str.Substring(i, 1); if (type == GameSkillResutlType.Cure || otherType == GameSkillOtherEffect.HealAll) { text.color = new Color(0.0f, 1.0f, 0.0f); } if (hp < 0 || mp < 0) { text.color = new Color(0.0f, 1.0f, 0.0f); } if (mp > 0) { text.color = new Color(0.0f, 0.9f, 1.0f); } objs.Add(obj); } }
public void jump(GameBattleAttackResultSide side, int hp, OnEventOver over) { clear(); gameObject.SetActive(true); RectTransform trans = GetComponent <RectTransform>(); if (side == GameBattleAttackResultSide.Right) { trans.anchoredPosition = new Vector2(-40.0f, 30.0f); } else { trans.anchoredPosition = new Vector2(54.0f, -24.0f); } position = trans.anchoredPosition; onEventOver = over; jumpCount = 0; string str = GameDefine.getBigInt(hp.ToString()); float ox = 6.0f * str.Length / 2.0f; for (int i = 0; i < str.Length; i++) { GameObject obj = Instantiate <GameObject>(Resources.Load <GameObject>("Prefab/TextUI")); trans = obj.GetComponent <RectTransform>(); trans.SetParent(transform); trans.anchoredPosition = new Vector2(-ox + i * 6.0f, 0.0f); trans.localScale = new Vector3(0.5f, 0.5f, 0.5f); GameBattleJumpHPUIText jumpText = obj.GetComponent <GameBattleJumpHPUIText>(); jumpText.jump(-i * 0.1f, onJumpOver); Text text = obj.GetComponent <Text>(); text.text = str.Substring(i, 1); if (hp < 0) { text.color = new Color(0.0f, 1.0f, 0.0f, 1.0f); } objs.Add(obj); } }