public LoginScreen()
        {
            /**
             * Scale the whole screen to 1024
             */
            BackgroundCtnr        = new UIContainer();
            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = ScreenWidth / 800.0f;

            /** Background image **/
            Background    = new UIImage(GetTexture((ulong)FileIDs.UIFileIDs.setup));
            Background.ID = "Background";
            BackgroundCtnr.Add(Background);

            var lbl = new UILabel();

            lbl.Caption = "Version 1.1097.1.0";
            lbl.X       = 20;
            lbl.Y       = 558;
            BackgroundCtnr.Add(lbl);
            this.Add(BackgroundCtnr);

            LoginProgress         = new UILoginProgress();
            LoginProgress.X       = (ScreenWidth - (LoginProgress.Width + 20));
            LoginProgress.Y       = (ScreenHeight - (LoginProgress.Height + 20));
            LoginProgress.Opacity = 0.9f;
            this.Add(LoginProgress);

            LoginDialog         = new UILoginDialog(this);
            LoginDialog.Opacity = 0.9f;
            //Center
            LoginDialog.X = (ScreenWidth - LoginDialog.Width) / 2;
            LoginDialog.Y = (ScreenHeight - LoginDialog.Height) / 2;
            this.Add(LoginDialog);
        }
Example #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            font              = Content.Load <SpriteFont>("Arial");
            whiteTexture      = Content.Load <Texture2D>("white");
            pointerTexture    = Content.Load <Texture2D>("pointer");
            runningTexture    = Content.Load <Texture2D>("running");
            breakpointTexture = Content.Load <Texture2D>("breakpoint");
            runTexture        = Content.Load <Texture2D>("run");
            stepInTexture     = Content.Load <Texture2D>("stepin");
            stepOverTexture   = Content.Load <Texture2D>("stepover");
            stepOutTexture    = Content.Load <Texture2D>("stepout");
            restartTexture    = Content.Load <Texture2D>("restart");
            pinheadTexture    = Content.Load <Texture2D>("pinhead");

            ui = new UIContainer();
            UIButtonStyle defaultButtonStyle = UIButton.GetDefaultStyle(Content);

            ui.Add(new UIButton("Run (F5)", runTexture, new Rectangle(100, 650, 120, 40), defaultButtonStyle, DoRun));
            ui.Add(new UIButton("Step In (F11)", stepInTexture, new Rectangle(240, 650, 120, 40), defaultButtonStyle, DoStepIn));
            ui.Add(new UIButton("Step Over (F10)", stepOverTexture, new Rectangle(380, 650, 120, 40), defaultButtonStyle, DoStepOver));
            ui.Add(new UIButton("Step Out (^F11)", stepOutTexture, new Rectangle(520, 650, 120, 40), defaultButtonStyle, DoStepOut));
            ui.Add(new UIButton("Restart", restartTexture, new Rectangle(660, 650, 120, 40), defaultButtonStyle, DoRestart));

            DoRestart();
        }
 /*
  * Horizontal Walls: north and south
  */
 private void AddHWall(int row, int column, bool isSouth)
 {
     if (row == -1) // charisma player
     {
         if (isSouth)
         {
             SouthWall.Visible = true;
             South.Disabled    = true;
         }
         else
         {
             NorthWall.Visible = true;
             North.Disabled    = true;
         }
     }
     else // logic player
     {
         if (isSouth)
         {
             row++;
         }
         UIHighlightSprite hwall = new UIHighlightSprite((int)HWall.Width, (int)HWall.Height, 0.95f);
         hwall.Position = NWWallOriginOffset;
         hwall.Y       += row * CellOffsetY;
         hwall.X       += column * CellOffsetX;
         WallContainer.Add(hwall);
     }
 }
        /*
         * Logic player only: removes colored cells and draws the path from the origin to the goal
         */
        private void DrawSolutionHandler(string evt, byte[] solutionPathCoords)
        {
            ColoredCellsContainer.Visible = false;
            if (solutionPathCoords.Length > 2 && solutionPathCoords.Length % 2 == 1)
            {
                // the very first byte is the color of the origin
                var    colorCode   = solutionPathCoords[0];
                string index       = "";
                string colorString = "";
                switch (colorCode)
                {
                case 0:
                {
                    index       = "12";   // "Blue"
                    colorString = "BlueIcon";
                    break;
                }

                case 1:
                {
                    index       = "13";   // "Green"
                    colorString = "GreenIcon";
                    break;
                }

                case 2:
                {
                    index       = "14";   // "Red"
                    colorString = "RedIcon";
                    break;
                }

                default:
                {
                    index       = "15";   // "Yellow"
                    colorString = "YellowIcon";
                    break;
                }
                }
                // the first two coordinates are the origin
                var origin = Script.Create <UIImage>(colorString);
                origin.UseTooltip();
                origin.Position = NWCellOriginOffset;
                origin.Y       += solutionPathCoords[1] * CellOffsetY;
                origin.X       += solutionPathCoords[2] * CellOffsetX;
                origin.Tooltip  = GameFacade.Strings.GetString("f112", index);
                SolutionPathContainer.Add(origin);

                // now draw the path with remaining coordinates
                for (int x = 3; x < solutionPathCoords.Length - 1; x++)
                {
                    var track = new UIImage(MazeXTrackTexture);
                    track.Position = NWCellOriginOffset;
                    track.Y       += solutionPathCoords[x++] * CellOffsetY;
                    track.X       += solutionPathCoords[x] * CellOffsetX;
                    SolutionPathContainer.Add(track);
                }
            }
        }
        /// <summary>
        /// Handles AddText nodes in a UIScript
        /// This method will:
        ///  * Create a label
        ///  * Assign all the properties from the UIScript
        ///  * Add to the display list
        ///  * Wire up against any members with the same name in the target class
        /// </summary>
        /// <param name="node"></param>
        public void AddText(UINode node)
        {
            var label = new UILabel();

            DoSetControlProperties(label, node);
            target.Add(label);
            WireUp(node.ID, label);
        }
