Skip to content

Commit

Permalink
Facebook SDK For Unity 7.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhuowen committed Jul 29, 2016
1 parent 288f07f commit fb74f8b
Show file tree
Hide file tree
Showing 373 changed files with 2,485 additions and 2,566 deletions.
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ unit_test_results.txt
TestResult.xml

# Ignore Plugin Folders which are build by build
/Facebook.Unity/Assets/Plugins/
/UnitySDK/Assets/Plugins/

# Ignore Current Facebook Settings
FacebookSettings.asset*

# Ignore androdi wrapper lib created by build scripts
# Ignore android wrapper lib created by build scripts
/facebook-android-wrapper/libs/

# MD Plugins
Expand Down Expand Up @@ -134,7 +134,7 @@ TestResult.xml
# Ignore Current Facebook Settings
FacebookSettings.asset*

# Ignore androdi wrapper lib created by build scripts
# Ignore android wrapper lib created by build scripts
/facebook-android-wrapper/libs/

# MD Plugins
Expand All @@ -147,4 +147,7 @@ StyleCop.Cache.meta
*.DS_Store

# Temp file to show call stack
*.stackdump
*.stackdump

# Ignore editor generated user prefs
*.userprefs
200 changes: 200 additions & 0 deletions Facebook.Unity.Arcade/ArcadeWrapper.cs
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);
}
}
}
58 changes: 58 additions & 0 deletions Facebook.Unity.Arcade/Facebook.Unity.Arcade.csproj
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.
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
*/

using System.Runtime.CompilerServices;
using System.Reflection;

[assembly: InternalsVisibleTo("Facebook.Unity.Tests")]
[assembly: AssemblyVersion("7.8.0")]
82 changes: 82 additions & 0 deletions Facebook.Unity.Editor/Facebook.Unity.Editor.csproj
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>
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static string ExportPackage()
AssetDatabase.DeleteAsset("Assets/Temp");

// regenerate the manifest
UnityEditor.FacebookEditor.ManifestMod.GenerateManifest();
ManifestMod.GenerateManifest();
}

Debug.Log("Finished exporting!");
Expand Down
Loading

0 comments on commit fb74f8b

Please sign in to comment.