public void LoadXml(string strConfigFile) { if (string.IsNullOrEmpty(strConfigFile)) { EffectLogger.Error("LoadXml:string.IsNullOrEmpty(strConfigFile) == true"); } else { try { XmlDocument xmlDocument = XmlResAdapter.GetXmlDocument(ResourceManager.GetFullPath(strConfigFile, false)); XmlNode xmlNode = xmlDocument.SelectSingleNode("EffectPool"); if (null == xmlNode) { EffectLogger.Error("null == root"); } else { XmlNodeList xmlNodeList = xmlNode.SelectNodes("Effect"); if (null == xmlNodeList) { EffectLogger.Error("null == nodeList"); } else { foreach (XmlNode effectNode in xmlNodeList) { EffectData effectData = new EffectData(); if (effectData.Load(effectNode)) { if (!this.m_EffectDatas.ContainsKey(effectData.Id)) { this.m_EffectDatas.Add(effectData.Id, effectData); } else { EffectLogger.Debug("true == m_EffectDatas.ContainsKey(data.Id):" + effectData.Id); } } } } } } catch (Exception ex) { EffectLogger.Error(ex.ToString()); } } }
public int PlayEffect(int id, IBeast caster, IBeast target) { int num = -1; int result; try { EffectLogger.Debug("PlayEffect:" + id); if (!this.m_EffectDatas.ContainsKey(id)) { EffectLogger.Error("!m_EffectDatas.ContainsKey(id):" + id); result = -1; return(result); } EffectData effectData = this.m_EffectDatas[id]; if (effectData == null) { result = -1; return(result); } Effect effect = new Effect(); effect.m_nEffectTypeId = id; effect.Caster = caster; effect.Target = target; num = this.GetID(); if (this.HighLight) { effect.HighLight = true; this.m_HightLightEffect.Add(num, effect); } effect.Load(effectData); if (num != -1) { effect.Id = num; this.m_Effects.Add(num, effect); } } catch (Exception e) { EffectLogger.Fatal(e.ToString()); } result = num; return(result); }
public int PlayEffect(int id, Beast iCast, Vector3 vec3SrcPos, IXUIObject uiObjectCast, Beast iTarget, Vector3 vec3DestPos, IXUIObject uiObjectTarget, Vector3 vec3FixDir) { int num = -1; try { if (this.m_EffectDatas.ContainsKey(id)) { EffectData effectData = this.m_EffectDatas[id]; if (null != effectData) { if (effectData.Reverse > 0) { if (iCast == null || null == iTarget) { effectData.Reverse = 0; } } Effect effect = new Effect(); effect.m_nEffectTypeId = id; effect.Caster = ((effectData.Reverse == 0) ? iCast : iTarget); effect.Target = ((effectData.Reverse == 0) ? iTarget : iCast); /*if (null != uiObjectCast) * { * effect.CasterUIObject = SafeXUIObject.GetSafeXUIObject(uiObjectCast); * } * if (null != uiObjectTarget) * { * effect.TargetUIObject = SafeXUIObject.GetSafeXUIObject(uiObjectTarget); * }*/ num = this.GetID(); if (num != -1) { if (this.HighLight) { effect.HighLight = true; this.m_HightLightEffect.Add(num, effect); } effect.Load(effectData); effect.Id = num; this.m_Effects.Add(num, effect); if (vec3SrcPos != Vector3.zero) { if (vec3DestPos != Vector3.zero) { this.m_Effects[num].SetSrcPos(vec3SrcPos); } else { this.m_Effects[num].SourcePos = vec3SrcPos; } } if (vec3DestPos != Vector3.zero) { this.m_Effects[num].TargetPos = vec3DestPos; } if (vec3FixDir != Vector3.zero) { this.m_Effects[num].FixDir = vec3FixDir; } EffectLogger.Debug("PlayEffect:" + id); } } } else { EffectLogger.Error("!m_EffectDatas.ContainsKey(id):" + id); } } catch (Exception ex) { EffectLogger.Fatal(ex.ToString()); } return(num); }