Example #6
0
 void Init()
 {
     if (price > 0)
     {
         ui.Add(new UIBuyButton("Buy", price, new Rectangle(-40, 36, 112, 35), Game1.buttonStyle, button_Purchase));
     }
     else
     {
         ui.Add(new UIButton("Collect", new Rectangle(-40, 36, 112, 35), Game1.buttonStyle, button_Purchase));
     }
 }
Example #7
0
        public LoginScreen()
        {
            PlayBackgroundMusic(new string[] { "none" });

            /**
             * Scale the whole screen to 1024
             */
            BackgroundCtnr        = new UIContainer();
            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = ScreenWidth / 800.0f;

            /** Background image **/
            Background    = new UIImage(GetTexture((ulong)FileIDs.UIFileIDs.setup));
            Background.ID = "Background";
            BackgroundCtnr.Add(Background);

            /** Client version **/
            var lbl = new UILabel();

            lbl.Caption = "Version " + GlobalSettings.Default.ClientVersion;
            lbl.X       = 20;
            lbl.Y       = 558;
            BackgroundCtnr.Add(lbl);
            this.Add(BackgroundCtnr);

            /** Progress bar **/
            LoginProgress         = new UILoginProgress();
            LoginProgress.X       = (ScreenWidth - (LoginProgress.Width + 20));
            LoginProgress.Y       = (ScreenHeight - (LoginProgress.Height + 20));
            LoginProgress.Opacity = 0.9f;
            this.Add(LoginProgress);

            /** Login dialog **/
            LoginDialog         = new UILoginDialog(this);
            LoginDialog.Opacity = 0.9f;
            //Center
            LoginDialog.X = (ScreenWidth - LoginDialog.Width) / 2;
            LoginDialog.Y = (ScreenHeight - LoginDialog.Height) / 2;
            this.Add(LoginDialog);

            NetworkFacade.Controller.OnNetworkError  += new NetworkErrorDelegate(Controller_OnNetworkError);
            NetworkFacade.Controller.OnLoginProgress += new OnProgressDelegate(Controller_OnLoginProgress);
            NetworkFacade.Controller.OnLoginStatus   += new OnLoginStatusDelegate(Controller_OnLoginStatus);
            var gameplayButton = new UIButton()
            {
                Caption = "Simantics & Lot Debug",
                Y       = 10,
                Width   = 200,
                X       = 10
            };

            this.Add(gameplayButton);
            gameplayButton.OnButtonClick += new ButtonClickDelegate(gameplayButton_OnButtonClick);
        }
Example #8
0
 private void GameFacade_OnContentLoaderReady()
 {
     /**
      * Add a debug button once the content loader is ready so we can load textures
      */
     debugButton = new UIButton()
     {
         Caption = "Debug",
         Y       = 10,
         Width   = 100,
         X       = GlobalSettings.Default.GraphicsWidth - 110
     };
     debugButton.OnButtonClick += new ButtonClickDelegate(debugButton_OnButtonClick);
     mainUI.Add(debugButton);
 }
