Ejemplo n.º 1
0
 void IInterpTimedEventReceiver.OnInterpTimedEvent()
 {
     if (!this.OnInterpTimedEvent())
     {
         InterpTimedEvent.MarkUnhandled();
     }
 }
Ejemplo n.º 2
0
    protected virtual bool OnInterpTimedEvent()
    {
        int    num;
        string tag = InterpTimedEvent.Tag;

        if (tag != null)
        {
            if (BasicWildLifeAI.< > f__switch$map7 == null)
            {
                Dictionary <string, int> strs = new Dictionary <string, int>(2)
                {
                    { "DEATH", 0 },
                    { "SOUND", 1 }
                };
                BasicWildLifeAI.< > f__switch$map7 = strs;
            }
            if (BasicWildLifeAI.< > f__switch$map7.TryGetValue(tag, out num))
            {
                if (num == 0)
                {
                    this.DoClientDeath();
                    return(true);
                }
                if (num == 1)
                {
                    this.PlaySnd(InterpTimedEvent.Argument <int>(0));
                    return(true);
                }
            }
        }
        return(false);
    }
Ejemplo n.º 3
0
 public bool Insert(InterpTimedEvent node)
 {
     InterpTimedEvent.Dir dir;
     dir.node = node;
     dir.has  = true;
     return(this.Insert(ref dir));
 }
Ejemplo n.º 4
0
 public bool Dequeue(UnityEngine.MonoBehaviour script, ulong playhead, out InterpTimedEvent node, ref InterpTimedEvent.LList.Iterator iter_)
 {
     if (this.count <= 0)
     {
         node = null;
         return(false);
     }
     InterpTimedEvent.Dir dir = (!iter_.started ? this.first : iter_.d);
     while (dir.has)
     {
         if ((double)((float)playhead) >= dir.node.info.timestamp)
         {
             if (dir.node.component == script)
             {
                 node          = dir.node;
                 iter_.d       = node.next;
                 iter_.started = true;
                 this.Remove(node);
                 return(true);
             }
             dir = dir.node.next;
         }
         else
         {
             break;
         }
     }
     iter_.d       = new InterpTimedEvent.Dir();
     iter_.started = true;
     node          = null;
     return(false);
 }
Ejemplo n.º 5
0
    void IInterpTimedEventReceiver.OnInterpTimedEvent()
    {
        int    num;
        string tag = InterpTimedEvent.Tag;

        if (tag != null)
        {
            if (ClientVitalsSync.< > f__switch$map2 == null)
            {
                ClientVitalsSync.< > f__switch$map2 = new Dictionary <string, int>(1)
                {
                    { "DMG", 0 }
                };
            }
            if (ClientVitalsSync.< > f__switch$map2.TryGetValue(tag, out num))
            {
                if (num != 0)
                {
                    InterpTimedEvent.MarkUnhandled();
                    return;
                }
                this.ClientHealthChange(InterpTimedEvent.Argument <float>(0), InterpTimedEvent.Argument <GameObject>(1));
                return;
            }
        }
        InterpTimedEvent.MarkUnhandled();
    }
Ejemplo n.º 6
0
 public static void EMERGENCY_DUMP(bool TRY_TO_EXECUTE)
 {
     Debug.LogWarning(string.Concat("RUNNING EMERGENCY DUMP: TRY TO EXECUTE=", TRY_TO_EXECUTE));
     try
     {
         try
         {
             if (!TRY_TO_EXECUTE)
             {
                 InterpTimedEvent.queue.EmergencyDump(false);
             }
             else
             {
                 try
                 {
                     foreach (InterpTimedEvent interpTimedEvent in InterpTimedEvent.queue.EmergencyDump(true))
                     {
                         try
                         {
                             try
                             {
                                 InterpTimedEvent.InvokeDirect(interpTimedEvent);
                             }
                             catch (Exception exception)
                             {
                                 Debug.LogException(exception);
                             }
                         }
                         finally
                         {
                             try
                             {
                                 interpTimedEvent.Dispose();
                             }
                             catch (Exception exception1)
                             {
                                 Debug.LogException(exception1);
                             }
                         }
                     }
                 }
                 catch (Exception exception2)
                 {
                     Debug.LogException(exception2);
                 }
             }
         }
         catch (Exception exception3)
         {
             Debug.LogException(exception3);
         }
     }
     finally
     {
         InterpTimedEvent.queue     = new InterpTimedEvent.LList();
         InterpTimedEvent.dump      = new InterpTimedEvent.Dir();
         InterpTimedEvent.dumpCount = 0;
     }
     Debug.LogWarning(string.Concat("END OF EMERGENCY DUMP: TRY TO EXECUTE=", TRY_TO_EXECUTE));
 }
