Пример #1
0
        /// <summary>
        /// Create a new Layer for user interface
        /// </summary>
        /// <param name="attachingView">The game view that the interface layer is attached to.</param>
        /// <param name="rectLayerPos">The position and size of the layer.</param>
        public GuiLayer(String layerName, View attachingView, Rectangle rectLayerPos)
        {
            GuiLayer.lastid++;
            this.id = "GUILayer" + GuiLayer.lastid;
            this.name = layerName;
            this.attachedView = attachingView;
            this.SetArea(rectLayerPos);

            attachedView.AddLayer(this);
            //add this layer to the list of all layers in the game
            GuiLayer.allTheLayers.Add(this);
            //if there isn't currently an active GUILayer, make this one the active one

            this.BackgroundOpacity = 0.0;
            this.ForegroundOpacity = 1.0;
            this.BackgroundColor = Color.Black;
        }
Пример #2
0
        public static void Init()
        {
            Game.Clock = new DOM_Clock();
            //Game.Clock.Start();

            //I must be script#'ing wrong. This won't fire here.
            InputManager.Input.Init();
            // Set up the local player
            Player LocalPlayer = new Player();
            //Surface.Initialize(new DOM_Renderer());
            //Surface.Initialize(new Canvas_Renderer());
            Game.Renderer = new Canvas_Renderer();
            SoundSystem = new HTML5_Audio();
            //set up the primary view
            // Remember to initialize the renderer first!
            View playerOneView = new View(LightingStyle.Tiles);
            playerOneView.SetArea(new Rectangle(0, 0, Renderer.GetSize().width, Renderer.GetSize().height));

            //notificationLayer = new GuiLayer(playerOneView, new Rectangle(0, 0, 0, 0));
            notificationLayer = playerOneView.AddLayer("NotificationLayer", new Rectangle(0, 0, 0, 0));
            notificationLayer.SetSize(522, 60);
            //notificationLayer.Hide();

            //create two gui elements on the layer:
            //an image on the left
            GuiElement notifIcon = notificationLayer.AddGUIElement("");
            notifIcon.AddStyle("notifIcon");
            notifIcon.SetPosition(12, 0);
            //and sender on the right
            GuiElement notifSender = notificationLayer.AddGUIElement("");
            notifSender.SetPosition(58, 0);
            notifSender.SetSize(474, 12);
            //and the sender's handle, if applicable
            GuiElement notifSenderHandle = notificationLayer.AddGUIElement("");
            notifSenderHandle.SetPosition(80, 0);
            notifSenderHandle.SetSize(474, 12);
            notifSenderHandle.AddStyle("tweetName");
            //and the text on the right
            GuiElement notifText = notificationLayer.AddGUIElement("");
            notifText.SetPosition(58, 18);
            notifText.SetSize(474, 40);
            notificationLayer.Hide();

            //clockRenderguy = Game.Clock.AddRender(Game.Renderer.RenderUpdate);
            //clockRenderguy = Game.Clock.AddRender(Game.Renderer.Render);

            //reposition the notification layer after a few seconds
            string notif_repos = Clock.AddRender(reposition_notification_layeer);
            Clock.delayRender(notif_repos, 2);

            Clock.AddCalculation(StandardCalculations);
            Clock.IntervalExecute(Game.StandardIntervalCalculations, .2);
            Game.Paused = false;
        }