Ejemplo n.º 1
0
        public UITransDialog(string transType, Action transAction)
        {
            var ui = Content.Get().CustomUI;

            TransImage  = ui.Get($"trans_{transType}.png").Get(GameFacade.GraphicsDevice);
            TransAction = transAction;

            Diag = new UIDiagonalStripe(new Point(0, 0), UIDiagonalStripeSide.RIGHT, UIStyle.Current.TransColor);
            Add(Diag);
            UIScreen.GlobalShowDialog(this, true);
            GameFacade.Screens.Tween.To(this, 0.2f, new Dictionary <string, float>()
            {
                { "TransPct", 1f }
            });

            TransPct = TransPct;
        }
Ejemplo n.º 2
0
        public LoadingScreen()
        {
            Content.InitBasic(GlobalSettings.Default.StartupPath, GameFacade.GraphicsDevice);

            Bg          = new UISimitoneBg();
            Bg.Position = (new Vector2(ScreenWidth, ScreenHeight)) / 2;
            Add(Bg);

            ProgressDiag          = new UIDiagonalStripe(new Point(0, 150), UIDiagonalStripeSide.RIGHT, Color.Black * 0.75f);
            ProgressDiag.Position = new Vector2(0, ScreenHeight / 2 - 75);
            Add(ProgressDiag);

            TextDiag          = new UIDiagonalStripe(new Point(0, 150), UIDiagonalStripeSide.LEFT, Color.Black * 0.5f);
            TextDiag.Position = new Vector2(0, ScreenHeight * 0.75f - 37);
            Add(TextDiag);

            GameFacade.Screens.Tween.To(this, 0.5f, new Dictionary <string, float>()
            {
                { "InterpolatedAnimation", 1f }
            }, TweenQuad.EaseOut);

            LoadProgress          = new UILoadProgress();
            LoadProgress.Position = (new Vector2(ScreenWidth, ScreenHeight) - new Vector2(1012, 128)) / 2;
            Add(LoadProgress);

            Logo          = new UISimitoneLogo();
            Logo.Position = new Vector2(ScreenWidth, ScreenHeight) / 2;
            Add(Logo);
            LogoTween = GameFacade.Screens.Tween.To(Logo, 1f, new Dictionary <string, float>()
            {
                { "Y", ScreenHeight / 4 }, { "ScaleX", 0.5f }, { "ScaleY", 0.5f }
            }, TweenQuad.EaseOut);

            InterpolatedAnimation = InterpolatedAnimation;

            (new Thread(() => {
                VMContext.InitVMConfig(true);
                FSO.Content.Content.Init(GlobalSettings.Default.StartupPath, GameFacade.GraphicsDevice);
                lock (this)
                {
                    LoadingComplete = true;
                }
            })).Start();
        }
Ejemplo n.º 3
0
        public UIFamilyCASPanel(List <VMAvatar> avatar)
        {
            Avatars = avatar;

            AvatarOptions = new UICategorySwitcher();
            AvatarOptions.InitCategories(AvatarCategories);
            AvatarOptions.MainButton.Visible = false;
            AvatarOptions.OnCategorySelect  += AvatarOptions_OnCategorySelect;
            Add(AvatarOptions);

            NameStripe          = new UIDiagonalStripe(new Point(0, 75), UIDiagonalStripeSide.LEFT, UIStyle.Current.Bg);
            NameStripe.Position = new Vector2(UIScreen.Current.ScreenWidth, 30);
            Add(NameStripe);

            SecondName            = new UITextBox();
            SecondName.TextMargin = new Rectangle();
            SecondName.SetSize(UIScreen.Current.ScreenWidth, 60);
            SecondName.Alignment       = TextAlignment.Center;
            SecondName.TextStyle       = SecondName.TextStyle.Clone();
            SecondName.TextStyle.Size  = 37;
            SecondName.TextStyle.Color = UIStyle.Current.SecondaryText;
            SecondName.Position        = new Vector2(0, 40);
            Add(SecondName);

            ListStripe          = new UIDiagonalStripe(new Point(0, 125), UIDiagonalStripeSide.RIGHT, UIStyle.Current.Bg);
            ListStripe.Position = new Vector2(0, UIScreen.Current.ScreenHeight - 145);
            Add(ListStripe);

            AvatarList              = new UIAvatarListPanel(avatar);
            AvatarList.Y            = UIScreen.Current.ScreenHeight - 145;
            AvatarList.OnSelection += AvatarList_OnSelection;
            Add(AvatarList);

            Reset();
            ShowI = ShowI;
        }
