Exemple #1
0
        public static void Main () {
                Do[] arr = new Do [5];
                for (int i = 0; i < 5; ++i) {
                        arr [i] = delegate {doit (i);};
                }
                for (int i = 0; i < 5; ++i) {
                        arr [i] ();
                }
{
                for (int j = 0; j < 5; ++j) {
                        arr [j] = delegate {doit (j);};
                }
}
        }
    public object Get(Do request)
    {
        var cached = Cache.Get<GameObject>(request.target);
        var v = new Vector3(request.x, request.y, request.z);
        var transform = default(MoveResponse);
        bool move = request.action == "move";

        Exec.OnMain(() =>
        {
            if (cached == null)
            {
                cached = GameObject.Find(request.target);
                Cache.Set<GameObject>(request.target, cached);
                Debug.Log("not cached");
            }

            if (move)
            {
                cached.transform.position = Vector3.MoveTowards(cached.transform.position, v, 0.1f);
            }

            transform = new MoveResponse
            {
                x = cached.transform.position.x,
                y = cached.transform.position.y,
                z = cached.transform.position.z
            };
        }, true);

        return transform;
    }
Exemple #3
0
 /// <summary>
 /// Perform certain task till specified condition is matched
 /// </summary>
 /// <param name="do">Delegate executed repeatedly at recheck interval of Clock. The return value is used as argument for "matched" delegate.</param>
 /// <param name="matched">The return value of the "do" delegate passed as argument to this delegate. Return value of true would cause the
 /// Clock to stop.</param>
 /// <param name="expired">In case of a no match this delegate is called</param>
 /// <returns></returns>
 public virtual object Perform(Do @do, Matched matched, Expired expired)
 {
     while (true)
     {
         object o = @do();
         if (matched(o)) return o;
         if (TimeUp) return expired();
         Thread.Sleep(recheckAfterInMilliSeconds);
     }
 }
Exemple #4
0
 public static void WaitAndPerform(FrameworkElement frameworkElement, Do @do)
 {
     frameworkElement.Cursor = Cursors.Wait;
     try
     {
         @do();
     }
     finally
     {
         frameworkElement.Cursor = Cursors.Arrow;
     }
 }