Example #9
0
        /// <summary>
        /// Creates a new CityTransitionScreen.
        /// </summary>
        /// <param name="SelectedCity">The city being transitioned to.</param>
        /// <param name="CharacterCreated">If transitioning from CreateASim, this should be true.
        /// A CharacterCreateCity packet will be sent to the CityServer. Otherwise, this should be false.
        /// A CityToken packet will be sent to the CityServer.</param>
        public CityTransitionScreen(CityInfo SelectedCity, bool CharacterCreated)
        {
            m_SelectedCity     = SelectedCity;
            m_CharacterCreated = CharacterCreated;

            /**
             * Scale the whole screen to 1024
             */
            m_BackgroundCtnr        = new UIContainer();
            m_BackgroundCtnr.ScaleX = m_BackgroundCtnr.ScaleY = ScreenWidth / 800.0f;

            /** Background image **/
            m_Background    = new UIImage(GetTexture((ulong)FileIDs.UIFileIDs.setup));
            m_Background.ID = "Background";
            m_BackgroundCtnr.Add(m_Background);

            var lbl = new UILabel();

            lbl.Caption = "Version " + GlobalSettings.Default.ClientVersion;
            lbl.X       = 20;
            lbl.Y       = 558;
            m_BackgroundCtnr.Add(lbl);
            this.Add(m_BackgroundCtnr);

            m_LoginProgress         = new UILoginProgress();
            m_LoginProgress.X       = (ScreenWidth - (m_LoginProgress.Width + 20));
            m_LoginProgress.Y       = (ScreenHeight - (m_LoginProgress.Height + 20));
            m_LoginProgress.Opacity = 0.9f;
            this.Add(m_LoginProgress);

            NetworkFacade.Controller.OnNetworkError += new NetworkErrorDelegate(Controller_OnNetworkError);

            LoginArgsContainer LoginArgs = new LoginArgsContainer();

            LoginArgs.Username = NetworkFacade.Client.ClientEncryptor.Username;
            LoginArgs.Password = Convert.ToBase64String(PlayerAccount.Hash);
            LoginArgs.Enc      = NetworkFacade.Client.ClientEncryptor;

            NetworkFacade.Client = new NetworkClient(SelectedCity.IP, SelectedCity.Port);
            //THIS IS IMPORTANT - THIS NEEDS TO BE COPIED AFTER IT HAS BEEN RECREATED FOR
            //THE RECONNECTION TO WORK!
            LoginArgs.Client = NetworkFacade.Client;
            NetworkFacade.Client.OnConnected += new OnConnectedDelegate(Client_OnConnected);
            NetworkFacade.Controller.Reconnect(ref NetworkFacade.Client, SelectedCity, LoginArgs);

            NetworkFacade.Controller.OnCharacterCreationStatus += new OnCharacterCreationStatusDelegate(Controller_OnCharacterCreationStatus);
            NetworkFacade.Controller.OnCityTransferProgress    += new OnCityTransferProgressDelegate(Controller_OnCityTransfer);
        }
Example #10
0
        public void SetupQuery()
        {
            UIContainer parent = null;

            QueryPanel = new UIQueryPanel(World);

            if (QueryPanel.Parent != null && QueryPanel.Parent.Parent != null)
            {
                parent = QueryPanel.Parent;
            }

            QueryPanel.OnSellBackClicked += ObjectHolder.SellBack;
            //QueryPanel.OnInventoryClicked += ObjectHolder.MoveToInventory;
            //QueryPanel.OnAsyncBuyClicked += ObjectHolder.AsyncBuy;
            //QueryPanel.OnAsyncSaleClicked += ObjectHolder.AsyncSale;
            //QueryPanel.OnAsyncPriceClicked += ObjectHolder.AsyncSale;
            //QueryPanel.OnAsyncSaleCancelClicked += ObjectHolder.AsyncCancelSale;
            QueryPanel.X = 0;
            QueryPanel.Y = -114;

            if (parent != null)
            {
                parent.Add(QueryPanel);
            }
        }
Example #11
0
        void slot_Clicked()
        {
            isOpen = !isOpen;

            if (weaponSlotStyle == null)
            {
                weaponSlotStyle = new UIButtonStyle(
                    new UIButtonAppearance(Game1.font, Color.White, TextureCache.castIronButton, Color.White, new Vector2(25, 0)),
                    new UIButtonAppearance(Game1.font, Color.White, TextureCache.castIronButton_hover, Color.White, new Vector2(25, 0)),
                    new UIButtonAppearance(Game1.font, Color.White, TextureCache.castIronButton_pressed, Color.White, new Vector2(25, 1)),
                    new UIButtonAppearance(Game1.font, Color.White, TextureCache.castIronButton, Color.White, new Vector2(25, 0))
                    );
            }

            const int BUTTONHEIGHT = 50;

            dropDown.Clear();
            Vector2 nextSelectablePos = new Vector2(frame.X, frame.Y - BUTTONHEIGHT * (availableWeapons.Count() - 1));

            foreach (Weapon w in availableWeapons)
            {
                if (w != slot.weapon)
                {
                    dropDown.Add(new UIWeaponSelectable(w, new Rectangle((int)nextSelectablePos.X, (int)nextSelectablePos.Y, 175, BUTTONHEIGHT), weaponSlotStyle, button_SelectWeapon));
                    nextSelectablePos.Y += BUTTONHEIGHT;
                }
            }
        }
