UWP SDK社区

简介

本文介绍了如何对接Miracle Games SDK的社区接口

该接口由MiracleGames统一管理,若需要开启社区功能,需要提前联系MG工作人员协助开通

社区功能接入

社区功能的前提是账户必须登陆成功,所以通常是在登陆成功的逻辑中,加入社交功能调用代码。

C#CPP


public MainPage()
{
	this.InitializeComponent();
	try
	{
		Loaded += (sender, args) =>
		{
		 
			
			 var auth = await MiracleGames.AuthenticationManager.AuthenticateAsync();//开启登录
			 if (auth.ReturnValue)//登录成功.
			 {
				 //var uid =  MiracleGames.AuthenticationManager.UserInfo.Id;
				 //var token =  MiracleGames.AuthenticationManager.UserInfo.Token;
				 
				 //Show user center bubble.
				 MiracleGames.BubbleManager.ShowBubble();//开启社区功能
			 }
		};
	}
	catch (Exception){}//添加异常处理机制,预防游戏崩溃.
}


try
{
	concurrency::create_task(MiracleGames::AuthenticationManager::AuthenticateAsync()).then([this](MiracleGames::Services::Core::Common::AsyncProcessResult^ auth)//开启登录
	{
	if (!auth->ReturnValue)//登录成功
		return;
	//auto uid =  MiracleGames::AuthenticationManager::UserInfo.Id;
	//auto token =  MiracleGames::AuthenticationManager::UserInfo.Token;

	//Show user center bubble.
	MiracleGames::BubbleManager::ShowBubble();//开启社区功能
	});
}
catch (...){}//添加异常处理机制,预防游戏崩溃.

社区和积分墙事件回调

社区和积分墙的事件回调功能,可直接在程序中注册委托事件来实现。

C#CPP

try
{
	MiracleGames.BubbleManager.BubbleIntegralWallRewardsChanged += BubbleManager_BubbleIntegralWallRewardsChanged;//积分墙程序安装奖励回调
	private void BubbleManager_BubbleIntegralWallRewardsChanged(object sender, string e)
	{
		throw new NotImplementedException();
	}

	MiracleGames.BubbleManager.BubbleIntegralWallFirePwChangeEvents += BubbleManager_BubbleIntegralWallFirePwChangeEvents;//积分墙任务完成奖励回调
	private void BubbleManager_BubbleIntegralWallFirePwChangeEvents(object sender, string e)
	{
		throw new NotImplementedException();
	}

	MiracleGames.BubbleManager.BubbleOpenCloseEvent += BubbleManager_BubbleOpenCloseEvent;//气泡开启关闭回调
	private void BubbleManager_BubbleOpenCloseEvent(object sender, bool e)
	{
		ShowFullScreenInterstitialAd();
		throw new NotImplementedException();
	}
}
catch (Exception){}//添加异常处理机制,预防游戏崩溃.


try
{
	MiracleGames::BubbleManager::BubbleIntegralWallRewardsChanged += ref new Windows::Foundation::EventHandler(this, &App::OnBubbleIntegralWallRewardsChanged);
	void Snow_Patrol::App::OnBubbleIntegralWallRewardsChanged(Platform::Object ^ sender, Platform::String ^ args)//积分墙程序安装奖励回调
	{
		throw ref new Platform::NotImplementedException();
	}

	MiracleGames::BubbleManager::BubbleIntegralWallFirePwChangeEvents += ref new Windows::Foundation::EventHandler(this, &App::BubbleIntegralWallFirePwChangeEvents);
	void Snow_Patrol::App::BubbleIntegralWallFirePwChangeEvents(Platform::Object ^ sender, Platform::String ^ args)//积分墙任务完成奖励回调
	{
		throw ref new Platform::NotImplementedException();
	}

	MiracleGames::BubbleManager::BubbleOpenCloseEvent += ref new Windows::Foundation::EventHandler(this, &Snow_Patrol::App::BubbleOpenCloseEvent);
	void Snow_Patrol::App::BubbleOpenCloseEvent(Platform::Object ^ sender, bool args)//气泡开启关闭回调
	{
		throw ref new Platform::NotImplementedException();
	}
}
catch (...){}//添加异常处理机制,预防游戏崩溃.

MiracleGames开发者后台控制社区功能模块

应用管理中,下列勾选哪个功能模块,即开启对应功能【参考