// Update is called once per frame public void SetPlayerInfo(PUnionPlayer playerInfo) { Get(); PPlayerInfo baseInfo = playerInfo.info; if (baseInfo == null) { return; } Module_Avatar.SetClassAvatar(m_headImg, baseInfo.proto, false, baseInfo.gender); headBoxFriend detailBox = m_headBox.GetComponentDefault <headBoxFriend>(); detailBox.HeadBox(baseInfo.headBox); m_name.text = baseInfo.name; m_level.text = "LV." + baseInfo.level; m_contribution.text = ConfigText.GetDefalutString(242, 183) + playerInfo.sentiment.ToString(); if (baseInfo.state == 0) { m_state.text = ConfigText.GetDefalutString(218, 30); m_state.color = Color.gray; } else { m_state.text = ConfigText.GetDefalutString(218, 29); m_state.color = Color.green; } m_rankImg.gameObject.SetActive(false); if (playerInfo.title == 0) { m_rankImg.gameObject.SetActive(true); AtlasHelper.SetShared(m_rankImg.gameObject, "ui_union_level01"); m_rankTxt.text = ConfigText.GetDefalutString(242, 184); } else if (playerInfo.title == 1) { m_rankImg.gameObject.SetActive(true); AtlasHelper.SetShared(m_rankImg.gameObject, "ui_union_level02"); m_rankTxt.text = ConfigText.GetDefalutString(242, 185); } if (baseInfo.roleId == Module_Player.instance.roleInfo.roleId) { detailBox.HeadBox(Module_Player.instance.roleInfo.headBox); m_name.text = Module_Player.instance.name_; m_level.text = "LV." + Module_Player.instance.level; } }
protected void InitComponent() { addButton = GetComponent <Button> ("person_frame/invite_btn"); closeButton = GetComponent <Button> ("person_frame/titled_bg/close_btn"); blackButton = GetComponent <Button> ("person_frame/black_btn"); m_addTxt = GetComponent <Text> ("person_frame/invite_btn/Image"); name_ = GetComponent <Text> ("person_frame/content/infoList/name_Txt"); level = GetComponent <Text> ("person_frame/content/infoList/level_Txt"); uid_ = GetComponent <Text> ("person_frame/content/infoList/id_Txt"); introduce = GetComponent <Text> ("person_frame/content/individual/Text"); protoHint = GetComponent <Image> ("person_frame/content/frameInside/framePro"); friendBox = GetComponent <Transform> ("person_frame/content/bg")?.gameObject.AddComponent <headBoxFriend>(); Head_img = transform.Find("person_frame/content/bg/mask"); }
protected override void Init() { friend_txt = ConfigManager.Get <ConfigText>((int)TextForMatType.FriendUIText); if (friend_txt == null) { friend_txt = ConfigText.emptey; Logger.LogError("this id can not"); } isFriend = transform.GetComponent <Transform>("isFriend"); isUnionMember = transform.GetComponent <Transform>("isGuildMember"); isStranger = transform.GetComponent <Transform>("isStranger"); friend_hint = transform.GetComponent <Transform>("hint_"); friend_hint?.SafeSetActive(false); name_friend = transform.GetComponent <Text>("name"); level_friend = transform.GetComponent <Text>("level"); ID_friend = transform.GetComponent <Text>("ID"); isonline_friend = transform.GetComponent <Image>("isonline"); offonline_friend = transform.GetComponent <Image>("offline"); busy_friend = transform.GetComponent <Image>("busy"); Head_img = transform.Find("bg/mask")?.gameObject; friebdBox = transform.Find("bg")?.gameObject.GetComponentDefault <headBoxFriend>(); checkObj = transform.Find("selectbox")?.gameObject; toggle = transform.GetComponent <Toggle>("toggle"); goodFeelingValue = transform.GetComponent <Text>("goodFeeling_Text/goodFeelingValue"); if (toggle) { //为什么要这么做呢? //因为摆预制的时候可能isOn是false toggle的标志图片确实显示着的 //至少会调用一次OnValueChange。确保isOn的状态和toggle的标志图片显示一致 toggle.isOn = !toggle.isOn; toggle.isOn = false; } toggle?.onValueChanged.RemoveAllListeners(); toggle?.onValueChanged.AddListener((t) => onToggle?.Invoke(this, toggle.isOn)); Util.SetText(gameObject.GetComponent <Text>("isonline/isonline_text"), friend_txt[29]); Util.SetText(gameObject.GetComponent <Text>("offline/offline_text"), friend_txt[30]); Util.SetText(gameObject.GetComponent <Text>("busy/offline_text"), friend_txt[39]); Util.SetText(isFriend?.GetComponent <Text>("friend_Txt"), ConfigText.GetDefalutString(9502)); Util.SetText(isUnionMember?.GetComponent <Text>("guildMember_Txt"), ConfigText.GetDefalutString(9502, 1)); Util.SetText(isStranger?.GetComponent <Text>("text"), ConfigText.GetDefalutString(9502, 2)); Util.SetText(gameObject?.GetComponent <Text>("goodFeeling_Text"), ConfigText.GetDefalutString(9502, 4)); }
public void SetInfo(PPlayerInfo Info, int type = 0) { Get(); Module_Avatar.SetClassAvatar(apply_bg_mask, Info.proto, false, Info.gender); headBoxFriend applybox = apply_bg.GetComponentDefault <headBoxFriend>(); applybox.HeadBox(Info.headBox); name_apply.text = Info.name; level_apply.text = string.Format(ConfigText.GetDefalutString(218, 37), Info.level.ToString()); ID_apply.text = Info.roleId.ToString(); add_Ok.onClick.RemoveAllListeners(); add_No.onClick.RemoveAllListeners(); if (type == 0) { transform.GetComponent <Button>().onClick.AddListener(delegate { Module_Friend.instance.SendLookDetails(Info.roleId); }); add_Ok.onClick.AddListener(AgreeClick); add_No.onClick.AddListener(delegate { Module_Friend.instance.SendReplyRefusedMes(ID); }); } else { add_Ok.onClick.AddListener(UnionAgreeClick); add_No.onClick.AddListener(delegate { long[] ids = new long[1]; ids[0] = m_idUnion; Module_Union.instance.SloveApply(2, ids); }); } }
public void SetInfo(PCooperateInfo info, Action <CooperationTask> monShow) { if (info == null) { Logger.LogError("server info is null"); return; } CooperationTask task = Module_Active.instance.coopTaskBase.Find(a => a.ID == info.taskId); if (task == null) { Logger.LogError("configuration is not have this id"); return; } Get(); monShowList = monShow; Util.SetText(m_name, task.name); if (string.IsNullOrEmpty(task.icon)) { Logger.LogError(" this task no icon"); } UIDynamicImage.LoadImage(m_monsterImg, task.icon); Util.SetText(m_invateTxt, ConfigText.GetDefalutString(223, 38), task.limitLevel); m_taskOne.gameObject.SetActive(true); m_coop.gameObject.SetActive(task.type == 1); m_taskTwo.gameObject.SetActive(task.type == 1); m_invate.gameObject.SetActive(info.friendId == 0 && task.type == 1 && info.state == 0); m_player.gameObject.SetActive(info.friendId != 0 && task.type == 1 && info.state == 0); m_reward.gameObject.SetActive(info.state == 1); m_offPlane.gameObject.SafeSetActive(info.state == 2); AwardGetSucced succed = m_showReward.GetComponentDefault <AwardGetSucced>(); succed.SetAward(task.reward, showReward, false); if (task.conditions == null || task.conditions.Length < 1) { Logger.LogError("monster info is error"); return; } if (task.type == 2 && task.conditions.Length >= 1) { SetValue(task.conditions[0], 0, m_oneTxt, m_oneSlider, m_oneValue, info.selfFinishVal); } else if (task.type == 1 && task.conditions.Length > 1) { var self = task.conditions[0]; var friend = task.conditions[1]; var ids = info.friendId; var selfValue = info.selfFinishVal; var fValue = info.assistFinishVal; if (Module_Player.instance.id_ != info.ownerId) { self = task.conditions[1]; friend = task.conditions[0]; ids = info.ownerId; selfValue = info.assistFinishVal; fValue = info.selfFinishVal; } SetValue(self, 0, m_oneTxt, m_oneSlider, m_oneValue, selfValue); SetValue(friend, 1, m_twoTxt, m_twoSlider, m_twoValue, fValue); if (ids != 0) { var f = Module_Friend.instance.FriendList.Find(a => a.roleId == ids); if (f != null) { m_invateName.text = f.name; headBoxFriend headBox = m_HeadBox.gameObject.GetComponentDefault <headBoxFriend>(); headBox.HeadBox(f.headBox); Module_Avatar.SetClassAvatar(m_HeadAvatar, f.proto, false, f.gender); } } } m_invateBtn.onClick.RemoveAllListeners(); m_invateBtn.onClick.AddListener(delegate { Module_Active.instance.CheckTaskID = info.uid; Module_Active.instance.GetCanInvate(info.taskId); }); m_monsterBtn.onClick.RemoveAllListeners(); m_monsterBtn.onClick.AddListener(delegate { //出现怪物详情界面 if (!Module_Active.instance.collTask.ContainsKey(task.ID)) { var idnex = 0; if (Module_Player.instance.id_ != info.ownerId) { idnex = 1; } Module_Active.instance.GetMonsterShow(task.ID, task.conditions[idnex].monsterId); } Module_Active.instance.CoopShowList.Clear(); Module_Active.instance.GetAllMonsterStage(task.ID); monShowList(task); }); m_rewardBtn.onClick.RemoveAllListeners(); m_rewardBtn.onClick.AddListener(delegate { Module_Active.instance.GetCoopReward(info.uid); }); m_playerBtn.onClick.RemoveAllListeners(); m_playerBtn.onClick.AddListener(delegate { if (Module_Player.instance.id_ != info.ownerId) { Module_Global.instance.ShowMessage(223, 46); //无权踢出 } else { if (CanKickedOut(info.acceptTime) && info.state == 0) { Window_Alert.ShowAlert(ConfigText.GetDefalutString(223, 40), true, true, true, () => { Module_Active.instance.KickedOutFriend(info.uid, info.friendId); }, null, "", ""); } else { Module_Global.instance.ShowMessage(223, 43); //未到时间 或者 已经可领取 } } }); }
public void PlayerDetailsInfo(PPlayerInfo details, long sent, int title)//加载玩家的详情 { if (details == null) { return; } PlayerId = details.roleId; GetPath(); m_addBtn.interactable = true; bool added = Module_Friend.instance.AddApplyID.Exists(a => a == details.roleId); var black = Module_Friend.instance.BlackList.Exists(a => a.roleId == details.roleId); if (added || black) { m_addBtn.interactable = false; } Module_Avatar.SetClassAvatar(m_headbg, details.proto, false, details.gender); headBoxFriend detaibox = m_headBox.GetComponentDefault <headBoxFriend>(); detaibox.HeadBox(details.headBox); Util.SetText(m_name, details.name); Util.SetText(m_id, ConfigText.GetDefalutString(218, 36), details.index); Util.SetText(m_introduce, details.intro); string formatText = ConfigText.GetDefalutString(218, 2) + details.level.ToString(); Util.SetText(m_level, formatText); string ss = ConfigText.GetDefalutString(242, 167) + sent; Util.SetText(m_contribute, ss); m_blackBtn.gameObject.SetActive(!black); m_removeBlack.gameObject.SetActive(black); bool isFriend = Module_Friend.instance.FriendList.Exists(a => a.roleId == details.roleId); if (isFriend) { m_isFriend.gameObject.SetActive(true); m_notFriend.gameObject.SetActive(false); } else { m_isFriend.gameObject.SetActive(false); m_notFriend.gameObject.SetActive(true); } SetSelfState(title); m_addBtn.onClick.RemoveAllListeners(); m_chatBtn.onClick.RemoveAllListeners(); m_addBtn.onClick.AddListener(delegate { var blacks = Module_Friend.instance.CanAddPlayer(details.roleId); if (blacks) { return; } Module_Friend.instance.SendAddMes(details.roleId); m_addBtn.interactable = false; }); m_chatBtn.onClick.AddListener(delegate { //打开好友私聊界面 Module_Union.instance.m_unionChatID = details.roleId; Module_Friend.instance.m_friendOpenType = OpenFriendType.Union; Window.ShowAsync("window_friend"); }); SetBtnClick(details.roleId, title); }
private void PlayerDetailsInfo(PPlayerInfo details, bool world)//加载玩家的详情 { if (details == null) { return; } Module_Avatar.SetClassAvatar(details_headbg, details.proto, false, details.gender); headBoxFriend detaibox = Details_box.GetComponentDefault <headBoxFriend>(); detaibox.HeadBox(details.headBox); is_compare.interactable = true; Util.SetText(details_name, details.name); Util.SetText(details_id, ConfigText.GetDefalutString(218, 36), details.index); Util.SetText(details_introduce, Module_Set.instance.SetSignTxt(details.intro)); string formatText = ConfigText.GetDefalutString(218, 2) + details.level.ToString(); Util.SetText(details_level, formatText); is_compare.onClick.RemoveAllListeners(); is_compare.onClick.AddListener(delegate { var canshow = Module_Guide.instance.IsActiveFunction(HomeIcons.Fight); if (canshow) { canshow = Module_Guide.instance.IsActiveFunction(HomeIcons.PVP); } if (!canshow) { Module_Global.instance.ShowMessage(ConfigText.GetDefalutString(223, 12)); return; } int remain = Module_Match.instance.CanInvation(details.roleId); if (remain > 0) { Module_Global.instance.ShowMessage(ConfigText.GetDefalutString(218, 51)); return; } if (details.state == 1) { Module_PVP.instance.opType = OpenWhichPvP.FriendPvP; Window.ShowAsync("window_pvp"); List <ulong> this_F = new List <ulong>(); this_F.Add(details.roleId); Module_Match.instance.FriendFree(this_F); var inKey = "invation" + PlayerId; PlayerPrefs.SetString(inKey, Util.GetServerLocalTime().ToString()); } else if (details.state == 0) { Module_Global.instance.ShowMessage(218, 46); } else { Module_Global.instance.ShowMessage(218, 47); } }); m_invateUnion.onClick.RemoveAllListeners(); m_invateUnion.onClick.AddListener(delegate { if (Module_Friend.instance.CanInviteUnion == 0) { Window_Alert.ShowAlert(ConfigText.GetDefalutString(248, 2), true, true, true, () => { SetInvate(); }, null, "", ""); } else if (Module_Friend.instance.CanInviteUnion == 1) { Module_Global.instance.ShowMessage(218, 55); } else if (Module_Friend.instance.CanInviteUnion == 2) { Module_Global.instance.ShowMessage(218, 57); } else if (Module_Friend.instance.CanInviteUnion == 3) { Module_Global.instance.ShowMessage(218, 56); } }); is_delete.onClick.RemoveAllListeners(); not_add.onClick.RemoveAllListeners(); m_blackBtn?.onClick.RemoveAllListeners(); m_removeBtn?.onClick.RemoveAllListeners(); m_blackBtn?.onClick.AddListener(SetBLack); m_removeBtn?.onClick.AddListener(RemoveBlack); is_delete.onClick.AddListener(SetDelete); not_add.onClick.AddListener(DeltailAdd); if (world) { is_compare.SafeSetActive(false); is_chat.onClick.RemoveAllListeners(); is_chat.onClick.AddListener(delegate { gameObject.SafeSetActive(false); Module_Friend.instance.m_friendOpenType = OpenFriendType.World; Window.ShowAsync("window_friend"); }); } }
public void caht_show(int type, string content, bool Isme, int headboxid, int playerSend = 0)//接收的还是自己的世界的还是好友的,那个类型的,信息 { //0 世界的接受的 //1世界我发的 2好友接收的 3 好友我发的 只有在0的情况下头像才可以点击(isshow) //type 0,文本 1,图片 2 语音 headBoxFriend headBoxa = head_btn.gameObject.GetComponentDefault <headBoxFriend>(); headBoxa.HeadBox(headboxid); if (!Isme) { Module_Avatar.SetClassAvatar(headbgmask, m_proto, false, Gender); } if (type == 0) { img_txt.gameObject.SetActive(true); if (playerSend == 0) { mes_txt.supportRichText = false; mes_txt.text = content; mes_txt.Set(); } else { mes_txt.supportRichText = true; mes_txt.text = content; mes_txt.Set(); mes_txt.text = mes_txt.gettxt; } float width = mes_txt.preferredWidth; float height = mes_txt.preferredHeight; if (width <= generalInfo.ChatMax) { img_txt.rectTransform.sizeDelta = new Vector2(width + generalInfo.ChatTxtWidth, generalInfo.ChatTxtHeight); //设置图片的宽高 RectTransform my_height = gameObject.GetComponent <RectTransform>(); my_height.sizeDelta = new Vector2(my_height.sizeDelta.x, generalInfo.ChatAllHeight); //设置整个背景的高度 This_height = generalInfo.ChatAllHeight; } else { ContentSizeFitter a = mes_txt.gameObject.GetComponentDefault <ContentSizeFitter>(); a.horizontalFit = ContentSizeFitter.FitMode.Unconstrained; img_txt.rectTransform.sizeDelta = new Vector2(generalInfo.OverChatTxtWidth, height + generalInfo.OverChatTxtHeight); //设置图片的宽高 RectTransform my_height = gameObject.GetComponent <RectTransform>(); my_height.sizeDelta = new Vector2(my_height.sizeDelta.x, height + generalInfo.OverChatBackHeight); //设置整个背景的高度 This_height = height + generalInfo.OverChatBackHeight; } } else if (type == 1) { id_key.text = content; mes_txt.text = string.Empty; img_img.gameObject.SetActive(true); //FaceName icon = ConfigManager.Get<FaceName>(Int32.Parse(content));//用id获取图片名称 GameObject a = Level.GetPreloadObject(content); if (a != null) { a.transform.SetParent(img_img.transform); a.transform.localScale = new Vector3(1, 1, 1); RectTransform sss = a.GetComponent <RectTransform>(); sss.anchoredPosition = new Vector3(0, 0, 0); sss.localPosition = new Vector3(0, 0, 0); } RectTransform my_heightimg = gameObject.GetComponent <RectTransform>(); my_heightimg.sizeDelta = new Vector2(my_heightimg.sizeDelta.x, generalInfo.ChatImgAllHeight);//设置整个背景的高度 This_height = generalInfo.ChatImgAllHeight; } else { This_height = 75f; } // mes_btn_txt.text = Util.Format("语音", time.ToString()); // mes_btn.onClick.AddListener(aa); }