Example #12
0
	private void AddItems(){
		container = GetContainer ();

		if (container != null) {
			if (clearContainer) {
				container.Clear ();
			}

			if (execute != null) {
				if(behaviour == null){
					behaviour = gameObject.AddBehaviour(execute);
					behaviour.stateMachine.SetVariable ("Items", items);
					behaviour.stateMachine.SetVariable ("Container", container.gameObject);
				}
				return;
			}

			for (int i=0; i< items.Length; i++) {
				if (items [i] != null) {
					container.Add (items[i]);
				}
			}

			if(openContainer){
				OpenContainer();
			}
		}
	}
        private void Redraw()
        {
            if (myTextButtons != null)
            {
                foreach (var btn in myTextButtons)
                {
                    myNumCtnr.Remove(btn);
                }
                m_SelectedButton = null;
            }

            var numsToShow = Math.Min(m_TotalPages, (int)Math.Floor((double)m_Width / 15));

            myTextButtons = new UIClickableLabel[numsToShow];
            for (int i = 0; i < numsToShow; i++)
            {
                var btn = new UIClickableLabel()
                {
                    X            = i * ItemSize,
                    Caption      = (i + 1).ToString(),
                    Size         = new Microsoft.Xna.Framework.Vector2(ItemSize, ItemSize),
                    CaptionStyle = TextStyle
                };
                myTextButtons[i] = btn;
                myTextButtons[i].OnButtonClick += new ButtonClickDelegate(UIPaginationBar_OnButtonClick);
                myNumCtnr.Add(myTextButtons[i]);
            }

            SetSize(m_Width, m_Height);
            SelectedPage = m_SelectedPage;
        }
        private void MarkCellHandler(string evt, byte[] coords)
        {
            UIContainer container = ColoredCellsContainer;

            evt = evt.Remove(0, 8); // remove "TSOMaze_"
            if (coords.Length > 0 && coords.Length % 2 == 0)
            {
                string index = "15"; // "Yellow"
                switch (evt[0])
                {
                // blue is always the first color marked, so make a new container for it and make sure it's visible
                case 'B':
                {
                    index = "12";         // "Blue"
                    if (ColoredCellsContainer != null)
                    {
                        Remove(ColoredCellsContainer);
                    }
                    ColoredCellsContainer = new UIContainer()
                    {
                        Visible = true
                    };
                    Add(ColoredCellsContainer);
                    container = ColoredCellsContainer;
                    break;
                }

                case 'E':
                {
                    index = "12";
                    if (SolutionPathContainer != null)
                    {
                        Remove(SolutionPathContainer);
                    }
                    SolutionPathContainer = new UIContainer()
                    {
                        Visible = true
                    };
                    container = SolutionPathContainer;
                    Add(SolutionPathContainer);
                    break;         // "Blue" for "ExitIcon"
                }

                case 'G': index = "13"; break;     // "Green"

                case 'R': index = "14"; break;     // "Red"
                }
                for (int x = 0; x < coords.Length - 1; x++)
                {
                    var color = Script.Create <UIImage>(evt);
                    color.UseTooltip();
                    color.Position = NWCellOriginOffset;
                    color.Y       += coords[x++] * CellOffsetY;
                    color.X       += coords[x] * CellOffsetX;
                    color.Tooltip  = GameFacade.Strings.GetString("f112", index);
                    container.Add(color);
                }
            }
        }
Example #15
0
        /// <summary>
        /// Adds a UIScreen instance to this ScreenManager's list of screens.
        /// This function is called from Lua.
        /// </summary>
        /// <param name="Screen">The UIScreen instance to be added.</param>
        public void AddScreen(UIScreen Screen)
        {
            /*if (currentScreen != null)
             * {
             *  mainUI.Remove(currentScreen);
             * }*/
            /** Add screen on top **/
            mainUI.Add(Screen);
            /** Bring dialogs to top **/
            mainUI.Add(dialogContainer);
            /** Bring debug to the top **/
            //mainUI.Add(debugButton);

            Screen.OnShow();

            m_Screens.Add(Screen);
            currentScreen = Screen;
        }
Example #16
0
        public UILayer(Microsoft.Xna.Framework.Game G)
        {
            fpsStopwatch = new Stopwatch();
            fpsStopwatch.Start();

            m_G = G;

            m_WorldMatrix      = Matrix.Identity;
            m_ViewMatrix       = Matrix.CreateLookAt(Vector3.Right * 5, Vector3.Zero, Vector3.Forward);
            m_ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.Pi / 4.0f,
                                                                     (float)GraphicsDevice.PresentationParameters.BackBufferWidth /
                                                                     (float)GraphicsDevice.PresentationParameters.BackBufferHeight,
                                                                     1.0f, 100.0f);

            TextStyle.DefaultTitle = new TextStyle {
                Font              = GameFacade.MainFont,
                VFont             = GameFacade.VectorFont,
                Size              = 10,
                Color             = new Color(255, 249, 157),
                SelectedColor     = new Color(0x00, 0x38, 0x7B),
                SelectionBoxColor = new Color(255, 249, 157)
            };

            TextStyle.DefaultButton = new TextStyle
            {
                Font              = GameFacade.MainFont,
                VFont             = GameFacade.VectorFont,
                Size              = 10,
                Color             = new Color(255, 249, 157),
                SelectedColor     = new Color(0x00, 0x38, 0x7B),
                SelectionBoxColor = new Color(255, 249, 157)
            };

            TextStyle.DefaultLabel = new TextStyle
            {
                Font              = GameFacade.MainFont,
                VFont             = GameFacade.VectorFont,
                Size              = 10,
                Color             = new Color(255, 249, 157),
                SelectedColor     = new Color(0x00, 0x38, 0x7B),
                SelectionBoxColor = new Color(255, 249, 157)
            };

            Tween = new UITween();
            this.AddProcess(Tween);

            inputManager = new InputManager();
            inputManager.RequireWindowFocus = true;
            mainUI          = new UIContainer();
            dialogContainer = new UIContainer();
            mainUI.Add(dialogContainer);

            // Create a new SpriteBatch, which can be used to draw textures.
            SpriteBatch = new UISpriteBatch(GraphicsDevice, 0);
            //GameFacade.OnContentLoaderReady += new BasicEventHandler(GameFacade_OnContentLoaderReady);
            m_G.GraphicsDevice.DeviceReset += new EventHandler <EventArgs>(GraphicsDevice_DeviceReset);
        }