Exemple #5
0
        public static bool ImportAreas(string fullPath)
        {
            var sLevels = new Areas.Serialized[510];

            for (int i = 0; i < sLevels.Length; i++)
            {
                sLevels[i] = new Areas.Serialized();
            }
            try
            {
                Do.Import(sLevels, fullPath + "\\" + "area", "AREA", true);
            }
            catch
            {
                MessageBox.Show("One or more files not an area data file.",
                                "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }
            for (int i = 0; i < sLevels.Length; i++)
            {
                Areas[i].Layering       = sLevels[i].Layering;
                Areas[i].Layering.Index = i;
                Areas[i].Map            = sLevels[i].MapNum;
                var map = sLevels[i].Map;
                Maps[Areas[i].Map]                     = map;
                Tilesets[map.TilesetL1 + 0x20]         = sLevels[i].TilesetL1;
                Tilesets[map.TilesetL2 + 0x20]         = sLevels[i].TilesetL2;
                Tilesets[map.TilesetL3]                = sLevels[i].TilesetL3;
                Modify_Tilesets[map.TilesetL1 + 0x20]  = true;
                Modify_Tilesets[map.TilesetL2 + 0x20]  = true;
                Modify_Tilesets[map.TilesetL3]         = true;
                Tilemaps[map.TilemapL1 + 0x40]         = sLevels[i].TilemapL1;
                Tilemaps[map.TilemapL2 + 0x40]         = sLevels[i].TilemapL2;
                Tilemaps[map.TilemapL3]                = sLevels[i].TilemapL3;
                Modify_Tilemaps[map.TilemapL1 + 0x40]  = true;
                Modify_Tilemaps[map.TilemapL2 + 0x40]  = true;
                Modify_Tilemaps[map.TilemapL3]         = true;
                CollisionMaps[map.CollisionMap]        = sLevels[i].CollisionMap;
                Modify_CollisionMaps[map.CollisionMap] = true;
                Areas[i].NPCObjects                    = sLevels[i].NPCs;
                Areas[i].ExitTriggers                  = sLevels[i].Exits;
                Areas[i].EventTriggers                 = sLevels[i].Events;
                Areas[i].Overlaps                = sLevels[i].Overlaps;
                Areas[i].NPCObjects.AreaIndex    = i;
                Areas[i].ExitTriggers.AreaIndex  = i;
                Areas[i].EventTriggers.AreaIndex = i;
                Areas[i].Overlaps.AreaIndex      = i;
            }
            return(true);
        }
Exemple #6
0
        /// <summary>
        /// Serialize the specified storage into file.
        /// </summary>
        /// <param name="settings"><see cref="SettingsStorage"/></param>
        /// <param name="fileName">File name.</param>
        public static void SerializeInvariant(this SettingsStorage settings, string fileName)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (fileName.IsEmpty())
            {
                throw new ArgumentNullException(nameof(fileName));
            }

            Do.Invariant(() => settings.Serialize(fileName));
        }
Exemple #7
0
 public void Clear(int startIndex)
 {
     for (int i = startIndex; i < count; i++)
     {
         for (int a = 0; a < size; a++)
         {
             reds[i * size + a]   = 0;
             greens[i * size + a] = 0;
             blues[i * size + a]  = 0;
         }
     }
     palette  = Do.RGBToColors(reds, greens, blues);
     palettes = Do.RGBToColors(reds, greens, blues, count, size);
 }
Exemple #8
0
 //
 private void SetBattlefieldImage()
 {
     int[] quadrant1 = Do.TilesetToPixels(tileset.Tileset_tiles, 16, 16, 0, false);
     int[] quadrant2 = Do.TilesetToPixels(tileset.Tileset_tiles, 16, 16, 256, false);
     int[] quadrant3 = Do.TilesetToPixels(tileset.Tileset_tiles, 16, 16, 512, false);
     int[] quadrant4 = Do.TilesetToPixels(tileset.Tileset_tiles, 16, 16, 768, false);
     int[] pixels    = new int[512 * 512];
     Do.PixelsToPixels(quadrant1, pixels, 512, new Rectangle(0, 0, 256, 256));
     Do.PixelsToPixels(quadrant2, pixels, 512, new Rectangle(256, 0, 256, 256));
     Do.PixelsToPixels(quadrant3, pixels, 512, new Rectangle(0, 256, 256, 256));
     Do.PixelsToPixels(quadrant4, pixels, 512, new Rectangle(256, 256, 256, 256));
     battlefieldImage = Do.PixelsToImage(pixels, 512, 512);
     picture.Invalidate();
 }
Exemple #9
0
        internal NbtCompound GetNbtObject()
        {
            NbtCompound ticket = new NbtCompound();

            if (Od > Do && Do.ToString("H:mm") != "0:00")
            {
                Od = Od.AddHours(-12);
                Do = Do.AddHours(12);
            }

            ticket.Add(new NbtByte("Den", (byte)Datum.Day));
            ticket.Add(new NbtByte("Do h", (byte)Do.Hour));
            ticket.Add(new NbtByte("Do m", (byte)Do.Minute));
            ticket.Add(new NbtByte("Od h", (byte)Od.Hour));
            ticket.Add(new NbtByte("Od m", (byte)Od.Minute));
            ticket.Add(new NbtByte("Prace", TypPrace));
            ticket.Add(new NbtByte("Stav", (byte)StavT));
            ticket.Add(new NbtShort("Rok", (short)Datum.Year));
            ticket.Add(new NbtLong("IDlong", IDtick));
            ticket.Add(new NbtString("ID", ID));
            ticket.Add(new NbtString("Kontakt", Kontakt));
            ticket.Add(new NbtString("PC", PC));
            ticket.Add(new NbtString("Popis", Popis));
            ticket.Add(new NbtString("Poznamky", Poznamky));
            ticket.Add(new NbtString("Terp", CustomTerp));
            ticket.Add(new NbtString("Task", CustomTask));
            ticket.Add(new NbtString("OnlineTyp", OnlineTyp));
            List <byte> poh = new List <byte>();
            List <byte> pom = new List <byte>();

            foreach (DateTime b in PauzyOd)
            {
                poh.Add((byte)b.Hour);
                pom.Add((byte)b.Minute);
            }
            List <byte> pdh = new List <byte>();
            List <byte> pdm = new List <byte>();

            foreach (DateTime b in PauzyDo)
            {
                pdh.Add((byte)b.Hour);
                pdm.Add((byte)b.Minute);
            }
            ticket.Add(new NbtByteArray("Pauza do h", pdh.ToArray()));
            ticket.Add(new NbtByteArray("Pauza do m", pdm.ToArray()));
            ticket.Add(new NbtByteArray("Pauza od h", poh.ToArray()));
            ticket.Add(new NbtByteArray("Pauza od m", pom.ToArray()));

            return(ticket);
        }
Exemple #10
0
 private void pictureBoxTileset_Paint(object sender, PaintEventArgs e)
 {
     if (tilesetImage == null)
     {
         tilesetPixels = Do.TilesetToPixels(tileset.Tileset, 8, 13, 0);
         tilesetImage  = Do.PixelsToImage(tilesetPixels, 256, 416);
     }
     e.Graphics.DrawImage(tilesetImage, 0, 0);
     overlay.DrawTileGrid(e.Graphics, Color.Gray, new Size(256, 416), new Size(32, 32), 1, true);
     if (selection != null)
     {
         selection.DrawSelectionBox(e.Graphics, 1);
     }
 }
Exemple #11
0
 private void RefreshMonsterImages()
 {
     monsterImages = new List <Bitmap>();
     shadowImages  = new List <Bitmap>();
     for (int i = 0; i < 8; i++)
     {
         int[] pixels = Model.Monsters[formation.Monsters[i]].Pixels;
         monsterImages.Add(Do.PixelsToImage(pixels, 256, 256));
         pixels = Model.Monsters[formation.Monsters[i]].Shadow;
         shadowImages.Add(Do.PixelsToImage(pixels, 16, 16));
     }
     formation.PixelIndexes = null;
     pictureBoxFormation.Invalidate();
 }
Exemple #12
0
        public override ConfigDef ConfigClient()
        {
            ValidatorOptions.ResourceProviderType = typeof(ValidationMessages);
            ConfigFile(x => x.Log4net(), "Log4net.config");
            ConfigFile(x => x.The <ApplicationConfig>(), "Application.config");
            ConfigFile(x => x.Remoting(), "Remoting.config");

            if (!IsTest)
            {
                Do.AddClientHook(x => new HttpIdentityInjector(x));
            }

            return(this);
        }
Exemple #13
0
        public void Search_ForAMessageBox_FindsAndClosesIt()
        {
            Do.Launch(TestData.ApplicationPath).And.Wait(1000);
            var window = WindowFinder.Search <BasicWindow>(Use.AutomationId("CUI_TestApplication_MainWindow"));
            var button = UI.GetChild <BasicButton>(By.AutomationId("CUI_ShowMessageBox_Button"), From.Element(window));

            button.Unsafe.Click();
            DynamicSleep.Wait(1000);

            var messageBox = WindowFinder.Search <BasicMessageBox>(Use.Title("MessageBoxTitle"));

            messageBox.OKButton.Unsafe.Click();
            window.CloseButton.Unsafe.Click();
        }
Exemple #14
0
 private void nameText_TextChanged(object sender, EventArgs e)
 {
     if (Model.Names.GetUnsortedName(Monster.Index).CompareTo(this.nameText.Text) != 0)
     {
         Monster.Name = Do.ASCIIToRaw(this.nameText.Text, Lists.KeystrokesMenu, 13);
         Model.Names.SetName(
             Monster.Index,
             new string(Monster.Name));
         Model.Names.SortAlphabetically();
         this.name.Items.Clear();
         this.name.Items.AddRange(Model.Names.Names);
         this.name.SelectedIndex = Model.Names.GetSortedIndex(Monster.Index);
     }
 }
 private void SetBattlefieldImage()
 {
     int[] battlefieldPixelsQ1 = Do.TilesetToPixels(tileset.Tileset_tiles, 16, 16, 0, false);
     int[] battlefieldPixelsQ2 = Do.TilesetToPixels(tileset.Tileset_tiles, 16, 16, 256, false);
     int[] battlefieldPixelsQ3 = Do.TilesetToPixels(tileset.Tileset_tiles, 16, 16, 512, false);
     int[] battlefieldPixelsQ4 = Do.TilesetToPixels(tileset.Tileset_tiles, 16, 16, 768, false);
     int[] battlefieldPixels   = new int[512 * 512];
     Do.PixelsToPixels(battlefieldPixelsQ1, battlefieldPixels, 512, new Rectangle(0, 0, 256, 256));
     Do.PixelsToPixels(battlefieldPixelsQ2, battlefieldPixels, 512, new Rectangle(256, 0, 256, 256));
     Do.PixelsToPixels(battlefieldPixelsQ3, battlefieldPixels, 512, new Rectangle(0, 256, 256, 256));
     Do.PixelsToPixels(battlefieldPixelsQ4, battlefieldPixels, 512, new Rectangle(256, 256, 256, 256));
     battlefieldImage = Do.PixelsToImage(battlefieldPixels, 512, 512);
     pictureBoxBattlefield.Invalidate();
 }
Exemple #16
0
        private void SetSpriteImage()
        {
            Size size = new Size(0, 0);

            int[] spritePixels = sprite.GetPixels(false, true, 0, 3, false, true, ref size);
            if (spritePixels.Length == 0)
            {
                spritePixels = new int[2];
                size.Width   = 1;
                size.Height  = 1;
            }
            spriteImage = Do.PixelsToImage(spritePixels, size.Width, size.Height);
            spritePictureBox.Invalidate();
        }
Exemple #17
0
        // Picture
        private void picture_Paint(object sender, PaintEventArgs e)
        {
            if (battlefieldImage == null)
            {
                return;
            }
            Rectangle rdst = new Rectangle(0, 0, 512, 512);

            if (toggleBG.Checked)
            {
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(paletteSets[palette].Palette[0])), rdst);
            }
            e.Graphics.DrawImage(battlefieldImage, rdst, 0, 0, 512, 512, GraphicsUnit.Pixel);
            if (moving && selection != null)
            {
                Rectangle rsrc = new Rectangle(0, 0, overlay.SelectTS.Width, overlay.SelectTS.Height);
                rdst = new Rectangle(
                    overlay.SelectTS.X * zoom, overlay.SelectTS.Y * zoom,
                    rsrc.Width * zoom, rsrc.Height * zoom);
                e.Graphics.DrawImage(new Bitmap(selection), rdst, rsrc, GraphicsUnit.Pixel);
                Do.DrawString(e.Graphics, new Point(rdst.X, rdst.Y + rdst.Height),
                              "click/drag", Color.White, Color.Black, new Font("Tahoma", 6.75F, FontStyle.Bold));
            }
            float[][] matrixItems =
            {
                new float[] { 1, 0, 0,     0, 0 },
                new float[] { 0, 1, 0,     0, 0 },
                new float[] { 0, 0, 1,     0, 0 },
                new float[] { 0, 0, 0, 0.50F, 0 },
                new float[] { 0, 0, 0,     0, 1 }
            };
            ColorMatrix     cm = new ColorMatrix(matrixItems);
            ImageAttributes ia = new ImageAttributes();

            ia.SetColorMatrix(cm, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            if (mouseEnter)
            {
                Point location = new Point(mousePosition.X / 16 * 16 * zoom, mousePosition.Y / 16 * 16 * zoom);
                overlay.DrawHoverBox(e.Graphics, location, new Size(16 * zoom, 16 * zoom), zoom, true);
            }
            if (toggleTileGrid.Checked)
            {
                overlay.DrawTileGrid(e.Graphics, Color.Gray, picture.Size, new Size(16, 16), 1, true);
            }
            if (overlay.SelectTS != null)
            {
                overlay.SelectTS.DrawSelectionBox(e.Graphics, 1);
            }
        }
