Beispiel #1
0
        /// <summary>
        /// Sends a CharacterCreate packet to a CityServer.
        /// </summary>
        /// <param name="LoginArgs">Arguments used to log onto the CityServer.</param>
        /// <param name="Character">The character to create on the CityServer.</param>
        public static void SendCharacterCreateCity(NetworkClient Client, UISim Character)
        {
            PacketStream Packet = new PacketStream((byte)PacketType.CHARACTER_CREATE_CITY, 0);

            MemoryStream PacketData = new MemoryStream();
            BinaryWriter Writer     = new BinaryWriter(PacketData);

            Writer.Write((byte)Client.ClientEncryptor.Username.Length);
            Writer.Write(Encoding.ASCII.GetBytes(Client.ClientEncryptor.Username), 0,
                         Encoding.ASCII.GetBytes(Client.ClientEncryptor.Username).Length);

            Writer.Write(PlayerAccount.CityToken);
            Writer.Write(Character.Timestamp);
            Writer.Write(Character.Name);
            Writer.Write(Character.Sex);
            Writer.Write(Character.Description);
            Writer.Write((ulong)Character.HeadOutfitID);
            Writer.Write((ulong)Character.BodyOutfitID);
            Writer.Write((byte)Character.Avatar.Appearance);

            Packet.WriteBytes(PacketData.ToArray());
            Writer.Close();

            Client.SendEncrypted((byte)PacketType.CHARACTER_CREATE_CITY, Packet.ToArray());
        }
        /// <summary>
        /// Sends a CharacterCreate packet to a CityServer.
        /// </summary>
        /// <param name="LoginArgs">Arguments used to log onto the CityServer.</param>
        /// <param name="Character">The character to create on the CityServer.</param>
        public static void SendCharacterCreateCity(LoginArgsContainer LoginArgs, UISim Character)
        {
            PacketStream Packet = new PacketStream((byte)PacketType.CHARACTER_CREATE_CITY, 0);

            Packet.WriteHeader();

            MemoryStream PacketData = new MemoryStream();
            BinaryWriter Writer     = new BinaryWriter(PacketData);

            Writer.Write((byte)LoginArgs.Username.Length);
            Writer.Write(Encoding.ASCII.GetBytes(LoginArgs.Username), 0, Encoding.ASCII.GetBytes(LoginArgs.Username).Length);

            //LoginArgs password is set to PlayerAccount.Hash for relogging to the cityserver.
            byte[] HashBuf = Convert.FromBase64String(LoginArgs.Password);
            Writer.Write((byte)HashBuf.Length);
            Writer.Write(HashBuf, 0, HashBuf.Length);

            Writer.Write(PlayerAccount.CityToken);
            Writer.Write(Character.Timestamp);
            Writer.Write(Character.Name);
            Writer.Write(Character.Sex);
            Writer.Write(Character.Description);
            Writer.Write((ulong)Character.HeadOutfitID);
            Writer.Write((ulong)Character.BodyOutfitID);
            Writer.Write((byte)Character.Avatar.Appearance);

            Packet.WriteUInt16((ushort)((ushort)PacketHeaders.UNENCRYPTED + PacketData.Length));
            Packet.WriteBytes(PacketData.ToArray());
            Writer.Close();

            LoginArgs.Client.Send(Packet.ToArray());
        }
Beispiel #3
0
        public UISim SelectCharacter(string file)
        {
            UISim sim;

            XmlCharacter charInfo;

            AppearanceType type;

            charInfo = XmlCharacter.Parse(file);

            Enum.TryParse(charInfo.Appearance, out type);

            var    headPurchasable = Content.Content.Get().AvatarPurchasables.Get(Convert.ToUInt64(charInfo.Head, 16));
            var    bodyPurchasable = Content.Content.Get().AvatarPurchasables.Get(Convert.ToUInt64(charInfo.Body, 16));
            Outfit HeadOutfit      = Content.Content.Get().AvatarOutfits.Get(headPurchasable != null ? headPurchasable.OutfitID :
                                                                             Convert.ToUInt64(charInfo.Head, 16));
            Outfit BodyOutfit = Content.Content.Get().AvatarOutfits.Get(bodyPurchasable != null ? bodyPurchasable.OutfitID :
                                                                        Convert.ToUInt64(charInfo.Body, 16));

            sim = new UISim(charInfo.ObjID, true)
            {
                Name      = charInfo.Name,
                Head      = HeadOutfit,
                Body      = BodyOutfit,
                Handgroup = BodyOutfit,
            };

            sim.Avatar.Appearance = type;


            return(sim);
        }
Beispiel #4
0
        public UIBigPersonButton()
        {
            NormalImg   = GetTexture(0x83E00000001);
            HoverImg    = GetTexture(0x83F00000001);
            PressedImg  = GetTexture(0xCF200000001);
            DisabledImg = GetTexture(0xCEE00000001);
            DataService = FSOFacade.Kernel.Get <IClientDataService>();
            MainButton  = new UIButton(NormalImg)
            {
                Size = new Microsoft.Xna.Framework.Vector2(114, 169)
            };
            Add(MainButton);

            User = new Binding <Avatar>()
                   .WithBinding(this, "AvatarName", "Avatar_Name")
                   .WithBinding(this, "Sim.Avatar.HeadOutfitId", "Avatar_Appearance.AvatarAppearance_HeadOutfitID")
                   .WithBinding(this, "Sim.Avatar.BodyOutfitId", "Avatar_Appearance.AvatarAppearance_BodyOutfitID")
                   .WithBinding(this, "Sim.Avatar.Appearance", "Avatar_Appearance.AvatarAppearance_SkinTone", (x) => (Vitaboy.AppearanceType)((byte)(x ?? (byte)0)));

            Sim            = new UISim();
            Sim.Size       = new Vector2(80, 150);
            Sim.Position   = new Vector2(17, 13);
            Sim.AutoRotate = true;
            Add(Sim);

            //m_TooltipHandler = UIUtils.GiveTooltip(this);

            MainButton.OnButtonClick += _Button_OnButtonClick;
        }
Beispiel #5
0
        public void SimBoxSelect(string charname)
        {
            this.Remove(SimBox);
            SimBox = null;
            if (PlayerAccount.CurrentlyActiveSim != null)
            {
                SimBox = new UISim(PlayerAccount.CurrentlyActiveSim.GUID.ToString(), true);
            }
            else
            {
                SimBox = new UISim("", false);
            }

            string charfile = FSOEnvironment.ContentDir + "/Characters/" + charname + ".xml";
            var    sim      = SelectCharacter(charfile);

            SelectedCharInfo = XmlCharacter.Parse(charfile);

            SimBox          = sim;
            SimBox.SimScale = 0.1f;
            SimBox.Position = new Microsoft.Xna.Framework.Vector2(0, 6);


            this.Add(SimBox);
        }
Beispiel #6
0
        public UITop10Pedestal()
        {
            DataService = FSOFacade.Kernel.Get <IClientDataService>();
            var ui = Content.Content.Get().CustomUI;

            TileFill = ui.Get("neighp_tilefill.png").Get(GameFacade.GraphicsDevice);
            TileTop  = ui.Get("neighp_tiletop.png").Get(GameFacade.GraphicsDevice);
            TileBtm  = ui.Get("neighp_tilebtm.png").Get(GameFacade.GraphicsDevice);

            SetGraphics(false);

            Sim = new UISim();
            Sim.Avatar.BodyOutfitId = 2611340115981;
            Sim.Avatar.HeadOutfitId = 5076651343885;
            Sim.Size       = new Microsoft.Xna.Framework.Vector2(64, 80);
            Sim.AutoRotate = true;
            Sim.Position   = new Vector2(-32, (-80) + 16);
            this.Add(Sim);

            User = new Binding <Avatar>()
                   .WithBinding(this, "AvatarTooltip", "Avatar_Name")
                   .WithBinding(this, "Sim.Avatar.HeadOutfitId", "Avatar_Appearance.AvatarAppearance_HeadOutfitID")
                   .WithBinding(this, "Sim.Avatar.BodyOutfitId", "Avatar_Appearance.AvatarAppearance_BodyOutfitID")
                   .WithBinding(this, "Sim.Avatar.Appearance", "Avatar_Appearance.AvatarAppearance_SkinTone", (x) => {
                if (x == null)
                {
                    return(Vitaboy.AppearanceType.Light);
                }
                return((Vitaboy.AppearanceType)((byte)(x)));
            });

            Property = new Binding <Lot>()
                       .WithBinding(this, "LotTooltip", "Lot_Name");
        }
