Ejemplo n.º 1
0
    public void SetData(PrefabMessageTabbarControllerView controller, List <Messages> _listMessage)
    {
        tabbarController = controller;
        listMessage      = _listMessage;
        if (listMessage[0].sender_name == GameManager.Instance.mInfo.username)
        {
            username.text = listMessage[0].receiver_name;
            username.text = CutString(username.text);
        }
        else
        {
            username.text = listMessage[0].sender_name;
            username.text = CutString(username.text);
        }
        listMessage.Sort((x, y) => x.time_sent.CompareTo(y.time_sent));
        //GameManager.Instance.mInfo.AvatarTexture(delegate(Texture _texture) { avatar.mainTexture = _texture; });
        //Debug.Log
        ServerWeb.GetAvatarFromId(GameManager.Instance.mInfo.id == listMessage[0].receiver ? listMessage[0].sender_avatar : listMessage[0].receiver_avatar,
                                  delegate(Texture _avatar) {
            if (avatar != null)
            {
                avatar.mainTexture = _avatar;
            }
        });

        numberNoneRead = listMessage.FindAll(m => m.receiver_name == GameManager.Instance.mInfo.username && m.read == false).Count;
        SetCountNumber(numberNoneRead);
    }
Ejemplo n.º 2
0
    public void SetData(Messages message)
    {
        lbUsername.text = message.sender_name;           // GameManager.Instance.mInfo.username == message.receiver_name ? message.sender_name : message.receiver_name;
        lbContent.text  = message.content;               // +" Mỗi lần xuất hiện, hai bé gái song sinh nhà của ngôi sao ‘Sex and the City’, Sarah Jessica Parker luôn gây chú ý về vẻ dễ thương cùng gu ăn mặc sành điệu.";

        ServerWeb.GetAvatarFromId(message.sender_avatar, // GameManager.Instance.mInfo.username == message.receiver_name ? message.sender_avatar : message.receiver_avatar,
                                  delegate(Texture _avatar) { if (avatar != null)
                                                              {
                                                                  avatar.mainTexture = _avatar;
                                                              }
                                  });
    }
Ejemplo n.º 3
0
    public void SetDataUser(Electrotank.Electroserver5.Api.EsObject obj)
    {
        if (obj.variableExists("id"))
        {
            id = obj.getInteger("id");
        }

        if (obj.variableExists("username"))
        {
            username = obj.getString("username");
        }
        else if (obj.variableExists(Fields.PLAYER.USERNAME))
        {
            username = obj.getString(Fields.PLAYER.USERNAME);
        }

        if (obj.variableExists("email"))
        {
            email = obj.getString("email");
        }
        if (obj.variableExists("first_name"))
        {
            firstName = obj.getString("first_name");
        }
        if (obj.variableExists("middle_name"))
        {
            middleName = obj.getString("middle_name");
        }
        if (obj.variableExists("last_name"))
        {
            lastName = obj.getString("last_name");
        }
        if (obj.variableExists("birthday"))
        {
            System.DateTime.TryParse(obj.getString("birthday").Replace(":", "-"), out brithday);
        }
        if (obj.variableExists("gender"))
        {
            gender = obj.getString("gender");
        }
        if (obj.variableExists("address"))
        {
            address = obj.getString("address");
        }
        if (obj.variableExists("identity_card_number"))
        {
            cmtnd = obj.getString("identity_card_number");
        }
        if (obj.variableExists("mobile"))
        {
            phone = obj.getString("mobile");
        }
        if (obj.variableExists("avatar"))
        {
            if (obj.getDataType("avatar") == DataType.String)
            {
                avatarUrl = obj.getString("avatar");
            }
            else if (obj.getDataType("avatar") == DataType.Integer)
            {
                ServerWeb.GetAvatarFromId(obj.getInteger("avatar"), delegate(Texture _texture) { _avatarTexture = _texture; });
            }
        }

        if (obj.variableExists("create_time"))
        {
            System.DateTime.TryParse(obj.getString("create_time"), out createTime);
        }
        if (obj.variableExists("time_request"))
        {
            System.DateTime.TryParse(obj.getString("time_request"), out timeRequest);
        }
        if (obj.variableExists("numBuddies"))
        {
            numberBuddies = obj.getInteger("numBuddies");
        }
        if (obj.variableExists("role"))
        {
            role = (ERole)obj.getInteger("role");
        }
        if (obj.variableExists("level"))
        {
            level = obj.getInteger("level");
        }
        if (obj.variableExists("experience"))
        {
            experience = obj.getInteger("experience");
        }
        if (obj.variableExists("expMinCurrentLevel"))
        {
            expMinCurrentLevel = obj.getInteger("expMinCurrentLevel");
        }
        if (obj.variableExists("expMinNextLevel"))
        {
            expMinNextLevel = obj.getInteger("expMinNextLevel");
        }

        if (obj.variableExists("buddies"))
        {
            if (buddies != null && buddies.Count > 0)
            {
                buddies.Clear();
            }
            EsObject[] array = obj.getEsObjectArray("buddies");
            Array.ForEach <EsObject>(array, o => { buddies.Add(new User(o)); });
        }
        if (obj.variableExists("pendingBuddies"))
        {
            if (pendingBuddies != null && pendingBuddies.Count > 0)
            {
                pendingBuddies.Clear();
            }
            EsObject[] array = obj.getEsObjectArray("pendingBuddies");
            Array.ForEach <EsObject>(array, o => { pendingBuddies.Add(new User(o)); });
        }
        if (obj.variableExists("requestBuddies"))
        {
            EsObject[] array = obj.getEsObjectArray("requestBuddies");
            Array.ForEach <EsObject>(array, o => { requestBuddies.Add(new User(o)); });
        }

        if (obj.variableExists("chip"))
        {
            if (obj.getDataType("chip") == DataType.String)
            {
                long.TryParse(obj.getString("chip"), out chip);
            }
            else if (obj.getDataType("chip") == DataType.Long)
            {
                chip = obj.getLong("chip");
            }
        }

        if (obj.variableExists("gold"))
        {
            if (obj.getDataType("gold") == DataType.String)
            {
                long.TryParse(obj.getString("gold"), out gold);
            }
            else if (obj.getDataType("gold") == DataType.Long)
            {
                gold = obj.getLong("gold");
            }
        }

        if (obj.variableExists("accessToken"))
        {
            accessToken = obj.getString("accessToken");
        }
    }