Guild bind group
Unity3D
Outline
Access Guide
Mobile QQ group function
WeChat group function
FAQ
Android
Outline
Access Guide
Mobile QQ group function
WeChat group function
FAQ
IOS
Outline
Access Guide
Mobile QQ group function
WeChat group function
FAQ
Others
Data Structure
System Tools
Guild bind group / Unity3D / Outline

Outline

By calling MSDK's group function, the president player of a faction inside the game can bind the faction to the chat group and unbind the faction-bound chat group; and common players can join various factions' chat groups. This can easily help the game increase the player groups' interaction, thus enhancing the players' activity and viscosity. Currently, chat groups support QQ groups and WeChat groups, and each faction can bind a QQ group and a WeChat group at most

Bind QQ group:

Join QQ group:

Unbind QQ group:

Bind WeChat group:

Join WeChat group:

Access Guide

Preconditions

1) You have completed access configuration by the instructions for accessing the configuration module.

2) You have completed access login by the instructions for accessing the login module.

mobile QQ group functions of new versions V2(1.3.0u and higher versions)

1 Call the interface to create a QQ group (v2)

1)Function description

Create a QQ group,the result of creating a group will be called back to the game via BindGroupEvent.

2)Interface declaration
public void WGCreateQQGroupV2(GameGuild gameGuild);
3)Parameter description

GameGuild: set parameter description

Parameter name Type Description
guildId String (required) guild id;The string needs to use numbers, such as: "123456"
guildName String (required) guild nickname
zoneId String (required) zone id
roleId String (required) role id
partition String (optional) partition id (sub-zone); it is allowed to fill in it; the parameter is useless temporarily
areaId String (required) game zone ID, "1" QQ (by default), "2" WeChat (optional)
4)Return value

None; the result of creating a group will be called back to the game via BindGroupEvent.

5)Demo code:
GameGuild gameGuild = new GameGuild();
gameGuild.guildId = "100703379";
gameGuild.guildName = "msdk";
gameGuild.zoneId = "100";
gameGuild.roleId = "jingjing";
gameGuild.partition = "10";
gameGuild.areaId = "123";
WGPlatform.Instance.WGCreateQQGroupV2(gameGuild);

MsdkEvent.Instance.OnCreateGroupV2Event += (GroupRet ret) => {
            Debug.Log(ret.ToString());
            message = ret.ToString();
            if (ret.flag == eFlag.eFlag_Succ) {
                // Succeed in binding the QQ group
            } else {
                // Failure in binding the QQ group
            }
};
6)Special description

None

7)Name interpretation

None

2 Call the interface to query the relations with QQ group (v2)

1)Function description

Get the relationship between the player and the group,the query result will be called back to the game via QueryGroupEvent.

2)Interface declaration
public void WGQueryQQGroupInfoV2(String groupId);
3)Parameter description
Parameter name Type Description
groupId String Group id returned when creating a group(Group id is the group account number)
4)Return value

None; the query result will be called back to the game via QueryGroupEvent.

5)Demo code:
WGPlatform.Instance.WGQueryQQGroupInfoV2("11002222");

MsdkEvent.Instance.QueryGroupInfoV2Event += (GroupRet ret) =>
{
    Debug.Log(ret.ToString());
    message = ret.ToString();
    ///ret.mQQGroupInfo.relation Indicates the relationship between qq group users and qq group, 1: group leader, 2: administrator, 3: ordinary member, 4: non-member
    if (ret.flag == eFlag.eFlag_Succ)
    {
        // Query group information successfully
    }
    else
    {
        // Failure in searching the group information
    }
};
6)Special description

None

7)Name interpretation

None

3 Call the interface used to join a QQ group(v2)

1)Function description

Join QQ group, the result of joining a group will be called back to the game via JoinQQGroupEvent.

2)Interface declaration

When calling a function, pay attention to the order in which parameters are passed

public void WGJoinQQGroupV2(string guildId, string zoneId,string groupId, string roleId, string partition);
3)Parameter description
Parameter name Type Description
gameGuild GameGuild (required) guild information
groupId String (required) group id(Group id is the group account number)

