void SetDataOther(Electrotank.Electroserver5.Api.EsObject obj)
 {
     if (obj.variableExists("isMaster"))
     {
         isMaster = obj.getBoolean("isMaster");
     }
     if (obj.variableExists("slotIndex"))
     {
         slotServer = obj.getInteger("slotIndex");
     }
     if (obj.variableExists("playerState"))
     {
         PlayerState = ConvertPlayerState(obj.getString("playerState"));
     }
     if (obj.variableExists("handSize"))
     {
         handSize = obj.getInteger("handSize");
     }
     if (obj.variableExists("isRobot"))
     {
         isRobot = obj.getBoolean("isRobot");
     }
     if (obj.variableExists("priority"))
     {
         isPriority = obj.getBoolean("priority");
     }
 }
Beispiel #2
0
 public void SetDataRoom(Electrotank.Electroserver5.Api.EsObject obj)
 {
     if (obj.variableExists("zoneId"))
     {
         zoneId = obj.getInteger("zoneId");
     }
     if (obj.variableExists("roomId"))
     {
         roomId = obj.getInteger("roomId");
     }
     if (obj.variableExists("zoneName"))
     {
         zoneName = obj.getString("zoneName");
     }
     if (obj.variableExists("roomName"))
     {
         roomName = obj.getString("roomName");
     }
 }
Beispiel #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");
        }
    }