/// <summary> /// Create new AttachedPicture frame /// </summary> /// <param name="Flags">Flags of frame</param> /// <param name="Description">Description of picture</param> /// <param name="TextEncoding">TextEncoding use for texts</param> /// <param name="MIMEType">MimeType of picture</param> /// <param name="PictureType">Picture type</param> /// <param name="Data">Data Contain picture</param> public AttachedPictureFrame(FrameFlags Flags, string Description, TextEncodings TextEncoding, string MIMEType, PictureTypes PictureType, MemoryStream Data) : base("APIC", Flags, Description, MIMEType, TextEncoding, Data) { _PictureType = PictureType; }
/// <summary> /// Create new AttachedPictureFrame /// </summary> /// <param name="FrameID">4 Characters tag identifier</param> /// <param name="Flags">2 Bytes flags identifier</param> /// <param name="Data">Contain Data for this frame</param> /// <param name="Length">MaxLength of frame</param> internal AttachedPictureFrame(string FrameID, FrameFlags Flags, FileStreamEx Data, int Length, Version version) : base(FrameID, Flags) { _TextEncoding = (TextEncodings)Data.ReadByte(); Length--; if (!IsValidEnumValue(_TextEncoding, ValidatingErrorTypes.ID3Error)) { _MustDrop = true; return; } if (version.Major == 2 && version.Minor == 2) { _MIMEType = Data.ReadText(3, TextEncodings.Ascii, ref Length, true); } else { _MIMEType = Data.ReadText(Length, TextEncodings.Ascii, ref Length, true); } _PictureType = (PictureTypes)Data.ReadByte(); Length--; _Description = Data.ReadText(Length, _TextEncoding, ref Length, true); _Data = Data.ReadData(Length); }
private void DeletePicture() { if (pictures[pictureSelection] == null) { return; } PictureTypes pictureType = pictures[pictureSelection].type; if (pictureType == PictureTypes.Capture) { if (pictures[pictureSelection].capturedGameObject.CompareTag("Crystal")) { pictures[pictureSelection].capturedGameObject.transform.position = player.transform.position + player.transform.forward * CrystalReleaseDistance; pictures[pictureSelection].capturedGameObject.SetActive(true); pictures[pictureSelection].capturedGameObject.GetComponent <Rigidbody>().AddForce(player.transform.forward * CrystalReleaseForce + player.GetComponent <CharacterController>().velocity, ForceMode.Impulse); } } pictures[pictureSelection] = null; UpdatePictureSlots(); if (pictureType == PictureTypes.Freeze) { UpdateFrozenEnemies(); } }
/// <summary> /// Статический метод. Возвращает тип картинки как текстовую строку /// </summary> public static string GetPictureTypeAsStringStatic(PictureTypes pictureType) { string pictureTypeAsString; // Тип картинки (как тескстовая строка) switch (pictureType) // Проверить тип картинки { case PictureTypes.document: // Тип картинки: документ pictureTypeAsString = "Документ"; // Задать тип картинки break; case PictureTypes.map: // Тип картинки: карта pictureTypeAsString = "Карта"; // Задать тип картинки break; case PictureTypes.photo: // Тип картинки: фотография pictureTypeAsString = "Фотография"; // Задать тип картинки break; case PictureTypes.screenshot: // Тип картинки: снимок экрана pictureTypeAsString = "Снимок экрана"; // Задать тип картинки break; case PictureTypes.appartmentMap: // Тип картинки: снимок экрана pictureTypeAsString = "План квартиры"; // Задать тип картинки break; default: // Тип картинки: картинка по умолчанию pictureTypeAsString = ""; // Задать тип картинки break; } return(pictureTypeAsString); }
public Picture(PictureTypes type, int id, int hue, int page, int x, int y) { m_id = id; m_type = type; m_page = page; m_x = x; m_y = y; m_hue = hue; }
public void Deserialize(GenericReader reader) { int version = reader.ReadInt(); m_type = (PictureTypes)reader.ReadInt(); m_id = reader.ReadInt(); m_page = reader.ReadInt(); m_x = reader.ReadInt(); m_y = reader.ReadInt(); m_hue = reader.ReadInt(); }
/// <summary> /// Method to get a string name of a Picture type. /// </summary> /// <param name="type">The type of the Picture.</param> /// <returns>The type string name of the Picture.</returns> public static string Name(this PictureTypes type) { switch (type) { case PictureTypes.Original: return("Original"); case PictureTypes.Preview: return("Preview"); case PictureTypes.Thumbnail: return("Thumbnail"); } return(null); }
/// <summary> /// Create new AttachedPictureFrame /// </summary> /// <param name="FrameID">4 Characters tag identifier</param> /// <param name="Flags">2 Bytes flags identifier</param> /// <param name="Data">Contain Data for this frame</param> /// <param name="Length">MaxLength of frame</param> public AttachedPictureFrame(string FrameID, FrameFlags Flags, int Length, Stream FS) : base(FrameID, Flags, FS) { TStream = new BreadPlayer.Tags.TagStreamUWP(FS); _TextEncoding = (TextEncodings)TStream.ReadByte(FS); Length--; if (!IsValidEnumValue(_TextEncoding, ExceptionLevels.Error, FrameID)) { return; } _MIMEType = TStream.ReadText(Length, TextEncodings.Ascii, ref Length, true); _PictureType = (PictureTypes)TStream.ReadByte(FS); Length--; _Description = TStream.ReadText(Length, _TextEncoding, ref Length, true); _Data = TStream.ReadData(Length); }
/// <summary> /// Create new AttachedPictureFrame /// </summary> /// <param name="FrameID">4 Characters tag identifier</param> /// <param name="Flags">2 Bytes flags identifier</param> /// <param name="Data">Contain Data for this frame</param> /// <param name="Length">MaxLength of frame</param> internal AttachedPictureFrame(string FrameID, FrameFlags Flags, FileStreamEx Data, int Length) : base(FrameID, Flags) { _TextEncoding = (TextEncodings)Data.ReadByte(); Length--; if (!IsValidEnumValue(_TextEncoding, ValidatingErrorTypes.ID3Error)) { _MustDrop = true; return; } _MIMEType = Data.ReadText(Length, TextEncodings.Ascii, ref Length, true); _PictureType = (PictureTypes)Data.ReadByte(); Length--; _Description = Data.ReadText(Length, _TextEncoding, ref Length, true); _Data = Data.ReadData(Length); }
/// <summary> /// Метод. Добавляет элемент в список "Тип картинки" /// </summary> private void AddPictureTypeToList(PictureTypes pictureType, string pictureTypeDescription) { pictureTypeComboBox.Items.Add(new KeyValuePair <PictureTypes, string>(pictureType, pictureTypeDescription)); }
public Picture(Texture2D texture2D, PictureTypes pictureType) { texture = texture2D; type = pictureType; }
private void TakePicture(PictureTypes pictureType) { bool hasFreeSlot = false; for (int i = 0; i < pictures.Length; i++) { if (pictures[i] == null) { hasFreeSlot = true; break; } } if (hasFreeSlot == false) { return; } RenderTexture currentRT = RenderTexture.active; RenderTexture.active = CameraVisorRT; Texture2D texture2D = new Texture2D(CameraVisorRT.height, CameraVisorRT.height, TextureFormat.RGB24, true); int xOffset = ( int )((CameraVisorRT.width - CameraVisorRT.height) / 2.0f); texture2D.ReadPixels(new Rect(xOffset, 0, CameraVisorRT.height, CameraVisorRT.height), 0, 0); texture2D.Apply(); RenderTexture.active = currentRT; Picture picture = new Picture(texture2D, pictureType); switch (pictureType) { case PictureTypes.Freeze: { List <Enemy> frozenEnemies = new List <Enemy>(); List <Enemy> enemies = LevelManager.instance.GetEnemies(); for (int i = 0; i < enemies.Count; i++) { if (enemies[i].enabled && IsInSightOfCamera(enemies[i].transform)) { frozenEnemies.Add(enemies[i]); } } if (frozenEnemies.Count > 0) { picture.frozenEnemies = frozenEnemies.ToArray(); } else { picture.type = PictureTypes.None; } } break; case PictureTypes.Capture: { GameObject capturedGameObject = null; float smallestDistance = 0; for (int i = 0; i < LevelManager.instance.Crystals.Length; i++) { if (LevelManager.instance.Crystals[i].gameObject.activeSelf == false) { continue; } if (IsInSightOfCamera(LevelManager.instance.Crystals[i].transform)) { float distance = Vector3.Distance(LevelManager.instance.Crystals[i].transform.position, player.transform.position); if (capturedGameObject == null || distance < smallestDistance) { capturedGameObject = LevelManager.instance.Crystals[i].gameObject; smallestDistance = distance; } } } if (capturedGameObject != null) { capturedGameObject.SetActive(false); picture.capturedGameObject = capturedGameObject; } else { picture.type = PictureTypes.None; } } break; } for (int i = 0; i < playerUI.PictureSlots.Length; i++) { if (pictures[i] == null) { pictures[i] = picture; pictureSelection = i; UpdateSelectionOutline(); break; } } UpdatePictureSlots(); switch (pictureType) { case PictureTypes.Freeze: { UpdateFrozenEnemies(); } break; case PictureTypes.Capture: { UpdateFrozenEnemies(); } break; } }
/// <summary> /// Метод. Возвращает тип картинки как текстовую строку /// </summary> public string GetPictureTypeAsString(PictureTypes pictureType) { return(Picture.GetPictureTypeAsStringStatic(pictureType)); }
public void AddPicturePage(PictureTypes type, int page, int hue, int id, int x, int y) { Picture pic = new Picture(type, id, hue, page, x, y); m_Pictures.Add(pic); }