public void Update()
 {
     try
     {
         Dictionary <int, Effect> dictionary = new Dictionary <int, Effect>();
         foreach (KeyValuePair <int, Effect> current in this.m_Effects)
         {
             if (current.Value.Dead)
             {
                 current.Value.Destroy();
             }
             else
             {
                 dictionary.Add(current.Key, current.Value);
             }
         }
         this.m_Effects.Clear();
         this.m_Effects = dictionary;
         foreach (KeyValuePair <int, Effect> current in this.m_Effects)
         {
             current.Value.Update();
         }
     }
     catch (Exception ex)
     {
         EffectLogger.Fatal(ex.ToString());
     }
 }
示例#2
0
 public void Update()
 {
     try
     {
         Singleton <EffectManagerImplement> .singleton.Update();
     }
     catch (Exception message)
     {
         EffectLogger.Fatal(message);
     }
 }
 public void SetVisible(int id, bool bVisible)
 {
     try
     {
         if (this.m_Effects.ContainsKey(id))
         {
             this.m_Effects[id].SetVisible(bVisible);
         }
     }
     catch (Exception ex)
     {
         EffectLogger.Fatal(ex.ToString());
     }
 }
 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 void StopEffect(int id)
 {
     try
     {
         if (this.m_Effects.ContainsKey(id))
         {
             this.m_Effects[id].Destroy();
             this.m_Effects.Remove(id);
         }
     }
     catch (Exception ex)
     {
         EffectLogger.Fatal(ex.ToString());
     }
 }
示例#6
0
    public static void Init()
    {
        string fullPath = ResourceManager.GetFullPath("localLog.txt", false);

        Logger.Init(fullPath);
        if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXEditor)
        {
            Logger.IsInEditor = true;
        }
        else
        {
            Logger.IsInEditor = false;
        }
        AssetLogger.Init(new Logger("AssetLogger"));
        AssetLogger.LogLevel = UnityAssetEx.Export.EnumLogLevel.eLogLevel_Error;
        EffectLogger.Init(new Logger("EffectLogger"));
        EffectLogger.LogLevel = Effect.Export.EnumLogLevel.eLogLevel_Error;
    }
        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 void LoadEffect(int id)
 {
     if (!this.m_dicAllPreLoadAssetRequest.ContainsKey(id))
     {
         if (!this.m_EffectDatas.ContainsKey(id))
         {
             EffectLogger.Error("!m_EffectDatas.ContainsKey(id):" + id);
         }
         else
         {
             this.m_dicAllPreLoadAssetRequest[id] = new List <IAssetRequest>();
             EffectData effectData = this.m_EffectDatas[id];
             for (int i = 0; i < effectData.InstanceDatas.Count; i++)
             {
                 EffectInstanceData effectInstanceData = effectData.InstanceDatas[i];
                 IAssetRequest      assetRequest       = ResourceManager.singleton.LoadEffect(effectInstanceData.Path, null, AssetPRI.DownloadPRI_Low);
                 if (null != assetRequest)
                 {
                     this.m_dicAllPreLoadAssetRequest[id].Add(assetRequest);
                 }
             }
         }
     }
 }
示例#9
0
 public void Update()
 {
     try
     {
         if (this.m_Loaded)
         {
             if (this.m_Data.Life != 0f && Time.time - this.m_StartTime > this.m_Data.Life)
             {
                 this.Dead = true;
             }
             else
             {
                 this.Dead = true;
                 foreach (EffectInstance current in this.m_EffectInstances)
                 {
                     if (!current.Dead)
                     {
                         this.Dead = false;
                         break;
                     }
                 }
             }
             if (!this.Dead)
             {
                 foreach (var current in this.m_EffectInstances)
                 {
                     current.Update();
                 }
             }
         }
     }
     catch (Exception e)
     {
         EffectLogger.Fatal(e);
     }
 }
        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);
        }
