API
CBSClanModule.GetClanFullInformation - Get full information about the clan.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private IProfile ProfileModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
string clanID = "some clan id";
ClanModule.GetClanFullInformation(clanID, OnGet);
}
private void OnGet(CBSGetClanFullInfoResult result)
{
if (result.IsSuccess)
{
var info = result.Info;
var clanID = info.ClanID;
var groupID = info.ClanGroupID;
var displayName = info.DisplayName;
var description = info.Description;
var membersCount = info.MembersCount;
var level = info.LevelInfo;
var avatar = info.AvatarInfo;
var visibility = info.Visibility;
var roleList = info.RolesList;
var customData = info.CustomData;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.CreateClan - Creation of a new clan.
using CBS;
using CBS.Models;
using System.Collections.Generic;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var createRequest = new CBSCreateClanRequest
{
DisplayName = "My Clan",
Description = "Clan Description",
CustomData = new Dictionary<string, string>
{
{ "datakey1", "some data 1" },
{ "datakey2", "some data 2" },
{ "datakey3", "some data 3" }
},
Visibility = ClanVisibility.OPEN,
AvatarInfo = new ClanAvatarInfo
{
SimpleIconID = "icon 1"
}
};
ClanModule.CreateClan(createRequest, OnCreate);
}
private void OnCreate(CBSCreateClanResult result)
{
if (result.IsSuccess)
{
var clanID = result.ClanID;
var groupID = result.GroupID;
var clanEntity = result.ClanEntity;
var displayName = clanEntity.DisplayName;
var description = clanEntity.Description;
var membersCount = clanEntity.MembersCount;
var level = clanEntity.LevelInfo;
var avatar = clanEntity.Avatar;
var visibility = clanEntity.Visibility;
var stitistics = clanEntity.Statistics;
var csutomData = clanEntity.ClanData;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.SearchClanByName - Find a clan by name. Full name is required.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanName = "Some clan name";
ClanModule.SearchClanByName(clanName, OnSearch);
}
private void OnSearch(CBSGetClanEntityResult result)
{
if (result.IsSuccess)
{
var clanEntity = result.ClanEntity;
var clanID = clanEntity.ClanID;
var displayName = clanEntity.DisplayName;
var description = clanEntity.Description;
var membersCount = clanEntity.MembersCount;
var level = clanEntity.LevelInfo;
var avatar = clanEntity.Avatar;
var visibility = clanEntity.Visibility;
var stitistics = clanEntity.Statistics;
var csutomData = clanEntity.ClanData;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.GetClanEntity - Get shot information about clan using constraints.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID= "Clan ID";
var constraints = new CBSClanConstraints
{
LoadAvatar = true,
LoadClanData = true,
LoadDescription = true,
LoadLevel = true,
LoadMembersCount = true,
LoadStatistics = true,
LoadVisibility = true,
};
ClanModule.GetClanEntity(clanID, constraints, OnGet);
}
private void OnGet(CBSGetClanEntityResult result)
{
if (result.IsSuccess)
{
var clanEntity = result.ClanEntity;
var clanID = clanEntity.ClanID;
var displayName = clanEntity.DisplayName;
var description = clanEntity.Description;
var membersCount = clanEntity.MembersCount;
var level = clanEntity.LevelInfo;
var avatar = clanEntity.Avatar;
var visibility = clanEntity.Visibility;
var stitistics = clanEntity.Statistics;
var csutomData = clanEntity.ClanData;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.InviteToClan - Send an invitation to a profile to join a clan.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var profileIDToInvite = "some profile id";
ClanModule.InviteToClan(profileIDToInvite, OnInvite);
}
private void OnInvite(CBSInviteToClanResult result)
{
if (result.IsSuccess)
{
var profileID = result.ProfileID;
var roleID = result.RoleId;
var expires = result.Expires;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.GetProfileInvitations - Get a list of all invitations of the current profile to join the clan.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var constraints = new CBSClanConstraints
{
LoadAvatar = true,
LoadClanData = true,
LoadDescription = true,
LoadLevel = true,
LoadMembersCount = true,
LoadStatistics = true,
LoadVisibility = true,
};
ClanModule.GetProfileInvitations(constraints, OnGet);
}
private void OnGet(CBSGetProfileInvationsResult result)
{
if (result.IsSuccess)
{
var invites = result.Invites;
foreach (var invite in invites)
{
var clanID = invite.ClanID;
var expires = invite.Expires;
var clanEntity = invite.ClanEntity;
var displayName = clanEntity.DisplayName;
var description = clanEntity.Description;
var membersCount = clanEntity.MembersCount;
var level = clanEntity.LevelInfo;
var avatar = clanEntity.Avatar;
var visibility = clanEntity.Visibility;
var stitistics = clanEntity.Statistics;
var csutomData = clanEntity.ClanData;
}
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.DeclineInvite - Decline clan invitation to join.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clan id";
ClanModule.DeclineInvite(clanID, OnDecline);
}
private void OnDecline(CBSDeclineInviteResult result)
{
if (result.IsSuccess)
{
var clanID = result.ClanID;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.JoinToClan - Force join to clan if clan visibility is open
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clan id";
ClanModule.JoinToClan(clanID, OnJoin);
}
private void OnJoin(CBSJoinToClanResult result)
{
if (result.IsSuccess)
{
var clanID = result.ClanID;
var clanEntity = result.ClanEntity;
var displayName = clanEntity.DisplayName;
var description = clanEntity.Description;
var membersCount = clanEntity.MembersCount;
var level = clanEntity.LevelInfo;
var avatar = clanEntity.Avatar;
var visibility = clanEntity.Visibility;
var stitistics = clanEntity.Statistics;
var csutomData = clanEntity.ClanData;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.SendJoinRequest - Send an application to join the clan.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clan id";
ClanModule.SendJoinRequest(clanID, OnSent);
}
private void OnSent(CBSBaseResult result)
{
if (result.IsSuccess)
{
Debug.Log("Success!");
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.GetClanJoinRequestsList - Get a list of all profiles who want to join the clan.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var constraints = new CBSProfileConstraints
{
LoadAvatar = true,
LoadClan = true,
LoadLevel = true,
LoadOnlineStatus = true,
LoadProfileData = true,
LoadStatistics = true
};
ClanModule.GetClanJoinRequestsList(constraints, OnGet);
}
private void OnGet(CBSGetClanJoinRequestListResult result)
{
if (result.IsSuccess)
{
var requests = result.RequestList;
foreach (var profileRequest in requests)
{
var profileID = profileRequest.ProfileID;
var expires = profileRequest.Expires;
var profileEntity = profileRequest.ProfileEntity;
var clanID = profileEntity.ClanID;
var displayName = profileEntity.DisplayName;
var levelInfo = profileEntity.Level;
var onlineStatus = profileEntity.OnlineStatus;
var clanEntity = profileEntity.ClanEntity;
var statistics = profileEntity.Statistics;
var profileData = profileEntity.ProfileData;
}
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.AcceptProfileJoinRequest - Accept the profile request to join the clan.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var profileID = "profile ID";
ClanModule.AcceptProfileJoinRequest(profileID, OnAccept);
}
private void OnAccept(CBSAcceptDeclineClanRequestResult result)
{
if (result.IsSuccess)
{
var profileEntity = result.ProfileEntity;
var profileID = profileEntity.ProfileID;
var clanID = profileEntity.ClanID;
var displayName = profileEntity.DisplayName;
var levelInfo = profileEntity.Level;
var onlineStatus = profileEntity.OnlineStatus;
var clanEntity = profileEntity.ClanEntity;
var statistics = profileEntity.Statistics;
var profileData = profileEntity.ProfileData;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.DeclineProfileJoinRequest - Decline the profile request to join the clan
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var profileID = "profile ID";
ClanModule.DeclineProfileJoinRequest(profileID, OnDecline);
}
private void OnDecline(CBSAcceptDeclineClanRequestResult result)
{
if (result.IsSuccess)
{
var profileEntity = result.ProfileEntity;
var profileID = profileEntity.ProfileID;
var clanID = profileEntity.ClanID;
var displayName = profileEntity.DisplayName;
var levelInfo = profileEntity.Level;
var onlineStatus = profileEntity.OnlineStatus;
var clanEntity = profileEntity.ClanEntity;
var statistics = profileEntity.Statistics;
var profileData = profileEntity.ProfileData;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.LeaveClan - Leave current clan if exist.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
ClanModule.LeaveClan(OnLeave);
}
private void OnLeave(CBSBaseResult result)
{
if (result.IsSuccess)
{
Debug.Log("Success");
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.UpdateClanDescription - Update the description of the clan the user is currently a member of
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var newDescription = "new description";
ClanModule.UpdateClanDescription(newDescription, OnUpdate);
}
private void OnUpdate(CBSBaseResult result)
{
if (result.IsSuccess)
{
Debug.Log("Success");
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.UpdateClanAvatar - Update the avatar info of the clan the user is currently a member of
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var avatarInfo = new ClanAvatarInfo
{
SimpleIconID = "icon id"
};
ClanModule.UpdateClanAvatar(avatarInfo, OnUpdate);
}
private void OnUpdate(CBSBaseResult result)
{
if (result.IsSuccess)
{
Debug.Log("Success");
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.UpdateClanVisibility - Update the join request type of the clan the user is currently a member of
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var visibility = ClanVisibility.BY_REQUEST;
ClanModule.UpdateClanVisibility(visibility, OnUpdate);
}
private void OnUpdate(CBSBaseResult result)
{
if (result.IsSuccess)
{
Debug.Log("Success");
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.UpdateClanDisplayName - Update the display name of the clan the user is currently a member of
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var newName = "clan name";
ClanModule.UpdateClanDisplayName(newName, OnUpdate);
}
private void OnUpdate(CBSBaseResult result)
{
if (result.IsSuccess)
{
Debug.Log("Success");
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.UpdateClanCustomData - Set clan clan custom data by update request.
using CBS;
using CBS.Models;
using System.Collections.Generic;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clanID";
var updateSet = new Dictionary<string, string>();
updateSet["data1"] = "new data 1";
updateSet["data2"] = "new data 2";
updateSet["data3"] = "new data 3";
ClanModule.UpdateClanCustomData(clanID, updateSet, OnUpdate);
}
private void OnUpdate(CBSBaseResult result)
{
if (result.IsSuccess)
{
Debug.Log("Success");
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.GetClanCustomData - Get clan all custom data
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clanID";
ClanModule.GetClanCustomData(clanID, OnGet);
}
private void OnGet(CBSGetClanCustomDataResult result)
{
if (result.IsSuccess)
{
var clanID = result.ClanID;
var dataSet = result.CustomData;
var data1 = dataSet["data1"];
var data2 = dataSet["data2"];
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.GetClanBadge - Get information about requests/invations count for profile
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
ClanModule.GetClanBadge(OnGet);
}
private void OnGet(CBSGetClanBadgeResult result)
{
if (result.IsSuccess)
{
var invationsCount = result.InvationsCount;
var requestsCount = result.RequestsCount;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.GetClanMemberships - Get a list of all clan members.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clanID";
var constraints = new CBSProfileConstraints
{
LoadAvatar = true,
LoadClan = true,
LoadLevel = true,
LoadOnlineStatus = true,
LoadProfileData = true,
LoadStatistics = true
};
ClanModule.GetClanMemberships(clanID, constraints, OnGet);
}
private void OnGet(CBSGetClanMembersResult result)
{
if (result.IsSuccess)
{
var clanID = result.ClanID;
var clanRoles = result.AvailableRoles;
var members = result.Members;
foreach (var member in members)
{
var profileID = member.ProfileID;
var roleID = member.RoleID;
var roleName = member.RoleName;
var profileEntity = member.ProfileEntity;
var displayName = profileEntity.DisplayName;
var levelInfo = profileEntity.Level;
var onlineStatus = profileEntity.OnlineStatus;
var clanEntity = profileEntity.ClanEntity;
var statistics = profileEntity.Statistics;
var profileData = profileEntity.ProfileData;
}
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.KickClanMember - Remove a member from the clan.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var memberID = "Member profile id";
ClanModule.KickClanMember(memberID, OnKick);
}
private void OnKick(CBSBaseResult result)
{
if (result.IsSuccess)
{
Debug.Log("Success!");
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.ChangeMemberRole - Change clan member role is profile has permission for this action
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var memberID = "Member profile id";
var newRoleID = "Role ID";
ClanModule.ChangeMemberRole(memberID, newRoleID, OnChange);
}
private void OnChange(CBSChangeRoleResult result)
{
if (result.IsSuccess)
{
var profileID = result.ProfileID;
var roleInfo = result.NewRole;
var roleID = roleInfo.RoleID;
var roleName = roleInfo.DisplayName;
var permissions = roleInfo.RolePermissions;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.DisbandClan - Disband current clan.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
ClanModule.DisbandClan(OnDisband);
}
private void OnDisband(CBSBaseResult result)
{
if (result.IsSuccess)
{
Debug.Log("Success!");
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.AddExpirienceToClan - Adds N points of experience to the current state. In the response, you can get information whether the clan has reached a new level and also information about the reward about the new level.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clan id";
var expToAdd = 100;
ClanModule.AddExpirienceToClan(clanID, expToAdd, OnAdd);
}
private void OnAdd(CBSLevelDataResult result)
{
if (result.IsSuccess)
{
var levelInfo = result.LevelInfo;
var newLevel = result.IsNewLevel;
var newLevelReward = result.NewLevelReward;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.GetClanLevelDetail - Get information about current experience/level of clan
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clan id";
ClanModule.GetClanLevelDetail(clanID, OnGet);
}
private void OnGet(CBSLevelDataResult result)
{
if (result.IsSuccess)
{
var levelInfo = result.LevelInfo;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.GetClanInventory - Get inventory items list of clan
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clan id";
ClanModule.GetClanInventory(clanID, OnGet);
}
private void OnGet(CBSGetInventoryResult result)
{
if (result.IsSuccess)
{
var clanID = result.TargetID;
var items = result.AllItems;
var lootboxes = result.Lootboxes;
var equippedItems = result.EquippedItems;
var nonEquippedItems = result.NonEquippedItems;
var equippableItems = result.EquippableItems;
var tradableItems = result.TradableItems;
var consumableItems = result.ConsumableItems;
var recipeItems = result.RecipeItems;
var isInTradingItems = result.IsInTradingItems;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.GrantItemToClan - Add item to clan by id. The item automatically goes into inventory.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clan id";
var itemID = "item id to grant";
ClanModule.GrantItemToClan(clanID, itemID, OnGrant);
}
private void OnGrant(CBSGrantItemsResult result)
{
if (result.IsSuccess)
{
var clanID = result.TargetID;
var grantedInstances = result.GrantedInstances;
var grantedCurrencies = result.GrantedCurrencies;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.GrantItemsToClan - Add items to clan by id. The items automatically goes into inventory.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clan id";
var itemsID = new string[]
{
"item1",
"item2",
"item3"
};
ClanModule.GrantItemsToClan(clanID, itemsID, OnGrant);
}
private void OnGrant(CBSGrantItemsResult result)
{
if (result.IsSuccess)
{
var clanID = result.TargetID;
var grantedInstances = result.GrantedInstances;
var grantedCurrencies = result.GrantedCurrencies;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.GetClanCurrencies - Get information about clan currencies
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clan id";
ClanModule.GetClanCurrencies(clanID, OnGet);
}
private void OnGet(CBSGetCurrenciesResult result)
{
if (result.IsSuccess)
{
var currencies = result.Currencies;
foreach (var currencyInstance in currencies)
{
var currencyCode = currencyInstance.Value.Code;
var currencyValue = currencyInstance.Value.Value;
var isRecharchable = currencyInstance.Value.Rechargeable;
var maxRecharge = currencyInstance.Value.MaxRecharge;
var secondsToNextRecharge = currencyInstance.Value.SecondsToRecharge;
}
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.AddCurrencyToClan - Add currency value to current clan balance
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clan id";
var currencyCode = "GD";
var currencyValue = 100;
ClanModule.AddCurrencyToClan(clanID, currencyCode, currencyValue, OnAddCurrency);
}
private void OnAddCurrency(CBSUpdateCurrencyResult result)
{
if (result.IsSuccess)
{
var balanceChange = result.BalanceChange;
var updatedCurrency = result.UpdatedCurrency;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.SubtractCurrencyFromClan - Subtract currency value from current clan balance.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var clanID = "clan id";
var currencyCode = "GD";
var currencyValue = 100;
ClanModule.SubtractCurrencyFromClan(clanID, currencyCode, currencyValue, OnSubtract);
}
private void OnSubtract(CBSUpdateCurrencyResult result)
{
if (result.IsSuccess)
{
var balanceChange = result.BalanceChange;
var updatedCurrency = result.UpdatedCurrency;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.TransferItemFromProfileToClan - Move item from profile inventory to clan inventory
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var itemInstanceID = "instance id";
ClanModule.TransferItemFromProfileToClan(itemInstanceID, OnTransfer);
}
private void OnTransfer(CBSClanTransferItemResult result)
{
if (result.IsSuccess)
{
var profileID = result.ProfileID;
var clanID = result.ClanID;
var itemInstanceID = result.ItemInstanceID;
var transferID = result.TransferID;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.TransferItemFromClanToProfile - Move item from clan inventory to profile inventory
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var itemInstanceID = "instance id";
ClanModule.TransferItemFromClanToProfile(itemInstanceID, OnTransfer);
}
private void OnTransfer(CBSClanTransferItemResult result)
{
if (result.IsSuccess)
{
var profileID = result.ProfileID;
var clanID = result.ClanID;
var itemInstanceID = result.ItemInstanceID;
var transferID = result.TransferID;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.GetTasksForClan - Get tasks available for current profile clan
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
ClanModule.GetTasksForClan(OnGet);
}
private void OnGet(CBSGetTasksForClanResult result)
{
if (result.IsSuccess)
{
var tasks = result.Tasks;
var resetDate = result.ResetDate;
foreach (var task in tasks)
{
var id = task.ID;
var title = task.Title;
var description = task.Description;
var poolID = task.PoolID;
var type = task.Type;
var steps = task.Steps;
var isLockedByLevel = task.IsLockedByLevel;
var lockLevel = task.LockLevel;
var levelFilter = task.LevelFilter;
var externalUrl = task.ExternalUrl;
var tierList = task.TierList;
var profileReward = task.ProfileReward;
var clanReward = task.ProfileReward;
var isComplete = task.IsComplete;
var isAvailable = task.IsAvailable;
var rewarded = task.Rewarded;
var tierIndex = task.TierIndex;
var currentStep = task.CurrentStep;
var taskData = task.GetCustomData<CBSTaskCustomData>();
}
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.AddTaskPoint - Adds a point to an task. For Tasks "OneShot" completes it immediately, for Tasks "Steps" - adds one step
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var taskID = "some task id";
ClanModule.AddTaskPoint(taskID, OnAdd);
}
private void OnAdd(CBSModifyClanTaskPointsResult result)
{
if (result.IsSuccess)
{
var task = result.Task;
var isComplete = result.CompleteTask;
var isCompleteTier = result.CompleteTier;
var reward = result.ReceivedReward;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.AddTaskPoints - Adds the points you specified to the task. More suitable for Steps task.
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
var taskID = "some task id";
var pointsToAdd = 10;
ClanModule.AddTaskPoints(taskID, pointsToAdd, OnAdd);
}
private void OnAdd(CBSModifyClanTaskPointsResult result)
{
if (result.IsSuccess)
{
var task = result.Task;
var isComplete = result.CompleteTask;
var isCompleteTier = result.CompleteTier;
var reward = result.ReceivedReward;
}
else
{
Debug.Log(result.Error.Message);
}
}
}
CBSClanModule.ResetTasksForClan - Reset tasks for current profile clan
using CBS;
using CBS.Models;
using UnityEngine;
public class ClanExamples : MonoBehaviour
{
private IClan ClanModule;
private void Start()
{
ClanModule = CBSModule.Get<CBSClanModule>();
ClanModule.ResetTasksForClan(OnReset);
}
private void OnReset(CBSGetTasksForClanResult result)
{
if (result.IsSuccess)
{
var newTasks = result.Tasks;
var resetDate = result.ResetDate;
foreach (var task in newTasks)
{
var id = task.ID;
var title = task.Title;
var description = task.Description;
var poolID = task.PoolID;
var type = task.Type;
var steps = task.Steps;
var isLockedByLevel = task.IsLockedByLevel;
var lockLevel = task.LockLevel;
var levelFilter = task.LevelFilter;
var externalUrl = task.ExternalUrl;
var tierList = task.TierList;
var profileReward = task.ProfileReward;
var clanReward = task.ProfileReward;
var isComplete = task.IsComplete;
var isAvailable = task.IsAvailable;
var rewarded = task.Rewarded;
var tierIndex = task.TierIndex;
var currentStep = task.CurrentStep;
var taskData = task.GetCustomData<CBSTaskCustomData>();
}
}
else
{
Debug.Log(result.Error.Message);
}
}
}
Last updated