コード例 #1
0
            public override void AssetTransferComplete()
            {
                base.AssetTransferComplete();
                m_Transaction?.Commit();

                ObjectPart     part;
                SceneInterface scene;
                UGUI           sellOwner;

                if (TryGetScene(m_SceneID, out scene) &&
                    scene.Primitives.TryGetValue(m_SellingPrimitiveID, out part))
                {
                    sellOwner = part.Owner;
                    foreach (ObjectBuyListen lt in scene.m_ObjectBuyListeners.Values)
                    {
                        ObjectPartInventoryItem item;
                        if (scene.Primitives.TryGetValue(lt.PrimitiveID, out part) &&
                            part.Inventory.TryGetValue(lt.ItemID, out item) &&
                            part.Owner.EqualsGrid(sellOwner))
                        {
                            ScriptInstance script = item.ScriptInstance;
                            script?.PostEvent(new ItemSoldEvent
                            {
                                Agent      = m_DestinationAgent,
                                ObjectID   = m_SellingPrimitiveID,
                                ObjectName = part.Name
                            });
                        }
                    }
                }
            }
コード例 #2
0
        private static void SetTypeDiagramSelfMode(IEnumerable <IViewModel> selection, SelfTypeMode mode)
        {
            SelfType selfType = FindSelfType(selection);

            using (IActiveTransaction transaction = selfType.TransactionManager.BeginTransaction("Set SelfType mode", TransactionPurpose.User))
            {
                selfType.Mode = mode;
                transaction.Commit();
            }
        }
コード例 #3
0
 public static void SetBorrowTunnelsMode <T>(this IEnumerable <T> borrowTunnels, BorrowMode borrowMode) where T : Element, IBorrowTunnel
 {
     if (borrowTunnels.Any())
     {
         using (IActiveTransaction transaction = (borrowTunnels.First()).TransactionManager.BeginTransaction("Set BorrowTunnel BorrowMode", TransactionPurpose.User))
         {
             foreach (T borrowTunnel in borrowTunnels)
             {
                 borrowTunnel.BorrowMode = borrowMode;
             }
             transaction.Commit();
         }
     }
 }
コード例 #4
0
        /** <summary> Process a transaction for paying a user by a group</summary>
         * <exception cref="InsufficientFundsException">this exception is thrown when not enough funds are available</exception>
         * <exception cref="NotSupportedException">this exception is thrown when the economy service does not support group accounts</exception>
         */
        public void TransferMoney(UGI sourceID, UGUI destinationID, BaseTransaction transactionData, int amount, Action processOperation)
        {
            IActiveTransaction transaction = BeginTransferTransaction(sourceID, destinationID, transactionData, amount);

            try
            {
                processOperation();
            }
            catch (Exception e)
            {
                transaction.Rollback(e);
                throw;
            }
            transaction.Commit();
        }
コード例 #5
0
        public void ChargeAmount(UGUI agentID, BaseTransaction transactionData, int amount, Action processOperation)
        {
            IActiveTransaction transaction = BeginChargeTransaction(agentID, transactionData, amount);

            try
            {
                processOperation();
            }
            catch (Exception e)
            {
                transaction.Rollback(e);
                throw;
            }
            transaction.Commit();
        }