static void OnRemoveQueueItemSuccess(ProductionBlockSync sync, ref RemoveQueueItemMsg msg, MyNetworkClient sender)
 {
     if (!RemoveQueueItemTests(sync, msg))
     {
         return;
     }
     OnRemoveQueueItemInternal(sync, msg);
 }
            static void OnRemoveQueueItemRequest(ProductionBlockSync sync, ref RemoveQueueItemMsg msg, MyNetworkClient sender)
            {
                if (!RemoveQueueItemTests(sync, msg))
                {
                    return;
                }
                OnRemoveQueueItemInternal(sync, msg);

                Sync.Layer.SendMessageToAll(msg, MyTransportMessageEnum.Success);
            }
 private static void OnRemoveQueueItemInternal(ProductionBlockSync sync, RemoveQueueItemMsg msg)
 {
     if (msg.Idx >= 0)
     {
         sync.Block.RemoveQueueItem(msg.Idx);
     }
     else
     {
         sync.Block.RemoveFirstQueueItem(msg.Amount, msg.CurrentProgress);
     }
 }
            public void RemoveQueueItemRequest(int idx, MyFixedPoint amount)
            {
                Debug.Assert(idx != -2, "No longer supported.");
                var msg = new RemoveQueueItemMsg();

                msg.Idx                = idx;
                msg.Amount             = amount;
                msg.ProductionEntityId = Block.EntityId;

                Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request);
            }
            /// <summary>
            /// idx - index to insert to (-1 = last)
            /// </summary>
            public void RemoveQueueItemAnnounce(int idx, MyFixedPoint amount, float progress = 0f)
            {
                Debug.Assert(idx != -2, "No longer supported.");
                var msg = new RemoveQueueItemMsg();

                msg.Idx                = idx;
                msg.Amount             = amount;
                msg.CurrentProgress    = progress;
                msg.ProductionEntityId = Block.EntityId;

                Sync.Layer.SendMessageToAll(msg, MyTransportMessageEnum.Success);
            }
            private static bool RemoveQueueItemTests(ProductionBlockSync sync, RemoveQueueItemMsg msg)
            {
                Debug.Assert(msg.Idx != -2, "No longer supported.");

                if (sync == null)
                {
                    MySandboxGame.Log.WriteLine("Queue sync object is null!");
                    return(false);
                }
                if (sync != null && sync.Block == null)
                {
                    MySandboxGame.Log.WriteLine("Block of queue sync object is null!");
                    return(false);
                }
                if (!sync.Block.m_queue.IsValidIndex(msg.Idx) && msg.Idx != -1)
                {
                    MySandboxGame.Log.WriteLine("Invalid queue index in the remove item message!");
                    return(false);
                }

                return(true);
            }
Пример #7
0
 private static void OnRemoveQueueItemInternal(ProductionBlockSync sync, RemoveQueueItemMsg msg)
 {
     if (msg.Idx >= 0)
         sync.Block.RemoveQueueItem(msg.Idx);
     else
         sync.Block.RemoveFirstQueueItem(msg.Amount, msg.CurrentProgress);
 }
Пример #8
0
            private static bool RemoveQueueItemTests(ProductionBlockSync sync, RemoveQueueItemMsg msg)
            {
                Debug.Assert(msg.Idx != -2, "No longer supported.");

                if (sync == null)
                {
                    MySandboxGame.Log.WriteLine("Queue sync object is null!");
                    return false;
                }
                if (sync != null && sync.Block == null)
                {
                    MySandboxGame.Log.WriteLine("Block of queue sync object is null!");
                    return false;
                }
                if (!sync.Block.m_queue.IsValidIndex(msg.Idx) && msg.Idx != -1)
                {
                    MySandboxGame.Log.WriteLine("Invalid queue index in the remove item message!");
                    return false;
                }

                return true;
            }
Пример #9
0
 static void OnRemoveQueueItemSuccess(ProductionBlockSync sync, ref RemoveQueueItemMsg msg, MyNetworkClient sender)
 {
     if (!RemoveQueueItemTests(sync, msg)) return;
     OnRemoveQueueItemInternal(sync, msg);
 }
Пример #10
0
            static void OnRemoveQueueItemRequest(ProductionBlockSync sync, ref RemoveQueueItemMsg msg, MyNetworkClient sender)
            {
                if (!RemoveQueueItemTests(sync, msg)) return;
                OnRemoveQueueItemInternal(sync, msg);

                Sync.Layer.SendMessageToAll(msg, MyTransportMessageEnum.Success);
            }
Пример #11
0
            /// <summary>
            /// idx - index to insert to (-1 = last)
            /// </summary>
            public void RemoveQueueItemAnnounce(int idx, MyFixedPoint amount, float progress = 0f)
            {
                Debug.Assert(idx != -2, "No longer supported.");
                var msg = new RemoveQueueItemMsg();
                msg.Idx = idx;
                msg.Amount = amount;
                msg.CurrentProgress = progress;
                msg.ProductionEntityId = Block.EntityId;

                Sync.Layer.SendMessageToAll(msg, MyTransportMessageEnum.Success);
            }
Пример #12
0
            public void RemoveQueueItemRequest(int idx, MyFixedPoint amount)
            {
                Debug.Assert(idx != -2, "No longer supported.");
                var msg = new RemoveQueueItemMsg();
                msg.Idx = idx;
                msg.Amount = amount;
                msg.ProductionEntityId = Block.EntityId;

                Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request);
            }