示例#1
0
    private void OnMsgGetPlayerInfo(byte[] buffer)
    {
        PPlayerInfo ret = Net.Deserialize <PPlayerInfo>(buffer);

        if (ret.errorCode != 0)
        {
            // 创建新的角色
            if (ret.errorCode == (int)eErrorCode.NO_PLAYER_ERROR)
            {
                UIManager.Instance.OpenWindow <UICreateRoleView>();
                return;
            }
        }

        if (!Net.CheckErrorCode(ret.errorCode, eCommand.GET_PLAYER_INFO))
        {
            return;
        }

        UserManager.Instance.Deserialize(ret);

        if (!Game.Instance.IsInGame)
        {
            // 加入游戏
            UserManager.Instance.JoinGame();
        }
    }
示例#2
0
    public void Late_reset(ulong lastid)//每一条消息(排序最近的列表)
    {
        var black = moduleFriend.BlackList.Exists(a => a.roleId == lastid);

        if (black)
        {
            return;
        }

        PPlayerInfo isIn = late_ListAllInfo.Find(a => a.roleId == lastid);
        PPlayerInfo info = moduleFriend.FriendList.Find(a => a.roleId == lastid);

        if (isIn == null && late_ListAllInfo.Count < 4)
        {
            moduleFriend.RefreshLateState = true;
        }
        if (info == null)
        {
            info = LatePlayerInfo(lastid);
        }
        if (isIn != null)
        {
            late_ListAllInfo.Remove(isIn);
        }
        if (info != null)
        {
            late_ListAllInfo.Insert(0, info);
        }
        if (late_ListAllInfo.Count > 10)
        {
            late_ListAllInfo.Remove(late_ListAllInfo[10]);                             //如果现在超过十个了 就直接移除最后一个
        }
    }
示例#3
0
    void _Packet(ScFriendApplyDetail p)
    {
        ScFriendApplyDetail pp = p.Clone();

        if (pp.applyInfo == null || pp.applyInfo?.playerInfo == null)
        {
            return;
        }
        var black = BlackList.Exists(a => a.roleId == pp.applyInfo.playerInfo.roleId);

        if (black)
        {
            return;
        }

        PPlayerInfo apply = Apply_playerList.Find(a => a.roleId == pp.applyInfo.playerInfo.roleId);

        if (apply != null)
        {
            RemoveApply(apply);
        }
        AddApply(pp.applyInfo);
        Apply_playerList.Reverse();//按接收顺序翻转所以就会是最早的在第一个
        DispatchModuleEvent(EventFriendApplyList);

        if (moduleFriend.FriendList.Count < FriendNumTop)
        {
            moduleHome.UpdateIconState(HomeIcons.Friend, true);
        }
    }
示例#4
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;
    }
示例#5
0
    public void SendAddMes(ulong playId)//发送添加请求
    {
        ApplyPlayerID = playId;
        var p = PacketObject.Create <CsFriendAddApply>();

        p.roleId = playId;
        bool        is_apply  = false;
        PPlayerInfo apply_add = Apply_playerList.Find(apply => apply.roleId == playId);

        if (apply_add != null)
        {
            is_apply = true;
        }
        if (is_apply)
        {
            SendReplyAgreeMes(playId);
            DispatchModuleEvent(EventFriendAddApply, 0);
        }
        else
        {
            session.Send(p);
            moduleGlobal.LockUI(string.Empty, 0.5f);
        }
        AddApplyID.Add(playId);
    }
示例#6
0
    private void FriendClick(RectTransform rt, PPlayerInfo Info)
    {
        GameObject select   = rt.gameObject.transform.Find("selectbox").gameObject;
        GameObject selectbg = rt.gameObject.transform.Find("checkBg_Img").gameObject;
        GameObject checkbg  = rt.gameObject.transform.Find("check_Img").gameObject;
        bool       have     = moduleMatch.m_invateCheck.Exists(a => a.roleId == Info.roleId);

        if (!select)
        {
            return;
        }
        if (select.activeInHierarchy)
        {
            select.SafeSetActive(false);
            selectbg.SafeSetActive(false);
            checkbg.SafeSetActive(false);
            if (have)
            {
                moduleMatch.m_invateCheck.Remove(Info);
            }
        }
        else
        {
            select.SafeSetActive(true);
            selectbg.SafeSetActive(true);
            checkbg.SafeSetActive(true);
            if (!have)
            {
                moduleMatch.m_invateCheck.Add(Info);
            }
        }
    }
