Skip to content

Commit

Permalink
Release 0.4.0
Browse files Browse the repository at this point in the history
- Reduce RPC node pressure
- Organize some name spaces
  • Loading branch information
Woody4618 committed Oct 27, 2022
1 parent 1c3eff0 commit 86e080a
Show file tree
Hide file tree
Showing 35 changed files with 136 additions and 165 deletions.
1 change: 0 additions & 1 deletion Assets/SolPlay/FlappyGame/Runtime/Scripts/Core/GameMode.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections;
using Frictionless;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Services;
using SolPlay.Scripts.Ui;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Runtime.Serialization.Formatters;
using DG.Tweening;
using Frictionless;
using SolPlay.Deeplinks;
using SolPlay.Scripts;
using UnityEngine;

[RequireComponent(typeof(PlayerAudio))]
Expand Down
12 changes: 12 additions & 0 deletions Assets/SolPlay/FlappyGame/Runtime/Scripts/SimpleRotate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using UnityEngine;


public class SimpleRotate : MonoBehaviour
{
public float speed = 5;

void Update()
{
transform.Rotate(Vector3.forward, speed);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using DG.Tweening;
using Frictionless;
using Solana.Unity.Rpc.Models;
using SolPlay.Deeplinks;
using SolPlay.DeeplinksNftExample.Scripts;
using SolPlay.Scripts.Services;
using SolPlay.Scripts.Ui;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using Frictionless;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Services;
using UnityEngine;

Expand Down
14 changes: 0 additions & 14 deletions Assets/SolPlay/FlappyGame/SimpleRotate.cs

This file was deleted.

17 changes: 5 additions & 12 deletions Assets/SolPlay/Orca/OrcaSwapWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
using Solana.Unity.Rpc.Models;
using Solana.Unity.SDK.Nft;
using Solana.Unity.Wallet;
using SolPlay.Deeplinks;
using SolPlay.DeeplinksNftExample.Scripts;
using SolPlay.DeeplinksNftExample.Scripts.OrcaWhirlPool;
using SolPlay.MetaPlex;
using SolPlay.Orca.OrcaWhirlPool;
using SolPlay.Scripts;
using SolPlay.Scripts.Services;
using UnityEngine;
using Vector2 = UnityEngine.Vector2;
Expand Down Expand Up @@ -76,7 +76,7 @@ private async void InitPools(bool whiteList)
Whirlpool.Accounts.Whirlpool pool = await ServiceFactory.Resolve<OrcaWhirlpoolService>().GetPool(entry);
pools.Add(pool);

Debug.Log("add pool" + pool.TokenMintA);
//Debug.Log("add pool" + pool.TokenMintA);
}
catch (Exception e)
{
Expand All @@ -102,11 +102,8 @@ private async void InitPools(bool whiteList)

private async void initPools(List<Whirlpool.Accounts.Whirlpool> pools)
{
Thread.Sleep(3);
var wallet = ServiceFactory.Resolve<WalletHolderService>().BaseWallet;

string poolList = String.Empty;

Debug.Log("pools" + pools.Count);
for (var index = 0; index < pools.Count; index++)
{
Expand Down Expand Up @@ -150,13 +147,13 @@ private async void initPools(List<Whirlpool.Accounts.Whirlpool> pools)

if (tokenAccountInfoA == null || tokenAccountInfoA.Data == null)
{
Debug.LogWarning($"Could not load meta data of mint {metadataPdaA}");
Debug.LogWarning($"Could not load meta data of mint A");
continue;
}

if (tokenAccountInfoB == null || tokenAccountInfoB.Data == null)
{
Debug.LogWarning($"Could not load meta data of mint {metadataPdaB}");
Debug.LogWarning($"Could not load meta data of mint B");
continue;
}

Expand All @@ -166,19 +163,15 @@ private async void initPools(List<Whirlpool.Accounts.Whirlpool> pools)
poolData.SymbolA = metaPlexA.data.symbol;
poolData.SymbolB = metaPlexB.data.symbol;

poolList +=
$"\nSymbolA: {poolData.SymbolA} SymbolB: {poolData.SymbolB} PDA: {whirlPoolPda} config: {pool.WhirlpoolsConfig}";

poolData.SpriteA = await GetTokenIconSprite(pool.TokenMintA, poolData.SymbolA);
poolData.SpriteB = await GetTokenIconSprite(pool.TokenMintB, poolData.SymbolB);

PoolListItem poolListItem = Instantiate(PoolListItemPrefab, PoolListItemRoot.transform);
Debug.Log("set data" + poolData.PoolPda);
// Debug.Log("set data" + poolData.PoolPda);

poolListItem.SetData(poolData, OpenSwapPopup);
}

Debug.Log(poolList);
}

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Orca/OrcaWhirlPool/OrcaSwapPopup.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Numerics;
using Frictionless;
using SolPlay.Deeplinks;
using SolPlay.DeeplinksNftExample.Scripts;
using SolPlay.Orca.OrcaWhirlPool;
using SolPlay.Scripts.Services;
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Orca/OrcaWhirlPool/OrcaWhirlpoolService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Solana.Unity.SDK;
using Solana.Unity.SDK.Utility;
using Solana.Unity.Wallet;
using SolPlay.Deeplinks;
using SolPlay.DeeplinksNftExample.Scripts.OrcaWhirlPool;
using SolPlay.Orca;
using SolPlay.Scripts.Services;
Expand Down
11 changes: 9 additions & 2 deletions Assets/SolPlay/Scripts/Services/HighscoreService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
using Solana.Unity.Rpc.Types;
using Solana.Unity.SDK;
using Solana.Unity.Wallet;
using SolPlay.Deeplinks;
using SolPlay.DeeplinksNftExample.Scripts;
using SolPlay.DeeplinksNftExample.Utils;
using SolPlay.Scripts.Ui;
using UnityEngine;
using Random = UnityEngine.Random;

namespace SolPlay.Scripts.Services
{
Expand Down Expand Up @@ -80,7 +80,14 @@ private void OnNftArrivedMessage(NftArrivedMessage message)
};
_allHighscores[seedFromPubkey] = highscoreEntry;

GetHighscoreAccountData(message.NewNFt);
// Taking some work from the RPC nodes and delay the high score requests.
StartCoroutine(GetHighScoreDataDelayed(message.NewNFt, Random.Range(0, 3)));
}

private IEnumerator GetHighScoreDataDelayed(SolPlayNft messageNewNFt, int range)
{
yield return new WaitForSeconds(range);
GetHighscoreAccountData(messageNewNFt);
}

private async void OnAllNftsLoadedMessage(NftLoadingFinishedMessage message)
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Services/IapService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using CandyMachineV2;
using Frictionless;
using Solana.Unity.Wallet;
using SolPlay.Deeplinks;
using UnityEngine;

namespace SolPlay.Scripts.Services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Solana.Unity.Rpc.Messages;
using Solana.Unity.Rpc.Models;
using Solana.Unity.Wallet;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Ui;
using UnityEngine;

Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Services/NftMintingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Solana.Unity.Rpc.Types;
using Solana.Unity.Wallet;
using Solnet.Metaplex;
using SolPlay.Deeplinks;
using SolPlay.DeeplinksNftExample.Utils;
using UnityEngine;

Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Services/NftPowerLevelService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections;
using Frictionless;
using SolPlay.Deeplinks;
using UnityEngine;

namespace SolPlay.Scripts.Services
Expand Down
3 changes: 1 addition & 2 deletions Assets/SolPlay/Scripts/Services/NftService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
using Solana.Unity.Rpc.Types;
using Solana.Unity.SDK;
using Solana.Unity.SDK.Nft;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Ui;
using UnityEngine;
using NftImage = SolPlay.Deeplinks.NftImage;
using NftImage = SolPlay.Scripts.NftImage;

namespace SolPlay.Scripts.Services
{
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Services/ShadowDriveService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Solana.Unity.Rpc.Builders;
using Solana.Unity.Rpc.Types;
using Solana.Unity.Wallet;
using SolPlay.Deeplinks;
using UnityEngine;

namespace SolPlay.Scripts.Services
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Services/TransactionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Solana.Unity.Rpc.Messages;
using Solana.Unity.Rpc.Models;
using Solana.Unity.Wallet;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Ui;
using UnityEngine;
using SystemProgram = Solana.Unity.Programs.SystemProgram;
Expand Down
2 changes: 1 addition & 1 deletion Assets/SolPlay/Scripts/Services/WalletHolderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private void Awake()
if (ServiceFactory.Resolve<WalletHolderService>() != null)
{
Destroy(gameObject);
return;
return;
}

ServiceFactory.RegisterSingleton(this);
Expand Down
3 changes: 1 addition & 2 deletions Assets/SolPlay/Scripts/SolPlay.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using Frictionless;
using SolPlay.DeeplinksNftExample.Scripts;
using SolPlay.Scripts.Services;
using UnityEngine;
using UnityEngine.SceneManagement;

namespace SolPlay.Deeplinks
namespace SolPlay.Scripts
{
public class SolPlay : MonoBehaviour
{
Expand Down
2 changes: 1 addition & 1 deletion Assets/SolPlay/Scripts/SolPlayFileLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using UnityEngine.Networking;
using Object = UnityEngine.Object;

namespace SolPlay.Deeplinks
namespace SolPlay.Scripts
{
/// <summary>
/// Originally from AllArt, but with some changes to also be able to load gifs and reduce garbage and name textures
Expand Down
3 changes: 1 addition & 2 deletions Assets/SolPlay/Scripts/SolPlayNft.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
using Solana.Unity.Rpc.Models;
using Solana.Unity.SDK;
using Solana.Unity.SDK.Nft;
using Solana.Unity.SDK.Utility;
using Solana.Unity.Wallet;
using Solana.Unity.Wallet.Utilities;
using SolPlay.Scripts.Services;
using SolPlay.Scripts.Ui;
using UnityEngine;
using Object = UnityEngine.Object;

namespace SolPlay.Deeplinks
namespace SolPlay.Scripts
{
[Serializable]
public class NftImage : iNftFile<Texture2D>
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Ui/BlimpSystem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections;
using Frictionless;
using SolPlay.Deeplinks;
using UnityEngine;

namespace SolPlay.Scripts.Ui
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Ui/LoginScreen.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Frictionless;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Services;
using UnityEngine;
using UnityEngine.UI;
Expand Down
6 changes: 2 additions & 4 deletions Assets/SolPlay/Scripts/Ui/NftContextMenu.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Frictionless;
using SolPlay.Deeplinks;
using SolPlay.DeeplinksNftExample.Scripts;
using SolPlay.Scripts.Services;
using TMPro;
using UnityEngine;
Expand All @@ -20,7 +18,7 @@ public class NftContextMenu : MonoBehaviour
public Button BurnButton;
public Button SelectButton;
public SolPlayNft currentNft;

private void Awake()
{
ServiceFactory.RegisterSingleton(this);
Expand All @@ -44,7 +42,7 @@ private void OnSelectClicked()
else
{
// In case you want to load another scene please use the SolPlay instance
Deeplinks.SolPlay.Instance.LoadScene("FlappGameExample");
//SolPlay.Instance.LoadScene("FlappyGameExample");
ServiceFactory.Resolve<LoggingService>().Log("Add you select logic in NftContextMenu.cs", true);
}
}
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Ui/NftItemListView.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using Frictionless;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Services;
using UnityEngine;

Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Ui/NftItemView.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using Frictionless;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Services;
using TMPro;
using UnityEngine;
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Ui/NftListScreen.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Threading.Tasks;
using Frictionless;
using SolPlay.Deeplinks;
using SolPlay.DeeplinksNftExample.Scripts;
using SolPlay.Scripts.Services;
using UnityEngine;
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Ui/PowerLevelWidget.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Frictionless;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Services;
using TMPro;
using UnityEngine;
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Ui/SolBalanceWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Threading.Tasks;
using Frictionless;
using Solana.Unity.Rpc.Types;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Services;
using TMPro;
using UnityEngine;
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Ui/TokenPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Solana.Unity.Programs;
using Solana.Unity.Rpc.Types;
using Solana.Unity.Wallet;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Services;
using TMPro;
using UnityEngine;
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Ui/TokenScreen.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Frictionless;
using SolPlay.Deeplinks;
using SolPlay.DeeplinksNftExample.Scripts;
using SolPlay.DeeplinksNftExample.Utils;
using SolPlay.Scripts.Services;
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Scripts/Ui/XpWidget.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections;
using Frictionless;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Services;
using TMPro;
using UnityEngine;
Expand Down
1 change: 0 additions & 1 deletion Assets/SolPlay/Staking/StakingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using GemFarm.Program;
using Solana.Unity.Rpc.Models;
using Solana.Unity.Wallet;
using SolPlay.Deeplinks;
using SolPlay.Scripts.Services;
using SolPlay.Scripts.Ui;
using UnityEngine;
Expand Down
Loading

0 comments on commit 86e080a

Please sign in to comment.