public Texture2D GetLotThumbnail(string shardName, uint lotId) { //might reintroduce the cache at some point, though with the thumbnails behind cloudflare it's likely not an issue for now. var shard = LoginRegulator.Shards.GetByName(shardName); var shardKey = CacheKey.For("shards", shard.Id); var thumbKey = CacheKey.Combine(shardKey, "lot_thumbs", lotId); if (Cache.ContainsKey(thumbKey)) { try { var thumbData = Cache.Get <byte[]>(thumbKey).Result; var thumb = ImageLoader.FromStream(GameFacade.GraphicsDevice, new MemoryStream(thumbData)); return(thumb); }catch (Exception ex) { //Handles cases where the cache file got corrupted var thumb = TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, GameFacade.GameFilePath("userdata/houses/defaulthouse.bmp")); TextureUtils.ManualTextureMask(ref thumb, new uint[] { 0xFF000000 }); return(thumb); } } else { var thumb = TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, GameFacade.GameFilePath("userdata/houses/defaulthouse.bmp")); TextureUtils.ManualTextureMask(ref thumb, new uint[] { 0xFF000000 }); return(thumb); } }
/// <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); }
public TerrainComponent(HouseRenderState state) { var textureBase = GameFacade.GameFilePath("gamedata/terrain/newformat/"); var grass = Texture2D.FromFile(GameFacade.GraphicsDevice, Path.Combine(textureBase, "gr.tga")); Texture = grass; Effect = new BasicEffect(GameFacade.GraphicsDevice, null); Effect.TextureEnabled = true; Effect.Texture = Texture; Geom = new VertexPositionTexture[4]; var repeatX = state.Size / 2.5f; var repeatY = repeatX; var tl = state.GetWorldFromTile(new Vector2(1, 1)); var tr = state.GetWorldFromTile(new Vector2(state.Size - 1, 1)); var bl = state.GetWorldFromTile(new Vector2(1, state.Size - 1)); var br = state.GetWorldFromTile(new Vector2(state.Size - 1, state.Size - 1)); Geom[0] = new VertexPositionTexture(tl, new Vector2(0, 0)); Geom[1] = new VertexPositionTexture(tr, new Vector2(repeatX, 0)); Geom[2] = new VertexPositionTexture(br, new Vector2(repeatX, repeatY)); Geom[3] = new VertexPositionTexture(bl, new Vector2(0, repeatY)); }
public LotThumbContent() { GameThread.SetInterval(Update, 1000); Client = new ApiClient(ApiClient.CDNUrl ?? GlobalSettings.Default.GameEntryUrl); DefaultThumb = TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, GameFacade.GameFilePath("userdata/houses/defaulthouse.bmp")); TextureUtils.ManualTextureMask(ref DefaultThumb, new uint[] { 0xFF000000 }); }
/// <summary> /// Handle when a user selects a city /// </summary> /// <param name="element"></param> void CityListBox_OnChange(UIElement element) { var selectedItem = CityListBox.SelectedItem; if (selectedItem == null) { return; } var city = (ShardStatusItem)selectedItem.Data; String gamepath = GameFacade.GameFilePath(""); var fsoMap = int.Parse(city.Map) >= 100; var cityThumb = fsoMap ? Path.Combine(FSOEnvironment.ContentDir, "Cities/city_" + city.Map + "/thumbnail.png") : GameFacade.GameFilePath("cities/city_" + city.Map + "/thumbnail.bmp"); //Take a copy so we dont change the original when we alpha mask it Texture2D cityThumbTex = TextureUtils.Copy(GameFacade.GraphicsDevice, TextureUtils.TextureFromFile( GameFacade.GraphicsDevice, cityThumb)); TextureUtils.CopyAlpha(ref cityThumbTex, thumbnailAlphaImage); CityThumb.Texture = cityThumbTex; DescriptionText.CurrentText = GameFacade.Strings.GetString(fsoMap?"f104":"238", int.Parse(city.Map).ToString()); DescriptionText.VerticalScrollPosition = 0; /** Validate **/ var isValid = true; if (city.Status == ShardStatus.Frontier) { isValid = false; /** Already have a sim in this city **/ ShowCityErrorDialog(CityReservedDialogTitle, CityReservedDialogMessage); } else if (city.Status == ShardStatus.Full) { isValid = false; /** City is full **/ ShowCityErrorDialog(CityFullDialogTitle, CityFullDialogMessage); } else if (city.Status == ShardStatus.Busy) { isValid = false; /** City is busy **/ ShowCityErrorDialog(CityBusyDialogTitle, CityBusyDialogMessage); } OkButton.Disabled = !isValid; }
/// <summary> /// Handle when a user selects a city /// </summary> /// <param name="element"></param> private void CityListBox_OnChange(UIElement element) { var selectedItem = CityListBox.SelectedItem; if (selectedItem == null) { return; } var city = (CityInfo)selectedItem.Data; String gamepath = GameFacade.GameFilePath(""); int CityNum = GameFacade.GetCityNumber(city.Name); string CityStr = gamepath + "cities/" + ((CityNum >= 10) ? "city_00" + CityNum.ToString() : "city_000" + CityNum.ToString()); //Take a copy so we dont change the original when we alpha mask it var stream = new FileStream(CityStr + "/Thumbnail.bmp", FileMode.Open, FileAccess.Read, FileShare.Read); Texture2D cityThumbTex = TextureUtils.Copy(GameFacade.GraphicsDevice, ImageLoader.FromStream( GameFacade.Game.GraphicsDevice, stream)); TextureUtils.CopyAlpha(ref cityThumbTex, thumbnailAlphaImage); stream.Close(); CityThumb.Texture = cityThumbTex; DescriptionText.CurrentText = city.Description; DescriptionText.VerticalScrollPosition = 0; /** Validate **/ var isValid = true; if (city.Status == CityInfoStatus.Reserved) { isValid = false; /** Already have a sim in this city **/ ShowCityErrorDialog(CityReservedDialogTitle, CityReservedDialogMessage); } else if (city.Status == CityInfoStatus.Full) { isValid = false; /** City is full **/ ShowCityErrorDialog(CityFullDialogTitle, CityFullDialogMessage); } else if (city.Status == CityInfoStatus.Busy) { isValid = false; /** City is busy **/ ShowCityErrorDialog(CityBusyDialogTitle, CityBusyDialogMessage); } OkButton.Disabled = !isValid; }
/// <summary> /// Display an avatar /// </summary> /// <param name="avatar"></param> public void DisplayAvatar(AvatarData avatar) { this.Avatar = avatar; var isUsed = avatar != null; SetSlotAvailable(!isUsed); if (avatar == null) { return; } PersonNameText.Caption = avatar.Name; //PersonDescriptionText.CurrentText = avatar.Description; AvatarButton.Texture = Screen.SimSelectButtonImage; var shard = Screen.LoginRegulator.Shards.All.First(x => x.Name == avatar.ShardName); CityNameText.Caption = shard.Name; if (avatar.LotId.HasValue && avatar.LotName != null) { HouseNameText.Caption = avatar.LotName; HouseThumb.Texture = Screen.GetLotThumbnail(avatar.ShardName, avatar.LotLocation.Value); HouseThumb.Y += HouseThumb.Size.Y / 2; HouseThumb.SetSize(HouseThumb.Size.X, (int)(HouseThumb.Size.X * ((double)HouseThumb.Texture.Height / HouseThumb.Texture.Width))); HouseThumb.Y -= HouseThumb.Size.Y / 2; } var cityThumb = (int.Parse(shard.Map) >= 100)? Path.Combine(FSOEnvironment.ContentDir, "Cities/city_" + shard.Map + "/thumbnail.png") : GameFacade.GameFilePath("cities/city_" + shard.Map + "/thumbnail.bmp"); Texture2D cityThumbTex = TextureUtils.Resize( GameFacade.GraphicsDevice, TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, cityThumb), 78, 58); TextureUtils.CopyAlpha(ref cityThumbTex, Screen.CityHouseButtonAlpha); CityThumb.Texture = cityThumbTex; SetTab(PersonSlotTab.EnterTab); Sim.Avatar.Appearance = (AppearanceType)Enum.Parse(typeof(AppearanceType), avatar.AppearanceType.ToString()); Sim.Avatar.BodyOutfitId = avatar.BodyOutfitID; Sim.Avatar.HeadOutfitId = avatar.HeadOutfitID; Sim.Visible = true; PersonDescriptionText.CurrentText = avatar.Description; }
private void SaveHouseButton_OnButtonClick(UIElement button) { if (vm == null) { return; } var exporter = new VMWorldExporter(); exporter.SaveHouse(vm, GameFacade.GameFilePath("housedata/blueprints/house_00.xml")); }
public LotThumbContent() { GameThread.SetInterval(Update, 1000); Client = new ApiClient(ApiClient.CDNUrl ?? GlobalSettings.Default.GameEntryUrl); DefaultThumb = TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, GameFacade.GameFilePath("userdata/houses/defaulthouse.bmp")); using (var strm = File.Open("Content/3D/defaulthouse.fsof", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { DefaultFSOF = new FSOF(); DefaultFSOF.Read(strm); DefaultFSOF.LoadGPU(GameFacade.GraphicsDevice); } TextureUtils.ManualTextureMask(ref DefaultThumb, new uint[] { 0xFF000000 }); }
public LotDebugScreen() { var lotInfo = XmlHouseData.Parse(GameFacade.GameFilePath("housedata/blueprints/restaurant01_00.xml")); World = new World(GameFacade.Game.GraphicsDevice); GameFacade.Scenes.Add(World); vm = new TSO.Simantics.VM(new VMContext(World)); vm.Init(); var activator = new VMWorldActivator(vm, World); var blueprint = activator.LoadFromXML(lotInfo); World.InitBlueprint(blueprint); vm.Context.Blueprint = blueprint; var sim = activator.CreateAvatar(); //sim.Position = new Vector3(31.5f, 55.5f, 0.0f); sim.Position = new Vector3(26.5f, 41.5f, 0.0f); VMDebug = new UIButton() { Caption = "Simantics", Y = 45, Width = 100, X = GlobalSettings.Default.GraphicsWidth - 110 }; VMDebug.OnButtonClick += new ButtonClickDelegate(VMDebug_OnButtonClick); this.Add(VMDebug); LotController = new UILotControl(vm, World); this.AddAt(0, LotController); ucp = new UIUCP(this); ucp.Y = ScreenHeight - 210; ucp.SetInLot(true); ucp.SetMode(UIUCP.UCPMode.LotMode); ucp.SelectedAvatar = sim; ucp.SetPanel(1); //ucp.ZoomLevel = 1; //ucp.OnZoomChanged += new UCPZoomChangeEvent(ucp_OnZoomChanged); //ucp.OnRotateChanged += new UCPRotateChangeEvent(ucp_OnRotateChanged); this.Add(ucp); }
public EALogo() : base() { PlayBackgroundMusic(new string[] { GameFacade.GameFilePath("music\\stations\\latin\\latin3_7df26b84.mp3") }); /** * Scale the whole screen to 1024 */ BackgroundCtnr = new UIContainer(); BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = GlobalSettings.Default.GraphicsWidth / 800.0f; /** Background image **/ m_EALogo = new UIImage(GetTexture((ulong)FileIDs.UIFileIDs.eagames)); BackgroundCtnr.Add(m_EALogo); this.Add(BackgroundCtnr); m_CheckProgressTimer = new Timer(); m_CheckProgressTimer.Interval = 5000; m_CheckProgressTimer.Elapsed += new ElapsedEventHandler(m_CheckProgressTimer_Elapsed); m_CheckProgressTimer.Start(); }
private void SaveHouseButton_OnButtonClick(UIElement button) { if (vm == null) { return; } var exporter = new VMWorldExporter(); exporter.SaveHouse(vm, GameFacade.GameFilePath("housedata/blueprints/house_00.xml")); var marshal = vm.Save(); Directory.CreateDirectory(Path.Combine(FSOEnvironment.UserDir, "LocalHouse/")); using (var output = new FileStream(Path.Combine(FSOEnvironment.UserDir, "LocalHouse/house_00.fsov"), FileMode.Create)) { marshal.SerializeInto(new BinaryWriter(output)); } if (vm.GlobalLink != null) { ((VMTSOGlobalLinkStub)vm.GlobalLink).Database.Save(); } }
public void InitTestLot() { var lotInfo = XmlHouseData.Parse(GameFacade.GameFilePath("housedata/blueprints/restaurant08_00.xml")); World = new World(GameFacade.Game.GraphicsDevice); GameFacade.Scenes.Add(World); vm = new TSO.Simantics.VM(new VMContext(World)); vm.Init(); var activator = new VMWorldActivator(vm, World); var blueprint = activator.LoadFromXML(lotInfo); World.InitBlueprint(blueprint); vm.Context.Blueprint = blueprint; var sim = activator.CreateAvatar(); sim.Position = new Vector3(26.5f, 41.5f, 0.0f); var sim2 = activator.CreateAvatar(); sim2.Position = new Vector3(27.5f, 41.5f, 0.0f); LotController = new UILotControl(vm, World); this.AddAt(0, LotController); vm.Context.Clock.Hours = 6; ucp.SelectedAvatar = sim; ucp.SetInLot(true); if (m_ZoomLevel > 3) { World.Visible = false; } }
public void LoadContent(GraphicsDevice gd, int cityNumber) { String gamepath = GameFacade.GameFilePath(""); string CityStr = "city_" + cityNumber.ToString("0000"); string ext = "bmp"; if (cityNumber >= 100) { //start FSO cities //the first few will be client included //probably after 200 will be inherited from content packs, when they are implemented ext = "png"; CityStr = Path.Combine(FSOEnvironment.ContentDir, "Cities/", CityStr); } else { CityStr = gamepath + "cities/" + CityStr; } VertexColor = LoadTex(CityStr + "/vertexcolor." + ext); MapData = new CityMapData(); MapData.Load(CityStr, LoadTex, ext); //special tuning from server var terrainTuning = DynamicTuning.Global?.GetTable("city", 0); float forceSnow = 0f; if (terrainTuning != null && terrainTuning.TryGetValue(0, out forceSnow)) { ForceSnow(forceSnow); } var terrainpath = "Content/Textures/terrain/"; //grass, sand, rock, snow, water if (forceSnow == 2) { TerrainTextures[0] = RTToMip(LoadTex(terrainpath + "autumn.png"), gd); } else { TerrainTextures[0] = RTToMip(LoadTex(gamepath + "gamedata/terrain/newformat/gr.tga"), gd); } TerrainTextures[1] = RTToMip(LoadTex(gamepath + "gamedata/terrain/newformat/sd.tga"), gd); TerrainTextures[2] = RTToMip(LoadTex(gamepath + "gamedata/terrain/newformat/rk.tga"), gd); TerrainTextures[3] = RTToMip(LoadTex(gamepath + "gamedata/terrain/newformat/sn.tga"), gd); TerrainTextures[4] = RTToMip(LoadTex(gamepath + "gamedata/terrain/newformat/wt.tga"), gd); Forest = LoadTex(gamepath + "gamedata/farzoom/forest00a.tga"); DefaultHouse = LoadTex(gamepath + "userdata/houses/defaulthouse.bmp");//, new TextureCreationParameters(128, 64, 24, 0, SurfaceFormat.Rgba32, TextureUsage.Linear, Color.Black, FilterOptions.None, FilterOptions.None)); //Can crash on some setups on dx11? TextureUtils.ManualTextureMaskSingleThreaded(ref DefaultHouse, new uint[] { new Color(0x00, 0x00, 0x00, 0xFF).PackedValue }); LotOnline = UIElement.GetTexture(0x0000032F00000001); LotOffline = UIElement.GetTexture(0x0000033100000001); //fills used for line drawing WhiteLine = TextureUtils.TextureFromColor(GameFacade.GraphicsDevice, Color.White); stpWhiteLine = TextureUtils.TextureFromColor(GameFacade.GraphicsDevice, new Color(255, 255, 255, 128)); string Num; TransA = new Texture2D[30]; for (int x = 0; x < 30; x = x + 2) { Num = (x / 2).ToString().PadLeft(2, '0'); TransA[x] = LoadTex(gamepath + "gamedata/terrain/newformat/transa" + Num + "a.tga"); TransA[x + 1] = LoadTex(gamepath + "gamedata/terrain/newformat/transa" + Num + "b.tga"); } TransB = new Texture2D[30]; for (int x = 0; x < 30; x = x + 2) { Num = (x / 2).ToString().PadLeft(2, '0'); TransB[x] = LoadTex(gamepath + "gamedata/terrain/newformat/transb" + Num + "a.tga"); TransB[x + 1] = LoadTex(gamepath + "gamedata/terrain/newformat/transb" + Num + "b.tga"); } //TODO: optionally load non-freeso textures Roads = new Texture2D[16]; for (int x = 0; x < 16; x++) { Num = (x).ToString().PadLeft(2, '0'); Roads[x] = LoadTex(terrainpath + "road" + Num + ".png"); } RoadCorners = new Texture2D[16]; for (int x = 0; x < 16; x++) { Num = (x).ToString().PadLeft(2, '0'); RoadCorners[x] = LoadTex(terrainpath + "roadcorner" + Num + ".png"); } BigWNormal = RTToMip(LoadTex(terrainpath + "bigwnormal.jpg"), gd); SmallWNormal = RTToMip(LoadTex(terrainpath + "smallwnormal.jpg"), gd); using (var strm = new FileStream(terrainpath + "trees.png", FileMode.Open, FileAccess.Read, FileShare.Read)) { TreeTex = ImageLoader.FromStream(gd, strm); if (FSOEnvironment.EnableNPOTMip) { TreeTex = RTToMip(TreeTex, gd); } } for (int i = 0; i < 3; i++) { NeighTextures[i] = RTToMip(LoadTex("Content/Textures/" + NeighTexNames[i]), gd); } var batch = new SpriteBatch(GameFacade.GraphicsDevice); for (int i = 0; i < 4; i++) { CreateTransparencyAtlas(gd, batch, i); } CreateRoadAtlas(gd, batch); for (int x = 0; x < 30; x++) { TransA[x].Dispose(); } for (int x = 0; x < 30; x++) { TransB[x].Dispose(); } for (int x = 0; x < 16; x++) { Roads[x].Dispose(); } for (int x = 0; x < 16; x++) { RoadCorners[x].Dispose(); } }
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); }); }
public LoadingScreen() { /** * Scale the whole screen to 1024 */ BackgroundCtnr = new UIContainer(); BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = ScreenWidth / 800.0f; /** Background image **/ Background = new UIImage(GetTexture((ulong)FileIDs.UIFileIDs.setup)); BackgroundCtnr.Add(Background); //TODO: Letter spacing is a bit wrong on this label var lbl = new UILabel(); lbl.Caption = GameFacade.Strings.GetString("154", "5"); lbl.X = 0; lbl.Size = new Microsoft.Xna.Framework.Vector2(800, 100); lbl.Y = 508; var style = lbl.CaptionStyle.Clone(); style.Size = 17; lbl.CaptionStyle = style; BackgroundCtnr.Add(lbl); this.Add(BackgroundCtnr); ProgressLabel1 = new UILabel { X = 0, Y = 550, Size = new Microsoft.Xna.Framework.Vector2(800, 100), CaptionStyle = style }; ProgressLabel2 = new UILabel { X = 0, Y = 550, Size = new Microsoft.Xna.Framework.Vector2(800, 100), CaptionStyle = style }; BackgroundCtnr.Add(ProgressLabel1); BackgroundCtnr.Add(ProgressLabel2); PreloadLabels = new string[] { GameFacade.Strings.GetString("155", "6"), GameFacade.Strings.GetString("155", "7"), GameFacade.Strings.GetString("155", "8"), GameFacade.Strings.GetString("155", "9") }; CurrentPreloadLabel = 0; AnimateLabel("", PreloadLabels[0]); CheckProgressTimer = new Timer(); CheckProgressTimer.Interval = 5; CheckProgressTimer.Elapsed += new ElapsedEventHandler(CheckProgressTimer_Elapsed); CheckProgressTimer.Start(); PlayBackgroundMusic(new string[] { GameFacade.GameFilePath("music\\stations\\latin\\latin3_7df26b84.mp3") }); //GameFacade.Screens.Tween.To(rect, 10.0f, new Dictionary<string, float>() { // {"X", 500.0f} //}, TweenQuad.EaseInOut); }
public UILotPage() { var script = RenderScript("housepage.uis"); BackgroundNumOccupantsImage = script.Create <UIImage>("BackgroundNumOccupantsImage"); AddAt(0, BackgroundNumOccupantsImage); BackgroundHouseCategoryThumbImage = script.Create <UIImage>("BackgroundHouseCategoryThumbImage"); AddAt(0, BackgroundHouseCategoryThumbImage); BackgroundHouseLeaderThumbImage = script.Create <UIImage>("BackgroundHouseLeaderThumbImage"); AddAt(0, BackgroundHouseLeaderThumbImage); BackgroundDescriptionEditImage = script.Create <UIImage>("BackgroundDescriptionEditImage"); AddAt(0, BackgroundDescriptionEditImage); BackgroundDescriptionImage = script.Create <UIImage>("BackgroundDescriptionImage"); AddAt(0, BackgroundDescriptionImage); BackgroundContractedImage = new UIImage(); BackgroundContractedImage.Texture = ContractedBackgroundImage; this.AddAt(0, BackgroundContractedImage); BackgroundExpandedImage = new UIImage(); BackgroundExpandedImage.Texture = ExpandedBackgroundImage; this.AddAt(0, BackgroundExpandedImage); ContractButton.OnButtonClick += (x) => Open = false; ExpandButton.OnButtonClick += (x) => Open = true; ExpandedCloseButton.OnButtonClick += Close; ContractedCloseButton.OnButtonClick += Close; LotThumbnail = script.Create <UILotThumbButton>("HouseThumbSetup"); LotThumbnail.Init(RoommateThumbButtonImage, VisitorThumbButtonImage); DefaultThumb = TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, GameFacade.GameFilePath("userdata/houses/defaulthouse.bmp")); TextureUtils.ManualTextureMask(ref DefaultThumb, new uint[] { 0xFF000000 }); LotThumbnail.SetThumbnail(DefaultThumb, 0); Add(LotThumbnail); RoommateList = script.Create <UIRoommateList>("RoommateList"); Add(RoommateList); SkillGameplayLabel = new UIClickableLabel(); SkillGameplayLabel.Position = RoommateList.Position + new Vector2(-1, 24); SkillGameplayLabel.Size = new Vector2(180, 18); SkillGameplayLabel.Alignment = TextAlignment.Center; SkillGameplayLabel.OnButtonClick += SkillGameplayLabel_OnButtonClick; SkillGameplayLabel.CaptionStyle = SkillGameplayLabel.CaptionStyle.Clone(); SkillGameplayLabel.CaptionStyle.Size = 9; Add(SkillGameplayLabel); OwnerButton = script.Create <UIPersonButton>("HouseLeaderThumbSetup"); OwnerButton.FrameSize = UIPersonButtonSize.LARGE; Add(OwnerButton); /** Drag **/ UIUtils.MakeDraggable(BackgroundContractedImage, this, true); UIUtils.MakeDraggable(BackgroundExpandedImage, this, true); /** Description scroll **/ HouseDescriptionSlider.AttachButtons(HouseDescriptionScrollUpButton, HouseDescriptionScrollDownButton, 1); HouseDescriptionTextEdit.AttachSlider(HouseDescriptionSlider); HouseLinkButton.OnButtonClick += JoinLot; HouseCategoryButton.OnButtonClick += ChangeCategory; HouseNameButton.OnButtonClick += ChangeName; LotThumbnail.OnLotClick += JoinLot; NeighborhoodNameButton.OnButtonClick += (btn) => { if (CurrentLot != null && CurrentLot.Value != null && CurrentLot.Value.Lot_NeighborhoodID != 0) { FindController <CoreGameScreenController>().ShowNeighPage(CurrentLot.Value.Lot_NeighborhoodID); } }; var ui = Content.Content.Get().CustomUI; HouseCategory_CommunityButtonImage = ui.Get("lotp_community_small.png").Get(GameFacade.GraphicsDevice); CurrentLot = new Binding <Lot>() .WithBinding(HouseNameButton, "Caption", "Lot_Name") .WithBinding(NeighborhoodNameButton, "Caption", "Lot_NeighborhoodName") .WithBinding(HouseValueLabel, "Caption", "Lot_Price", x => MoneyFormatter.Format((uint)x)) .WithBinding(OccupantsNumberLabel, "Caption", "Lot_NumOccupants", x => x.ToString()) .WithBinding(OwnerButton, "AvatarId", "Lot_LeaderID") .WithBinding(HouseCategoryButton, "Texture", "Lot_Category", x => { var category = (LotCategory)Enum.Parse(typeof(LotCategory), x.ToString()); switch (category) { case LotCategory.none: return(HouseCategory_NoCategoryButtonImage); case LotCategory.welcome: return(HouseCategory_WelcomeButtonImage); case LotCategory.money: return(HouseCategory_MoneyButtonImage); case LotCategory.entertainment: return(HouseCategory_EntertainmentButtonImage); case LotCategory.games: return(HouseCategory_GamesButtonImage); case LotCategory.offbeat: return(HouseCategory_OffbeatButtonImage); case LotCategory.residence: return(HouseCategory_ResidenceButtonImage); case LotCategory.romance: return(HouseCategory_RomanceButtonImage); case LotCategory.services: return(HouseCategory_ServicesButtonImage); case LotCategory.shopping: return(HouseCategory_ShoppingButtonImage); case LotCategory.skills: return(HouseCategory_SkillsButtonImage); case LotCategory.community: return(HouseCategory_CommunityButtonImage); default: return(HouseCategory_CommunityButtonImage); } }).WithBinding(HouseCategoryButton, "Position", "Lot_Category", x => { return(new Vector2(69 + 11 - HouseCategoryButton.Texture.Width / 8, 164 + 11 - HouseCategoryButton.Texture.Height / 2)); }) .WithMultiBinding(x => RefreshUI(), "Lot_LeaderID", "Lot_IsOnline", "Lot_Thumbnail", "Lot_Description", "Lot_RoommateVec"); RefreshUI(); //NeighborhoodNameButton.Visible = false; Size = BackgroundExpandedImage.Size.ToVector2(); SendToFront(ExpandButton, ContractButton); }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public void Initialize() { //RenderTarget = RenderTargetUtils.CreateRenderTarget(game.GraphicsDevice, 1, SurfaceFormat.Color, 800, 600); /** Load the terrain effect **/ effect = GameFacade.Game.Content.Load <Effect>("Effects/TerrainSplat"); /** Setup **/ //SetCity("0020"); SetCity("0013"); //transX = -(City.Width * Geom.CellWidth / 2); //transY = +(City.Height / 2 * Geom.CellHeight / 2); /** * Setup terrain texture */ var device = GameFacade.GraphicsDevice; var textureBase = GameFacade.GameFilePath("gamedata/terrain/newformat/"); var grass = Texture2D.FromFile(device, Path.Combine(textureBase, "gr.tga")); var rock = Texture2D.FromFile(device, Path.Combine(textureBase, "rk.tga")); var snow = Texture2D.FromFile(device, Path.Combine(textureBase, "sn.tga")); var sand = Texture2D.FromFile(device, Path.Combine(textureBase, "sd.tga")); var water = Texture2D.FromFile(device, Path.Combine(textureBase, "wt.tga")); TextureTerrain = TextureUtils.MergeHorizontal(device, grass, snow, sand, rock, water); TextureGrass = grass; TextureSand = sand; TextureSnow = snow; TextureRock = rock; TextureWater = water; effect.Parameters["xTextureBlend"].SetValue(TextureBlend); effect.Parameters["xTextureTerrain"].SetValue(TextureTerrain); /** Dont need these anymore **/ //grass.Dispose(); //rock.Dispose(); //snow.Dispose(); //sand.Dispose(); //water.Dispose(); /** * Setup alpha map texture */ /** Construct a single texture out of the alpha maps **/ Texture2D[] alphaMaps = new Texture2D[15]; for (var t = 0; t < 15; t++) { var index = t.ToString(); if (t < 10) { index = "0" + index; } alphaMaps[t] = Texture2D.FromFile(device, Path.Combine(textureBase, "transb" + index + "b.tga")); } /** We add an extra 64px so that the last slot in the sheet is a solid color aka no blending **/ TextureBlend = TextureUtils.MergeHorizontal(device, 64, alphaMaps); alphaMaps.ToList().ForEach(x => x.Dispose()); effect.Parameters["xTextureBlend"].SetValue(TextureBlend); effect.Parameters["xTextureTerrain"].SetValue(TextureTerrain); //TextureBlend.Save(@"C:\Users\Admin\Desktop\blendBB.jpg", ImageFileFormat.Jpg); }
public void SetCity(string code) { //currentCity = code; City = CityData.Load(GameFacade.GraphicsDevice, GameFacade.GameFilePath("cities/city_" + code + "/")); RecalculateGeometry(); }
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); }
public LotDebugScreen() { var lotInfo = XmlHouseData.Parse(GameFacade.GameFilePath("housedata/blueprints/restaurant01_00.xml")); World = new World(GameFacade.Game.GraphicsDevice); GameFacade.Scenes.Add(World); vm = new tso.simantics.VM(new VMContext(World)); vm.Init(); var activator = new VMWorldActivator(vm, World); var blueprint = activator.LoadFromXML(lotInfo); World.InitBlueprint(blueprint); vm.Context.Blueprint = blueprint; var sim = activator.CreateAvatar(); //sim.Position = new Vector3(31.5f, 55.5f, 0.0f); sim.Position = new Vector3(26.5f, 41.5f, 0.0f); VMDebug = new UIButton() { Caption = "Simantics", Y = 45, Width = 100, X = GlobalSettings.Default.GraphicsWidth - 110 }; VMDebug.OnButtonClick += new ButtonClickDelegate(VMDebug_OnButtonClick); this.Add(VMDebug); //var lotInfo = HouseData.Parse("C:\\restaurant00_00_small.xml"); //for (int i = 1; i < 64; i++) //{ // lotInfo.World.Floors.Add(new HouseDataFloor { // X = 1, // Y = i, // Level = 0, // Value = 9 // }); //} //lotInfo.World.Floors.Add(new HouseDataFloor { // X = 0, Y = 0, // Level = 0, Value = 20 //}); //lotInfo.World.Floors.Add(new HouseDataFloor //{ // X = 63, // Y = 63, // Level = 0, // Value = 40 //}); //lotInfo.World.Floors.Add(new HouseDataFloor //{ // X = 0, // Y = 63, // Level = 0, // Value = 20 //}); //lotInfo.World.Floors.Add(new HouseDataFloor //{ // X = 63, // Y = 0, // Level = 0, // Value = 20 //}); //Renderer = new HouseRenderer(); //Renderer.SetModel(lotInfo); ////Renderer.Position = new Microsoft.Xna.Framework.Vector3(-32.0f, -40.0f, 0.0f); //var scene = new ThreeDScene(); //var focusPoint = Vector3.Zero; //var yValue = (float)Math.Cos(MathHelper.ToRadians(30.0f)) * 96.0f; //var cameraOffset = new Vector3(-96.0f, yValue, 96.0f); //var rotatedOffset = Vector3.Transform(cameraOffset, Microsoft.Xna.Framework.Matrix.CreateRotationY(MathHelper.PiOver2 * 0.5f)); ////rotatedOffset = Vector3.Transform(rotatedOffset, Microsoft.Xna.Framework.Matrix.CreateScale(3f)); ////Renderer.Position = new Vector3(-96.0f, 0.0f, -96.0f); //scene.Camera.Position = cameraOffset;// new Microsoft.Xna.Framework.Vector3(0, 0, 80); //scene.Add(Renderer); //Renderer.Scale = new Vector3(0.005f); //GameFacade.Scenes.AddScene(scene); ucp = new UIUCP(); ucp.Y = ScreenHeight - 210; //ucp.OnZoomChanged += new UCPZoomChangeEvent(ucp_OnZoomChanged); //ucp.OnRotateChanged += new UCPRotateChangeEvent(ucp_OnRotateChanged); this.Add(ucp); }
public UINeighPage() { Add(BackgroundImage = new UIImage()); Add(InfoTabBackgroundImage = new UIImage()); Add(InfoTabImage = new UIImage()); Add(TopSTab2BackgroundImage = new UIImage()); Add(TopSTab3BackgroundImage = new UIImage()); Add(TopSTabImage = new UIImage()); Add(TopSTabTab1BackgroundImage = new UIImage()); Add(TopSTabTab2BackgroundImage = new UIImage()); Add(TopSTabTab3BackgroundImage = new UIImage()); Add(TopSTabTab4BackgroundImage = new UIImage()); Add(TopSTabTab1SeatImage = new UIImage()); Add(TopSTabTab2SeatImage = new UIImage()); Add(TopSTabTab3SeatImage = new UIImage()); Add(TopSTabTab4SeatImage = new UIImage()); Add(MayorTabBackgroundImage = new UIImage()); Add(MayorTabImage = new UIImage()); Add(MayorTabRateImage = new UIImage()); MayorBanner = new UINeighBanner() { ScaleX = 0.3333f, ScaleY = 0.3333f, Caption = GameFacade.Strings.GetString("f115", "72") }; TermBanner = new UINeighBanner() { ScaleX = 0.3333f, ScaleY = 0.3333f, Caption = GameFacade.Strings.GetString("f115", "83", new string[] { GetOrdinal(1) }) }; TownNameBanner = new UINeighBanner() { ScaleX = 0.3333f, ScaleY = 0.3333f, Caption = GameFacade.Strings.GetString("f115", "14") }; MayorRatingBox1 = new UIRatingSummaryPanel(); MayorRatingBox2 = new UIRatingSummaryPanel(); RatingStars = new UIRatingDisplay(false); RatingStars.HalfStars = 7; var script = RenderScript("fsoneighpage.uis"); DescriptionText.OnChange += DescriptionText_OnChange; HouseNameButton.OnButtonClick += RenameAdmin; InfoButton.OnButtonClick += (btn) => SetTab(UINeighPageTab.Description); HouseButton.OnButtonClick += (btn) => SetTab(UINeighPageTab.Lots); PersonButton.OnButtonClick += (btn) => SetTab(UINeighPageTab.People); MayorButton.OnButtonClick += (btn) => SetTab(UINeighPageTab.Mayor); TopTab1Button.OnButtonClick += (btn) => SetSubTab(0); TopTab2Button.OnButtonClick += (btn) => SetSubTab(1); TopTab3Button.OnButtonClick += (btn) => SetSubTab(2); TopTab4Button.OnButtonClick += (btn) => SetSubTab(3); RateButton.OnButtonClick += RateSwitch; UIUtils.MakeDraggable(BackgroundImage, this, true); DescriptionSlider.AttachButtons(DescriptionScrollUpButton, DescriptionScrollDownButton, 1); DescriptionText.AttachSlider(DescriptionSlider); RateButton.Width = 60; LotThumbnail = script.Create <UILotThumbButton>("HouseThumbSetup"); LotThumbnail.Init(RoommateThumbButtonImage, VisitorThumbButtonImage); DefaultThumb = TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, GameFacade.GameFilePath("userdata/houses/defaulthouse.bmp")); TextureUtils.ManualTextureMask(ref DefaultThumb, new uint[] { 0xFF000000 }); LotThumbnail.SetThumbnail(DefaultThumb, 0); LotThumbnail.OnLotClick += (btn) => { FindController <CoreGameScreenController>()?.ShowLotPage(CurrentNeigh.Value?.Neighborhood_TownHallXY ?? 0); }; Add(LotThumbnail); MayorPersonButton = script.Create <UIBigPersonButton>("MayorPersonButton"); Add(MayorPersonButton); Add(RatingStars); Add(MayorBanner); Add(TermBanner); TermBanner.Flip = true; Add(TownNameBanner); Add(MayorRatingBox1); Add(MayorRatingBox2); CurrentNeigh = new Binding <Neighborhood>() .WithBinding(HouseNameButton, "Caption", "Neighborhood_Name") .WithBinding(ResidentCountLabel, "Caption", "Neighborhood_AvatarCount", (object ava) => { return(GameFacade.Strings.GetString("f115", "15", new string[] { ava.ToString() })); }) .WithBinding(PropertyCountLabel, "Caption", "Neighborhood_LotCount", (object lot) => { return(GameFacade.Strings.GetString("f115", "16", new string[] { lot.ToString() })); }) .WithBinding(ActivityRatingLabel, "Caption", "Neighborhood_ActivityRating", (object rate) => { return(GameFacade.Strings.GetString("f115", "13", new string[] { rate.ToString() })); }) .WithBinding(TermBanner, "Caption", "Neighborhood_ElectedDate", (object rate) => { return(GameFacade.Strings.GetString("f115", "83", new string[] { GetOrdinal(GetTermsSince((uint)rate)) })); }) .WithBinding(this, "MayorID", "Neighborhood_MayorID") .WithBinding(this, "TownHallID", "Neighborhood_TownHallXY") .WithBinding(StatusLabel, "Caption", "Neighborhood_Flag", (object flago) => { var flag = (uint)flago; var availableText = "11"; if ((flag & 1) > 0) { availableText = "12"; } return(GameFacade.Strings.GetString("f115", availableText)); }) .WithMultiBinding((changes) => Redraw(), "Neighborhood_Description", "Neighborhood_TownHallXY", "Neighborhood_MayorID", "Neighborhood_TopLotCategory", "Neighborhood_TopLotOverall", "Neighborhood_TopAvatarActivity", "Neighborhood_TopAvatarFamous", "Neighborhood_TopAvatarInfamous"); CurrentMayor = new Binding <Avatar>() .WithBinding(RatingStars, "DisplayStars", "Avatar_MayorRatingHundredth", (object hundredths) => { return(((uint)hundredths) / 100f); }) .WithBinding(this, "Ratings", "Avatar_ReviewIDs"); CurrentTownHall = new Binding <Lot>() .WithBinding(TownNameBanner, "Caption", "Lot_Name", (object name) => { if ((string)name == "Retrieving...") { return(GameFacade.Strings.GetString("f115", "14")); } else { return((string)name); } }); CenterButton.OnButtonClick += (btn) => { (UIScreen.Current as CoreGameScreen).CityRenderer.NeighGeom.CenterNHood((int)(CurrentNeigh.Value?.Id ?? 0)); }; BulletinButton.OnButtonClick += (btn) => { var id = CurrentNeigh?.Value?.Id ?? 0; if (id != 0 && !UIBulletinDialog.Present) { var dialog = new UIBulletinDialog(id); dialog.CloseButton.OnButtonClick += (btn2) => { UIScreen.RemoveDialog(dialog); }; UIScreen.GlobalShowDialog(dialog, false); } }; CloseButton.OnButtonClick += (btn) => { FindController <NeighPageController>().Close(); }; //mayor action buttons: MayorActionMod.OnButtonClick += (btn) => { CurrentMayorTab = UINeighMayorTabMode.ModActions; Redraw(); }; MayorActionReturn.OnButtonClick += (btn) => { CurrentMayorTab = UINeighMayorTabMode.Rate; Redraw(); }; MayorActionMoveTH.OnButtonClick += (btn) => { MoveTownHall(true); }; MayorActionNewTH.OnButtonClick += (btn) => { MoveTownHall(false); }; ModActionSetMayor.OnButtonClick += ModSetMayor; ModActionReturn.OnButtonClick += (btn) => { CurrentMayorTab = UINeighMayorTabMode.Actions; Redraw(); }; ModActionManageRatings.OnButtonClick += (btn) => { var ratingList = new UIRatingList(CurrentMayor.Value?.Avatar_Id ?? 0); UIScreen.GlobalShowAlert(new UIAlertOptions() { Title = GameFacade.Strings.GetString("f118", "23", new string[] { "Retrieving..." }), Message = GameFacade.Strings.GetString("f118", "24", new string[] { "Retrieving..." }), GenericAddition = ratingList, Width = 530 }, true); }; foreach (var elem in Children) { var label = elem as UILabel; if (label != null) { label.CaptionStyle = label.CaptionStyle.Clone(); label.CaptionStyle.Shadow = true; } } Pedestals = new List <UITop10Pedestal>(); Top10Labels = new List <UILabel>(); var top10style = TextStyle.DefaultLabel.Clone(); top10style.Shadow = true; top10style.Size = 8; for (int i = 0; i < 10; i++) { var alt = i % 2 == 1; var ped = new UITop10Pedestal() { AltColor = alt }; Pedestals.Add(ped); var label = new UILabel() { CaptionStyle = top10style, Alignment = TextAlignment.Center | TextAlignment.Middle, Size = new Vector2(1, 1) }; Top10Labels.Add(label); Add(label); } for (int i = 0; i < 10; i += 2) { Add(Pedestals[i]); //backmost } for (int i = 1; i < 10; i += 2) { Add(Pedestals[i]); //frontmost } SetPedestalPosition(false, true); Redraw(); }
public LotScreen() { ArchitectureCatalog.Init(); var lotInfo = HouseData.Parse(GameFacade.GameFilePath("housedata/blueprints/restaurant00_00.xml")); //var lotInfo = HouseData.Parse("C:\\restaurant00_00_small.xml"); //for (int i = 1; i < 64; i++) //{ // lotInfo.World.Floors.Add(new HouseDataFloor { // X = 1, // Y = i, // Level = 0, // Value = 9 // }); //} //lotInfo.World.Floors.Add(new HouseDataFloor { // X = 0, Y = 0, // Level = 0, Value = 20 //}); //lotInfo.World.Floors.Add(new HouseDataFloor //{ // X = 63, // Y = 63, // Level = 0, // Value = 40 //}); //lotInfo.World.Floors.Add(new HouseDataFloor //{ // X = 0, // Y = 63, // Level = 0, // Value = 20 //}); //lotInfo.World.Floors.Add(new HouseDataFloor //{ // X = 63, // Y = 0, // Level = 0, // Value = 20 //}); Scene = new HouseScene(); Scene.LoadHouse(lotInfo); GameFacade.Scenes.Add(Scene); //Renderer = new HouseRenderer(); //Renderer.SetModel(lotInfo); ////Renderer.Position = new Microsoft.Xna.Framework.Vector3(-32.0f, -40.0f, 0.0f); //var scene = new ThreeDScene(); //var focusPoint = Vector3.Zero; //var yValue = (float)Math.Cos(MathHelper.ToRadians(30.0f)) * 96.0f; //var cameraOffset = new Vector3(-96.0f, yValue, 96.0f); //var rotatedOffset = Vector3.Transform(cameraOffset, Microsoft.Xna.Framework.Matrix.CreateRotationY(MathHelper.PiOver2 * 0.5f)); ////rotatedOffset = Vector3.Transform(rotatedOffset, Microsoft.Xna.Framework.Matrix.CreateScale(3f)); ////Renderer.Position = new Vector3(-96.0f, 0.0f, -96.0f); //scene.Camera.Position = cameraOffset;// new Microsoft.Xna.Framework.Vector3(0, 0, 80); //scene.Add(Renderer); //Renderer.Scale = new Vector3(0.005f); //GameFacade.Scenes.AddScene(scene); ucp = new UIUCP(); ucp.Y = ScreenHeight - 210; //ucp.OnZoomChanged += new UCPZoomChangeEvent(ucp_OnZoomChanged); ucp.OnRotateChanged += new UCPRotateChangeEvent(ucp_OnRotateChanged); this.Add(ucp); }
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; }