void ParsePropose(Token token) { Advance(); //past 'propose MessageEffect effect = ParseMessageEffect(); effect.MessageTag.IsProposal = true; }
public void PrintGoldTips(Vector3 pos, int value) { GameObject tips = Instantiate(GameRoot.GetInstance().BattleField.assetManager.GoldTips); tips.GetComponent <RectTransform>().parent = GameRoot.GetInstance().battleTextUI.GetComponent <RectTransform>(); tips.SetActive(true); tips.GetComponent <Text>().text = "+" + value.ToString(); Canvas canvas = GameRoot.GetInstance().battleTextUI.GetComponent <Canvas>(); CamaraManager camara = GameRoot.GetInstance().CameraMng; Vector2 screenPos = Camera.main.WorldToScreenPoint(pos); tips.transform.position = new Vector3(screenPos.x, screenPos.y, 0); MessageEffect effect = new MessageEffect { effect = tips, uid = -1, duration = 0.6f, pos = pos }; messageCantainer.Add(effect); //float scale = camara.minSize / camara.size; tips.transform.localScale = Vector3.one; }
MessageEffect ParseMessageEffect() { MessageEffect effect = new MessageEffect(); PushNode(effect); ExprSeq expr = ParseExprSeq(); PopNode(); //TODO:!!!:Add new keyword support //ParseProperties(messageEffect); //parent.Add(effect); effect.ExprSeq = expr; PeekNode().AddChild(effect); return(effect); }
private void Update() { if (inBattle) { for (int index = messageCantainer.Count - 1; index >= 0; --index) { MessageEffect effect = messageCantainer[index]; MapField mapField = GameRoot.GetInstance().MapField; //Debug.Log("duration " + effect.duration); if (effect.duration <= 0) { messageCantainer.RemoveAt(index); Destroy(effect.effect); continue; } Canvas canvas = GameRoot.GetInstance().battleTextUI.GetComponent <Canvas>(); CamaraManager camara = GameRoot.GetInstance().CameraMng; Vector2 screenPos = Camera.main.WorldToScreenPoint(effect.pos); float scale = camara.GetViewSize(); float hight = Screen.height / 10 * scale; effect.effect.transform.position = new Vector3(screenPos.x, screenPos.y + Mathf.Clamp((1.1f - effect.duration) * 0.2f, 0, 0.2f) * hight, 0); if (effect.canvas == BattleUICanvas.BattleText) { Text text = effect.effect.GetComponentInChildren <Text>(); if (text != null) { text.gameObject.transform.localScale = Vector3.one * scale * 1.3f; } } messageCantainer[index].duration = effect.duration - Time.deltaTime; } } }
public Message(String message, float duration, MessageEffect effect) { this.message = message; this.duration = duration; this.effect = effect; }
//flag:1,crit,2,miss,3,heal,4,warning public void PrintMessage(int uid, string text, int flag) { MapField mapField = GameRoot.GetInstance().MapField; Entity entity; entity = mapField.FindEntity(uid); if (entity == null) { Debug.Log("entity is null"); return; } Canvas canvas = GameRoot.GetInstance().battleTextUI.GetComponent <Canvas>(); CamaraManager camara = GameRoot.GetInstance().CameraMng; Vector2 screenPos = Camera.main.WorldToScreenPoint(entity.GetSocketPos("S_Center")); //Vector2 uiPos = Vector2.zero; //uiPos.x = screenPos.x - (Screen.width / 2); //uiPos.y = screenPos.y - (Screen.height / 2); //hpBar.GetComponent<RectTransform>().position = new Vector3(0, 0, 0); GameObject message = Instantiate(GameRoot.GetInstance().BattleField.assetManager.Message); message.GetComponent <RectTransform>().parent = GameRoot.GetInstance().battleTextUI.GetComponent <RectTransform>(); //hpBar.GetComponent<RectTransform>().sizeDelta = new Vector2(Mathf.Sqrt(radius) / 2 * 80, 22); message.SetActive(true); if (entity.side == 2) { switch (flag) { case 0: message.GetComponentInChildren <Text>().text = text; message.GetComponentInChildren <Text>().color = new Color(0.95f, 0.10f, 0.18f); message.transform.localScale = Vector3.one; break; case 1: message.GetComponentInChildren <Text>().text = text; message.GetComponentInChildren <Text>().color = new Color(0.9f, 0.1f, 0.7f); message.GetComponent <TipMessage>().SetLogo(int.Parse(text)); message.transform.DOScale(Vector3.one * 3.5f, 0.1f).onComplete += () => { message.transform.DOScale(Vector3.one * 2f, 0.15f).onComplete += () => { message.transform.DOScale(Vector3.one * 1.5f, 0.45f); }; }; break; case 4: message.GetComponentInChildren <Text>().text = StrUtil.GetText(text); message.GetComponentInChildren <Text>().color = new Color(0.87f, 0.82f, 0.34f); message.transform.localScale = new Vector3(1.2f, 1, 1); break; } } else { switch (flag) { case 0: case 1: message.GetComponentInChildren <Text>().text = text; message.GetComponentInChildren <Text>().color = new Color(0.7f, 0.6f, 1f); message.transform.localScale = Vector3.one * 0.7f; break; case 4: message.GetComponentInChildren <Text>().text = StrUtil.GetText(text); message.GetComponentInChildren <Text>().color = new Color(0.87f, 0.82f, 0.34f); message.transform.localScale = new Vector3(0.96f, 0.8f, 0.8f); break; } } message.transform.position = new Vector3(screenPos.x, screenPos.y, 0); Color t_color = message.GetComponentInChildren <Text>().color; message.GetComponentInChildren <Text>().DOColor(new Color(t_color.r, t_color.g, t_color.b, 1), 0.5f).onComplete += () => { message.GetComponentInChildren <Text>().DOColor(new Color(t_color.r, t_color.g, t_color.b, 0), 0.5f); }; Image logo = message.GetComponent <TipMessage>().CritLogo.GetComponentInChildren <Image>(); Color l_color = logo.color; if (logo != null && logo.gameObject.activeSelf == true) { logo.DOColor(new Color(l_color.r, l_color.g, l_color.b, 1), 0.3f).onComplete += () => { logo.DOColor(new Color(l_color.r, l_color.g, l_color.b, 0), 0.4f); } } ; //init message struct MessageEffect effect = new MessageEffect { effect = message, uid = uid, duration = 1.1f, pos = entity.GetSocketPos("S_Center"), canvas = BattleUICanvas.BattleText, }; messageCantainer.Add(effect); //float scale = camara.minSize / camara.size; //message.transform.localScale = Vector3.one; //message.transform.DOMoveY(message.transform.position.y + 20, 0.2f); //Destroy(message, 0.2f); }