Ejemplo n.º 7
0
    public void Local_HealthChange(float amount, uLink.NetworkViewID attackerID, uLink.NetworkMessageInfo info)
    {
        GameObject gameObject;

        object[] objArray;
        bool     flag;

        if (attackerID != uLink.NetworkViewID.unassigned)
        {
            uLink.NetworkView networkView  = uLink.NetworkView.Find(attackerID);
            uLink.NetworkView networkView1 = networkView;
            if (!networkView)
            {
                gameObject = null;
                objArray   = new object[] { amount, gameObject };
                flag       = InterpTimedEvent.Queue(this, "DMG", ref info, objArray);
                return;
            }
            gameObject = networkView1.gameObject;
            objArray   = new object[] { amount, gameObject };
            flag       = InterpTimedEvent.Queue(this, "DMG", ref info, objArray);
            return;
        }
        gameObject = null;
        objArray   = new object[] { amount, gameObject };
        flag       = InterpTimedEvent.Queue(this, "DMG", ref info, objArray);
    }
Ejemplo n.º 8
0
 public bool Dequeue(UnityEngine.MonoBehaviour script, ulong playhead, out InterpTimedEvent node, ref Iterator iter_)
 {
     if (this.count <= 0)
     {
         node = null;
         return(false);
     }
     for (InterpTimedEvent.Dir dir = !iter_.started ? this.first : iter_.d; dir.has; dir = dir.node.next)
     {
         if (playhead < dir.node.info.timestamp)
         {
             break;
         }
         if (dir.node.component == script)
         {
             node          = dir.node;
             iter_.d       = node.next;
             iter_.started = true;
             this.Remove(node);
             return(true);
         }
     }
     iter_.d       = new InterpTimedEvent.Dir();
     iter_.started = true;
     node          = null;
     return(false);
 }
Ejemplo n.º 9
0
 public bool Dequeue(ulong playhead, out InterpTimedEvent node, ref Iterator iter_)
 {
     if (this.count <= 0)
     {
         node = null;
         return(false);
     }
     InterpTimedEvent.Dir dir = !iter_.started ? this.first : iter_.d;
     while (dir.has)
     {
         if (playhead < dir.node.info.timestamp)
         {
             break;
         }
         node          = dir.node;
         iter_.d       = node.next;
         iter_.started = true;
         this.Remove(node);
         return(true);
     }
     iter_.d       = new InterpTimedEvent.Dir();
     iter_.started = true;
     node          = null;
     return(false);
 }
Ejemplo n.º 10
0
    private void Client_OnKilledShared(bool killedBy, Character attacker, ref uLink.NetworkMessageInfo info)
    {
        Controllable   controllable;
        bool           flag;
        AudioClipArray trait = base.GetTrait <CharacterSoundsTrait>().death;
        AudioClip      item  = trait[UnityEngine.Random.Range(0, trait.Length)];

        item.Play(base.transform.position, 1f, 1f, 10f);
        bool flag1 = base.localControlled;

        if (flag1)
        {
            base.rposLimitFlags = RPOSLimitFlags.KeepOff | RPOSLimitFlags.HideInventory | RPOSLimitFlags.HideContext | RPOSLimitFlags.HideSprites;
            DeathScreen.Show();
        }
        BaseHitBox remote = base.idMain.GetRemote <BaseHitBox>();

        if (remote)
        {
            remote.collider.enabled = false;
        }
        if (!killedBy || !attacker)
        {
            controllable = null;
            flag         = false;
        }
        else
        {
            controllable = attacker.controllable;
            flag         = (!controllable ? false : controllable.localPlayerControlled);
        }
        base.AdjustClientSideHealth(0f);
        if (flag1 || flag)
        {
            InterpTimedEvent.Queue(this, "ClientLocalDeath", ref info);
            if (!flag1)
            {
                InterpTimedEvent.Remove(this, true);
            }
            else
            {
                InterpTimedEvent.Clear(true);
            }
        }
        else
        {
            Collider[] componentsInChildren = base.GetComponentsInChildren <Collider>();
            for (int i = 0; i < (int)componentsInChildren.Length; i++)
            {
                Collider collider = componentsInChildren[i];
                if (collider)
                {
                    collider.enabled = false;
                }
            }
            InterpTimedEvent.Queue(this, "RAG", ref info);
            NetCull.DontDestroyWithNetwork(this);
        }
    }
