public void Refresh(FriendGift g_info_) { m_gift_id = g_info_.GiftId; PlayerFriendMsg info_ = g_info_.PlayerFriends; m_name_text.Text = info_.Name; ConfTitle my_title = ConfTitle.Get(info_.TitleId); m_title_text.Text = null != my_title?LocalizeModule.Instance.GetString(my_title.name) : ""; if (info_.Icon.Contains("http://")) { m_head_icon.Visible = false; m_head_tex.Visible = true; m_head_tex.TextureName = info_.Icon; } else { m_head_icon.Visible = true; m_head_tex.Visible = false; m_head_icon.Sprite = info_.Icon; } //m_gender_icon.Sprite = CommonTools.GetGenderIcon(info_.Gender); m_lvl_text.Text = string.Format("LV{0}", info_.Level); m_receive_gift_btn.Enable = FriendDataManager.Instance.Receive_gift_left_num > 0; m_receive_gift_btn.SetGray(!(FriendDataManager.Instance.Receive_gift_left_num > 0)); m_receive_gift_btn.Visible = true; m_received_gift_btn.Visible = false; }
public override void OnShow(object param) { m_add_btn.AddClickCallBack(OnAddClick); //m_facebook_invite_btn.AddClickCallBack(OnInviteClick); m_input.AddChangeCallBack(OnInputting); //m_player_id_text.Text = string.Format(LocalizeModule.Instance.GetString("friend_self_ID") + ":{0}", GlobalInfo.MY_PLAYER_ID.ToString()); if (string.IsNullOrEmpty(m_input.Text)) { m_add_btn.Enable = false; m_add_btn.SetGray(true); } else { m_add_btn.Enable = true; m_add_btn.SetGray(false); } }
public void Refresh(string icon_name_, bool gray_, float alpha_) { this.m_icon_img.Sprite = icon_name_; if (null != m_effect) { m_effect.Visible = !gray_; } this.m_icon_bg.SetGray(gray_); m_icon_img.SetGray(gray_); m_canvasgroup.alpha = alpha_; }
public void Refresh(PlayerFriendMsg info_) { m_player_id = info_.PlayerId; m_name_text.Text = info_.Name; ConfTitle my_title = ConfTitle.Get(info_.TitleId); m_title_text.Text = null != my_title?LocalizeModule.Instance.GetString(my_title.name) : ""; FriendDataManager.Instance.SetHeadIcon(m_head_tex, info_.Icon, info_.PlayerId); m_gender_icon.Sprite = CommonTools.GetGenderIcon(info_.Gender); m_lvl_text.Text = string.Format("LV{0}", info_.Level); bool enable_gift = FriendDataManager.Instance.Send_gift_left_num <= 0 ? false : info_.Gift; m_send_gift_btn.Enable = enable_gift; m_send_gift_btn.SetGray(!enable_gift); }
public void Refresh() { UpdateCountDown(); m_recommend_grid.EnsureSize <RecommendItemUI>(FriendDataManager.Instance.Recommends.Count); for (int i = 0; i < FriendDataManager.Instance.Recommends.Count; ++i) { m_recommend_grid.GetChild <RecommendItemUI>(i).Refresh(FriendDataManager.Instance.Recommends[i]); m_recommend_grid.GetChild <RecommendItemUI>(i).Visible = true; } var valids = FriendDataManager.Instance.Recommends.FindAll((item) => ENUM_RECOMMEND_STATUS.E_RECOMMEND == (ENUM_RECOMMEND_STATUS)item.Status); bool has_recommend = null != valids && valids.Count > 0; m_add_all_btn.SetGray(!has_recommend); m_add_all_btn.Enable = has_recommend; string btn_txt = has_recommend ? "friend_addueser_all" : "friend_addueser_end"; m_add_all_btn_txt.Text = LocalizeModule.Instance.GetString(btn_txt); }
public void Refresh() { Dictionary <long, FriendGift> datas = FriendDataManager.Instance.GetGifts(); int gift_num = datas.Count; int receive_num = FriendDataManager.Instance.Receive_gift_left_num; m_receive_all_img.Enable = gift_num > 0 && receive_num > 0; m_receive_all_img.SetGray(!(gift_num > 0 && receive_num > 0)); m_receive_all_img.Color = new Color(m_receive_all_img.Color.r, m_receive_all_img.Color.g, m_receive_all_img.Color.b, 1.0f); //m_gift_num_text.Text = string.Format("{0}/{1}", FriendDataManager.Instance.Receive_gift_max_num - FriendDataManager.Instance.Receive_gift_left_num, FriendDataManager.Instance.Receive_gift_max_num); if (null == datas || 0 == datas.Count) { m_gift_grid.Clear(); return; } gifts = new List <FriendGift>(datas.Values); gifts.Sort((a, b) => { if (a.PlayerFriends.StatusTime > b.PlayerFriends.StatusTime) { return(-1); } else { return(1); } }); m_gift_grid.EnsureSize <GiftItemUI>(gifts.Count); //m_gift_scroll.ScrollToTop(); for (int i = 0; i < m_gift_grid.ChildCount; ++i) { m_gift_grid.GetChild <GiftItemUI>(i).Visible = false; m_gift_grid.GetChild <GiftItemUI>(i).Visible = true; m_gift_grid.GetChild <GiftItemUI>(i).Refresh(gifts[i]); } }
public void Refresh(FRIEND_UI_TOGGLE_TYPE type_) { //this.SwitchUI(type_); ShowConfirmRedPoint(FriendDataManager.Instance.Last_apply); ShowApplyRedPoint(PlayerPrefTool.GetIsThereNewApply()); m_recommend_btn.Visible = false; if (FRIEND_UI_TOGGLE_TYPE.Added == type_ || FRIEND_UI_TOGGLE_TYPE.Addinfo == type_ || FRIEND_UI_TOGGLE_TYPE.Agreeing == type_) { int temp_type = (int)type_; Dictionary<long, PlayerFriendMsg> datas = FriendDataManager.Instance.GetDatas((FriendReqType)temp_type); if (FRIEND_UI_TOGGLE_TYPE.Added == type_ && m_friend_info_list_root.Visible) { if (null == datas) { m_friend_info_grid.Clear(); return; } List<PlayerFriendMsg> friends = new List<PlayerFriendMsg>(datas.Values); friends.Sort((a, b) => { if (a.Level > b.Level) return -1; else return 1; }); m_friend_info_grid.EnsureSize<FriendInfoItemUI>(friends.Count); for (int i = 0; i < m_friend_info_grid.ChildCount; ++i) { m_friend_info_grid.GetChild<FriendInfoItemUI>(i).Visible = false; m_friend_info_grid.GetChild<FriendInfoItemUI>(i).Visible = true; m_friend_info_grid.GetChild<FriendInfoItemUI>(i).Refresh(friends[i]); } m_friend_num_text.Text = string.Format("{0}/{1}", friends.Count, FriendDataManager.Instance.Max_friend_num); m_recommend_btn.Visible = 0 == friends.Count; m_recommend_tips.Visible = m_recommend_btn.Visible; } else if (FRIEND_UI_TOGGLE_TYPE.Agreeing == type_ && m_friend_application_root.Visible) { if (m_application_switch.Checked != FriendDataManager.Instance.Is_receive_application) m_application_switch.Checked = FriendDataManager.Instance.Is_receive_application; if (null == datas || 0 == datas.Count) { m_friend_application_grid.Clear(); m_ignore_all_btn.Enable = false; m_ignore_all_btn.SetGray(true); return; } m_ignore_all_btn.Enable = true; m_ignore_all_btn.SetGray(false); List<PlayerFriendMsg> friends = new List<PlayerFriendMsg>(datas.Values); friends.Sort((a, b) => { if (a.StatusTime > b.StatusTime) return -1; else return 1; }); m_friend_application_grid.EnsureSize<FriendApplicationItemUI>(friends.Count); for (int i = 0; i < m_friend_application_grid.ChildCount; ++i) { m_friend_application_grid.GetChild<FriendApplicationItemUI>(i).Visible = false; m_friend_application_grid.GetChild<FriendApplicationItemUI>(i).Visible = true; m_friend_application_grid.GetChild<FriendApplicationItemUI>(i).Refresh(friends[i]); } } else if (FRIEND_UI_TOGGLE_TYPE.Addinfo == type_ && m_friend_confirm_root.Visible) { if (null == datas) { m_friend_confirm_grid.Clear(); return; } List<PlayerFriendMsg> friends = new List<PlayerFriendMsg>(datas.Values); friends.Sort((a, b) => { if (a.StatusTime > b.StatusTime) return -1; else return 1; }); m_friend_confirm_grid.EnsureSize<FriendConfirmItemUI>(friends.Count); for (int i = 0; i < m_friend_confirm_grid.ChildCount; ++i) { m_friend_confirm_grid.GetChild<FriendConfirmItemUI>(i).Visible = false; m_friend_confirm_grid.GetChild<FriendConfirmItemUI>(i).Visible = true; m_friend_confirm_grid.GetChild<FriendConfirmItemUI>(i).Refresh(friends[i]); } } } else if (FRIEND_UI_TOGGLE_TYPE.gift == type_) { m_gift_root.Refresh(); } }
public void SetData(ConfTitle confTitle, TitleMsg title, bool isChoose, bool isLock) { if (confTitle == null) { Visible = false; return; } this.m_detailLab.Text = LocalizeModule.Instance.GetString(confTitle.info); m_curTitle = title; if (confTitle != null) { m_Name_lab.Text = LocalizeModule.Instance.GetString(confTitle.name); List <RankData> rankdatas = PlayerTitleHelper.GetRandData(confTitle.benefit); m_addition_lab[0].Visible = false; m_addition_lab[1].Visible = false; for (int i = 0; i < 2; i++) { if (i < rankdatas.Count) { m_addition_lab[i].Text = LocalizeModule.Instance.GetString(string.Format("RankType_{0}", rankdatas[i].type), rankdatas[i].value); m_addition_lab[i].Visible = !isLock; } } m_desc_lab.Text = LocalizeModule.Instance.GetString(confTitle.source); } m_icon_img.Sprite = confTitle.icon; bool active = !isLock; m_mask_img.Visible = !active; m_lock_img.Visible = !active; m_desc_lab.Visible = !active; m_currentState = isChoose; m_choose_btn.Enable = active; m_Expired_lab.Visible = false; m_Name_lab.color = m_oriColor; m_addition_lab[0].color = m_oriColor; m_addition_lab[1].color = m_oriColor; m_TimeLab.Visible = false; if (active) //是否已拥有 { long nowTicks = CommonTools.DateTimeToTimeStamp(System.DateTime.Now) / 10000; if (title.Deadline > 0) { if (title.Deadline < nowTicks) { m_TimeLab.Visible = false; //过期 m_Name_lab.color = m_grayColor; m_addition_lab[0].color = m_grayColor; //m_additionNum01_lab.color = m_grayColor; m_addition_lab[1].color = m_grayColor; //m_additionNum02_lab.color = m_grayColor; m_bg_img.SetGray(true); m_icon_img.SetGray(true); m_Expired_lab.Visible = true; m_choose_btn.Enable = false; } else { DateTime deadTime = CommonTools.TimeStampToDateTime(title.Deadline * 10000); if (deadTime != null) { m_TimeLab.Text = CommonTools.SecondToTitleString((deadTime - DateTime.Now).TotalSeconds); } m_TimeLab.Visible = true; } } } m_require_img.Visible = m_currentState; }