コード例 #1
0
 static void OnRemoveQueueItemSuccess(ProductionBlockSync sync, ref RemoveQueueItemMsg msg, MyNetworkClient sender)
 {
     if (!RemoveQueueItemTests(sync, msg))
     {
         return;
     }
     OnRemoveQueueItemInternal(sync, msg);
 }
コード例 #2
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);
            }
コード例 #3
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);
     }
 }
コード例 #4
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);
            }
コード例 #5
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);
            }
コード例 #6
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);
            }
コード例 #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);
            }