private void SetHideCardButton() { CUIFormScript form = Singleton <CUIManager> .instance.GetForm(CPlayerInfoSystem.sPlayerInfoFormPath); if (form == null) { return; } GameObject widget = form.GetWidget(32); if (widget == null) { return; } Transform transform = widget.transform.Find("pnlContainer/Social_BtnGroupTop"); GameObject gameObject = transform.FindChild("HideBtn").gameObject; CPlayerProfile profile = Singleton <CPlayerInfoSystem> .instance.GetProfile(); Text component = gameObject.transform.Find("Text").GetComponent <Text>(); if (profile.IsPrivacyOpen(COM_USER_PRIVACY_MASK.COM_USER_PRIVACY_MASK_FRIEND_CARD)) { component.set_text(Singleton <CTextManager> .GetInstance().GetText("Social_ShowCard")); } else { component.set_text(Singleton <CTextManager> .GetInstance().GetText("Social_HideCard")); } }
private void OnHideShowCard(CUIEvent evt) { CPlayerProfile profile = Singleton <CPlayerInfoSystem> .instance.GetProfile(); if (profile.IsPrivacyOpen(COM_USER_PRIVACY_MASK.COM_USER_PRIVACY_MASK_FRIEND_CARD)) { this.OnHideShowCardConfirm(null); } else { Singleton <CUIManager> .GetInstance().OpenMessageBoxWithCancel(Singleton <CTextManager> .GetInstance().GetText("Social_HideCardConfirm"), enUIEventID.Social_HideCardConfirm, enUIEventID.Social_HideCardCancel, false); } }
private void OnHideShowCardConfirm(CUIEvent evt) { CPlayerProfile profile = Singleton <CPlayerInfoSystem> .instance.GetProfile(); if (profile == null) { return; } if (!CPlayerInfoSystem.isSelf(profile.m_uuid)) { return; } bool bOpen = !profile.IsPrivacyOpen(COM_USER_PRIVACY_MASK.COM_USER_PRIVACY_MASK_FRIEND_CARD); profile.SetPrivacyBit(bOpen, COM_USER_PRIVACY_MASK.COM_USER_PRIVACY_MASK_FRIEND_CARD); Singleton <CSettingsSys> .GetInstance().reqOperateUserPrivacyBit(bOpen, COM_USER_PRIVACY_MASK.COM_USER_PRIVACY_MASK_FRIEND_CARD); this.SetHideCardButton(); }