Beispiel #7
0
        /// <summary>
        /// Display an avatar
        /// </summary>
        /// <param name="avatar"></param>
        public void DisplayAvatar(UISim avatar)
        {
            this.Avatar = avatar;
            SetSlotAvailable(false);

            PersonNameText.Caption            = avatar.Name;
            PersonDescriptionText.CurrentText = avatar.Description;
            AvatarButton.Texture = Screen.SimSelectButtonImage;

            CityNameText.Caption = avatar.ResidingCity.Name;

            String gamepath = GameFacade.GameFilePath("");
            int    CityNum  = GameFacade.GetCityNumber(avatar.ResidingCity.Name);
            string CityStr  = gamepath + "cities\\" + ((CityNum >= 10) ? "city_00" + CityNum.ToString() : "city_000" + CityNum.ToString());

            var stream = new FileStream(CityStr + "\\Thumbnail.bmp", FileMode.Open, FileAccess.Read, FileShare.Read);

            Texture2D cityThumbTex = TextureUtils.Resize(GameFacade.GraphicsDevice, ImageLoader.FromStream(
                                                             GameFacade.Game.GraphicsDevice, stream), 78, 58);

            stream.Close();

            TextureUtils.CopyAlpha(ref cityThumbTex, Screen.CityHouseButtonAlpha);
            CityThumb.Texture = cityThumbTex;

            SetTab(PersonSlotTab.EnterTab);
        }
Beispiel #8
0
        /// <summary>
        /// Sends a CharacterRetirement packet to the LoginServer, retiring a specific character.
        /// </summary>
        /// <param name="Character">The character to retire.</param>
        public static void SendCharacterRetirement(UISim Character)
        {
            PacketStream Packet = new PacketStream((byte)PacketType.RETIRE_CHARACTER, 0);

            Packet.WriteString(PlayerAccount.Username);
            Packet.WriteString(Character.GUID.ToString());
            NetworkFacade.Client.SendEncrypted((byte)PacketType.RETIRE_CHARACTER, Packet.ToArray());
        }
Beispiel #9
0
        /// <summary>
        /// Requests a token from the LoginServer, that can be used to log into a CityServer.
        /// </summary>
        /// <param name="Client">A NetworkClient instance.</param>
        public static void RequestCityToken(NetworkClient Client, UISim SelectedCharacter)
        {
            PacketStream Packet = new PacketStream((byte)PacketType.REQUEST_CITY_TOKEN, 0);

            Packet.WriteString(Client.ClientEncryptor.Username);
            Packet.WriteString(SelectedCharacter.ResidingCity.UUID);
            Packet.WriteString(SelectedCharacter.GUID.ToString());
            Client.SendEncrypted((byte)PacketType.REQUEST_CITY_TOKEN, Packet.ToArray());
        }
Beispiel #10
0
        private void AcceptButton_OnButtonClick(UIElement button)
        {
            var sim = new UISim(Guid.NewGuid(), false);

            sim.Name         = NameTextEdit.CurrentText;
            sim.Sex          = System.Enum.GetName(typeof(Gender), Gender);
            sim.Description  = DescriptionTextEdit.CurrentText;
            sim.Timestamp    = DateTime.Now.ToString("yyyy.MM.dd hh:mm:ss", CultureInfo.InvariantCulture);
            sim.ResidingCity = SelectedCity;

            var selectedHead    = (CollectionItem)((UIGridViewerItem)m_HeadSkinBrowser.SelectedItem).Data;
            var selectedBody    = (CollectionItem)((UIGridViewerItem)m_BodySkinBrowser.SelectedItem).Data;
            var headPurchasable = Content.Content.Get().AvatarPurchasables.Get(selectedHead.PurchasableOutfitId);
            var bodyPurchasable = Content.Content.Get().AvatarPurchasables.Get(selectedBody.PurchasableOutfitId);

            sim.Head              = Content.Content.Get().AvatarOutfits.Get(headPurchasable.OutfitID);
            sim.HeadOutfitID      = headPurchasable.OutfitID;
            sim.Body              = Content.Content.Get().AvatarOutfits.Get(bodyPurchasable.OutfitID);
            sim.BodyOutfitID      = bodyPurchasable.OutfitID;
            sim.Handgroup         = Content.Content.Get().AvatarOutfits.Get(bodyPurchasable.OutfitID);
            sim.Avatar.Appearance = this.AppearanceType;

            GlobalSettings.Default.DebugBody   = sim.BodyOutfitID;
            GlobalSettings.Default.DebugHead   = sim.HeadOutfitID;
            GlobalSettings.Default.LastUser    = sim.Name;
            GlobalSettings.Default.DebugGender = (Gender == Gender.Male);
            GlobalSettings.Default.DebugSkin   = (int)this.AppearanceType;

            GlobalSettings.Default.Save();

            GameFacade.Controller.ShowLotDebug();

            /*
             * PlayerAccount.CurrentlyActiveSim = sim;
             *
             * if (NetworkFacade.Avatars.Count <= 3)
             * {
             *  lock(NetworkFacade.Avatars)
             *      NetworkFacade.Avatars.Add(sim);
             * }
             * else
             * {
             *  UIAlertOptions Options = new UIAlertOptions();
             *  Options.Message = "You've already created three characters!";
             *  Options.Title = "Too Many Avatars";
             *  Options.Buttons = UIAlertButtons.OK;
             *  UI.Framework.UIScreen.ShowAlert(Options, true);
             *
             *  return;
             * }
             *
             * //DateTime.Now.ToString() requires extremely specific formatting.
             * UIPacketSenders.SendCharacterCreate(sim, DateTime.Now.ToString("yyyy.MM.dd hh:mm:ss",
             *  CultureInfo.InvariantCulture));
             */
        }
Beispiel #11
0
        /// <summary>
        /// Player wished to log into a city!
        /// </summary>
        /// <param name="button">The avatar button that was clicked.</param>
        public void AvatarButton_OnButtonClick(UIElement button)
        {
            PersonSlot PSlot  = m_PersonSlots.First(x => x.AvatarButton == button);
            UISim      Avatar = NetworkFacade.Avatars.First(x => x.Name == PSlot.PersonNameText.Caption);

            //This is important, the avatar contains ResidingCity, which is neccessary to
            //continue to CityTransitionScreen.
            PlayerAccount.CurrentlyActiveSim = Avatar;

            UIPacketSenders.RequestCityToken(NetworkFacade.Client, Avatar);
        }
Beispiel #12
0
        public void Initialize()
        {
            var buttonTexture = Button.Texture;

            SimBox                     = new UISim();
            SimBox.Position            = new Microsoft.Xna.Framework.Vector2(16, 8); //new Microsoft.Xna.Framework.Vector2((buttonTexture.Width / 4) / 2.0f, buttonTexture.Height - 20.0f);
            SimBox.Avatar.BodyOutfitId = 2611340115981;
            SimBox.Avatar.HeadOutfitId = 5076651343885;
            SimBox.Size                = new Microsoft.Xna.Framework.Vector2(75, 140);
            SimBox.AutoRotate          = true;
            this.Add(SimBox);
        }
Beispiel #13
0
        /// <summary>
        /// Loads all sims from the player's cache.
        /// </summary>
        /// <returns>List of cached sims. Will be empty if no cache existed.</returns>
        public static List <UISim> LoadAllSims()
        {
            List <UISim> CachedSims = new List <UISim>();

            if (!Directory.Exists(CacheDir))
            {
                Directory.CreateDirectory(CacheDir);
                return(CachedSims);
            }

            if (!File.Exists(CacheDir + "\\Sims.cache"))
            {
                return(CachedSims);
            }

            using (BinaryReader Reader = new BinaryReader(File.Open(CacheDir + "\\Sims.cache", FileMode.Open, FileAccess.Read, FileShare.Read)))
            {
                //Last time these sims were cached.
                Reader.ReadString();
                int NumSims = Reader.ReadInt32();

                for (int i = 0; i < NumSims; i++)
                {
                    Reader.ReadInt32(); //Length of entry.
                    string GUID = Reader.ReadString();

                    UISim S = new UISim(GUID, false);

                    S.CharacterID            = Reader.ReadInt32();
                    S.Timestamp              = Reader.ReadString();
                    S.Name                   = Reader.ReadString();
                    S.Sex                    = Reader.ReadString();
                    S.Description            = Reader.ReadString();
                    S.HeadOutfitID           = Reader.ReadUInt64();
                    S.BodyOutfitID           = Reader.ReadUInt64();
                    S.Avatar.Appearance      = (AppearanceType)Reader.ReadByte();
                    S.ResidingCity           = new ProtocolAbstractionLibraryD.CityInfo(false);
                    S.ResidingCity.Name      = Reader.ReadString();
                    S.ResidingCity.Thumbnail = Reader.ReadUInt64();
                    S.ResidingCity.UUID      = Reader.ReadString();
                    S.ResidingCity.Map       = Reader.ReadUInt64();
                    S.ResidingCity.IP        = Reader.ReadString();
                    S.ResidingCity.Port      = Reader.ReadInt32();
                    CachedSims.Add(S);
                }

                Reader.Close();
            }

            return(CachedSims);
        }