Ejemplo n.º 11
0
 public static void Catchup(ulong playhead)
 {
     InterpTimedEvent._forceCatchupToDate = false;
     while (InterpTimedEvent.queue.Dequeue(playhead, out InterpTimedEvent.current))
     {
         InterpTimedEvent.Invoke();
     }
 }
Ejemplo n.º 12
0
 protected void RODone(uLink.NetworkMessageInfo info)
 {
     if (!this.__done)
     {
         NetCull.DontDestroyWithNetwork(this);
         InterpTimedEvent.Queue(this, "_done", ref info);
     }
 }
Ejemplo n.º 13
0
    private static void InvokeDirect(InterpTimedEvent evnt)
    {
        InterpTimedEvent current = InterpTimedEvent.current;

        InterpTimedEvent.current = evnt;
        Invoke();
        InterpTimedEvent.current = current;
    }
Ejemplo n.º 14
0
    private void Client_OnKilledShared(bool killedBy, Character attacker, ref NetworkMessageInfo info)
    {
        Controllable   controllable;
        bool           flag2;
        AudioClipArray death = base.GetTrait <CharacterSoundsTrait>().death;

        death[Random.Range(0, death.Length)].Play(base.transform.position, (float)1f, (float)1f, (float)10f);
        bool localControlled = base.localControlled;

        if (localControlled)
        {
            base.rposLimitFlags = RPOSLimitFlags.HideSprites | RPOSLimitFlags.HideContext | RPOSLimitFlags.HideInventory | RPOSLimitFlags.KeepOff;
            DeathScreen.Show();
        }
        BaseHitBox remote = base.idMain.GetRemote <BaseHitBox>();

        if (remote != null)
        {
            remote.collider.enabled = false;
        }
        if (killedBy && (attacker != null))
        {
            controllable = attacker.controllable;
            flag2        = (controllable != null) && controllable.localPlayerControlled;
        }
        else
        {
            controllable = null;
            flag2        = false;
        }
        base.AdjustClientSideHealth(0f);
        if (!localControlled && !flag2)
        {
            foreach (Collider collider in base.GetComponentsInChildren <Collider>())
            {
                if (collider != null)
                {
                    collider.enabled = false;
                }
            }
            InterpTimedEvent.Queue(this, "RAG", ref info);
            NetCull.DontDestroyWithNetwork((MonoBehaviour)this);
        }
        else
        {
            InterpTimedEvent.Queue(this, "ClientLocalDeath", ref info);
            if (localControlled)
            {
                InterpTimedEvent.Clear(true);
            }
            else
            {
                InterpTimedEvent.Remove(this, true);
            }
        }
    }
Ejemplo n.º 15
0
    void IInterpTimedEventReceiver.OnInterpTimedEvent()
    {
        int    num;
        string tag = InterpTimedEvent.Tag;

        if (tag != null)
        {
            if (DeathTransfer.< > f__switch$map3 == null)
            {
                Dictionary <string, int> strs = new Dictionary <string, int>(2)
                {
                    { "ClientLocalDeath", 0 },
                    { "RAG", 1 }
                };
                DeathTransfer.< > f__switch$map3 = strs;
            }
            if (DeathTransfer.< > f__switch$map3.TryGetValue(tag, out num))
            {
                if (num == 0)
                {
                    try
                    {
                        this.ClientLocalDeath();
                    }
                    finally
                    {
                        if (!base.localControlled)
                        {
                            UnityEngine.Object.Destroy(base.gameObject);
                        }
                    }
                    return;
                }
                else
                {
                    if (num != 1)
                    {
                        InterpTimedEvent.MarkUnhandled();
                        return;
                    }
                    try
                    {
                        this.DeathRagdoll();
                    }
                    finally
                    {
                        UnityEngine.Object.Destroy(base.gameObject);
                    }
                    return;
                }
            }
        }
        InterpTimedEvent.MarkUnhandled();
    }
Ejemplo n.º 16
0
 protected void InterpDestroy(uLink.NetworkMessageInfo info)
 {
     if (!base.networkView || !base.networkView.isMine)
     {
         InterpTimedEvent.Queue(this, "InterpDestroy", ref info);
         NetCull.DontDestroyWithNetwork(this);
     }
     else
     {
         InterpTimedEvent.Remove(this, true);
     }
 }
