public void SyncPosterType(Posters p) { posterVariant = p; var attributes = GetComponent <ItemAttributesV2>(); var poster = wallPrefab.GetComponent <PosterBehaviour>().GetPoster(p); string posterName; string desc; Sprite icon; if (posterVariant == Posters.RandomContraband) { posterName = "Contraband Poster"; desc = "This poster comes with its own automatic adhesive mechanism, for easy pinning to any vertical surface. Its vulgar themes have marked it as contraband aboard Nanotrasen space facilities."; icon = contrabandSprite; } else if (posterVariant == Posters.RandomOfficial) { posterName = "Motivational Poster"; desc = "An official Nanotrasen-issued poster to foster a compliant and obedient workforce. It comes with state-of-the-art adhesive backing, for easy pinning to any vertical surface."; icon = legitSprite; } else { posterName = poster.Name; desc = poster.Description; icon = poster.Type == PosterType.Contraband ? contrabandSprite : legitSprite; } attributes.ServerSetArticleName(posterName); attributes.ServerSetArticleDescription(desc); spriteRend.sprite = icon; }
public override void OnStartClient() { var starterPoster = GetPoster(posterVariant); posterVariant = starterPoster.PosterName; SyncPosterType(posterVariant, posterVariant); base.OnStartClient(); }
public override void OnStartServer() { var startPoster = wallPrefab.GetComponent <PosterBehaviour>().GetPoster(posterVariant); posterVariant = startPoster.PosterName; SyncPosterType(posterVariant); base.OnStartServer(); }
private void SyncPosterType(Posters oldP, Posters p) { posterVariant = p; var poster = GetPoster(p); if (poster != null) { sprite.sprite = poster.sprite; } }
private void ShowCarouselArrowsCommandExecute(PosterOutput poster) { IsNotFirstItem = true; IsNotLastItem = true; if (Posters.First() == poster) { IsNotFirstItem = false; } if (Posters.Last() == poster) { IsNotLastItem = false; } }
public Poster GetPoster(Posters p) { if (p == Posters.Ripped) { return(OtherPosters[0]); } if (p == Posters.Random) { if (Random.value < 0.5f) { return(OfficialPosters[Random.Range(0, OfficialPosters.Count - 1)]); } else { return(ContrabandPosters[Random.Range(0, OfficialPosters.Count - 1)]); } } if (p == Posters.RandomOfficial) { return(OfficialPosters[Random.Range(0, OfficialPosters.Count - 1)]); } if (p == Posters.RandomContraband) { return(ContrabandPosters[Random.Range(0, OfficialPosters.Count - 1)]); } var index = OfficialPosters.FindIndex(x => x.PosterName == p); if (index != -1) { return(OfficialPosters[index]); } else { index = ContrabandPosters.FindIndex(x => x.PosterName == p); if (index != -1) { return(ContrabandPosters[index]); } } return(null); }
private void SyncPosterType(Posters p) { posterVariant = p; var posters = new List <string>(); if (posterVariant == Posters.RandomOfficial || posterVariant == Posters.Random) { posters.AddRange(Globals.OfficialPosters.Keys.ToList()); } if (posterVariant == Posters.RandomContraband || posterVariant == Posters.Random) { posters.AddRange(Globals.ContrabandPosters.Keys.ToList()); } if (posters.Count > 0) { Enum.TryParse(posters[UnityEngine.Random.Range(0, posters.Count)], out Posters variant); posterVariant = variant; } Poster poster = null; var posterName = posterVariant.ToString(); if (Globals.OfficialPosters.ContainsKey(posterName)) { poster = Globals.OfficialPosters[posterName]; } else if (Globals.ContrabandPosters.ContainsKey(posterName)) { poster = Globals.ContrabandPosters[posterName]; } else if (Globals.OtherPosters.ContainsKey(posterName)) { poster = Globals.OtherPosters[posterName]; } if (poster != null) { sprite.sprite = Resources.Load <Sprite>("textures/objects/contraband/contraband_" + poster.Icon); } }
public void SetMovieIds() { if (Covers != null) { Covers.ForEach(c => c.Id = Id); } if (Backdrops != null) { Backdrops.ForEach(c => c.Id = Id); } if (Posters != null) { Posters.ForEach(c => c.Id = Id); } if (Profiles != null) { Profiles.ForEach(c => c.Id = Id); } if (Stills != null) { Stills.ForEach(c => c.Id = Id); } }