Beispiel #14
0
        /// <summary>
        /// Setup UI events
        /// </summary>
        public void Init()
        {
            /** Textures **/
            AvatarButton.Texture = Screen.SimCreateButtonImage;
            CityButton.Texture   = Screen.CityButtonTemplateImage;
            HouseButton.Texture  = Screen.HouseButtonTemplateImage;

            /** Send tab stuff to the bottom **/
            Screen.SendToBack(TabBackground, TabEnterBackground, TabDescBackground);

            /** Events **/
            EnterTabButton.OnButtonClick += new ButtonClickDelegate(EnterTabButton_OnButtonClick);
            DescTabButton.OnButtonClick  += new ButtonClickDelegate(DescTabButton_OnButtonClick);

            NewAvatarButton.OnButtonClick    += new ButtonClickDelegate(OnSelect);
            DeleteAvatarButton.OnButtonClick += new ButtonClickDelegate(DeleteAvatarButton_OnButtonClick);

            PersonDescriptionSlider.AttachButtons(PersonDescriptionScrollUpButton, PersonDescriptionScrollDownButton, 1);
            PersonDescriptionText.AttachSlider(PersonDescriptionSlider);

            CityThumb = new UIImage
            {
                X = CityButton.X + 6,
                Y = CityButton.Y + 6
            };
            CityThumb.SetSize(78, 58);
            Screen.Add(CityThumb);


            HouseThumb = new UIImage
            {
                X = HouseButton.X + 6,
                Y = HouseButton.Y + 6
            };
            HouseThumb.SetSize(78, 58);
            Screen.Add(HouseThumb);

            Sim = new UISim
            {
                Visible  = false,
                Position = AvatarButton.Position + new Vector2(1, 10),
                Size     = new Vector2(140, 200)
            };

            Screen.Add(Sim);
            SetTab(PersonSlotTab.EnterTab);

            AvatarButton.OnButtonClick += new ButtonClickDelegate(OnSelect);
            CityButton.OnButtonClick   += new ButtonClickDelegate(OnSelect);
            HouseButton.OnButtonClick  += new ButtonClickDelegate(OnSelect);
        }
        /// <summary>
        /// LoginServer sent information about the player's characters.
        /// </summary>
        /// <param name="Packet">The packet that was received.</param>
        public static void OnCharacterInfoResponse(ProcessedPacket Packet, NetworkClient Client)
        {
            //If the decrypted length == 1, it means that there were 0
            //characters that needed to be updated, or that the user
            //hasn't created any characters on his/her account yet.
            //Since the Packet.Length property is equal to the length
            //of the encrypted data, it cannot be used to get the length
            //of the decrypted data.
            if (Packet.DecryptedLength > 1)
            {
                byte         NumCharacters = (byte)Packet.ReadByte();
                List <UISim> FreshSims     = new List <UISim>();

                for (int i = 0; i < NumCharacters; i++)
                {
                    int CharacterID = Packet.ReadInt32();

                    UISim FreshSim = new UISim(Packet.ReadString(), false);
                    FreshSim.CharacterID       = CharacterID;
                    FreshSim.Timestamp         = Packet.ReadString();
                    FreshSim.Name              = Packet.ReadString();
                    FreshSim.Sex               = Packet.ReadString();
                    FreshSim.Description       = Packet.ReadString();
                    FreshSim.HeadOutfitID      = Packet.ReadUInt64();
                    FreshSim.BodyOutfitID      = Packet.ReadUInt64();
                    FreshSim.Avatar.Appearance = (AppearanceType)Packet.ReadByte();
                    FreshSim.ResidingCity      = new CityInfo(Packet.ReadString(), "", Packet.ReadUInt64(), Packet.ReadString(),
                                                              Packet.ReadUInt64(), Packet.ReadString(), Packet.ReadInt32());

                    FreshSims.Add(FreshSim);
                }

                if (NumCharacters < 3)
                {
                    FreshSims = Cache.LoadCachedSims(FreshSims);
                }
                NetworkFacade.Avatars = FreshSims;
                Cache.CacheSims(FreshSims);
            }
            else
            {
                NetworkFacade.Avatars = Cache.LoadAllSims();
            }

            PacketStream CityInfoRequest = new PacketStream(0x06, 0);

            CityInfoRequest.WriteByte(0x00); //Dummy

            Client.SendEncrypted((byte)PacketType.CITY_LIST, CityInfoRequest.ToArray());
        }
Beispiel #16
0
        private void AcceptButton_OnButtonClick(UIElement button)
        {
            var sim = new UISim("0x7FD96B54", false);

            sim.Name         = NameTextEdit.CurrentText;
            sim.Sex          = System.Enum.GetName(typeof(Gender), Gender);
            sim.Description  = DescriptionTextEdit.CurrentText;
            sim.Timestamp    = DateTime.Now.ToString("yyyy.MM.dd hh:mm:ss", CultureInfo.InvariantCulture);
            sim.ResidingCity = SelectedCity;

            var selectedHead    = (CollectionItem)((UIGridViewerItem)m_HeadSkinBrowser.SelectedItem).Data;
            var selectedBody    = (CollectionItem)((UIGridViewerItem)m_BodySkinBrowser.SelectedItem).Data;
            var headPurchasable = Content.Content.Get().AvatarPurchasables.Get(selectedHead.PurchasableOutfitId);
            var bodyPurchasable = Content.Content.Get().AvatarPurchasables.Get(selectedBody.PurchasableOutfitId);

            sim.Head              = Content.Content.Get().AvatarOutfits.Get(headPurchasable.OutfitID);
            sim.HeadOutfitID      = headPurchasable.OutfitID;
            sim.Body              = Content.Content.Get().AvatarOutfits.Get(bodyPurchasable.OutfitID);
            sim.BodyOutfitID      = bodyPurchasable.OutfitID;
            sim.Handgroup         = Content.Content.Get().AvatarOutfits.Get(bodyPurchasable.OutfitID);
            sim.Avatar.Appearance = this.AppearanceType;

            XmlCharacter = new XmlCharacter()
            {
                Id         = sim.CharacterID.ToString(),
                Name       = sim.Name,
                ObjID      = sim.GUID,
                Gender     = sim.Sex,
                Head       = sim.HeadOutfitID.ToString("X"),
                Body       = sim.BodyOutfitID.ToString("X"),
                Appearance = sim.Avatar.Appearance.ToString()
            };

            GlobalSettings.Default.LastBody   = sim.BodyOutfitID;
            GlobalSettings.Default.LastHead   = sim.HeadOutfitID;
            GlobalSettings.Default.LastUser   = sim.Name;
            GlobalSettings.Default.LastGender = (Gender == Gender.Male);
            GlobalSettings.Default.LastSkin   = (int)this.AppearanceType;

            GlobalSettings.Default.Save();

            XmlCharacter.Save(FSOEnvironment.ContentDir + "/Characters/" + sim.Name + ".xml", XmlCharacter);

            GameFacade.Controller.ShowLotDebug();
        }
        private void AcceptButton_OnButtonClick(UIElement button)
        {
            var sim = new UISim(Guid.NewGuid(), false);

            sim.Name         = NameTextEdit.CurrentText;
            sim.Sex          = System.Enum.GetName(typeof(Gender), Gender);
            sim.Description  = DescriptionTextEdit.CurrentText;
            sim.Timestamp    = DateTime.Now.ToString("yyyy.MM.dd hh:mm:ss");
            sim.ResidingCity = SelectedCity;

            var selectedHead    = (CollectionItem)((UIGridViewerItem)m_HeadSkinBrowser.SelectedItem).Data;
            var selectedBody    = (CollectionItem)((UIGridViewerItem)m_BodySkinBrowser.SelectedItem).Data;
            var headPurchasable = Content.Get().AvatarPurchasables.Get(selectedHead.PurchasableOutfitId);
            var bodyPurchasable = Content.Get().AvatarPurchasables.Get(selectedBody.PurchasableOutfitId);

            sim.Head              = Content.Get().AvatarOutfits.Get(headPurchasable.OutfitID);
            sim.HeadOutfitID      = headPurchasable.OutfitID;
            sim.Body              = Content.Get().AvatarOutfits.Get(bodyPurchasable.OutfitID);
            sim.BodyOutfitID      = bodyPurchasable.OutfitID;
            sim.Handgroup         = Content.Get().AvatarOutfits.Get(bodyPurchasable.OutfitID);
            sim.Avatar.Appearance = this.AppearanceType;

            //GameFacade.Controller.ShowCity();
            PlayerAccount.CurrentlyActiveSim = sim;

            if (PlayerAccount.Sims.Count == 0)
            {
                PlayerAccount.Sims.Add(sim);
            }
            else if (PlayerAccount.Sims.Count == 2)
            {
                PlayerAccount.Sims[1] = sim;
            }
            else if (PlayerAccount.Sims.Count == 3)
            {
                PlayerAccount.Sims[2] = sim;
            }

            UIPacketSenders.SendCharacterCreate(sim, DateTime.Now.ToString());
        }
