Esempio n. 1
0
    public void SetData(FriendData data)
    {
        foreach(UnityEngine.UI.Button b in unfriend)
        {
            b.onClick.RemoveAllListeners();
            b.onClick.AddListener(() => { FriendManager.callRemoveFriend(data); SmallWindow.singleton.close(gameObject); });
        }
        Tname.text = data.Name;
        level.text = "Level " + data.Level.ToString();
        statistics.text = data.Staticsics;
        status.text = data.status.ToString();
        if (data.icon != new Sprite())
            Icon.sprite = data.icon;
        else
            Icon.sprite = defaultIcon;

        switch (data.status)
        {
            case friendStatus.Online:
                Offline.SetActive(false);
                Online.SetActive(true);
                break;
            case friendStatus.Offline:
                Offline.SetActive(true);
                Online.SetActive(false);
                break;
            case friendStatus.Playing:
                Offline.SetActive(false);
                Online.SetActive(true);
                break;
        }
    }
Esempio n. 2
0
File: Friend.cs Progetto: kwsch/NLSE
        public Friend()
        {
            InitializeComponent();
            Save = new FriendData(Main.SaveData);

            // Load
            loadData();
        }
Esempio n. 3
0
 public static void Show(FriendData data)
 {
     if (GUIFriendInfoPopUp.mInstance == null)
     {
         GUIFriendInfoPopUp.CreateInstance();
     }
     GUIFriendInfoPopUp.mInstance.Init(data);
 }
Esempio n. 4
0
 public void AddFriendItem(FriendData data)
 {
     if (data.GUID == 0uL || data.FriendType != 1)
     {
         return;
     }
     this.mCommonFriendTable.AddData(new FriendDataEx(data, EUITableLayers.ESL_Friend, null, null));
     this.RefreshLayer();
 }
Esempio n. 5
0
 public void AddFriendItem(FriendData data)
 {
     if (data.GUID == 0uL || data.FriendType != 2)
     {
         return;
     }
     this.mFriendBlackListTable.AddData(new FriendDataEx(data, EUITableLayers.ESL_BlackList, null, null));
     this.RefreshLayer();
 }
Esempio n. 6
0
    // RankUnit 초기화.
    public void Init(FriendData friendData, int rankNo, bool isMyData)
    {
        // 이미 작동중인 경우 예외처리.
        if(IsInvoking("RefreshRemainHeartSendTime")) 
            CancelInvoke("RefreshRemainHeartSendTime");
        
        // 친구정보 저장.
        fData = friendData;
        
        rankLabel.text = rankNo.ToString();
        nameLabel.text = fData.name;
        scoreLabel.text = fData.score.ToString();

        // 페이스북 ID가 있는지 체크.
        if(fData.facebook.CompareTo("0") != 0)
        {
            //ID가 있는 경우. 프로필 이미지 요청.
            string requestImgQuery 
                = string.Format("/{0}/picture?width=80&height=80", fData.facebook);
            FB.API(requestImgQuery, Facebook.HttpMethod.GET, ProfileImgCallBack);
        }
        else
        {
            // 기본 이미지로 나타나도록 함.
            userImg.mainTexture = GameData.Instance.lobbyGM.normalUserImg;
        }
        
        if(!isMyData)
        {
            fillHeart.transform.parent.gameObject.SetActive(true);
            // 하트 선물 가능여부 체크.
            remainSendTime = GameData.Instance.serverLoadedTime - fData.sendTime;
            if(remainSendTime >= 3600)
            {
                isPossibleSendHeart = true;
                fillHeart.enabled = true;
                heartTimeLabel.enabled = false;
            }
            else
            {
                isPossibleSendHeart = false;
                fillHeart.enabled = false;
                heartTimeLabel.enabled = true;
                // 하트 선물이 가능할 때까지 남은 시간을 계산하여 처리한다.
                if(IsInvoking("RefreshRemainHeartSendTime")) 
                    CancelInvoke("RefreshRemainHeartSendTime");
                RefreshRemainHeartSendTime();
                InvokeRepeating("RefreshRemainHeartSendTime", 1.0f, 1.0f);
            }
        }
        else
        {
            fillHeart.transform.parent.gameObject.SetActive(false);
        }
    }
Esempio n. 7
0
 void AddFriend(FriendData data)
 {
     friends.Add(data.Name, data);
     GameObject G = (GameObject)Instantiate(friendIconParent);
     friendsInList.Add(data.Name, G);
     G.SetActive(true);
     G.name = data.Name;
     G.transform.SetParent(scrollerContent.transform);
     G.transform.localScale = new Vector3(1, 1, 1);
     G.GetComponentInChildren<UnityEngine.UI.Text>().text = data.Name;
     UnityEngine.UI.Button B = G.GetComponent<UnityEngine.UI.Button>();
     B.onClick.RemoveAllListeners();
     B.onClick.AddListener(() => { friendPopupWindow.SetData(friends[data.Name]); SmallWindow.singleton.open(friendPopupWindow.gameObject); });
     if(data.status == friendStatus.Offline)
         B.image.color = Color.gray;
 }
Esempio n. 8
0
 public void AddFriendItem(FriendData data)
 {
     if (data == null || data.GUID == 0uL)
     {
         return;
     }
     for (int i = 0; i < FriendRecommendLayer.RecommendFriends.Count; i++)
     {
         if (FriendRecommendLayer.RecommendFriends[i].GUID == data.GUID)
         {
             FriendRecommendLayer.RecommendFriends.RemoveAt(i);
             this.mFriendRecommendTable.RemoveData(data.GUID);
             this.RefreshLayer();
             break;
         }
     }
 }
        /// <summary>
        /// 是否有对方的馈赠
        /// </summary>
        /// <returns></returns>
        public bool IsHaveFriendGiveAway(int uid)
        {
            FriendData fd = FindFriend(uid);

            return(fd != null && fd.IsByGiveAway);
        }
Esempio n. 10
0
    /// <summary>
    /// 写入字节流(完整版)
    /// </summary>
    protected override void toWriteBytesFull(BytesWriteStream stream)
    {
        stream.startWriteObj();

        if (this.friends != null)
        {
            stream.writeLen(this.friends.size());
            if (!this.friends.isEmpty())
            {
                FriendData[] friendsVValues = this.friends.getValues();
                for (int friendsVI = friendsVValues.Length - 1; friendsVI >= 0; --friendsVI)
                {
                    FriendData friendsV = friendsVValues[friendsVI];
                    if (friendsV != null)
                    {
                        if (friendsV != null)
                        {
                            stream.writeDataFullNotNull(friendsV);
                        }
                        else
                        {
                            nullObjError("friendsV");
                        }
                    }
                }
            }
        }
        else
        {
            nullObjError("friends");
        }

        if (this.blackList != null)
        {
            stream.writeLen(this.blackList.size());
            if (!this.blackList.isEmpty())
            {
                ContactData[] blackListVValues = this.blackList.getValues();
                for (int blackListVI = blackListVValues.Length - 1; blackListVI >= 0; --blackListVI)
                {
                    ContactData blackListV = blackListVValues[blackListVI];
                    if (blackListV != null)
                    {
                        if (blackListV != null)
                        {
                            stream.writeDataFullNotNull(blackListV);
                        }
                        else
                        {
                            nullObjError("blackListV");
                        }
                    }
                }
            }
        }
        else
        {
            nullObjError("blackList");
        }

        if (this.applyDic != null)
        {
            stream.writeLen(this.applyDic.size());
            if (!this.applyDic.isEmpty())
            {
                ApplyAddFriendData[] applyDicVValues = this.applyDic.getValues();
                for (int applyDicVI = applyDicVValues.Length - 1; applyDicVI >= 0; --applyDicVI)
                {
                    ApplyAddFriendData applyDicV = applyDicVValues[applyDicVI];
                    if (applyDicV != null)
                    {
                        if (applyDicV != null)
                        {
                            stream.writeDataFullNotNull(applyDicV);
                        }
                        else
                        {
                            nullObjError("applyDicV");
                        }
                    }
                }
            }
        }
        else
        {
            nullObjError("applyDic");
        }

        stream.endWriteObj();
    }