示例#7
0
    private void SetInvateClick(RectTransform rt, PPlayerInfo info)
    {
        if (info == null)
        {
            return;
        }
        GameObject select  = rt.gameObject.transform.Find("selectbox").gameObject;
        GameObject checkbg = rt.gameObject.transform.Find("check_Img").gameObject;
        bool       have    = moduleActive.m_coopCheckList.Exists(a => a == info.roleId);

        if (!select)
        {
            return;
        }
        if (have)
        {
            moduleActive.m_coopCheckList.Remove(info.roleId);
            select.gameObject.SetActive(false);
            checkbg.gameObject.SetActive(false);
        }
        else
        {
            if (moduleActive.m_coopCheckList.Count > GeneralConfigInfo.defaultConfig.coopInvateTop)
            {
                moduleGlobal.ShowMessage(active_text[37]);
            }
            else
            {
                moduleActive.m_coopCheckList.Add(info.roleId);
                select.gameObject.SetActive(true);
                checkbg.gameObject.SetActive(true);
            }
        }
    }
示例#8
0
 void _Packet(ScFriendRefuse p)//拒绝申请
 {
     if (p.target == 0)
     {
         ScFriendRefuse pp = p.Clone();
         for (int i = 0; i < apply_player_id.Count; i++)
         {
             if (pp.applyId == apply_player_id[i])
             {
                 if (!apply_player_player.ContainsKey(pp.applyId))
                 {
                     return;
                 }
                 PPlayerInfo infos = Apply_playerList.Find(a => a.roleId == apply_player_player[pp.applyId].roleId);
                 if (infos == null)
                 {
                     Logger.LogError("Apply list not have this id {0}", pp.applyId);
                 }
                 RemoveApply(infos);
             }
         }
         DispatchModuleEvent(EventFriendResufed);
     }
     else if (p.target == 1)
     {
         if (AddApplyID.Exists(a => a == p.applyId))
         {
             AddApplyID.Remove(p.applyId);
         }
     }
 }
示例#9
0
 public SourceFriendInfo(PPlayerInfo rInfo)
 {
     if (rInfo != null)
     {
         Relation = Module_Friend.instance.IsFriend(rInfo.roleId)
             ? CommonRelation.Friend
             : Module_Union.instance.IsUnionMember(rInfo.roleId) ? CommonRelation.UnionMember : CommonRelation.Stranger;
     }
     PlayerInfo = rInfo;
 }
示例#10
0
 public void DelayAddData(SourceFriendInfo info, int index = 1, int type = -1, int sub = -1)
 {
     // type -1其他页面不可出现红点  0 是好友界面 可以出现红点 1公会悬赏记录 不出现状态及公会好友标识
     m_Source     = info;
     m_playerInfo = info.PlayerInfo;
     m_index      = index;
     isopen       = true;
     m_type       = type;
     m_sub        = sub;
 }
示例#11
0
    private void OnMsgOtherHeroInfo(byte[] buffer)
    {
        PPlayerInfo ret = Net.Deserialize <PPlayerInfo>(buffer);

        if (!Net.CheckErrorCode(ret.errorCode, eCommand.OTHER_HERO_INF0))
        {
            return;
        }

        UserManager.Instance.Deserialize(ret);
    }
示例#12
0
    private void OnGetSomeHerosInfo(byte[] buffer)
    {
        PPlayerInfo ret = Net.Deserialize <PPlayerInfo>(buffer);

        if (!Net.CheckErrorCode(ret.errorCode, eCommand.GET_SOME_HEROS_INFO))
        {
            return;
        }

        UserManager.Instance.Deserialize(ret);
    }
示例#13
0
    private void OnGetRoleInfo(byte[] buffer)
    {
        PPlayerInfo ret = Net.Deserialize <PPlayerInfo>(buffer);

        if (!Net.CheckErrorCode(ret.errorCode, eCommand.GET_ROLE_INFO))
        {
            return;
        }

        Deserialize(ret);
    }
示例#14
0
    // 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;
        }
    }
