コード例 #1
0
        public override void CheckForValueUpdate()
        {
            // Check if we are the owner of this
            if (ShouldReplicate())
            {
                return;
            }

            uint RemoteTick   = GameClock.GetRemoteTick();
            bool ValueChanged = false;

            // Find the most recent update
            List <uint> touchedKeys = new List <uint>();

            foreach (uint key in ValueList.Keys)
            {
                if (key > RemoteTick)
                {
                    break;
                }

                ValueList[key].ForEach(parameters => GetCommandReplicator().MDProcessCommand((object[])parameters));
                ValueChanged = true;
                touchedKeys.Add(key);
            }

            if (ValueChanged)
            {
                // Remove old
                touchedKeys.ForEach(k => ValueList.Remove(k));

                // Send event
                if (OnValueChangedCallback != null)
                {
                    Node Instance = NodeRef.GetRef() as Node;
                    OnValueChangedCallback.Invoke(Instance, null);
                }
            }
        }
コード例 #2
0
        public override void SetValues(uint Tick, params object[] Parameters)
        {
            // If the tick this update is for is past the current tick
            if (GameClock.GetRemoteTick() >= Tick || IsSynchInProgress())
            {
                GetCommandReplicator().MDProcessCommand(Parameters);
                if (OnValueChangedCallback != null)
                {
                    Node Instance = NodeRef.GetRef() as Node;
                    OnValueChangedCallback.Invoke(Instance, null);
                }
            }
            else
            {
                if (!ValueList.ContainsKey(Tick))
                {
                    ValueList.Add(Tick, new List <object>());
                }

                ValueList[Tick].Add(Parameters);
            }
        }
コード例 #3
0
 public override void OnValueChanged(Enum newValue)
 {
     OnValueChangedCallback?.Invoke((T)newValue);
 }
コード例 #4
0
 public void OnValueChanged(T newValue)
 {
     OnValueChangedCallback?.Invoke(newValue);
 }