Ejemplo n.º 4
0
        public UIMainPanel(TS1GameScreen game) : base()
        {
            Game = game;
            Diag = new UIDiagonalStripe(new Point(0, 128), UIDiagonalStripeSide.RIGHT, UIStyle.Current.Bg);
            Add(Diag);
            WhitePx = TextureGenerator.GetPxWhite(GameFacade.GraphicsDevice);
            var ui = Content.Get().CustomUI;

            Div = ui.Get("panel_div.png").Get(GameFacade.GraphicsDevice);

            FloorUpBtn                = new UIStencilButton(ui.Get("level_up.png").Get(GameFacade.GraphicsDevice));
            FloorUpBtn.Position       = new Vector2(80, 10);
            FloorUpBtn.OnButtonClick += (b) => { if (Game.Level < 5)
                                                 {
                                                     Game.Level++;
                                                 }
            };
            Add(FloorUpBtn);

            FloorDownBtn                = new UIStencilButton(ui.Get("level_down.png").Get(GameFacade.GraphicsDevice));
            FloorDownBtn.Position       = new Vector2(80, 68);
            FloorDownBtn.OnButtonClick += (b) => { if (Game.Level > 1)
                                                   {
                                                       Game.Level--;
                                                   }
            };
            Add(FloorDownBtn);

            FloorLabel = new UILabel();
            FloorLabel.CaptionStyle       = FloorLabel.CaptionStyle.Clone();
            FloorLabel.CaptionStyle.Size  = 15;
            FloorLabel.CaptionStyle.Color = UIStyle.Current.Text;
            FloorLabel.Alignment          = TextAlignment.Middle | TextAlignment.Center;
            FloorLabel.Position           = new Vector2(80, 64);
            FloorLabel.Size = new Vector2(51, 18);

            FloorLabelShadow = new UILabel();
            FloorLabelShadow.CaptionStyle       = FloorLabel.CaptionStyle.Clone();
            FloorLabelShadow.Alignment          = TextAlignment.Middle | TextAlignment.Center;
            FloorLabelShadow.Position           = new Vector2(83, 67);
            FloorLabelShadow.Size               = new Vector2(51, 18);
            FloorLabelShadow.CaptionStyle.Color = Color.Black * 0.5f;
            Add(FloorLabelShadow);
            Add(FloorLabel);

            HideButton                = new UIStencilButton(ui.Get("panel_hide.png").Get(GameFacade.GraphicsDevice));
            HideButton.X              = Game.ScreenWidth - (50 + 64 + 15);
            HideButton.Y              = 26;
            HideButton.OnButtonClick += (b) => { Close(); };
            Add(HideButton);

            Divider          = new UIImage(ui.Get("divider.png").Get(GameFacade.GraphicsDevice));
            Divider.Position = new Vector2(146, 29);
            Add(Divider);

            Switcher          = new UICategorySwitcher();
            Switcher.Position = new Vector2(164, 0);
            Switcher.InitCategories(LiveCategories);
            Switcher.OnCategorySelect += Switcher_OnCategorySelect;
            Switcher.OnOpen           += Switcher_OnOpen;
            Add(Switcher);

            foreach (var fade in GetFadeables())
            {
                fade.Opacity = 0;
            }

            Game.LotControl.QueryPanel.Position = new Vector2(53, -5);
            Add(Game.LotControl.QueryPanel);
            Game.LotControl.PickupPanel.Opacity = 0;
            Add(Game.LotControl.PickupPanel);

            CurWidth = 0;
        }
        public UIHouseSelectPanel(int houseID)
        {
            var screen = GameFacade.Screens.CurrentUIScreen;
            var extra  = Math.Max(0, (screen.ScreenHeight - 640) / 128) * 64;

            HouseID = houseID;

            Diag   = new UIDiagonalStripe(new Point(screen.ScreenWidth / 2, screen.ScreenHeight + 16), UIDiagonalStripeSide.RIGHT, UIStyle.Current.Bg);
            Diag.Y = -16;
            Diag.ListenForMouse(Diag.GetBounds(), (e, s) => { });
            Add(Diag);

            TitleStripe          = new UIDiagonalStripe(new Point(screen.ScreenWidth / 2, 92 + 8 + 32), UIDiagonalStripeSide.RIGHT, UIStyle.Current.Bg);
            TitleStripe.StartOff = 8 + 32;
            TitleStripe.Y        = -16 + extra;
            Add(TitleStripe);

            var neigh = Content.Get().Neighborhood;

            var house = neigh.GetHouse(houseID);

            var street     = neigh.StreetNames;
            var assignment = street.Get <STR>(2001).GetString(houseID - 1);

            int streetName;

            if (int.TryParse(assignment, out streetName))
            {
                StreetTitle          = new UILabel();
                StreetTitle.Position = new Vector2(30, 94 + extra - 64);
                InitLabel(StreetTitle);
                StreetTitle.CaptionStyle.Color = UIStyle.Current.BtnActive;
                StreetTitle.Caption            = street.Get <STR>(2000).GetString(streetName - 1).Replace("%s", houseID.ToString());
            }

            var nameDesc = neigh.GetHouseNameDesc(houseID);
            var name     = nameDesc.Item1;

            if (name == "")
            {
                name = StreetTitle.Caption;
            }

            LotTitle          = new UILabel();
            LotTitle.Position = new Vector2(30, 122 + extra - 64);
            InitLabel(LotTitle);
            LotTitle.CaptionStyle.Size = 37;
            LotTitle.Caption           = name;

            var family = neigh.GetFamilyForHouse((short)houseID);

            LotDescription          = new UILabel();
            LotDescription.Position = new Vector2(30, 206 + extra);
            InitLabel(LotDescription);
            //LotDescription.CaptionStyle.Size = 15;
            LotDescription.Size      = new Vector2(screen.ScreenWidth / 2 - 60, screen.ScreenHeight - 415);
            LotDescription.Wrapped   = true;
            LotDescription.Alignment = TextAlignment.Top | TextAlignment.Left;

            SecondaryText          = new UILabel();
            SecondaryText.Position = new Vector2(30, screen.ScreenHeight - (165 + extra));
            InitLabel(SecondaryText);
            SecondaryText.Size               = new Vector2(screen.ScreenWidth / 2 - 60, 29);
            SecondaryText.Wrapped            = true;
            SecondaryText.Alignment          = TextAlignment.Bottom | TextAlignment.Right;
            SecondaryText.CaptionStyle.Color = UIStyle.Current.SecondaryText;

            var moveInID    = (UIScreen.Current as Screens.TS1GameScreen).MoveInFamily;
            var moveIn      = (moveInID == null) ? null : Content.Get().Neighborhood.GetFamily((ushort)moveInID.Value);
            var buttonValid = true;

            if (family != null)
            {
                var famUI = new UIHouseFamilyList(family);

                var scale = Math.Max(2 / 3f, Math.Min(1, screen.ScreenWidth / 1704f));
                famUI.ScaleX = famUI.ScaleY = scale;
                var space = (96 * scale) - 56;
                LotDescription.Y += space;
                famUI.Position    = new Vector2(48 + space / 2, 152 + extra + space / 2);
                Add(famUI);
                FamilyDisplay = famUI;

                LotDescription.Caption = GameFacade.Strings.GetString("134", "0", new string[] {
                    Content.Get().Neighborhood.MainResource.Get <FAMs>(family.ChunkID)?.GetString(0) ?? "?",
                    "§" + (family.ValueInArch + family.Budget).ToString("##,#0"), //should include lot value eventually
                    family.FamilyFriends.ToString()
                });

                LotDescription.CaptionStyle.Color = UIStyle.Current.SecondaryText;

                if (moveIn != null)
                {
                    SecondaryText.Caption = GameFacade.Strings.GetString("132", "15"); //house occupied
                    buttonValid           = false;
                }
            }
            else
            {
                LotDescription.Y   -= 64;
                LotDescription.Size = new Vector2(LotDescription.Size.X, LotDescription.Size.Y + 65);
                //LotDescription.Caption = new string(Enumerable.Range(1, 255).Select(x => 'a').ToArray());
                LotDescription.Caption = nameDesc.Item2;

                //set up the secondary text
                var   zones  = neigh.ZoningDictionary;
                short result = 1;
                if (!zones.TryGetValue((short)houseID, out result))
                {
                    result = (short)((houseID >= 81 && houseID <= 89) ? 2 : 1);
                }

                if (result > 0)
                {
                    //zone
                    string str;
                    if (moveIn != null)
                    {
                        str         = GameFacade.Strings.GetString("134", "18").Substring(8); //is community, can't move in
                        buttonValid = false;
                    }
                    else
                    {
                        str = GameFacade.Strings.GetString("134", "17").Substring(8); //is community
                    }
                    SecondaryText.Caption = str;
                }
                else
                {
                    //show price
                    var    price = house.Get <SIMI>(1)?.PurchaseValue ?? 0;
                    string str;
                    if (houseID >= 90 && houseID <= 92)
                    {
                        //also requires magicoins
                        var magicoins  = neigh.GetMagicoinsForFamily(family);
                        var requiredMC = int.Parse(GameFacade.Strings.GetString("134", (32 + Math.Abs(91 - houseID)).ToString()));

                        if (moveIn != null)
                        {
                            if (magicoins >= requiredMC)
                            {
                                if (moveIn.Budget >= price)
                                {
                                    str = GameFacade.Strings.GetString("134", "31", new string[] { "", "",
                                                                                                   "§" + price.ToString("##,#0"),
                                                                                                   requiredMC.ToString() });
                                }
                                else
                                {
                                    //missing simoleons
                                    str = GameFacade.Strings.GetString("134", "38", new string[] { "", "",
                                                                                                   "§" + price.ToString("##,#0"),
                                                                                                   requiredMC.ToString(),
                                                                                                   moveIn.ChunkParent.Get <FAMs>(moveIn.ChunkID)?.GetString(0) ?? "",
                                                                                                   "§" + moveIn.Budget.ToString("##,#0") }).Substring(4);
                                    buttonValid = false;
                                }
                            }
                            else
                            {
                                if (moveIn.Budget >= price)
                                {
                                    //missing magicoins
                                    str = GameFacade.Strings.GetString("134", "36", new string[] { "", "",
                                                                                                   "§" + price.ToString("##,#0"),
                                                                                                   requiredMC.ToString(),
                                                                                                   moveIn.ChunkParent.Get <FAMs>(moveIn.ChunkID)?.GetString(0) ?? "",
                                                                                                   magicoins.ToString() }).Substring(4);
                                }
                                else
                                {
                                    //missing both
                                    str = GameFacade.Strings.GetString("134", "37", new string[] { "", "",
                                                                                                   "§" + price.ToString("##,#0"),
                                                                                                   requiredMC.ToString(),
                                                                                                   moveIn.ChunkParent.Get <FAMs>(moveIn.ChunkID)?.GetString(0) ?? "",
                                                                                                   magicoins.ToString() }).Substring(4);
                                    buttonValid = false;
                                }
                                buttonValid = false;
                            }
                        }
                        else
                        {
                            //suggest move in
                            str = GameFacade.Strings.GetString("134", "29", new string[] { "", "",
                                                                                           "§" + price.ToString("##,#0"),
                                                                                           requiredMC.ToString() }).Substring(4);
                        }
                    }
                    else
                    {
                        if (moveIn != null)
                        {
                            if (moveIn.Budget >= price)
                            {
                                str = GameFacade.Strings.GetString("134", "5", new string[] { "", "",
                                                                                              "§" + price.ToString("##,#0"),
                                                                                              "§" + (moveIn.Budget - price).ToString("##,#0") }).Substring(4);
                            }
                            else
                            {
                                str = GameFacade.Strings.GetString("134", "4", new string[] { "", "",
                                                                                              "§" + price.ToString("##,#0"),
                                                                                              moveIn.ChunkParent.Get <FAMs>(moveIn.ChunkID)?.GetString(0) ?? "",
                                                                                              "§" + moveIn.Budget.ToString("##,#0") }).Substring(4);
                                buttonValid = false;
                            }
                        }
                        else
                        {
                            //suggest move in
                            str = GameFacade.Strings.GetString("134", "1", new string[] { "", "", "§" + price.ToString("##,#0") }).Substring(4);
                        }
                    }

                    SecondaryText.Caption           = str;
                    SecondaryText.CaptionStyle.Size = 15;
                }
            }

            EnterLot                = new UIBigButton(false);
            EnterLot.Caption        = (moveIn == null)?"Enter Lot":"Move In";
            EnterLot.Width          = (moveIn == null)? (screen.ScreenWidth / 2 - 293) : (screen.ScreenWidth / 2 - 60);
            EnterLot.Disabled       = !buttonValid;
            EnterLot.Position       = new Vector2(30, screen.ScreenHeight - (extra + 125));
            EnterLot.OnButtonClick += (b) => { OnSelected?.Invoke(houseID); Kill(); };
            Add(EnterLot);

            More                = new UIBigButton(true);
            More.Caption        = "More";
            More.Width          = 208;
            More.Position       = new Vector2(screen.ScreenWidth / 2 - 238, screen.ScreenHeight - (extra + 125));
            More.OnButtonClick += (btn) => { ShowMore(true); };
            if (moveIn == null)
            {
                Add(More);
            }

            var optionFunctions = new ButtonClickDelegate[]
            {
                (family == null)?null:(ButtonClickDelegate)((btn) => Evict(family)),
                null,
                null,
                (btn) => ShowMore(false)
            };
            var optionNames = new string[]
            {
                (family == null)?"Bulldoze":"Evict",
                "Rezone",
                "Export",
                "Back"
            };

            var bY = extra + 140;

            for (int i = 0; i < optionFunctions.Length; i++)
            {
                var btn = new UIBigButton(i == optionFunctions.Length - 1);
                btn.Caption        = optionNames[i];
                btn.Position       = new Vector2(screen.ScreenWidth / 4 - btn.Width / 2, bY);
                btn.Disabled       = optionFunctions[i] == null;
                btn.OnButtonClick += optionFunctions[i];
                Add(btn);
                bY += 120;
                OptionButtons.Add(btn);
            }

            X = screen.ScreenWidth / -2;
            GameFacade.Screens.Tween.To(this, 0.5f, new Dictionary <string, float>()
            {
                { "X", 0f }
            }, TweenQuad.EaseOut);
            MoreTween = MoreTween;
        }
