public void DrawPortrait(SpriteBatch spriteBatch, Vector2 screenPos, float targetWidth) { float backgroundScale = 1; if (PortraitBackground != null) { backgroundScale = targetWidth / PortraitBackground.size.X; PortraitBackground.Draw(spriteBatch, screenPos, scale: backgroundScale); } if (Portrait != null) { // Scale down the head sprite 10% float scale = targetWidth * 0.9f / Portrait.size.X; Vector2 offset = Portrait.size * backgroundScale / 4; Portrait.Draw(spriteBatch, screenPos + offset, scale: scale, spriteEffect: SpriteEffects.FlipHorizontally); if (AttachmentSprites != null) { float depthStep = 0.000001f; foreach (var attachment in AttachmentSprites) { DrawAttachmentSprite(spriteBatch, attachment, Portrait, screenPos + offset, scale, depthStep, SpriteEffects.FlipHorizontally); depthStep += depthStep; } } } }
protected override JProperty MainElement(Portrait portrait) { if (FileOutputOptions.IsLocalizedText) { AddLocalizedGameString(portrait); } JObject portraitObject = new JObject(); if (!string.IsNullOrEmpty(portrait.Name) && !FileOutputOptions.IsLocalizedText) { portraitObject.Add("name", portrait.Name); } portraitObject.Add("hyperlinkId", portrait.HyperlinkId); if (!string.IsNullOrEmpty(portrait.EventName)) { portraitObject.Add("event", portrait.EventName); } if (!string.IsNullOrEmpty(portrait.SortName) && !FileOutputOptions.IsLocalizedText) { portraitObject.Add("sortName", portrait.SortName); } return(new JProperty(portrait.Id, portraitObject)); }
public GamePlayerView Load(GamePlayerViewModel vm) { Portrait.SetCurrentValue(Image.SourceProperty, vm.Portrait); Division.SetCurrentValue(Image.SourceProperty, vm.DivisionMedal); Name.Text = vm.Name; return(this); }
public MainPageViewModel(Dictionary <string, BookDto> books) { _rubin = new Rubin(); _wool = new Wool(); _portrait = new Portrait(); _prayer = new Prayer(); foreach (var i in books) { if (i.Key == "Rubin") { RubinTitle = i.Value.Title; RubinComments = i.Value.Comments.ToString(); RubinLikes = i.Value.Likes.ToString(); } if (i.Key == "Wool") { WoolTitle = i.Value.Title; WoolComments = i.Value.Comments.ToString(); WoolLikes = i.Value.Likes.ToString(); } if (i.Key == "Prayer") { PrayerTitle = i.Value.Title; PrayerComments = i.Value.Comments.ToString(); PrayerLikes = i.Value.Likes.ToString(); } if (i.Key == "Portrait") { PortraitTitle = i.Value.Title; PortraitComments = i.Value.Comments.ToString(); PortraitLikes = i.Value.Likes.ToString(); } } }
public ActionResult <Portrait> EditPortraitMethod(Portrait portrait, int admin_id, string admin_token, int site_id) { Portrait queried_portrait; try{ queried_portrait = dbQuery.QueryPortraitById(portrait.portrait_id); }catch { JsonFailure f = new JsonFailure($"Portrait Id: {portrait.portrait_id} not found."); return(StatusCode(400, f)); } if (authenticator.VerifyAdminForLeaf(admin_id, queried_portrait.site_id, admin_token)) { DataPlan data_plan; try{ data_plan = _dataLimiter.ValidateDataPlanB(admin_id, queried_portrait, portrait); }catch (System.ArgumentException e) { return(StatusCode(400, e.Message)); } Portrait changed_portrait = dbQuery.EditPortrait(portrait); _dataLimiter.UpdateDataPlan(data_plan); return(changed_portrait); } else { return(StatusCode(400, "Invalid credentials.")); } }
public void OnCharacterRemoved(int playerIndex) { if (playerNumber - 1 == playerIndex) { if (activePortraitIndex - 1 < 0) { return; } if (activePortraitIndex != portraits.Count - 1) { oldPortrait = activePortrait; oldPortrait.SetSwordVisiblity(true); activePortraitIndex--; activePortrait = portraits[activePortraitIndex]; activePortrait.SetSwordVisiblity(false); oldPortrait.characterPortrait.sprite = null; } else if (activePortrait == oldPortrait) { oldPortrait = portraits[activePortraitIndex]; oldPortrait.SetSwordVisiblity(true); activePortrait.SetSwordVisiblity(false); oldPortrait.characterPortrait.sprite = null; activePortraitIndex--; } else { activePortrait = oldPortrait; activePortrait.SetSwordVisiblity(false); } } }
public ActionResult <JsonResponse> PostPortraitMethod(Portrait NewPortrait, int admin_id, string admin_token) { if (authenticator.VerifyAdminForLeaf(admin_id, NewPortrait.site_id, admin_token)) { List <string> errors = authenticator.ValidateIncomingComponent(NewPortrait); if (errors.Count == 0) { DataPlan data_plan; try{ data_plan = _dataLimiter.ValidateComponentAdditionForDataPlan(admin_id, NewPortrait); }catch (System.ArgumentException e) { return(StatusCode(400, e.Message)); } NewPortrait.byte_size = NewPortrait.FindCharLength(); dbQuery.AddPortrait(NewPortrait); _dataLimiter.UpdateDataPlan(data_plan); JsonResponse r = new JsonSuccess("Portrait posted sucessfully!"); return(r); } else { return(StatusCode(400, errors)); } } else { return(StatusCode(400, "Invalid Token. Stranger Danger.")); } }
public void DrawPortrait(SpriteBatch spriteBatch, Vector2 screenPos, float targetWidth) { float backgroundScale = 1; if (PortraitBackground != null) { backgroundScale = targetWidth / PortraitBackground.size.X; PortraitBackground.Draw(spriteBatch, screenPos, scale: backgroundScale); } if (Portrait != null) { // Scale down the head sprite 10% float scale = targetWidth * 0.9f / Portrait.size.X; Vector2 offset = Portrait.size * backgroundScale / 4; if (Head.SheetIndex.HasValue) { Portrait.SourceRect = new Rectangle(CalculateOffset(Portrait, Head.SheetIndex.Value.ToPoint()), Portrait.SourceRect.Size); } Portrait.Draw(spriteBatch, screenPos + offset, scale: scale, spriteEffect: SpriteEffects.FlipHorizontally); if (AttachmentSprites != null) { float depthStep = 0.000001f; foreach (var attachment in AttachmentSprites) { DrawAttachmentSprite(spriteBatch, attachment, Portrait, screenPos + offset, scale, depthStep, SpriteEffects.FlipHorizontally); depthStep += depthStep; } } } }
private void OnEnable() { if (portraits == null) { InitPortraits(); TogglePortraitsVisibility(false); playerCharacterInfo.onCharacterPush += OnCharacterAdded; playerCharacterInfo.onCharacterPop += OnCharacterRemoved; playerPortraitInfo.InitData(); playerPortraitInfo.onPortraitHighlighted += OnCharacterHighlighted; } else { foreach (Portrait p in portraits) { Destroy(p.gameObject); } activePortraitIndex = 0; InitPortraits(); activePortrait = portraits[0]; activePortrait.SetSwordVisiblity(false); TogglePortraitsVisibility(true); } }
void Core_UpdatePortrait() { try { if (IsGenericClassCard) { CurrentPortrait = new Portrait( Core.ReadPalette((Pointer)Current["Palette"], Palette.LENGTH), Core.ReadData((Pointer)Current[(Core.CurrentROM is FE6) ? "Main" : "Card"], 0)); } else { CurrentPortrait = new Portrait( Core.ReadPalette((Pointer)Current["Palette"], Palette.LENGTH), ((Core.CurrentROM is FE7 && Core.CurrentROM.Version == GameVersion.JAP) || Core.CurrentROM is FE8) ? Core.ReadData((Pointer)Current["Face"] + 4, Portrait.Face_Length) : Core.ReadData((Pointer)Current[(Core.CurrentROM is FE6) ? "Main" : "Face"], 0), Core.ReadData((Pointer)Current["Chibi"], (Core.CurrentROM is FE6) ? Portrait.Chibi_Length : 0), (Core.CurrentROM is FE6) ? null : Core.ReadData((Pointer)Current["Mouth"], Portrait.Mouth_Length)); } Image_ImageBox.Load(CurrentPortrait); Palette_PaletteBox.Load(CurrentPortrait.Colors); } catch (Exception ex) { Program.ShowError("Could not load the portrait image.", ex); Image_ImageBox.Reset(); Palette_PaletteBox.Reset(); } }
private void SavePartyPortraitsNew() { mPartyPortraits = (Texture2D[])new Texture2D[6]; PartyPortraitsRawData = new byte[6][]; int num = 0; foreach (PartyMember activePrimaryPartyMember in SingletonBehavior <PartyManager> .Instance.GetActivePrimaryPartyMembers()) { if (!(activePrimaryPartyMember == null)) { try { string path = FileUtility.CombinePath(SaveLoadUtils.WorkingSaveGamePath, "partyMember" + num.ToStringInvariant() + ".png"); var val = Portrait.GetTexture(activePrimaryPartyMember, Portrait.Style.Small); if (val != null) { Texture2D val2 = GameUtilities.ResizeTexture((Texture2D)val, 32, 41); byte[] array = val2.EncodeToPNG(); PartyPortraitsRawData[num++] = array; File.WriteAllBytes(path, array); ResourceManager.DestroyTexture(val2); } } catch (Exception ex) { Debug.LogException(ex); Debug.LogError((object)("Error saving '" + activePrimaryPartyMember.name + "' portrait.")); } } } }
void Core_InsertImage(string filepath) { Portrait portrait; try { GBA.Image image = new GBA.Image(filepath); int regular_width = Portrait.WIDTH * Tile.SIZE; int regular_height = Portrait.HEIGHT * Tile.SIZE; int generic_width = Portrait.Card_Width * Tile.SIZE; int generic_height = Portrait.Card_Height * Tile.SIZE; if (image.Width == regular_width && image.Height == regular_height) { portrait = new Portrait(image, false); } else if (image.Width == generic_width && image.Height == generic_height) { portrait = new Portrait(image, true); } else { throw new Exception("Image given has invalid dimensions.\r\n" + "It must be " + regular_width + "x" + regular_height + " or " + generic_width + "x" + generic_height + " (for a generic card portrait)"); } } catch (Exception ex) { Program.ShowError("Could not load the image file.", ex); return; } Core_Insert(portrait); }
public void Test() { var provider = new Db4oProvider("faces.db4o"); Func <Frame, string> f1 = f => f.Guid.ToString() + ".jpg"; Func <Portrait, string> f2 = p => p.Guid.ToString() + ".jpg"; var repository = new Damany.PortraitCapturer.DAL.Providers.LocalDb4oProvider( @".\"); var frame = new Frame(Data.GetFrame()); var mockCamera = new Damany.Cameras.DirectoryFilesCamera(@"c:\", "*.jpg"); mockCamera.Id = 3; frame.CapturedFrom = mockCamera; repository.SaveFrame(frame); var fromDb = repository.GetFrame(frame.Guid); Assert.AreEqual(fromDb.Guid, frame.Guid); var portrait = new Portrait(Data.GetPortrait()); portrait.FaceBounds = new OpenCvSharp.CvRect(0, 0, 100, 100); portrait.CapturedFrom = mockCamera; repository.SavePortrait(portrait); var portraitFromDb = repository.GetPortrait(portrait.Guid); Assert.AreEqual(portraitFromDb.Guid, portrait.Guid); }
public void GetCharacter(GameObject Character, GameObject Manager) { this.Character = Character; this.Manager = Manager; hubCharacterScript = Character.GetComponent <CharacterScript>(); stats = Character.GetComponent <Stats>(); Portrait.GetComponent <CharacterScript>().LoadPlayer(hubCharacterScript); Portrait.GetComponent <Stats>().LoadPlayer(stats); boxCharacterScript = Portrait.GetComponent <CharacterScript>(); role = boxCharacterScript.role; if (role != null) { txtRole.text = role.roleName; } else { txtRole.text = "-No Role-"; } PrepareAppoint(); txtName.text = boxCharacterScript.title + boxCharacterScript.strName; SetStats(); //boxCharacterScript.isEnlisted = false; }
public void GetRole(RoleObject role, GameObject Manager) { this.role = role; this.Manager = Manager; roleTaken = false; hubCharacters = GameObject.FindGameObjectsWithTag("Character"); foreach (GameObject character in hubCharacters) { hubCharacterScript = character.GetComponent <CharacterScript>(); if (hubCharacterScript.role == role) { stats = character.GetComponent <Stats>(); Portrait.GetComponent <CharacterScript>().LoadPlayer(hubCharacterScript); Portrait.GetComponent <Stats>().LoadPlayer(stats); SetStats(); hubCharacterScript.isEnlisted = false; roleTaken = true; break; } } if (!roleTaken) { //Destroy(Portrait); EmptyRole(); } }
public void GetGeneralUnlocks(ICLIFlags toolFlags) { string basePath; if (toolFlags is ExtractFlags flags) { basePath = flags.OutputPath; } else { throw new Exception("no output path"); } foreach (var key in TrackedFiles[0x54]) { STUGlobalInventoryMaster invMaster = GetInstance <STUGlobalInventoryMaster>(key); if (invMaster == null) { continue; } var achivementUnlocks = invMaster.AchievementUnlocks?.Unlocks?.Select(it => GatherUnlock((ulong)it)).ToList(); SprayAndIcon.SaveItems(basePath, null, "General", "Achievements", flags, achivementUnlocks); if (invMaster.EventGeneralUnlocks != null) { foreach (var eventUnlocks in invMaster.EventGeneralUnlocks) { if (eventUnlocks?.Unlocks?.Unlocks == null) { continue; } var eventKey = ItemEvents.GetInstance().EventsNormal[(uint)eventUnlocks.Event]; var unlocks = eventUnlocks.Unlocks.Unlocks.Select(it => GatherUnlock((ulong)it)).ToList(); SprayAndIcon.SaveItems(basePath, null, "General", eventKey, flags, unlocks); } } if (invMaster.LevelUnlocks != null) { var unlocks = new HashSet <ItemInfo>(); foreach (var levelUnlocks in invMaster.LevelUnlocks) { if (levelUnlocks?.Unlocks == null) { continue; } foreach (var unlock in levelUnlocks.Unlocks) { unlocks.Add(GatherUnlock(unlock)); } } SprayAndIcon.SaveItems(basePath, null, "General", "Standard", flags, unlocks.ToList()); Portrait.SaveItems(basePath, null, "General", "Standard", flags, unlocks.ToList()); } } }
public override string ToString() { return(Name + ";" + Surname + ";" + Nickname + ";" + Portrait.ToString() + ";" + Citizenship + ";" + LastHome + ";" + String.Join(",", Languages) + ";" + CriminalWork + ";" + LastDeal); }
public void Witness(Player p) { Portrait port = p.PredictPortrait(); left_pivot.GetChild(0).GetComponent <SpriteRenderer>().sprite = hair[port.hair]; left_pivot.GetChild(1).GetComponent <SpriteRenderer>().sprite = face[port.head]; left_pivot.GetChild(2).GetComponent <SpriteRenderer>().sprite = shirt[port.shirt]; }
public Player(int id, PlayerType type, int x, int y) { this.id = id; this.type = type; this.x = x; this.y = y; this.portrait = new Portrait(); }
private int GetTileIndex(Portrait portrait, int frameCount, Layer layer) { char letter = portrait.GetLetter(layer.Characteristic); int tileIndex = Portrait.GetIndex(letter, frameCount); logger.Debug(string.Format("Layer letter: {0}, Tile Index: {1}", letter, tileIndex)); return(tileIndex); }
public ActionResult <Portrait> GetPortraitMethod(int portrait_id) { try{ Portrait portrait = dbQuery.QueryPortraitById(portrait_id); return(portrait); }catch { return(StatusCode(400, "Component Not Found")); } }
public void SavePortrait(Portrait portrait) { var dto = Mapper.Map <Portrait, DAL.DTO.Portrait>(portrait); dataProvider.SavePortrait(dto); var absolutePath = GetAbsolutePath(dto.Path); portrait.GetImage().SaveImage(absolutePath); }
public ExtendedNPC(Sprite sprite, BasicRenderer renderer, Portrait portrait, Vector2 position, int facingDirection, string name) : base(sprite.sprite, position, facingDirection, name, null) { this.characterRenderer = renderer; this.portraitInformation = portrait; this.portraitInformation.setCharacterPortraitFromThis(this); this.spriteInformation = sprite; this.spriteInformation.setCharacterSpriteFromThis(this); this.swimming = false; }
/// <summary>Construct an instance.</summary> /// <param name="sprite">The sprite for the character to use incase the renderer is null.</param> /// <param name="renderer">The custom npc render. Used to draw the npcfrom a collection of assets.</param> /// <param name="position">The position of the npc on the map.</param> /// <param name="facingDirection">The direction of the npc</param> /// <param name="name">The name of the npc.</param> public ExtendedNpc(Sprite sprite, BasicRenderer renderer, Vector2 position, int facingDirection, string name) : base(sprite.sprite, position, facingDirection, name) { this.characterRenderer = renderer; this.Portrait = null; this.portraitInformation = null; this.spriteInformation = sprite; this.spriteInformation?.setCharacterSpriteFromThis(this); this.swimming.Value = false; }
/// <summary> /// Defines what should happen when hovering over this script's object. /// </summary> public void OnMouseOver() { if (Input.GetMouseButtonDown(0)) { SceneChange.LoadSceneFromMenu("Tutorial"); Portrait.GetInstance().gameObject.SetActive(true); Player.GetInstance().StartStarving(30); Player.GetInstance().DialogueLine = 0; } }
private void Awake() { if (instance != null) { Destroy(gameObject); return; } instance = this; }
private void cursorOverPortrait() { Portrait portrait = Utils.GetObjectUnderCursor <Portrait>("Portrait"); if (portrait == null) { return; } ShowCreature(portrait.Creature); }
private void PopUp() { if (currentPopUp != null) { currentPopUp.Recycle(); } currentPopUp = popup.Spawn(); currentPopUp.transform.position = new Vector3(-7.65f, -3.65f); }
/// <summary> /// Non modular npc Constructor. /// </summary> /// <param name="sprite">The sprite for the character.</param> /// <param name="position">The position of the npc on the map.</param> /// <param name="facingDirection">The direction of the npc</param> /// <param name="name">The name of the npc.</param> public ExtendedNPC(Sprite sprite, Vector2 position, int facingDirection, string name) : base(sprite.sprite, position, facingDirection, name, null) { this.characterRenderer = null; this.Portrait = (Texture2D)null; this.portraitInformation = null; this.spriteInformation = sprite; if (this.spriteInformation != null) { this.spriteInformation.setCharacterSpriteFromThis(this); } this.swimming.Value = false; }
/// <summary> /// Defines what should happen when hovering over this scripts' object. /// </summary> public void OnMouseOver() { if (Input.GetMouseButtonDown(0)) { Portrait.GetInstance().gameObject.SetActive(true); string path = Application.persistentDataPath + "/" + "save1.dat"; Debug.Log(path); sv.Load(path); Player.GetInstance().StopStarving(); Player.GetInstance().StartStarving(0); } }
public void SavePortrait(Portrait portrait) { var dto = Mapper.Map<Portrait, DAL.DTO.Portrait>(portrait); dataProvider.SavePortrait(dto); var absolutePath = GetAbsolutePath(dto.Path); portrait.GetImage().SaveImage(absolutePath); }