Beispiel #18
0
        /// <summary>
        /// Sends a CharacterCreate packet to the LoginServer.
        /// </summary>
        /// <param name="Character">The character to create.</param>
        /// <param name="TimeStamp">The timestamp of when this character was created.</param>
        public static void SendCharacterCreate(UISim Character, string TimeStamp)
        {
            PacketStream Packet = new PacketStream((byte)PacketType.CHARACTER_CREATE, 0);

            Packet.WriteString(NetworkFacade.Client.ClientEncryptor.Username);
            Packet.WriteString(TimeStamp);
            Packet.WriteString(Character.Name);
            Packet.WriteString(Character.Sex);
            Packet.WriteString(Character.Description);
            Packet.WriteUInt64(Character.HeadOutfitID);
            Packet.WriteUInt64(Character.BodyOutfitID);
            Packet.WriteByte((byte)Character.Avatar.Appearance);

            Packet.WriteString(Character.ResidingCity.Name);
            Packet.WriteUInt64(Character.ResidingCity.Thumbnail);
            Packet.WriteString(Character.ResidingCity.UUID);
            Packet.WriteUInt64(Character.ResidingCity.Map);
            Packet.WriteString(Character.ResidingCity.IP);
            Packet.WriteInt32(Character.ResidingCity.Port);

            byte[] PacketData = Packet.ToArray();
            NetworkFacade.Client.SendEncrypted((byte)PacketType.CHARACTER_CREATE, PacketData);
        }
Beispiel #19
0
        /// <summary>
        /// A player joined a session (game) in progress.
        /// </summary>
        public static LotTileEntry OnPlayerJoinedSession(NetworkClient Client, ProcessedPacket Packet)
        {
            LotTileEntry TileEntry = new LotTileEntry(0, "", 0, 0, 0, 0);

            UISim Avatar = new UISim(Packet.ReadString());

            Avatar.Name              = Packet.ReadString();
            Avatar.Sex               = Packet.ReadString();
            Avatar.Description       = Packet.ReadString();
            Avatar.HeadOutfitID      = Packet.ReadUInt64();
            Avatar.BodyOutfitID      = Packet.ReadUInt64();
            Avatar.Avatar.Appearance = (AppearanceType)Packet.ReadInt32();

            byte HasHouse = (byte)Packet.ReadByte();

            if (HasHouse != 0)
            {
                TileEntry = new LotTileEntry(Packet.ReadInt32(), Packet.ReadString(), (short)Packet.ReadUInt16(),
                                             (short)Packet.ReadUInt16(), (byte)Packet.ReadByte(), Packet.ReadInt32());

                Avatar.LotID  = TileEntry.lotid;
                Avatar.HouseX = TileEntry.x;
                Avatar.HouseY = TileEntry.y;

                LotTileEntry[] TileEntries = new LotTileEntry[GameFacade.CDataRetriever.LotTileData.Length + 1];
                TileEntries[0] = TileEntry;
                GameFacade.CDataRetriever.LotTileData.CopyTo(TileEntries, 1);
            }

            lock (NetworkFacade.AvatarsInSession)
            {
                NetworkFacade.AvatarsInSession.Add(Avatar);
            }

            return(TileEntry);
        }
Beispiel #20
0
        public UIGizmo()
        {
            var ui = this.RenderScript("gizmo.uis");

            BackgroundImageGizmo = ui.Create <UIImage>("BackgroundImageGizmo");
            this.AddAt(0, BackgroundImageGizmo);

            BackgroundImageGizmoPanel = ui.Create <UIImage>("BackgroundImageGizmoPanel");
            this.AddAt(0, BackgroundImageGizmoPanel);

            BackgroundImagePanel = ui.Create <UIImage>("BackgroundImagePanel");
            this.AddAt(0, BackgroundImagePanel);

            UIUtils.MakeDraggable(BackgroundImageGizmo, this);
            UIUtils.MakeDraggable(BackgroundImageGizmoPanel, this);
            UIUtils.MakeDraggable(BackgroundImagePanel, this);

            ButtonContainer = new UIContainer();
            this.Remove(ExpandButton);
            ButtonContainer.Add(ExpandButton);
            this.Remove(ContractButton);
            ButtonContainer.Add(ContractButton);
            this.Remove(FiltersButton);
            ButtonContainer.Add(FiltersButton);
            this.Remove(SearchButton);
            ButtonContainer.Add(SearchButton);
            this.Remove(Top100ListsButton);
            ButtonContainer.Add(Top100ListsButton);
            this.Add(ButtonContainer);

            FiltersProperty         = new UIGizmoPropertyFilters(ui, this);
            FiltersProperty.Visible = false;
            this.Add(FiltersProperty);

            Search         = new UIGizmoSearch(ui, this);
            Search.Visible = false;
            this.Add(Search);

            Top100                    = new UIGizmoTop100(ui, this);
            Top100.Visible            = false;
            Top100.Background.Visible = false;
            this.Add(Top100);

            ExpandButton.OnButtonClick   += new ButtonClickDelegate(ExpandButton_OnButtonClick);
            ContractButton.OnButtonClick += new ButtonClickDelegate(ContractButton_OnButtonClick);

            PeopleTabButton.OnButtonClick += new ButtonClickDelegate(PeopleTabButton_OnButtonClick);
            HousesTabButton.OnButtonClick += new ButtonClickDelegate(HousesTabButton_OnButtonClick);

            FiltersButton.OnButtonClick     += new ButtonClickDelegate(FiltersButton_OnButtonClick);
            SearchButton.OnButtonClick      += new ButtonClickDelegate(SearchButton_OnButtonClick);
            Top100ListsButton.OnButtonClick += new ButtonClickDelegate(Top100ListsButton_OnButtonClick);

            if (PlayerAccount.CurrentlyActiveSim != null)
            {
                SimBox = new UISim(PlayerAccount.CurrentlyActiveSim.GUID.ToString());
            }
            else
            {
                SimBox = new UISim("");
            }
            //var sim = new Sim(Guid.NewGuid().ToString());
            //var maleHeads = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_male_heads));
            //SimCatalog.LoadSim3D(sim, maleHeads.First().PurchasableObject.Outfit, AppearanceType.Light);
            //

            //sim.HeadOutfitID = 4853313044493;
            //sim.AppearanceType = AppearanceType.Light;
            //sim.BodyOutfitID = 5394478923789;

            //SimCatalog.LoadSim3D(sim);
            //SimCatalog.LoadSim3D(sim, SimCatalog.GetOutfit(4462471020557), AppearanceType.Light);

            //SimBox.Sim = sim;
            //SimBox.SimScale = 0.4f;
            //SimBox.Position = new Microsoft.Xna.Framework.Vector2(60, 60);

            //this.Add(SimBox);

            View = UIGizmoView.Top100;
            SetOpen(true);
        }
