示例#1
0
        public override void Register(IAddinHost host)
        {
            // copy host to local instance
            Host = host;

            // if we didn't find a control then create one
            if (host != null)
            {
                Trace.WriteLine(DateTime.Now + " | Editor Camera Addin Loaded .. ");

                // Create our Camera
                Camera          = new EditorCamera(Host.Game);
                Camera.Position = new Vector3(1, 20, 0);
                Camera.Pitch    = 0.5f;
                Camera.FarPlane = 3000;

                Host.Camera = Camera;

                // Retreive our Input Handler Service
                InputHandler = (InputHandler)Host.Game.Services.GetService(typeof(InputHandler));

                InputHandler.AddCommand(new InputAction("Left", Buttons.LeftStick, Keys.A));
                InputHandler.AddCommand(new InputAction("Right", Buttons.LeftStick, Keys.D));
                InputHandler.AddCommand(new InputAction("Forward", Buttons.LeftStick, Keys.W));
                InputHandler.AddCommand(new InputAction("Backward", Buttons.LeftStick, Keys.S));
                InputHandler.AddCommand(new InputAction("MoveUpward", Buttons.LeftStick, Keys.PageUp));
                InputHandler.AddCommand(new InputAction("MoveDownward", Buttons.LeftStick, Keys.PageDown));

                conSettings         = new conCameraSettings(Camera);
                conSettings.Enabled = false;

                Host.DockManager.SetDock(conSettings, DockPosition.Right);
            }
        }
 /// <summary>
 /// 初始化类型 Tumbler.Addin.Core.MessageService 实例。
 /// </summary>
 /// <param name="host">宿主。</param>
 public MessageService(IAddinHost host)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     _host = host;
     host.MessageDispatcher.Start();
     AppDomain.CurrentDomain.SetData("ms", this);
 }
        public conSceneObjects(IAddinHost host)
        {
            SetGuid("9f1d2834-56ad-4dd2-8507-5e5549fa85ea");

            InitializeComponent();

            Host = host;

            tsAdd.Image    = Resource1.add;
            tsRemove.Image = Resource1.delete;

            Enabled = false;
        }
示例#4
0
        public override void Register(IAddinHost host)
        {
            // copy host to local instance
            Host = host;

            // if we didn't find a control then create one
            if (host != null)
            {
                Trace.WriteLine(DateTime.Now + " | Scene Manager Addin Loaded .. ");

                conSceneObjects = new conSceneObjects(Host);

                // Add our Property Grid to the Right Side
                Host.DockManager.SetDock(conSceneObjects, DockPosition.Right);
            }
        }
        public static void LoadAddins(List <Addin> addins, IAddinHost host)
        {
            // create instance of each addin
            foreach (Addin addin in addins)
            {
                // create instance
                ObjectHandle handle   = Activator.CreateComInstanceFrom(addin.File, addin.Path);
                Addin        instance = (Addin)handle.Unwrap();
                addin.Instance = instance;

                // add the addin to the global collection
                Addins.Add(addin);

                // call the register method on the addin
                instance.Register(host);
            }
        }
        public static void SendMessage(this IMessageSource sender, Message message)
        {
            IAddinHost host = sender as IAddinHost;

            if (host != null)
            {
                if (message.Source != host.Id && message.Source != MessageService.AddinHostId)
                {
                    throw new InvalidOperationException("This message is not yours,maybe you need forward it");
                }
            }
            else if (sender.Id != message.Source)
            {
                throw new InvalidOperationException("This message is not yours,maybe you need forward it");
            }
            SendMessageImpl(message);
        }
        public conBrushSettings(IAddinHost host)
        {
            SetGuid("d299c928-f001-4ad9-b85c-9b9fdd25e068");

            InitializeComponent();

            Host = host;

            // Create our Round Brush
            conBrush b1 = new conBrush();

            b1.BrushImage = Resource1.RoundBrush;
            b1.Click     += OnBrushClicked;
            BrushContainer.Controls.Add(b1);

            // Create our Square Brush
            conBrush b2 = new conBrush();

            b2.BrushImage = Resource1.SquareBrush;
            b2.Click     += OnBrushClicked;
            BrushContainer.Controls.Add(b2);
        }
示例#8
0
 /// <summary>
 /// 初始化类型 Tumbler.Addin.Core.AddinManager 实例。
 /// </summary>
 /// <param name="host">宿主。</param>
 /// <param name="globalConfigFile">全局配置文件。</param>
 public AddinManager(IAddinHost host, String globalConfigFile)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     if (String.IsNullOrWhiteSpace(globalConfigFile))
     {
         throw new ArgumentNullException("globalConfigFile");
     }
     if (!Path.IsPathRooted(globalConfigFile))
     {
         globalConfigFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, globalConfigFile);
     }
     if (!File.Exists(globalConfigFile))
     {
         throw new FileNotFoundException(globalConfigFile);
     }
     _parser         = CreateAddinConfigParser(globalConfigFile);
     _messageService = new MessageService(host);
     _loader         = CreateAddinLoader();
 }
        public frmGenLandscape(IAddinHost host)
        {
            Host = host;

            InitializeComponent();
        }