Ejemplo n.º 17
0
 protected void InterpDestroy(uLink.NetworkMessageInfo info)
 {
     if ((base.networkView != null) && base.networkView.isMine)
     {
         InterpTimedEvent.Remove(this, true);
     }
     else
     {
         InterpTimedEvent.Queue(this, "InterpDestroy", ref info);
         NetCull.DontDestroyWithNetwork((Facepunch.MonoBehaviour) this);
     }
 }
Ejemplo n.º 18
0
 internal bool Remove(InterpTimedEvent node)
 {
     if (!this.RemoveUnsafe(node))
     {
         return(false);
     }
     if (this.FAIL_SAFE_SET != null)
     {
         this.FAIL_SAFE_SET.Remove(node);
     }
     return(true);
 }
Ejemplo n.º 19
0
 protected void Snd(byte type, uLink.NetworkMessageInfo info)
 {
     try
     {
         InterpTimedEvent.Queue(this, "SOUND", ref info, new object[] { (int)type });
     }
     catch (Exception exception)
     {
         Debug.LogException(exception);
         Debug.LogWarning("Running emergency dump because of previous exception in Snd", this);
         InterpTimedEvent.EMERGENCY_DUMP(true);
     }
 }
Ejemplo n.º 20
0
 protected void OnDestroy()
 {
     try
     {
         InterpTimedEvent.Remove(this, true);
         this.ClearMods();
     }
     finally
     {
         this._parentViewID = uLink.NetworkViewID.unassigned;
         this.ClearSignals();
         base.OnDestroy();
     }
 }
Ejemplo n.º 21
0
 void IInterpTimedEventReceiver.OnInterpTimedEvent()
 {
     if (InterpTimedEvent.Tag == "LAND")
     {
         this.LandShared();
         GameObject obj2 = UnityEngine.Object.Instantiate(this.landedEffect, base.transform.position, base.transform.rotation) as GameObject;
         UnityEngine.Object.Destroy(obj2, 2.5f);
         this._landed = true;
         this.chute.Landed();
     }
     else
     {
         InterpTimedEvent.MarkUnhandled();
     }
 }
Ejemplo n.º 22
0
 private void OnDestroy()
 {
     if (singleton == this)
     {
         try
         {
             InterpTimedEvent.Clear(false);
         }
         finally
         {
             singleton = null;
             exists    = false;
         }
     }
 }
 private void OnDestroy()
 {
     if (InterpTimedEventSyncronizer.singleton == this)
     {
         try
         {
             InterpTimedEvent.Clear(false);
         }
         finally
         {
             InterpTimedEventSyncronizer.singleton = null;
             InterpTimedEventSyncronizer.exists    = false;
         }
     }
 }
Ejemplo n.º 24
0
    protected void OnClientDeath(ref Vector3 deathPosition, uLink.NetworkViewID attackerNetViewID, ref uLink.NetworkMessageInfo info)
    {
        Vector3 vector;
        Vector3 vector2;

        TransformHelpers.GetGroundInfo(deathPosition + new Vector3(0f, 0.25f, 0f), 10f, out vector, out vector2);
        deathPosition = vector;
        Quaternion rot = TransformHelpers.LookRotationForcedUp((Vector3)(this._myTransform.rotation * Vector3.forward), vector2);

        this._interp.SetGoals(deathPosition, rot, info.timestamp);
        if (attackerNetViewID.isMine)
        {
            this.DoClientDeath();
        }
        else
        {
            InterpTimedEvent.Queue(this, "DEATH", ref info);
        }
    }
