Skip to content

Commit

Permalink
Updated Phantasma API and DLLs on Phantasma Game Unity Sample
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoCatarinoDev committed Jun 26, 2019
1 parent dbe9f56 commit 2b11679
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 72 deletions.
9 changes: 9 additions & 0 deletions C#/UnitySamples/PhantasmaGame/Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,15 @@
<Reference Include="Unity.Analytics.Tracker">
<HintPath>C:/UnityProjects/Trabalho/PhantasmaSDK/C#/UnitySamples/PhantasmaGame/Library/PackageCache/com.unity.analytics@3.3.2/Unity.Analytics.Tracker.dll</HintPath>
</Reference>
<Reference Include="Phantasma.CodeGen">
<HintPath>C:/UnityProjects/Trabalho/PhantasmaSDK/C#/UnitySamples/PhantasmaGame/Assets/Phantasma/Plugins/Phantasma.CodeGen.dll</HintPath>
</Reference>
<Reference Include="Phantasma.Storage">
<HintPath>C:/UnityProjects/Trabalho/PhantasmaSDK/C#/UnitySamples/PhantasmaGame/Assets/Phantasma/Plugins/Phantasma.Storage.dll</HintPath>
</Reference>
<Reference Include="Phantasma.Pay">
<HintPath>C:/UnityProjects/Trabalho/PhantasmaSDK/C#/UnitySamples/PhantasmaGame/Assets/Phantasma/Plugins/Phantasma.Pay.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<HintPath>C:/Program Files/Unity/Hub/Editor/2019.1.8f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath>
</Reference>
Expand Down
Binary file not shown.
Binary file not shown.

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

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private IEnumerator GetMarketCoroutine(Action<Auction[]> successCallback = null,
SellCarAuctions.Clear();
BuyCarAuctions.Clear();

yield return PhantasmaDemo.Instance.PhantasmaApi.GetAuctions(PhantasmaDemo.TOKEN_SYMBOL, 1, (uint)itemsPerPage,
yield return PhantasmaDemo.Instance.PhantasmaApi.GetAuctions(PhantasmaDemo.PHANTASMA_CHAIN, PhantasmaDemo.TOKEN_SYMBOL, 1, (uint)itemsPerPage,
(auctions, currentPage, totalPages) =>
{
StartCoroutine(ProcessAuctions(auctions, currentPage, itemsPerPage, totalPages, successCallback, errorCallback));
Expand All @@ -64,7 +64,7 @@ private IEnumerator ProcessAuctions(Auction[] auctions, int currentPage, int ite
{
if (currentPage < totalPages)
{
yield return PhantasmaDemo.Instance.PhantasmaApi.GetAuctions(PhantasmaDemo.TOKEN_SYMBOL, (uint) currentPage + 1, (uint) itemsPerPage,
yield return PhantasmaDemo.Instance.PhantasmaApi.GetAuctions(PhantasmaDemo.PHANTASMA_CHAIN, PhantasmaDemo.TOKEN_SYMBOL, (uint) currentPage + 1, (uint) itemsPerPage,
(a, cPage, tPages) =>
{
foreach (var auction in auctions)
Expand Down Expand Up @@ -178,7 +178,7 @@ private IEnumerator CheckAssetPurchase(Car car, string result)
EventKind eKind;
if (Enum.TryParse(evt.kind, out eKind))
{
if (eKind == EventKind.AuctionFilled)
if (eKind == EventKind.OrderFilled)
{
var carMutableData = car.MutableData;
carMutableData.location = CarLocation.None;
Expand Down Expand Up @@ -266,7 +266,7 @@ private IEnumerator CheckAssetSale(Car car, BigInteger price, Timestamp endDate,
EventKind eKind;
if (Enum.TryParse(evt.kind, out eKind))
{
if (eKind == EventKind.AuctionCreated)
if (eKind == EventKind.OrderCreated)
{
var bytes = Base16.Decode(evt.data);
var marketEventData = Serialization.Unserialize<MarketEventData>(bytes);
Expand Down Expand Up @@ -357,7 +357,7 @@ private IEnumerator CheckAssetRemoval(Car car, string result)
EventKind eKind;
if (Enum.TryParse(evt.kind, out eKind))
{
if (eKind == EventKind.AuctionCancelled)
if (eKind == EventKind.OrderCancelled)
{
var carMutableData = car.MutableData;
carMutableData.location = CarLocation.None;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine;
using Phantasma.SDK;
using UnityEngine;
using UnityEngine.UI;

public class LoginMenu : MonoBehaviour
Expand All @@ -15,7 +16,7 @@ public void Login()

if (PhantasmaDemo.Instance != null)
{
if (PhantasmaDemo.Instance.PhantasmaApi != null && !PhantasmaDemo.Instance.PhantasmaApi.IsValidPrivateKey(addressInputField.text))
if (PhantasmaDemo.Instance.PhantasmaApi != null && !API.IsValidPrivateKey(addressInputField.text))
{
CanvasManager.Instance.ShowResultPopup(EOPERATION_RESULT.FAIL, "Error: The entered private key is not valid.\nThe private key must start with an 'L' or a 'K' and have 52 characters.");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public enum EBLOCKCHAIN_OPERATION
{ EBLOCKCHAIN_OPERATION.REMOVE_ASSET, "Remove asset from the market." },
};

public const string PHANTASMA_CHAIN = "main";

public const string TOKEN_SYMBOL = "CAR";
public const string TOKEN_NAME = "Car Demo Token";

Expand Down
Loading

0 comments on commit 2b11679

Please sign in to comment.