コード例 #1
0
        //////////////////////////////////////////////////////////////////////////
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null)
            {
                return(value);
            }
            NativePropProxy Proxy = context.Instance as NativePropProxy;

            if (Proxy == null || Proxy.NativeObject == null)
            {
                SystemSounds.Asterisk.Play();
                return(value);
            }

            WSprite OrigSprite = value as WSprite;

            FileAssignForm dlg = new FileAssignForm();

            dlg.Game       = Proxy.NativeObject.Game;
            dlg.ParentForm = Form.ActiveForm;
            dlg.Filter     = "Sprites|*.sprite;*.png;*.bmp;*.jpg;*.tga";
            if (OrigSprite != null && OrigSprite.Filename != null)
            {
                dlg.Filename = OrigSprite.Filename;
            }

            DialogResult Res = dlg.ShowDialog();

            switch (Res)
            {
            case DialogResult.OK:
                try
                {
                    WSprite NewSprite = new WSprite(Proxy.NativeObject.Game);
                    if (!NewSprite.LoadFromFile(dlg.Filename))
                    {
                        NewSprite.Dispose();
                        return(value);
                    }
                    else
                    {
                        return(NewSprite);
                    }
                }
                catch
                {
                    return(value);
                }

            case DialogResult.Abort:
                return(null);

            default:
                return(value);
            }
        }
コード例 #2
0
        //////////////////////////////////////////////////////////////////////////
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null) return value;
            NativePropProxy Proxy = context.Instance as NativePropProxy;
            if (Proxy == null || Proxy.NativeObject == null)
            {
                SystemSounds.Asterisk.Play();
                return value;
            }

            WSprite OrigSprite = value as WSprite;

            FileAssignForm dlg = new FileAssignForm();
            dlg.Game = Proxy.NativeObject.Game;
            dlg.ParentForm = Form.ActiveForm;
            dlg.Filter = "Sprites|*.sprite;*.png;*.bmp;*.jpg;*.tga";
            if (OrigSprite != null && OrigSprite.Filename != null)
                dlg.Filename = OrigSprite.Filename;

            DialogResult Res = dlg.ShowDialog();

            switch (Res)
            {
                case DialogResult.OK:
                    try
                    {
                        WSprite NewSprite = new WSprite(Proxy.NativeObject.Game);
                        if (!NewSprite.LoadFromFile(dlg.Filename))
                        {
                            NewSprite.Dispose();
                            return value;
                        }
                        else return NewSprite;
                    }
                    catch
                    {
                        return value;
                    }
                case DialogResult.Abort:
                    return null;
                default:
                    return value;
            }
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Game == null)
            {
                Game = new WAdGame();
                Canvas.Create(Game, @"F:\Program Files\WME DevKit\projects\wme_demo\wme_demo.wpr", @"c:\test.log");

                Sprite = new WSprite(Game);
                Sprite.LoadFromFile(@"actors\molly\rr\walk.sprite");

                Entity = new WAdEntity(Game);
                Entity.LoadFromFile(@"entities\oldguy\oldguy.entity");

                Win = new WUIWindow(Game);
                Win.LoadFromFile(@"interface\system\mainmenu.window");
                Game.Windows.Add(Win);
                Game.FocusedWindow = Win;
            }
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if(Game==null)
            {
                Game = new WAdGame();
                Canvas.Create(Game, @"F:\Program Files\WME DevKit\projects\wme_demo\wme_demo.wpr", @"c:\test.log");

                Sprite = new WSprite(Game);
                Sprite.LoadFromFile(@"actors\molly\rr\walk.sprite");

                Entity = new WAdEntity(Game);
                Entity.LoadFromFile(@"entities\oldguy\oldguy.entity");

                Win = new WUIWindow(Game);
                Win.LoadFromFile(@"interface\system\mainmenu.window");
                Game.Windows.Add(Win);
                Game.FocusedWindow = Win;
            }
        }