Beispiel #21
0
        public PersonSelectionEdit() : base()
        {
            /**
             * Data
             */
            var content = Content.Content.Get();

            MaleHeads   = content.AvatarCollections.Get("ea_male_heads.col");
            MaleOutfits = content.AvatarCollections.Get("ea_male.col");

            FemaleHeads   = content.AvatarCollections.Get("ea_female_heads.col");
            FemaleOutfits = content.AvatarCollections.Get("ea_female.col");

            /**
             * UI
             */

            UIScript ui = this.RenderScript("personselectionedit1024.uis");

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

            m_ExitButton = (UIButton)ui["ExitButton"];
            m_ExitButton.OnButtonClick += new ButtonClickDelegate(m_ExitButton_OnButtonClick);

            CancelButton = (UIButton)ui["CancelButton"];
            CancelButton.OnButtonClick += new ButtonClickDelegate(CancelButton_OnButtonClick);
            CancelButton.Disabled       = true;

            DescriptionTextEdit.CurrentText = ui.GetString("DefaultAvatarDescription");
            DescriptionSlider.AttachButtons(DescriptionScrollUpButton, DescriptionScrollDownButton, 1);
            DescriptionTextEdit.AttachSlider(DescriptionSlider);
            NameTextEdit.OnChange   += new ChangeDelegate(NameTextEdit_OnChange);
            NameTextEdit.CurrentText = GlobalSettings.Default.LastUser;

            AcceptButton.Disabled       = NameTextEdit.CurrentText.Length == 0;
            AcceptButton.OnButtonClick += new ButtonClickDelegate(AcceptButton_OnButtonClick);

            /** Appearance **/
            SkinLightButton.OnButtonClick  += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SkinMediumButton.OnButtonClick += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SkinDarkButton.OnButtonClick   += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SelectedAppearanceButton        = SkinLightButton;

            m_HeadSkinBrowser           = ui.Create <UICollectionViewer>("HeadSkinBrowser");
            m_HeadSkinBrowser.OnChange += new ChangeDelegate(HeadSkinBrowser_OnChange);
            m_HeadSkinBrowser.Init();
            this.Add(m_HeadSkinBrowser);

            m_BodySkinBrowser           = ui.Create <UICollectionViewer>("BodySkinBrowser");
            m_BodySkinBrowser.OnChange += new ChangeDelegate(BodySkinBrowser_OnChange);
            m_BodySkinBrowser.Init();
            this.Add(m_BodySkinBrowser);

            FemaleButton.OnButtonClick += new ButtonClickDelegate(GenderButton_OnButtonClick);
            MaleButton.OnButtonClick   += new ButtonClickDelegate(GenderButton_OnButtonClick);

            /** 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);

            var offset = new Vector2(0, 0);

            if (BackgroundImageDialog != null)
            {
                offset = new Vector2(112, 84);

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

            /**
             * Music
             */
            HIT.HITVM.Get().PlaySoundEvent(UIMusic.CAS);

            /*
             * PlayBackgroundMusic(
             *  new string[] { GlobalSettings.Default.StartupPath + "\\music\\modes\\create\\tsocas1_v2.mp3" }
             * );*/

            SimBox = new UISim(Guid.NewGuid().ToString());

            SimBox.SimScale = 0.5f;
            SimBox.Position = new Microsoft.Xna.Framework.Vector2(offset.X + 70, offset.Y + 88);

            SimBox.AutoRotate = true;
            this.Add(SimBox);

            /**
             * Init state
             */

            if (GlobalSettings.Default.DebugGender)
            {
                Gender = Gender.Male;
                MaleButton.Selected   = true;
                FemaleButton.Selected = false;
            }
            else
            {
                Gender = Gender.Female;
                MaleButton.Selected   = false;
                FemaleButton.Selected = true;
            }

            AppearanceType = (AppearanceType)GlobalSettings.Default.DebugSkin;

            SkinLightButton.Selected  = false;
            SkinMediumButton.Selected = false;
            SkinDarkButton.Selected   = false;

            switch (AppearanceType)
            {
            case AppearanceType.Light:
                SkinLightButton.Selected = true; break;

            case AppearanceType.Medium:
                SkinMediumButton.Selected = true; break;

            case AppearanceType.Dark:
                SkinDarkButton.Selected = true; break;
            }

            RefreshCollections();

            SearchCollectionForInitID(GlobalSettings.Default.DebugHead, GlobalSettings.Default.DebugBody);


            NetworkFacade.Controller.OnCharacterCreationProgress += new OnCharacterCreationProgressDelegate(Controller_OnCharacterCreationStatus);
        }
Beispiel #22
0
        /// <summary>
        /// LoginServer sent information about the player's characters.
        /// </summary>
        /// <param name="Packet">The packet that was received.</param>
        public static void OnCharacterInfoResponse(ProcessedPacket Packet, NetworkClient Client)
        {
            byte NumCharacters = (byte)Packet.ReadByte();
            byte NewCharacters = (byte)Packet.ReadByte();

            List <UISim> FreshSims = new List <UISim>();

            for (int i = 0; i < NewCharacters; i++)
            {
                int CharacterID = Packet.ReadInt32();

                UISim FreshSim = new UISim(Packet.ReadString(), false);
                FreshSim.CharacterID            = CharacterID;
                FreshSim.Timestamp              = Packet.ReadString();
                FreshSim.Name                   = Packet.ReadString();
                FreshSim.Sex                    = Packet.ReadString();
                FreshSim.Description            = Packet.ReadString();
                FreshSim.HeadOutfitID           = Packet.ReadUInt64();
                FreshSim.BodyOutfitID           = Packet.ReadUInt64();
                FreshSim.Avatar.Appearance      = (AppearanceType)Packet.ReadByte();
                FreshSim.ResidingCity           = new CityInfo(false);
                FreshSim.ResidingCity.Name      = Packet.ReadString();
                FreshSim.ResidingCity.Thumbnail = Packet.ReadUInt64();
                FreshSim.ResidingCity.UUID      = Packet.ReadString();
                FreshSim.ResidingCity.Map       = Packet.ReadUInt64();
                FreshSim.ResidingCity.IP        = Packet.ReadString();
                FreshSim.ResidingCity.Port      = Packet.ReadInt32();

                FreshSims.Add(FreshSim);
            }

            lock (NetworkFacade.Avatars)
            {
                if ((NumCharacters < 3) && (NewCharacters > 0))
                {
                    FreshSims             = Cache.LoadCachedSims(FreshSims);
                    NetworkFacade.Avatars = FreshSims;
                    Cache.CacheSims(FreshSims);
                }

                if (NewCharacters == 0 && NumCharacters > 0)
                {
                    NetworkFacade.Avatars = Cache.LoadAllSims();
                }
                else if (NewCharacters == 3 && NumCharacters == 3)
                {
                    NetworkFacade.Avatars = FreshSims;
                    Cache.CacheSims(FreshSims);
                }
                else if (NewCharacters == 0 && NumCharacters == 0)
                {
                    //Make sure if sims existed in the cache, they are deleted (because they didn't exist in DB).
                    Cache.DeleteCache();
                }
                else if (NumCharacters == 3 && NewCharacters == 3)
                {
                    NetworkFacade.Avatars = FreshSims;
                }
            }

            PacketStream CityInfoRequest = new PacketStream(0x06, 0);

            CityInfoRequest.WriteByte(0x00); //Dummy

            Client.SendEncrypted((byte)PacketType.CITY_LIST, CityInfoRequest.ToArray());
        }
Beispiel #23
0
        public PersonSelection()
        {
            UIScript ui = null;

            if (GlobalSettings.Default.ScaleUI)
            {
                ui = this.RenderScript("personselection.uis");
                this.Scale800x600 = true;
            }
            else
            {
                ui = this.RenderScript("personselection" + (ScreenWidth == 1024 ? "1024" : "") + ".uis");
            }

            var numSlots = 3;

            PersonSlots = new List <PersonSlot>();

            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.SetSlotAvaliable(true);
                PersonSlots.Add(personSlot);

                if (i < NetworkFacade.Avatars.Count)
                {
                    personSlot.DisplayAvatar(NetworkFacade.Avatars[i]);
                }
            }

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

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


            /**
             * Music
             */
            var tracks = new string[] {
                //"music\\modes\\select\\tsosas1_v2.mp3",
                "music\\modes\\select\\tsosas2_v2.mp3",
                //"music\\modes\\select\\tsosas3.mp3",
                //"music\\modes\\select\\tsosas4.mp3",
                //"music\\modes\\select\\tsosas5.mp3"
            };

            PlayBackgroundMusic(
                GameFacade.GameFilePath(tracks.RandomItem())
                );

            var simBox    = new UISim();
            var sim       = new Sim(Guid.NewGuid().ToString());
            var maleHeads = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_male_heads));

            SimCatalog.LoadSim3D(sim, SimCatalog.GetOutfit(4462471020557), AppearanceType.Light);

            simBox.Sim      = sim;
            simBox.Position = PersonSlots[0].AvatarButton.Position + new Vector2(70, 40);
            simBox.Size     = PersonSlots[0].AvatarButton.Size;

            this.Add(simBox);
        }