Esempio n. 11
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is FriendPartData))
        {
            return;
        }

        FriendPartData mData = (FriendPartData)data;

        if (mData.friends != null)
        {
            if (this.friends != null)
            {
                this.friends.clear();
                this.friends.ensureCapacity(mData.friends.size());
            }
            else
            {
                this.friends = new LongObjectMap <FriendData>(mData.friends.size());
            }

            LongObjectMap <FriendData> friendsT = this.friends;
            if (!mData.friends.isEmpty())
            {
                FriendData[] friendsVValues = mData.friends.getValues();
                for (int friendsVI = friendsVValues.Length - 1; friendsVI >= 0; --friendsVI)
                {
                    FriendData friendsV = friendsVValues[friendsVI];
                    if (friendsV != null)
                    {
                        FriendData friendsU;
                        if (friendsV != null)
                        {
                            friendsU = (FriendData)friendsV.clone();
                        }
                        else
                        {
                            friendsU = null;
                            nullObjError("friendsU");
                        }

                        friendsT.put(friendsU.playerID, friendsU);
                    }
                }
            }
        }
        else
        {
            this.friends = null;
            nullObjError("friends");
        }

        if (mData.blackList != null)
        {
            if (this.blackList != null)
            {
                this.blackList.clear();
                this.blackList.ensureCapacity(mData.blackList.size());
            }
            else
            {
                this.blackList = new LongObjectMap <ContactData>(mData.blackList.size());
            }

            LongObjectMap <ContactData> blackListT = this.blackList;
            if (!mData.blackList.isEmpty())
            {
                ContactData[] blackListVValues = mData.blackList.getValues();
                for (int blackListVI = blackListVValues.Length - 1; blackListVI >= 0; --blackListVI)
                {
                    ContactData blackListV = blackListVValues[blackListVI];
                    if (blackListV != null)
                    {
                        ContactData blackListU;
                        if (blackListV != null)
                        {
                            blackListU = (ContactData)blackListV.clone();
                        }
                        else
                        {
                            blackListU = null;
                            nullObjError("blackListU");
                        }

                        blackListT.put(blackListU.playerID, blackListU);
                    }
                }
            }
        }
        else
        {
            this.blackList = null;
            nullObjError("blackList");
        }

        if (mData.applyDic != null)
        {
            if (this.applyDic != null)
            {
                this.applyDic.clear();
                this.applyDic.ensureCapacity(mData.applyDic.size());
            }
            else
            {
                this.applyDic = new LongObjectMap <ApplyAddFriendData>(mData.applyDic.size());
            }

            LongObjectMap <ApplyAddFriendData> applyDicT = this.applyDic;
            if (!mData.applyDic.isEmpty())
            {
                ApplyAddFriendData[] applyDicVValues = mData.applyDic.getValues();
                for (int applyDicVI = applyDicVValues.Length - 1; applyDicVI >= 0; --applyDicVI)
                {
                    ApplyAddFriendData applyDicV = applyDicVValues[applyDicVI];
                    if (applyDicV != null)
                    {
                        ApplyAddFriendData applyDicU;
                        if (applyDicV != null)
                        {
                            applyDicU = (ApplyAddFriendData)applyDicV.clone();
                        }
                        else
                        {
                            applyDicU = null;
                            nullObjError("applyDicU");
                        }

                        applyDicT.put(applyDicU.playerID, applyDicU);
                    }
                }
            }
        }
        else
        {
            this.applyDic = null;
            nullObjError("applyDic");
        }
    }
Esempio n. 12
0
 public void setData(FriendData data)
 {
     data.name = name;
     data.name = code;
 }
Esempio n. 13
0
 public void Init(FriendData data)
 {
     if (data == null)
     {
         return;
     }
     this.mFriendData = data;
     this.friendType = data.FriendType;
     this.mName.text = Singleton<StringManager>.Instance.GetString("friend_4", new object[]
     {
         data.Level
     }) + "  " + data.Name;
     this.mName.color = Tools.GetItemQualityColor(LocalPlayer.GetQuality(data.ConLevel));
     if (data.CombatValue > 0)
     {
         this.mCombatValue.enabled = true;
         this.mCombatValue.text = data.CombatValue.ToString();
     }
     else
     {
         this.mCombatValue.enabled = false;
     }
     if (!string.IsNullOrEmpty(data.GuildName))
     {
         this.mGuildName.enabled = true;
         this.mGuildName.text = Singleton<StringManager>.Instance.GetString("friend_1", new object[]
         {
             data.GuildName
         });
     }
     else
     {
         this.mGuildName.enabled = true;
         this.mGuildName.text = Singleton<StringManager>.Instance.GetString("friend_3");
         this.mGuildName.color = Color.gray;
     }
     this.mIcon.spriteName = Tools.GetPlayerIcon(data.FashionID);
     this.mFrame.spriteName = Tools.GetItemQualityIcon(LocalPlayer.GetQuality(data.ConLevel));
     int vipLevel = this.mFriendData.VipLevel;
     if (vipLevel > 0)
     {
         this.mVip.gameObject.SetActive(true);
         if (vipLevel >= 10)
         {
             this.mVipSingle.enabled = true;
             this.mVipTens.enabled = true;
             this.mVipOne.enabled = false;
             this.mVipSingle.spriteName = (vipLevel % 10).ToString();
             this.mVipTens.spriteName = (vipLevel / 10).ToString();
         }
         else
         {
             this.mVipSingle.enabled = false;
             this.mVipTens.enabled = false;
             this.mVipOne.enabled = true;
             this.mVipOne.spriteName = vipLevel.ToString();
         }
     }
     else
     {
         this.mVip.gameObject.SetActive(false);
     }
     this.mBacklistLabel.text = Singleton<StringManager>.Instance.GetString((data.FriendType != 2) ? "friend_25" : "friend_26");
     this.mFriendLabel.text = Singleton<StringManager>.Instance.GetString((data.FriendType != 1) ? "friend_27" : "friend_28");
     if (data != null && data.FriendType == 0)
     {
         this.mBacklistLabel.text = Singleton<StringManager>.Instance.GetString("friend_25");
         this.mFriendLabel.text = Singleton<StringManager>.Instance.GetString("friend_27");
     }
     GameUITools.PlayOpenWindowAnim(this.mWindow.transform, null, true);
 }
Esempio n. 14
0
        public void UpdateNote(long friendAccountId, string note)
        {
            FriendData orCreateFriendInfo = GetOrCreateFriendInfo(friendAccountId);

            orCreateFriendInfo.LastSeenNote = note.Substring(0, Math.Min(note.Length, 50));
        }
