void Events_Tick(object sender, TickEventArgs e) { timeElapsed += e.SecondsElapsed; while (timeElapsed > 1.0 / file.Header.Fps) { lock (((ICollection)frameQueue).SyncRoot) { if (frameQueue.Count <= 0) { return; } } timeElapsed -= (float)(1.0f / file.Header.Fps); byte[] argbData = frameQueue.Dequeue(); currentFrame = GuiUtil.CreateImage(argbData, (ushort)Width, (ushort)Height, 32, Width * 4); EmitFrameReady(); if (frameQueue.Count < (buffered_frames / 2) + 1) { waitEvent.Set(); } } }
void FlipPage(object sender, TickEventArgs e) { totalElapsed += e.MillisecondsElapsed; if (totalElapsed < millisDelay) { return; } totalElapsed = 0; AdvanceToNextPage(); }
public void CursorTick(object sender, TickEventArgs e) { totalElapsed += e.MillisecondsElapsed; if (totalElapsed < millisDelay) { return; } totalElapsed = 0; current_frame++; SetNeedsDisplay(); }
void NavigateTick(object sender, TickEventArgs e) { // totalElapsed += e.TicksElapsed; if (totalElapsed < millisDelay) { return; } sprite.Invalidate(); pixel_x += delta_x; pixel_y += delta_y; if (dest_pixel_x - pixel_x < 2) { pixel_x = dest_pixel_x; } if (dest_pixel_y - pixel_y < 2) { pixel_y = dest_pixel_y; } sprite.SetPosition(pixel_x, pixel_y); sprite.Invalidate(); x = pixel_x << 2; y = pixel_y << 2; if (pixel_x == dest_pixel_x && pixel_y == dest_pixel_y) { startCurrentSegment = endCurrentSegment; navigatePath.RemoveAt(0); // if we're at the destination, remove the tick handler if (navigatePath.Count == 0) { sprite.RunScript(AnimationType.WalkingToIdle); Game.Instance.Tick -= NavigateTick; } else { endCurrentSegment = navigatePath[0]; sprite.Face(ClassifyDirection(startCurrentSegment, endCurrentSegment)); dest_pixel_x = endCurrentSegment.X * 4 + 4; dest_pixel_y = endCurrentSegment.Y * 4 + 4; delta_x = dest_pixel_x - pixel_x; delta_y = dest_pixel_y - pixel_y; } } }
static void SpriteManagerPainterTick(object sender, TickEventArgs args) { #if notyet for (int i = 0; i < sprites.Count; i++) { Sprite s = sprites[i]; if (s.Tick(args.TicksElapsed) == false) { Console.WriteLine("removing sprite!!!!"); sprites.RemoveAt(i); } } #endif }
void LoadingFlasher (object sender, TickEventArgs e) { totalElapsed += e.MillisecondsElapsed; if ((Elements[LOADING_ELEMENT_INDEX].Visible && (totalElapsed < FLASH_ON_DURATION)) || (!Elements[LOADING_ELEMENT_INDEX].Visible && (totalElapsed < FLASH_OFF_DURATION)) ) return; Console.WriteLine ("Flashing"); Elements[LOADING_ELEMENT_INDEX].Visible = !Elements[LOADING_ELEMENT_INDEX].Visible; totalElapsed = 0; }
void LoadingFlasher(object sender, TickEventArgs e) { totalElapsed += e.MillisecondsElapsed; if ((Elements[LOADING_ELEMENT_INDEX].Visible && (totalElapsed < FLASH_ON_DURATION)) || (!Elements[LOADING_ELEMENT_INDEX].Visible && (totalElapsed < FLASH_OFF_DURATION))) { return; } Console.WriteLine("Flashing"); Elements[LOADING_ELEMENT_INDEX].Visible = !Elements[LOADING_ELEMENT_INDEX].Visible; totalElapsed = 0; }
public void ScrollTick(object sender, TickEventArgs e) { scroll_elapsed += (int)e.MillisecondsElapsed; if (scroll_elapsed < 6 /*XXX*/) { return; } scroll_elapsed = 0; if (horiz_delta == 0 && vert_delta == 0) { return; } int old_topleft_x = topleft_x; int old_topleft_y = topleft_y; topleft_x += horiz_delta; topleft_y += vert_delta; ClipTopLeft(); if (old_topleft_x == topleft_x && old_topleft_y == topleft_y) { return; } SpriteManager.SetUpperLeft(topleft_x, topleft_y); mapRenderer.SetUpperLeft(topleft_x, topleft_y); UpdateCursor(); #if notyet Painter.Invalidate(new Rectangle(new Point(0, 0), new Size(Painter.SCREEN_RES_X, 375))); #endif }
public void CursorTick (object sender, TickEventArgs e) { totalElapsed += e.MillisecondsElapsed; if (totalElapsed < millisDelay) return; totalElapsed = 0; current_frame++; SetNeedsDisplay (); }
public void Tick (object sender, TickEventArgs e) { TriggerAction[] actions = triggerData.Triggers[0].Actions; if (current_action == actions.Length) return; // FIXME we need to figure out how many ticks per second SC1 used for normal mode... 6? totalElapsed += (int)e.MillisecondsElapsed; /* if we're presently waiting, make sure enough time has gone by. otherwise return */ if (totalElapsed < sleepUntil * 166 /* 166 = 1/6th of a second */) return; totalElapsed = 0; while (current_action < actions.Length) { TriggerAction action = actions[current_action]; current_action ++; switch (action.Action) { case 0: /* no action */ break; case 1: sleepUntil = (int)action.Delay; return; case 2: GuiUtil.PlaySound (screen.Mpq, prefix + "\\" + scenario.GetMapString ((int)action.WavIndex)); sleepUntil = (int)action.Delay; return; case 3: screen.SetTransmissionText (scenario.GetMapString ((int)action.TextIndex)); break; case 4: screen.SetObjectives (scenario.GetMapString ((int)action.TextIndex)); break; case 5: Console.WriteLine ("show portrait:"); Console.WriteLine ("location = {0}, textindex = {1}, wavindex = {2}, delay = {3}, group1 = {4}, group2 = {5}, unittype = {6}, action = {7}, switch = {8}, flags = {9}", action.Location, action.TextIndex, action.WavIndex, action.Delay, action.Group1, action.Group2, action.UnitType, action.Action, action.Switch, action.Flags); screen.ShowPortrait ((int)action.UnitType, (int)action.Group1); Console.WriteLine (scenario.GetMapString ((int)action.TextIndex)); break; case 6: screen.HidePortrait ((int)action.Group1); break; case 7: Console.WriteLine ("Display Speaking Portrait(Slot, Time)"); Console.WriteLine (scenario.GetMapString ((int)action.TextIndex)); break; case 8: Console.WriteLine ("Transmission(Text, Slot, Time, Modifier, Wave, WavTime)"); screen.SetTransmissionText (scenario.GetMapString ((int)action.TextIndex)); screen.HighlightPortrait ((int)action.Group1); GuiUtil.PlaySound (screen.Mpq, prefix + "\\" + scenario.GetMapString ((int)action.WavIndex)); sleepUntil = (int)action.Delay; return; default: break; } } }
static void SpriteManagerPainterTick (object sender, TickEventArgs args) { #if notyet for (int i = 0; i < sprites.Count; i ++) { Sprite s = sprites[i]; if (s.Tick (args.TicksElapsed) == false) { Console.WriteLine ("removing sprite!!!!"); sprites.RemoveAt (i); } } #endif }
public void ScrollTick (object sender, TickEventArgs e) { scroll_elapsed += (int)e.MillisecondsElapsed; if (scroll_elapsed < 6/*XXX*/) return; scroll_elapsed = 0; if (horiz_delta == 0 && vert_delta == 0) return; int old_topleft_x = topleft_x; int old_topleft_y = topleft_y; topleft_x += horiz_delta; topleft_y += vert_delta; ClipTopLeft (); if (old_topleft_x == topleft_x && old_topleft_y == topleft_y) return; SpriteManager.SetUpperLeft (topleft_x, topleft_y); mapRenderer.SetUpperLeft (topleft_x, topleft_y); UpdateCursor (); #if notyet Painter.Invalidate (new Rectangle (new Point (0,0), new Size (Painter.SCREEN_RES_X, 375))); #endif }
void FlipPage (object sender, TickEventArgs e) { totalElapsed += e.MillisecondsElapsed; if (totalElapsed < millisDelay) return; totalElapsed = 0; AdvanceToNextPage (); }
void Events_Tick(object sender, TickEventArgs e) { timeElapsed += e.SecondsElapsed; while (timeElapsed > 1.0 / file.Header.Fps) { lock (((ICollection)frameQueue).SyncRoot) { if (frameQueue.Count <= 0) return; } timeElapsed -= (float)(1.0f / file.Header.Fps); byte[] argbData = frameQueue.Dequeue(); currentFrame = GuiUtil.CreateImage (argbData, (ushort)Width, (ushort)Height, 32, Width * 4); EmitFrameReady (); if (frameQueue.Count < (buffered_frames / 2) + 1) waitEvent.Set (); } }
public void Tick(object sender, TickEventArgs e) { TriggerAction[] actions = triggerData.Triggers[0].Actions; if (current_action == actions.Length) { return; } // FIXME we need to figure out how many ticks per second SC1 used for normal mode... 6? totalElapsed += (int)e.MillisecondsElapsed; /* if we're presently waiting, make sure * enough time has gone by. otherwise * return */ if (totalElapsed < sleepUntil * 166 /* 166 = 1/6th of a second */) { return; } totalElapsed = 0; while (current_action < actions.Length) { TriggerAction action = actions[current_action]; current_action++; switch (action.Action) { case 0: /* no action */ break; case 1: sleepUntil = (int)action.Delay; return; case 2: GuiUtil.PlaySound(screen.Mpq, prefix + "\\" + scenario.GetMapString((int)action.WavIndex)); sleepUntil = (int)action.Delay; return; case 3: screen.SetTransmissionText(scenario.GetMapString((int)action.TextIndex)); break; case 4: screen.SetObjectives(scenario.GetMapString((int)action.TextIndex)); break; case 5: Console.WriteLine("show portrait:"); Console.WriteLine("location = {0}, textindex = {1}, wavindex = {2}, delay = {3}, group1 = {4}, group2 = {5}, unittype = {6}, action = {7}, switch = {8}, flags = {9}", action.Location, action.TextIndex, action.WavIndex, action.Delay, action.Group1, action.Group2, action.UnitType, action.Action, action.Switch, action.Flags); screen.ShowPortrait((int)action.UnitType, (int)action.Group1); Console.WriteLine(scenario.GetMapString((int)action.TextIndex)); break; case 6: screen.HidePortrait((int)action.Group1); break; case 7: Console.WriteLine("Display Speaking Portrait(Slot, Time)"); Console.WriteLine(scenario.GetMapString((int)action.TextIndex)); break; case 8: Console.WriteLine("Transmission(Text, Slot, Time, Modifier, Wave, WavTime)"); screen.SetTransmissionText(scenario.GetMapString((int)action.TextIndex)); screen.HighlightPortrait((int)action.Group1); GuiUtil.PlaySound(screen.Mpq, prefix + "\\" + scenario.GetMapString((int)action.WavIndex)); sleepUntil = (int)action.Delay; return; default: break; } } }
void NavigateTick (object sender, TickEventArgs e) { // totalElapsed += e.TicksElapsed; if (totalElapsed < millisDelay) return; sprite.Invalidate (); pixel_x += delta_x; pixel_y += delta_y; if (dest_pixel_x - pixel_x < 2) pixel_x = dest_pixel_x; if (dest_pixel_y - pixel_y < 2) pixel_y = dest_pixel_y; sprite.SetPosition (pixel_x, pixel_y); sprite.Invalidate (); x = pixel_x << 2; y = pixel_y << 2; if (pixel_x == dest_pixel_x && pixel_y == dest_pixel_y) { startCurrentSegment = endCurrentSegment; navigatePath.RemoveAt (0); // if we're at the destination, remove the tick handler if (navigatePath.Count == 0) { sprite.RunScript (AnimationType.WalkingToIdle); Game.Instance.Tick -= NavigateTick; } else { endCurrentSegment = navigatePath[0]; sprite.Face (ClassifyDirection (startCurrentSegment, endCurrentSegment)); dest_pixel_x = endCurrentSegment.X * 4 + 4; dest_pixel_y = endCurrentSegment.Y * 4 + 4; delta_x = dest_pixel_x - pixel_x; delta_y = dest_pixel_y - pixel_y; } } }