Example #17
0
        public UILayer(Microsoft.Xna.Framework.Game G, SpriteFont SprFontBig, SpriteFont SprFontSmall)
        {
            m_G            = G;
            m_SprFontBig   = SprFontBig;
            m_SprFontSmall = SprFontSmall;

            GraphicsDevice.VertexDeclaration = new VertexDeclaration(GraphicsDevice,
                                                                     VertexPositionNormalTexture.VertexElements);

            m_WorldMatrix      = Matrix.Identity;
            m_ViewMatrix       = Matrix.CreateLookAt(Vector3.Right * 5, Vector3.Zero, Vector3.Forward);
            m_ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.Pi / 4.0f,
                                                                     (float)GraphicsDevice.PresentationParameters.BackBufferWidth /
                                                                     (float)GraphicsDevice.PresentationParameters.BackBufferHeight,
                                                                     1.0f, 100.0f);

            TextStyle.DefaultTitle = new TextStyle {
                Font              = GameFacade.MainFont,
                Size              = 10,
                Color             = new Color(255, 249, 157),
                SelectedColor     = new Color(0x00, 0x38, 0x7B),
                SelectionBoxColor = new Color(255, 249, 157)
            };

            TextStyle.DefaultButton = new TextStyle
            {
                Font              = GameFacade.MainFont,
                Size              = 10,
                Color             = new Color(255, 249, 157),
                SelectedColor     = new Color(0x00, 0x38, 0x7B),
                SelectionBoxColor = new Color(255, 249, 157)
            };

            TextStyle.DefaultLabel = new TextStyle
            {
                Font              = GameFacade.MainFont,
                Size              = 10,
                Color             = new Color(255, 249, 157),
                SelectedColor     = new Color(0x00, 0x38, 0x7B),
                SelectionBoxColor = new Color(255, 249, 157)
            };

            Tween = new UITween();
            this.AddProcess(Tween);

            inputManager    = new InputManager();
            mainUI          = new UIContainer();
            dialogContainer = new UIContainer();
            mainUI.Add(dialogContainer);

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new UISpriteBatch(GraphicsDevice, 3);

            GameFacade.OnContentLoaderReady += new BasicEventHandler(GameFacade_OnContentLoaderReady);
            m_G.GraphicsDevice.DeviceReset  += new EventHandler(GraphicsDevice_DeviceReset);
        }
Example #18
0
        public PlatformLevel()
        {
            //InitObjects();

            ui = new UIContainer();
            ui.Add(new UIButton("Reset", new Rectangle(610, 30, 100, 50), Game1.buttonStyle, button_Reset));
            ui.Add(new UIButton("Cancel", new Rectangle(610, 90, 100, 50), Game1.buttonStyle, button_Cancel));

            saveButton = new UIButton("Save", new Rectangle(10, 302, 100, 40), Game1.buttonStyle, button_Save);
            ui.Add(saveButton);
            weaponSlots = new UIContainer();
            ui.Add(weaponSlots);

            weaponButtonStyle = new UIButtonStyle(
                new UIButtonAppearance(Game1.font, Color.White, TextureCache.steelButton, Color.White, new Vector2(20, 0)),
                new UIButtonAppearance(Game1.font, Color.White, TextureCache.steelButton_hover, Color.White, new Vector2(20, 0)),
                new UIButtonAppearance(Game1.font, Color.White, TextureCache.steelButton_pressed, Color.White, new Vector2(20, 1)),
                new UIButtonAppearance(Game1.font, Color.White, TextureCache.steelButton, Color.White, new Vector2(20, 0))
                );
        }
Example #19
0
        public UISetupBackground()
        {
            var ScreenWidth  = GlobalSettings.Default.GraphicsWidth;
            var ScreenHeight = GlobalSettings.Default.GraphicsHeight;

            BackgroundCtnr = new UIContainer();
            var scale = ScreenHeight / 600.0f;

            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = scale;

            /** Background image **/
            Texture2D setupTex;

            if (File.Exists(LoadingScreens.CustomLoadingScreen))
            {
                using (var logostrm = File.Open(LoadingScreens.CustomLoadingScreen, FileMode.Open, FileAccess.Read, FileShare.Read))
                    setupTex = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);
            }
            // In the future servers should be allowed to have their own custom holiday splash screens
            else if (DateTime.UtcNow.Month == 12 && File.Exists(LoadingScreens.XmasLoadingScreen) &&
                     GlobalSettings.Default.HolidayLoadingScreens == true)
            {
                using (var logostrm = File.Open(LoadingScreens.XmasLoadingScreen, FileMode.Open, FileAccess.Read, FileShare.Read))
                    setupTex = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);
            }
            else
            {
                setupTex = GetTexture((ulong)FileIDs.UIFileIDs.setup);
            }

            Background = new UIImage(setupTex);
            var bgScale = 600f / setupTex.Height;

            Background.SetSize(setupTex.Width * bgScale, 600);
            Background.X = (800 - bgScale * setupTex.Width) / 2;
            BackgroundCtnr.Add(Background);
            BackgroundCtnr.X = (ScreenWidth - (800 * scale)) / 2;

            Texture2D splashSeg;

            using (var logostrm = File.Open("Content/Textures/splashSeg.png", FileMode.Open, FileAccess.Read, FileShare.Read))
                splashSeg = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);

            BgEdge = new UIImage(splashSeg).With9Slice(64, 64, 1, 1);
            BackgroundCtnr.AddAt(0, BgEdge);
            BgEdge.Y = -1;
            BgEdge.X = Background.X - 64;
            BgEdge.SetSize(Background.Width + 64 * 2, ScreenHeight + 2);

            Add(BackgroundCtnr);
        }