Esempio n. 15
0
        public void SendMessageToUnread(AccountViewModel account, FriendData friend)
        {
            const string functionName = "Ответ на непрочитанные сообщения";

            if (friend.Deleted || friend.DialogIsCompleted)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Ошибка! Друг {0}({1}) удален, либо переписка с ним закончилась.", friend.FriendName, friend.FacebookId));
                return;
            }

            if (account.GroupSettingsId == null)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Ошибка! Не указана группа настроек."));
                return;
            }

            var friendIsBlocked = _friendsBlackListManager.CheckForFriendBlacklist(friend.FacebookId, (long)account.GroupSettingsId);

            if (friendIsBlocked)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Ошибка! Друг {0}({1}) находится в черном списке.", friend.FriendName, friend.FacebookId));
                return;
            }

            var message = String.Empty;

            var messageData = friend.MessageRegime == MessageRegime.BotFirstMessage
            ? _messageManager.GetAllMessagesWhereBotWritesFirst(account.Id)
            : _messageManager.GetAllMessagesWhereUserWritesFirst(account.Id);

            _notice.AddNotice(functionName, account.Id, string.Format("Загружаем сообщения для ответа"));

            if (messageData.Count == 0)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("У данного пользователя нет сообщений для ответа"));
                return;
            }

            var numberLastBotMessage = _messageManager.GetLasBotMessageOrderNumber(messageData, account.Id);

            //

            var lastFriendMessages = _facebookMessageManager.GetLastFriendMessageModel(account.Id, friend.Id);

            if (lastFriendMessages == null)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Возникла ошибка при ответе. Сообщение друга не найдено в базе."));
                return;
            }

            var lastBotMessage = _facebookMessageManager.GetLastBotMessageModel(account.Id, friend.Id);

            int orderNumber;

            if (lastBotMessage != null && lastFriendMessages.OrderNumber == lastBotMessage.OrderNumber && lastFriendMessages.MessageDateTime > lastBotMessage.MessageDateTime)
            {
                orderNumber = lastFriendMessages.OrderNumber + 1;
            }
            else
            {
                orderNumber = lastFriendMessages.OrderNumber;
            }

            if (orderNumber == 1 && friend.MessageRegime == null)
            {
                new ChangeMessageRegimeCommandHandler(new DataBaseContext()).Handle(new ChangeMessageRegimeCommand
                {
                    AccountId     = account.Id,
                    FriendId      = friend.Id,
                    MessageRegime = MessageRegime.UserFirstMessage
                });

                friend.MessageRegime = MessageRegime.UserFirstMessage;
            }

            _notice.AddNotice(functionName, account.Id, string.Format("Сверяем сообщение друга со стоп-словами"));

            var emergencyFactor = _stopWordsManager.CheckMessageOnEmergencyFaktor(lastFriendMessages);

            _notice.AddNotice(functionName, account.Id, string.Format("Получаем сообщение для ответа с порядковым номером - {0}. (Стоп-фактор - {1})", orderNumber, emergencyFactor));

            var messageModel = _messageManager.GetRandomMessage(account.Id, orderNumber, emergencyFactor, friend.MessageRegime);

            if (messageModel != null)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Подставляем значения в сообщение бота"));

                message = new CalculateMessageTextQueryHandler(new DataBaseContext()).Handle(new CalculateMessageTextQuery
                {
                    TextPattern = messageModel.Message,
                    AccountId   = account.Id,
                    FriendId    = lastFriendMessages.FriendId,
                });
            }
            var userAgent = new GetUserAgentQueryHandler(new DataBaseContext()).Handle(new GetUserAgentQuery
            {
                UserAgentId = account.UserAgentId
            });

            if (message != String.Empty)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Отправляем сообщение"));

                new SendMessageEngine().Execute(new SendMessageModel
                {
                    AccountId     = account.FacebookId,
                    Cookie        = account.Cookie,
                    FriendId      = friend.FacebookId,
                    Message       = message,
                    Proxy         = _accountManager.GetAccountProxy(account),
                    UrlParameters =
                        new GetUrlParametersQueryHandler(new DataBaseContext()).Handle(new GetUrlParametersQuery
                    {
                        NameUrlParameter = NamesUrlParameter.SendMessage
                    }),
                    UserAgent = userAgent.UserAgentString
                });

                new SaveSentMessageCommandHandler(new DataBaseContext()).Handle(new SaveSentMessageCommand()
                {
                    AccountId       = account.Id,
                    FriendId        = friend.FacebookId,
                    OrderNumber     = orderNumber,
                    Message         = message,
                    MessageDateTime = DateTime.Now,
                });

                _notice.AddNotice(functionName, account.Id, string.Format("Сообщение пользователю {0}({1}) отправлено", friend.FriendName, friend.FacebookId));
            }

            if (messageData == null || orderNumber < numberLastBotMessage)
            {
                return;
            }

            if (account.GroupSettingsId == null)
            {
                return;
            }

            _notice.AddNotice(functionName, account.Id, string.Format("Переписка завершена. Блокируем пользователя {0}({1})", friend.FriendName, friend.FacebookId));

            new MarkAddToEndDialogCommandHandler(new DataBaseContext()).Handle(new MarkAddToEndDialogCommand
            {
                AccountId = account.Id,
                FriendId  = friend.FacebookId
            });

            _friendManager.AddFriendToBlackList((long)account.GroupSettingsId, friend.FacebookId);
        }
Esempio n. 16
0
        public void SendMessageToNewFriend(AccountViewModel account, FriendData friend)
        {
            const string functionName = "Отправка сообщений новым друзьям";

            if (friend.DialogIsCompleted || friend.Deleted)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Ошибка! Друг {0}({1}) удален, либо переписка с ним закончилась.", friend.FriendName, friend.FacebookId));
                return;
            }

            if (account.GroupSettingsId == null)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Ошибка! Не указана группа настроек."));
                return;
            }

            var friendIsBlocked = _friendsBlackListManager.CheckForFriendBlacklist(friend.FacebookId, (long)account.GroupSettingsId);

            if (friendIsBlocked)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Ошибка! Друг {0}({1}) находится в черном списке.", friend.FriendName, friend.FacebookId));
                return;
            }

            var message = String.Empty;

            var userAgent = new GetUserAgentQueryHandler(new DataBaseContext()).Handle(new GetUserAgentQuery
            {
                UserAgentId = account.UserAgentId
            });

            _notice.AddNotice(functionName, account.Id, string.Format("Отправляем сообщения новым друзьям"));

            var messageModel = _messageManager.GetRandomMessage(account.Id, 1, false, MessageRegime.BotFirstMessage);

            if (messageModel == null)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Ошибка. Нет сообщений для отправки."));

                return;
            }

            message = messageModel.Message;

            if (!message.Equals(String.Empty))
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Отправляем сообщение {0}({1})", friend.FriendName, friend.FacebookId));

                new SendMessageEngine().Execute(new SendMessageModel
                {
                    AccountId     = account.FacebookId,
                    Cookie        = account.Cookie,
                    FriendId      = friend.FacebookId,
                    Message       = message,
                    Proxy         = _accountManager.GetAccountProxy(account),
                    UrlParameters =
                        new GetUrlParametersQueryHandler(new DataBaseContext()).Handle(new GetUrlParametersQuery
                    {
                        NameUrlParameter = NamesUrlParameter.SendMessage
                    }),
                    UserAgent = userAgent.UserAgentString
                });

                if (friend.MessageRegime == null)
                {
                    new ChangeMessageRegimeCommandHandler(new DataBaseContext()).Handle(new ChangeMessageRegimeCommand()
                    {
                        AccountId     = account.Id,
                        FriendId      = friend.Id,
                        MessageRegime = MessageRegime.BotFirstMessage
                    });
                }

                new SaveSentMessageCommandHandler(new DataBaseContext()).Handle(new SaveSentMessageCommand()
                {
                    AccountId       = account.Id,
                    FriendId        = friend.FacebookId,
                    OrderNumber     = 1,
                    Message         = message,
                    MessageDateTime = DateTime.Now
                });

                _notice.AddNotice(functionName, account.Id, string.Format("Сообщение отправлено"));
            }
        }