Exemple #18
0
        /// <summary>
        /// Flips the mold selection vertically or horizontally.
        /// </summary>
        /// <param name="type">Either "mirror" or "invert".</param>
        private void Flip(string type)
        {
            if (overlay.Select.Empty)
            {
                return;
            }
            if (tileset.Tileset == null || overlay.Select.Size == new Size(0, 0))
            {
                return;
            }
            Point location = overlay.Select.Location;
            Point terminal = overlay.Select.Terminal;

            byte[] flippedTiles = new byte[(overlay.Select.Width / 16) * (overlay.Select.Height / 16)];
            for (int y = 0, y_ = overlay.Select.Y / 16; y < overlay.Select.Height / 16; y++, y_++)
            {
                for (int x = 0, x_ = overlay.Select.X / 16; x < overlay.Select.Width / 16; x++, x_++)
                {
                    flippedTiles[y * (overlay.Select.Width / 16) + x] = mold.Mold[y_ * (width / 16) + x_];
                    if (type == "mirror" && flippedTiles[y * (overlay.Select.Width / 16) + x] != 0xFF)
                    {
                        flippedTiles[y * (overlay.Select.Width / 16) + x] ^= 0x40;
                    }
                    if (type == "invert" && flippedTiles[y * (overlay.Select.Width / 16) + x] != 0xFF)
                    {
                        flippedTiles[y * (overlay.Select.Width / 16) + x] ^= 0x80;
                    }
                }
            }
            if (type == "mirror")
            {
                Do.FlipHorizontal(flippedTiles, overlay.Select.Width / 16, overlay.Select.Height / 16);
            }
            if (type == "invert")
            {
                Do.FlipVertical(flippedTiles, overlay.Select.Width / 16, overlay.Select.Height / 16);
            }
            commandStack.Push(new TilemapCommand(
                                  mold.Mold, width / 16, height / 16, flippedTiles,
                                  overlay.Select.X / 16, overlay.Select.Y / 16, overlay.Select.Width / 16, overlay.Select.Height / 16));
            commandStack.Push(1);
            SetTilemapImage();
            if (sequences != null)
            {
                sequences.SetSequenceFrameImages();
                sequences.RealignFrames();
            }
            animation.Assemble();
        }