Beispiel #24
0
        public PersonSelectionEdit()
        {
            /**
             * Data
             */
            MaleHeads   = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_male_heads));
            MaleOutfits = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_male));

            FemaleHeads   = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_female_heads));
            FemaleOutfits = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_female));

            /**
             * UI
             */

            UIScript ui = null;

            if (GlobalSettings.Default.ScaleUI)
            {
                ui = this.RenderScript("personselectionedit.uis");
                this.Scale800x600 = true;
            }
            else
            {
                ui = this.RenderScript("personselectionedit" + (ScreenWidth == 1024 ? "1024" : "") + ".uis");
            }

            DescriptionTextEdit.CurrentText = ui.GetString("DefaultAvatarDescription");
            DescriptionSlider.AttachButtons(DescriptionScrollUpButton, DescriptionScrollDownButton, 1);
            DescriptionTextEdit.AttachSlider(DescriptionSlider);
            NameTextEdit.OnChange += new ChangeDelegate(NameTextEdit_OnChange);

            AcceptButton.Disabled       = true;
            AcceptButton.OnButtonClick += new ButtonClickDelegate(AcceptButton_OnButtonClick);

            /** Appearance **/
            SkinLightButton.OnButtonClick  += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SkinMediumButton.OnButtonClick += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SkinDarkButton.OnButtonClick   += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SelectedAppearanceButton        = SkinLightButton;
            SkinLightButton.Selected        = true;

            HeadSkinBrowser           = ui.Create <UICollectionViewer>("HeadSkinBrowser");
            HeadSkinBrowser.OnChange += new ChangeDelegate(HeadSkinBrowser_OnChange);
            HeadSkinBrowser.Init();
            this.Add(HeadSkinBrowser);

            BodySkinBrowser = ui.Create <UICollectionViewer>("BodySkinBrowser");
            BodySkinBrowser.Init();
            this.Add(BodySkinBrowser);

            FemaleButton.OnButtonClick += new ButtonClickDelegate(GenderButton_OnButtonClick);
            MaleButton.OnButtonClick   += new ButtonClickDelegate(GenderButton_OnButtonClick);

            /** Backgrounds **/
            var bg = new UIImage(BackgroundImage);

            this.AddAt(0, bg);

            var offset = new Vector2(0, 0);

            if (BackgroundImageDialog != null)
            {
                offset = new Vector2(112, 84);

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

            /**
             * Music
             */
            PlayBackgroundMusic(
                GameFacade.GameFilePath("music\\modes\\create\\tsocas1_v2.mp3")
                );


            SimBox          = new UISim();
            SimBox.SimScale = 0.8f;
            SimBox.Position = new Microsoft.Xna.Framework.Vector2(offset.X + 140, offset.Y + 130);

            this.Add(SimBox);

            Sim = new Sim(new Guid().ToString());

            /**
             * Init state
             */
            RefreshCollections();

            HeadSkinBrowser.SelectedIndex = 0;
            BodySkinBrowser.SelectedIndex = 0;
            FemaleButton.Selected         = true;
        }
        /// <summary>
        /// Caches sims received from the LoginServer to the disk.
        /// </summary>
        /// <param name="FreshSims">A list of the sims received by the LoginServer.</param>
        public static void CacheSims(List <UISim> FreshSims)
        {
            if (!Directory.Exists(CacheDir))
            {
                Directory.CreateDirectory(CacheDir);
            }

            using (BinaryWriter Writer = new BinaryWriter(File.Create(CacheDir + "\\Sims.tempcache")))
            {
                //Last time these sims were cached.
                Writer.Write(DateTime.Now.ToString("yyyy.MM.dd hh:mm:ss"));

                Writer.Write(FreshSims.Count);

                foreach (UISim S in FreshSims)
                {
                    //Length of the current entry, so its skippable...
                    Writer.Write((int)4 + S.GUID.ToString().Length + 4 + S.Timestamp.Length + S.Name.Length + S.Sex.Length +
                                 S.Description.Length + 17 + S.ResidingCity.Name.Length + 8 + S.ResidingCity.UUID.ToString().Length + 8 +
                                 S.ResidingCity.IP.Length + 4);
                    Writer.Write(S.GUID.ToString());
                    Writer.Write(S.CharacterID);
                    Writer.Write(S.Timestamp);
                    Writer.Write(S.Name);
                    Writer.Write(S.Sex);
                    Writer.Write(S.Description);
                    Writer.Write(S.HeadOutfitID);
                    Writer.Write(S.BodyOutfitID);
                    Writer.Write((byte)S.Avatar.Appearance);
                    Writer.Write(S.ResidingCity.Name);
                    Writer.Write(S.ResidingCity.Thumbnail);
                    Writer.Write(S.ResidingCity.UUID);
                    Writer.Write(S.ResidingCity.Map);
                    Writer.Write(S.ResidingCity.IP);
                    Writer.Write(S.ResidingCity.Port);
                }

                if (File.Exists(CacheDir + "\\Sims.cache"))
                {
                    using (BinaryReader Reader = new BinaryReader(File.Open(CacheDir + "\\Sims.cache", FileMode.Open)))
                    {
                        //Last time these sims were cached.
                        Reader.ReadString();
                        int NumSims = Reader.ReadInt32();

                        List <UISim> UnchangedSims = new List <UISim>();

                        if (NumSims > FreshSims.Count)
                        {
                            if (NumSims == 2)
                            {
                                //Skips the first entry.
                                Reader.BaseStream.Position = Reader.ReadInt32();

                                Reader.ReadInt32(); //Length of second entry.
                                string GUID = Reader.ReadString();

                                UISim S = new UISim(GUID, false);

                                S.CharacterID       = Reader.ReadInt32();
                                S.Timestamp         = Reader.ReadString();
                                S.Name              = Reader.ReadString();
                                S.Sex               = Reader.ReadString();
                                S.Description       = Reader.ReadString();
                                S.HeadOutfitID      = Reader.ReadUInt64();
                                S.BodyOutfitID      = Reader.ReadUInt64();
                                S.Avatar.Appearance = (AppearanceType)Reader.ReadByte();
                                S.ResidingCity      = new ProtocolAbstractionLibraryD.CityInfo(Reader.ReadString(), "",
                                                                                               Reader.ReadUInt64(), Reader.ReadString(), Reader.ReadUInt64(), Reader.ReadString(),
                                                                                               Reader.ReadInt32());
                                UnchangedSims.Add(S);
                            }
                            else if (NumSims == 3)
                            {
                                //Skips the first entry.
                                Reader.BaseStream.Position = Reader.ReadInt32();

                                Reader.ReadInt32(); //Length of second entry.
                                string GUID = Reader.ReadString();

                                UISim S = new UISim(GUID, false);

                                S.CharacterID       = Reader.ReadInt32();
                                S.Timestamp         = Reader.ReadString();
                                S.Name              = Reader.ReadString();
                                S.Sex               = Reader.ReadString();
                                S.Description       = Reader.ReadString();
                                S.HeadOutfitID      = Reader.ReadUInt64();
                                S.BodyOutfitID      = Reader.ReadUInt64();
                                S.Avatar.Appearance = (AppearanceType)Reader.ReadByte();
                                S.ResidingCity      = new ProtocolAbstractionLibraryD.CityInfo(Reader.ReadString(), "",
                                                                                               Reader.ReadUInt64(), Reader.ReadString(), Reader.ReadUInt64(), Reader.ReadString(),
                                                                                               Reader.ReadInt32());
                                UnchangedSims.Add(S);

                                Reader.ReadInt32(); //Length of third entry.
                                S.CharacterID       = Reader.ReadInt32();
                                S.Timestamp         = Reader.ReadString();
                                S.Name              = Reader.ReadString();
                                S.Sex               = Reader.ReadString();
                                S.Description       = Reader.ReadString();
                                S.HeadOutfitID      = Reader.ReadUInt64();
                                S.BodyOutfitID      = Reader.ReadUInt64();
                                S.Avatar.Appearance = (AppearanceType)Reader.ReadByte();
                                S.ResidingCity      = new ProtocolAbstractionLibraryD.CityInfo(Reader.ReadString(), "",
                                                                                               Reader.ReadUInt64(), Reader.ReadString(), Reader.ReadUInt64(), Reader.ReadString(),
                                                                                               Reader.ReadInt32());
                                UnchangedSims.Add(S);
                            }

                            Reader.Close();

                            foreach (UISim S in UnchangedSims)
                            {
                                //Length of the current entry, so its skippable...
                                Writer.Write((int)4 + S.GUID.ToString().Length + 4 + S.Timestamp.Length + S.Name.Length + S.Sex.Length +
                                             S.Description.Length + 17 + S.ResidingCity.Name.Length + 8 + S.ResidingCity.UUID.ToString().Length + 8 +
                                             S.ResidingCity.IP.Length + 4);
                                Writer.Write(S.GUID.ToString());
                                Writer.Write(S.CharacterID);
                                Writer.Write(S.Timestamp);
                                Writer.Write(S.Name);
                                Writer.Write(S.Sex);
                                Writer.Write(S.Description);
                                Writer.Write(S.HeadOutfitID);
                                Writer.Write(S.BodyOutfitID);
                                Writer.Write((byte)S.Avatar.Appearance);
                                Writer.Write(S.ResidingCity.Name);
                                Writer.Write(S.ResidingCity.Thumbnail);
                                Writer.Write(S.ResidingCity.UUID);
                                Writer.Write(S.ResidingCity.Map);
                                Writer.Write(S.ResidingCity.IP);
                                Writer.Write(S.ResidingCity.Port);
                            }
                        }
                    }
                }

                Writer.Flush();
                Writer.Close();
            }

            if (File.Exists(CacheDir + "\\Sims.cache"))
            {
                File.Delete(CacheDir + "\\Sims.cache");
                File.Move(CacheDir + "\\Sims.tempcache", CacheDir + "\\Sims.cache");
            }
            else
            {
                File.Move(CacheDir + "\\Sims.tempcache", CacheDir + "\\Sims.cache");
            }
        }