Ejemplo n.º 6
0
        public UIHouseSelectPanel(int houseID)
        {
            HouseID = houseID;
            var screen = GameFacade.Screens.CurrentUIScreen;

            Diag   = new UIDiagonalStripe(new Point(screen.ScreenWidth / 2, screen.ScreenHeight + 16), UIDiagonalStripeSide.RIGHT, UIStyle.Current.Bg);
            Diag.Y = -16;
            Diag.ListenForMouse(Diag.GetBounds(), (e, s) => { });
            Add(Diag);

            TitleStripe          = new UIDiagonalStripe(new Point(screen.ScreenWidth / 2, 92 + 8 + 32), UIDiagonalStripeSide.RIGHT, UIStyle.Current.Bg);
            TitleStripe.StartOff = 8 + 32;
            TitleStripe.Y        = 82 - 34;
            Add(TitleStripe);

            var house = Content.Get().Neighborhood.GetHouse(houseID);

            var street     = Content.Get().Neighborhood.StreetNames;
            var assignment = street.Get <STR>(2001).GetString(houseID - 1);

            int streetName;

            if (int.TryParse(assignment, out streetName))
            {
                StreetTitle          = new UILabel();
                StreetTitle.Position = new Vector2(30, 94);
                InitLabel(StreetTitle);
                StreetTitle.CaptionStyle.Color = UIStyle.Current.BtnActive;
                StreetTitle.Caption            = street.Get <STR>(2000).GetString(streetName - 1).Replace("%s", houseID.ToString());
            }

            var nameDesc = Content.Get().Neighborhood.GetHouseNameDesc(houseID);
            var name     = nameDesc.Item1;

            if (name == "")
            {
                name = "Unnamed House";
            }

            LotTitle          = new UILabel();
            LotTitle.Position = new Vector2(30, 122);
            InitLabel(LotTitle);
            LotTitle.CaptionStyle.Size = 37;
            LotTitle.Caption           = name;

            LotDescription          = new UILabel();
            LotDescription.Position = new Vector2(30, 206);
            InitLabel(LotDescription);
            //LotDescription.CaptionStyle.Size = 15;
            LotDescription.Size      = new Vector2(502, screen.ScreenHeight - 415);
            LotDescription.Wrapped   = true;
            LotDescription.Alignment = TextAlignment.Top | TextAlignment.Left;
            LotDescription.Caption   = nameDesc.Item2;

            EnterLot                = new UIBigButton(false);
            EnterLot.Caption        = "Enter Lot";
            EnterLot.Width          = 275;
            EnterLot.Position       = new Vector2(30, screen.ScreenHeight - 160);
            EnterLot.OnButtonClick += (b) => { OnSelected?.Invoke(houseID); Kill(); };
            Add(EnterLot);

            More          = new UIBigButton(true);
            More.Caption  = "More";
            More.Width    = 192;
            More.Position = new Vector2(330, screen.ScreenHeight - 160);
            Add(More);

            X = screen.ScreenWidth / -2;
            GameFacade.Screens.Tween.To(this, 0.5f, new Dictionary <string, float>()
            {
                { "X", 0f }
            }, TweenQuad.EaseOut);
        }