Inheritance: MonoBehaviour
Example #1
0
 private void Reload()
 {
     Beginning.Raise(this, EventArgs.Empty);
     Reloaded.Raise(this, EventArgs.Empty);
     Ending.Raise(this, EventArgs.Empty);
     Ended.Raise(this, EventArgs.Empty);
 }
Example #2
0
        private void ModifySelected(IEnumerable <object> selection)
        {
            Beginning.Raise(this, EventArgs.Empty);

            foreach (var obj in selection)
            {
                var data = obj.As <DataItem>();
                if (data == null)
                {
                    continue;
                }

                switch (data.Type)
                {
                case DataType.Integer:
                    data.Value = (int)data.Value + s_random.Next(2, 6);
                    break;

                case DataType.String:
                    data.Value = string.Format("{0}{1}", data.Value, Alphabet[s_random.Next(0, Alphabet.Length)]);
                    break;
                }

                ItemChanged.Raise(this, new ItemChangedEventArgs <object>(data));
            }

            Ending.Raise(this, EventArgs.Empty);
            Ended.Raise(this, EventArgs.Empty);
        }
Example #3
0
        private void GenerateFlat(DataItem parent)
        {
            Beginning.Raise(this, EventArgs.Empty);

            var items = s_random.Next(5, 16);

            for (var i = 0; i < items; i++)
            {
                var data = CreateItem(parent);
                data.ItemChanged += DataItemChanged;

                if (parent != null)
                {
                    parent.Children.Add(data);
                }
                else
                {
                    m_data.Add(data);
                }

                ItemInserted.Raise(this, new ItemInsertedEventArgs <object>(-1, data, parent));
            }

            if (parent != null)
            {
                ItemChanged.Raise(this, new ItemChangedEventArgs <object>(parent));
            }

            Ending.Raise(this, EventArgs.Empty);
            Ended.Raise(this, EventArgs.Empty);
        }
Example #4
0
        public override int GetHashCode()
        {
            var hash = 163;

            hash *= 79 + Beginning.GetHashCode();
            hash *= 79 + End.GetHashCode();

            return(hash);
        }
Example #5
0
 public void ValidationBeginning()
 {
     try
     {
         Beginning.Raise(this, EventArgs.Empty);
     }
     finally
     {
         m_validating = true;
     }
 }
Example #6
0
 public void Delete(G_Island island)
 {
     if (island == Beginning)
     {
         Ending.RemoveBridge(this);
     }
     else
     {
         Beginning.RemoveBridge(this);
     }
     Destroy(gameObject);
 }
 public void DeleteByIndex(int index)
 {
     if (index >= Length || index < (-1) * Length)
     {
         throw new ArgumentOutOfRangeException("Index was out of range");
     }
     if (index < 0)
     {
         index = (int)Length + index;
     }
     if (Length == 1)
     {
         Beginning = null;
         Ending    = null;
         Length   -= 1;
     }
     else if (Length == 2 && index == 1)
     {
         Ending = null;
         Beginning.SetNodes(null, null);
         Length -= 1;
     }
     else if (index == 0)
     {
         Beginning = Beginning.Next;
         Beginning.SetNodes(null);
         Length -= 1;
         return;
     }
     else if (index == Length - 1)
     {
         Ending = Ending.Previous;
         Ending.SetNodes(Ending.Previous, null);
         Length -= 1;
         return;
     }
     else
     {
         Node <T> currentNode = Beginning;
         while (index > 0)
         {
             currentNode = currentNode.Next;
             index      -= 1;
         }
         currentNode.Previous.SetNodes(null, currentNode.Next);
         currentNode.Next.SetNodes(currentNode.Previous);
         Length -= 1;
     }
 }
 public T Add(T element)
 {
     Length += 1;
     if (Beginning == null)
     {
         Beginning = new Node <T>(element);
         return(Beginning.Value);
     }
     else if (Ending == null)
     {
         Ending = new Node <T>(element, Beginning);
         Beginning.SetNodes(null, Ending);
         return(Ending.Value);
     }
     else
     {
         Node <T> newNode = new Node <T>(element, Ending);
         Ending.SetNodes(Ending.Previous, newNode);
         Ending = newNode;
         return(Ending.Value);
     }
 }
Example #9
0
        /// <summary>
        /// Begins a transaction with the given name</summary>
        /// <param name="transactionName">Transaction name</param>
        /// <remarks>Throws an InvalidOperationException if another transaction is in
        /// progress</remarks>
        public virtual void Begin(string transactionName)
        {
            // If there is a transaction in progress, throw the exception.
            if (InTransaction)
            {
                throw new InvalidOperationException("already in transaction");
            }

            m_transactionCancelled = false;

            // Client code expects the transaction name to be available for listeners to the Beginning event.
            m_transactionName = transactionName;

            // Perform custom operations, such as closing an existing transaction.
            OnBeginning();
            Beginning.Raise(this, EventArgs.Empty);

            // Setting this indicates that a transaction is in progress; InTransaction will be true.
            if (!m_transactionCancelled)
            {
                m_transactionOperations = new List <Operation>();
            }
        }
Example #10
0
 public int CompareTo(MatchLocation other)
 {
     return(Beginning.CompareTo(other.Beginning));
 }
 public SetBeginningCommand(Module module, Beginning beginning)
 {
     Module    = module;
     Beginning = beginning;
 }
Example #12
0
 internal void Trim()
 {
     Name.Trim();
     Deadline.Trim();
     Beginning.Trim();
 }
 public void RaiseBeginning()
 {
     Beginning.Raise(this, EventArgs.Empty);
 }
Example #14
0
 public override int GetHashCode()
 {
     return(Beginning.GetHashCode() ^ Ending.GetHashCode());
 }
Example #15
0
 public override string ToString()
 {
     return(Beginning.ToString());
 }
Example #16
0
 public void ValidationBeginning()
 {
     Beginning.Raise(this, EventArgs.Empty);
 }
Example #17
0
 /// <summary>
 /// Переопределение эквивалентности для объектов одного класса.
 /// </summary>
 /// <param name="other">Объект для сравнения.</param>
 /// <returns>Одинаковы ли объекты.</returns>
 protected bool Equals(DiscussionResultDto other)
 {
     return(Beginning.Equals(other.Beginning) && Ending.Equals(other.Ending) && Theme == other.Theme && Resume == other.Resume);
 }