private void Initialize(Fresvii.AppSteroid.Models.GroupMessage groupMessage, float scaleFactor, float width, FresviiGUIChat frameChat) { this.transform.parent = frameChat.transform; this.GroupMessage = groupMessage; this.frameChat = frameChat; this.scaleFactor = scaleFactor; if (Application.platform == RuntimePlatform.IPhonePlayer) { guiStyleText.font = null; guiStyleTime.font = null; guiStyleUserName.font = null; } sideSmallMargin *= this.scaleFactor; sideLargeMargin *= this.scaleFactor; centerMargin *= this.scaleFactor; userIconSize *= this.scaleFactor; clipImageUserIconOffset *= this.scaleFactor; height *= this.scaleFactor; imageHeight = ImageHeight * this.scaleFactor; imageMargin *= this.scaleFactor; userIconOffsetY *= this.scaleFactor; guiStyleText.fontSize = (int)(guiStyleText.fontSize * this.scaleFactor); guiStyleText.padding = FresviiGUIUtility.RectOffsetScale(guiStyleText.padding, this.scaleFactor); guiStyleText.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.ChatBalloonText); guiStyleTime.fontSize = (int)(guiStyleTime.fontSize * this.scaleFactor); guiStyleTime.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.ChatBalloonText); guiStyleUserName.fontSize = (int)(guiStyleUserName.fontSize * this.scaleFactor); guiStyleUserName.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.ChatBalloonText); guiStyleUserName.padding = FresviiGUIUtility.RectOffsetScale(guiStyleUserName.padding, this.scaleFactor); guiContentText = new GUIContent(GroupMessage.Text); guiContentTime = new GUIContent(GroupMessage.CreatedAt.ToString("H:mm")); Vector2 timeSize = guiStyleTime.CalcSize(guiContentTime); texCoodsProgressBar = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.CardProgressBar); timePosition.width = timeSize.x; timePosition.height = timeSize.y; if (!string.IsNullOrEmpty(groupMessage.User.ProfileImageUrl)) LoadUserIcon(GroupMessage.User.ProfileImageUrl); CalcLayout(width); balloonAlpha = 0.0f; chatBalloonColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.ChatBalloon); iTween.ValueTo(this.gameObject, iTween.Hash("from", 0.0f, "to", 1.0f, "time", 0.5f, "onupdatetarget", this.gameObject, "onupdate", "OnUpdateBalloonAlpha", "oncompletetarget", this.gameObject, "oncomplete", "OnCompleteBalloonAlpha")); }
public void Init(Fresvii.AppSteroid.Models.GroupMessage groupMessage, float scaleFactor, float width, FresviiGUIChat frameChat) { if (frameChat == null) return; isMine = (FAS.CurrentUser.Id == groupMessage.User.Id); Initialize(groupMessage, scaleFactor, width, frameChat); if (groupMessage.Type == Fresvii.AppSteroid.Models.GroupMessage.ContentType.Image) { LoadClipImage(groupMessage.ImageThumbnailUrl); } else if (groupMessage.Type == Fresvii.AppSteroid.Models.GroupMessage.ContentType.Video) { if (groupMessage.VideoStatus == Fresvii.AppSteroid.Models.GroupMessage.VideoStatuses.Ready && groupMessage.Video != null && !string.IsNullOrEmpty(groupMessage.Video.ThumbnailUrl)) { LoadClipImage(groupMessage.Video.ThumbnailUrl); } else { clipImage = textureRemovedVideo; } } }
public void InitByLocal(Fresvii.AppSteroid.Models.GroupMessage groupMessage, float scaleFactor, float width, FresviiGUIChat frameChat, Texture2D _clipImage) { isMine = true; this.clipImage = _clipImage; Initialize(groupMessage, scaleFactor, width, frameChat); }
public void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth, FresviiGUIChat frameChat) { if (Application.platform == RuntimePlatform.IPhonePlayer) { guiStyleTitle.font = null; guiStyleTitle.fontStyle = FontStyle.Bold; guiStyleBackButton.font = null; guiStyleDoneButton.font = null; } this.frameChat = frameChat; this.other = frameChat.Other; this.scaleFactor = scaleFactor; this.postFix = postFix; this.GuiDepth = guiDepth; this.guiDepth = guiDepth; palette = FresviiGUIColorPalette.Palette; texCoordsMenu = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.NavigationBarBackground); texCoordsBorderLine = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.NavigationBarUnderLine); this.backIcon = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.BackIconTextureName + postFix, false); this.navDownIcon = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.NavMenuTextureName + postFix, false); height *= scaleFactor; guiStyleTitle.fontSize = (int)(titleFontSize * scaleFactor); this.popUpOffset *= scaleFactor; guiStyleTitle.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.NavigationBarTitle); guiStyleDoneButton.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.NavigationBarPositive); hMargin *= scaleFactor; vMargin *= scaleFactor; editButtonPosition = FresviiGUIUtility.RectScale(editButtonPosition, scaleFactor); navButtonPosition = FresviiGUIUtility.RectScale(navButtonPosition, scaleFactor); callIconPosition = FresviiGUIUtility.RectScale(callIconPosition, scaleFactor); iconColor = colorNormal = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.NavigationBarNormal); guiStyleDoneButton.fontSize = (int)(guiStyleDoneButton.fontSize * scaleFactor); guiStyleDoneButton.padding = FresviiGUIUtility.RectOffsetScale(guiStyleDoneButton.padding, scaleFactor); if (this.other != null) { this.title = FresviiGUIUtility.Truncate(other.Name, guiStyleTitle, Screen.width - vMargin * 4f - backIcon.width - navDownIcon.width, "..."); } else { if (frameChat.Group.Members == null) { frameChat.Group.FetchMembers((error) => { if (error == null) { SetMemberNames(); } }); } else if (frameChat.Group.Members.Count == 0) { frameChat.Group.FetchMembers(delegate(Fresvii.AppSteroid.Models.Error error) { if (error == null) { SetMemberNames(); } }); } else { SetMemberNames(); } } CalcLayout(); if (frameChat.Group != null) { if (!frameChat.Group.Pair) enableEditMember = true; } }