示例#15
0
    public void Deserialize(PPlayerInfo data)
    {
        if (data.pBattlePT.Count < 2)
        {
            Log.Error("Error Battle Formation");
            return;
        }

        // pvp的阵型数据
        PBattlePT formation = data.pBattlePT[1];

        // 英雄
        HeroList.Clear();
        foreach (var item in formation.heroPT)
        {
            HeroInfo info = new HeroInfo();
            info.Deserialize(item.hero, false);
            HeroList.Add(info);
        }

        SoldierList.Clear();
        foreach (var item in formation.buildPT)
        {
            BuildingInfo binfo = CityManager.Instance.CreateBuilding(item.build.cfgId);
            if (binfo == null)
            {
                continue;
            }

            TroopBuildingInfo tbinfo = binfo as TroopBuildingInfo;
            if (tbinfo != null)
            {
                // TODO 暂时只处理兵营数据,将来再处理校场,校场含有士兵等级数据
                binfo.Deserialize(item.build);

                SoldierInfo info = new SoldierInfo();
                info.ConfigID = tbinfo.SoldierConfigID;
                SoldierList.Add(info);
            }


            if (binfo.BuildingType == CityBuildingType.TRAIN)
            {
                // 校场,持有士兵等级数据
            }
            else if (binfo.BuildingType == CityBuildingType.TROOP)
            {
                // 兵营
            }
        }
    }
示例#16
0
    private void SetInvateInfo(RectTransform rt, PPlayerInfo info)
    {
        if (info == null)
        {
            return;
        }
        FriendPrecast fInfo = rt.GetComponentDefault <FriendPrecast>();

        fInfo.DelayAddData(info, 1, 2, 12);
        GameObject checkbg = rt.gameObject.transform.Find("check_Img").gameObject;
        bool       have    = moduleActive.m_coopCheckList.Exists(a => a == info.roleId);

        checkbg.gameObject.SetActive(have);
    }
示例#17
0
    public void SendLookDetails(ulong playerId)
    {
        PPlayerInfo info = PlayerInfo(playerId);

        if (info != null)
        {
            DispatchModuleEvent(EventFriendDetails, info);
        }
        else
        {
            var p = PacketObject.Create <CsFriendStateView>();
            p.roleId = playerId;
            session.Send(p);
        }
    }
示例#18
0
    public PPlayerInfo LatePlayerInfo(ulong lateId)
    {
        PPlayerInfo player = late_ListAllInfo.Find(a => a.roleId == lateId);

        if (player != null)
        {
            return(player);
        }
        PUnionPlayer chat = moduleUnion.m_unionPlayer.Find(a => a.info.roleId == lateId);

        if (chat != null)
        {
            player = chat.info;
        }
        return(player);
    }
示例#19
0
    private void OnMsgCreateNewRole(byte[] buffer)
    {
        PPlayerInfo ret = Net.Deserialize <PPlayerInfo>(buffer);

        if (!Net.CheckErrorCode(ret.errorCode, eCommand.CREATE_NEW_ROLE))
        {
            return;
        }

        UserManager.Instance.Deserialize(ret);

        // 加入游戏
        UserManager.Instance.JoinGame();

        UIManager.Instance.CloseWindow <UISelectServerView>();
    }
示例#20
0
 private void OnToggle(PPlayerInfo data, bool isOn)
 {
     if (!isOn)
     {
         Check.Remove(data);
     }
     else
     {
         if (Check.Count >= Check.Capacity)
         {
             moduleGlobal.ShowMessage(9810);
             return;
         }
         Check.Add(data);
     }
 }
示例#21
0
    public void OnlineFriend()
    {
        m_friendOnline.Clear();
        List <PPlayerInfo> thisInfo = moduleFriend.FriendList.FindAll(p => p.state != 0);

        for (int i = 0; i < thisInfo.Count; i++)
        {
            PPlayerInfo info = null;
            thisInfo[i].CopyTo(ref info);
            if (info == null)
            {
                Logger.LogError(" error");
                continue;
            }
            m_friendOnline.Add(info);
        }
    }
示例#22
0
    public void IsfriendDetails(PPlayerInfo playerInfo, bool world = false, Action <int, string, ulong> invate = null)
    {
        if (playerInfo == null)
        {
            return;
        }

        Get();
        m_invate = invate;
        PlayerId = playerInfo.roleId;

        //isMyfriend 0 好友 1 不是好友但是显示添加 2 黑名单
        SetButtonShow(world);

        //在这加载玩家的详情
        PlayerDetailsInfo(playerInfo, world);
    }