Esempio n. 17
0
        public void SendMessageToUnanswered(AccountViewModel account, FriendData friend)
        {
            const string functionName = "Ответ на неотвеченные сообщения";

            if (friend.DialogIsCompleted || friend.Deleted)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Ошибка! Друг {0}({1}) удален, либо переписка с ним закончилась.", friend.FriendName, friend.FacebookId));
                return;
            }

            if (account.GroupSettingsId == null)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Ошибка! Не указана группа настроек."));
                return;
            }

            var friendIsBlocked = _friendsBlackListManager.CheckForFriendBlacklist(friend.FacebookId, (long)account.GroupSettingsId);

            if (friendIsBlocked)
            {
                _notice.AddNotice(functionName, account.Id, string.Format("Ошибка! Друг {0}({1}) находится в черном списке.", friend.FriendName, friend.FacebookId));
                return;
            }

            var allMessages = new GetFriendMessagesQueryHandler(new DataBaseContext()).Handle(new GetFriendMessagesQuery()
            {
                AccountId = account.Id,
                FriendId  = friend.Id
            });

            var lastBotMessages =
                allMessages.Where(data => data.MessageDirection == MessageDirection.ToFriend)
                .OrderByDescending(data => data.OrderNumber)
                .FirstOrDefault();

            if (lastBotMessages == null)
            {
                return;
            }

            _notice.AddNotice(functionName, account.Id, string.Format("Получаем экстра-сообщение"));

            var messageModel = _messageManager.GetRandomExtraMessage();

            if (messageModel == null)
            {
                return;
            }

            var message = new CalculateMessageTextQueryHandler(new DataBaseContext()).Handle(new CalculateMessageTextQuery
            {
                TextPattern = messageModel.Message,
                AccountId   = account.Id,
                FriendId    = friend.FacebookId
            });

            _notice.AddNotice(functionName, account.Id, string.Format("Отправляем экстра сообщение - '{0}'", message));

            var userAgent = new GetUserAgentQueryHandler(new DataBaseContext()).Handle(new GetUserAgentQuery
            {
                UserAgentId = account.UserAgentId
            });

            new SendMessageEngine().Execute(new SendMessageModel
            {
                AccountId     = account.FacebookId,
                Cookie        = account.Cookie,
                FriendId      = friend.FacebookId,
                Message       = message,
                Proxy         = _accountManager.GetAccountProxy(account),
                UrlParameters =
                    new GetUrlParametersQueryHandler(new DataBaseContext()).Handle(new GetUrlParametersQuery
                {
                    NameUrlParameter = NamesUrlParameter.SendMessage
                }),
                UserAgent = userAgent.UserAgentString
            });

            new SaveSentMessageCommandHandler(new DataBaseContext()).Handle(new SaveSentMessageCommand()
            {
                AccountId       = account.Id,
                FriendId        = friend.FacebookId,
                OrderNumber     = lastBotMessages.OrderNumber,
                Message         = message,
                MessageDateTime = DateTime.Now,
            });

            _notice.AddNotice(functionName, account.Id, string.Format("Отправка экстра сообщения завершена"));
        }
Esempio n. 18
0
 public void AddFrienddata(FriendData value)
 {
     frienddata_.Add(value);
 }
Esempio n. 19
0
 public void SetFrienddata(FriendData value)
 {
     hasFrienddata = true;
     frienddata_   = value;
 }
Esempio n. 20
0
 private void AddFriendData(FriendData data)
 {
     switch (data.FriendType)
     {
     case 1:
         this.friends.Add(data);
         break;
     case 2:
         this.blackList.Add(data);
         break;
     case 3:
         this.applyList.Add(data);
         break;
     default:
         Debug.LogErrorFormat("FriendType error, type = {0}", new object[]
         {
             data.FriendType
         });
         break;
     }
 }
Esempio n. 21
0
 static int FriendSortByLastLogin(FriendData x, FriendData y)
 {
     return(x._lastlogin.CompareTo(y._lastlogin));
 }
Esempio n. 22
0
        public static MarryResult MarryReply(GameClient client, int sourceID, int accept)
        {
            MarryResult result;

            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                result = MarryResult.NotOpen;
            }
            else if (client.ClientData.MyMarriageData.byMarrytype > 0)
            {
                result = MarryResult.SelfMarried;
            }
            else
            {
                GameClient sourceClient = GameManager.ClientMgr.FindClient(sourceID);
                if (sourceClient == null)
                {
                    result = MarryResult.ApplyTimeout;
                }
                else if (sourceClient.ClientData.MyMarriageData.byMarrytype > 0)
                {
                    result = MarryResult.TargetMarried;
                }
                else if (!MarryLogic.RemoveMarryApply(sourceID, MarryApplyType.ApplyInit))
                {
                    result = MarryResult.ApplyTimeout;
                }
                else
                {
                    if (!client.ClientData.IsMainOccupation || !sourceClient.ClientData.IsMainOccupation)
                    {
                        accept = 0;
                    }
                    if (accept == 0 || client.ClientData.MyMarriageData.byAutoReject == 1)
                    {
                        string notifyData = string.Format("{0}:{1}:{2}", 1, client.ClientData.RoleID, client.ClientData.RoleName);
                        sourceClient.sendCmd(894, notifyData, false);
                        GameManager.ClientMgr.AddUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, sourceClient, MarryLogic.MarryCost, "求婚被拒绝返还钻石", ActivityTypes.None, "");
                    }
                    else
                    {
                        MarryLogic.RemoveMarryApply(sourceID, MarryApplyType.ApplyNull);
                        MarryLogic.ApplyLogoutClear(client);
                        MarryLogic.RemoveMarryApply(client.ClientData.RoleID, MarryApplyType.ApplyNull);
                        int initRingID = 0;
                        if (null != MarriageOtherLogic.getInstance().WeddingRingDic.SystemXmlItemDict)
                        {
                            initRingID = MarriageOtherLogic.getInstance().WeddingRingDic.SystemXmlItemDict.Keys.First <int>();
                        }
                        if (sourceClient.ClientData.MyMarriageData.nRingID <= 0)
                        {
                            sourceClient.ClientData.MyMarriageData.nRingID = initRingID;
                        }
                        if (client.ClientData.MyMarriageData.nRingID <= 0)
                        {
                            client.ClientData.MyMarriageData.nRingID = initRingID;
                        }
                        sbyte sourceType = (sbyte)(sourceClient.ClientData.RoleSex != 1 || client.ClientData.RoleSex == sourceClient.ClientData.RoleSex ? 1 : 2);
                        sourceClient.ClientData.MyMarriageData.byMarrytype = sourceType;
                        client.ClientData.MyMarriageData.byMarrytype       = (sbyte)(sourceType == 1 ? 2 : 1);
                        sourceClient.ClientData.MyMarriageData.nSpouseID   = client.ClientData.RoleID;
                        client.ClientData.MyMarriageData.nSpouseID         = sourceID;
                        if (sourceClient.ClientData.MyMarriageData.byGoodwilllevel == 0)
                        {
                            sourceClient.ClientData.MyMarriageData.ChangTime       = TimeUtil.NowDateTime().ToString("yyyy-MM-dd HH:mm:ss");
                            sourceClient.ClientData.MyMarriageData.byGoodwilllevel = 1;
                        }
                        if (client.ClientData.MyMarriageData.byGoodwilllevel == 0)
                        {
                            client.ClientData.MyMarriageData.ChangTime       = TimeUtil.NowDateTime().ToString("yyyy-MM-dd HH:mm:ss");
                            client.ClientData.MyMarriageData.byGoodwilllevel = 1;
                        }
                        EventLogManager.AddRingBuyEvent(sourceClient, 0, initRingID, 0, 0, 0, 1, "");
                        EventLogManager.AddRingBuyEvent(client, 0, initRingID, 0, 0, 0, 1, "");
                        MarryFuBenMgr.UpdateMarriageData2DB(sourceClient);
                        MarryFuBenMgr.UpdateMarriageData2DB(client);
                        MarriageOtherLogic.getInstance().SendMarriageDataToClient(sourceClient, true);
                        MarriageOtherLogic.getInstance().SendMarriageDataToClient(client, true);
                        MarriageOtherLogic.getInstance().UpdateRingAttr(sourceClient, true, false);
                        if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage))
                        {
                            client._IconStateMgr.AddFlushIconState(14000, client._IconStateMgr.IsAnyJieRiTipActived());
                            client._IconStateMgr.SendIconStateToClient(client);
                        }
                        if (sourceClient._IconStateMgr.CheckJieRiFanLi(sourceClient, ActivityTypes.JieriMarriage))
                        {
                            sourceClient._IconStateMgr.AddFlushIconState(14000, sourceClient._IconStateMgr.IsAnyJieRiTipActived());
                            sourceClient._IconStateMgr.SendIconStateToClient(sourceClient);
                        }
                        FriendData friendData = Global.FindFriendData(client, sourceID);
                        if (friendData != null && friendData.FriendType != 0)
                        {
                            GameManager.ClientMgr.RemoveFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, friendData.DbID);
                            friendData = null;
                        }
                        if (friendData == null)
                        {
                            GameManager.ClientMgr.AddFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, -1, sourceID, Global.FormatRoleName(sourceClient, sourceClient.ClientData.RoleName), 0);
                        }
                        friendData = Global.FindFriendData(sourceClient, client.ClientData.RoleID);
                        if (friendData != null && friendData.FriendType != 0)
                        {
                            GameManager.ClientMgr.RemoveFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, sourceClient, friendData.DbID);
                            friendData = null;
                        }
                        if (friendData == null)
                        {
                            GameManager.ClientMgr.AddFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, sourceClient, -1, client.ClientData.RoleID, Global.FormatRoleName(client, client.ClientData.RoleName), 0);
                        }
                        string broadCastMsg = string.Format(GLang.GetLang(485, new object[0]), sourceClient.ClientData.RoleName, client.ClientData.RoleName);
                        Global.BroadcastRoleActionMsg(client, RoleActionsMsgTypes.Bulletin, broadCastMsg, true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlySysHint, 0, 0, 100, 100);
                        SingletonTemplate <CoupleArenaManager> .Instance().OnMarry(sourceClient, client);
                    }
                    result = MarryResult.Success;
                }
            }
            return(result);
        }