Exemple #19
0
 private void SetAllyImages()
 {
     allyImages = new Bitmap[5];
     statImages = new Bitmap[5];
     portraits  = new Bitmap[5];
     for (int i = 0; i < allyImages.Length; i++)
     {
         Size   size   = new Size(0, 0);
         Sprite sprite = Model.Sprites[Model.NPCProperties[i].Sprite];
         int[]  pixels = sprite.GetPixels(false, true, 0, 7, false, false, ref size);
         allyImages[i] = Do.PixelsToImage(pixels, size.Width, size.Height);
         //
         pixels = new int[128 * 24];
         int[]  palette = Model.BattleMenuPalette.Palette;
         char[] HP      = new char[] { '2', '0', '9' }; // Mario
         if (i == 1)
         {
             HP = new char[] { '2', '1', '1' }
         }
         ;                                              // Toadstool
         if (i == 2)
         {
             HP = new char[] { '2', '4', '0' }
         }
         ;                                              // Bowser
         if (i == 3)
         {
             HP = new char[] { '1', '9', '5' }
         }
         ;                                              // Mallow
         if (i == 4)
         {
             HP = new char[] { '2', '0', '3' }
         }
         ;                                              // Geno
         char[] text = new char[]
         {
             '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x02', '\n',
             '\x00', HP[0], HP[1], HP[2], '\x16', HP[0], HP[1], HP[2], '\x10', '\n',
             '\x11', '\x11', '\x11', '\x11', '\x11', '\x11', '\x11', '\x11', '\x12'
         };
         Do.DrawText(pixels, 128, text, 0, 0, 8, Model.FontBattleMenu, palette);
         statImages[i] = Do.PixelsToImage(pixels, 128, 24);
         //
         palette      = Model.Sprites[Model.NPCProperties[i].Sprite].Palette;
         pixels       = Model.Sprites[i + 40].GetPixels(true, false, 0, 0, palette, true, false, ref size);
         portraits[i] = Do.PixelsToImage(pixels, 256, 256);
     }
 }
