Skip to content

Commit

Permalink
Merge pull request #22 from dsarfati/1.2.0
Browse files Browse the repository at this point in the history
Updated iOS and Android SDKs
  • Loading branch information
seniorquico authored Jun 15, 2018
2 parents a5cbf6a + 81f19a4 commit 2edc653
Show file tree
Hide file tree
Showing 44 changed files with 276 additions and 369 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sudo: required
env:
global:
- Android_SDK="v1.1.0"
- iOS_SDK="v1.1.0"
- iOS_SDK="v1.2.0"
branches:
only:
- master
Expand Down

This file was deleted.

13 changes: 1 addition & 12 deletions Assets/Zapic/Editor/ZapicDependencies.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
<dependencies>
<androidPackages>
<androidPackage spec="com.android.support:cardview-v7:27.1.0" />
<androidPackage spec="com.android.support:support-fragment:27.1.0" />
<androidPackage spec="com.google.android.gms:play-services-auth:11.8.0">
<androidSdkPackageIds>
<androidSdkPackageId>extra-google-m2repository</androidSdkPackageId>
</androidSdkPackageIds>
</androidPackage>
<androidPackage spec="com.google.android.gms:play-services-games:11.8.0">
<androidSdkPackageIds>
<androidSdkPackageId>extra-google-m2repository</androidSdkPackageId>
</androidSdkPackageIds>
</androidPackage>
<androidPackage spec="com.android.support:support-core-utils:[26.0.0, 27.2.0)" />
</androidPackages>
</dependencies>
126 changes: 0 additions & 126 deletions Assets/Zapic/Editor/ZapicEditorWindow.cs

This file was deleted.

64 changes: 0 additions & 64 deletions Assets/Zapic/Examples/ExampleStartup.cs

This file was deleted.

Binary file modified Assets/Zapic/Examples/MenuDemo.unity
Binary file not shown.
7 changes: 6 additions & 1 deletion Assets/Zapic/Examples/ZapicButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ private void Awake()

private void ShowZapicMenu()
{
Zapic.Show(ZapicSDK.Views.Main);
Zapic.ShowDefaultPage();
}

private void ShowZapicChallengesMenu()
{
Zapic.ShowPage(ZapicPages.Challenges);
}
}
78 changes: 78 additions & 0 deletions Assets/Zapic/Examples/ZapicExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using System.Collections.Generic;
using UnityEngine;

public class ZapicExample : MonoBehaviour
{
void Start()
{
Zapic.OnLogin = ((player) =>
{
Debug.LogFormat("Player logged in. Id:{0}, Notification:{1}", player.PlayerId, player.NotificationToken);
});

Zapic.OnLogout = ((player) =>
{
Debug.LogFormat("Player logged out. Id:{0}, Notification:{1}", player.PlayerId, player.NotificationToken);
});

Zapic.Start();
}

private void Update()
{
//Simulate a Zapic event on left click
if (Input.GetMouseButtonDown(0))
{
SendEvent();
}
//Simulate HandleInteraction on right click
else if(Input.GetMouseButtonDown(1))
{
HandleInteraction();
}
//Simulate getting current player on space bar
else if(Input.GetKeyDown(KeyCode.Space))
{
GetPlayer();
}
}

private void SendEvent()
{
var eventParams = new Dictionary<string, object>();

//Add parameter information to the event
eventParams.Add("Score",22);
eventParams.Add("PARAM2","abc");
eventParams.Add("PARAM3",true);
eventParams.Add("PARAM4","\"blab");
eventParams.Add("PAR\"AM5", "\"blab" );

//Sumbit the event to the Zapic server
Zapic.SubmitEvent(eventParams);
}

private void GetPlayer()
{
//Gets the current player
var player = Zapic.Player();

if (player == null)
{
Debug.Log("Player is null");
}
else
{
Debug.LogFormat("Current Player, Id:{0}, NotificationToken:{1}", player.PlayerId, player.NotificationToken);
}
}

private void HandleInteraction()
{
var data = new Dictionary<string, object>()
{ { "zapic", "/challenge/00000000-0000-0000-0000-000000000000" }
};

Zapic.HandleInteraction(data);
}
}
File renamed without changes.
15 changes: 10 additions & 5 deletions Assets/Zapic/IZapicInterface.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;

namespace ZapicSDK
Expand Down Expand Up @@ -28,10 +28,15 @@ internal interface IZapicInterface
void Start();

/// <summary>
/// Shows the given zapic window
/// Shows the default Zapic page
/// </summary>
/// <param name="view">View to show.</param>
void Show(Views view);
void ShowDefaultPage();

/// <summary>
/// Shows the given Zapic page
/// </summary>
/// <param name="page">Page to show.</param>
void ShowPage(ZapicPages page);

/// <summary>
/// Gets the current players unique id.
Expand All @@ -43,7 +48,7 @@ internal interface IZapicInterface
/// Handle Zapic data. Usually from an integration like push notifications.
/// </summary>
/// <param name="data">The data.</param>
void HandleData(Dictionary<string, object> data);
void HandleInteraction(Dictionary<string, object> data);

/// <summary>
/// Submit a new in-game event to zapic.
Expand Down
4 changes: 2 additions & 2 deletions Assets/Zapic/MiniJSON.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2013 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
Expand Down Expand Up @@ -629,4 +629,4 @@ void SerializeOther(object value)
}
}
}
}
}
10 changes: 0 additions & 10 deletions Assets/Zapic/Plugins.meta

This file was deleted.

10 changes: 0 additions & 10 deletions Assets/Zapic/Plugins/Android.meta

This file was deleted.

Loading

0 comments on commit 2edc653

Please sign in to comment.