Esempio n. 23
0
    public void FriendResearchResp(FriendData fd, int msg)
    {
        if (FriendManager.ERROR_FRIEND_SUCCESS != msg)
        {
            m_goCantFindFriend.SetActive(true);
            m_goAddFriendDialogLine.SetActive(true);
            m_goAddFriendInfo.SetActive(false);
            m_btnSendQuestBtn.id = 0;
        }
        else
        {
            m_goCantFindFriend.SetActive(false);
            m_goAddFriendDialogLine.SetActive(false);
            //m_spAddFriendInfoHeadImg
            //m_lblAddFriendInfoLevel.text = LanguageData.dataMap[ContentDefine.Friend.LV].Format(fd.level);
            m_lblAddFriendInfoLevel.text = LanguageData.GetContent(ContentDefine.Friend.LV, fd.level);
            m_lblAddFriendInfoName.text = fd.name;
            //m_lblAddFriendInfoPower.text = LanguageData.dataMap[ContentDefine.Friend.POWER].Format(fd.fight);
            m_lblAddFriendInfoPower.text = LanguageData.GetContent(ContentDefine.Friend.POWER, fd.fight);
            m_goAddFriendInfo.SetActive(true);
            m_btnSendQuestBtn.id = fd.id;
        }
        UISprite s = m_myTransform.FindChild(m_widgetToFullName["AddFriendInfoHeadImg"]).GetComponentsInChildren<UISprite>(true)[0];
        if (s != null)
        {
            string imageName = "";
            if (fd.vocation == 1)
            {
                imageName = "zhanshi";
            }
            else if (fd.vocation == 2)
            {
                imageName = "cike";
            }
            else if (fd.vocation == 3)
            {
                imageName = "gongjianshou";
            }
            else if (fd.vocation == 4)
            {
                imageName = "fashi";
            }
            else
            {

            }
            s.spriteName = imageName;
        }
    }
Esempio n. 24
0
        /// <summary>
        /// 对方回复求婚
        /// </summary>
        public static MarryResult MarryReply(GameClient client, int sourceID, int accept)
        {
            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                return(MarryResult.NotOpen);
            }

            if (client.ClientData.MyMarriageData.byMarrytype > 0)
            {
                return(MarryResult.SelfMarried);
            }

            GameClient sourceClient = GameManager.ClientMgr.FindClient(sourceID);

            if (sourceClient == null)
            {
                return(MarryResult.ApplyTimeout);
            }
            if (sourceClient.ClientData.MyMarriageData.byMarrytype > 0)
            {
                return(MarryResult.TargetMarried);
            }

            if (RemoveMarryApply(sourceID, MarryApplyType.ApplyInit) == false)
            {
                return(MarryResult.ApplyTimeout);
            }

            if (accept == 0 || client.ClientData.MyMarriageData.byAutoReject == 1)
            {
                // 拒绝返钱
                string notifyData = string.Format("{0}:{1}:{2}", (int)MarryNotifyType.NotifyRejectInit, client.ClientData.RoleID, client.ClientData.RoleName);
                sourceClient.sendCmd((int)TCPGameServerCmds.CMD_SPR_MARRY_NOTIFY, notifyData);

                GameManager.ClientMgr.AddUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, sourceClient, MarryCost, "求婚被拒绝返还钻石");
            }
            else
            {
                // 同意
                RemoveMarryApply(sourceID);

                // 如果自己在申请狀态,需取消返钱
                MarryLogic.ApplyLogoutClear(client);
                RemoveMarryApply(client.ClientData.RoleID);

                // 初始婚戒
                int initRingID = 0;
                if (null != MarriageOtherLogic.getInstance().WeddingRingDic.SystemXmlItemDict)
                {
                    initRingID = MarriageOtherLogic.getInstance().WeddingRingDic.SystemXmlItemDict.Keys.First();
                }
                if (sourceClient.ClientData.MyMarriageData.nRingID <= 0)
                {
                    sourceClient.ClientData.MyMarriageData.nRingID = initRingID;
                }
                if (client.ClientData.MyMarriageData.nRingID <= 0)
                {
                    client.ClientData.MyMarriageData.nRingID = initRingID;
                }

                // 更新婚姻狀态
                // marry type 1:丈夫 2:妻子
                sbyte sourceType = (sourceClient.ClientData.RoleSex != 1 || client.ClientData.RoleSex == sourceClient.ClientData.RoleSex)? (sbyte)1 : (sbyte)2;
                sourceClient.ClientData.MyMarriageData.byMarrytype = sourceType;
                client.ClientData.MyMarriageData.byMarrytype       = (sourceType == 1)? (sbyte)2 : (sbyte)1;

                // 更新伴侶role id
                sourceClient.ClientData.MyMarriageData.nSpouseID = client.ClientData.RoleID;
                client.ClientData.MyMarriageData.nSpouseID       = sourceID;

                // 初始化0星1阶 [bing] 因为再结婚还会走这个函数就会被初始化为1阶 应该不初始化它 是个bug 这里FIX下
                if (sourceClient.ClientData.MyMarriageData.byGoodwilllevel == 0)
                {
                    //[bing] 更新时间
                    sourceClient.ClientData.MyMarriageData.ChangTime       = TimeUtil.NowDateTime().ToString("yyyy-MM-dd HH:mm:ss");
                    sourceClient.ClientData.MyMarriageData.byGoodwilllevel = 1;
                }
                if (client.ClientData.MyMarriageData.byGoodwilllevel == 0)
                {
                    client.ClientData.MyMarriageData.ChangTime       = TimeUtil.NowDateTime().ToString("yyyy-MM-dd HH:mm:ss");
                    client.ClientData.MyMarriageData.byGoodwilllevel = 1;
                }

                MarryFuBenMgr.UpdateMarriageData2DB(sourceClient);
                MarryFuBenMgr.UpdateMarriageData2DB(client);

                MarriageOtherLogic.getInstance().SendMarriageDataToClient(sourceClient);
                MarriageOtherLogic.getInstance().SendMarriageDataToClient(client);

                //更新婚戒属性
                MarriageOtherLogic.getInstance().UpdateRingAttr(sourceClient, true);

                //[bing] 刷新客户端活动叹号
                if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage) == true)
                {
                    client._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, client._IconStateMgr.IsAnyJieRiTipActived());
                    client._IconStateMgr.SendIconStateToClient(client);
                }
                //[bing] 刷新客户端活动叹号
                if (sourceClient._IconStateMgr.CheckJieRiFanLi(sourceClient, ActivityTypes.JieriMarriage) == true)
                {
                    sourceClient._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, sourceClient._IconStateMgr.IsAnyJieRiTipActived());
                    sourceClient._IconStateMgr.SendIconStateToClient(sourceClient);
                }

                // 好友逻辑
                FriendData friendData = Global.FindFriendData(client, sourceID);
                if (friendData != null && friendData.FriendType != 0)
                {
                    GameManager.ClientMgr.RemoveFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                       client, friendData.DbID);
                    friendData = null;
                }
                if (friendData == null)
                {
                    GameManager.ClientMgr.AddFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                    client, -1, sourceID, Global.FormatRoleName(sourceClient, sourceClient.ClientData.RoleName), 0);
                }

                friendData = Global.FindFriendData(sourceClient, client.ClientData.RoleID);
                if (friendData != null && friendData.FriendType != 0)
                {
                    GameManager.ClientMgr.RemoveFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                       sourceClient, friendData.DbID);
                    friendData = null;
                }
                if (friendData == null)
                {
                    GameManager.ClientMgr.AddFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                    sourceClient, -1, client.ClientData.RoleID, Global.FormatRoleName(client, client.ClientData.RoleName), 0);
                }

                //扩播消息
                string broadCastMsg = string.Format(Global.GetLang("恭喜 {0} 和 {1} 喜结连理!"), sourceClient.ClientData.RoleName, client.ClientData.RoleName);
                Global.BroadcastRoleActionMsg(client, RoleActionsMsgTypes.Bulletin, broadCastMsg, true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlySysHint);

                CoupleArenaManager.Instance().OnMarry(sourceClient, client);
            }

            return(MarryResult.Success);
        }