Exemple #20
0
        /// <summary>
        /// Flips the mold selection vertically or horizontally.
        /// </summary>
        /// <param name="flipType">The direction to flip the mold selection.</param>
        private void Flip(FlipType flipType)
        {
            if (overlay.Select.Empty)
            {
                return;
            }
            if (tileset.Tiles == null || overlay.Select.Size == new Size(0, 0))
            {
                return;
            }
            Point location = overlay.Select.Location;
            Point terminal = overlay.Select.Terminal;

            byte[] flippedTiles = new byte[(overlay.Select.Width / 16) * (overlay.Select.Height / 16)];
            for (int y = 0, y_ = overlay.Select.Y / 16; y < overlay.Select.Height / 16; y++, y_++)
            {
                for (int x = 0, x_ = overlay.Select.X / 16; x < overlay.Select.Width / 16; x++, x_++)
                {
                    flippedTiles[y * (overlay.Select.Width / 16) + x] = mold.Tiles[y_ * (width / 16) + x_];
                    if (flipType == FlipType.Horizontal && flippedTiles[y * (overlay.Select.Width / 16) + x] != 0xFF)
                    {
                        flippedTiles[y * (overlay.Select.Width / 16) + x] ^= 0x40;
                    }
                    if (flipType == FlipType.Vertical && flippedTiles[y * (overlay.Select.Width / 16) + x] != 0xFF)
                    {
                        flippedTiles[y * (overlay.Select.Width / 16) + x] ^= 0x80;
                    }
                }
            }
            if (flipType == FlipType.Horizontal)
            {
                Do.FlipHorizontal(flippedTiles, overlay.Select.Width / 16, overlay.Select.Height / 16);
            }
            if (flipType == FlipType.Vertical)
            {
                Do.FlipVertical(flippedTiles, overlay.Select.Width / 16, overlay.Select.Height / 16);
            }
            commandStack.Push(new MoldEdit(
                                  mold.Tiles, width / 16, height / 16, flippedTiles,
                                  overlay.Select.X / 16, overlay.Select.Y / 16, overlay.Select.Width / 16, overlay.Select.Height / 16));
            commandStack.Push(1);
            SetTilemapImage();
            if (sequencesForm != null)
            {
                sequencesForm.SetFrameImages();
                sequencesForm.RealignFrames();
            }
            animation.WriteToBuffer();
        }
        private void TextChanged(object sender, EventArgs e)
        {
            if (!LoggingAccept(sender))
            {
                return;
            }
            string temp = "";
            Type   type = sender.GetType();

            if (type == typeof(RichTextBox))
            {
                RichTextBox control = (RichTextBox)sender;
                string      text    = control.Text;
                temp += "\"" + control.Name + "\" | ";
                temp += "Text = \"" + text.Substring(0, Math.Min(30, text.Length));
                if (text.Length > 30)
                {
                    temp += "...";
                }
            }
            else if (type == typeof(TextBox))
            {
                TextBox control = (TextBox)sender;
                string  text    = control.Text;
                temp += "\"" + control.Name + "\" | ";
                temp += "Text = \"" + text.Substring(0, Math.Min(30, text.Length));
                if (text.Length > 30)
                {
                    temp += "...";
                }
            }
            else if (type == typeof(ToolStripTextBox))
            {
                ToolStripTextBox control = (ToolStripTextBox)sender;
                string           text    = control.Text;
                temp += "\"" + control.Name + "\" | ";
                temp += "Text = \"" + text.Substring(0, Math.Min(30, text.Length));
                if (text.Length > 30)
                {
                    temp += "...";
                }
            }
            temp += "\"";
            temp += " | Form \"" + form.Name + "\"";
            AddElementIndex(ref temp);
            //
            Do.AddHistory(temp);
            dateTime = DateTime.Now;
        }
