public PersonSelectionController(PersonSelection view, LoginRegulator regulator, IShardsDomain shards, ICache cache)
 {
     Shards    = shards;
     View      = view;
     Regulator = regulator;
     Cache     = cache;
 }
Exemple #2
0
 public Network(LoginRegulator loginReg, CityConnectionRegulator cityReg, LotConnectionRegulator lotReg, IShardsDomain shards)
 {
     this.Shards         = shards;
     this.CityRegulator  = cityReg;
     this.LoginRegulator = loginReg;
     this.LotRegulator   = lotReg;
 }
Exemple #3
0
        public DisconnectController(TransitionScreen view, CityConnectionRegulator cityRegulator, LotConnectionRegulator lotRegulator, LoginRegulator logRegulator, Network.Network network)
        {
            View = view;
            View.ShowProgress = false;

            CityConnectionRegulator = cityRegulator;
            CityConnectionRegulator.OnTransition += CityConnectionRegulator_OnTransition;
            LotConnectionRegulator       = lotRegulator;
            LoginRegulator               = logRegulator;
            LoginRegulator.OnError      += LoginRegulator_OnError;
            LoginRegulator.OnTransition += LoginRegulator_OnTransition;
        }
        public LoginScreen(LoginRegulator regulator)
        {
            try
            {
                if (File.Exists("update2.exe"))
                {
                    File.Delete("update.exe");
                    File.Move("update2.exe", "update.exe");
                }
            } catch (Exception) {
                //maybe signal to user that the updater update failed
            }

            this.Regulator = regulator;
            regulator.Logout();

            HITVM.Get().PlaySoundEvent(UIMusic.None);
            GlobalSettings.Default.Save();

            if (Content.Content.Get().TS1)
            {
                //load the sandbox screen in neighbourhood view mode
                GameThread.NextUpdate(x =>
                {
                    FSOFacade.Controller.EnterSandboxMode("", false);
                });
            }

            Background = new UISetupBackground();

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

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

            /** 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(Login);
            LoginDialog.Opacity = 0.9f;
            //Center
            LoginDialog.X = (ScreenWidth - LoginDialog.Width) / 2;
            LoginDialog.Y = (ScreenHeight - LoginDialog.Height) / 2;
            this.Add(LoginDialog);

            bool usernamePopulated = false;

            var loginIniFile = GameFacade.GameFilePath("login.ini");

            if (File.Exists(loginIniFile))
            {
                var iniFile = IniFile.Read(loginIniFile);
                if (iniFile.ContainsKey("LastSession"))
                {
                    LoginDialog.Username = iniFile["LastSession"]["UserName"];
                    usernamePopulated    = true;
                }
            }

            if (!FSOEnvironment.SoftwareKeyboard)
            {
                if (usernamePopulated)
                {
                    LoginDialog.FocusPassword();
                }
                else
                {
                    LoginDialog.FocusUsername();
                }
            }

            var gameplayButton = new UIButton()
            {
                Caption = "Sandbox Mode",
                Y       = 10,
                Width   = 125,
                X       = 10
            };

            this.Add(gameplayButton);
            gameplayButton.OnButtonClick += new ButtonClickDelegate(gameplayButton_OnButtonClick);

            Regulator.OnError      += AuthRegulator_OnError;
            Regulator.OnTransition += AuthRegulator_OnTransition;

            var compat = GlobalSettings.Default.CompatState;

            if (compat != -1 && compat < GlobalSettings.TARGET_COMPAT_STATE)
            {
                GameThread.NextUpdate(x =>
                {
                    GlobalShowAlert(new UIAlertOptions()
                    {
                        Message = GameFacade.Strings.GetString("f105", "2")
                    }, true);
                    var settings                = GlobalSettings.Default;
                    settings.CompatState        = 0;
                    settings.LightingMode       = 0;
                    settings.SurroundingLotMode = 0;
                    settings.CityShadows        = false;
                    settings.AntiAlias          = 0;
                    settings.Save();

                    LotView.WorldConfig.Current = new LotView.WorldConfig()
                    {
                        LightingMode    = settings.LightingMode,
                        SmoothZoom      = settings.SmoothZoom,
                        SurroundingLots = settings.SurroundingLotMode,
                        AA                = settings.AntiAlias,
                        Weather           = settings.Weather,
                        Directional       = settings.DirectionalLight3D,
                        Complex           = settings.ComplexShaders,
                        EnableTransitions = settings.EnableTransitions
                    };
                });
            }
            GameThread.NextUpdate(x =>
            {
                FSOFacade.Hints.TriggerHint("screen:login");

                //UIScreen.GlobalShowDialog(new Panels.Neighborhoods.UIBulletinDialog(), false);
                //Content.Content.Get().UIGraphics.ExportAll(GameFacade.GraphicsDevice);
            });
        }
Exemple #5
0
 public LoginController(LoginScreen view, LoginRegulator reg)
 {
     View      = view;
     Regulator = reg;
     Regulator.OnTransition += Regulator_OnTransition;
 }
Exemple #6
0
        public PersonSelection(LoginRegulator loginRegulator, ICache cache) : base()
        {
            //Arrange UI
            this.LoginRegulator = loginRegulator;
            this.Cache          = cache;
            Api = new ApiClient(ApiClient.CDNUrl ?? GlobalSettings.Default.GameEntryUrl);

            UIScript ui = null;

            ui = this.RenderScript("personselection1024.uis");

            Position = new Vector2((GlobalSettings.Default.GraphicsWidth - 1024) / 2, (GlobalSettings.Default.GraphicsHeight - 768) / 2) * FSOEnvironment.DPIScaleFactor;

            m_ExitButton = (UIButton)ui["ExitButton"];

            var numSlots = 3;

            m_PersonSlots = new List <PersonSlot>();

            FamilyButton.Visible   = false;
            CreditsButton.Disabled = true;

            for (var i = 0; i < numSlots; i++)
            {
                var index = (i + 1).ToString();

                /** Tab Background **/
                var tabBackground = ui.Create <UIImage>("TabBackgroundImage" + index);
                this.Add(tabBackground);

                var enterTabImage = ui.Create <UIImage>("EnterTabImage" + index);
                this.Add(enterTabImage);

                var descTabImage = ui.Create <UIImage>("DescriptionTabImage" + index);
                this.Add(descTabImage);

                var descTabBgImage = ui.Create <UIImage>("DescriptionTabBackgroundImage" + index);
                var enterIcons     = ui.Create <UIImage>("EnterTabBackgroundImage" + index);

                var personSlot = new PersonSlot(this)
                {
                    AvatarButton       = (UIButton)ui["AvatarButton" + index],
                    CityButton         = (UIButton)ui["CityButton" + index],
                    HouseButton        = (UIButton)ui["HouseButton" + index],
                    EnterTabButton     = (UIButton)ui["EnterTabButton" + index],
                    DescTabButton      = (UIButton)ui["DescriptionTabButton" + index],
                    NewAvatarButton    = (UIButton)ui["NewAvatarButton" + index],
                    DeleteAvatarButton = (UIButton)ui["DeleteAvatarButton" + index],
                    PersonNameText     = (UILabel)ui["PersonNameText" + index],
                    PersonDescriptionScrollUpButton   = (UIButton)ui["PersonDescriptionScrollUpButton" + index],
                    PersonDescriptionScrollDownButton = (UIButton)ui["PersonDescriptionScrollDownButton" + index],
                    PersonDescriptionSlider           = (UISlider)ui["PersonDescriptionSlider" + index],
                    CityNameText                  = (UILabel)ui["CityNameText" + index],
                    HouseNameText                 = (UILabel)ui["HouseNameText" + index],
                    PersonDescriptionText         = (UITextEdit)ui["PersonDescriptionText" + index],
                    DescriptionTabBackgroundImage = descTabBgImage,
                    EnterTabBackgroundImage       = enterIcons,

                    TabBackground      = tabBackground,
                    TabEnterBackground = enterTabImage,
                    TabDescBackground  = descTabImage
                };

                this.AddBefore(descTabBgImage, personSlot.PersonDescriptionText);
                this.AddBefore(enterIcons, personSlot.CityButton);

                personSlot.Init();
                personSlot.SetSlotAvailable(true);
                m_PersonSlots.Add(personSlot);

                if (i < loginRegulator.Avatars.Count)
                {
                    var avatar = loginRegulator.Avatars[i];
                    personSlot.DisplayAvatar(avatar);
                }
            }

            /** Backgrounds **/
            var bg = new UIImage(BackgroundImage).With9Slice(128, 128, 84, 84);

            this.AddAt(0, bg);
            bg.SetSize(GlobalSettings.Default.GraphicsWidth, GlobalSettings.Default.GraphicsHeight);
            bg.Position = new Vector2((GlobalSettings.Default.GraphicsWidth - 1024) / -2, (GlobalSettings.Default.GraphicsHeight - 768) / -2);
            Background  = bg;

            if (BackgroundImageDialog != null)
            {
                this.AddAt(1, new UIImage(BackgroundImageDialog)
                {
                    X = 112,
                    Y = 84
                });
            }

            /**
             * Button plumbing
             */
            CreditsButton.OnButtonClick += new ButtonClickDelegate(CreditsButton_OnButtonClick);
            m_ExitButton.OnButtonClick  += new ButtonClickDelegate(m_ExitButton_OnButtonClick);

            /**
             * Music
             */

            HITVM.Get().PlaySoundEvent(UIMusic.SAS);

            GameThread.NextUpdate(x =>
            {
                FSOFacade.Hints.TriggerHint("screen:sas");
            });
        }