Esempio n. 25
0
 public FriendController(FriendData friendData, ILoggerFactory loggerFactory)
 {
     _frienddata = friendData;
     _Logger     = loggerFactory.CreateLogger(nameof(FriendController));
 }
Esempio n. 26
0
    private void SetDeadFriend(FriendData friendData)
    {
        DeadFriend deadFriend = Instantiate(deadFriendPrefab, friendData.Position, Quaternion.identity).GetComponent <DeadFriend>();

        deadFriend.FriendData = friendData;
    }
Esempio n. 27
0
    IEnumerator RequestSubmit()
    {
        int userKeyNo = PlayerPrefs.GetInt("UserKeyNo");

        WWWForm form = new WWWForm();

        form.AddField("userKeyNo", userKeyNo);
        form.AddField("msgTableKeyNo", messageTableKeyNo);
        form.AddField("msgTypeNo", messageTypeNo);

        string url = string.Format(
            GameData.Instance.urlPrefix,
            "deleteMessage");
        WWW www = new WWW(url, form);

        yield return(www);

        if (www.isDone && www.error == null)
        {
            string responseCode = www.text.Substring(0, 5);
            switch (responseCode)
            {
            case "query":
                // 서버에서 SQL 쿼리 에러가 발생한 경우.
                #if UNITY_EDITOR
                Debug.Log(www.text);
                #endif
                break;

            case "none0":
                // 메시지 데이터가 존재하지는 않는 경우.
                // 메시지 삭제, 메시지창 재설정.
                GameData.Instance.msgBox.DeleteMessage(messageTableKeyNo);
                GameData.Instance.msgBox.RefreshMessageBox(true);
                break;

            case "done0":
                // 메시지 처리 완료.
                if (messageTypeNo < 10)
                {
                    responseCode = www.text.Substring(5);
                    GameData.Instance.msgBox.UpdateData(messageTypeNo, responseCode);
                    GameData.Instance.lobbyGM.UpdateCoreData();
                }
                else
                {
                    responseCode = www.text.Substring(5);
                    int friendNo = System.Convert.ToInt32(responseCode);
                    //친구 데이터 업데이트.
                    int friendIndex
                        = GameData.Instance
                          .friendList.FindIndex(x => x.friend == friendNo);
                    FriendData tempFriendData
                        = GameData.Instance.friendList[friendIndex];
                    tempFriendData.state = 2;
                    GameData.Instance.friendList[friendIndex] = tempFriendData;
                }

                GameData.Instance.msgBox.DeleteMessage(messageTableKeyNo);
                GameData.Instance.msgBox.RefreshMessageBox(true);
                break;
            }
        }
    }
    void onGetFriendScoreSuccess(string jsonData)
    {
        Debug.Log("onGetFriendScoreSuccess");

        Dictionary <string, object> dataDict = jsonData.dictionaryFromJson();

        if (dataDict == null || !dataDict.ContainsKey("data"))
        {
            return;
        }

        List <object> friendDataObjList = dataDict["data"] as List <object>;

        if (friendDataObjList == null)
        {
            return;
        }

        List <FriendData> friendDatas = new List <FriendData>();

        for (int i = 0; i < friendDataObjList.Count; i++)
        {
            Dictionary <string, object> oneData = friendDataObjList[i] as Dictionary <string, object>;

            FriendData oneFriendData = new FriendData();

            if (oneData.ContainsKey("userId"))
            {
                oneFriendData.userId = Convert.ToInt32(oneData["userId"]);
            }

            if (oneData.ContainsKey("deviceId"))
            {
                oneFriendData.deviceId = Convert.ToString(oneData["deviceId"]);
            }

            if (oneData.ContainsKey("platformId"))
            {
                oneFriendData.platformId = Convert.ToString(oneData["platformId"]);

                oneFriendData.userName = QihooSnsModel.Instance.getNameByPlatformID(oneFriendData.platformId);
            }

            if (oneData.ContainsKey("levelMap"))
            {
                int maxLevelIndex = 0;
                Dictionary <string, object> oneUserData = oneData["levelMap"] as Dictionary <string, object>;
                foreach (KeyValuePair <string, object> pair in oneUserData)
                {
                    int level = int.Parse(pair.Key);
                    int score = 0;

                    maxLevelIndex = level > maxLevelIndex ? level : maxLevelIndex;

                    Dictionary <string, object> oneLevelData = pair.Value as Dictionary <string, object>;
                    if (oneLevelData.ContainsKey("score"))
                    {
                        score = Convert.ToInt32(oneLevelData["score"]);
                    }

                    oneFriendData.levelMap[level] = score;
                    oneFriendData.maxLevelIndex   = maxLevelIndex;
                }
            }

            friendDatas.Add(oneFriendData);
        }

        HighScoreModel.Instance.FriendDataList = friendDatas;

        UpdateFriendNameInMap();
    }
Esempio n. 29
0
 private void OnAddFriendDataEvent(FriendData data)
 {
     if (data.FriendType == 1)
     {
         this.mFriendLayer.AddFriendItem(data);
         this.RefreshTabMark0();
     }
     if (data.FriendType == 2)
     {
         this.mFriendBlackListLayer.AddFriendItem(data);
     }
     if (data.FriendType == 3)
     {
         this.mFriendRequestLayer.AddFriendItem(data);
         this.RefreshTabMark3();
     }
     this.mFriendRecommendLayer.AddFriendItem(data);
 }
Esempio n. 30
0
 /// <summary>
 /// 搜索的人物列表
 /// </summary>
 /// <param name="luaTable"></param>
 /// <param name="msg"></param>
 public void FriendResearchReqResp(LuaTable luaTable, int msg)
 {
     FriendData obj;
     if (Utils.ParseLuaTable(luaTable, out obj))
     {
         m_lastResearchFriend = obj;
         SocietyUIViewManager.Instance.FriendResearchResp(m_lastResearchFriend, msg);
     }
     else
     {
         m_lastResearchFriend.id = 0;
         m_lastResearchFriend.name = "";
     }
 }
Esempio n. 31
0
 public static void callRemoveFriend(FriendData data)
 {
     OnRemoveFriend(data);
 }
