private void ShowChat() { if (configItem.Guide_type == (int)GuideType.tip) { chartTrans.gameObject.SetActive(true); chartText.text = LanguageUtil.GetTxt(Convert.ToInt32(configItem.desc)).ToString(); chatBg.rectTransform.sizeDelta = new Vector2(500, chartText.preferredHeight + 60); chartTrans.localPosition = new Vector3(0, 150, 1); EventTriggerListener.Get(blackTrans.gameObject).onClick = OnBlankClick; trigTrans.gameObject.SetActive(false); return; } string firstAims = configItem.GetAims(); UpdateTargetTrans(firstAims); targetWorldUIPos = targetTrans.localPosition; if (configItem.desc != null && configItem.desc != "") { chartTrans.gameObject.SetActive(true); trigTrans.gameObject.SetActive(true); chartText.text = LanguageUtil.GetTxt(Convert.ToInt32(configItem.desc)).ToString(); chatBg.rectTransform.sizeDelta = new Vector2(500, chartText.preferredHeight + 60); int offx = 0; int offy = 0; Vector3 chatPos = new Vector3(); chatPos.x = targetWorldUIPos.x; if (chatPos.x > 260) { offx = (int)chatPos.x - 260; chatPos.x = 260; } if (chatPos.x < -260) { offx = (int)chatPos.x + 260; chatPos.x = -260; } chatPos.y = targetWorldUIPos.y; if (chatPos.y > 0 && configItem.Guide_type != (int)GuideType.link) { chatPos.y = targetWorldUIPos.y - targetTrans.sizeDelta.y / 2 - chatBg.rectTransform.sizeDelta.y / 2 - BASE_OFFSET; offy = 1; } else { chatPos.y = targetWorldUIPos.y + targetTrans.sizeDelta.y / 2 + chatBg.rectTransform.sizeDelta.y / 2 + BASE_OFFSET; offy = -1; } trigTrans.localScale = new Vector3(1, offy, 1); trigTrans.localPosition = new Vector3(offx, offy * chatBg.rectTransform.sizeDelta.y / 2, 1); chartTrans.localPosition = new Vector3(chatPos.x, chatPos.y, chatPos.z); } }
private void GuideView() { if (guidingItem.Guide_type == (int)GuideType.tip) { if (updateViewEvent != null) { updateViewEvent(guidingItem); } return; } GameObject target = GameObject.Find(guidingItem.GetAims()); if (target != null && target.activeSelf == true) { if (updateViewEvent != null) { updateViewEvent(guidingItem); } } else { //Debug.Log("target == null " + guidingItem.GetAims()); } }