GameGuild: set parameter description

Parameter name Type Description
guildId String (required) guild id;The string needs to use numbers, such as: "123456"
zoneId String (required) zone id
roleId String (required) role id
partition String (optional) partition id (sub-zone); it is allowed to fill in it; the parameter is useless temporarily
areaId String (required) game zone ID, "1" QQ (by default), "2" WeChat (optional)
4)Return value

None; the result of joining a group will be called back to the game via JoinQQGroupEvent.

5)Demo code:
groupId = "12345678";
GameGuild gameGuild = new GameGuild();
gameGuild.guildId = "100703379";
gameGuild.zoneId = "100";
gameGuild.roleId = "jingjing";
gameGuild.partition = "10";
gameGuild.areaId = "123";
WGPlatform.Instance.WGJoinQQGroupV2(gameGuild,groupId);

MsdkEvent.Instance.OnJoinGroupV2Event += (GroupRet ret) =>
{
    Debug.Log(ret.ToString());
    message = ret.ToString();
    if (ret.flag == eFlag.eFlag_Succ)
    {
        // Query group information successfully
    }
    else
    {
        // Failure in searching the group information
    }
};
6)Special description

None

7)Name interpretation

None

4 Call the interface used to unbind QQ group(v2)

1)Function description

Unbind QQ group,the unbinding result will be called back to the game via UnbindGroupEvent.

2)Interface declaration
public void WGUnbindQQGroupV2(GameGuild gameGuild);
3)Parameter description

GameGuild: set parameter description

Parameter name Type Description
guildId String (required) guild id;The string needs to use numbers, such as: "123456"
guildName String (required) guild name
zoneId String (required) zone id
areaId String (required) game zone ID, "1" QQ (by default), "2" WeChat (optional)
4)Return value

None; the unbinding result will be called back to the game via UnbindGroupEvent.

5)Demo code:
GameGuild gameGuild = new GameGuild();
gameGuild.guildId = "110022";
gameGuild.guildName = "msdk天团";
gameGuild.zoneid = "1122";
gameGuild.areaId = "123";
WGPlatform.Instance.WGUnbindQQGroupV2(gameGuild);

MsdkEvent.Instance.UnbindGroupV2Event += (GroupRet ret) => {
    Debug.Log(ret.ToString());
    message = ret.ToString();
    if (ret.flag == eFlag.eFlag_Succ) {
        // Succeed in unbinding QQ group
    } else {
        // Failure in unbinding QQ group
    }
};
6)Special description

None

7)Name interpretation

None

5 Call the interface of binding the existing mobile QQ group (v2)

1) Function description

Bind the existing mobile QQ group,the unbinding result will be called back to the game via BindExistGroupV2Event.

2) Interface declaration
public void WGBindExistQQGroupV2(GameGuild gameGuild,String groupId,String groupName);
3) Parameter description
Parameter name Type Description
gameGuild GameGuild (required) guild information
groupId String (required) group id(Group id is the group account number)
groupName String (required) group nickname

GameGuild: set parameter description

Parameter name Type Description
guildId String (required) guild id;The string needs to use numbers, such as: "123456"
roleId String (required) role id
zoneId String (required) zone id
areaId String (required) game zone ID, "1" QQ (by default), "2" WeChat (optional)
4) Return value

None,the unbinding result will be called back to the game via BindExistGroupV2Event.

5) Demo code:
GameGuild gameGuild = new GameGuild();
gameGuild.guildId = "100703379";
gameGuild.roleId = "10"
gameGuild.zoneId = "100";
gameGuild.areaId = "123";
WGPlatform.Instance.WGBindExistQQGroupV2(gameguild, groupId, groupName);

MsdkEvent.Instance.BindExistGroupV2Event += (GroupRet ret) =>
        {
            Debug.Log(ret.ToString());
            message = ret.ToString();
            if (ret.flag == eFlag.eFlag_Succ)
            {
                // Bind the created QQ group interface successfully
            }
            else
            {
                // Bind the created QQ group interface failed
            }
        };