Esempio n. 32
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        int friendsLen = stream.readLen();

        if (this.friends != null)
        {
            this.friends.clear();
            this.friends.ensureCapacity(friendsLen);
        }
        else
        {
            this.friends = new LongObjectMap <FriendData>(friendsLen);
        }

        LongObjectMap <FriendData> friendsT = this.friends;

        for (int friendsI = friendsLen - 1; friendsI >= 0; --friendsI)
        {
            FriendData friendsV;
            BaseData   friendsVT = stream.readDataFullNotNull();
            if (friendsVT != null)
            {
                if (friendsVT is FriendData)
                {
                    friendsV = (FriendData)friendsVT;
                }
                else
                {
                    friendsV = new FriendData();
                    if (!(friendsVT.GetType().IsAssignableFrom(typeof(FriendData))))
                    {
                        stream.throwTypeReadError(typeof(FriendData), friendsVT.GetType());
                    }
                    friendsV.shadowCopy(friendsVT);
                }
            }
            else
            {
                friendsV = null;
            }

            friendsT.put(friendsV.playerID, friendsV);
        }

        int blackListLen = stream.readLen();

        if (this.blackList != null)
        {
            this.blackList.clear();
            this.blackList.ensureCapacity(blackListLen);
        }
        else
        {
            this.blackList = new LongObjectMap <ContactData>(blackListLen);
        }

        LongObjectMap <ContactData> blackListT = this.blackList;

        for (int blackListI = blackListLen - 1; blackListI >= 0; --blackListI)
        {
            ContactData blackListV;
            BaseData    blackListVT = stream.readDataFullNotNull();
            if (blackListVT != null)
            {
                if (blackListVT is ContactData)
                {
                    blackListV = (ContactData)blackListVT;
                }
                else
                {
                    blackListV = new ContactData();
                    if (!(blackListVT.GetType().IsAssignableFrom(typeof(ContactData))))
                    {
                        stream.throwTypeReadError(typeof(ContactData), blackListVT.GetType());
                    }
                    blackListV.shadowCopy(blackListVT);
                }
            }
            else
            {
                blackListV = null;
            }

            blackListT.put(blackListV.playerID, blackListV);
        }

        int applyDicLen = stream.readLen();

        if (this.applyDic != null)
        {
            this.applyDic.clear();
            this.applyDic.ensureCapacity(applyDicLen);
        }
        else
        {
            this.applyDic = new LongObjectMap <ApplyAddFriendData>(applyDicLen);
        }

        LongObjectMap <ApplyAddFriendData> applyDicT = this.applyDic;

        for (int applyDicI = applyDicLen - 1; applyDicI >= 0; --applyDicI)
        {
            ApplyAddFriendData applyDicV;
            BaseData           applyDicVT = stream.readDataFullNotNull();
            if (applyDicVT != null)
            {
                if (applyDicVT is ApplyAddFriendData)
                {
                    applyDicV = (ApplyAddFriendData)applyDicVT;
                }
                else
                {
                    applyDicV = new ApplyAddFriendData();
                    if (!(applyDicVT.GetType().IsAssignableFrom(typeof(ApplyAddFriendData))))
                    {
                        stream.throwTypeReadError(typeof(ApplyAddFriendData), applyDicVT.GetType());
                    }
                    applyDicV.shadowCopy(applyDicVT);
                }
            }
            else
            {
                applyDicV = null;
            }

            applyDicT.put(applyDicV.playerID, applyDicV);
        }

        stream.endReadObj();
    }
Esempio n. 33
0
 void FriendManager_OnAddFriend(FriendData data)
 {
     AddFriend(data);
     scrollerContent.SendMessage("calcHeight");
 }
Esempio n. 34
0
 void removeFriend(FriendData data)
 {
     GameObject G = friendsInList[data.Name];
     friendsInList.Remove(data.Name);
     Destroy(G);
     friends.Remove(data.Name);
     scrollerContent.SendMessage("calcHeight");
 }
Esempio n. 35
0
    private bool FriendsRecommendResult(CReadPacket packet)
    {
        Debug.Log(" FriendsRecommendResult  推荐好友");
        Dictionary <string, object> data = packet.data;

        int result = int.Parse(data["ret"].ToString());

        if (result == 0)
        {
            if (data.ContainsKey("item"))
            {
                playerData.GetInstance().friendListData.RecommendfriendList.Clear();
                if (null != data["item"] as object[])
                {
                    object[] goodList = data["item"] as object[];
                    for (int i = 0; i < goodList.Length; i++)
                    {
                        Dictionary <string, object> goodInfo = (Dictionary <string, object>)goodList[i];
                        FriendData info = new FriendData();
                        if (goodInfo.ContainsKey("nm"))
                        {
                            info.Name = goodInfo["nm"].ToString();
                        }
                        if (goodInfo.ContainsKey("id"))
                        {
                            info.PlayerId = long.Parse(goodInfo["id"].ToString());
                        }
                        if (goodInfo.ContainsKey("aid"))
                        {
                            info.AcountPlayerId = long.Parse(goodInfo["aid"].ToString());
                        }
                        if (goodInfo.ContainsKey("ptf"))
                        {
                            if (null != FSDataNodeTable <RoleIconAttrNode> .GetSingleton().FindDataByType(int.Parse(goodInfo["ptf"].ToString())))
                            {
                                RoleIconAttrNode vo = FSDataNodeTable <RoleIconAttrNode> .GetSingleton().FindDataByType(int.Parse(goodInfo["ptf"].ToString()));

                                info.PlayerFrame = vo.icon_name;
                            }
                        }
                        if (goodInfo.ContainsKey("lv"))
                        {
                            info.Level = int.Parse(goodInfo["lv"].ToString());
                        }
                        if (goodInfo.ContainsKey("hlv"))
                        {
                            info.HeroLevel = int.Parse(goodInfo["hlv"].ToString());
                        }
                        if (goodInfo.ContainsKey("pt"))
                        {
                            if (null != FSDataNodeTable <HeroNode> .GetSingleton().FindDataByType(int.Parse(goodInfo["pt"].ToString())))
                            {
                                HeroNode vo = FSDataNodeTable <HeroNode> .GetSingleton().FindDataByType(int.Parse(goodInfo["pt"].ToString()));

                                info.PlayerIcon = vo.icon_name + "_head";
                            }
                        }
                        if (goodInfo.ContainsKey("afc"))
                        {
                            info.Fighting = int.Parse(goodInfo["afc"].ToString());
                        }
                        if (goodInfo.ContainsKey("tl"))
                        {
                            if (0 != int.Parse(goodInfo["tl"].ToString()))
                            {
                                if (null != FSDataNodeTable <TitleNode> .GetSingleton().FindDataByType(int.Parse(goodInfo["tl"].ToString())))
                                {
                                    TitleNode vo = FSDataNodeTable <TitleNode> .GetSingleton().FindDataByType(int.Parse(goodInfo["tl"].ToString()));

                                    info.Title = vo.titlename;
                                }
                            }
                            else
                            {
                                info.Title = "称号:无";
                            }
                        }
                        playerData.GetInstance().friendListData.RecommendfriendList.Add(info);
                    }
                    if (playerData.GetInstance().friendListData.RecommendfriendList.Count > 0)
                    {
                        List <FriendData> itemLt = new List <FriendData>();
                        playerData.GetInstance().friendListData.RecommendfriendList.Sort((a, b) => b.Fighting - a.Fighting);
                        FriendData temp = null;
                        for (int i = 0; i < playerData.GetInstance().friendListData.RecommendfriendList.Count; i++)
                        {
                            for (int j = i + 1; j < playerData.GetInstance().friendListData.RecommendfriendList.Count; j++)
                            {
                                if (playerData.GetInstance().friendListData.RecommendfriendList[j].Fighting == playerData.GetInstance().friendListData.RecommendfriendList[i].Fighting && playerData.GetInstance().friendListData.RecommendfriendList[j].Level > playerData.GetInstance().friendListData.RecommendfriendList[i].Level)
                                {
                                    temp = playerData.GetInstance().friendListData.RecommendfriendList[j];
                                    playerData.GetInstance().friendListData.RecommendfriendList[j] = playerData.GetInstance().friendListData.RecommendfriendList[i];
                                    playerData.GetInstance().friendListData.RecommendfriendList[i] = temp;
                                }
                            }
                        }
                    }
                }
            }
            return(true);
        }
        else
        {
            Control.ShowGUI(UIPanleID.UITooltips, EnumOpenUIType.DefaultUIOrSecond, false, data["desc"].ToString());
            return(false);
        }
    }