Ejemplo n.º 25
0
 private bool RemoveUnsafe(InterpTimedEvent node)
 {
     if (((this.count > 0) && (node != null)) && node.inlist)
     {
         if (node.prev.has)
         {
             if (node.next.has)
             {
                 node.next.node.prev = node.prev;
                 node.prev.node.next = node.next;
                 this.count--;
                 node.prev   = node.next = new InterpTimedEvent.Dir();
                 node.inlist = false;
                 return(true);
             }
             this.last           = node.prev;
             this.last.node.next = new InterpTimedEvent.Dir();
             this.count--;
             node.prev   = node.next = new InterpTimedEvent.Dir();
             node.inlist = false;
             return(true);
         }
         if (node.next.has)
         {
             this.first           = node.next;
             this.first.node.prev = new InterpTimedEvent.Dir();
             this.count--;
             node.prev   = node.next = new InterpTimedEvent.Dir();
             node.inlist = false;
             return(true);
         }
         if (this.first.node == node)
         {
             this.first  = this.last = new InterpTimedEvent.Dir();
             this.count  = 0;
             node.prev   = node.next = new InterpTimedEvent.Dir();
             node.inlist = false;
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 26
0
    public static bool QueueOrExecute(IInterpTimedEventReceiver receiver, bool immediate, string tag, ref uLink.NetworkMessageInfo info, params object[] args)
    {
        UnityEngine.MonoBehaviour behaviour = receiver as UnityEngine.MonoBehaviour;
        InterpTimedEvent          evnt      = New(behaviour, tag, ref info, args, immediate);

        if (evnt == null)
        {
            return(false);
        }
        if (immediate)
        {
            InvokeDirect(evnt);
        }
        else if (!InterpTimedEventSyncronizer.available)
        {
            Debug.LogWarning("Not running event because theres no syncronizer available. " + tag, receiver as UnityEngine.Object);
            return(false);
        }
        return(true);
    }
Ejemplo n.º 27
0
    public static void Clear(bool invokePending)
    {
        InterpTimedEvent interpTimedEvent;

        InterpTimedEvent.LList.Iterator iterator = new InterpTimedEvent.LList.Iterator();
        if (!invokePending)
        {
            while (InterpTimedEvent.queue.Dequeue((ulong)-1, out interpTimedEvent, ref iterator))
            {
                interpTimedEvent.Dispose();
            }
        }
        else
        {
            while (InterpTimedEvent.queue.Dequeue((ulong)-1, out interpTimedEvent, ref iterator))
            {
                InterpTimedEvent.InvokeDirect(interpTimedEvent);
            }
        }
    }
Ejemplo n.º 28
0
    public static void Remove(UnityEngine.MonoBehaviour receiver, bool invokePending)
    {
        InterpTimedEvent interpTimedEvent;

        InterpTimedEvent.LList.Iterator iterator = new InterpTimedEvent.LList.Iterator();
        if (!invokePending)
        {
            while (InterpTimedEvent.queue.Dequeue(receiver, (ulong)-1, out interpTimedEvent, ref iterator))
            {
                interpTimedEvent.Dispose();
            }
        }
        else
        {
            while (InterpTimedEvent.queue.Dequeue(receiver, (ulong)-1, out interpTimedEvent, ref iterator))
            {
                InterpTimedEvent.InvokeDirect(interpTimedEvent);
            }
        }
    }
Ejemplo n.º 29
0
    protected void uLink_OnNetworkInstantiate(uLink.NetworkMessageInfo info)
    {
        PosRot posRot = new PosRot();

        this.view = (Facepunch.NetworkView)info.networkView;
        uLink.BitStream bitStream = this.view.initialData;
        if (this.expectsInitialVelocity)
        {
            this.initialVelocity = bitStream.ReadVector3();
        }
        if (this.expectsOwner)
        {
            this.ownerViewID = bitStream.ReadNetworkViewID();
        }
        this.spawnTime      = info.timestamp;
        this.updateInterval = 1 / ((double)NetCull.sendRate * (double)Mathf.Max(1f, this.updateRate));
        this.hasInterp      = this._interp;
        if (this.hasInterp)
        {
            this._interp.running = false;
        }
        this.rigidbody.isKinematic = true;
        this.__hiding = this.spawnTime > Interpolation.time;
        if (!this.__hiding)
        {
            this.OnShow();
        }
        else
        {
            this.OnHide();
            if (this.hasInterp)
            {
                posRot.position = this.view.position;
                posRot.rotation = this.view.rotation;
                this._interp.SetGoals(posRot, this.spawnTime);
            }
            InterpTimedEvent.Queue(this, "_init", ref info);
        }
    }
Ejemplo n.º 30
0
    internal static InterpTimedEvent New(UnityEngine.MonoBehaviour receiver, string tag, ref uLink.NetworkMessageInfo info, object[] args, bool immediate)
    {
        InterpTimedEvent node;

        if (receiver == null)
        {
            Debug.LogError("receiver is null or has been destroyed", receiver);
            return(null);
        }
        if (!(receiver is IInterpTimedEventReceiver))
        {
            Debug.LogError("receiver of type " + receiver.GetType() + " does not implement IInterpTimedEventReceiver", receiver);
            return(null);
        }
        if (dump.has)
        {
            dumpCount--;
            node          = dump.node;
            dump          = node.next;
            node.next     = new Dir();
            node.prev     = new Dir();
            node.disposed = false;
        }
        else
        {
            node = new InterpTimedEvent();
        }
        node.args      = ArgList.New(args);
        node.tag       = tag;
        node.component = receiver;
        node.info      = info;
        if (!immediate)
        {
            queue.Insert(node);
        }
        return(node);
    }