Exemple #22
0
        private void ui_EditKeyTapped()
        {
            var w = this.web;

            w?.Run <Navigator>(nav =>
            {
                Do presentEditor = nav.Present <TimestampEditPresenter>;
                w.Run <EditKeyTappedHandler>(handler =>
                {
                    handler.Handle(
                        this.ui,
                        presentEditor);
                });
            });
        }
 static void Main()
 {
     Do[] arr = new Do [5];
     for (int i = 0; i < 5; ++i)
     {
         arr [i] = delegate
         {
             doit(i);
         };
     }
     for (int i = 0; i < 5; ++i)
     {
         arr [i] ();
     }
     {
         for (int j = 0; j < 5; ++j)
         {
             arr [j] = delegate
             {
                 doit(j);
             };
         }
     }
 }
Exemple #24
0
        public ActionResult ConsolePage(ConsolePageModel model, string action)
        {
            _console.Clear();

            if (model.TrickerId != 0 &&
                model.TrickId != 0 &&
                action == Actions.PerformTrick.ToString())
            {
                var result = Do.Trick(model.TrickerId, model.TrickId);
                _console.WriteLine(result ? "Success!" : "Fail!");
            }

            model.ConsoleText = _console.Text;
            return(View("ConsolePage", model));
        }
Exemple #25
0
 private void zoomOut_Click(object sender, EventArgs e)
 {
     Do.ResetToolStripButtons(toolStrip6, sender as ToolStripButton);
     zoomIn.Checked = false;
     if (zoomOut.Checked)
     {
         this.pictureBoxMold.Cursor = NewCursors.ZoomOut;
     }
     else if (!zoomOut.Checked)
     {
         this.pictureBoxMold.Cursor = Cursors.Arrow;
     }
     Defloat();
     pictureBoxMold.Invalidate();
 }
Exemple #26
0
        public void Action_ThreeTimesAndTwoRepeat_AllGotCalledThreeTimes()
        {
            var firstExecutionCount  = 0;
            var secondExecutionCount = 0;
            var thirdExecutionCount  = 0;

            Do.Action(() => { ++firstExecutionCount; })
            .And.Action(() => { ++secondExecutionCount; })
            .And.Action(() => { ++thirdExecutionCount; })
            .Repeat(2);

            Assert.AreEqual(3, firstExecutionCount);
            Assert.AreEqual(3, secondExecutionCount);
            Assert.AreEqual(3, thirdExecutionCount);
        }
Exemple #27
0
        public static void ExportBattlefields(string fullPath)
        {
            var battlefields = Battlefields;
            var serialized   = new Serialized[battlefields.Length];

            PaletteSet[] paletteSets = PaletteSets;
            for (int i = 0; i < battlefields.Length; i++)
            {
                serialized[i] = new Serialized(Tilesets[battlefields[i].Tileset],
                                               paletteSets[battlefields[i++].PaletteSet], battlefields[i]);
            }
            Do.Export(serialized,
                      fullPath + "\\" + LazyShell.Model.GetFileNameWithoutPath() + " - Battlefields\\" + "battlefield",
                      "BATTLEFIELD", true);
        }
Exemple #28
0
            public void Invokes_it()
            {
                Do present = A.Fake <Do>();

                A
                .CallTo(() => this.reader.ReadLicense(
                            out present))
                .AssignsOutAndRefParameters(present);

                this.handler.Handle();

                A
                .CallTo(() => present.Invoke())
                .MustHaveHappened();
            }
        public void Main()
        {
            var doer = new Doer();
            //compile error
            //var d1 = doer.Do1;
            Do d = doer.Do1;

            //d += doer.Do2;
            d += doer.Do3;

            //if not exist no exception
            d -= doer.Do2;

            d(1);
        }