Esempio n. 36
0
 public static void callOnAddFriend(FriendData data)
 {
     OnAddFriend(data);
 }
Esempio n. 37
0
        private void OnGetMsg_SystemNotice(OperationResponse operationResponse)
        {
            if (operationResponse == null)
            {
                ClientLogger.Error("Model_Friend:OnGetMsg_SystemNotice:operationResponse=null");
                return;
            }
            if (operationResponse.Parameters == null || !operationResponse.Parameters.ContainsKey(1))
            {
                ClientLogger.Error("Model_Friend:OnGetMsg_SystemNotice:operationResponse.Parameters.ContainsKey((byte)MobaOpKey.ErrorCode)");
                return;
            }
            base.LastError = (int)operationResponse.Parameters[1];
            FriendModelData friendModelData = base.Data as FriendModelData;

            if (friendModelData == null)
            {
                ClientLogger.Error("Model_Friend:OnGetMsg_SystemNotice:data=null");
                return;
            }
            MobaErrorCode lastError = (MobaErrorCode)base.LastError;

            if (lastError != MobaErrorCode.Ok)
            {
                base.DebugMessage = "====>GetArenaDefTeam" + operationResponse.OperationCode;
            }
            else if (!operationResponse.Parameters.ContainsKey(40))
            {
                ClientLogger.Error("Model_Friend:OnGetMsg_SystemNotice:operationResponse[MobaOpKey.Notification]==null");
            }
            else
            {
                byte[]           buffer           = operationResponse.Parameters[40] as byte[];
                NotificationData notificationData = SerializeHelper.Deserialize <NotificationData>(buffer);
                if (notificationData == null)
                {
                    ClientLogger.Error("Model_Friend:OnGetMsg_SystemNotice:deserialize failed");
                }
                else
                {
                    short type = notificationData.Type;
                    if (type != 14)
                    {
                        if (type != 15)
                        {
                            if (type == 9)
                            {
                                string[] subItem = notificationData.Content.Split(new char[]
                                {
                                    '|'
                                });
                                FriendData friendData = friendModelData.friendDataList.Find((FriendData obj) => obj.TargetId == (long)int.Parse(subItem[0]));
                                if (friendData != null)
                                {
                                    if (friendData.Messages == null)
                                    {
                                        friendData.Messages = new List <Messages>();
                                    }
                                    friendData.Messages.Add(new Messages
                                    {
                                        Time    = subItem[subItem.Length - 1],
                                        Content = subItem[1]
                                    });
                                }
                            }
                        }
                        else
                        {
                            string[] delsubItem = notificationData.Content.Split(new char[]
                            {
                                '|'
                            });
                            FriendData item = friendModelData.friendDataList.Find((FriendData obj) => obj.TargetId == (long)int.Parse(delsubItem[delsubItem.Length - 1]));
                            friendModelData.friendDataList.Remove(item);
                        }
                    }
                    else
                    {
                        string[] blacksubItem = notificationData.Content.Split(new char[]
                        {
                            '|'
                        });
                        friendModelData.friendDataList.RemoveAll((FriendData obj) => obj.TargetId == long.Parse(blacksubItem[1]));
                    }
                    base.DebugMessage = "====>OK " + operationResponse.OperationCode;
                }
            }
            base.Data  = friendModelData;
            base.Valid = (base.LastError == 0);
        }
	void onGetFriendScoreSuccess(string jsonData)
	{
		Debug.Log("onGetFriendScoreSuccess");
		
		Dictionary<string, object> dataDict = jsonData.dictionaryFromJson();
		if (dataDict == null || !dataDict.ContainsKey("data"))
		{
			return;
		}
			
		List<object> friendDataObjList = dataDict["data"] as List<object>;
		if (friendDataObjList == null)
		{
			return;
		}
		
		List<FriendData> friendDatas = new List<FriendData>();
		for (int i = 0; i < friendDataObjList.Count; i++)
		{
			Dictionary<string, object> oneData = friendDataObjList[i] as Dictionary<string, object>;
			
			FriendData oneFriendData = new FriendData();
			
			if (oneData.ContainsKey("userId"))
			{
				oneFriendData.userId = Convert.ToInt32(oneData["userId"]);
			}
			
			if (oneData.ContainsKey("deviceId"))
			{
				oneFriendData.deviceId = Convert.ToString(oneData["deviceId"]);
			}
			
			if (oneData.ContainsKey("platformId"))
			{
				oneFriendData.platformId = Convert.ToString(oneData["platformId"]);
				
				oneFriendData.userName = QihooSnsModel.Instance.getNameByPlatformID(oneFriendData.platformId);
			}
			
			if (oneData.ContainsKey("levelMap"))
			{
				int maxLevelIndex = 0;
				Dictionary<string, object> oneUserData = oneData["levelMap"] as Dictionary<string, object>;
				foreach (KeyValuePair<string, object> pair in oneUserData)
				{
					int level = int.Parse(pair.Key);
					int score = 0;
					
					maxLevelIndex = level > maxLevelIndex ? level : maxLevelIndex;
					
					Dictionary<string, object> oneLevelData = pair.Value as Dictionary<string, object>;
					if (oneLevelData.ContainsKey("score"))
					{
						score = Convert.ToInt32(oneLevelData["score"]);
					}
					
					oneFriendData.levelMap[level] = score;
					oneFriendData.maxLevelIndex = maxLevelIndex;
				}
			}
			
			friendDatas.Add(oneFriendData);
		}
		
		HighScoreModel.Instance.FriendDataList = friendDatas;
		
		UpdateFriendNameInMap();
	}
Esempio n. 39
0
 public void GetPictureByURL(string url, FriendData friend)
 {
     StartCoroutine(GetPictureCor(url, friend));
 }
Esempio n. 40
0
 void FriendManager_OnRemoveFriend(FriendData data)
 {
     removeFriend(data);
     CustomDebug.Log("Removed Friend named: " + data.Name);
 }
Esempio n. 41
0
 public void GetFriend(FriendData friend)
 {
     _friendModel.AddFriend(friend);
 }
Esempio n. 42
0
    // RankUnit 처리하여 순위 생성.
    void MakeFriendRank()
    {
        // 점수에 따라서 정렬하기 전에 리스트 초기화.
        tempFriendList.Clear();
        // 친구 목록만 선택.
        tempFriendList = GameData.Instance.friendList.FindAll(x => x.state==2);
        // 사용자 데이터도 친구로 등록.
        FriendData myData = new FriendData();
        myData.score = GameData.Instance.userdata.highScore;
        myData.state = -1;
        myData.name = GameData.Instance.userdata.name;
        //
        myData.facebook = GameData.Instance.userdata.facebook;
        tempFriendList.Add(myData);

        // 점수에 따라 정렬.
        tempFriendList.Sort(
            (FriendData x, FriendData y) => y.score.CompareTo(x.score));
        // 새로운 RankUnit 추가.
        AddNewRankUnit(rankList.Count, tempFriendList.Count);

        //        int unitCounter = tempFriendList.Count - rankList.Count;
        //
        //        if(unitCounter > 0)
        //        {
        //            SetupRankUnit(rankList.Count, 1);
        //            //add
        //            AddNewRankUnit(rankList.Count, tempFriendList.Count);
        //        }
        //        else if(unitCounter < 0)
        //        {
        //            SetupRankUnit(tempFriendList.Count, 1);
        //            //remove
        //            rankList.RemoveRange(tempFriendList.Count,
        //                                 rankList.Count-tempFriendList.Count);
        //        }
        //        else if( rankList.Count > 0 )
        //        {
        //            SetupRankUnit(rankList.Count, 1);
        //        }
        //        else
        //        {
        //            AddNewRankUnit(0, tempFriendList.Count);
        //        }
    }
Esempio n. 43
0
 static int FriendSortByName(FriendData x, FriendData y)
 {
     return(x._name.CompareTo(y._name));
 }