Exemple #1
0
 public ActionDefinition(ActionLibrary parent, string name, int id)
 {
     Library          = parent;
     GameMakerVersion = 520;
     Name             = name;
     ActionID         = id;
     System.IO.MemoryStream ms = new System.IO.MemoryStream();
     Properties.Resources.DefaultAction.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
     OriginalImage = ms.ToArray();
     ms.Close();
     Image = new System.Drawing.Bitmap(24, 24, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
     System.Drawing.Graphics.FromImage(Image).DrawImage(Properties.Resources.DefaultAction, new System.Drawing.Rectangle(0, 0, 24, 24), new System.Drawing.Rectangle(0, 0, 24, 24), System.Drawing.GraphicsUnit.Pixel);
     (Image as System.Drawing.Bitmap).MakeTransparent(Properties.Resources.DefaultAction.GetPixel(0, Properties.Resources.DefaultAction.Height - 1));
     Hidden         = false;
     Advanced       = false;
     RegisteredOnly = false;
     Description    = string.Empty;
     ListText       = string.Empty;
     HintText       = string.Empty;
     Kind           = ActionKind.Normal;
     InterfaceKind  = ActionInferfaceKind.Normal;
     IsQuestion     = false;
     ShowApplyTo    = true;
     ShowRelative   = true;
     ArgumentCount  = 0;
     Arguments      = new ActionArgument[8];
     for (int i = 0; i < 8; i++)
     {
         Arguments[i] = new ActionArgument();
     }
     ExecutionType = ActionExecutionType.None;
     FunctionName  = string.Empty;
     Code          = string.Empty;
 }
Exemple #2
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(true);
     Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
     // Set the Program Properties
     SpriteIncremental     = 0;
     SoundIncremental      = 0;
     BackgroundIncremental = 0;
     PathIncremental       = 0;
     ScriptIncremental     = 0;
     FontIncremental       = 0;
     DataFileIncremental   = 0;
     TimeLineIncremental   = 0;
     ObjectIncremental     = 0;
     RoomIncremental       = 0;
     Sprites     = new Dictionary <int, SpriteResourceView>();
     Sounds      = new Dictionary <int, SoundResourceView>();
     Backgrounds = new Dictionary <int, BackgroundResourceView>();
     Paths       = new Dictionary <int, PathResourceView>();
     Scripts     = new Dictionary <int, ScriptResourceView>();
     Fonts       = new Dictionary <int, FontResourceView>();
     DataFiles   = new Dictionary <int, DataFileResourceView>();
     TimeLines   = new Dictionary <int, TimeLineResourceView>();
     Objects     = new Dictionary <int, ObjectResourceView>();
     Rooms       = new Dictionary <int, RoomResourceView>();
     Library     = new List <ActionLibrary>();
     Library.Add(ActionLibrary.Load(new System.IO.MemoryStream(Properties.Resources.LibMove)));
     Library.Add(ActionLibrary.Load(new System.IO.MemoryStream(Properties.Resources.LibMain1)));
     Library.Add(ActionLibrary.Load(new System.IO.MemoryStream(Properties.Resources.LibMain2)));
     Library.Add(ActionLibrary.Load(new System.IO.MemoryStream(Properties.Resources.LibControl)));
     Library.Add(ActionLibrary.Load(new System.IO.MemoryStream(Properties.Resources.LibScore)));
     Library.Add(ActionLibrary.Load(new System.IO.MemoryStream(Properties.Resources.LibExtra)));
     Library.Add(ActionLibrary.Load(new System.IO.MemoryStream(Properties.Resources.LibDraw)));
     IDE = new DesignerForm();
     // Load the settings
     if (!Properties.Settings.Default.WindowDefault)
     {
         bool maximized = Properties.Settings.Default.WindowMaximized;
         IDE.StartPosition = FormStartPosition.Manual;
         IDE.Location      = new System.Drawing.Point(Math.Max(0, Properties.Settings.Default.WindowX), Math.Max(0, Properties.Settings.Default.WindowY));
         IDE.Size          = new System.Drawing.Size(Properties.Settings.Default.WindowWidth, Properties.Settings.Default.WindowHeight);
         if (maximized)
         {
             IDE.WindowState = FormWindowState.Maximized;
         }
     }
     // Run GameCreator
     Application.Run(IDE);
     Properties.Settings.Default.Save();
 }
        public static ActionLibrary Load(System.IO.Stream s)
        {
            ActionLibrary lib = new ActionLibrary();

            System.IO.BinaryReader br = new System.IO.BinaryReader(s, Encoding.ASCII);
            lib.GameMakerVersion = br.ReadInt32();
            bool gm5 = lib.GameMakerVersion == 500;

            lib.TabCaption              = new string(br.ReadChars(br.ReadInt32()));
            lib.LibraryID               = br.ReadInt32();
            lib.Author                  = new string(br.ReadChars(br.ReadInt32()));
            lib.Version                 = br.ReadInt32();
            lib.LastChanged             = new DateTime(1899, 12, 30).AddDays(br.ReadDouble());
            lib.Info                    = new string(br.ReadChars(br.ReadInt32()));
            lib.InitializationCode      = new string(br.ReadChars(br.ReadInt32()));
            lib.AdvancedModeOnly        = br.ReadInt32() == 0 ? false : true;
            lib.ActionNumberIncremental = br.ReadInt32();
            for (int i = br.ReadInt32(); i > 0; i--)
            {
                int ver            = br.ReadInt32();
                ActionDefinition a = new ActionDefinition(lib, new string(br.ReadChars(br.ReadInt32())), br.ReadInt32());
                a.GameMakerVersion = ver;
                int size = br.ReadInt32();
                a.OriginalImage = new byte[size];
                br.Read(a.OriginalImage, 0, size);
                System.IO.MemoryStream ms = new System.IO.MemoryStream(a.OriginalImage);
                System.Drawing.Bitmap  b  = (System.Drawing.Bitmap)System.Drawing.Bitmap.FromStream(ms);
                a.Image = new System.Drawing.Bitmap(24, 24, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                using (var g = System.Drawing.Graphics.FromImage(a.Image))
                {
                    g.DrawImage(b, new System.Drawing.Rectangle(0, 0, b.Width, b.Height));
                }
                if (b.PixelFormat != System.Drawing.Imaging.PixelFormat.Format32bppArgb)
                {
                    ((System.Drawing.Bitmap)a.Image).MakeTransparent(b.GetPixel(0, b.Height - 1));
                }
                ms.Close();
                b.Dispose();
                a.Hidden         = br.ReadInt32() == 0 ? false : true;
                a.Advanced       = br.ReadInt32() == 0 ? false : true;
                a.RegisteredOnly = ver == 500 || (br.ReadInt32() == 0) ? false : true;
                a.Description    = new string(br.ReadChars(br.ReadInt32()));
                a.ListText       = new string(br.ReadChars(br.ReadInt32()));
                a.HintText       = new string(br.ReadChars(br.ReadInt32()));
                a.Kind           = (ActionKind)br.ReadInt32();
                a.InterfaceKind  = (ActionInferfaceKind)br.ReadInt32();
                a.IsQuestion     = br.ReadInt32() == 0 ? false : true;
                a.ShowApplyTo    = br.ReadInt32() == 0 ? false : true;
                a.ShowRelative   = br.ReadInt32() == 0 ? false : true;
                a.ArgumentCount  = br.ReadInt32();
                int count = br.ReadInt32();
                if (a.Arguments.Length != count)
                {
                    a.Arguments = new ActionArgument[count];
                }
                for (int j = 0; j < count; j++)
                {
                    a.Arguments[j]              = new ActionArgument();
                    a.Arguments[j].Caption      = new string(br.ReadChars(br.ReadInt32()));
                    a.Arguments[j].Type         = (ActionArgumentType)br.ReadInt32();
                    a.Arguments[j].DefaultValue = new string(br.ReadChars(br.ReadInt32()));
                    a.Arguments[j].Menu         = new string(br.ReadChars(br.ReadInt32()));
                }
                a.ExecutionType = (ActionExecutionType)br.ReadInt32();
                a.FunctionName  = new string(br.ReadChars(br.ReadInt32()));
                a.Code          = new string(br.ReadChars(br.ReadInt32()));
                lib.Actions.Add(a);
            }
            //Hmm...
            //ActionDefinition d = new ActionDefinition(lib);
            //d.Description = "Font...";
            //d.ArgumentCount = 1;
            //d.Arguments[0] = new ActionArgument();
            //d.Arguments[0].Type = ActionArgumentType.FontString;
            //d.ListText = "@0";
            //lib.Actions.Add(d);
            //d.Arguments[0].DefaultValue = "\"Times New Roman\",10,0,0,0,0,0";
            return(lib);
        }
Exemple #4
0
 public ActionDefinition(ActionLibrary reference) :
     this(reference, string.Format("Action {0}", ++reference.ActionNumberIncremental), reference.ActionNumberIncremental)
 {
 }