Ejemplo n.º 1
0
        public virtual void OnNpcStatus()
        {
            if (cachedNpc != null)
            {
                NpcStatus status = cachedNpc.curStatus;
                if (status != statusInLastFrame)
                {
                    NpcStatusInfo info = new NpcStatusInfo();

                    if (status.AnySame(NpcStatus.Slient) && !statusInLastFrame.AnySame(NpcStatus.Slient))
                    {
                        info.addItem(NpcStatus.Slient, true);
                    }
                    else if (!status.AnySame(NpcStatus.Slient) && statusInLastFrame.AnySame(NpcStatus.Slient))
                    {
                        info.addItem(NpcStatus.Slient, false);
                    }

                    if (status.AnySame(NpcStatus.Unconscious) && !statusInLastFrame.AnySame(NpcStatus.Unconscious))
                    {
                        info.addItem(NpcStatus.Unconscious, true);
                        On_Suffer(true);
                    }
                    else if (!status.AnySame(NpcStatus.Unconscious) && statusInLastFrame.AnySame(NpcStatus.Unconscious))
                    {
                        info.addItem(NpcStatus.Unconscious, false);
                        On_Suffer(false);
                    }

                    if (status.AnySame(NpcStatus.Taunt) && !statusInLastFrame.AnySame(NpcStatus.Taunt))
                    {
                        info.addItem(NpcStatus.Taunt, true);
                    }
                    else if (!status.AnySame(NpcStatus.Taunt) && statusInLastFrame.AnySame(NpcStatus.Taunt))
                    {
                        info.addItem(NpcStatus.Taunt, false);
                    }

                    animMsg.nextAnim = WarMsg_Type.OnStatus.ToString();
                    animMsg.uniqueId = cachedNpc.UniqueID;
                    animMsg.data     = JSON.Instance.ToJSON(info);

                    if (serMgr != null)
                    {
                        serMgr.realServer.proxyCli.NPCAnim(animMsg);
                    }
                }
                statusInLastFrame = status;
            }
        }
Ejemplo n.º 2
0
 public virtual void OnNpcStatus(WarMsgParam param)
 {
     if (param != null)
     {
         string        m_str = param.param as string;
         NpcStatusInfo info  = JSON.Instance.ToObject <NpcStatusInfo>(m_str);
         if (info != null)
         {
             List <StatusInfoItem> list = info.items;
             if (list != null)
             {
                 GameObject obj = null;
                 foreach (StatusInfoItem si in list)
                 {
                     if (!statusCache.TryGetValue(si.status, out obj))
                     {
                         obj = ClientNpcAnimState.getStatusObj(si.status);
                         if (obj != null)
                         {
                             obj = Instantiate(obj) as GameObject;
                             if (obj != null)
                             {
                                 SkillEffectBase seb = obj.GetComponent <SkillEffectBase>();
                                 if (seb != null)
                                 {
                                     seb.EmitEffect(null, cachedNpc, true);
                                 }
                             }
                             statusCache.Add(si.status, obj);
                         }
                     }
                     obj.SetActive(si.isAdd);
                 }
             }
         }
     }
 }