示例#23
0
    private void OnMsgOtherPlayerInfo(byte[] buffer)
    {
        PPlayerInfo ret = Net.Deserialize <PPlayerInfo>(buffer);

        if (!Net.CheckErrorCode(ret.errorCode, eCommand.OTHER_PLAYER_INFO))
        {
            return;
        }

        PVPPlayerInfo info = PVPManager.Instance.GetPlayer(ret.roleAttrs.userId);

        if (info != null)
        {
            info.Deserialize(ret);
        }

        UIManager.Instance.RefreshWindow <UIPVPPlayerInfoView>();
    }
示例#24
0
    private void RemoveApply(PPlayerInfo pp)
    {
        var t = pp.roleId;

        if (roleID_player.ContainsKey(pp.roleId))
        {
            t = roleID_player[pp.roleId];
        }
        var p = Apply_playerList.Find(a => a.roleId == pp.roleId);

        if (p != null)
        {
            Apply_playerList.Remove(p);
        }
        apply_player_id.Remove(t);
        apply_player_player.Remove(t);
        roleID_player.Remove(pp.roleId);
    }
示例#25
0
    void _Packet(ScFriendAdd p)
    {
        //被同意申请
        bool is_myfriend = false;

        for (int i = 0; i < FriendList.Count; i++)
        {
            if (p.friend_.roleId == FriendList[i].roleId)
            {
                is_myfriend = true;
            }
        }
        if (!is_myfriend)
        {
            PPlayerInfo add = p.friend_.Clone();
            FriendList.Add(add);                //好友的详细信息加进去了
            My_FriendList.Add(add.roleId, add); //把这个信息加进去
            FriendList = moduleFriend.SortWay();
            DispatchModuleEvent(EventAddFriendReply);
        }
    }
示例#26
0
 private void Oncheckfried()
 {
     //判定选中的好友有哪些
     if (moduleMatch.m_invateCheck.Count > 0 && moduleMatch.m_invateCheck.Count <= 5)
     {
         List <ulong> SendId = new List <ulong>();
         for (int i = 0; i < moduleMatch.m_invateCheck.Count; i++)
         {
             PPlayerInfo playerInfo = moduleFriend.FriendList.Find(a => a.roleId == moduleMatch.m_invateCheck[i].roleId);
             if (playerInfo == null || playerInfo.state != 1)
             {
                 continue;
             }
             SendId.Add(moduleMatch.m_invateCheck[i].roleId);
         }
         moduleMatch.FriendFree(SendId);
     }
     else
     {
         moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.MatchUIText, 31));
     }
 }
示例#27
0
    public PPlayerInfo PlayerInfo(ulong playerId)
    {
        //聊天页
        PPlayerInfo info = FriendList.Find(a => a.roleId == playerId);

        if (info == null)
        {
            info = BlackList.Find(a => a.roleId == playerId);
        }
        if (info == null)
        {
            info = searchList.Find(a => a.roleId == playerId);
        }
        if (info == null)
        {
            info = recommend.Find(a => a.roleId == playerId);
        }
        if (info == null)
        {
            info = moduleChat.LatePlayerInfo(playerId);
        }
        return(info);
    }
示例#28
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);
            });
        }
    }
示例#29
0
    private void FriendInfo(RectTransform rt, PPlayerInfo Info)
    {
        FriendPrecast Presct = rt.gameObject.GetComponentDefault <FriendPrecast>();

        Presct.DelayAddData(Info, 1, 1);
        rt.gameObject.GetComponentDefault <Button>().interactable = true;

        Text remainTxt = rt.Find("remain").GetComponent <Text>();

        remainTxt.SafeSetActive(false);

        int remain;

        moduleMatch.m_remainTime.TryGetValue(Info.roleId, out remain);

        if (remain > 0)
        {
            remainTxt.SafeSetActive(true);

            Util.SetText(remainTxt, ConfigText.GetDefalutString(219, 39), remain);
            rt.gameObject.GetComponentDefault <Button>().interactable = false;
        }

        GameObject selectbg = rt.gameObject.transform.Find("checkBg_Img").gameObject;
        GameObject checkbg  = rt.gameObject.transform.Find("check_Img").gameObject;

        selectbg.SafeSetActive(false);
        checkbg.SafeSetActive(false);
        bool have = moduleMatch.m_invateCheck.Exists(a => a.roleId == Info.roleId);

        if (have)
        {
            selectbg.SafeSetActive(true);
            checkbg.SafeSetActive(true);
        }
    }
示例#30
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);
    }