Inheritance: MonoBehaviour
Example #1
0
 public Fade(int Color, float From, float To, float Duration)
 {
     this.m_Color = Color;
     this.m_From  = (double)From;
     this.m_Delta = (double)To - (double)From;
     this.m_Sync  = new TimeSync((double)Duration);
 }
Example #2
0
 public bool setTextAndTimes(string input)
 {
     string realString = "";
     string timestr = "";
     TimeSpan tmptime = TimeSpan.FromSeconds(0);
     int state = 0; //0:read string, 1: read time
     for (int i = 0; i < input.Length; i++)
     {
         if (input[i] == '\n') continue;
         if (state == 0)
         {
             if (input[i] == '[')
             {
                 state = 1;
             }
             else
             {
                 realString += input[i];
             }
         }
         else
         {
             if (input[i] == ']')
             {
                 state = 0;
                 if (tmptime != TimeSpan.FromSeconds(0))
                 {
                     TimeSpan time1;
                     try
                     {
                         time1 = TimeSpan.ParseExact(timestr, "c", null);
                         TimeSync sync = new TimeSync();
                         sync.duration = new Duration(time1 - tmptime);
                         sync.len = realString.Length;
                         seriesTime.Add(sync);
                         tmptime = time1;
                     }
                     catch (Exception ex)
                     {
                         Debug.WriteLine(ex.Message);
                         return false;
                     }
                 }
                 else
                 {
                     try
                     {
                         tmptime = TimeSpan.ParseExact(timestr, "c", null);
                         this.BeginTime = tmptime;
                     }
                     catch (Exception ex)
                     {
                         Debug.WriteLine(ex.Message);
                         return false;
                     }
                 }
                 timestr = "";
             }
             else
             {
                 timestr += input[i];
             }
         }
     }
     this.Text = realString;
     this.EndTime = this.BeginTime;
     for (int i = 0; i < seriesTime.Count; i++)
     {
         this.EndTime += seriesTime[i].duration.TimeSpan;
     }
     return true;
 }
Example #3
0
 public bool addTimeSync(int textLen, TimeSpan time)
 {
     if (seriesTime.Count > 0)
     {
         if (textLen < seriesTime[seriesTime.Count - 1].len)
         {
             return false;
         }
     }
     if (textLen > this.Text.Length)
     {
         return false;
     }
     TimeSync tmp = new TimeSync();
     tmp.len = textLen;
     tmp.duration = new Duration(time);
     seriesTime.Add(tmp);
     this.EndTime = this.BeginTime;
     for (int i = 0; i < seriesTime.Count; i++)
     {
         this.EndTime += seriesTime[i].duration.TimeSpan;
     }
     return true;
 }