示例#1
0
    protected override void OnBecameVisible(bool oldState, bool forward)
    {
        playerInfo = Window.GetWindowParam <Window_ApplyFriend>().param1 as PPlayerInfo;
        if (playerInfo == null)
        {
            return;
        }

        Util.SetText(name_, playerInfo.name);
        Util.SetText(uid_, "<color=#CDFDFFFF>UID:</color>{0}", playerInfo.index);
        Util.SetText(level, $"LV.{playerInfo.level}");
        Util.SetText(introduce, moduleSet.SetSignTxt(playerInfo.intro));

        AtlasHelper.SetShared(protoHint, "ui_invitefriend_" + playerInfo.proto);

        friendBox.HeadBox(playerInfo.headBox);
        Module_Avatar.SetClassAvatar(Head_img?.gameObject, playerInfo.proto, false, playerInfo.gender);

        bool apply = moduleFriend.AddApplyID.Exists(a => a == playerInfo.roleId);

        if (apply)
        {
            Util.SetText(m_addTxt, 263, 5);
        }
        else
        {
            Util.SetText(m_addTxt, 263, 1);
        }
        addButton.interactable = !apply;
    }
示例#2
0
 private void UpdateAvatar()
 {
     if (!avatar || !m_creature)
     {
         return;
     }
     Module_Avatar.SetClassAvatar(avatar.gameObject, m_creature);
 }
    // 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;
        }
    }
示例#4
0
    private void AssistMemberCommonOn(Creature rCreature)
    {
        assistMember = rCreature;
        if (assistMember == null)
        {
            return;
        }
        isAssistComeOn = true;
        Module_Avatar.SetClassAvatar(assistIcon.gameObject, assistMember);
        Module_Avatar.SetClassAvatar(assistIcon2.gameObject, assistMember);
        assistHpSlider.fillAmount = assistMember.healthRate;
        Util.SetText(assistName, Util.Format(ConfigText.GetDefalutString(198), GetAssistName()));

        assistRoot.SafeSetActive(true);
        assistIcon.saturation = 1;

        assistNotice.SafeSetActive(true);
        var tween = assistNotice?.GetComponent <TweenBase>();

        tween?.Play();

        assistMember.AddEventListener(CreatureEvents.HEALTH_CHANGED, OnAssistHealthChange);
    }
示例#5
0
    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);
            });
        }
    }
示例#6
0
    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); //未到时间 或者 已经可领取
                }
            }
        });
    }
示例#7
0
    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);
    }
示例#8
0
    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");
            });
        }
    }
示例#9
0
    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);
    }
示例#10
0
    private void AddData()
    {
        AssertInit();
        Module_Avatar.SetClassAvatar(Head_img, m_playerInfo.proto, false, m_playerInfo.gender);
        friebdBox.HeadBox(m_playerInfo.headBox);

        checkObj.SafeSetActive(false);
        isonline_friend.SafeSetActive(false);
        offonline_friend.SafeSetActive(false);
        busy_friend.SafeSetActive(false);

        if (m_type == 0)
        {
            PPlayerInfo now = Module_Friend.instance.checkPlayer;
            if (now != null)
            {
                if (now.roleId == m_playerInfo.roleId)
                {
                    checkObj.SafeSetActive(true);                                   //现在选中 高亮
                }
            }
            if (m_index == 0)
            {
                friend_hint.SafeSetActive(false);
            }
            bool iscunthia = Module_Chat.instance.Past_mes.Exists(a => a == m_playerInfo.roleId);
            friend_hint.SafeSetActive(iscunthia);//如果在past里出现红点
        }
        else if (m_type != -1)
        {
            var have = false;
            if (m_type == 1)
            {
                have = Module_Match.instance.m_invateCheck.Exists(a => a.roleId == m_playerInfo.roleId);
            }
            if (m_type == 2)
            {
                have = Module_Active.instance.m_coopCheckList.Exists(a => a == m_playerInfo.roleId);
            }
            if (have)
            {
                checkObj.SafeSetActive(true);
            }
        }

        var nn = Module_Active.instance.CutString(m_playerInfo.name, m_sub);

        name_friend.text  = nn;
        level_friend.text = string.Format(ConfigText.GetDefalutString(218, 37), m_playerInfo.level.ToString());
        ID_friend.text    = m_playerInfo.roleId.ToString();

        if (m_type != 1)
        {
            if (m_playerInfo.state > 1)
            {
                busy_friend.SafeSetActive(true);
            }
            else if (m_playerInfo.state == 0)
            {
                offonline_friend.SafeSetActive(true);
            }
            else if (m_playerInfo.state == 1)
            {
                isonline_friend.SafeSetActive(true);
            }
        }

        isFriend?.SafeSetActive(m_Source.Relation == CommonRelation.Friend);
        isUnionMember?.SafeSetActive(m_Source.Relation == CommonRelation.UnionMember);
        isStranger?.SafeSetActive(m_Source.Relation == CommonRelation.Stranger);
        Util.SetText(goodFeelingValue, $"+{m_Source.addPoint}");

        if (m_playerInfo.roleId == Module_Player.instance.id_ || m_type == 1)
        {
            isUnionMember.SafeSetActive(false);
            isFriend.SafeSetActive(false);
        }
    }