6) Special description

None

7) Term interpretation

None

6 Call the interface of getting the group information of the bound mobile QQ group (v2)

1) Function description

Get the group information of the bound mobile QQ group,the unbinding result will be called back to the game via GetGroupCodeV2Event.

2) Interface declaration
public void WGGetQQGroupCodeV2(GameGuild gameGuild);
3) Parameter description

GameGuild: set parameter description

Parameter name Type Description
guildId String (required) guild id;The string needs to use numbers, such as: "123456"
zoneId String (required) zone id
4) Return value

None,the unbinding result will be called back to the game via GetGroupCodeV2Event.

5) Demo code:
GameGuild gameGuild = new GameGuild();
gameGuild.guildId = "100703379";
gameGuild.zoneId = "100";
WGPlatform.Instance.WGGetQQGroupCodeV2(gameGuild);

MsdkEvent.Instance.GetGroupCodeV2Event += (GroupRet ret) =>
        {
            Debug.Log(ret.ToString());
            message = ret.ToString();
            if (ret.flag == eFlag.eFlag_Succ)
            {
                // Query union binding group information successfully
            }
            else
            {
                // Query union binding group information failed
            }
        };
6) Special description

None

7) Term interpretation

None

7 Call the interface of querying guilds bound by a group (v2)

1) Function description

Query guilds bound by the specified group,the unbinding result will be called back to the game via QueryBindGuildV2Event.

2) Interface declaration
public void WGQueryBindGuildV2(String groupId, int type);
3) Parameter description
Parameter name Type Description
groupId String (required) group id(Group id is the group account number)
type int (required) Group type, defaulted to 0 (union type); when multiple types of union groups need to be created in the game, contact the QQ side to arrange schedule and to provide specific values.
4) Return value

None,the unbinding result will be called back to the game via QueryBindGuildV2Event.

5) Demo code:
WGPlatform.Instance.WGQueryBindGuildV2("111002",0)

MsdkEvent.Instance.QueryBindGuildV2Event += (GroupRet ret) =>
        {
            Debug.Log(ret.ToString());
            message = ret.ToString();
            if (ret.flag == eFlag.eFlag_Succ)
            {
                // Query group bind trade union information successfully
            }
            else
            {
                // Query group binding union information failed
            }
        };
6) Special description

None

7) Term interpretation

None

8 Call the interface of querying the list of created QQ groups (v2)

1) Function description

Query the list of created QQ groups,the unbinding result will be called back to the game via GetGroupListV2Event.

2) Interface declaration
public void WGGetQQGroupListV2();
3) Parameter description

None

4) Return value

None,the unbinding result will be called back to the game via GetGroupListV2Event.

5) Demo code:
WGPlatform.Instance.WGGetQQGroupListV2();

MsdkEvent.Instance.GetGroupListV2Event += (GroupRet ret) =>
        {
            Debug.Log(ret.ToString());
            message = ret.ToString();
            if (ret.flag == eFlag.eFlag_Succ)
            {
                // Pull the QQ group list I created successfully
            }
            else
            {
                // Pulling the QQ group list I created failed
            }
        };
6) Special description

None

7) Term interpretation

None

9 Call the interface of reminding the guild leader of binding a group (v2)

1) Function description

Remind the guild leader of binding a group,the unbinding result will be called back to the game via RemindGuildLeaderV2Event.

2) Interface declaration

Pay attention to the order of parameters passed when the function is called

public void WGRemindGuildLeaderV2(GameGuild gameGuild);
3) Parameter description

GameGuild: set parameter description

Parameter name Type Description
guildId String (required) guild id;The string needs to use numbers, such as: "123456"
zoneId String (required) zone id
roleId String (required) role id
roleName String (required) role name
leaderOpenid String (required) the guild leader's openid
leaderRoleId String (required) the guild leader's roleid
leaderZoneId String (optional) the guild leader’s zone information; the guild leader can transfer the ID to a person who doesn’t belong to the zone
userZoneId String (optional) the user’s zone ID; can transfer the ID to a person who doesn’t belong to the zone, the guild’s zone is not necessarily the user’s zone
type String (required) Group type, defaulted to 0 (union type); when multiple types of union groups need to be created in the game, contact the QQ side to arrange schedule and to provide specific values.
areaId String (required) game zone ID, "1" QQ (by default), "2" WeChat (optional)
4) Return value