Beispiel #26
0
        public UIGizmo()
        {
            TabV = Tab;

            var ui = this.RenderScript("gizmo.uis");

            BackgroundImageGizmo = ui.Create <UIImage>("BackgroundImageGizmo");
            this.AddAt(0, BackgroundImageGizmo);

            BackgroundImageGizmoPanel = ui.Create <UIImage>("BackgroundImageGizmoPanel");
            this.AddAt(0, BackgroundImageGizmoPanel);

            BackgroundImagePanel = ui.Create <UIImage>("BackgroundImagePanel");
            this.AddAt(0, BackgroundImagePanel);

            UIUtils.MakeDraggable(BackgroundImageGizmo, this);
            UIUtils.MakeDraggable(BackgroundImageGizmoPanel, this);
            UIUtils.MakeDraggable(BackgroundImagePanel, this);

            ButtonContainer = new UIContainer();
            this.Remove(ExpandButton);
            ButtonContainer.Add(ExpandButton);
            this.Remove(ContractButton);
            ButtonContainer.Add(ContractButton);
            this.Remove(FiltersButton);
            ButtonContainer.Add(FiltersButton);
            this.Remove(SearchButton);
            ButtonContainer.Add(SearchButton);
            this.Remove(Top100ListsButton);
            ButtonContainer.Add(Top100ListsButton);
            this.Add(ButtonContainer);

            FiltersProperty         = new UIGizmoPropertyFilters(ui, this);
            FiltersProperty.Visible = false;
            this.Add(FiltersProperty);

            Search         = new UIGizmoSearch(ui, this);
            Search.Visible = false;
            this.Add(Search);

            Top100                    = new UIGizmoTop100(ui, this);
            Top100.Visible            = false;
            Top100.Background.Visible = false;
            this.Add(Top100);

            ExpandButton.OnButtonClick   += new ButtonClickDelegate(ExpandButton_OnButtonClick);
            ContractButton.OnButtonClick += new ButtonClickDelegate(ContractButton_OnButtonClick);

            PeopleTabButton.OnButtonClick += new ButtonClickDelegate(PeopleTabButton_OnButtonClick);
            HousesTabButton.OnButtonClick += new ButtonClickDelegate(HousesTabButton_OnButtonClick);

            FiltersButton.OnButtonClick     += new ButtonClickDelegate(FiltersButton_OnButtonClick);
            SearchButton.OnButtonClick      += new ButtonClickDelegate(SearchButton_OnButtonClick);
            Top100ListsButton.OnButtonClick += new ButtonClickDelegate(Top100ListsButton_OnButtonClick);

            if (PlayerAccount.CurrentlyActiveSim != null)
            {
                SimBox = new UISim(PlayerAccount.CurrentlyActiveSim.GUID.ToString());
            }
            else
            {
                SimBox = new UISim("");
            }

            MessageDialog                 = new UIAlertOptions();
            MessageDialog.Message         = "No avatar has been selected";
            MessageDialog.Title           = "Avatar selectioin";
            MessageDialog.Buttons[0].Type = UIAlertButtonType.OK;


            View = UIGizmoView.Top100;
            SetOpen(true);


            TabV = UIGizmoTab.People;
        }
Beispiel #27
0
        public PersonSelectionEdit() : base()
        {
            /**
             * Data
             */
            var content = Content.GameContent.Get;

            MaleHeads   = content.AvatarCollections.Get("ea_male_heads.col");
            MaleOutfits = content.AvatarCollections.Get("ea_male.col");

            FemaleHeads   = content.AvatarCollections.Get("ea_female_heads.col");
            FemaleOutfits = content.AvatarCollections.Get("ea_female.col");

            /**
             * UI
             */

            UIScript ui = RenderScript("personselectionedit1024.uis");

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

            m_ExitButton = (UIButton)ui["ExitButton"];
            m_ExitButton.OnButtonClick += new ButtonClickDelegate(m_ExitButton_OnButtonClick);

            CancelButton = (UIButton)ui["CancelButton"];
            CancelButton.OnButtonClick += new ButtonClickDelegate(CancelButton_OnButtonClick);
            //CancelButton.Disabled = true;

            DescriptionTextEdit.CurrentText = ui.GetString("DefaultAvatarDescription");
            DescriptionSlider.AttachButtons(DescriptionScrollUpButton, DescriptionScrollDownButton, 1);
            DescriptionTextEdit.AttachSlider(DescriptionSlider);
            DescriptionTextEdit.CurrentText = DefaultAvatarDescription;
            DescriptionTextEdit.OnChange   += DescriptionTextEdit_OnChange;

            NameTextEdit.OnChange   += new ChangeDelegate(NameTextEdit_OnChange);
            NameTextEdit.CurrentText = GlobalSettings.Default.LastUser;

            AcceptButton.Disabled       = NameTextEdit.CurrentText.Length == 0;
            AcceptButton.OnButtonClick += new ButtonClickDelegate(AcceptButton_OnButtonClick);

            /** Appearance **/
            SkinLightButton.OnButtonClick  += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SkinMediumButton.OnButtonClick += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SkinDarkButton.OnButtonClick   += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SelectedAppearanceButton        = SkinLightButton;

            m_HeadSkinBrowser           = ui.Create <UICollectionViewer>("HeadSkinBrowser");
            m_HeadSkinBrowser.OnChange += new ChangeDelegate(HeadSkinBrowser_OnChange);
            m_HeadSkinBrowser.Init();
            Add(m_HeadSkinBrowser);

            m_BodySkinBrowser           = ui.Create <UICollectionViewer>("BodySkinBrowser");
            m_BodySkinBrowser.OnChange += new ChangeDelegate(BodySkinBrowser_OnChange);
            m_BodySkinBrowser.Init();
            Add(m_BodySkinBrowser);

            FemaleButton.OnButtonClick += new ButtonClickDelegate(GenderButton_OnButtonClick);
            MaleButton.OnButtonClick   += new ButtonClickDelegate(GenderButton_OnButtonClick);

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

            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;

            var offset = new Vector2(0, 0);

            if (BackgroundImageDialog != null)
            {
                offset = new Vector2(112, 84);

                AddAt(1, new UIImage(BackgroundImageDialog)
                {
                    X = 112,
                    Y = 84
                });
            }

            /**
             * Music
             */
            HIT.HITVM.Get.PlaySoundEvent(UIMusic.CAS);

            SimBox = new UISim
            {
                Position   = new Vector2(offset.X + 70, offset.Y + 88),
                Size       = new Vector2(140, 200),
                AutoRotate = true
            };
            Add(SimBox);

            /**
             * Init state
             */

            if (GlobalSettings.Default.DebugGender)
            {
                Gender = Gender.Male;
                MaleButton.Selected   = true;
                FemaleButton.Selected = false;
            }
            else
            {
                Gender = Gender.Female;
                MaleButton.Selected   = false;
                FemaleButton.Selected = true;
            }

            AppearanceType = (AppearanceType)GlobalSettings.Default.DebugSkin;

            SkinLightButton.Selected  = false;
            SkinMediumButton.Selected = false;
            SkinDarkButton.Selected   = false;

            switch (AppearanceType)
            {
            case AppearanceType.Light:
                SkinLightButton.Selected = true; break;

            case AppearanceType.Medium:
                SkinMediumButton.Selected = true; break;

            case AppearanceType.Dark:
                SkinDarkButton.Selected = true; break;
            }

            RefreshCollections();

            SearchCollectionForInitID(GlobalSettings.Default.DebugHead, GlobalSettings.Default.DebugBody);

            FSO.UI.Model.DiscordRpcEngine.SendFSOPresence("In Create A Sim");

            GameThread.NextUpdate(x =>
            {
                FSOFacade.Hints.TriggerHint("screen:cas");
            });
        }
        public PersonSelectionEdit()
        {
            /**
             * Data
             */
            MaleHeads   = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_male_heads));
            MaleOutfits = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_male));

            FemaleHeads   = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_female_heads));
            FemaleOutfits = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_female));

            /**
             * UI
             */

            UIScript ui = null;

            if (GlobalSettings.Default.ScaleUI)
            {
                ui = this.RenderScript("personselectionedit.uis");
                this.Scale800x600 = true;
            }
            else
            {
                ui = this.RenderScript("personselectionedit" + (ScreenWidth == 1024 ? "1024" : "") + ".uis");
            }

            m_ExitButton = (UIButton)ui["ExitButton"];
            m_ExitButton.OnButtonClick += new ButtonClickDelegate(m_ExitButton_OnButtonClick);

            DescriptionTextEdit.CurrentText = ui.GetString("DefaultAvatarDescription");
            DescriptionSlider.AttachButtons(DescriptionScrollUpButton, DescriptionScrollDownButton, 1);
            DescriptionTextEdit.AttachSlider(DescriptionSlider);
            NameTextEdit.OnChange += new ChangeDelegate(NameTextEdit_OnChange);

            AcceptButton.Disabled       = true;
            AcceptButton.OnButtonClick += new ButtonClickDelegate(AcceptButton_OnButtonClick);

            /** Appearance **/
            SkinLightButton.OnButtonClick  += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SkinMediumButton.OnButtonClick += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SkinDarkButton.OnButtonClick   += new ButtonClickDelegate(SkinButton_OnButtonClick);
            SelectedAppearanceButton        = SkinLightButton;
            SkinLightButton.Selected        = true;

            m_HeadSkinBrowser           = ui.Create <UICollectionViewer>("HeadSkinBrowser");
            m_HeadSkinBrowser.OnChange += new ChangeDelegate(HeadSkinBrowser_OnChange);
            m_HeadSkinBrowser.Init();
            this.Add(m_HeadSkinBrowser);

            m_BodySkinBrowser           = ui.Create <UICollectionViewer>("BodySkinBrowser");
            m_BodySkinBrowser.OnChange += new ChangeDelegate(BodySkinBrowser_OnChange);
            m_BodySkinBrowser.Init();
            this.Add(m_BodySkinBrowser);

            FemaleButton.OnButtonClick += new ButtonClickDelegate(GenderButton_OnButtonClick);
            MaleButton.OnButtonClick   += new ButtonClickDelegate(GenderButton_OnButtonClick);

            /** Backgrounds **/
            var bg = new UIImage(BackgroundImage);

            this.AddAt(0, bg);

            var offset = new Vector2(0, 0);

            if (BackgroundImageDialog != null)
            {
                offset = new Vector2(112, 84);

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

            /**
             * Music
             */
            PlayBackgroundMusic(
                new string[] { GlobalSettings.Default.StartupPath + "\\music\\modes\\create\\tsocas1_v2.mp3" }
                );

            //GUID can be empty here, because when a character is created, the GUID is assigned by the server.
            SimBox = new UISim("");

            if (GlobalSettings.Default.ScaleUI)
            {
                SimBox.SimScale = 0.8f;
                SimBox.Position = new Microsoft.Xna.Framework.Vector2(offset.X + 140, offset.Y + 130);
            }
            else
            {
                SimBox.SimScale = 0.5f;
                SimBox.Position = new Microsoft.Xna.Framework.Vector2(offset.X + 140, offset.Y + 260);
            }

            SimBox.AutoRotate = true;
            this.Add(SimBox);

            /**
             * Init state
             */
            RefreshCollections();

            m_HeadSkinBrowser.SelectedIndex = 0;
            m_BodySkinBrowser.SelectedIndex = 0;
            FemaleButton.Selected           = true;

            NetworkFacade.Controller.OnCharacterCreationProgress += new OnCharacterCreationProgressDelegate(Controller_OnCharacterCreationStatus);
        }