示例#10
0
 public virtual void Register(IAddinHost host)
 {
 }
示例#11
0
        public override void Register(IAddinHost host)
        {
            // copy host to local instance
            Host = host;

            if (host != null)
            {
                Trace.WriteLine(DateTime.Now + " | Landscape Addin Loaded .. ");

                // Create our control for the brush texture
                conBrushSettings         = new conBrushSettings(Host);
                conBrushSettings.Enabled = false;

                // Add our control to the docking manager
                Host.DockManager.SetDock(conBrushSettings, DockPosition.Default);

                ToolStripSeparator s = new ToolStripSeparator();

                ToolStripButton tsAddLandscape = new ToolStripButton();
                tsAddLandscape.Text         = "Generate Landscape";
                tsAddLandscape.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                tsAddLandscape.Click       += OnAddLandscape_Clicked;
                Host.ToolStrip.Items.Add(tsAddLandscape);

                // Add a seperator
                Host.ToolStrip.Items.Add(s);

                // Create a Label for our Brush Size
                ToolStripLabel lb1 = new ToolStripLabel("Brush Size : ");
                lb1.Margin = new Padding(5, 0, 0, 0);
                Host.ToolStrip.Items.Add(lb1);

                // Create our Brush Size combo box
                tsBrushSize      = new ToolStripComboBox("tsBrushSize");
                tsBrushSize.Text = "4";
                tsBrushSize.Items.Add("4");
                tsBrushSize.Items.Add("6");
                tsBrushSize.Items.Add("8");
                tsBrushSize.Items.Add("10");
                tsBrushSize.Items.Add("12");
                tsBrushSize.Items.Add("14");
                tsBrushSize.Items.Add("16");
                tsBrushSize.Items.Add("18");
                tsBrushSize.Items.Add("20");
                tsBrushSize.Items.Add("22");
                tsBrushSize.Items.Add("24");
                tsBrushSize.Items.Add("26");
                tsBrushSize.Items.Add("28");
                tsBrushSize.Items.Add("30");
                tsBrushSize.Items.Add("32");
                tsBrushSize.Items.Add("64");
                tsBrushSize.Items.Add("128");
                tsBrushSize.Items.Add("256");
                tsBrushSize.TextChanged += OnBrushSize_TextChanged;
                tsBrushSize.Width        = 20;
                Host.ToolStrip.Items.Add(tsBrushSize);

                // Brush Weight
                ToolStripLabel lb2 = new ToolStripLabel("Brush Weight : ");
                lb2.Margin = new Padding(5, 0, 0, 0);
                Host.ToolStrip.Items.Add(lb2);

                tbWeight       = new ToolStripTextBox("tbBrushWeight");
                tbWeight.Text  = "2.0";
                tbWeight.Width = 30;

                tbWeight.TextChanged += OnBrushWeight_TextChanged;
                Host.ToolStrip.Items.Add(tbWeight);

                // Raise Terrain Tool Panel Button
                tRaise             = new conTool();
                tRaise.ButtonImage = Resource1.btnRaise;
                tRaise.IsSelected  = true;
                tRaise.BackColor   = Color.Yellow;
                tRaise.MouseClick += OnRaiseClicked;
                Host.ToolPanel.Controls.Add(tRaise);

                // Lower Terrain Tool Panel Button
                tLower             = new conTool();
                tLower.ButtonImage = Resource1.btnLower;
                tLower.MouseClick += OnLowerClicked;
                Host.ToolPanel.Controls.Add(tLower);

                tPaint             = new conTool();
                tPaint.ButtonImage = Resource1.PaintBrush;
                tPaint.MouseClick += OnPaintClicked;
                Host.ToolPanel.Controls.Add(tPaint);

                LandscapeGenerated += OnLandscapeAdded;
            }
        }
示例#12
0
 /// <summary>
 /// 初始化类型 Tumbler.Addin.Wpf.AddinManager 实例。
 /// </summary>
 /// <param name="host">宿主。</param>
 /// <param name="globalConfigFile">全局配置文件。</param>
 public WpfAddinManager(IAddinHost host, string globalConfigFile)
     : base(host, globalConfigFile)
 {
 }
 /// <summary>
 /// 初始化类型 Tumbler.Addin.Core.MessageService 实例。
 /// </summary>
 /// <param name="host">宿主。</param>
 public MessageCenter(IAddinHost host)
 {
     _host = host;
 }