Example #20
0
        public UISetupBackground()
        {
            var ScreenWidth  = GlobalSettings.Default.GraphicsWidth;
            var ScreenHeight = GlobalSettings.Default.GraphicsHeight;

            BackgroundCtnr = new UIContainer();
            var scale = ScreenHeight / 600.0f;

            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = scale;

            /** Background image **/
            Texture2D setupTex;

            string[] splashes;
            if (Directory.Exists("Content/SplashScreens") && (splashes = Directory.GetFiles("Content/SplashScreens")).Length > 0)
            {
                Random rng = new Random();
                using (var logostrm = File.Open(splashes[rng.Next(splashes.Length)], FileMode.Open, FileAccess.Read, FileShare.Read))
                    setupTex = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);
            }
            else if (File.Exists("Content/setup.png")) //Compatible with the previous version
            {
                using (var logostrm = File.Open("Content/setup.png", FileMode.Open, FileAccess.Read, FileShare.Read))
                    setupTex = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);
            }
            else
            {
                setupTex = GetTexture((ulong)FileIDs.UIFileIDs.setup);
            }
            Background = new UIImage(setupTex);
            var bgScale = 600f / setupTex.Height;

            Background.SetSize(setupTex.Width * bgScale, 600);
            Background.X = (800 - bgScale * setupTex.Width) / 2;
            BackgroundCtnr.Add(Background);
            BackgroundCtnr.X = (ScreenWidth - (800 * scale)) / 2;

            Texture2D splashSeg;

            using (var logostrm = File.Open("Content/Textures/splashSeg.png", FileMode.Open, FileAccess.Read, FileShare.Read))
                splashSeg = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);

            BgEdge = new UIImage(splashSeg).With9Slice(64, 64, 1, 1);
            BackgroundCtnr.AddAt(0, BgEdge);
            BgEdge.Y = -1;
            BgEdge.X = Background.X - 64;
            BgEdge.SetSize(Background.Width + 64 * 2, ScreenHeight + 2);

            Add(BackgroundCtnr);
        }
Example #21
0
        void Init()
        {
            ui = new UIContainer();

            mode = CentrifugeMode.TurnRight;
            if (inputSignature != null)
            {
                UpdateOutputSignature();
            }

            UIButtonStyle centrifuge_button = new UIButtonStyle(new UIButtonAppearance(Game1.font, Color.Black, new RichImage(TextureCache.centrifuge_button_highlight), Color.Black, new Vector2(1, 0)),
                                                                new UIButtonAppearance(Game1.font, Color.Black, new RichImage(TextureCache.centrifuge_button_highlight), Color.Yellow, new Vector2(1, 0)),
                                                                new UIButtonAppearance(Game1.font, Color.Black, new RichImage(TextureCache.centrifuge_button_highlight), Color.Orange, new Vector2(1, 0)),
                                                                new UIButtonAppearance(Game1.font, Color.Black, new RichImage(TextureCache.centrifuge_button_highlight), Color.Black, new Vector2(1, 0)));

            ui.Add(new UIButton("", TextureCache.turnLeft, new Rectangle(-4, 42, 18, 18), centrifuge_button, button_SelectTurnLeft));
            ui.Add(new UIButton("", TextureCache.turn180, new Rectangle(14, 42, 18, 18), centrifuge_button, button_SelectTurn180));
            ui.Add(new UIButton("", TextureCache.turnRight, new Rectangle(33, 42, 18, 18), centrifuge_button, button_SelectTurnRight));

            SetPipeSocket(new Vector2(24, 13), 1);
            AddOutputPipe(new Vector2(14, 44));
            unlimitedPipes = true;
        }