None,the unbinding result will be called back to the game via RemindGuildLeaderV2Event.

5) Demo code:
GameGuild gameGuild;
gameGuild.guildId = "100703379";
gameGuild.roleId = "12";
gameGuild.roleName = "jingjing"
gameGuild.zoneId = "100";
gameGuild.leaderOpenid = "78AADD8DC9CF80E655EE68039B1D02C9";
gameGuild.leaderZoneId= "1234";
WGPlatform.Instance.WGRemindGuildLeaderV2 (gameguild);

MsdkEvent.Instance.RemindGuildLeaderV2Event += (GroupRet ret) =>
        {
            Debug.Log(ret.ToString());
            message = ret.ToString();
            if (ret.flag == eFlag.eFlag_Succ)
            {
                // Remind chairman tie group success
            }
            else
            {
                // Remind chairman tie group failure
            }
        };
6) Special description

None

7) Term interpretation

None

WeChat group function

1 Summary

You should first register WeChat group function callback, and then call WeChat group function interface according to the recommended workflow. After these steps, you can access WeChat group function The interface calling workflow is shown in the following diagram:

group_wx

2 Register the group information query callback

Refer to Register the group information query callback Mobile QQ and WeChat group functions share this callback

3 Register WeChat group creation callback

1)Function description

Call the WeChat group creation result back to the game.

2)Interface declaration
public delegate void CreateWXGroupDelegate(GroupRet groupRet);
3)Parameter description
Parameter name Type Description
groupRet GroupRet class Group function callback information
4)Return value

None

5)Demo code
MsdkEvent.Instance.CreateWXGroupEvent += (GroupRet groupRet) => {
    if (groupRet.flag == eFlag.eFlag_Succ) {
        // Succeed in creating WeChat group
    } else {
        // Failure in creating WeChat group
        string msg = handlerWXErrorCode(groupRet);
    }
}
string handlerWXErrorCode(GroupRet groupRet){
    string msg = "";
    if (groupRet.platform == 1)
    {
        int code = groupRet.errorCode;
        if (code == eFlag.eFlag_WX_UserCancel)
        {
            msg = "The user cancels";
        }
        else if (code == eFlag.eFlag_WX_Group_IDHadCreatedToday)
        {
            msg = "A group has been created today; each ID can only create a group chat a day";
        }
        else if (code == eFlag.eFlag_WX_Group_JoinAmountBeyond)
        {
            msg = "The number of groups joined with the ID exceeds the upper limit; an ID can join not more than 2 groups a day";
        }
        else if (code == eFlag.eFlag_WX_Group_HasNoAuthority)
        {
            msg = "The game doesn't have the permission to create a group";
        }
        else if (code == eFlag.eFlag_WX_Group_AmountBeyond)
        {
            msg = "The number of created or unbound groups exceeds the upper limit; one user can create or unbind not more than 5 groups";
        }
        else if (code == eFlag.eFlag_WX_Group_HadExist)
        {
            msg = "WeChat group has already existed";
        }
        else if (code == eFlag.eFlag_WX_Group_IDNotExist)
        {
            msg = "Group ID doesn't exist";
        }
        else if (code == eFlag.eFlag_WX_Group_ParameterError)
        {
            msg = "Parameter inspection error";
        }
        else if (code == eFlag.eFlag_Error)
        {
            msg = "Unknown error. Please refer to WeChat's error codes";
        }
    }
    return msg;
}
6)Special description

None

7)Term interpretation

GroupRet definition description

4 Register WeChat group joining callback

1)Function description

Send the WeChat group joining result callback to the game.

2)Interface declaration
public delegate void JoinWXGroupDelegate(GroupRet ret);
3)Parameter description
Parameter name Type Description
groupRet GroupRet class Group function callback information
4)Return value

