public void Show(string imageUrl, int guiDepth, Action onDoneCallback) { if (string.IsNullOrEmpty(imageUrl)) return; this.imageUrl = imageUrl; OnDoneCallback = onDoneCallback; textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.ModalBackground); this.guiDepth = guiDepth; loadingSpinnerSize *= FresviiGUIManager.Instance.ScaleFactor; loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, guiDepth - 10); FresviiGUIManager.Instance.resourceManager.TextureFromCacheOrDownloadOrMemory(this.imageUrl, true, delegate(Texture2D tex) { loadingSpinner.Hide(); this.texture = tex; imagePosition = new Vector2(Screen.width * 0.5f, Screen.height * 0.5f); imageRect = new Rect(0f, 0f, Screen.width, Screen.width * texture.height / texture.width); if (imageRect.height > Screen.height) { float w = texture.width * Screen.height / texture.height; imageRect = new Rect(0.5f * (Screen.width - w), 0f, w, Screen.height); } }); }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { this.GuiDepth = guiDepth; textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); loadingSpinnerPlace = LoadingSpinnerPlace.Center; loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, FASGui.GuiDepthBase); forumTopMenu = GetComponent<FresviiGUIForumTopMenu>(); tabBar = GetComponent<FresviiGUITabBar>(); forumTopMenu.Init(appIcon, postFix, scaleFactor, FresviiGUIText.Get("Forum")); tabBar.Init(postFix, scaleFactor, this.GuiDepth - 1); this.scaleFactor = scaleFactor; this.verticalMargin = verticalMargin * scaleFactor; this.reloadHeight *= scaleFactor; this.sideMargin *= scaleFactor; this.loadingSpinnerSize *= scaleFactor; this.postFix = postFix; TexForumCommentS = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumCommentSTextureName + postFix, false); TexForumCommentSH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumCommentSHTextureName + postFix, false); TexForumLikeS = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeSTextureName + postFix, false); TexForumLikeSH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeSHTextureName + postFix, false); TexForumCommentL = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumCommentLTextureName + postFix, false); TexForumCommentLH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumCommentLHTextureName + postFix, false); TexForumLikeL = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeLTextureName + postFix, false); TexForumLikeLH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeLHTextureName + postFix, false); TexForumLikeM = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeMTextureName + postFix, false); TexForumLikeMH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeMHTextureName + postFix, false); TexForumMenu = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumMenuTextureName + postFix, false); TexForumMenuH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumMenuHTextureName + postFix, false); TexVideoPlaybackIcon = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.VideoPlaybackIconTextureName, false); TexVideoIcon = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.VideoIconTextureName, false); FASForum.GetForumThreadsFromCache(OnGetForumThreads); GetForumThreads(); Initialized = true; frameCreateThread = ((GameObject)Instantiate(prfbGUIFrameCreateThread)).GetComponent<FresviiGUIFrame>(); frameCreateThread.transform.parent = this.transform; frameCreateThread.Init(appIcon, postFix, scaleFactor, this.GuiDepth - 10); frameCreateThread.PostFrame = this; frameCreateThread.SetDraw(false); tabBar.GuiDepth = this.GuiDepth - 1; SetScrollSlider(scaleFactor * 2.0f); }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { FASGesture.Resume(); this.GuiDepth = guiDepth; textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); chatTopMenu = GetComponent<FresviiGUIChatTopMenu>(); addCommentBottomMenu = GetComponent<FresviiGUIAddCommentBottomMenu>(); chatTopMenu.Init(appIcon, postFix, scaleFactor, GuiDepth - 1, this); addCommentBottomMenu.Init(postFix, scaleFactor, GuiDepth - 1, this, AddComment); addCommentBottomMenu.autoSendImageLoaded = true; this.scaleFactor = scaleFactor; this.postFix = postFix; loadingSpinnerSize *= scaleFactor; sideMargin *= scaleFactor; topMargin *= scaleFactor; balloonMargin *= scaleFactor; balloonMatTexture = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ChatBalloonTextureName + this.postFix, false); balloonTriangleTexture = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ChatBalloonTriangleTextureName + this.postFix, false); videoPlaybackIconTexture = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.VideoPlaybackIconTextureName, false); chatDateBg = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ChatDateBgTextureName + postFix, false); loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, this.GuiDepth - 10); heightDate *= scaleFactor; guiStyleDate.fontSize = (int)(guiStyleDate.fontSize * scaleFactor); guiStyleDate.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.CardText1); guiStyleDate.padding = FresviiGUIUtility.RectOffsetScale(guiStyleDate.padding, scaleFactor); chatBalloonColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.ChatBalloon); if (Application.platform == RuntimePlatform.IPhonePlayer) { guiStyleDate.font = null; } SetScrollSlider(scaleFactor * 2.0f); StartCoroutine(PollingGetMessages()); if (Application.internetReachability == NetworkReachability.NotReachable) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("Offline"), delegate(bool del) { }); loadingSpinner.Hide(); return; } }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { this.GuiDepth = guiDepth; textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); threadTopMenu = GetComponent<FresviiGUIThreadTopMenu>(); threadBottomMenu = GetComponent<FresviiGUIThreadBottomMenu>(); this.postFix = postFix; threadTopMenu.Init(appIcon, postFix, scaleFactor); threadBottomMenu.Init(postFix, scaleFactor, this); this.scaleFactor = scaleFactor; this.sideMargin *= scaleFactor; this.verticalMargin = verticalMargin * scaleFactor; this.loadingSpinnerSize *= scaleFactor; this.reloadHeight *= scaleFactor; TexForumLikeM = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeMTextureName + postFix, false); TexForumLikeMH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeMHTextureName + postFix, false); TexForumLikeL = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeLTextureName + postFix, false); TexForumLikeLH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeLHTextureName + postFix, false); this.baseRect = new Rect(Position.x, Position.y + threadTopMenu.height, Screen.width, Screen.height - threadTopMenu.height - threadBottomMenu.height); if (Application.internetReachability == NetworkReachability.NotReachable) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("Offline"), delegate(bool del) { }); return; } else { if (cards == null) { cards = new List<FresviiGUICommentCard>(); } else { foreach (FresviiGUICommentCard card in cards) { Destroy(card.gameObject); } cards.Clear(); } pageLoaded = 0; int pageNum = (int)(Thread.CommentCount / 25 + 1); for (uint i = 1; i <= pageNum; i++) { FASForum.GetThreadComments(this.Thread.Id, i, OnGetThreadComments); } } Initialized = true; loadingSpinnerPlace = LoadingSpinnerPlace.Center; loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, FASGui.GuiDepthBase); threadTopMenu.GuiDepth = GuiDepth - 1; threadBottomMenu.GuiDepth = GuiDepth - 1; SetScrollSlider(scaleFactor * 2.0f); }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { ControlLock = false; this.GuiDepth = guiDepth; if (Application.platform == RuntimePlatform.IPhonePlayer) { guiStyleLabelTo.font = null; guiStyleLableToUsers.font = null; } textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); groupMessageCreateTopMenu = GetComponent<FresviiGUIGroupMessageCreateTop>(); groupMessageCreateTopMenu.Init(appIcon, postFix, scaleFactor, GuiDepth - 1, this); guiStyleLabelTo.fontSize = (int)(guiStyleLabelTo.fontSize * scaleFactor); guiStyleLabelTo.padding = FresviiGUIUtility.RectOffsetScale(guiStyleLabelTo.padding, scaleFactor); guiStyleLableToUsers.fontSize = (int)(guiStyleLableToUsers.fontSize * scaleFactor); addCommentBottomMenu = GetComponent<FresviiGUIAddCommentBottomMenu>(); addCommentBottomMenu.Init(postFix, scaleFactor, GuiDepth - 1, this, AddComment); addCommentBottomMenu.autoSendImageLoaded = true; this.scaleFactor = scaleFactor; toMargin *= scaleFactor; loadingSpinnerSize *= scaleFactor; sideMargin *= scaleFactor; topMargin = scaleFactor; heightMessageTo *= scaleFactor; scrollPosition.y = 0.0f; textureCoordsTo = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.CardBackground); textureCheckMark = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.IconFriendTextureName + postFix, false); FASFriendship.GetAccountFriendList(OnGetFriends); contentLabelTo = new GUIContent(FresviiGUIText.Get("To")); loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, GuiDepth - 10); SetScrollSlider(scaleFactor * 2.0f); addCommentBottomMenu.SetSendEnableAtAction(false, FresviiGUIText.Get("Error"), FresviiGUIText.Get("NoSelectedMember")); FASUser.GetOfficialUser((user, error) => { if (error == null) { OfficialUser = user; } }); }
void OnPullDownReflesh() { if (loading || loadBlock) return; loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Top; loadingSpinner.Position = new Rect(baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, baseRect.y + segmentedCtrlBgPosition.height + pullRefleshHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinner.Position, this.GuiDepth - 1); pullRefleshing = true; if (selectedIndex == 0) { FASFriendship.GetFriendshipRequestedUsersList(FAS.CurrentUser.Id, OnGetFriendshipRequestedUsersList); } else { FASFriendship.GetHiddenFriendshipRequestedUsersList(OnGetHiddenFriendshipRequestedUsersList); } }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { this.GuiDepth = guiDepth; this.scaleFactor = scaleFactor; this.postFix = postFix; textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); userProfileTopMenu = GetComponent<FresviiGUIMyProfileTopMenu>(); tabBar = GetComponent<FresviiGUITabBar>(); if (Application.platform == RuntimePlatform.IPhonePlayer) { guiStyleLabelUserName.font = null; guiStyleLabelUserName.fontStyle = FontStyle.Bold; guiStyleLabelUserProfile.font = null; guiStyleButtonFriend.font = null; guiStyleButtonMessage.font = null; guiStyleFriendNotification.font = null; guiStyleFriendMenuTitle.font = null; guiStyleFriendMenuTitle.fontStyle = FontStyle.Bold; guiStyleLabelUserCode.font = null; } palette = FresviiGUIColorPalette.Palette; userProfileTopMenu.Init(appIcon, postFix, scaleFactor,this, GuiDepth - 1); tabBar.Init(postFix, scaleFactor, this.GuiDepth - 1); sideMargin *= scaleFactor; vMargin *= scaleFactor; margin *= scaleFactor; miniMargin *= scaleFactor; profileImageBgMargin *= scaleFactor; myProfileImageSize *= scaleFactor; topMargin *= scaleFactor; friendNotificationHeight *= scaleFactor; friendMenuTitleBarHeight *= scaleFactor; hMargin *= scaleFactor; loadingSpinnerSize *= scaleFactor; profileImageSize *= scaleFactor; guiStyleLabelUserName.fontSize = (int)(guiStyleLabelUserName.fontSize * scaleFactor); guiStyleLabelUserName.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.ProfileUserName); guiStyleLabelUserCode.fontSize = (int)(guiStyleLabelUserCode.fontSize * scaleFactor); guiStyleLabelUserCode.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.ProfileUserName); guiStyleLabelUserProfile.fontSize = (int)(guiStyleLabelUserProfile.fontSize * scaleFactor); guiStyleLabelUserProfile.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.ProfileDescription); guiStyleFriendNotification.fontSize = (int)(guiStyleFriendNotification.fontSize * scaleFactor); guiStyleFriendNotification.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.ProfileNotificationText); guiStyleFriendMenuTitle.fontSize = (int)(guiStyleFriendMenuTitle.fontSize * scaleFactor); guiStyleFriendMenuTitle.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.ProfileFriendBarText); guiStyleFriendMenuTitle.padding = FresviiGUIUtility.RectOffsetScale(guiStyleFriendMenuTitle.padding, scaleFactor); textureMyProfileDefault = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.UserTextureName + postFix, false); texCoordsNotificationBg = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.ProfileNotificationBackground); texCoordsFriendTitleBg = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.ProfileFriendBarBackground); texCoordsFriendTitleBgH = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.ProfileFriendBarBackgroundH); texCoordsFriendTitleLine = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.ProfileFriendBarLine); textureRight = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.RightIconTextureName + postFix, false); scrollPosition = Vector2.zero; frameMyProfileEdit = ((GameObject)Instantiate(prfbGUIFrameMyProfileEdit)).GetComponent<FresviiGUIFrame>(); guiEdit = frameMyProfileEdit.gameObject.GetComponent<FresviiGUIMyProfileEdit>(); frameMyProfileEdit.Init(FresviiGUIManager.appIcon, FresviiGUIManager.postFix, FresviiGUIManager.scaleFactor, GuiDepth - 20); frameMyProfileEdit.GetComponent<FresviiGUIMyProfileEdit>().SetGUIMyProfile(this); frameMyProfileEdit.transform.parent = this.transform; frameMyProfileEdit.SetDraw(false); textureMyProfileCircle = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.UserCircleTextureName + postFix, false); loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, FASGui.GuiDepthBase); GetAccout(); SetScrollSlider(scaleFactor * 2.0f); requestLabelContent = new GUIContent(FresviiGUIText.Get("FriendRequests")); friendCountLabelContent = new GUIContent(FresviiGUIText.Get("Friends")); videoListLabelContent = new GUIContent(FresviiGUIText.Get("Videos")); directMessageListLabelContent = new GUIContent(FresviiGUIText.Get("DirectMessages")); }
void OnGUI() { GUI.depth = GuiDepth; GUI.DrawTextureWithTexCoords(menuRect, palette, texCoordsMenu); GUI.DrawTextureWithTexCoords(new Rect(menuRect.x, menuRect.y - 1, Screen.width, 1), palette, texCoordsBorderLine); GUI.BeginGroup(menuRect); Event e = Event.current; if (!imageLoading) { if (clipImage == null) { GUI.DrawTexture(addButtonPosition, addButton, ScaleMode.ScaleToFit); } else { GUI.DrawTexture(addButtonPosition, clipImage, ScaleMode.ScaleAndCrop); } } if (!imageLoading) { if (GUI.Button(addButtonHitPosition, "", GUIStyle.none) && !parentFrame.ControlLock) { if (!sendEnableAtAction) { Fresvii.AppSteroid.Util.DialogManager.Instance.SetLabel(FresviiGUIText.Get("OK"), FresviiGUIText.Get("Cancel"), FresviiGUIText.Get("Close")); Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(sendUnableAtActionMessage, delegate(bool del) { }); } else { List<string> buttons = new List<string>(); buttons.Add(FresviiGUIText.Get("TakePhoto")); buttons.Add(FresviiGUIText.Get("ChoosePhoto")); buttons.Add(FresviiGUIText.Get("ChooseMovie")); if (clipImage != null) buttons.Add(FresviiGUIText.Get("CancelPhoto")); if (video != null) { buttons.Add(FresviiGUIText.Get("CancelVideo")); } actionSheet = Fresvii.AppSteroid.Gui.ActionSheet.Show(scaleFactor, postFix, this.GuiDepth - 10, buttons.ToArray(), (selectedButton) => { if (selectedButton == FresviiGUIText.Get("TakePhoto")) // TakePhoto { imageLoading = true; loadingSpinnerPosition = new Rect(menuRect.x + addButtonPosition.x, menuRect.y + addButtonPosition.y, addButtonPosition.width, addButtonPosition.height); loadingSpiner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, GUI.depth); Fresvii.AppSteroid.Util.ImagePicker.Show(this, Fresvii.AppSteroid.Util.ImagePicker.Type.Camera, delegate(Texture2D loadedTexture) { imageLoading = false; loadingSpiner.Hide(); if (loadedTexture != null) { if (clipImage != null) { Destroy(clipImage); clipImage = null; } clipImage = loadedTexture; video = null; if (autoSendImageLoaded) { Send("", clipImage, video); } } }); } else if (selectedButton == FresviiGUIText.Get("ChoosePhoto")) // Choose Photo from library { imageLoading = true; loadingSpiner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(new Rect(menuRect.x + addButtonPosition.x, menuRect.y + addButtonPosition.y, addButtonPosition.width, addButtonPosition.height), GUI.depth); Fresvii.AppSteroid.Util.ImagePicker.Show(this, Fresvii.AppSteroid.Util.ImagePicker.Type.Gallery, delegate(Texture2D loadedTexture) { imageLoading = false; loadingSpiner.Hide(); if (loadedTexture != null) { if (clipImage != null) { Destroy(clipImage); clipImage = null; } clipImage = loadedTexture; video = null; if (autoSendImageLoaded) { Send("", clipImage, video); } } }); } else if (selectedButton == FresviiGUIText.Get("ChooseMovie")) // Choose Video from library { imageLoading = true; loadingSpiner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(new Rect(menuRect.x + addButtonPosition.x, menuRect.y + addButtonPosition.y, addButtonPosition.width, addButtonPosition.height), GUI.depth); FresviiGUIVideoList.Show(parentFrame, int.MinValue + 1000, delegate(Fresvii.AppSteroid.Models.Video _video, Texture2D loadedTexture) { imageLoading = false; loadingSpiner.Hide(); if (loadedTexture != null) { if (clipImage != null) { Destroy(clipImage); clipImage = null; } clipImage = loadedTexture; this.video = _video; if (autoSendImageLoaded) { Send("", clipImage, video); } } }); } else if (selectedButton == FresviiGUIText.Get("CancelPhoto")) // Cancel photo { if (clipImage != null) { Destroy(clipImage); clipImage = null; video = null; } } else if (selectedButton == FresviiGUIText.Get("CancelVideo")) // Cancel video { if (clipImage != null) { Destroy(clipImage); clipImage = null; video = null; } } }); } } } FresviiGUIUtility.DrawButtonFrameX9(textFieldPosition, textFiled); if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXEditor) { textInputField = GUI.TextField(textFieldPosition, textInputField, guiStyleTextFiled); } else{ if (e.type == EventType.MouseUp && textFieldPosition.Contains(e.mousePosition) && !FASGesture.IsDragging) { e.Use(); FresviiGUIPopUpShield shield = gameObject.GetComponent<FresviiGUIPopUpShield>(); if(shield == null) { shield = gameObject.AddComponent<FresviiGUIPopUpShield>(); } shield.Enable(delegate () { if(keyboard != null) { keyboard.active = false; keyboard.text = ""; keyboard = null; } }); keyboard = TouchScreenKeyboard.Open(textInputField, TouchScreenKeyboardType.Default, false, true, false, false); } if (keyboard != null) { textInputField = keyboard.text; if(keyboard.done || keyboard.wasCanceled || !keyboard.active) { gameObject.GetComponent<FresviiGUIPopUpShield>().Done(); keyboard = null; } } GUI.Label(textFieldPosition, textInputField, guiStyleTextFiled); } bool sendOK = ((clipImage != null) || !string.IsNullOrEmpty(textInputField)); guiStyleSendButton.normal.textColor = (sendOK) ? buttonTextEnableColor : buttonTextUnableColor; Texture2D sendButtonTexture = (sendOK) ? sendButton : sendButtonD; if (sending) { sendButtonTexture = sendButtonH; guiStyleSendButton.normal.textColor = buttonTextHitColor; } FresviiGUIUtility.DrawButtonFrameX9(sendButtonPosition, sendButtonTexture); GUI.Label(sendButtonPosition, FresviiGUIText.Get("send"), guiStyleSendButton); if (e.type == EventType.MouseUp && sendButtonPosition.Contains(e.mousePosition) && sendOK && !FASGesture.IsDragging && !parentFrame.ControlLock) { e.Use(); if (!sendEnableAtAction) { Fresvii.AppSteroid.Util.DialogManager.Instance.SetLabel(FresviiGUIText.Get("OK"), FresviiGUIText.Get("Cancel"), FresviiGUIText.Get("Close")); if (string.IsNullOrEmpty(sendUnableAtActionDialogTitle)) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(sendUnableAtActionMessage, delegate(bool del) { }); } else { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(sendUnableAtActionDialogTitle, sendUnableAtActionMessage, delegate(bool del) { }); } } else { Send(textInputField, clipImage, video); textInputField = ""; if (keyboard != null) { keyboard.text = ""; } keyboard = null; clipImage = null; video = null; } } GUI.EndGroup(); }
void OnGUI() { GUI.DrawTextureWithTexCoords(backgroundRect, FresviiGUIColorPalette.Palette, textureCoordsBackground); if(user == null) return; if (!hasError) { GUI.depth = GuiDepth; GUI.BeginGroup(baseRect); GUI.BeginGroup(scrollViewRect); // User Image GUI.DrawTexture(userImagePosition, (textureUserProfile == null) ? textureUserProfileDefault : textureUserProfile, ScaleMode.ScaleToFit); Color tmp = GUI.color; GUI.color = bgColor; GUI.DrawTexture(userImagePosition, textureUserProfileMask, ScaleMode.ScaleToFit); GUI.color = tmp; GUI.DrawTexture(userImagePosition, textureUserProfileCircle, ScaleMode.ScaleToFit); // User name GUI.Label(userNamePosition, userNameContent, guiStyleLabelUserName); if (!string.IsNullOrEmpty(user.Description)) { GUI.Label(userDescriptionPosition, userDescriptionContent, guiStyleLabelUserProfile); } if (user.Official) { GUI.EndGroup(); GUI.EndGroup(); return; } Event e = Event.current; // Holding - menu apper if (userNamePosition.Contains(e.mousePosition) && FASGesture.IsHolding && !FASGesture.IsDragging && !ControlLock) { List<string> buttons = new List<string>(); buttons.Add(FresviiGUIText.Get("Copy")); Vector2 postion = new Vector2(baseRect.x + scrollViewRect.x + userNamePosition.x + userNamePosition.width * 0.5f, baseRect.y + scrollViewRect.y + userNamePosition.y); ControlLock = true; popOverBalloonMenu = Fresvii.AppSteroid.Gui.PopOverBalloonMenu.Show(scaleFactor, postFix, this.GuiDepth - 30, postion, buttons.ToArray(), (selectedButton) => { ControlLock = false; if (selectedButton == FresviiGUIText.Get("Copy")) { Fresvii.AppSteroid.Util.Clipboard.SetText(user.Name); } }); popOverBalloonMenu.Name = "UserName"; } // User Code GUI.Label(userCodePosition, userCodeContent, guiStyleLabelUserCode); // Holding - menu apper if (userCodePosition.Contains(e.mousePosition) && FASGesture.IsHolding && !FASGesture.IsDragging && !ControlLock) { List<string> buttons = new List<string>(); buttons.Add(FresviiGUIText.Get("Copy")); Vector2 postion = new Vector2(baseRect.x + scrollViewRect.x + userCodePosition.x + userCodePosition.width * 0.5f, baseRect.y + scrollViewRect.y + userCodePosition.y); ControlLock = true; popOverBalloonMenu = Fresvii.AppSteroid.Gui.PopOverBalloonMenu.Show(scaleFactor, postFix, this.GuiDepth - 30, postion, buttons.ToArray(), (selectedButton) => { ControlLock = false; if (selectedButton == FresviiGUIText.Get("Copy")) { Fresvii.AppSteroid.Util.Clipboard.SetText(user.UserCode); } }); popOverBalloonMenu.Name = "UserCode"; } if (userInfoEnable) { #region Friend button if (user.FriendStatus == Fresvii.AppSteroid.Models.User.FriendStatuses.Requesting) { guiStyleButtonFriend.normal.textColor = btnNegativeColor; buttonFriend.IsTap(e, friendButtonPosition, friendButtonPosition, FresviiGUIButton.ButtonType.FrameAndLabel, textureButton03, textureButton03, textureButton03, FresviiGUIText.Get("RequestSent"), guiStyleButtonFriend); } /*else if (user.FriendStatus == User.FriendStatuses.Requested) { guiStyleButtonFriend.normal.textColor = btnNegativeColor; buttonFriend.IsTap(e, friendButtonPosition, friendButtonPosition, FresviiGUIButton.ButtonType.FrameAndLabel, textureButton03, textureButton03, textureButton03, FresviiGUIText.Get("Requested"), guiStyleButtonFriend); }*/ else if (user.FriendStatus == Fresvii.AppSteroid.Models.User.FriendStatuses.Friend) { guiStyleButtonFriend.normal.textColor = btnPositiveColor; if (buttonFriend.IsTap(e, friendButtonPosition, friendButtonPosition, FresviiGUIButton.ButtonType.FrameAndLabel, textureButton01, textureButton01H, textureButton01H, FresviiGUIText.Get("Unfriend"), guiStyleButtonFriend)) { Fresvii.AppSteroid.Util.DialogManager.Instance.SetLabel(FresviiGUIText.Get("Unfriend"), FresviiGUIText.Get("Cancel"), FresviiGUIText.Get("Close")); Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSelectDialog(FresviiGUIText.Get("ConfirmUnfriend"), delegate(bool del) { #if UNITY_EDITOR if (true) #else if(del) #endif { if (Application.internetReachability == NetworkReachability.NotReachable) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("Offline"), delegate(bool _del) { }); } else { FASFriendship.UnFriend(this.user.Id, delegate(Fresvii.AppSteroid.Models.Error error) { if (error == null) { user.SetFriendStatus(Fresvii.AppSteroid.Models.FriendshipRequest.Statuses.none.ToString()); DeletePairGroupMessages(user.Id, deleteGroupRetryCount, deleteGroupRetryInterval); } else { if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error) { Debug.LogError(error.ToString()); } Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("UnknownError"), delegate(bool _del) { }); } }); } } }); } } else { guiStyleButtonFriend.normal.textColor = btnPositiveColor; if (buttonFriend.IsTap(e, friendButtonPosition, friendButtonPosition, FresviiGUIButton.ButtonType.FrameAndLabel, textureButton01, textureButton01H, textureButton01H, FresviiGUIText.Get("AddFriend"), guiStyleButtonFriend)) { if (Application.internetReachability == NetworkReachability.NotReachable) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("Offline"), delegate(bool del) { }); } else { user.SetFriendStatus(Fresvii.AppSteroid.Models.FriendshipRequest.Statuses.requesting.ToString()); FASFriendship.SendFriendshipRequest(this.user.Id, delegate(Fresvii.AppSteroid.Models.FriendshipRequest friendshipRequest, Fresvii.AppSteroid.Models.Error error) { if (error == null) { user.SetFriendStatus(friendshipRequest.Status.ToString()); } else { if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error) Debug.LogError(error.ToString()); Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("UnknownError"), delegate(bool del) { }); user.SetFriendStatus(Fresvii.AppSteroid.Models.FriendshipRequest.Statuses.none.ToString()); } }); } } } } #endregion #region Message button if (buttonMessage.IsTap(e, messageButtonPosition, messageButtonPosition, FresviiGUIButton.ButtonType.TextureOnly, textureIconMessage, textureIconMessage, textureIconMessage)) { if (Application.internetReachability == NetworkReachability.NotReachable) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("Offline"), delegate(bool del) { }); } else { FresviiGUIFrame framePairChat = ((GameObject)Instantiate(prfbGUIFramePairChat)).GetComponent<FresviiGUIFrame>(); framePairChat.transform.parent = this.transform; framePairChat.gameObject.GetComponent<FresviiGUIChat>().SetPairUser(this.user); framePairChat.Init(null, postFix, scaleFactor, this.GuiDepth - 1); framePairChat.SetDraw(true); framePairChat.PostFrame = this; this.tabBar.enabled = false; this.Tween(Vector2.zero, new Vector2(-Screen.width, 0.0f), moveDelayTime, delegate() { this.SetDraw(false); }); framePairChat.Tween(new Vector2(Screen.width, 0.0f), Vector2.zero, moveDelayTime, delegate() { }); } } GUI.Label(messageLabelPosition, messageLabelContent, guiStyleButtonLabel); #endregion #region Call button #if GROUP_CONFERENCE if (!user.Official) { bool isCalling = FASConference.IsCalling(); Texture2D textureCall = (isCalling) ? textureIconCallD : textureIconCall; if (buttonMessage.IsTap(e, callButtonPosition, callButtonPosition, FresviiGUIButton.ButtonType.TextureOnly, textureCall, textureCall, textureCall)) { #if !UNITY_EDITOR if (isCalling) { Fresvii.AppSteroid.Util.DialogManager.Instance.SetLabel(FresviiGUIText.Get("OK"), FresviiGUIText.Get("Cancel"), FresviiGUIText.Get("Close")); Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("VoiceChatAlredayExists"), delegate(bool del) { }); return; } #endif if (Application.internetReachability == NetworkReachability.NotReachable) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("Offline"), delegate(bool del) { }); } else { loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, this.GuiDepth - 10); FASGroup.CreatePair(user.Id, delegate(Fresvii.AppSteroid.Models.Group group, Fresvii.AppSteroid.Models.Error error) { if (error != null) { loadingSpinner.Hide(); if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error) { Debug.LogError("CreatePair : " + error.ToString()); } Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog("Error : CreatePair " + error.ToString(), delegate(bool del) { }); } else { loadingSpinner.Hide(); group.FetchMembers(delegate(Fresvii.AppSteroid.Models.Error error2) { if (error2 != null) { if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error) { Debug.LogError("FetchMembers : " + error.ToString()); } Fresvii.AppSteroid.Util.DialogManager.Instance.SetLabel(FresviiGUIText.Get("OK"), FresviiGUIText.Get("Cancel"), FresviiGUIText.Get("Close")); if (error.Code == (int)Fresvii.AppSteroid.Models.Error.ErrorCode.NetworkNotReachable) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("Offline"), delegate(bool del) { }); } else { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(error.Detail, delegate(bool del) { }); } } else { OnCallButtonTapped(group); } }); } }); } } GUI.Label(callLabelPosition, callLabelContent, guiStyleButtonLabel); } #endif #endregion // User FriendTitleBar if (friendCountLabelContent != null) { GUI.DrawTextureWithTexCoords(friendMenuTitleBarPosition, palette, buttonFriendList.IsActive ? texCoordsFriendTitleBgH : texCoordsFriendTitleBg); GUI.Label(friendMenuTitleBarPosition, friendCountLabelContent, guiStyleFriendMenuTitle); GUI.DrawTexture(friendMenuRightIconPosition, textureRight); } #if UNITY_IOS // VideoTitleBar if (FASConfig.Instance.videoEnable) { GUI.DrawTextureWithTexCoords(videoTitleBarPosition, palette, buttonVideoList.IsActive ? texCoordsFriendTitleBgH : texCoordsFriendTitleBg); GUI.Label(videoTitleBarPosition, videoListLabelContent, guiStyleFriendMenuTitle); GUI.DrawTexture(videoRightIconPosition, textureRight); if (buttonVideoList.IsTap(e, videoTitleBarPosition)) { GoToVideoList(true); } } #endif if(buttonFriendList.IsTap(e, friendMenuTitleBarPosition)) { frameFriendList = ((GameObject)Instantiate(prfbFriendList)).GetComponent<FresviiGUIFrame>(); frameFriendList.transform.parent = this.transform; frameFriendList.gameObject.GetComponent<FresviiGUIFriendList>().SetUser(this.user); frameFriendList.Init(null, postFix, scaleFactor, this.GuiDepth - 1); frameFriendList.SetDraw(true); frameFriendList.PostFrame = this; this.Tween(Vector2.zero, new Vector2(-Screen.width, 0.0f), delegate() { this.SetDraw(false); }); frameFriendList.Tween(new Vector2(Screen.width, 0.0f), Vector2.zero, delegate() { }); } GUI.EndGroup(); GUI.EndGroup(); } }
void OnPullUpReflesh() { if (videoListMeta != null) { if (videoListMeta.NextPage != null && !videoListLoading) { bottomLoadingSpinnerPosition = new Rect(Position.x + baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + baseRect.y + baseRect.height - pullRefleshHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); bottomLoadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(bottomLoadingSpinnerPosition, GuiDepth - 5); videoListLoading = true; if (user == null) { FASVideo.GetCurrentUserVideoList((uint)videoListMeta.NextPage, OnGetVideoList); } else { string query = "{\"where\":[{\"collection\":\"users\", \"column\":\"id\", \"value\":\"" + user.Id + "\"}]}"; FASVideo.GetVideoList((uint)videoListMeta.NextPage, query, OnGetVideoList); } } } }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { this.GuiDepth = guiDepth; if (Application.platform == RuntimePlatform.IPhonePlayer) { guiStyleVideoNumLabel.font = null; guiStyleVideoNumLabel.fontStyle = FontStyle.Bold; } textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); videoListTopMenu = GetComponent<FresviiGUIVideoListTop>(); videoListTopMenu.Init(appIcon, postFix, scaleFactor, GuiDepth - 1, this); tabBar = GetComponent<FresviiGUITabBar>(); if (!IsModal) { tabBar.Init(postFix, scaleFactor, this.GuiDepth - 1); tabBar.GuiDepth = GuiDepth - 1; } else { tabBar.enabled = false; } this.scaleFactor = scaleFactor; this.postFix = postFix; loadingSpinnerSize *= scaleFactor; sideMargin *= scaleFactor; topMargin *= scaleFactor; cardMargin *= scaleFactor; videoNumLabelHeight *= scaleFactor; loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, GuiDepth - 10); pullRefleshHeight *= scaleFactor; guiStyleVideoNumLabel.fontSize = (int)(guiStyleVideoNumLabel.fontSize * scaleFactor); SetScrollSlider(scaleFactor * 2.0f); TexVideoPlaybackIcon = Fresvii.AppSteroid.Util.ResourceManager.Instance.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.VideoListIconPlayTextureName + postFix, false); TexVideoEyeIcon = Fresvii.AppSteroid.Util.ResourceManager.Instance.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.VideoListIconEyeTextureName + postFix, false); TexVideoHeartIcon = Fresvii.AppSteroid.Util.ResourceManager.Instance.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.VideoListIconHeaertTextureName + postFix, false); TexButtonShare = Fresvii.AppSteroid.Util.ResourceManager.Instance.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ButtonShareTextureName + postFix, false); TexButtonShareH = Fresvii.AppSteroid.Util.ResourceManager.Instance.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ButtonShareHTextureName + this.postFix, false); videoListLoading = true; if (user == null) { IsMine = true; FASVideo.GetCurrentUserVideoList(OnGetVideoList); } else { IsMine = false; string query = "{\"where\":[{\"collection\":\"users\", \"column\":\"id\", \"value\":\"" + user.Id + "\"}]}"; FASVideo.GetVideoList(query, OnGetVideoList); } if(FASGesture.Instance == null) { gameObject.AddComponent<FASGesture>(); } TexMenu = Fresvii.AppSteroid.Util.ResourceManager.Instance.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumMenuTextureName + postFix, false); TexMenuH = Fresvii.AppSteroid.Util.ResourceManager.Instance.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumMenuHTextureName + postFix, false); }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { ControlLock = false; this.GuiDepth = guiDepth; this.postFix = postFix; if (Application.platform == RuntimePlatform.IPhonePlayer) { guiStyleLabelAddContact.font = null; guiStyleLableToUsers.font = null; } textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); editGroupMemberTopMenu = GetComponent<FresviiGUIEditGroupMemberTop>(); editGroupMemberTopMenu.Init(appIcon, postFix, scaleFactor, GuiDepth - 1, this); guiStyleLabelAddContact.fontSize = (int)(guiStyleLabelAddContact.fontSize * scaleFactor); guiStyleLabelAddContact.padding = FresviiGUIUtility.RectOffsetScale(guiStyleLabelAddContact.padding, scaleFactor); guiStyleLableToUsers.fontSize = (int)(guiStyleLableToUsers.fontSize * scaleFactor); this.scaleFactor = scaleFactor; toMargin *= scaleFactor; loadingSpinnerSize *= scaleFactor; sideMargin *= scaleFactor; topMargin = scaleFactor; heightAddContact *= scaleFactor; scrollPosition.y = 0.0f; guiStyleLabelAddContact.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.NavigationBarNormal); textureCheckMark = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.IconFriendTextureName + postFix, false); loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, GuiDepth - 10); labelAddContactPosition = FresviiGUIUtility.RectScale(labelAddContactPosition, scaleFactor); plusIconPosition = FresviiGUIUtility.RectScale(plusIconPosition, scaleFactor); FASGroup.GetGroupMemberList(Group.Id, OnGetMembers); SetScrollSlider(scaleFactor * 2.0f); }
void OnGUI() { GUI.depth = GuiDepth; GUI.DrawTextureWithTexCoords(menuRect, palette, texCoordsMenu); GUI.DrawTextureWithTexCoords(new Rect(menuRect.x, menuRect.y - 1, Screen.width, 1), palette, texCoordsBorderLine); GUI.BeginGroup(menuRect); Event e = Event.current; if (!imageLoading) { if (clipImage == null) { GUI.DrawTexture(addButtonPosition, addButton, ScaleMode.ScaleToFit); } else { GUI.DrawTexture(addButtonPosition, clipImage, ScaleMode.ScaleAndCrop); } } if (!imageLoading) { if (GUI.Button(addButtonHitPosition, "", GUIStyle.none)) { List<string> buttons = new List<string>(); buttons.Add(FresviiGUIText.Get("TakePhoto")); buttons.Add(FresviiGUIText.Get("ChoosePhoto")); buttons.Add(FresviiGUIText.Get("ChooseMovie")); if (clipImage != null) buttons.Add(FresviiGUIText.Get("CancelPhoto")); if (video != null) buttons.Add(FresviiGUIText.Get("CancelVideo")); actionSheet = Fresvii.AppSteroid.Gui.ActionSheet.Show(scaleFactor, postFix, this.GuiDepth - 10, buttons.ToArray(), (selectedButton) => { if (selectedButton == FresviiGUIText.Get("TakePhoto")) // TakePhoto { imageLoading = true; loadingSpinnerPosition = new Rect(menuRect.x + addButtonPosition.x, menuRect.y + addButtonPosition.y, addButtonPosition.width, addButtonPosition.height); loadingSpiner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, GUI.depth); Fresvii.AppSteroid.Util.ImagePicker.Show(this, Fresvii.AppSteroid.Util.ImagePicker.Type.Camera, delegate(Texture2D loadedTexture) { imageLoading = false; loadingSpiner.Hide(); if (loadedTexture != null) { if (clipImage != null) { Destroy(clipImage); clipImage = null; } clipImage = loadedTexture; video = null; } }); } else if (selectedButton == FresviiGUIText.Get("ChoosePhoto")) // Choose Photo from library { imageLoading = true; loadingSpiner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(new Rect(menuRect.x + addButtonPosition.x, menuRect.y + addButtonPosition.y, addButtonPosition.width, addButtonPosition.height), GUI.depth); Fresvii.AppSteroid.Util.ImagePicker.Show(this, Fresvii.AppSteroid.Util.ImagePicker.Type.Gallery, delegate(Texture2D loadedTexture) { imageLoading = false; loadingSpiner.Hide(); if (loadedTexture != null) { if (clipImage != null) { Destroy(clipImage); clipImage = null; } clipImage = loadedTexture; video = null; } }); } else if (selectedButton == FresviiGUIText.Get("ChooseMovie")) // Choose Video from library { imageLoading = true; loadingSpiner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(new Rect(menuRect.x + addButtonPosition.x, menuRect.y + addButtonPosition.y, addButtonPosition.width, addButtonPosition.height), GUI.depth); FresviiGUIVideoList.Show(frameThread, frameThread.GuiDepth - 500, delegate(Fresvii.AppSteroid.Models.Video _video, Texture2D loadedTexture) //ImagePicker.ShowMoviePicker(this, delegate(string path, Texture2D loadedTexture) { imageLoading = false; loadingSpiner.Hide(); if (loadedTexture != null) { if (clipImage != null) { Destroy(clipImage); clipImage = null; } clipImage = loadedTexture; this.video = _video; } }); } else if (selectedButton == FresviiGUIText.Get("CancelPhoto")) // Cancel photo { if (clipImage != null) { Destroy(clipImage); clipImage = null; video = null; } } else if (selectedButton == FresviiGUIText.Get("CancelVideo")) // Cancel video { if (clipImage != null) { Destroy(clipImage); clipImage = null; video = null; } } }); } } FresviiGUIUtility.DrawButtonFrame(textFieldPosition, textFiled, scaleFactor); #if UNITY_EDITOR textInputField = GUI.TextField(textFieldPosition, textInputField, guiStyleTextFiled); #elif UNITY_ANDROID || UNITY_IOS if (e.type == EventType.MouseUp && textFieldPosition.Contains(e.mousePosition) && !FASGesture.IsDragging) //if (GUI.Button(textFieldPosition, textInputField, guiStyleTextFiled)) { e.Use(); FresviiGUIPopUpShield shield = gameObject.GetComponent<FresviiGUIPopUpShield>(); if(shield == null) { shield = gameObject.AddComponent<FresviiGUIPopUpShield>(); } shield.Enable(delegate () { if(keyboard != null) { keyboard.active = false; keyboard.text = ""; keyboard = null; } }); keyboard = TouchScreenKeyboard.Open(textInputField, TouchScreenKeyboardType.Default, false, true, false, false); } if (keyboard != null) { textInputField = keyboard.text; if(keyboard.done || keyboard.wasCanceled || !keyboard.active) { gameObject.GetComponent<FresviiGUIPopUpShield>().Done(); keyboard = null; } } GUI.Label(textFieldPosition, textInputField, guiStyleTextFiled); #endif bool sendEnable = (clipImage != null) || !string.IsNullOrEmpty(textInputField); guiStyleSendButton.normal.textColor = (sendEnable) ? buttonTextEnableColor : buttonTextUnableColor; Texture2D sendButtonTexture = (sendEnable) ? sendButton : sendButtonD; if (sending) { sendButtonTexture = sendButtonH; guiStyleSendButton.normal.textColor = buttonTextHitColor; } FresviiGUIUtility.DrawButtonFrame(sendButtonPosition, sendButtonTexture, scaleFactor); GUI.Label(sendButtonPosition, FresviiGUIText.Get("send"), guiStyleSendButton); if(e.type == EventType.MouseUp && sendButtonPosition.Contains(e.mousePosition) && sendEnable && !FASGesture.IsDragging) { e.Use(); if (Application.internetReachability == NetworkReachability.NotReachable) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("Offline"), delegate(bool del) { }); return; } frameThread.AddComment(frameThread.Thread.Id, textInputField, clipImage, video); StartCoroutine(SendingAnimation()); textInputField = ""; if(keyboard != null) keyboard.text = ""; keyboard = null; clipImage = null; video = null; } GUI.EndGroup(); }
void OnPullDownReflesh() { if (loading || loadBlock) return; if (groupMessagesMeta != null) { uint? loadPage = groupMessagesMeta.NextPage; if (loadPage.HasValue) { loading = true; loadBlock = true; loadingSpinnerTopPosition = new Rect(Position.x + baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + baseRect.y + chatTopMenu.height + pullRefleshHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinnerTop = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerTopPosition, this.GuiDepth - 1); pullRefleshing = true; FASGroup.GetGroupMessageList(Group.Id, (uint)loadPage, OnGetGroupMessagesWithoutScroll); } } }
public void OnPullDownReflesh() { if (loading || loadBlock) return; loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Top; loadingSpinner.Position = new Rect(Position.x + baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + baseRect.y + reloadHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinner.Position); pullRefleshing = true; FASForum.GetForumThreads(delegate(IList<Fresvii.AppSteroid.Models.Thread> _threads, Fresvii.AppSteroid.Models.Error error) { pullRefleshing = false; loading = false; OnCompletePullReflesh(scrollViewRect, baseRect); loadingSpinner.Hide(); if (error == null) { foreach (Fresvii.AppSteroid.Models.Thread thread in _threads) { UpdateThread(thread); } SortCards(); } }); }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { this.GuiDepth = FASGui.GuiDepthBase; textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); groupMessageTopMenu = GetComponent<FresviiGUIGroupMessageTop>(); groupMessageTopMenu.Init(appIcon, postFix, scaleFactor, GuiDepth - 1, this); tabBar = GetComponent<FresviiGUITabBar>(); tabBar.Init(postFix, scaleFactor, this.GuiDepth - 1); this.scaleFactor = scaleFactor; this.postFix = postFix; loadingSpinnerSize *= scaleFactor; sideMargin *= scaleFactor; topMargin = scaleFactor; loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, GuiDepth - 10); pullRefleshHeight *= scaleFactor; FASUser.GetAccount(delegate(Fresvii.AppSteroid.Models.User _user, Fresvii.AppSteroid.Models.Error _error) { }); SetScrollSlider(scaleFactor * 2.0f); FASGroup.GetGroupMessageGroupListFromCache(OnGetGroups); IconUnread = Fresvii.AppSteroid.Util.ResourceManager.Instance.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.IconUnread + postFix, false); }
public void OnPullUpReflesh() { if (loading || loadBlock) return; uint loadPage = 2; if (pullUpListMeta != null) { if (pullUpListMeta.NextPage.HasValue) { loadPage = (uint)pullUpListMeta.NextPage; } else { loadPage = pullUpListMeta.TotalCount / pullUpListMeta.PerPage + 1; } } loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Bottom; loadingSpinner.Position = new Rect(Position.x + baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + baseRect.y + baseRect.height - reloadHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinner.Position); pullRefleshing = true; FASForum.GetForumThreads(loadPage, delegate(IList<Fresvii.AppSteroid.Models.Thread> _threads, Fresvii.AppSteroid.Models.ListMeta _meta, Fresvii.AppSteroid.Models.Error _error) { pullUpListMeta = _meta; pullRefleshing = false; loading = false; loadingSpinner.Hide(); if (_error == null) { float addedHeight = 0.0f; foreach (Fresvii.AppSteroid.Models.Thread thread in _threads) { addedHeight += UpdateThread(thread); } SortCards(); if (addedHeight > 0.0f) { //scrollViewRect.y -= addedHeight; } else { OnCompletePullReflesh(scrollViewRect, baseRect, forumTopMenu.height, tabBar.height); } } else { OnCompletePullReflesh(scrollViewRect, baseRect, forumTopMenu.height, tabBar.height); } }); }
void OnPullDownReflesh() { if (loading || loadBlock) return; loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Top; loadingSpinner.Position = new Rect(Position.x + baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + baseRect.y + pullRefleshHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinner.Position, this.GuiDepth - 1); pullRefleshing = true; FASGroup.GetGroupMessageGroupList(OnGetGroups); }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { ControlLock = false; this.GuiDepth = guiDepth; if (Application.platform == RuntimePlatform.IPhonePlayer) { guiStyleLabelTo.font = null; guiStyleLableToUsers.font = null; guiStyleTextFiled.font = null; guiStyleSearchLabel.font = null; } textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); selectMemberTop = GetComponent<FresviiGUISelectFriendsTop>(); selectMemberTop.Init(appIcon, postFix, scaleFactor, GuiDepth - 1, this); guiStyleLabelTo.fontSize = (int)(guiStyleLabelTo.fontSize * scaleFactor); guiStyleLabelTo.padding = FresviiGUIUtility.RectOffsetScale(guiStyleLabelTo.padding, scaleFactor); guiStyleLableToUsers.fontSize = (int)(guiStyleLableToUsers.fontSize * scaleFactor); guiStyleTextFiled.fontSize = (int)(guiStyleTextFiled.fontSize * scaleFactor); guiStyleTextFiled.padding = FresviiGUIUtility.RectOffsetScale(guiStyleTextFiled.padding, scaleFactor); guiStyleSearchLabel.fontSize = (int)(guiStyleSearchLabel.fontSize * scaleFactor); searchBgColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.SearchBackground); guiStyleSearchLabel.normal.textColor = searchBgColor; this.scaleFactor = scaleFactor; toMargin *= scaleFactor; loadingSpinnerSize *= scaleFactor; sideMargin *= scaleFactor; topMargin = scaleFactor; heightMessageTo *= scaleFactor; textureLoader = Fresvii.AppSteroid.Util.TextureLoader.Create(); textureLoader.transform.parent = this.transform; scrollPosition.y = 0.0f; textureCoordsSearchBg = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.SearchBackground); textureCheckMark = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.IconFriendTextureName + postFix, false); textureSearchArea = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.TextFiledWTextureName + postFix, false); searchIconPosition = FresviiGUIUtility.RectScale(searchIconPosition, scaleFactor); FASFriendship.GetAccountFriendList(1, OnGetFriends); contentLabelTo = new GUIContent(FresviiGUIText.Get("To")); loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, GuiDepth - 10); contentSearch = new GUIContent(FresviiGUIText.Get("Search")); serchObjLength = searchIconPosition.width + sideMargin + guiStyleSearchLabel.CalcSize(contentSearch).x; SetScrollSlider(scaleFactor * 2.0f); }
void OnPullUpReflesh() { uint loadPage = 2; if (groupListMeta != null) { if (groupListMeta.NextPage.HasValue) { loadPage = (uint)groupListMeta.NextPage; } else { loadPage = groupListMeta.TotalCount / groupListMeta.PerPage + 1; } } if (loading || loadBlock) return; loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Bottom; loadingSpinner.Position = new Rect(Position.x + baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + baseRect.y + baseRect.height - pullRefleshHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinner.Position, this.GuiDepth - 1); pullRefleshing = true; isPullUp = true; FASGroup.GetGroupMessageGroupList(loadPage, OnGetGroups); }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { this.GuiDepth = guiDepth; textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); friendRequestTopMenu = GetComponent<FresviiGUIFriendRequestsTopMenu>(); friendRequestTopMenu.Init(appIcon, postFix, scaleFactor, this.GuiDepth - 10, this); tabBar = GetComponent<FresviiGUITabBar>(); tabBar.Init(postFix, scaleFactor, this.GuiDepth - 1); tabBar.GuiDepth = GuiDepth - 1; this.scaleFactor = scaleFactor; sideMargin *= scaleFactor; verticalMargin *= scaleFactor; miniMargin *= scaleFactor; topMargin *= scaleFactor; loadingSpinnerSize *= scaleFactor; segmentedCtrlHeight *= scaleFactor; pullRefleshHeight *= scaleFactor; TexButtonAdd = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.Button02TextureName + postFix, false); TexButtonAddH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.Button02HTextureName + postFix, false); TexButtonHide = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.Button03TextureName + postFix, false); TexButtonHideH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.Button03HTextureName + postFix, false); Initialized = true; SetScrollSlider(scaleFactor * 2.0f); FASFriendship.GetFriendshipRequestedUsersList(FAS.CurrentUser.Id, OnGetFriendshipRequestedUsersList); FASFriendship.GetHiddenFriendshipRequestedUsersList(OnGetHiddenFriendshipRequestedUsersList); loadingSpinnerPlace = LoadingSpinnerPlace.Center; loadingSpinnerPosition = new Rect(Position.x + Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition); labels = new List<string>(); labels.Add(FresviiGUIText.Get("Requested")); labels.Add(FresviiGUIText.Get("NotNow")); selectedCards = requestedCards; segmentedCtrl.Init(scaleFactor, postFix, labels, OnTapSegmentedControl); }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { this.GuiDepth = guiDepth; textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); friendListTop = GetComponent<FresviiGUIFriendListTop>(); friendListTop.Init(appIcon, postFix, scaleFactor, guiDepth - 1, this); tabBar = GetComponent<FresviiGUITabBar>(); tabBar.Init(postFix, scaleFactor, this.GuiDepth - 1); tabBar.GuiDepth = GuiDepth - 1; this.scaleFactor = scaleFactor; friendMenuTitleBarHeight *= scaleFactor; loadingSpinnerSize *= scaleFactor; pullRefleshHeight *= this.scaleFactor; SetScrollSlider(scaleFactor * 2.0f); loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, GuiDepth - 10); GetUserFriendList(1); }
void OnPullUpReflesh() { uint loadPage = 2; Fresvii.AppSteroid.Models.ListMeta selectedMeta = (selectedIndex == 0 ) ? requestedMeta : hiddenMeta; if (selectedMeta != null) { if (selectedMeta.NextPage.HasValue) { loadPage = (uint)selectedMeta.NextPage; } else { loadPage = selectedMeta.TotalCount / selectedMeta.PerPage + 1; } } if (loading || loadBlock) return; loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Bottom; loadingSpinner.Position = new Rect(Position.x + baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + baseRect.y + baseRect.height - pullRefleshHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinner.Position, this.GuiDepth - 1); pullRefleshing = true; isPullUp = true; if (selectedIndex == 0) { FASFriendship.GetFriendshipRequestedUsersList(FAS.CurrentUser.Id, loadPage, false, OnGetFriendshipRequestedUsersList); } else { FASFriendship.GetHiddenFriendshipRequestedUsersList(loadPage, OnGetHiddenFriendshipRequestedUsersList); } }
void OnPullUpReflesh() { if (friendsMeta != null) { if (friendsMeta.NextPage != null && !friendListLoading) { bottomLoadingSpinnerPosition = new Rect(Position.x + baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + baseRect.y + baseRect.height - pullRefleshHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); bottomLoadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(bottomLoadingSpinnerPosition, GuiDepth - 5); GetUserFriendList((uint)friendsMeta.NextPage); } } }
public void AddComment(string comment, Texture2D clipImage, Fresvii.AppSteroid.Models.Video video) { if (groupFriends.Count > 0) { if (Application.internetReachability == NetworkReachability.NotReachable) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("Offline"), delegate(bool del) { }); return; } List<string> userIds = new List<string>(); foreach (Fresvii.AppSteroid.Models.User friend in groupFriends) { userIds.Add(friend.Id); } userIds.Add(FAS.CurrentUser.Id); loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, this.GuiDepth - 10); ControlLock = true; if (groupFriends.Count > 1) { FASGroup.CreateGroup(userIds.ToArray(), (group, error) => { OnGroupCreated(group, error, comment, clipImage, video); }); } else { FASGroup.CreatePair(groupFriends[0].Id, (group, error) => { OnGroupCreated(group, error, comment, clipImage, video); }); } } }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { this.GuiDepth = guiDepth; if (Application.platform == RuntimePlatform.IPhonePlayer) { guiStyleSubject.font = null; guiStyleSubject.fontStyle = FontStyle.Bold; guiStyleText.font = null; } textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.DirectMessageBackground); directMessageListTopMenu = GetComponent<FresviiGUIDirectMessageTop>(); directMessageListTopMenu.Init(appIcon, postFix, scaleFactor, GuiDepth - 1, this); tabBar = GetComponent<FresviiGUITabBar>(); tabBar.Init(postFix, scaleFactor, this.GuiDepth - 1); tabBar.GuiDepth = GuiDepth - 1; loadingSpinnerSize *= scaleFactor; guiStyleSubject.padding = FresviiGUIUtility.RectOffsetScale(guiStyleSubject.padding, scaleFactor); guiStyleText.padding = FresviiGUIUtility.RectOffsetScale(guiStyleText.padding, scaleFactor); guiStyleSubject.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.DirectMessageSubject); guiStyleText.normal.textColor = FresviiGUIColorPalette.GetColor(FresviiGUIColorPalette.DirectMessageText); guiStyleSubject.fontSize = (int)(guiStyleSubject.fontSize * scaleFactor); guiStyleText.fontSize = (int)(guiStyleText.fontSize * scaleFactor); loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, GuiDepth - 10); SetScrollSlider(scaleFactor * 2.0f); FAS.Instance.Client.DirectMessageService.GetDirectMessage(DirectMessage.Id, OnGetDirectMessage); contentSubject = new GUIContent(DirectMessage.Subject); }
public void OnPullUpReflesh() { if (loading || loadBlock) return; loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Bottom; loadingSpinnerPosition = new Rect(baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, baseRect.y + baseRect.height - reloadHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, FASGui.GuiDepthBase); loadedPage++; pullRefleshing = true; FASForum.GetThreadComments(Thread.Id, loadedPage, delegate(IList<Fresvii.AppSteroid.Models.Comment> _comments, Fresvii.AppSteroid.Models.Error _error) { bool added = false; pullRefleshing = false; loadingSpinner.Hide(); OnCompletePullReflesh(scrollViewRect, baseRect, threadTopMenu.height, threadBottomMenu.height); if (_error == null) { foreach (Fresvii.AppSteroid.Models.Comment _comment in _comments) { if (!commentIds.Contains(_comment.Id)) { FresviiGUICommentCard card = ((GameObject)Instantiate(Resources.Load("GuiPrefabs/CommentCard"))).GetComponent<FresviiGUICommentCard>(); card.transform.parent = this.transform; card.Init(_comment, scaleFactor, Thread, Screen.width - 2f * sideMargin, this); cards.Add(card); comments.Add(_comment); commentIds.Add(_comment.Id); added = true; } else { foreach (FresviiGUICommentCard card in cards) { if (card.Comment.Id == _comment.Id) { card.Comment = _comment; break; } } } } cards.Sort((a, b) => System.DateTime.Compare(a.Comment.CreatedAt, b.Comment.CreatedAt)); if (cards.Count > cardMaxNum) { for (int i = 0; i < cardMaxNum - cards.Count; i++) { FresviiGUICommentCard card = cards[0]; cards.RemoveAt(0); Destroy(card.gameObject); } } } else { loadedPage--; } if (!added) loadedPage--; loading = false; if (!FASGesture.IsTouching && !added) { iTween.ValueTo(this.gameObject, iTween.Hash("from", scrollViewRect.y, "to", - scrollViewRect.height + baseRect.height - threadBottomMenu.height, "time", tweenTime, "easetype", tweenEaseType, "onupdatetarget", this.gameObject, "onupdate", "OnUpdateScrollPosition")); } }); }
public void Submit() { loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y), FASGui.GuiDepthBase - 100); FresviiGUIBlocker blocker = this.gameObject.AddComponent<FresviiGUIBlocker>(); blocker.guiDepth = FASGui.GuiDepthBase + blockerGUIDepth; FASUser.PatchAccount(inputUsername, inputDescription, (loadedTexture != null) ? loadedTexture : null, delegate(Fresvii.AppSteroid.Models.User user, Fresvii.AppSteroid.Models.Error error) { loadingSpinner.Hide(); Destroy(blocker); Fresvii.AppSteroid.Util.DialogManager.Instance.SetLabel(FresviiGUIText.Get("OK"), FresviiGUIText.Get("Cancel"), FresviiGUIText.Get("Close")); if (error == null) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("ProfileUpdateSuccess"), delegate(bool del) { }); guiMyProfile.SetUserProfile(inputUsername, inputDescription, loadedUserIcon); FresviiGUIMyProfile.currentUser = user; guiMyProfile.SetDraw(true); this.Tween(Vector2.zero, new Vector2(0.0f, Screen.height), delegate() { this.SetDraw(false); }); Destroy(loadedTexture); loadedTexture = null; loadedUserIcon = null; } else { Debug.Log(error.ToString()); if (error.Code == (int)Fresvii.AppSteroid.Models.Error.ErrorCode.NameHasAlreadyBeenTaken) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("NameHasAlredyBeenTaken"), (del) => { }); inputUsername = me.Name; } else { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("ProfileUpdateError"), (del) => { }); } } }); }