コード例 #1
0
        /// <summary>
        /// Set the vlaues of this replicated member, this is called on clients
        /// after we receive an update from the network master of a member.
        /// </summary>
        /// <param name="Tick">The tick this update is for</param>
        /// <param name="Parameters">The value</param>
        public virtual void SetValues(uint Tick, params object[] Parameters)
        {
            // If the tick this update is for is past the current tick
            // Or if we are currently synching
            if (GameClock.GetRemoteTick() >= Tick || IsSynchInProgress())
            {
                UpdateValue(Parameters);
            }
            else
            {
                if (!ValueList.ContainsKey(Tick))
                {
                    ValueList.Add(Tick, new List <object>());
                }

                ValueList[Tick].Add(Parameters);
            }
        }
コード例 #2
0
        private void ClockedCall(uint Tick, ClockedRemoteCall.TypeOfCall Type, string NodePath, string Method,
                                 MDRemoteMode Mode, params object[] Parameters)
        {
            Node Target = GetNodeOrNull(NodePath);

            if (Target == null)
            {
                MDLog.Warn(LOG_CAT, $"Could not find target [{NodePath}] for ClockedRpcCall.");
                return;
            }
            MDLog.Trace(LOG_CAT, $"Got clocked call {Method} on {NodePath} with parameters ({MDStatics.GetParametersAsString(Parameters)})");
            ClockedRemoteCall RemoteCall = new ClockedRemoteCall(Tick, Type, WeakRef(Target), Method, Mode, Multiplayer.GetRpcSenderId(), Parameters);

            // Check if we should already invoke this (if the time has already passed)
            if (!RemoteCall.Invoke(GameClock.GetRemoteTick()))
            {
                ClockedRemoteCallList.Add(RemoteCall);
            }
        }