Exemple #30
0
        private void saveImageAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            switch (FontType)
            {
            case FontType.Menu: Do.Export(fontTableImage, "fontTableMenu.png"); break;

            case FontType.Dialogue: Do.Export(fontTableImage, "fontTableDialogue.png"); break;

            case FontType.Description: Do.Export(fontTableImage, "fontTableDescription.png"); break;

            case FontType.Triangles: Do.Export(fontTableImage, "fontTableTriangles.png"); break;

            case FontType.BattleMenu: Do.Export(fontTableImage, "fontTableBattleMenu.png"); break;
            }
        }
Exemple #31
0
        public virtual IEnumerable <T> Decorate <T>(
            IEnumerable <T> source,
            Do <T> action)
        {
            if (source == null)
            {
                yield break;
            }

            foreach (var item in source)
            {
                action?.Invoke(item);
                yield return(item);
            }
        }
Exemple #32
0
 public static bool ImportWAVSample(int index, string fullPath)
 {
     try
     {
         byte[] sample = (byte[])Do.Import(new byte[1], fullPath);
         BRRSamples[index].Sample = BRR.Encode(sample);
     }
     catch
     {
         MessageBox.Show("Error encoding .wav file.",
                         "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         return(false);
     }
     return(true);
 }
Exemple #33
0
 private void e_moldZoomIn_Click(object sender, EventArgs e)
 {
     Do.ResetToolStripButtons(toolStrip6, (ToolStripButton)sender);
     e_moldZoomOut.Checked = false;
     if (e_moldZoomIn.Checked)
     {
         this.pictureBoxE_Mold.Cursor = NewCursors.ZoomIn;
     }
     else if (!e_moldZoomIn.Checked)
     {
         this.pictureBoxE_Mold.Cursor = Cursors.Arrow;
     }
     Defloat();
     pictureBoxE_Mold.Invalidate();
 }
Exemple #34
0
            public int[] GetGridplanePixels()
            {
                int[] pixels = new int[32 * 32];
                if (Subtile_tiles == null)
                {
                    return(pixels);
                }
                //
                int w; int h;
                int r; int c;

                switch (Format)
                {
                case 0: w = h = 24; break;

                case 1: w = 24; h = 32; break;

                case 2: w = 32; h = 24; break;

                case 3: w = 32; h = 32; break;

                default: goto case 0;
                }
                for (int i = 0; i < ((h / 8) * (w / 8)); i++)
                {
                    r = (i / (w / 8)) * 8; c = (i % (w / 8)) * 8;
                    for (int y = 0; y < 8; y++)
                    {
                        if (Subtile_tiles[i] == null)
                        {
                            break;
                        }
                        for (int x = 0; x < 8; x++)
                        {
                            pixels[x + c + ((y + r) * 32)] = Subtile_tiles[i].Pixels[y * 8 + x];
                        }
                    }
                }
                if (Mirror)
                {
                    Do.FlipHorizontal(pixels, 32, 0, 0, w, h);
                }
                if (Invert)
                {
                    Do.FlipVertical(pixels, 32, 0, 0, w, h);
                }
                return(pixels);
            }
Exemple #35
0
 public SstreamEnc(APro apro, Do od)
     : base(apro, od)
 {
 }
Exemple #36
0
void case_935()
#line 6228 "cs-parser.jay"
{
		Error_SyntaxError (yyToken);
	  
		yyVal = new Do ((Statement) yyVals[-4+yyTop], (BooleanExpression) yyVals[-1+yyTop], GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-3+yyTop]));
		lbag.AddStatement (yyVal, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-2+yyTop]));
	  }
Exemple #37
0
void case_933()
#line 6218 "cs-parser.jay"
{
		yyVal = new Do ((Statement) yyVals[-5+yyTop], (BooleanExpression) yyVals[-2+yyTop], GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[-4+yyTop]));
		lbag.AddStatement (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop]));
	  }
Exemple #38
0
 public Module(Do activity, string path)
 {
     Activity = activity;
     Path = path;
 }
Exemple #39
0
 public EagerlyAttribute(Do what) {
     this.what = what;
 }
void case_870()
#line 6665 "ps-parser.jay"
{
	    Lexer.AutoSemiInsertion = true;

		Error_SyntaxError (yyToken);
	  
		yyVal = new Do ((Statement) yyVals[-4+yyTop], (BooleanExpression) yyVals[-1+yyTop], GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-3+yyTop]));
		lbag.AddStatement (yyVal, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-2+yyTop]));
	  }
 public void addDo(Operator op, Lvalues lvalues, Operands arguments)
 {
     Do op_stamp = new Do(lvalues, op, arguments);
     m_lambda.addStatement(op_stamp);
 }
Exemple #42
0
 public Wrapper(APro apro, Do od)
     : base(apro, od)
 {
 }
 public EagerlyFacetAnnotation(Do what, IFacetHolder holder)
     : base(Type, holder) {
     What = what;
 }
