Represents a layer which is rendered on top of the 'normal' scene contents.
An overlay is a container for visual components (2D and 3D) which will be rendered after the main scene in order to composite heads-up-displays, menus or other layers on top of the contents of the scene.

An overlay always takes up the entire size of the viewport, although the components attached to it do not have to. An overlay has no visual element in itself, it it merely a container for visual elements.

Overlays are created by calling SceneManager.CreateOverlay, or by defining them in special text scripts (.overlay files). As many overlays as you like can be defined; after creation an overlay is hidden i.e. not visible until you specifically enable it by calling Show(). This allows you to have multiple overlays predefined (menus etc) which you make visible only when you want. It is possible to have multiple overlays enabled at once; in this case the relative ZOrder parameter of the overlays determine which one is displayed on top.

By default overlays are rendered into all viewports. This is fine when you only have fullscreen viewports, but if you have picture-in-picture views, you probably don't want the overlay displayed in the smaller viewports. You turn this off for a specific viewport by calling the Viewport.DisplayOverlays property.

Inheritance: Axiom.Core.Resource
Ejemplo n.º 1
0
		public void CreateScene()
		{
			TextureUtil.CreateDynamicTextureAndMaterial(
				"OBDynamicTexture",
				"OBDynamicMaterial",
				_browserWidth,
				_browserHeight,
				out _texture,
				out _material);



			
			_panel = (OverlayElementContainer)OverlayManager.Instance.Elements.CreateElement("Panel", "Panels");
			_panel.SetPosition(1, 1);
			_panel.SetDimensions(_browserWidth, _browserHeight);
			_panel.MaterialName = "OBDynamicMaterial";


			_overlay = OverlayManager.Instance.Create("OverlayBrowser");
			_overlay.AddElement(_panel);
			_overlay.Show();

			Core.BrowserManager.BrowserRenderEvent += BrowserManager_BrowserRenderEvent;
			_browserId = Core.BrowserManager.CreateBrowser("http://www.google.com.au", _browserWidth, _browserHeight);
		}
Ejemplo n.º 2
0
		public virtual void Start( RenderWindow window, ushort numGroupsInit, ushort numGroupsLoad, Real initProportion )
		{
			mWindow = window;
			mNumGroupsInit = numGroupsInit;
			mNumGroupsLoad = numGroupsLoad;
			mInitProportion = initProportion;
			// We need to pre-initialise the 'Bootstrap' group so we can use
			// the basic contents in the loading screen
			ResourceGroupManager.Instance.InitializeResourceGroup( "Bootstrap" );

			OverlayManager omgr = OverlayManager.Instance;
			mLoadOverlay = omgr.GetByName( "Core/LoadOverlay" );
			if ( mLoadOverlay == null )
			{
				throw new KeyNotFoundException( "Cannot find loading overlay" );
			}
			mLoadOverlay.Show();

			// Save links to the bar and to the loading text, for updates as we go
			mLoadingBarElement = omgr.Elements.GetElement( "Core/LoadPanel/Bar/Progress" );
			mLoadingCommentElement = omgr.Elements.GetElement( "Core/LoadPanel/Comment" );
			mLoadingDescriptionElement = omgr.Elements.GetElement( "Core/LoadPanel/Description" );

			OverlayElement barContainer = omgr.Elements.GetElement( "Core/LoadPanel/Bar" );
			mProgressBarMaxSize = barContainer.Width;
			mLoadingBarElement.Width = 0;

			// self is listener
			ResourceGroupManager.Instance.AddResourceGroupListener( this );
		}
Ejemplo n.º 3
0
 public MessageDialog(string name, int width)
 {
     _name = name;
     _dialogWidth = width;
     _dialog = OverlayManager.Instance.Create("Overlays/MessageDialog/" + _name);
     _dialogElement = CreateDialogElement();
     _dialog.AddElement(_dialogElement);
     ResizeElement();
 }
Ejemplo n.º 4
0
 public TopBar(string name, string defaultLocation)
 {
     _name = name;
     _defaultLocation = defaultLocation;
     _topBar = OverlayManager.Instance.Create("Overlays/TopBar/" + _name);
     _topBarElement = CreateTopBarElement();
     SetLocationText(_defaultLocation);
     _topBar.AddElement(_topBarElement);
 }
