public void MsgTypeTip(MsgConfigInfo info, MsgSettingConfigInfo setting) { msgInfo = info; SettingEnd = setting; Content.text = info.content; //Debug.LogError("text =" + Content.text + "width = " + Content.width + "height = " + Content.height); SetLabelShow(Content, setting, info); SetShowInfo(setting); }
void SetShowInfo(MsgSettingConfigInfo setting) { ClearEvent(); UitPos = TweenPosition.Begin(root, setting.position_time_in, setting.position_end_in); EventDelegate.Add(UitPos.onFinished, ShowInfoTweenPosition); UitRot = TweenRotation.Begin(root, setting.rotation_time_in, Quaternion.Euler(setting.rotation_end_in)); EventDelegate.Add(UitRot.onFinished, ShowInfoTweenRotation, true); UitSca = TweenScale.Begin(root, setting.scale_time_in, setting.scale_end_in); EventDelegate.Add(UitSca.onFinished, ShowInfoTweenScale, true); UitAlp = TweenAlpha.Begin(Content.gameObject, setting.alpha_time_in, setting.alpha_end_in / Alpha); EventDelegate.Add(UitAlp.onFinished, ShowInfoTweenAlpha, true); }
void CheckMsgEnd() { if (currentIsEnd && worldMsg != null && worldMsg.Count != 0) { Msg msg = worldMsg.Dequeue(); msg.Init(); MsgConfigInfo msginfo = ConfigReader.GetMsgInfo(msg.msgID); MsgSettingConfigInfo setting = ConfigReader.GetMsgSettingInfo(msginfo.effect); msg.MsgTypeTip(msginfo, setting); currentIsEnd = false; msg.msgEndEvent += MsgEnd; } }
public void ShowMsg(MsgConfigInfo msginfo) { MsgSettingConfigInfo setting = null; if (msginfo == null) { //GameMethod.DebugError("error :msgID" + msgID); return; } setting = ConfigReader.GetMsgSettingInfo(msginfo.effect); if (setting == null) { //GameMethod.DebugError("error :msginfo.effect"); return; } switch ((MsgType)msginfo.msgType) { case MsgType.MsgType1: if (localMsg == null) { localMsg = new Msg(); } localMsg.Init(); localMsg.MsgTypeTip(msginfo, setting); break; case MsgType.MsgType2: Msg msg = new Msg(); msg.msgID = msginfo.id; worldMsg.Enqueue(msg); CheckMsgEnd(); break; case MsgType.MsgType4: break; } }
void SetLabelShow(UILabel worldLocalLabel, MsgSettingConfigInfo setting, MsgConfigInfo info) { worldLocalLabel.fontSize = setting.font_size; worldLocalLabel.color = setting.color; worldLocalLabel.alpha = setting.alpha_start_in / Alpha; worldLocalLabel.effectStyle = (UILabel.Effect)setting.font_effect; worldLocalLabel.effectColor = setting.fontEffect_color; worldLocalLabel.effectDistance = setting.fontEffect_distance; worldLocalLabel.depth = 100; root.transform.parent = GameMethod.GetUiCamera.transform; root.transform.localScale = setting.scale_start_in; root.transform.localPosition = setting.position_start_in; root.gameObject.SetActive(true); if (setting.if_frame != 0) { frame.SetDimensions((info.content.Length * setting.font_size + 80), setting.font_size + 15); frame.gameObject.SetActive(true); } else { frame.gameObject.SetActive(false); } }
public ReadMsgSettingConfig(string xmlFilePath) { //TextAsset xmlfile = Resources.Load(xmlFilePath) as TextAsset; ResourceUnit xmlfileUnit = ResourcesManager.Instance.loadImmediate(xmlFilePath, ResourceType.ASSET); TextAsset xmlfile = xmlfileUnit.Asset as TextAsset; if (!xmlfile) { //Debug.LogError(" error infos: 没有找到指定的xml文件:" + xmlFilePath); } xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlfile.text); XmlNodeList infoNodeList = xmlDoc.SelectSingleNode("MsgSettingConfig ").ChildNodes; for (int i = 0; i < infoNodeList.Count; i++) { if ((infoNodeList[i] as XmlElement).GetAttributeNode("id") == null) { continue; } string typeName = (infoNodeList[i] as XmlElement).GetAttributeNode("id").InnerText; //Debug.LogError(typeName); MsgSettingConfigInfo msgSettingInfo = new MsgSettingConfigInfo(); msgSettingInfo.id = Convert.ToInt32(typeName); #region 搜索 foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { switch (xEle.Name) { case "color": { msgSettingInfo.color = GameMethod.ResolveToColor(xEle.InnerText); } break; case "font_size": { msgSettingInfo.font_size = Convert.ToInt32(xEle.InnerText); } break; case "effect": { msgSettingInfo.font_effect = Convert.ToInt32(xEle.InnerText); } break; case "effect_color": { msgSettingInfo.fontEffect_color = GameMethod.ResolveToColor(xEle.InnerText); } break; case "effect_distance": { msgSettingInfo.fontEffect_distance = GameMethod.ResolveToVector2(xEle.InnerText); } break; case "position_start_in": { msgSettingInfo.position_start_in = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "position_end_in": { msgSettingInfo.position_end_in = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "position_time_in": msgSettingInfo.position_time_in = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); break; case "position_start_out": { msgSettingInfo.position_start_out = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "position_end_out": { msgSettingInfo.position_end_out = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "position_time_out": msgSettingInfo.position_time_out = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); break; case "rotation_start_in": { msgSettingInfo.rotation_start_in = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "rotation_end_in": { msgSettingInfo.rotation_end_in = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "rotation_time_in": msgSettingInfo.rotation_time_in = float.Parse(xEle.InnerText); break; case "rotation_start_out": { msgSettingInfo.rotation_start_out = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "rotation_end_out": { msgSettingInfo.rotation_end_out = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "rotation_time_out": msgSettingInfo.rotation_time_out = float.Parse(xEle.InnerText); break; case "scale_start_in": { msgSettingInfo.scale_start_in = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "scale_end_in": { msgSettingInfo.scale_end_in = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "scale_time_in": msgSettingInfo.scale_time_in = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); break; case "scale_start_out": { msgSettingInfo.scale_start_out = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "scale_end_out": { msgSettingInfo.scale_end_out = GameMethod.ResolveToVector3(xEle.InnerText); } break; case "scale_time_out": msgSettingInfo.scale_time_out = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); break; case "alpha_start_in": { msgSettingInfo.alpha_start_in = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); } break; case "alpha_end_in": { msgSettingInfo.alpha_end_in = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); } break; case "alpha_time_in": msgSettingInfo.alpha_time_in = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); break; case "alpha_start_out": { msgSettingInfo.alpha_start_out = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); } break; case "alpha_end_out": { msgSettingInfo.alpha_end_out = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); } break; case "alpha_time_out": msgSettingInfo.alpha_time_out = float.Parse(xEle.InnerText, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); break; case "if_frame": msgSettingInfo.if_frame = Convert.ToInt32(xEle.InnerText); break; case "staytime": msgSettingInfo.stayTime = Convert.ToInt32(xEle.InnerText); break; } } #endregion ConfigReader.msgSettingXmlInfoDic.Add(msgSettingInfo.id, msgSettingInfo); } }