None

5)Demo code
MsdkEvent.Instance.JoinWXGroupEvent += (GroupRet groupRet) => {
    if (groupRet.flag == eFlag.eFlag_Succ) {
        // Succeed in joining WeChat group
    } else {
        // Failure in joining WeChat group
        string msg = handlerWXErrorCode(groupRet);
        }
    }
}
6)Special description

None

7)Term interpretation

None

5 Register and query Wechat group status callback

1)Function description

Call WeChat group status back to the game.

2)Interface declaration
public delegate void QueryWXGroupStatusDelegate(GroupRet ret);
3)Parameter description
Parameter name Type Description
groupRet GroupRet class Group function callback information
4)Return value

None

5)Demo code
MsdkEvent.Instance.QueryWXGroupStatusEvent += (GroupRet ret) =>
{
    Debug.Log(ret.ToString());
    message = ret.ToString();
    if (ret.flag == eFlag.eFlag_Succ)
    {
        // Query group information successfully

    }
    else
    {
        // Query group information unsuccessfully
        string msg = handlerWXErrorCode(ret);
    }

};
6)Special description

None

7)Term interpretation

None

5 Call the interface used to query WeChat group information

1)Function description

In the game, query the guild's WeChat group information. The query result is used to check whether the guild's WeChat group has been created and whether the corresponding users have joined the group.

2)Interface declaration
void WGQueryWXGroupInfo(string unionid, string openIdList);
3)Parameter description
Parameter name Type Description
unionid String guild id
openIdList String check if it is the list of in-group users' openid, which should be separated with comma
4)Return value

None, the call result will be called back to the game through QueryGroupEvent

5)Demo code
WGPlatform.Instance.WGQueryWXGroupInfo ("union1", "openid"););
6)Special description

None

7)Term interpretation

None

6 Call the interface used to create the guild's WeChat group

1)Function description

In the game, create the guild's WeChat group.

2)Interface declaration
void WGCreateWXGroup(string unionid, string chatRoomName, string chatRoomNickName);
3)Parameter description
Parameter name Type Description
unionid String guild id
chatRoomName String chat group name
chatRoomNickName String the user's self-defined nickname in the chat group
4)Return value

None, the call result will be called back to the game through CreateWXGroupEvent

5)Demo code
WGPlatform.Instance.WGCreateWXGroup("union1", "MSDK-Unity-Society", "A user's group nickname");
6)Special description

None

7)Term interpretation

None

7 Call the interface used to join the guild's WeChat group

1)Function description

In the game, join the guild's WeChat group.

2)Interface declaration
void WGJoinWXGroup(string unionid, string chatRoomNickName);
3)Parameter description
Parameter name Type Description
unionid String guild id
chatRoomNickName String the user's self-defined nickname in the chat group
4)Return value

None, the call result will be called back to the game through JoinWXGroupEvent

5)Demo code
WGPlatform.Instance.WGJoinWXGroup ("union1", "A user's group nickname");    
6)Special description

None

7)Term interpretation

None

8 Guild Wechat group status query interface

1)Function description

In the game, query whether the specified guild id has created or joined any group.

2)Interface declaration
void WGQueryWXGroupStatus(string unionid, eStatusType opType);
3)Parameter description
Parameter name Type Description
unionid String guild id
opType eStatusType Enumeration type:ISCREATED(whether or not create a group),ISJONINED(whether or not join a group)
4)Return value

None, the call result will be called back to the game through QueryWXGroupStatusEvent

5)Demo code
WGPlatform.Instance.WGQueryWXGroupStatus("union1", eStatusType.ISCREATED);    
6)Special description

None

7)Term interpretation

None

FAQ

  • If a QQ group is disbanded, there are two ways to cancel its binding relations:
  • The president calls the unbinding interface to unbind the group's relations;
  • When a guild member calls the group-joining interface, the group ID can't be queried at this time and unbinding is performed by default.
    When a QQ group is disbanded without performing any of the above operations, the binding relationship does not disappear automatically.
  • After chairman does the transfer, the new chairman may perform unbinding operation.