Exemple #44
0
 public ScryptoEnc(APro apro, Do od)
     : base(apro, od)
 {
 }
Exemple #45
0
 public Acrypto(APro apro, Do od)
     : base(apro, od)
 {
 }
Exemple #46
0
 public Confuse(APro apro, Do od)
     : base(apro, od)
 {
 }
Exemple #47
0
 public Digest(APro apro, Do od)
     : base(apro, od)
 {
 }
Exemple #48
0
void case_934()
#line 6223 "cs-parser.jay"
{
		Error_SyntaxError (yyToken);
		yyVal = new Do ((Statement) yyVals[-1+yyTop], null, GetLocation (yyVals[-2+yyTop]), Location.Null);
	  }
 public void Otoc(Do strana)
 {
     character.Turn((Direction)strana);
 }
        public override void VisitDo(Do p)
        {
            var continueLabel = IL.DefineLabel();
            var loop = IL.DefineLabel();

            EmitLoopSkeleton(continueLabel, (breakLabel) =>
            {
                IL.MarkLabel(loop);
                VisitStatement(p.Body);

                IL.MarkLabel(continueLabel);
                var dodo = IL.DefineLabel();

                VisitExpression(p.Expression);
                IL.Emit(OpCodes.Stloc, E);
                IL.Emit(OpCodes.Ldloca, E);
                IL.Emit(OpCodes.Call, isReal);
                IL.Emit(OpCodes.Brtrue, dodo);
                IL.Emit(OpCodes.Ldsfld, typeof(Error).GetField("ExpectedExpression"));
                IL.Emit(OpCodes.Newobj, typeof(ProgramError).GetConstructor(new[] { typeof(Error) }));
                IL.Emit(OpCodes.Throw);

                IL.MarkLabel(dodo);
                IL.Emit(OpCodes.Ldloc, E);
                EmitImplicitConversion(typeof(bool));
                IL.Emit(OpCodes.Brfalse, loop);
            });
        }
			public override object Visit (Do doStatement)
			{
				var result = new DoWhileStatement ();
				var location = LocationsBag.GetLocations (doStatement);
				result.AddChild (new CSharpTokenNode (Convert (doStatement.loc), DoWhileStatement.DoKeywordRole), DoWhileStatement.DoKeywordRole);
				if (doStatement.EmbeddedStatement != null)
					result.AddChild ((Statement)doStatement.EmbeddedStatement.Accept (this), Roles.EmbeddedStatement);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location [0]), DoWhileStatement.WhileKeywordRole), DoWhileStatement.WhileKeywordRole);
				if (location != null && location.Count > 1)
					result.AddChild (new CSharpTokenNode (Convert (location [1]), Roles.LPar), Roles.LPar);
				if (doStatement.expr != null)
					result.AddChild ((Expression)doStatement.expr.Accept (this), Roles.Condition);
				if (location != null && location.Count > 2) {
					result.AddChild (new CSharpTokenNode (Convert (location [2]), Roles.RPar), Roles.RPar);
					if (location.Count > 3)
						result.AddChild (new CSharpTokenNode (Convert (location [3]), Roles.Semicolon), Roles.Semicolon);
				}
				
				return result;
			}
Exemple #52
0
 static object MyGet (Do d)
 {
         return null;
 }
Exemple #53
0
 public RandKey(APro apro, Do od)
     : base(apro, od)
 {
 }
Exemple #54
0
		public virtual object Visit (Do doStatement)
		{
			return null;
		}
void case_868()
#line 6651 "ps-parser.jay"
{
	    Lexer.AutoSemiInsertion = true;
	    
		yyVal = new Do ((Statement) yyVals[-5+yyTop], (BooleanExpression) yyVals[-2+yyTop], GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[-4+yyTop]));
		lbag.AddStatement (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop]));
	  }
Exemple #56
0
 public Default(APro apro, Do od)
     : base(apro, od)
 {
 }
Exemple #57
0
 public Txt2Img(APro apro, Do od)
     : base(apro, od)
 {
 }
Exemple #58
0
 // 搜索(m,n)周边8个格子
 void SearchAround(int m, int n, Do d)
 {
     for (int i = -1; i <= 1; i++) {
         for (int j = -1; j <= 1; j++) {
             if (i != 0 || j != 0) { // 排除中心点
                 int x = m + i;
                 int y = n + j;
                 if (x >= 0 && x < row &&
                     y >= 0 && y < col) {
                     d(x, y);
                 }
             }
         }
     }
 }
void case_869()
#line 6658 "ps-parser.jay"
{
	    Lexer.AutoSemiInsertion = true;
	    
		Error_SyntaxError (yyToken);
		yyVal = new Do ((Statement) yyVals[-1+yyTop], null, GetLocation (yyVals[-2+yyTop]), Location.Null);
	  }