示例#11
0
        public bool Load(XmlNode node)
        {
            bool result;

            if (null == node)
            {
                result = false;
            }
            else
            {
                try
                {
                    foreach (XmlNode xmlNode in node.ChildNodes)
                    {
                        string text = xmlNode.Name.ToLower();
                        switch (text)
                        {
                        case "beziercontrol":
                            this.mBezierControl.Load(xmlNode);
                            break;

                        case "type":
                            text = xmlNode.InnerText.ToLower();
                            switch (text)
                            {
                            case "uistand":
                                this.Type = EffectInstanceType.UIStand;
                                break;

                            case "uirandomtrace":
                                this.Type = EffectInstanceType.UIRandomTrace;
                                break;

                            case "randomtrace":
                                this.Type = EffectInstanceType.RandomTrace;
                                break;

                            case "addmaterial":
                                this.Type = EffectInstanceType.AddMaterial;
                                break;

                            case "uitrace":
                                this.Type = EffectInstanceType.UITrace;
                                break;

                            case "stand":
                                this.Type = EffectInstanceType.Stand;
                                break;

                            case "follow":
                                this.Type = EffectInstanceType.Follow;
                                break;

                            case "followtarget":
                                this.Type = EffectInstanceType.FollowTarget;
                                break;

                            case "trace":
                                this.Type = EffectInstanceType.Trace;
                                break;

                            case "spacelink":
                                this.Type = EffectInstanceType.SpaceLink;
                                break;

                            case "bindtocamera":
                                this.Type = EffectInstanceType.BindToCamera;
                                break;

                            case "ropeeffect":
                                this.Type = EffectInstanceType.RopeEffect;
                                break;
                            }
                            break;

                        case "life":
                            this.Life = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "fov":
                            this.Fov = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "cameracontrol":
                            this.CameraControl = (Convert.ToInt32(xmlNode.InnerText) == 1);
                            break;

                        case "cameracontroldelay":
                            this.CameraControlDelay = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "path":
                            this.Path = xmlNode.InnerText;
                            break;

                        case "sound":
                            this.Sound = xmlNode.InnerText;
                            break;

                        case "scale":
                            this.Scale = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "startdelay":
                            this.StartDelay = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "tracedelay":
                            this.TraceDelay = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "pathdelay":
                            this.PathDelay = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "fadeintime":
                            this.FadeInTime = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "fadeouttime":
                            this.FadeOutTime = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "uvspeedx":
                            this.UVSpeedX = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "uvspeedy":
                            this.UVSpeedY = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "followdirection":
                        {
                            int num2 = Convert.ToInt32(xmlNode.InnerText);
                            if (num2 == 1)
                            {
                                this.FollowDirection = true;
                            }
                            if (num2 == 2)
                            {
                                this.FollowLeagueDir = true;
                            }
                            if (num2 == 3)
                            {
                                this.FollowEmpireDir = true;
                            }
                            if (num2 == 4)
                            {
                                this.FixDir = true;
                            }
                            break;
                        }

                        case "tracetime":
                            this.TraceTime = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "tracetype":
                            text = xmlNode.InnerText.ToLower();
                            if (text == null)
                            {
                                goto IL_630;
                            }
                            if (!(text == "bezier"))
                            {
                                if (!(text == "line"))
                                {
                                    if (!(text == "gravity"))
                                    {
                                        goto IL_630;
                                    }
                                    this.InstanceTraceType = TraceType.Gravity;
                                }
                                else
                                {
                                    this.InstanceTraceType = TraceType.Line;
                                }
                            }
                            else
                            {
                                this.InstanceTraceType = TraceType.Bezier;
                            }
                            break;
IL_630:
                            this.InstanceTraceType = TraceType.Line;
                            break;

                        case "gravityheight":
                            this.GravityHeight = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "tracemovetype":
                            if ("fixspeed" == xmlNode.InnerText.ToLower())
                            {
                                this.InstanceTraceMoveType = TraceMoveType.FixMoveSpeed;
                            }
                            else
                            {
                                this.InstanceTraceMoveType = TraceMoveType.FixMoveTime;
                            }
                            break;

                        case "movespeed":
                            this.MoveSpeed = (float)Convert.ToDouble(xmlNode.InnerText);
                            break;

                        case "casterbindtype":
                            text = xmlNode.InnerText.ToLower();
                            switch (text)
                            {
                            case "head":
                                this.CasterBindType = EffectInstanceBindType.Head;
                                break;

                            case "body":
                                this.CasterBindType = EffectInstanceBindType.Body;
                                break;

                            case "foot":
                                this.CasterBindType = EffectInstanceBindType.Foot;
                                break;

                            case "lefthand":
                                this.CasterBindType = EffectInstanceBindType.LeftHand;
                                break;

                            case "righthand":
                                this.CasterBindType = EffectInstanceBindType.RightHand;
                                break;

                            case "pos":
                                this.CasterBindType = EffectInstanceBindType.Pos;
                                break;

                            case "leftspecial":
                                this.CasterBindType = EffectInstanceBindType.LeftWeapon;
                                break;

                            case "rightspecial":
                                this.CasterBindType = EffectInstanceBindType.RightWeapon;
                                break;

                            case "bcpoint":
                                this.CasterBindType = EffectInstanceBindType.OtherWeapon;
                                break;
                            }
                            break;

                        case "targetbindtype":
                            text = xmlNode.InnerText.ToLower();
                            switch (text)
                            {
                            case "head":
                                this.TargetBindType = EffectInstanceBindType.Head;
                                break;

                            case "body":
                                this.TargetBindType = EffectInstanceBindType.Body;
                                break;

                            case "foot":
                                this.TargetBindType = EffectInstanceBindType.Foot;
                                break;

                            case "lefthand":
                                this.TargetBindType = EffectInstanceBindType.LeftHand;
                                break;

                            case "righthand":
                                this.TargetBindType = EffectInstanceBindType.RightHand;
                                break;

                            case "pos":
                                this.TargetBindType = EffectInstanceBindType.Pos;
                                break;

                            case "leftspecial":
                                this.TargetBindType = EffectInstanceBindType.LeftWeapon;
                                break;

                            case "rightspecial":
                                this.TargetBindType = EffectInstanceBindType.RightWeapon;
                                break;

                            case "bcpoint":
                                this.TargetBindType = EffectInstanceBindType.OtherWeapon;
                                break;
                            }
                            break;

                        case "randtracecount":
                            this.RandTraceCount = Convert.ToInt32(xmlNode.InnerText);
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    EffectLogger.Error(ex.ToString());
                }
                result = true;
            }
            return(result);
        }