Example #22
0
        public void InitUI()
        {
            ui = new UIContainer();

            if (Game1.instance.inventory.hasWorldMap)
            {
                ui.Add(new UIButton("World Map", new Rectangle(600, 10, 190, 40), Game1.buttonStyle, button_GoToMap));
            }

            int buttonY = 70;

            if (Game1.instance.inventory.hasFactoryBlueprint)
            {
                newFactoryButton = new UIBuyButton("Build Factory", nextFactoryPrice, new Rectangle(600, buttonY, 190, 40), Game1.buttonStyle, button_SpawnFactory);
                ui.Add(newFactoryButton);
                buttonY += 50;
            }
            if (Game1.instance.inventory.hasBigFactoryBlueprint)
            {
                newBigFactoryButton = new UIBuyButton("Build Big Factory", nextFactoryPrice, new Rectangle(600, buttonY, 190, 40), Game1.buttonStyle, button_SpawnBigFactory);
                ui.Add(newBigFactoryButton);
                buttonY += 50;
            }
            //newFactoryButton = new UIBuyButton("Build Factory", 100, new Rectangle(600, 100, 170, 40), Game1.buttonStyle, button_SpawnFactory);
            if (Game1.instance.inventory.hasSiloBlueprint)
            {
                newSiloButton = new UIBuyButton("Build Silo", 150, new Rectangle(600, buttonY, 190, 40), Game1.buttonStyle, button_SpawnSilo);
                ui.Add(newSiloButton);
                buttonY += 50;
            }
            if (Game1.instance.inventory.hasCentrifugeBlueprint)
            {
                newCentrifugeButton = new UIBuyButton("Build Centrifuge", 150, new Rectangle(600, buttonY, 190, 40), Game1.buttonStyle, button_SpawnCentrifuge);
                ui.Add(newCentrifugeButton);
                buttonY += 50;
            }

            /*            unlockableUI = new Dictionary<string, UIElement>()
             *          {
             *              { "BUY_FACTORY", newFactoryButton },
             *              { "BUY_BIG_FACTORY", newBigFactoryButton },
             *              { "BUY_SILO", newSiloButton },
             *              { "BUY_CENTRIFUGE", newCentrifugeButton },
             *          };*/

#if DEBUG
            ui.Add(new UIButton("Cheat:Unlocks", new Rectangle(600, 370, 170, 40), Game1.buttonStyle, button_Unlocks));
            ui.Add(new UIButton("Cheat:Loadsamoney", new Rectangle(600, 420, 170, 40), Game1.buttonStyle, button_CheatMoney));
#endif
        }
Example #23
0
        public MaxisLogo() : base()
        {
            /**
             * Scale the whole screen to 1024
             */
            BackgroundCtnr        = new UIContainer();
            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = GlobalSettings.Default.GraphicsWidth / 640.0f;

            /** Background image **/
            m_MaxisLogo = new UIImage(GetTexture((ulong)FileIDs.UIFileIDs.maxislogo));
            BackgroundCtnr.Add(m_MaxisLogo);

            this.Add(BackgroundCtnr);

            m_CheckProgressTimer          = new Timer();
            m_CheckProgressTimer.Interval = 5000;
            m_CheckProgressTimer.Elapsed += new ElapsedEventHandler(m_CheckProgressTimer_Elapsed);
            m_CheckProgressTimer.Start();
        }
Example #24
0
        private void AddCheckBox(UIContainer parent, string caption, string groupName)
        {
            var formField = new UIHBoxContainer();

            parent.Add(formField);

            var check = new UIButton(GetTexture(0x0000083600000001));

            check.Tooltip        = caption;
            check.OnButtonClick += x => {
                check.Selected = !check.Selected;
                SetOption(groupName, check.Selected);
            };

            formField.Add(check);

            formField.Add(new UILabel {
                Caption = caption
            });
        }
Example #25
0
        public EALogo()
            : base()
        {
            PlayBackgroundMusic(new string[] { GameFacade.GameFilePath("music\\stations\\latin\\latin3_7df26b84.mp3") });

            /**
             * Scale the whole screen to 1024
             */
            BackgroundCtnr        = new UIContainer();
            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = GlobalSettings.Default.GraphicsWidth / 800.0f;

            /** Background image **/
            m_EALogo = new UIImage(GetTexture((ulong)FileIDs.UIFileIDs.eagames));
            BackgroundCtnr.Add(m_EALogo);

            this.Add(BackgroundCtnr);

            m_CheckProgressTimer          = new Timer();
            m_CheckProgressTimer.Interval = 5000;
            m_CheckProgressTimer.Elapsed += new ElapsedEventHandler(m_CheckProgressTimer_Elapsed);
            m_CheckProgressTimer.Start();
        }
Example #26
0
        public EALogo()
            : base()
        {
            //HITVM.Get().PlaySoundEvent(UIMusic.LoadLoop);

            /**
             * Scale the whole screen to 1024
             */
            BackgroundCtnr        = new UIContainer();
            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = GlobalSettings.Default.GraphicsWidth / 800.0f;

            /** Background image **/
            m_EALogo = new UIImage(GetTexture((ulong)FileIDs.UIFileIDs.eagames));
            BackgroundCtnr.Add(m_EALogo);

            this.Add(BackgroundCtnr);

            m_CheckProgressTimer          = new Timer();
            m_CheckProgressTimer.Interval = 5000;
            m_CheckProgressTimer.Elapsed += new ElapsedEventHandler(m_CheckProgressTimer_Elapsed);
            m_CheckProgressTimer.Start();
        }
