Ejemplo n.º 1
0
        public override void CopyFrom(InputDataBase fromBase)
        {
            InputData from = (InputData)fromBase;

            var stringTableEnum = from.stringTable.GetEnumerator();

            while (stringTableEnum.MoveNext())
            {
                var kv = stringTableEnum.Current;
                this.stringTable.Add(kv.Key, kv.Value);
            }

            var byteTableEnum = from.byteTable.GetEnumerator();

            while (byteTableEnum.MoveNext())
            {
                var kv = byteTableEnum.Current;
                this.byteTable.Add(kv.Key, kv.Value);
            }

            var intTableEnum = from.intTable.GetEnumerator();

            while (intTableEnum.MoveNext())
            {
                var kv = intTableEnum.Current;
                this.intTable.Add(kv.Key, kv.Value);
            }

            var fpTableEnum = from.fpTable.GetEnumerator();

            while (fpTableEnum.MoveNext())
            {
                var kv = fpTableEnum.Current;
                this.fpTable.Add(kv.Key, kv.Value);
            }

            var byteArrayTableEnum = from.byteArrayTable.GetEnumerator();

            while (byteArrayTableEnum.MoveNext())
            {
                var kv = byteArrayTableEnum.Current;
                this.byteArrayTable.Add(kv.Key, kv.Value);
            }

            var tsVectorTableEnum = from.tsVectorTable.GetEnumerator();

            while (tsVectorTableEnum.MoveNext())
            {
                var kv = tsVectorTableEnum.Current;
                this.tsVectorTable.Add(kv.Key, kv.Value);
            }

            var tsVectorTable2Enum = from.tsVectorTable2.GetEnumerator();

            while (tsVectorTable2Enum.MoveNext())
            {
                var kv = tsVectorTable2Enum.Current;
                this.tsVectorTable2.Add(kv.Key, kv.Value);
            }
        }
Ejemplo n.º 2
0
        void GetLocalData(InputDataBase playerInputData)
        {
            SyncInput.CurrentInputData = (InputData)playerInputData;

            if (behaviorsByPlayer.ContainsKey(playerInputData.ownerID))
            {
                List <SyncManagedBehaviour> managedBehavioursByPlayer = behaviorsByPlayer[playerInputData.ownerID];
                for (int i = 0; i < managedBehavioursByPlayer.Count; i++)
                {
                    SyncManagedBehaviour bh = managedBehavioursByPlayer[i];

                    if (bh != null && !bh.disabled)
                    {
                        bh.OnSyncedInput();
                    }
                }
            }

            SyncInput.CurrentInputData = null;
        }
Ejemplo n.º 3
0
        public override bool EqualsData(InputDataBase otherBase)
        {
            InputData other = (InputData)otherBase;

            if (this.stringTable.Count != other.stringTable.Count ||
                this.byteTable.Count != other.byteTable.Count ||
                this.intTable.Count != other.intTable.Count ||
                this.fpTable.Count != other.fpTable.Count ||
                this.byteArrayTable.Count != other.byteArrayTable.Count ||
                this.tsVectorTable.Count != other.tsVectorTable.Count ||
                this.tsVectorTable2.Count != other.tsVectorTable2.Count)
            {
                return(false);
            }

            if (!checkEqualsTable(this, other))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
 public abstract void CopyFrom(InputDataBase fromBase);
Ejemplo n.º 5
0
 public abstract bool EqualsData(InputDataBase otherBase);
Ejemplo n.º 6
0
        void OnStepUpdate(List <InputDataBase> allInputData)
        {
            time += lockedTimeStep;

//             if (ReplayRecord.replayMode != ReplayMode.LOAD_REPLAY)
//             {
//                 CheckGameObjectsSafeMap();
//             }

            SyncInput.SetAllInputs(null);

            for (int index = 0; index < generalBehaviours.Count; index++)
            {
                SyncManagedBehaviour bh = generalBehaviours[index];

                if (bh != null && !bh.disabled)
                {
                    bh.OnPreSyncedUpdate();
                    //instance.scheduler.UpdateAllCoroutines();
                }
            }

            for (int index = 0; index < allInputData.Count; index++)
            {
                InputDataBase playerInputData = allInputData[index];

                if (behaviorsByPlayer.ContainsKey(playerInputData.ownerID))
                {
                    List <SyncManagedBehaviour> managedBehavioursByPlayer = behaviorsByPlayer[playerInputData.ownerID];
                    for (int index2 = 0, length2 = managedBehavioursByPlayer.Count; index2 < length2; index2++)
                    {
                        SyncManagedBehaviour bh = managedBehavioursByPlayer[index2];

                        if (bh != null && !bh.disabled)
                        {
                            bh.OnPreSyncedUpdate();
                            //instance.scheduler.UpdateAllCoroutines();
                        }
                    }
                }
            }

            SyncInput.SetAllInputs(allInputData);

            SyncInput.CurrentSimulationData = null;
            for (int index = 0; index < generalBehaviours.Count; index++)
            {
                SyncManagedBehaviour bh = generalBehaviours[index];

                if (bh != null && !bh.disabled)
                {
                    bh.OnSyncedUpdate();
                    //instance.scheduler.UpdateAllCoroutines();
                }
            }

            for (int index = 0, length = allInputData.Count; index < length; index++)
            {
                InputDataBase playerInputData = allInputData[index];

                if (behaviorsByPlayer.ContainsKey(playerInputData.ownerID))
                {
                    SyncInput.CurrentSimulationData = (InputData)playerInputData;

                    List <SyncManagedBehaviour> managedBehavioursByPlayer = behaviorsByPlayer[playerInputData.ownerID];
                    for (int index2 = 0, length2 = managedBehavioursByPlayer.Count; index2 < length2; index2++)
                    {
                        SyncManagedBehaviour bh = managedBehavioursByPlayer[index2];

                        if (bh != null && !bh.disabled)
                        {
                            bh.OnSyncedUpdate();
                            //instance.scheduler.UpdateAllCoroutines();
                        }
                    }
                }

                SyncInput.CurrentSimulationData = null;
            }

            CheckQueuedBehaviours();
        }