Beispiel #29
0
        public PersonSelection()
        {
            UIScript ui = null;

            if (GlobalSettings.Default.ScaleUI)
            {
                ui = this.RenderScript("personselection.uis");
                this.Scale800x600 = true;
            }
            else
            {
                ui = this.RenderScript("personselection" + (ScreenWidth == 1024 ? "1024" : "") + ".uis");
            }

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

            var numSlots = 3;

            m_PersonSlots = new List <PersonSlot>();

            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 < NetworkFacade.Avatars.Count)
                {
                    personSlot.DisplayAvatar(NetworkFacade.Avatars[i]);
                    personSlot.AvatarButton.OnButtonClick += new ButtonClickDelegate(AvatarButton_OnButtonClick);

                    var SimBox = new UISim(NetworkFacade.Avatars[i].GUID);

                    SimBox.Avatar.Body       = NetworkFacade.Avatars[i].Body;
                    SimBox.Avatar.Head       = NetworkFacade.Avatars[i].Head;
                    SimBox.Avatar.Handgroup  = NetworkFacade.Avatars[i].Body;
                    SimBox.Avatar.Appearance = NetworkFacade.Avatars[i].Avatar.Appearance;

                    SimBox.Position = m_PersonSlots[i].AvatarButton.Position + new Vector2(70, (m_PersonSlots[i].AvatarButton.Size.Y - 35));
                    SimBox.Size     = m_PersonSlots[i].AvatarButton.Size;

                    SimBox.Name = NetworkFacade.Avatars[i].Name;

                    m_UISims.Add(SimBox);
                    this.Add(SimBox);
                }
            }

            this.AddAt(0, new UIImage(BackgroundImage));
            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
             */
            var tracks = new string[] {
                GlobalSettings.Default.StartupPath + "\\music\\modes\\select\\tsosas1_v2.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\select\\tsosas2_v2.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\select\\tsosas3.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\select\\tsosas4.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\select\\tsosas5.mp3"
            };

            PlayBackgroundMusic(
                tracks
                );

            NetworkFacade.Controller.OnCityToken           += new OnCityTokenDelegate(Controller_OnCityToken);
            NetworkFacade.Controller.OnCharacterRetirement += new OnCharacterRetirementDelegate(Controller_OnCharacterRetirement);
        }
        public UIGizmo()
        {
            var ui = this.RenderScript("gizmo.uis");

            BackgroundImageGizmo = ui.Create <UIImage>("BackgroundImageGizmo");
            this.AddAt(0, BackgroundImageGizmo);

            BackgroundImageGizmoPanel = ui.Create <UIImage>("BackgroundImageGizmoPanel");
            this.AddAt(0, BackgroundImageGizmoPanel);

            BackgroundImagePanel = ui.Create <UIImage>("BackgroundImagePanel");
            this.AddAt(0, BackgroundImagePanel);

            UIUtils.MakeDraggable(BackgroundImageGizmo, this);
            UIUtils.MakeDraggable(BackgroundImageGizmoPanel, this);
            UIUtils.MakeDraggable(BackgroundImagePanel, this);

            ButtonContainer = new UIContainer();
            this.Remove(ExpandButton);
            ButtonContainer.Add(ExpandButton);
            this.Remove(ContractButton);
            ButtonContainer.Add(ContractButton);
            this.Remove(FiltersButton);
            ButtonContainer.Add(FiltersButton);
            this.Remove(SearchButton);
            ButtonContainer.Add(SearchButton);
            this.Remove(Top100ListsButton);
            ButtonContainer.Add(Top100ListsButton);
            this.Add(ButtonContainer);

            FiltersProperty         = new UIGizmoPropertyFilters(ui, this);
            FiltersProperty.Visible = false;
            this.Add(FiltersProperty);

            Search         = new UIGizmoSearch(ui, this);
            Search.Visible = false;
            this.Add(Search);

            Top100         = new UIGizmoTop100(ui, this);
            Top100.Visible = false;
            this.Add(Top100);

            ExpandButton.OnButtonClick   += new ButtonClickDelegate(ExpandButton_OnButtonClick);
            ContractButton.OnButtonClick += new ButtonClickDelegate(ContractButton_OnButtonClick);

            PeopleTabButton.OnButtonClick += new ButtonClickDelegate(PeopleTabButton_OnButtonClick);
            HousesTabButton.OnButtonClick += new ButtonClickDelegate(HousesTabButton_OnButtonClick);

            FiltersButton.OnButtonClick     += new ButtonClickDelegate(FiltersButton_OnButtonClick);
            SearchButton.OnButtonClick      += new ButtonClickDelegate(SearchButton_OnButtonClick);
            Top100ListsButton.OnButtonClick += new ButtonClickDelegate(Top100ListsButton_OnButtonClick);

            SimBox = new UISim();
            var sim       = new Sim(Guid.NewGuid().ToString());
            var maleHeads = new Collection(ContentManager.GetResourceFromLongID((ulong)FileIDs.CollectionsFileIDs.ea_male_heads));

            SimCatalog.LoadSim3D(sim, SimCatalog.GetOutfit(4462471020557), AppearanceType.Light);

            SimBox.Sim      = sim;
            SimBox.SimScale = 0.4f;
            SimBox.Position = new Microsoft.Xna.Framework.Vector2(60, 60);

            this.Add(SimBox);

            SetOpen(false);
        }