forked from facebook/facebook-sdk-for-unity
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
373 changed files
with
2,485 additions
and
2,566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
* | ||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
* copy, modify, and distribute this software in source code or binary form for use | ||
* in connection with the web services and APIs provided by Facebook. | ||
* | ||
* As with any software that integrates with the Facebook platform, your use of | ||
* this software is subject to the Facebook Developer Principles and Policies | ||
* [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
* included in all copies or substantial portions of the software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
namespace Facebook.Unity.Arcade | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using FacebookGames; | ||
using FacebookPlatformServiceClient; | ||
|
||
internal class ArcadeWrapper : IArcadeWrapper | ||
{ | ||
private const string PipeErrorMessage = @"Pipe name not passed to application on start. | ||
Make sure you are running inside the facebook games client."; | ||
|
||
private FacebookNamedPipeClient clientPipe; | ||
private ArcadeFacebookGameObject facebookGameObject; | ||
|
||
public ArcadeWrapper() | ||
{ | ||
string pipeName; | ||
Utilities.CommandLineArguments.TryGetValue("/pn", out pipeName); | ||
if (pipeName == null) | ||
{ | ||
throw new InvalidOperationException(ArcadeWrapper.PipeErrorMessage); | ||
} | ||
|
||
this.clientPipe = new FacebookNamedPipeClient(pipeName); | ||
this.facebookGameObject = ComponentFactory.GetComponent<ArcadeFacebookGameObject>(); | ||
} | ||
|
||
public IDictionary<string, object> PipeResponse | ||
{ | ||
get | ||
{ | ||
PipePacketResponse response = this.clientPipe.PipeResponse; | ||
if (response == null) | ||
{ | ||
return null; | ||
} | ||
|
||
return response.ToDictionary(); | ||
} | ||
|
||
set | ||
{ | ||
if (value == null) | ||
{ | ||
this.clientPipe.PipeResponse = null; | ||
return; | ||
} | ||
|
||
throw new NotSupportedException("Can only set pipe response to null"); | ||
} | ||
} | ||
|
||
public void DoLoginRequest( | ||
string appID, | ||
string permissions, | ||
string callbackId, | ||
ArcadeFacebook.OnComplete completeDelegate) | ||
{ | ||
var request = new LoginRequest( | ||
appID, | ||
permissions); | ||
this.HandleRequest<LoginRequest, LoginResponse>( | ||
request, | ||
callbackId, | ||
completeDelegate); | ||
} | ||
|
||
public void DoPayRequest( | ||
string appId, | ||
string method, | ||
string action, | ||
string product, | ||
string productId, | ||
string quantity, | ||
string quantityMin, | ||
string quantityMax, | ||
string requestId, | ||
string pricepointId, | ||
string testCurrency, | ||
string callbackId, | ||
ArcadeFacebook.OnComplete completeDelegate) | ||
{ | ||
var request = new PayRequest( | ||
appId, | ||
method, | ||
action, | ||
product, | ||
productId, | ||
quantity, | ||
quantityMin, | ||
quantityMax, | ||
requestId, | ||
pricepointId, | ||
testCurrency); | ||
this.HandleRequest<PayRequest, PayResponse>( | ||
request, | ||
callbackId, | ||
completeDelegate); | ||
} | ||
|
||
public void DoFeedShareRequest( | ||
string appId, | ||
string toId, | ||
string link, | ||
string linkName, | ||
string linkCaption, | ||
string linkDescription, | ||
string pictureLink, | ||
string mediaSource, | ||
string callbackId, | ||
ArcadeFacebook.OnComplete completeDelegate) | ||
{ | ||
var request = new FeedShareRequest( | ||
appId, | ||
toId, | ||
link, | ||
linkName, | ||
linkCaption, | ||
linkDescription, | ||
pictureLink, | ||
mediaSource); | ||
this.HandleRequest<FeedShareRequest, FeedShareResponse>( | ||
request, | ||
callbackId, | ||
completeDelegate); | ||
} | ||
|
||
public void DoAppRequestRequest( | ||
string appId, | ||
string message, | ||
string actionType, | ||
string objectId, | ||
string to, | ||
string filters, | ||
string excludeIDs, | ||
string maxRecipients, | ||
string data, | ||
string title, | ||
string callbackId, | ||
ArcadeFacebook.OnComplete completeDelegate) | ||
{ | ||
var request = new AppRequestRequest( | ||
appId, | ||
message, | ||
actionType, | ||
objectId, | ||
to, | ||
filters, | ||
excludeIDs, | ||
maxRecipients, | ||
data, | ||
title); | ||
this.HandleRequest<AppRequestRequest, AppRequestResponse>( | ||
request, | ||
callbackId, | ||
completeDelegate); | ||
} | ||
|
||
public void SendRequest<T>(T request) | ||
where T : PipePacketResponse | ||
{ | ||
this.clientPipe.SendRequest<T>(request); | ||
return; | ||
} | ||
|
||
private void HandleRequest<T, R>( | ||
T request, | ||
string callbackId, | ||
ArcadeFacebook.OnComplete completeDelegate) | ||
where T : PipePacketRequest | ||
where R : PipePacketResponse | ||
{ | ||
this.clientPipe.SendRequest<R>(request); | ||
this.facebookGameObject.WaitForResponse( | ||
completeDelegate, | ||
callbackId); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{D8F7CF97-7FE9-48B7-A30C-CB14BAA73010}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>Facebook.Unity.Arcade</RootNamespace> | ||
<AssemblyName>Facebook.Unity.Arcade</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<ReleaseVersion> | ||
</ReleaseVersion> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug</OutputPath> | ||
<DefineConstants>DEBUG;</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>none</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>\Applications\Unity\Unity.app\Contents\Frameworks\Managed\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="FacebookNamedPipeClient"> | ||
<HintPath>Plugins\FacebookNamedPipeClient.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="ArcadeWrapper.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
<ItemGroup> | ||
<Folder Include="Properties\" /> | ||
<Folder Include="Plugins\" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Plugins\FacebookNamedPipeClient.dll" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Facebook.Unity\Facebook.Unity.csproj"> | ||
<Project>{3DFF6C0C-BB04-405D-A23F-95999630E7F8}</Project> | ||
<Name>Facebook.Unity</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
</Project> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{4F631992-8D32-4AB5-8073-4BDC8A79380B}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>Facebook.Unity.Editor</RootNamespace> | ||
<AssemblyName>Facebook.Unity.Editor</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<ReleaseVersion> | ||
</ReleaseVersion> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug</OutputPath> | ||
<DefineConstants>DEBUG;</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>full</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="UnityEditor"> | ||
<HintPath>\Applications\Unity\Unity.app\Contents\Frameworks\Managed\UnityEditor.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>\Applications\Unity\Unity.app\Contents\Frameworks\Managed\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="FacebookBuild.cs" /> | ||
<Compile Include="FacebookConsoleEndpoint.cs" /> | ||
<Compile Include="FacebookPostprocess.cs" /> | ||
<Compile Include="FacebookSettingsEditor.cs" /> | ||
<Compile Include="Utility.cs" /> | ||
<Compile Include="android\FacebookAndroidUtil.cs" /> | ||
<Compile Include="android\ManifestMod.cs" /> | ||
<Compile Include="iOS\FixupFiles.cs" /> | ||
<Compile Include="iOS\PListDict.cs" /> | ||
<Compile Include="iOS\PListParser.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
<ItemGroup> | ||
<None Include="FacebookBuild.cs.meta" /> | ||
<None Include="FacebookConsoleEndpoint.cs.meta" /> | ||
<None Include="FacebookPostprocess.cs.meta" /> | ||
<None Include="FacebookSettingsEditor.cs.meta" /> | ||
<None Include="Utility.cs.meta" /> | ||
<None Include="android\DefaultAndroidManifest.xml.meta" /> | ||
<None Include="android\FacebookAndroidUtil.cs.meta" /> | ||
<None Include="android\ManifestMod.cs.meta" /> | ||
<None Include="iOS\FixupFiles.cs.meta" /> | ||
<None Include="iOS\PListDict.cs.meta" /> | ||
<None Include="iOS\PListParser.cs.meta" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Facebook.Unity\Facebook.Unity.csproj"> | ||
<Project>{3DFF6C0C-BB04-405D-A23F-95999630E7F8}</Project> | ||
<Name>Facebook.Unity</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="android\DefaultAndroidManifest.xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Folder Include="Properties\" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.