Skip to content
This repository has been archived by the owner on Dec 15, 2017. It is now read-only.

Commit

Permalink
Updating sample to work with Facebook SDK (4.3.4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Borrell committed Nov 11, 2013
1 parent 171e33a commit 095eb90
Show file tree
Hide file tree
Showing 68 changed files with 1,729 additions and 414 deletions.
5 changes: 5 additions & 0 deletions Assets/Facebook.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

149 changes: 145 additions & 4 deletions Assets/Scenes/GameStage.unity
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,18 @@ Camera:
m_GameObject: {fileID: 811108332}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_ClearFlags: 3
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: -20
near clip plane: .00999999978
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic: 0
orthographic size: 100
m_Depth: -1
m_CullingMask:
Expand All @@ -249,7 +249,148 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 811108332}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -31.5500641}
m_LocalPosition: {x: 0, y: 23.6060181, z: -175.502625}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
--- !u!1 &944952145
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 944952147}
- 108: {fileID: 944952146}
m_Layer: 0
m_Name: Directional light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &944952146
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 944952145}
m_Enabled: 1
serializedVersion: 3
m_Type: 1
m_Color: {r: .904411793, g: .904411793, b: .904411793, a: 1}
m_Intensity: .5
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 1
m_Resolution: -1
m_Strength: 1
m_Bias: .0500000007
m_Softness: 4
m_SoftnessFade: 1
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_ActuallyLightmapped: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 1
m_ShadowSamples: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
m_IndirectIntensity: 1
m_AreaSize: {x: 1, y: 1}
--- !u!4 &944952147
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 944952145}
m_LocalRotation: {x: .278701276, y: -.0825572014, z: .0551311336, w: .955233216}
m_LocalPosition: {x: 0, y: 0, z: -3.0447998}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
--- !u!1 &1242341862
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1242341867}
- 20: {fileID: 1242341866}
- 124: {fileID: 1242341865}
- 92: {fileID: 1242341864}
- 81: {fileID: 1242341863}
m_Layer: 0
m_Name: Camera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1242341863
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1242341862}
m_Enabled: 1
--- !u!92 &1242341864
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1242341862}
m_Enabled: 1
--- !u!124 &1242341865
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1242341862}
m_Enabled: 1
--- !u!20 &1242341866
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1242341862}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: .300000012
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 100
m_Depth: -2
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_HDR: 0
--- !u!4 &1242341867
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1242341862}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 23.6060181, z: -175.502625}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
Expand Down
24 changes: 23 additions & 1 deletion Assets/Scenes/MainMenu.unity
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,27 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 372241c8db1404a85b6374fdad805060, type: 3}
m_Name:
m_EditorClassIdentifier:
ButtonTexture: {fileID: 2800000, guid: 85b8733f7ac1b43a79c44fe143ed66e6, type: 3}
PlayTexture: {fileID: 2800000, guid: 23478e2b5b99244209fcae0cd0fae353, type: 3}
BragTexture: {fileID: 2800000, guid: bf81e3ab0afda465bb6d3d61f00e3c2a, type: 3}
ChallengeTexture: {fileID: 2800000, guid: 996e3f704781d43d89e373bbfc897267, type: 3}
StoreTexture: {fileID: 2800000, guid: 923f44927c5d14574a1dbd1562cdbf16, type: 3}
FullScreenTexture: {fileID: 2800000, guid: 44f916c4d76414764aa2f22e0a98b78b, type: 3}
FullScreenActiveTexture: {fileID: 2800000, guid: 1d77f685bafdf42c198204b0266d4ac4,
type: 3}
ResourcesTexture: {fileID: 2800000, guid: 2f9cbc1e57c674b8aa2d32fd3eec89cd, type: 3}
CanvasSize: {x: 1000, y: 600}
LoginButtonRect:
serializedVersion: 2
x: 190
y: 114
width: 200
height: 43
ResourcePos: {x: 162, y: 108}
ButtonStartPos: {x: -94, y: 182}
ButtonScale: .600000024
ButtonYGap: 10
ChallengeDisplayTime: 4
ButtonLogoOffset: {x: 332, y: 0}
TournamentStep: 140
MenuSkin: {fileID: 11400000, guid: 19ecbe5a38115409985fb91294c4ad4a, type: 2}
LogoTexture: {fileID: 2800000, guid: fcee03f6549564442af28e63a85c3b54, type: 3}
12 changes: 8 additions & 4 deletions Assets/Scripts/GameStateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class GameStateManager : MonoBehaviour

public static int StartingLives = 3, StartingScore = 0;
private int lives, score;
private int? highScore;

private string username = null;
public static Texture UserTexture;
Expand Down Expand Up @@ -58,6 +59,7 @@ void Awake()

public static GameStateManager Instance { get { return current(); } }
public static int Score { get { return Instance.score; } }
public static int HighScore { get { return Instance.highScore.HasValue ? Instance.highScore.Value : 0; } set { Instance.highScore = value; }}
public static int LivesRemaining { get { return Instance.lives; } }
public static string Username
{
Expand All @@ -72,6 +74,7 @@ public static string Username
instance = container.AddComponent<GameStateManager>();
instance.lives = StartingLives;
instance.score = StartingScore;
instance.highScore = null;
current = then;
return instance;
};
Expand Down Expand Up @@ -110,11 +113,12 @@ public static void EndGame()
{
Destroy(t);
}
var query = new Dictionary<string, string>();
query["score"] = Instance.score.ToString();
FbDebug.Log("EndGame Instance.highScore = " + Instance.highScore + "\nInstance.score = " + Instance.score);

// xxxxx scores
FB.API("/me/scores", Facebook.HttpMethod.POST, delegate(FBResult r) { Debug.Log("Result: " + r.Text); }, query);

Instance.highScore = Instance.score;
FbDebug.Log("Player has new high score :" + Instance.score);


Application.LoadLevel("MainMenu");
Time.timeScale = 0.0f;
Expand Down
Loading

0 comments on commit 095eb90

Please sign in to comment.