Example #27
0
        private void DrawCellBanner(CompleteVCell cell, HashSet <UINeighBanner> toDraw, UIContainer bannerContainer, float f)
        {
            var screenCtr = City.transformSpr4(new Vector3(cell.Center.X, City.InterpElevationAt(cell.Center) + 5f, cell.Center.Y));

            if (!float.IsNaN(screenCtr.X) && screenCtr.Z > 0)
            {
                var banner = Banners.FirstOrDefault(x => x.DataID == cell.Ind);
                if (banner != null && banner.Parent == null)
                {
                    Banners.Remove(banner);
                    banner = null;
                }

                if (banner == null)
                {
                    var nhood = Data[cell.Ind];
                    banner = new UINeighBanner()
                    {
                        DataID      = cell.Ind,
                        Caption     = nhood.Name,
                        BannerColor = (nhood.Color ?? Color.White)
                    };
                    Banners.Add(banner);
                    bannerContainer.Add(banner);
                }

                var mulFactor = 120f;
                if (City.Camera is CityCamera2D)
                {
                    mulFactor = 0.5f;
                }
                banner.ScaleX   = banner.ScaleY = Math.Min(2.75f, (mulFactor / screenCtr.W));
                banner.Position = new Vector2(screenCtr.X, screenCtr.Y);
                banner.Opacity  = f;
                banner.Z        = -screenCtr.Z;
                toDraw.Add(banner);
            }
        }
Example #28
0
        public void LinkMembers(UIContainer target, bool addUIElements)
        {
            var fields = target.GetType().GetProperties();

            foreach (var field in fields)
            {
                if (NamedObjects.ContainsKey(field.Name))
                {
                    var value = NamedObjects[field.Name];
                    field.SetValue(target, value, new object[] {});

                    if (value is UIElement && addUIElements)
                    {
                        var uiValue = (UIElement)value;
                        if (uiValue.Parent != null)
                        {
                            uiValue.Parent.Remove(uiValue);
                        }
                        target.Add(uiValue);
                    }
                }
            }
        }
Example #29
0
        void UpdateZoneChanges()
        {
            bool didAnything = zoneChanges.Count > 0;

            for (int Idx = 0; Idx < zoneChanges.Count; ++Idx)
            {
                KeyValuePair <ConvergeObject, ConvergeZone> kv = zoneChanges[Idx];
                ConvergeObject obj     = kv.Key;
                ConvergeZone   newZone = kv.Value;
                ConvergeZone   oldZone = obj.zone;

                if (newZone.zoneId == ConvergeZoneId.DiscardPile && TriggerSystem.HasTriggers(ConvergeTriggerType.Discarded))
                {
                    TriggerSystem.CheckTriggers(ConvergeTriggerType.Discarded, new TriggerData(newZone.owner, null, obj, 0));
                }

                newZone.Add(obj);

                if (newZone.inPlay && (oldZone == null || !oldZone.inPlay) && TriggerSystem.HasTriggers(ConvergeTriggerType.EnterPlay))
                {
                    TriggerSystem.CheckTriggers(ConvergeTriggerType.EnterPlay, new TriggerData(newZone.owner, obj, null, 0));
                }

                if (obj.ui == null && !newZone.isHidden && obj.zone == newZone)
                {
                    obj.ui = new ConvergeUIObject(obj);
                    ui.Add(obj.ui);
                }
                else if (obj.ui != null && newZone.isHidden && obj.zone == newZone)
                {
                    ui.Remove(obj.ui);
                    obj.ui = null;
                }
            }
            zoneChanges.Clear();
        }
Example #30
0
    private static void InitializeNewObject(Transform parent, int siblingIndex, UIContainer container, UIObject obj, UIDir dir)
    {
        GameObject item = obj.gameObject;

        item.SetActive(true);
        item.transform.SetParent(parent);
        item.transform.SetSiblingIndex(siblingIndex);
        item.transform.localScale = new Vector3(1, 1, 1);

        //UT.print("Init. size: " + obj.GetWidth() + ", " + obj.GetHeight());

        container.Add(obj, dir);         // add new item after previous to 'dir' direction.

        if (container.anchor == UIAlign.CENTER)
        {
            Vector2 offset = new Vector2(-container.GetWidth() / 2f, container.GetHeight() / 2f);
            container.SetScreenPosition(getScreenPosition(0, 0) + offset);
        }
        else if (container.anchor == UIAlign.TOP_LEFT)
        {
            container.SetScreenPosition(getScreenPosition(-.5f, .5f));
        }
        else if (container.anchor == UIAlign.LEFT)
        {
            container.SetScreenPosition(getScreenPosition(-.5f, 0f));
        }
        else if (container.anchor == UIAlign.BOTTOM_LEFT)
        {
            Vector2 offset = new Vector2(0f, container.GetHeight());
            container.SetScreenPosition(getScreenPosition(-.5f, -.5f) + offset);
        }
        else
        {
            UT.trap("AMenu.InitializeButton: invalid orientation.");
        }
    }
Example #31
0
        void InitPipes()
        {
            numCores = DEFAULT_NUM_CORES;
            ui       = new UIContainer(bounds.XY);
            ui.Add(new UIButton("Record", TextureCache.record_icon, new Rectangle(((int)bounds.Width - 90) / 2, (int)bounds.Height + 5, 90, 35), Game1.buttonStyle, button_Play));

            leftSocket = new PipeSocket(this, new Vector2(14, 14), 1);

            if (canDrag)
            {
                rightSocket = new PipeSocket(this, new Vector2(32, 14), 1);
            }

            if (isBigFactory)
            {
                AddOutputPipe(new Vector2(-6, 36));
                AddOutputPipe(new Vector2(53, 36));
            }
            else
            {
                AddOutputPipe(new Vector2(15, 39));
            }
            //unlimitedPipes = canDrag;
        }