Ejemplo n.º 5
0
 public Inventory(string name, float x, float y, int slotCount, int slotCountX, InventoryModel model)
 {
     _name = name;
     _slotCount = slotCount;
     _inventory = OverlayManager.Instance.Create("Overlays/Inventory/" + _name);
     _model = model;
     _modelChangeTimestamp = -1;
     var inventoryElement = CreateOverlayElementContainer(x, y, slotCountX);
     _inventory.AddElement(inventoryElement);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="line"></param>
        /// <param name="overlay"></param>
        /// <param name="element"></param>
        private void ParseElementAttrib(string line, Overlay overlay, OverlayElement element)
        {
            string[] parms = line.Split(' ');

            // get a string containing only the params
            string paramLine = line.Substring(line.IndexOf(' ', 0) + 1);

            // set the param, and hopefully it exists
            if(!element.SetParam(parms[0].ToLower(), paramLine)) {
                log.WarnFormat("Bad element attribute line: {0} for element '{1}'", line, element.Name);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="script"></param>
        /// <param name="line"></param>
        /// <param name="overlay"></param>
        /// <param name="isTemplate"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        private bool ParseChildren(TextReader script, string line, Overlay overlay, bool isTemplate, OverlayElementContainer parent)
        {
            bool ret = false;
            int skipParam = 0;

            string[] parms = line.Split(' ', '(', ')');

            // split on lines with a ) will have an extra blank array element, so lets get rid of it
            if(parms[parms.Length - 1].Length == 0) {
                string[] tmp = new string[parms.Length - 1];
                Array.Copy(parms, 0, tmp, 0, parms.Length - 1);
                parms = tmp;
            }

            if(isTemplate) {
                // the first param = 'template' on a new child element
                if(parms[0] == "template") {
                    skipParam++;
                }
            }

            // top level component cannot be an element, it must be a container unless it is a template
            if(parms[0 + skipParam] == "container" || (parms[0 + skipParam] == "element" && (isTemplate || parent != null))) {
                string templateName = "";
                ret = true;

                // nested container/element
                if(parms.Length > 3 + skipParam) {
                    if(parms.Length != 5 + skipParam) {
                        log.WarnFormat("Bad element/container line: {0} in {1} - {2}, expecting ':' templateName", line, parent.Type, parent.Name);
                        ParseHelper.SkipToNextCloseBrace(script);
                        return ret;
                    }
                    if(parms[3 + skipParam] != ":") {
                        log.WarnFormat("Bad element/container line: {0} in {1} - {2}, expecting ':' for element inheritance.", line, parent.Type, parent.Name);
                        ParseHelper.SkipToNextCloseBrace(script);
                        return ret;
                    }

                    // get the template name
                    templateName = parms[4 + skipParam];
                }
                else if(parms.Length != 3 + skipParam) {
                    log.WarnFormat("Bad element/container line: {0} in {1} - {2}, expecting 'element type(name)'.", line, parent.Type, parent.Name);
                    ParseHelper.SkipToNextCloseBrace(script);
                    return ret;
                }

                ParseHelper.SkipToNextOpenBrace(script);
                bool isContainer = (parms[0 + skipParam] == "container");
                ParseNewElement(script, parms[1 + skipParam], parms[2 + skipParam], isContainer, overlay, isTemplate, templateName, parent);
            }

            return ret;
        }
        /// <summary>
        ///    Parses an attribute belonging to an Overlay.
        /// </summary>
        /// <param name="line"></param>
        /// <param name="overlay"></param>
        private void ParseAttrib(string line, Overlay overlay)
        {
            string[] parms = line.Split(' ');

            if(parms[0].ToLower() == "zorder") {
                overlay.ZOrder = int.Parse(parms[1]);
            }
            else {
                ParseHelper.LogParserError(parms[0], overlay.Name, "Invalid overlay attribute.");
            }
        }
 /// <summary>
 ///    Parses a 3D mesh which will be used in the overlay.
 /// </summary>
 /// <param name="script"></param>
 /// <param name="meshName"></param>
 /// <param name="entityName"></param>
 /// <param name="overlay"></param>
 public void ParseNewMesh(TextReader script, string meshName, string entityName, Overlay overlay)
 {
 }
Ejemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="script"></param>
        /// <param name="line"></param>
        /// <param name="overlay"></param>
        /// <param name="isTemplate"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        private bool ParseChildren(TextReader script, string line, Overlay overlay, bool isTemplate, OverlayElementContainer parent)
        {
            bool ret       = false;
            int  skipParam = 0;

            string[] parms = line.Split(' ', '(', ')');

            // split on lines with a ) will have an extra blank array element, so lets get rid of it
            if (parms[parms.Length - 1].Length == 0)
            {
                string[] tmp = new string[parms.Length - 1];
                Array.Copy(parms, 0, tmp, 0, parms.Length - 1);
                parms = tmp;
            }

            if (isTemplate)
            {
                // the first param = 'template' on a new child element
                if (parms[0] == "template")
                {
                    skipParam++;
                }
            }

            // top level component cannot be an element, it must be a container unless it is a template
            if (parms[0 + skipParam] == "container" || (parms[0 + skipParam] == "element" && (isTemplate || parent != null)))
            {
                string templateName = "";
                ret = true;

                // nested container/element
                if (parms.Length > 3 + skipParam)
                {
                    if (parms.Length != 5 + skipParam)
                    {
                        log.WarnFormat("Bad element/container line: {0} in {1} - {2}, expecting ':' templateName", line, parent.Type, parent.Name);
                        ParseHelper.SkipToNextCloseBrace(script);
                        return(ret);
                    }
                    if (parms[3 + skipParam] != ":")
                    {
                        log.WarnFormat("Bad element/container line: {0} in {1} - {2}, expecting ':' for element inheritance.", line, parent.Type, parent.Name);
                        ParseHelper.SkipToNextCloseBrace(script);
                        return(ret);
                    }

                    // get the template name
                    templateName = parms[4 + skipParam];
                }
                else if (parms.Length != 3 + skipParam)
                {
                    log.WarnFormat("Bad element/container line: {0} in {1} - {2}, expecting 'element type(name)'.", line, parent.Type, parent.Name);
                    ParseHelper.SkipToNextCloseBrace(script);
                    return(ret);
                }

                ParseHelper.SkipToNextOpenBrace(script);
                bool isContainer = (parms[0 + skipParam] == "container");
                ParseNewElement(script, parms[1 + skipParam], parms[2 + skipParam], isContainer, overlay, isTemplate, templateName, parent);
            }

            return(ret);
        }
Ejemplo n.º 11
0
		public override void CreateScene()
		{
			// Create dynamic texture
			ptex = TextureManager.Instance.CreateManual( "DynaTex", ResourceGroupManager.DefaultResourceGroupName, TextureType.TwoD, reactorExtent - 2, reactorExtent - 2, 0, PixelFormat.A8R8G8B8, TextureUsage.DynamicWriteOnly );
			buffer = ptex.GetBuffer( 0, 0 );

			// Set ambient light
			scene.AmbientLight = new ColorEx( 0.6F, 0.6F, 0.6F );
			scene.SetSkyBox( true, "SkyBox/Space", 50 );

			//mRoot->getRenderSystem()->clearFrameBuffer(FBT_COLOUR, ColourValue(255,255,255,0));

			// Create a light
			Light l = scene.CreateLight( "MainLight" );
			l.Diffuse = new ColorEx( 0.75F, 0.75F, 0.80F );
			l.Specular = new ColorEx( 0.9F, 0.9F, 1F );
			l.Position = new Vector3( -100, 80, 50 );
			scene.RootSceneNode.AttachObject( l );


			Entity planeEnt = scene.CreateEntity( "TexPlane1", PrefabEntity.Plane );
			// Give the plane a texture
			planeEnt.MaterialName = "Examples/DynaTest";

			SceneNode node = scene.RootSceneNode.CreateChildSceneNode( new Vector3( -100, -40, -100 ) );
			node.AttachObject( planeEnt );
			node.Scale = new Vector3( 3.0f, 3.0f, 3.0f );

			// Create objects
			SceneNode blaNode = scene.RootSceneNode.CreateChildSceneNode( new Vector3( -200, 0, 50 ) );
			Entity ent2 = scene.CreateEntity( "knot", "knot.mesh" );
			ent2.MaterialName = "Examples/DynaTest4";
			blaNode.AttachObject( ent2 );

			blaNode = scene.RootSceneNode.CreateChildSceneNode( new Vector3( 200, -90, 50 ) );
			ent2 = scene.CreateEntity( "knot2", "knot.mesh" );
			ent2.MaterialName = "Examples/DynaTest2";
			blaNode.AttachObject( ent2 );
			blaNode = scene.RootSceneNode.CreateChildSceneNode( new Vector3( -110, 200, 50 ) );

			// Cloaked fish
			ent2 = scene.CreateEntity( "knot3", "fish.mesh" );
			ent2.MaterialName = "Examples/DynaTest3";
			swim = ent2.GetAnimationState( "swim" );
			swim.IsEnabled = true;
			blaNode.AttachObject( ent2 );
			blaNode.Scale = new Vector3( 50.0f, 50.0f, 50.0f );

			LogManager.Instance.Write( "HardwarePixelBuffer {0} {1} {2} ", buffer.Width, buffer.Height, buffer.Depth );

			buffer.Lock( BufferLocking.Normal );
			PixelBox pb = buffer.CurrentLock;

			LogManager.Instance.Write( "PixelBox {0} {1} {2} {3} {4} {5} {6}", pb.Width, pb.Height, pb.Depth, pb.RowPitch, pb.SlicePitch, pb.Data, pb.Format );
			buffer.Unlock();

			// show GUI
			overlay = OverlayManager.Instance.GetByName( "Example/DynTexOverlay" );
			overlay.Show();
		}
Ejemplo n.º 12
0
		// Just override the mandatory create scene method
		public override void CreateScene()
		{
			RAND = new Random( 0 ); // najak: use a time-based seed
			GuiMgr = OverlayManager.Instance.Elements;
			scene.AmbientLight = new ColorEx( 0.75f, 0.75f, 0.75f ); // default Ambient Light
			// Customize Controls - speed up camera and slow down the input update rate
			this.camSpeed = 5.0f;
			inputInterval = inputTimer = 0.02f;

			// Create water mesh and entity, and attach to sceneNode
			waterMesh = new WaterMesh( "WaterMesh", PLANE_SIZE, CMPLX );
			waterEntity = scene.CreateEntity( "WaterEntity", "WaterMesh" );
			SceneNode waterNode = scene.RootSceneNode.CreateChildSceneNode();
			waterNode.AttachObject( waterEntity );

			// Add Ogre head, give it it's own node
			headNode = waterNode.CreateChildSceneNode();
			Entity ent = scene.CreateEntity( "head", "ogrehead.mesh" );
			headNode.AttachObject( ent );

			// Create the camera node, set its position & attach camera
			camera.Yaw( -45f );
			camera.Move( new Vector3( 1500f, 700f, PLANE_SIZE + 700f ) );
			camera.LookAt( new Vector3( PLANE_SIZE / 2f, 300f, PLANE_SIZE / 2f ) );
			camera.SetAutoTracking( false, headNode ); // Autotrack the head, but it isn't working right

			//scene.SetFog(FogMode.Exp, ColorEx.White, 0.000020f); // add Fog for fun, cuz we can

			// show overlay
			waterOverlay = OverlayManager.Instance.GetByName( "Example/WaterOverlay" );
			waterOverlay.Show();

			// Create Rain Emitter, but default Rain to OFF
			particleSystem = ParticleSystemManager.Instance.CreateSystem( "rain", "Examples/Water/Rain" );
			particleEmitter = particleSystem.GetEmitter( 0 );
			particleEmitter.EmissionRate = 0f;

			// Attach Rain Emitter to SceneNode, and place it 3000f above the water surface
			SceneNode rNode = scene.RootSceneNode.CreateChildSceneNode();
			rNode.Translate( new Vector3( PLANE_SIZE / 2.0f, 3000, PLANE_SIZE / 2.0f ) );
			rNode.AttachObject( particleSystem );
			particleSystem.FastForward( 20 ); // Fastforward rain to make it look natural

			// It can't be set in .particle file, and we need it ;)
			//particleSystem.Origin = BillboardOrigin.BottomCenter;

			// Set Lighting
			lightNode = scene.RootSceneNode.CreateChildSceneNode();
			lightSet = scene.CreateBillboardSet( "Lights", 20 );
			lightSet.MaterialName = "Particles/Flare";
			lightNode.AttachObject( lightSet );
			SetLighting( "Ambient" ); // Add Lights - added by Najak to show lighted Water conditions - cool!

			#region STUBBED LIGHT ANIMATION
			// Create a new animation state to track this
			// TODO: Light Animation not working.
			//this.animState = scene.CreateAnimationState("WaterLight");
			//this.animState.Time = 0f;
			//this.animState.IsEnabled = false;

			// set up spline animation of light node.  Create random Spline
			Animation anim = scene.CreateAnimation( "WaterLight", 20 );
			AnimationTrack track = anim.CreateNodeTrack( 0, this.lightNode );
			TransformKeyFrame key = (TransformKeyFrame)track.CreateKeyFrame( 0 );
			for ( int ff = 1; ff <= 19; ff++ )
			{
				key = (TransformKeyFrame)track.CreateKeyFrame( ff );
				Random rand = new Random( 0 );
				Vector3 lpos = new Vector3(
					(float)rand.NextDouble() % (int)PLANE_SIZE, //- PLANE_SIZE/2,
					(float)rand.NextDouble() % 300 + 100,
					(float)rand.NextDouble() % (int)PLANE_SIZE ); //- PLANE_SIZE/2
				key.Translate = lpos;
			}
			key = (TransformKeyFrame)track.CreateKeyFrame( 20 );
			#endregion STUBBED LIGHT ANIMATION

			// Initialize the Materials/Demo
			UpdateMaterial();
			UpdateInfoParamC();
			UpdateInfoParamD();
			UpdateInfoParamU();
			UpdateInfoParamT();
			UpdateInfoNormals();
			UpdateInfoHeadDepth();
			UpdateInfoSkyBox();
			UpdateInfoHeadSpeed();
			UpdateInfoLights();
			UpdateInfoTracking();

			// Init Head Animation:  Load adds[] elements - Ogre head animation
			adds[ 0 ] = 0.3f;
			adds[ 1 ] = -1.6f;
			adds[ 2 ] = 1.1f;
			adds[ 3 ] = 0.5f;
			sines[ 0 ] = 0;
			sines[ 1 ] = 100;
			sines[ 2 ] = 200;
			sines[ 3 ] = 300;

		} // end CreateScene()
Ejemplo n.º 13
0
		/// <summary>
		/// Creates backdrop, cursor, and trays.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="window"></param>
		/// <param name="mouse"></param>
		/// <param name="listener"></param>
		public SdkTrayManager( String name, RenderWindow window, SIS.Mouse mouse, ISdkTrayListener listener )
		{
			this.mName = name;
			this.mWindow = window;
			this.Mouse = mouse;
			Listener = listener;

			this.mWidgetPadding = 8;
			this.mWidgetSpacing = 2;

			OverlayManager om = OverlayManager.Instance;

			String nameBase = this.mName + "/";
			nameBase.Replace( ' ', '_' );

			// create overlay layers for everything

			BackdropLayer = om.Create( nameBase + "BackdropLayer" );
			this.mTraysLayer = om.Create( nameBase + "WidgetsLayer" );
			this.mPriorityLayer = om.Create( nameBase + "PriorityLayer" );
			this.cursorLayer = om.Create( nameBase + "CursorLayer" );
			BackdropLayer.ZOrder = 100;
			this.mTraysLayer.ZOrder = 200;
			this.mPriorityLayer.ZOrder = 300;
			this.cursorLayer.ZOrder = 400;

			// make backdrop and cursor overlay containers

			this.cursor =
				(OverlayElementContainer)om.Elements.CreateElementFromTemplate( "SdkTrays/Cursor", "Panel", nameBase + "Cursor" );
			this.cursorLayer.AddElement( this.cursor );
			this.backdrop = (OverlayElementContainer)om.Elements.CreateElement( "Panel", nameBase + "Backdrop" );
			BackdropLayer.AddElement( this.backdrop );
			this.mDialogShade = (OverlayElementContainer)om.Elements.CreateElement( "Panel", nameBase + "DialogShade" );
			this.mDialogShade.MaterialName = "SdkTrays/Shade";
			this.mDialogShade.Hide();
			this.mPriorityLayer.AddElement( this.mDialogShade );

			String[] trayNames = {
			                     	"TopLeft", "Top", "TopRight", "Left", "Center", "Right", "BottomLeft", "Bottom", "BottomRight"
			                     };

			for ( int i = 0; i < 9; i++ ) // make the real trays
			{
				this.mTrays[ i ] =
					(OverlayElementContainer)
					om.Elements.CreateElementFromTemplate( "SdkTrays/Tray", "BorderPanel", nameBase + trayNames[ i ] + "Tray" );

				this.mTraysLayer.AddElement( this.mTrays[ i ] );

				this.trayWidgetAlign[ i ] = HorizontalAlignment.Center;

				// align trays based on location
				if ( i == (int)TrayLocation.Top || i == (int)TrayLocation.Center || i == (int)TrayLocation.Bottom )
				{
					this.mTrays[ i ].HorizontalAlignment = HorizontalAlignment.Center;
				}
				if ( i == (int)TrayLocation.Left || i == (int)TrayLocation.Center || i == (int)TrayLocation.Right )
				{
					this.mTrays[ i ].VerticalAlignment = VerticalAlignment.Center;
				}
				if ( i == (int)TrayLocation.TopRight || i == (int)TrayLocation.Right || i == (int)TrayLocation.BottomRight )
				{
					this.mTrays[ i ].HorizontalAlignment = HorizontalAlignment.Right;
				}
				if ( i == (int)TrayLocation.BottomLeft || i == (int)TrayLocation.Bottom || i == (int)TrayLocation.BottomRight )
				{
					this.mTrays[ i ].VerticalAlignment = VerticalAlignment.Bottom;
				}
			}

			// create the null tray for free-floating widgets
			this.mTrays[ 9 ] = (OverlayElementContainer)om.Elements.CreateElement( "Panel", nameBase + "NullTray" );
			this.trayWidgetAlign[ 9 ] = HorizontalAlignment.Left;
			this.mTraysLayer.AddElement( this.mTrays[ 9 ] );

			for ( int i = 0; i < this.mWidgets.Length; i++ )
			{
				this.mWidgets[ i ] = new WidgetList();
			}

			AdjustTrays();

			ShowTrays();
			ShowCursor();
		}
Ejemplo n.º 14
0
        /// <summary>
        ///    Parses an individual .overlay file.
        /// </summary>
        /// <param name="data"></param>
        public void ParseOverlayScript(Stream data)
        {
            string  line    = "";
            Overlay overlay = null;

            StreamReader script = new StreamReader(data, System.Text.Encoding.ASCII);

            // keep reading the file until we hit the end
            while ((line = ParseHelper.ReadLine(script)) != null)
            {
                bool isTemplate = false;

                // ignore comments and blank lines
                if (line.Length > 0 && !line.StartsWith("//"))
                {
                    // does another overlay have to be included
                    if (line.StartsWith("#include"))
                    {
                        // TODO: Handle included overlays
                        continue;
                    }

                    if (overlay == null)
                    {
                        // no current overlay
                        // check to see if there is a template
                        if (line.StartsWith("template"))
                        {
                            isTemplate = true;
                        }
                        else
                        {
                            // the line in this case should be the name of the overlay
                            overlay = (Overlay)Create(line);
                            // cause the next line (open brace) to be skipped
                            ParseHelper.SkipToNextOpenBrace(script);

                            continue;
                        }
                    }
                    if (overlay != null || isTemplate)
                    {
                        // already in overlay
                        string[] parms = line.Split(' ', '(', ')');

                        // split on lines with a ) will have an extra blank array element, so lets get rid of it
                        if (parms[parms.Length - 1].Length == 0)
                        {
                            string[] tmp = new string[parms.Length - 1];
                            Array.Copy(parms, 0, tmp, 0, parms.Length - 1);
                            parms = tmp;
                        }

                        if (line == "}")
                        {
                            // finished overlay
                            overlay    = null;
                            isTemplate = false;
                        }
                        else if (ParseChildren(script, line, overlay, isTemplate, null))
                        {
                        }
                        else if (parms[0] == "entity")
                        {
                            // 3D element
                            if (parms.Length != 3)
                            {
                                log.WarnFormat("Bad entity line: {0} in {1}, expected format - entity meshName(entityName)'", line, overlay.Name);
                            }     // if parms...
                            else
                            {
                                ParseHelper.SkipToNextOpenBrace(script);
                                ParseNewMesh(script, parms[1], parms[2], overlay);
                            }
                        }
                        else
                        {
                            // must be an attribute
                            if (!isTemplate)
                            {
                                ParseAttrib(line, overlay);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 15
0
        private void EnterHandler()
        {
            Globals.UI.ShowMouse();

            if (_topBarView == null)
            {
                _topBarView = new TopBarView("Docked", _baseName);
            }

            if (_interactionView == null)
            {
                _interactionView = new InteractionView("Docked", 320, 500);
            }

            _interactionView.AddHeader("creatures", "CREATURES");
            _interactionView.AddItem("TestInstance", "Portrait", "[RK] Gom", "Guild Master", "Small", "Default", "", () => { InteractionListElementClicked("Creature"); });
            _interactionView.AddItem("TestInstance2", "Portrait", "[RK] Chapelier", "Lord of The Code", "Small", "Default", "", () => { InteractionListElementClicked("Creature"); });
            _interactionView.AddHeader("ships", "SHIPS");
            _interactionView.AddItem("TestShip", "Portrait", "Nautilus", "Small Fighter", "Small", "DefaultShip", "", () => { InteractionListElementClicked("Ship"); });

            if (_leftVerticalBar == null)
            {
                _leftVerticalBar = OverlayManager.Instance.Create("Overlays/LeftVerticalBar/Docked");
                _leftVerticalBarElement = CreateLeftVerticalBarElement();
                _leftVerticalBarElement.AddChildElement(_interactionView.ListElement);
                _interactionView.ListElement.VerticalAlignment = VerticalAlignment.Center;
                _interactionView.ListElement.Top = -(_interactionView.AbsoluteContentHeight / 2);
                _leftVerticalBar.AddElement(_leftVerticalBarElement);
            }

            _topBarView.AddButton("bar", "BAR (F1)", MoveToBar);
            _topBarView.AddButton("shopping", "SHOPS (F2)", MoveToShopping);
            _topBarView.AddButton("hangar", "HANGAR (F3)", MoveToHangar);
            _topBarView.AddButton("leave", "LEAVE (F4)", Leave);

            MoveToHangar();
        }
Ejemplo n.º 16
0
 /// <summary>
 ///    Parses a 3D mesh which will be used in the overlay.
 /// </summary>
 /// <param name="script"></param>
 /// <param name="meshName"></param>
 /// <param name="entityName"></param>
 /// <param name="overlay"></param>
 public void ParseNewMesh(TextReader script, string meshName, string entityName, Overlay overlay)
 {
 }
Ejemplo n.º 17
0
        /// <summary>
        ///    Parses a new element
        /// </summary>
        /// <param name="script"></param>
        /// <param name="type"></param>
        /// <param name="name"></param>
        /// <param name="isContainer"></param>
        /// <param name="overlay"></param>
        /// <param name="isTemplate"></param>
        /// <param name="templateName"></param>
        /// <param name="parent"></param>
        private void ParseNewElement(TextReader script, string type, string name, bool isContainer, Overlay overlay, bool isTemplate,
                                     string templateName, OverlayElementContainer parent)
        {
            string         line;
            OverlayElement element = OverlayElementManager.Instance.CreateElementFromTemplate(templateName, type, name, isTemplate);

            if (parent != null)
            {
                // add this element to the parent container
                parent.AddChild(element);
            }
            else if (overlay != null)
            {
                overlay.AddElement((OverlayElementContainer)element);
            }

            while ((line = ParseHelper.ReadLine(script)) != null)
            {
                // inore blank lines and comments
                if (line.Length > 0 && !line.StartsWith("//"))
                {
                    if (line == "}")
                    {
                        // finished element
                        break;
                    }
                    else
                    {
                        if (isContainer && ParseChildren(script, line, overlay, isTemplate, (OverlayElementContainer)element))
                        {
                            // nested children, so don't reparse it
                        }
                        else
                        {
                            // element attribute
                            ParseElementAttrib(line, overlay, element);
                        }
                    }
                }
            }
        }
Ejemplo n.º 18
0
 /// <summary>
 ///    Overloaded.  Calls overload with default of empty template name and null for the parent container.
 /// </summary>
 /// <param name="script"></param>
 /// <param name="type"></param>
 /// <param name="name"></param>
 /// <param name="isContainer"></param>
 /// <param name="overlay"></param>
 /// <param name="isTemplate"></param>
 private void ParseNewElement(TextReader script, string type, string name, bool isContainer, Overlay overlay, bool isTemplate)
 {
     ParseNewElement(script, type, name, isContainer, overlay, isTemplate, "", null);
 }
 /// <summary>
 ///    Overloaded.  Calls overload with default of empty template name and null for the parent container.
 /// </summary>
 /// <param name="script"></param>
 /// <param name="type"></param>
 /// <param name="name"></param>
 /// <param name="isContainer"></param>
 /// <param name="overlay"></param>
 /// <param name="isTemplate"></param>
 private void ParseNewElement(TextReader script, string type, string name, bool isContainer, Overlay overlay, bool isTemplate)
 {
     ParseNewElement(script, type, name, isContainer, overlay, isTemplate, "", null);
 }
Ejemplo n.º 20
0
		/// <summary>
		///
		/// </summary>
		/// <param name="name"></param>
		protected internal OverlayElement( string name )
            : base()
		{
			this.name = name;
			isVisible = true;
			isCloneable = true;
			left = 0.0f;
			top = 0.0f;
			width = 1.0f;
			height = 1.0f;
			metricsMode = MetricsMode.Relative;
			horzAlign = HorizontalAlignment.Left;
			vertAlign = VerticalAlignment.Top;
			pixelTop = 0.0f;
			pixelLeft = 0.0f;
			pixelWidth = 1.0f;
			pixelHeight = 1.0f;
			pixelScaleX = 1.0f;
			pixelScaleY = 1.0f;
			parent = null;
			overlay = null;
			isDerivedOutOfDate = true;
			isGeomPositionsOutOfDate = true;
			isGeomUVsOutOfDate = true;
			zOrder = 0;
			isEnabled = true;
			isInitialized = false;
			sourceTemplate = null;
		}
        /// <summary>
        ///    Parses a new element
        /// </summary>
        /// <param name="script"></param>
        /// <param name="type"></param>
        /// <param name="name"></param>
        /// <param name="isContainer"></param>
        /// <param name="overlay"></param>
        /// <param name="isTemplate"></param>
        /// <param name="templateName"></param>
        /// <param name="parent"></param>
        private void ParseNewElement(TextReader script, string type, string name, bool isContainer, Overlay overlay, bool isTemplate,
            string templateName, OverlayElementContainer parent)
        {
            string line;
            OverlayElement element = OverlayElementManager.Instance.CreateElementFromTemplate(templateName, type, name, isTemplate);

            if(parent != null) {
                // add this element to the parent container
                parent.AddChild(element);
            }
            else if(overlay != null) {
                overlay.AddElement((OverlayElementContainer)element);
            }

            while((line = ParseHelper.ReadLine(script)) != null) {
                // inore blank lines and comments
                if(line.Length > 0 && !line.StartsWith("//")) {
                    if(line == "}") {
                        // finished element
                        break;
                    }
                    else {
                        if(isContainer && ParseChildren(script, line, overlay, isTemplate, (OverlayElementContainer)element)) {
                            // nested children, so don't reparse it
                        }
                        else {
                            // element attribute
                            ParseElementAttrib(line, overlay, element);
                        }
                    }
                }
            }
        }
        public override void NotifyParent(OverlayElementContainer parent, Overlay overlay)
        {
            // call the base class method
            base.NotifyParent (parent, overlay);

            for(int i = 0; i < childList.Count; i++) {
                ((OverlayElement)childList[i]).NotifyParent(this, overlay);
            }
        }
Ejemplo n.º 23
0
		public override void NotifyParent( OverlayElementContainer parent, Overlay overlay )
		{
			// call the base class method
			base.NotifyParent( parent, overlay );

			foreach ( var child in this.children.Values )
			{
				child.NotifyParent( this, overlay );
			}
		}
 /// <summary>
 ///		Creates and return a new overlay.
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public override Resource Create(string name, bool isManual)
 {
     Overlay overlay = new Overlay(name);
     Load(overlay, 1);
     return overlay;
 }
 /// <summary>
 ///    Internal method for notifying the gui element of it's parent and ultimate overlay.
 /// </summary>
 /// <param name="parent">Parent of this element.</param>
 /// <param name="overlay">Overlay this element belongs to.</param>
 public virtual void NotifyParent(OverlayElementContainer parent, Overlay overlay)
 {
     this.parent = parent;
     this.overlay = overlay;
     isDerivedOutOfDate = true;
 }
Ejemplo n.º 26
0
		public ObjectTextDisplay( MovableObject p, Camera c, string shapeName )
		{
			this.parent = p;
			this.camera = c;
			this.enabled = false;
			this.text = "";

			// create an overlay that we can use for later

			// = Ogre.OverlayManager.getSingleton().create("shapeName");
			this.parentOverlay = (Overlay)OverlayManager.Instance.Create( "shapeName" );

			// (Ogre.OverlayContainer)(Ogre.OverlayManager.getSingleton().createOverlayElement("Panel", "container1"));
			this.parentContainer =
				(OverlayElementContainer)( OverlayElementManager.Instance.CreateElement( "Panel", "container1", false ) );

			//parentOverlay.add2D(parentContainer);
			this.parentOverlay.AddElement( this.parentContainer );

			//parentText = Ogre.OverlayManager.getSingleton().createOverlayElement("TextArea", "shapeNameText");
			this.parentText = OverlayElementManager.Instance.CreateElement( "TextArea", shapeName, false );

			this.parentText.SetDimensions( 1.0f, 1.0f );

			//parentText.setMetricsMode(Ogre.GMM_PIXELS);
			this.parentText.MetricsMode = MetricsMode.Pixels;


			this.parentText.SetPosition( 1.0f, 1.0f );


			this.parentText.SetParam( "font_name", "Arial" );
			this.parentText.SetParam( "char_height", "25" );
			this.parentText.SetParam( "horz_align", "center" );
			this.parentText.Color = new ColorEx( 1.0f, 1.0f, 1.0f );
			//parentText.setColour(Ogre.ColourValue(1.0, 1.0, 1.0));


			this.parentContainer.AddChild( this.parentText );

			this.parentOverlay.Show();
		}
Ejemplo n.º 27
0
		/// <summary>
		///    Internal method for notifying the gui element of it's parent and ultimate overlay.
		/// </summary>
		/// <param name="parent">Parent of this element.</param>
		/// <param name="overlay">Overlay this element belongs to.</param>
		public virtual void NotifyParent( OverlayElementContainer parent, Overlay overlay )
		{
			this.parent = parent;
			this.overlay = overlay;

			if ( overlay != null && overlay.IsInitialized && !this.isInitialized )
			{
				Initialize();
			}

			isDerivedOutOfDate = true;
		}
Ejemplo n.º 28
0
        private Dictionary<Int32, List<UpgradeGroup.Upgrade>> upgradesByCost; // Used for displaying indicator dots.

        #endregion Fields

        #region Constructors

        public UpgradeHUD(Ship pPlayerShip, Overlay pOverlay)
        {
            // Initialize local variables.
            playerShip = pPlayerShip;
            overlay = pOverlay;
            inSelectionMode = false;
            selectedUpgrade = 0;
            upgradesByCost = new Dictionary<int, List<UpgradeGroup.Upgrade>>();
            upgradePanelsByCost = new Dictionary<int, List<BorderPanel>>();
            costSelectorPanels = new Dictionary<int, BorderPanel>();

            // Create the upgrade panel.
            masterUpgradePanel = new PanelFactory().Create("Upgrade Panel") as Panel;
        }