Example #1
0
 /// <summary>Add new action triggered by the frequency freq and that will be runned first time with tick span.</summary>
 /// <param name="ca">Action storage in subprogram</param>
 protected void AddAct(ref CAct ca, Act act, uint freq, uint span = 0)
 {
     ca   = new CAct(AK == uint.MaxValue ? 1 : AK, act);
     freq = freq < 1 ? 1 : freq;
     AA.Add(AK == uint.MaxValue ? 1 : AK++, new Ad(OS.Tick + (span == 0 ? freq : span), freq));
     ActsToAdd.Add(new ActToAdd(ref ca, freq, span));
 }
Example #2
0
 /// <summary>Remove deferred action.</summary>
 protected void RemDefA(ref CAct a)
 {
     if (DefA.ContainsKey(a.ID) && DefA[a.ID] != null)
     {
         DefA[a.ID] -= a.Act;
     }
     a = new CAct(); // Removed actions have default id value 0
 }
Example #3
0
        /// <summary>Change action triggered by the frequency.</summary>
        /// <param name="ca">Editable action storage in subprogram</param>
        /// <param name="freq">New frequency.</param>
        /// <param name="span">Span to first run in ticks.</param>
        protected void ChaAct(ref CAct ca, uint freq, uint span = 0)
        {
            CAct t = new CAct();

            AddAct(ref t, ca.Act, freq, span);
            RemAct(ref ca);
            ca = t;
        }
Example #4
0
 /// <summary>Remove action triggered by the frequency.</summary>
 protected void RemAct(ref CAct a)
 {
     if (a.ID == 0)
     {
         return;
     }
     ActsToRem.Add(new CAct(a.ID, a.Act));
     a = new CAct(); // Removed actions have default id value 0
 }
Example #5
0
 /// <summary>Remove custom info in echo.</summary>
 public override void CClr()
 {
     for (int i = 0; i < C.Count() && C[i].ID != 0; i++)
     {
         RemDefA(ref C[i]);
         C[i] = new CAct();
     }
     Fields[FieldNames.Msg].Clear();
 }
Example #6
0
            /// <summary> Remove custom information after the time has elapsed. </summary>
            void CTimeRemove()
            {
                var i = Fields[FieldNames.Msg].Count;

                if (i > 0)
                {
                    Fields[FieldNames.Msg].RemoveAt(i - 1);
                    C[i - 1] = new CAct();
                }
            }
Example #7
0
 /// <summary>Show custom info at echo.</summary>
 public override void CShow(string s)
 {
     Fields[FieldNames.Msg].Insert(0, s);
     if (Fields[FieldNames.Msg].Count > C.Count())
     {
         Fields[FieldNames.Msg].RemoveAt(Fields[FieldNames.Msg].Count - 1);
     }
     for (int i = C.Count() - 1; i > 0; i--)
     {
         C[i] = C[i - 1];
     }
     C[0] = new CAct();
     AddDefA(ref C[0], CTimeRemove, DT);
     Refresh();
 }
Example #8
0
 public ActToAdd(ref CAct cact, uint f, uint s)
 {
     this.cact = cact; this.f = f; this.s = s;
 }
Example #9
0
 /// <summary>Add new deferred action that will run once after time span.</summary>
 protected void AddDefA(ref CAct ca, Act act, uint span)
 {
     ca = new CAct(OS.Tick + span, act);
     ActsToAdd.Add(new ActToAdd(ref ca, 0, span));
 }