Exemple #1
0
        void Timer_Tick(object sender, EventArgs e)
        {
            if (CurrentAction != Default && CurrentAction.GetLoopTime() > 1)
            {
                CurrentAction = Default;
            }
            AMTFrame f = CurrentAction.GetNextFrameWithRandomness();

            Console.WriteLine("Delay: {0}", f.Delay);
            CMainDisplay.Background = new ImageBrush(AMTUtil.BytesToImageSource(Package.CurrentResource.Frames[f.FrameRef]));
            //Text(CTopLeft, 10, 100, "Timer Triggered", Color.FromRgb(0, 100, 100));
            Timer.Interval = TimeSpan.FromMilliseconds(f.Delay);
        }
Exemple #2
0
        public KeyValuePair <AMTFrame, byte[]> GetNextFrame()
        {
            if (CurrentFrame > Action.Frames.Count - 1)
            {
                CurrentFrame = 0;
            }
            if (CurrentFrame == Action.Frames.Count - 1)
            {
                LoopTimes++;
            }
            AMTFrame f = Action.Frames[CurrentFrame++];

            Package.SwitchResource(f.Resource);
            return(new KeyValuePair <AMTFrame, byte[]>(f, Package.CurrentResource.Frames[f.FrameRef]));
        }
Exemple #3
0
        public KeyValuePair <AMTFrame, byte[]> GetNextFrameWithRandomness()
        {
            if (CurrentFrame > Action.Frames.Count - 1)
            {
                CurrentFrame = 0;
            }
            if (CurrentFrame == Action.Frames.Count - 1)
            {
                LoopTimes++;
            }
            AMTFrame f = (AMTFrame)Action.Frames[CurrentFrame++].Clone();

            f.Delay = (int)((f.Randomness * RandomGenerator.NextDouble()) * f.Delay) + f.Delay;
            Package.SwitchResource(f.Resource);
            return(new KeyValuePair <AMTFrame, byte[]>(f, Package.CurrentResource.Frames[f.FrameRef]));
        }
Exemple #4
0
        /// <summary>
        /// Visualize Frame
        /// </summary>
        /// <param name="frame">frame to viualize</param>
        /// <returns>current frame</returns>
        public static string FrameToString(AMTFrame frame)
        {
            string str = "";

            if (frame.ActionRef == null)
            {
                str  = "Resrouce:[" + frame.Resource + "]" + "Frame Ref:[" + frame.FrameRef + "]" + "Delay:" + "[" + frame.Delay + "ms" + "]";
                str += "Randomness:[" + frame.Randomness + "]";
                str += "Tags:[";
                foreach (string s in frame.Tags)
                {
                    str += "(";
                    str += s;
                    str += ")";
                }
                str += "]";
            }
            else
            {
                str = "Action Reference: [" + frame.ActionRef + "]";
            }
            return(str);
        }
Exemple #5
0
 public FrameInfo(AMTFrame frame)
 {
     InitializeComponent();
     tbFrameInfo.Text = JsonConvert.SerializeObject(frame, Formatting.Indented);
 }