repo_id
stringclasses 279
values | file_path
stringlengths 43
179
| content
stringlengths 1
4.18M
| __index_level_0__
int64 0
0
|
|---|---|---|---|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Configs/Good.asset.meta
|
fileFormatVersion: 2
guid: 88127756ef5a644f9a3212811ede23f4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Configs/Empty.asset
|
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ef6d93e4c8904031a8a9b76b4acb032c, type: 3}
m_Name: Empty
m_EditorClassIdentifier:
Number: 0
Prefab: {fileID: 1509320704378930833, guid: 632bbea73a6c746b092f7b5608da590a, type: 3}
MergeFx: {fileID: 0}
Material: {fileID: 2100000, guid: dc77712f8a3c349dfa7d7f80d7d2bb04, type: 2}
ShakeStrength: 0.3
MaterialColor: {r: 0, g: 1, b: 0.023376703, a: 1}
BackgroundMaterial: {fileID: 0}
Index: 0
building_type: 1
BuildingName: Empty
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Configs/Empty.asset.meta
|
fileFormatVersion: 2
guid: 70598f2cc4eb340a1a6efb58dd299aee
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/ChopTreePopupUiData.cs.meta
|
fileFormatVersion: 2
guid: 2ed15c14eda34891814cfadf87f10557
timeCreated: 1690569006
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftMintingService.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using CandyMachineV2;
using CandyMachineV2.Program;
using Frictionless;
using Solana.Unity.Metaplex.NFT.Library;
using Solana.Unity.Programs;
using Solana.Unity.Rpc.Builders;
using Solana.Unity.Rpc.Core.Http;
using Solana.Unity.Rpc.Messages;
using Solana.Unity.Rpc.Types;
using Solana.Unity.SDK;
using Solana.Unity.Wallet;
using SolPlay.DeeplinksNftExample.Utils;
using UnityEngine;
using Creator = Solana.Unity.Metaplex.NFT.Library.Creator;
using MetadataProgram = Solana.Unity.Metaplex.NFT.Library.MetadataProgram;
using PublicKey = Solana.Unity.Wallet.PublicKey;
using Transaction = Solana.Unity.Rpc.Models.Transaction;
namespace SolPlay.Scripts.Services
{
public class NftMintingService : MonoBehaviour, IMultiSceneSingleton
{
public void Awake()
{
if (ServiceFactory.Resolve<NftMintingService>() != null)
{
Destroy(gameObject);
return;
}
ServiceFactory.RegisterSingleton(this);
}
public IEnumerator HandleNewSceneLoaded()
{
yield return null;
}
public async Task<string> MintNFTFromCandyMachineV2(PublicKey candyMachineKey)
{
var account = Web3.Account;
Account mint = new Account();
PublicKey associatedTokenAccount =
AssociatedTokenAccountProgram.DeriveAssociatedTokenAccount(account, mint.PublicKey);
var candyMachineClient = new CandyMachineClient(Web3.Rpc, null);
var candyMachineWrap = await candyMachineClient.GetCandyMachineAsync(candyMachineKey);
var candyMachine = candyMachineWrap.ParsedResult;
var (candyMachineCreator, creatorBump) = CandyMachineUtils.getCandyMachineCreator(candyMachineKey);
MintNftAccounts mintNftAccounts = new MintNftAccounts
{
CandyMachine = candyMachineKey,
CandyMachineCreator = candyMachineCreator,
Clock = SysVars.ClockKey,
InstructionSysvarAccount = CandyMachineUtils.instructionSysVarAccount,
MasterEdition = CandyMachineUtils.getMasterEdition(mint.PublicKey),
Metadata = CandyMachineUtils.getMetadata(mint.PublicKey),
Mint = mint.PublicKey,
MintAuthority = account,
Payer = account,
RecentBlockhashes = SysVars.RecentBlockHashesKey,
Rent = SysVars.RentKey,
SystemProgram = SystemProgram.ProgramIdKey,
TokenMetadataProgram = CandyMachineUtils.TokenMetadataProgramId,
TokenProgram = TokenProgram.ProgramIdKey,
UpdateAuthority = account,
Wallet = candyMachine.Wallet
};
var candyMachineInstruction = CandyMachineProgram.MintNft(mintNftAccounts, creatorBump);
var blockHash = await Web3.Rpc.GetRecentBlockHashAsync();
var minimumRent =
await Web3.Rpc.GetMinimumBalanceForRentExemptionAsync(
TokenProgram.MintAccountDataSize);
var serializedTransaction = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(account)
.AddInstruction(
SystemProgram.CreateAccount(
account,
mint.PublicKey,
minimumRent.Result,
TokenProgram.MintAccountDataSize,
TokenProgram.ProgramIdKey))
.AddInstruction(
TokenProgram.InitializeMint(
mint.PublicKey,
0,
account,
account))
.AddInstruction(
AssociatedTokenAccountProgram.CreateAssociatedTokenAccount(
account,
account,
mint.PublicKey))
.AddInstruction(
TokenProgram.MintTo(
mint.PublicKey,
associatedTokenAccount,
1,
account))
.AddInstruction(candyMachineInstruction)
.Build(new List<Account>()
{
account,
mint
});
Transaction deserializedTransaction = Transaction.Deserialize(serializedTransaction);
Debug.Log($"mint transaction length {serializedTransaction.Length}");
var transactionSignature = await Web3.Wallet.SignAndSendTransaction(deserializedTransaction, commitment: Commitment.Confirmed);
if (!transactionSignature.WasSuccessful)
{
Debug.Log("Mint was not successfull: " + transactionSignature.Reason);
}
else
{
Debug.Log("Mint Successfull! Woop woop!");
}
Debug.Log(transactionSignature.Reason);
return transactionSignature.Result;
}
public async Task<string> MintNftWithMetaData(string metaDataUri, string name, string symbol, Action<bool> mintDone = null)
{
var account = Web3.Account;
var rpcClient = Web3.Rpc;
Account mint = new Account();
var associatedTokenAccount = AssociatedTokenAccountProgram
.DeriveAssociatedTokenAccount(account, mint.PublicKey);
var fromAccount = account;
RequestResult<ResponseValue<ulong>> balance =
await rpcClient.GetBalanceAsync(account.PublicKey, Commitment.Confirmed);
if (balance.Result != null && balance.Result.Value < SolanaUtils.SolToLamports / 10)
{
Debug.Log("Sol balance is low. Minting may fail");
}
Debug.Log($"Balance: {balance.Result.Value} ");
Debug.Log($"Mint key : {mint.PublicKey} ");
var blockHash = await rpcClient.GetRecentBlockHashAsync();
var rentMint = await rpcClient.GetMinimumBalanceForRentExemptionAsync(
TokenProgram.MintAccountDataSize,
Commitment.Confirmed
);
var rentToken = await rpcClient.GetMinimumBalanceForRentExemptionAsync(
TokenProgram.TokenAccountDataSize,
Commitment.Confirmed
);
//2. create a mint and a token
var createMintAccount = SystemProgram.CreateAccount(
fromAccount,
mint,
rentMint.Result,
TokenProgram.MintAccountDataSize,
TokenProgram.ProgramIdKey
);
var initializeMint = TokenProgram.InitializeMint(
mint.PublicKey,
0,
fromAccount.PublicKey,
fromAccount.PublicKey
);
var createTokenAccount = AssociatedTokenAccountProgram.CreateAssociatedTokenAccount(
fromAccount,
fromAccount,
mint.PublicKey);
var mintTo = TokenProgram.MintTo(
mint.PublicKey,
associatedTokenAccount,
1,
fromAccount.PublicKey
);
// If you freeze the account the users will not be able to transfer the NFTs anywhere or burn them
var freezeAccount = TokenProgram.FreezeAccount(
associatedTokenAccount,
mint.PublicKey,
fromAccount,
TokenProgram.ProgramIdKey
);
// PDA Metadata
PublicKey metadataAddressPDA;
byte nonce;
PublicKey.TryFindProgramAddress(
new List<byte[]>()
{
Encoding.UTF8.GetBytes("metadata"),
MetadataProgram.ProgramIdKey,
mint.PublicKey
},
MetadataProgram.ProgramIdKey,
out metadataAddressPDA,
out nonce
);
Console.WriteLine($"PDA METADATA: {metadataAddressPDA}");
// PDA master edition (Makes sure there can only be one minted)
PublicKey masterEditionAddress;
PublicKey.TryFindProgramAddress(
new List<byte[]>()
{
Encoding.UTF8.GetBytes("metadata"),
MetadataProgram.ProgramIdKey,
mint.PublicKey,
Encoding.UTF8.GetBytes("edition"),
},
MetadataProgram.ProgramIdKey,
out masterEditionAddress,
out nonce
);
Console.WriteLine($"PDA MASTER: {masterEditionAddress}");
// Craetors
var creator1 = new Creator(fromAccount.PublicKey, 100, false);
// Meta Data
var data = new Metadata()
{
name = name,
symbol = symbol,
uri = metaDataUri,
creators = new List<Creator>() {creator1},
sellerFeeBasisPoints = 77
};
var signers = new List<Account> {fromAccount, mint};
var transactionBuilder = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(fromAccount)
.AddInstruction(createMintAccount)
.AddInstruction(initializeMint)
.AddInstruction(createTokenAccount)
.AddInstruction(mintTo)
.AddInstruction(freezeAccount)
.AddInstruction(
MetadataProgram.CreateMetadataAccount(
metadataAddressPDA, // PDA
mint,
fromAccount.PublicKey,
fromAccount.PublicKey,
fromAccount.PublicKey, // update Authority
data, // DATA
TokenStandard.NonFungible,
true,
true, // ISMUTABLE,
masterEditionKey: null,
1,
0UL,
MetadataVersion.V3
)
)
.AddInstruction(
MetadataProgram.SignMetadata(
metadataAddressPDA,
creator1.key
)
)
.AddInstruction(
MetadataProgram.PuffMetada(
metadataAddressPDA
)
)
/*.AddInstruction(
MetadataProgram.CreateMasterEdition(
1,
masterEditionAddress,
mintAccount,
fromAccount.PublicKey,
fromAccount.PublicKey,
fromAccount.PublicKey,
metadataAddressPDA
)
)*/;
var tx = Transaction.Deserialize(transactionBuilder.Build(new List<Account> {fromAccount, mint}));
var res = await Web3.Wallet.SignAndSendTransaction(tx, true, Commitment.Confirmed);
await Web3.Rpc.ConfirmTransaction(res.Result, Commitment.Confirmed);
Debug.Log(res.Result);
if (!res.WasSuccessful)
{
mintDone?.Invoke(false);
Debug
.Log("Mint was not successfull: " + res.Reason);
}
else
{
mintDone?.Invoke(true);
Debug.Log("Mint Successfull! Woop woop!");
}
return res.Result;
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftListPopupUiData.cs
|
using Solana.Unity.SDK;
using SolPlay.Scripts.Services;
public class NftListPopupUiData : UiService.UiData
{
public bool RequestNfts;
public WalletBase Wallet;
public NftListPopupUiData(bool requestNfts, WalletBase wallet)
{
RequestNfts = requestNfts;
Wallet = wallet;
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftContextMenu.cs.meta
|
fileFormatVersion: 2
guid: fa2ed95613a844f5f9f1aa710c9be3ad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/BuildBuildingPopup.cs
|
using DefaultNamespace;
using Frictionless;
using SolPlay.Scripts.Services;
using SolPlay.Scripts.Ui;
using UnityEngine;
using UnityEngine.UI;
public class BuildBuildingPopup : BasePopup
{
public GameObject LoadingSpinner;
public GameObject ListRoot;
public BuildBuildingListItemView BuildBuildingListItemViewPrefab;
public override void Open(UiService.UiData uiData)
{
var refillUiData = (uiData as BuildBuildingPopupUiData);
foreach (Transform trans in ListRoot.transform)
{
Destroy(trans.gameObject);
}
foreach (var config in ServiceFactory.Resolve<BoardManager>().tileConfigs)
{
if (config.IsBuildable)
{
var newListItem = Instantiate(BuildBuildingListItemViewPrefab, ListRoot.transform);
newListItem.SetData(config, view =>
{
if (LumberjackService.HasEnoughResources(BalancingService.GetBuildCost(config)))
{
(uiData as BuildBuildingPopupUiData).OnClick(config);
Close();
}
});
}
}
if (refillUiData == null)
{
Debug.LogError("Wrong ui data for nft list popup");
return;
}
base.Open(uiData);
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Cell.cs
|
using System.Collections.Generic;
using SolPlay.Scripts.Services;
using UnityEngine;
public class Cell : MonoBehaviour
{
public int X { private set; get; }
public int Y { private set; get; }
public Tile Tile;
public MeshRenderer MeshRenderer;
public List<Material> Materials;
public void Init(int x, int y, Tile tile)
{
X = x;
Y = y;
Tile = tile;
MeshRenderer.material = Materials[Random.Range(0, Materials.Count)];
}
private void OnMouseUp()
{
if (UiService.IsPointerOverUIObject())
{
return;
}
LumberjackService.Instance.OnCellClicked((byte)X, (byte) Y);
}
public bool IsEmpty()
{
return Tile == null;
}
public bool IsOccupied()
{
return Tile != null;
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/BuildBuildingPopupUiData.cs.meta
|
fileFormatVersion: 2
guid: 346f2e31d6224a7ba27e22e3d369b007
timeCreated: 1690569214
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/CostWidget.cs.meta
|
fileFormatVersion: 2
guid: 3e9f583c22e84ff496349ff815e01097
timeCreated: 1690646509
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/ProductionIndicator.cs
|
using System;
using System.Collections;
using Lumberjack.Types;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class ProductionIndicator : MonoBehaviour
{
public Image ProgressBar;
public TextMeshProUGUI Level;
public TextMeshProUGUI Name;
public GameObject CollectionIndicator;
private TileData CurrentTileData;
private Coroutine _coroutine;
public void SetData(TileData tileData)
{
Level.text = tileData.BuildingLevel.ToString();
Name.text = LumberjackService.GetName(tileData);
CurrentTileData = tileData;
if (_coroutine != null)
{
StopCoroutine(_coroutine);
_coroutine = null;
}
_coroutine = StartCoroutine(UpdateProgressBar());
}
/* private void Update()
{
if (CurrentTileData == null)
{
return;
}
long unixTime = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds();
var tileDataBuildingStartCollectTime = CurrentTileData.BuildingStartCollectTime + new TimeSpan(0,0,1,0).TotalSeconds;
//Debug.Log("Time: " + tileDataBuildingStartCollectTime + " current time " + unixTime + " diff " + (unixTime - tileDataBuildingStartCollectTime));
//tileDataBuildingStartCollectTime < unixTime;
var dataBuildingStartCollectTime = tileDataBuildingStartCollectTime - unixTime;
ProgressBar.fillAmount = (float) (dataBuildingStartCollectTime / 60f);
}*/
private IEnumerator UpdateProgressBar()
{
while (true)
{
if (CurrentTileData == null)
{
continue;
}
long unixTime = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds();
var tileDataBuildingStartCollectTime = CurrentTileData.BuildingStartCollectTime + new TimeSpan(0,0,1,0).TotalSeconds;
//Debug.Log("Time: " + tileDataBuildingStartCollectTime + " current time " + unixTime + " diff " + (unixTime - tileDataBuildingStartCollectTime));
//tileDataBuildingStartCollectTime < unixTime;
var dataBuildingStartCollectTime = tileDataBuildingStartCollectTime - unixTime;
ProgressBar.fillAmount = (float) (dataBuildingStartCollectTime / 60f);
var isCollectable = LumberjackService.IsCollectable(CurrentTileData);
CollectionIndicator.gameObject.SetActive(isCollectable);
yield return new WaitForSeconds(0.3f);
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/BuildBuildingPopupUiData.cs
|
using System;
using DefaultNamespace;
using Lumberjack.Types;
using Solana.Unity.SDK;
using SolPlay.Scripts.Services;
public class BuildBuildingPopupUiData : UiService.UiData
{
public WalletBase Wallet;
public Action<TileConfig> OnClick;
public TileData TileData;
public BuildBuildingPopupUiData(WalletBase wallet, Action<TileConfig> onClick, TileData tileData)
{
OnClick = onClick;
Wallet = wallet;
TileData = tileData;
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/ProductionIndicator.cs.meta
|
fileFormatVersion: 2
guid: d96c4acb851e34cc5b96ca9c035d4307
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/BalancingService.cs
|
using Lumberjack.Types;
using UnityEngine;
namespace DefaultNamespace
{
public class BalancingService
{
public class Cost
{
public ulong Wood;
public ulong Stone;
}
private const int BASE_SAWMILL_WOOD_COST = 10;
private const int BASE_SAWMILL_STONE_COST = 5;
private const int BASE_STONE_MINE_WOOD_COST = 5;
private const int BASE_STONE_MINE_STONE_COST = 10;
// Define the cost increase multiplier per level for the sawmill and stone mine
private const float SAWMILL_WOOD_COST_MULTIPLIER = 1.1f; // Increase by 10% per level
private const float SAWMILL_STONE_COST_MULTIPLIER = 1.05f; // Increase by 5% per level
private const float STONE_MINE_WOOD_COST_MULTIPLIER = 1.05f; // Increase by 5% per level
private const float STONE_MINE_STONE_COST_MULTIPLIER = 1.1f; // Increase by 10% per level
public static ulong RefillEnergyCost = 3;
public static Cost GetUpgradeCost(TileData tileData)
{
Cost newCost = new Cost();
if (tileData.BuildingType == LumberjackService.BUILDING_TYPE_SAWMILL)
{
newCost.Wood = CalculateSawmillWoodUpgradeCost(tileData.BuildingLevel);
newCost.Stone = CalculateSawmillStoneUpgradeCost(tileData.BuildingLevel);
} else if (tileData.BuildingType == LumberjackService.BUILDING_TYPE_MINE)
{
newCost.Wood = CalculateStoneMineWoodUpgradeCost(tileData.BuildingLevel);
newCost.Stone = CalculateStoneMineStoneUpgradeCost(tileData.BuildingLevel);
} else if (tileData.BuildingType == LumberjackService.BUILDING_TYPE_GOOD)
{
newCost.Wood = CalculateGoodWoodUpgradeCost(tileData.BuildingLevel);
newCost.Stone = CalculateGoodStoneUpgradeCost(tileData.BuildingLevel);
} else if (tileData.BuildingType == LumberjackService.BUILDING_TYPE_EVIL)
{
newCost.Wood = CalculateEvilWoodUpgradeCost(tileData.BuildingLevel);
newCost.Stone = CalculateEvilStoneUpgradeCost(tileData.BuildingLevel);
}
return newCost;
}
public static Cost GetBuildCost(TileConfig tileConfig)
{
Cost newCost = new Cost();
if (tileConfig.building_type == LumberjackService.BUILDING_TYPE_SAWMILL)
{
newCost.Wood = CalculateSawmillWoodBuildCost();
newCost.Stone = CalculateSawmillStoneBuildCost();
} else if (tileConfig.building_type == LumberjackService.BUILDING_TYPE_MINE)
{
newCost.Wood = CalculateStoneMineWoodBuildCost();
newCost.Stone = CalculateStoneMineStoneBuildCost();
}
return newCost;
}
public static ulong CalculateSawmillWoodUpgradeCost(uint buildingLevel)
{
int sawmillWoodCost = Mathf.RoundToInt(BASE_SAWMILL_WOOD_COST * Mathf.Pow(SAWMILL_WOOD_COST_MULTIPLIER, buildingLevel));
return (ulong ) sawmillWoodCost;
}
public static ulong CalculateSawmillStoneUpgradeCost(uint buildingLevel)
{
int sawmillStoneCost = Mathf.RoundToInt(BASE_SAWMILL_STONE_COST * Mathf.Pow(SAWMILL_STONE_COST_MULTIPLIER, buildingLevel));
return (ulong )sawmillStoneCost;
}
public static ulong CalculateStoneMineWoodUpgradeCost(uint buildingLevel)
{
int stoneMineWoodCost = Mathf.RoundToInt(BASE_STONE_MINE_WOOD_COST * Mathf.Pow(STONE_MINE_WOOD_COST_MULTIPLIER, buildingLevel));
return (ulong )stoneMineWoodCost;
}
public static ulong CalculateStoneMineStoneUpgradeCost(uint buildingLevel)
{
int stoneMineStoneCost = Mathf.RoundToInt(BASE_STONE_MINE_STONE_COST * Mathf.Pow(STONE_MINE_STONE_COST_MULTIPLIER, buildingLevel));
return (ulong )stoneMineStoneCost;
}
public static ulong CalculateGoodStoneUpgradeCost(uint buildingLevel)
{
int stoneMineStoneCost = Mathf.RoundToInt(15 * Mathf.Pow(1.1f, buildingLevel));
return (ulong )stoneMineStoneCost;
}
public static ulong CalculateGoodWoodUpgradeCost(uint buildingLevel)
{
int stoneMineStoneCost = Mathf.RoundToInt(15 * Mathf.Pow(1.1f, buildingLevel));
return (ulong )stoneMineStoneCost;
}
public static ulong CalculateEvilStoneUpgradeCost(uint buildingLevel)
{
int stoneMineStoneCost = Mathf.RoundToInt(15 * Mathf.Pow(1.1f, buildingLevel));
return (ulong )stoneMineStoneCost;
}
public static ulong CalculateEvilWoodUpgradeCost(uint buildingLevel)
{
int stoneMineStoneCost = Mathf.RoundToInt(15 * Mathf.Pow(1.1f, buildingLevel));
return (ulong )stoneMineStoneCost;
}
public static ulong CalculateSawmillWoodBuildCost()
{
return (ulong ) 0;
}
public static ulong CalculateSawmillStoneBuildCost()
{
return (ulong ) 15;
}
public static ulong CalculateStoneMineWoodBuildCost()
{
return (ulong )15;
}
public static ulong CalculateStoneMineStoneBuildCost()
{
return (ulong )0;
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/ChopTreePopupUiData.cs
|
using System;
using Solana.Unity.SDK;
using SolPlay.Scripts.Services;
public class ChopTreePopupUiData : UiService.UiData
{
public WalletBase Wallet;
public Action OnClick;
public ChopTreePopupUiData(WalletBase wallet, Action onClick)
{
Wallet = wallet;
OnClick = onClick;
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Tile.cs
|
using System;
using System.Collections;
using DefaultNamespace;
using DG.Tweening;
using Lumberjack.Types;
using Unity.VisualScripting;
using UnityEngine;
public class Tile : MonoBehaviour
{
public bool IsLocked;
public TileConfig currentConfig;
public TileData currentTileData;
public AudioClip MergeClip;
public AudioSource MergeAudioSource;
public Cell Cell;
private Vector3 originalScale;
private GameObject Model;
private CollectionIndicator _collectionIndicator;
private ProductionIndicator _productionIndicator;
private void Awake()
{
var cachedTransform = transform;
originalScale = cachedTransform.localScale;
cachedTransform.localScale = Vector3.zero;
transform.DOScale(originalScale, 0.15f);
}
public void Init(TileConfig config, TileData tileData, bool updateVisuals = true)
{
currentConfig = config;
currentTileData = tileData;
if (updateVisuals)
{
UpdateVisualState();
}
}
public void UpdateVisualState()
{
if (Model == null || Model.name != currentConfig.Prefab.name)
{
Destroy(Model);
Model = Instantiate(currentConfig.Prefab, transform);
Model.name = currentConfig.Prefab.name;
}
StartCoroutine(DoNextFrame());
}
private IEnumerator DoNextFrame()
{
yield return null;
yield return null;
_productionIndicator = GetComponentInChildren<ProductionIndicator>(true);
if (_productionIndicator != null)
{
_productionIndicator.SetData(currentTileData);
}
var healthbar = GetComponentInChildren<HealthBar>(true);
if (healthbar != null)
{
healthbar.SetData((int) currentTileData.BuildingHealth, 9000);
}
}
public void Spawn(Cell cell)
{
if (Cell != null) {
Cell.Tile = null;
}
Cell = cell;
Cell.Tile = this;
transform.position = cell.transform.position;
}
public void PlaySpawnSound(AudioClip mergeClip = null)
{
MergeAudioSource.pitch = 1 + 0.06f * (currentConfig.Index);
if (mergeClip != null)
{
MergeAudioSource.PlayOneShot(mergeClip);
}
else
{
MergeAudioSource.PlayOneShot(MergeClip);
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/CostWidget.cs
|
using Lumberjack.Types;
using TMPro;
using UnityEngine;
namespace DefaultNamespace
{
public class CostWidget : MonoBehaviour
{
public TextMeshProUGUI WoodCost;
public TextMeshProUGUI StoneCost;
public TextMeshProUGUI NotEnoughResources;
public void SetDataUpgradeCost(TileData tiledata)
{
BalancingService.Cost upgradeCost = BalancingService.GetUpgradeCost(tiledata);
SetCost(upgradeCost);
}
public void SetDataBuildCost(TileConfig config)
{
BalancingService.Cost cost = BalancingService.GetBuildCost(config);
SetCost(cost);
}
private void SetCost(BalancingService.Cost upgradeCost)
{
WoodCost.text = upgradeCost.Wood.ToString();
StoneCost.text = upgradeCost.Stone.ToString();
var hasEnoughWood = upgradeCost.Wood <= LumberjackService.Instance.CurrentBoardAccount.Wood;
WoodCost.color = hasEnoughWood ? Color.white : Color.red;
var hasEnoughStone = upgradeCost.Stone <= LumberjackService.Instance.CurrentBoardAccount.Stone;
StoneCost.color = hasEnoughStone ? Color.white : Color.red;
NotEnoughResources.gameObject.SetActive(!LumberjackService.HasEnoughResources(upgradeCost));
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftItemListView.cs.meta
|
fileFormatVersion: 2
guid: d0e266ef90f54494bbd77ded7a8f4201
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/BasePopup.cs.meta
|
fileFormatVersion: 2
guid: b54549bd3faf4cb399338343fb9093d2
timeCreated: 1664440654
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftListPopup.cs
|
using Frictionless;
using SolPlay.Scripts.Services;
using SolPlay.Scripts.Ui;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// Screen that loads all NFTs when opened
/// </summary>
public class NftListPopup : BasePopup
{
public Button GetNFtsDataButton;
public Button MintInAppButton;
public NftItemListView NftItemListView;
public GameObject YouDontOwnANftOfCollectionRoot;
public GameObject YouOwnANftOfCollectionRoot;
public GameObject LoadingSpinner;
public GameObject MinitingBlocker;
void Start()
{
GetNFtsDataButton.onClick.AddListener(OnGetNftButtonClicked);
MintInAppButton.onClick.AddListener(OnMintInAppButtonClicked);
MessageRouter
.AddHandler<NftLoadingStartedMessage>(OnNftLoadingStartedMessage);
MessageRouter
.AddHandler<NftLoadingFinishedMessage>(OnNftLoadingFinishedMessage);
MessageRouter
.AddHandler<NftLoadedMessage>(OnNftLoadedMessage);
MessageRouter
.AddHandler<NftMintFinishedMessage>(OnNftMintFinishedMessage);
MessageRouter
.AddHandler<NftSelectedMessage>(OnNftSelectedMessage);
}
private void OnNftSelectedMessage(NftSelectedMessage obj)
{
Close();
}
public override void Open(UiService.UiData uiData)
{
var nftListPopupUiData = (uiData as NftListPopupUiData);
if (nftListPopupUiData == null)
{
Debug.LogError("Wrong ui data for nft list popup");
return;
}
NftItemListView.UpdateContent();
NftItemListView.SetData(nft =>
{
// when an nft was selected we want to close the popup so we can start the game.
Close();
});
base.Open(uiData);
}
private async void OnMintInAppButtonClicked()
{
if (MinitingBlocker != null)
{
MinitingBlocker.gameObject.SetActive(true);
}
// Mint a pirate sship
var signature = await ServiceFactory.Resolve<NftMintingService>()
.MintNftWithMetaData(
"https://shdw-drive.genesysgo.net/QZNGUVnJgkw6sGQddwZVZkhyUWSUXAjXF9HQAjiVZ55/DummyPirateShipMetaData.json",
"Simple Pirate Ship", "Pirate", b =>
{
if (MinitingBlocker != null)
{
MinitingBlocker.gameObject.SetActive(false);
}
if (b)
{
RequestNfts();
}
});
Debug.Log("Mint signature: " + signature);
}
private void OnNftLoadedMessage(NftLoadedMessage message)
{
NftItemListView.AddNFt(message.Nft);
UpdateOwnCollectionStatus();
}
private bool UpdateOwnCollectionStatus()
{
var nftService = ServiceFactory.Resolve<NftService>();
bool ownsBeaver = nftService.OwnsNftOfMintAuthority(NftService.NftMintAuthority);
YouDontOwnANftOfCollectionRoot.gameObject.SetActive(!ownsBeaver);
YouOwnANftOfCollectionRoot.gameObject.SetActive(ownsBeaver);
return ownsBeaver;
}
private void OnGetNftButtonClicked()
{
RequestNfts();
}
private void OnNftLoadingStartedMessage(NftLoadingStartedMessage message)
{
GetNFtsDataButton.interactable = false;
}
private void OnNftLoadingFinishedMessage(NftLoadingFinishedMessage message)
{
NftItemListView.UpdateContent();
}
private void OnNftMintFinishedMessage(NftMintFinishedMessage message)
{
RequestNfts();
}
private void Update()
{
var nftService = ServiceFactory.Resolve<NftService>();
if (nftService != null)
{
GetNFtsDataButton.interactable = !nftService.IsLoadingTokenAccounts;
LoadingSpinner.gameObject.SetActive(nftService.IsLoadingTokenAccounts);
}
}
private void RequestNfts()
{
ServiceFactory.Resolve<NftService>().LoadNfts();
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/TokenPanel.cs.meta
|
fileFormatVersion: 2
guid: b3585658f03574e5a97ec9242044a592
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/UiService.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using Frictionless;
using SolPlay.Scripts.Ui;
using UnityEngine;
using UnityEngine.EventSystems;
namespace SolPlay.Scripts.Services
{
public class UiService : MonoBehaviour, IMultiSceneSingleton
{
[Serializable]
public class UiRegistration
{
public BasePopup PopupPrefab;
public ScreenType ScreenType;
}
public enum ScreenType
{
TransferNftPopup = 0,
NftListPopup = 1,
RefillEnergyPopup = 2,
UpgradeBuildingPopup = 3,
BuildBuildingPopup = 4,
ChopTreePopup = 5,
}
public class UiData
{
}
public List<UiRegistration> UiRegistrations = new List<UiRegistration>();
private readonly Dictionary<ScreenType, BasePopup> openPopups = new Dictionary<ScreenType, BasePopup>();
public void Awake()
{
ServiceFactory.RegisterSingleton(this);
}
public void OpenPopup(ScreenType screenType, UiData uiData)
{
if (openPopups.TryGetValue(screenType, out BasePopup basePopup))
{
basePopup.Open(uiData);
return;
}
foreach (var uiRegistration in UiRegistrations)
{
if (uiRegistration.ScreenType == screenType)
{
BasePopup newPopup = Instantiate(uiRegistration.PopupPrefab);
openPopups.Add(screenType, newPopup);
newPopup.Open(uiData);
return;
}
}
Debug.LogWarning("There was no screen registration for " + screenType);
}
public static bool IsPointerOverUIObject()
{
PointerEventData eventDataCurrentPosition = new PointerEventData(EventSystem.current);
eventDataCurrentPosition.position = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
List<RaycastResult> results = new List<RaycastResult>();
EventSystem.current.RaycastAll(eventDataCurrentPosition, results);
return results.Count > 0;
}
public IEnumerator HandleNewSceneLoaded()
{
openPopups.Clear();
yield return null;
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftMintingService.cs.meta
|
fileFormatVersion: 2
guid: 7200cbf09ed7438eb4005bbcf351e7f7
timeCreated: 1665216069
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/SimpleRotate.cs
|
using UnityEngine;
namespace SolPlay.FlappyGame.Runtime.Scripts
{
public class SimpleRotate : MonoBehaviour
{
public enum Axis
{
x,
y,
z
}
public float speed = 0.1f;
public Axis RotationAxis = Axis.x;
void Update()
{
var rotationAxis = Vector3.zero;
switch (RotationAxis)
{
case Axis.x:
rotationAxis = Vector3.forward;
break;
case Axis.y:
rotationAxis = Vector3.up;
break;
case Axis.z:
rotationAxis = Vector3.right;
break;
}
transform.Rotate(rotationAxis * Time.deltaTime, speed);
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/UpgradeBuildingPopupUiData.cs.meta
|
fileFormatVersion: 2
guid: b359a686413f41b6a21ba5a2304c91be
timeCreated: 1690569053
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Tile.cs.meta
|
fileFormatVersion: 2
guid: cc400c92ec3249f09692ed4cc8b52cb4
timeCreated: 1690459933
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/LumberjackService.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using DefaultNamespace;
using Frictionless;
using Lumberjack;
using Lumberjack.Accounts;
using Lumberjack.Program;
using Lumberjack.Types;
using Solana.Unity.Programs;
using Solana.Unity.Programs.Models;
using Solana.Unity.Rpc.Core.Http;
using Solana.Unity.Rpc.Models;
using Solana.Unity.Rpc.Types;
using Solana.Unity.SDK;
using Solana.Unity.Wallet;
using SolPlay.Scripts.Services;
using UnityEngine;
public class LumberjackService : MonoBehaviour
{
public PublicKey LumberjackProgramIdPubKey = new PublicKey("HsT4yX959Qh1vis8fEqoQdgrHEJuKvaWGtHoPcTjk4mJ");
public const int TIME_TO_REFILL_ENERGY = 60;
public const int MAX_ENERGY = 10;
public const byte BUILDING_TYPE_TREE = 0;
public const byte BUILDING_TYPE_EMPTY = 1;
public const byte BUILDING_TYPE_SAWMILL = 2;
public const byte BUILDING_TYPE_MINE = 3;
public const byte BUILDING_TYPE_GOOD = 4;
public const byte BUILDING_TYPE_EVIL = 5;
public static LumberjackService Instance { get; private set; }
public static Action<PlayerData> OnPlayerDataChanged;
public static Action<BoardAccount> OnBoardDataChanged;
public static Action<GameActionHistory> OnGameActionHistoryChanged;
public static Action OnInitialDataLoaded;
public bool IsAnyTransactionInProgress => transactionsInProgress > 0;
public PlayerData CurrentPlayerData;
public BoardAccount CurrentBoardAccount;
public GameActionHistory CurrentGameActionHistory;
private SessionWallet sessionWallet;
private PublicKey PlayerDataPDA;
private PublicKey BoardPDA;
private PublicKey GameActionsPDA;
private bool _isInitialized;
private LumberjackClient lumberjackClient;
private int transactionsInProgress;
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(this);
}
else
{
Instance = this;
}
Web3.OnLogin += OnLogin;
}
private void OnDestroy()
{
Web3.OnLogin -= OnLogin;
}
private async void OnLogin(Account account)
{
var solBalance = await Web3.Instance.WalletBase.GetBalance(Commitment.Confirmed);
if (solBalance < 20000)
{
Debug.Log("Not enough sol. Requsting airdrop");
var result = await Web3.Instance.WalletBase.RequestAirdrop(commitment: Commitment.Confirmed);
if (!result.WasSuccessful)
{
Debug.Log("Airdrop failed.");
}
}
PublicKey.TryFindProgramAddress(new[]
{Encoding.UTF8.GetBytes("player"), account.PublicKey.KeyBytes},
LumberjackProgramIdPubKey, out PlayerDataPDA, out byte bump);
PublicKey.TryFindProgramAddress(new[]
{Encoding.UTF8.GetBytes("board")},
LumberjackProgramIdPubKey, out BoardPDA, out byte bump2);
PublicKey.TryFindProgramAddress(new[]
{Encoding.UTF8.GetBytes("gameActions")},
LumberjackProgramIdPubKey, out GameActionsPDA, out byte bump3);
lumberjackClient = new LumberjackClient(Web3.Rpc, Web3.WsRpc, LumberjackProgramIdPubKey);
ServiceFactory.Resolve<SolPlayWebSocketService>().Connect(Web3.WsRpc.NodeAddress.AbsoluteUri);
await SubscribeToPlayerDataUpdates();
sessionWallet = await SessionWallet.GetSessionWallet(LumberjackProgramIdPubKey, "ingame");
OnInitialDataLoaded?.Invoke();
}
public bool IsInitialized()
{
return _isInitialized;
}
private async Task SubscribeToPlayerDataUpdates()
{
AccountResultWrapper<PlayerData> playerData = null;
try
{
playerData = await lumberjackClient.GetPlayerDataAsync(PlayerDataPDA, Commitment.Confirmed);
if (playerData.ParsedResult != null)
{
CurrentPlayerData = playerData.ParsedResult;
OnPlayerDataChanged?.Invoke(playerData.ParsedResult);
}
_isInitialized = true;
}
catch (Exception e)
{
Debug.Log("Probably playerData not available " + e.Message);
}
AccountResultWrapper<BoardAccount> boardAccount = null;
try
{
boardAccount = await lumberjackClient.GetBoardAccountAsync(BoardPDA, Commitment.Confirmed);
if (boardAccount.ParsedResult != null)
{
CurrentBoardAccount = boardAccount.ParsedResult;
OnBoardDataChanged?.Invoke(boardAccount.ParsedResult);
}
}
catch (Exception e)
{
Debug.Log("Probably playerData not available " + e.Message);
}
AccountResultWrapper<GameActionHistory> gameActionHistroy = null;
try
{
gameActionHistroy = await lumberjackClient.GetGameActionHistoryAsync(GameActionsPDA, Commitment.Confirmed);
if (gameActionHistroy.ParsedResult != null)
{
CurrentGameActionHistory = gameActionHistroy.ParsedResult;
OnGameActionHistoryChanged?.Invoke(gameActionHistroy.ParsedResult);
}
}
catch (Exception e)
{
Debug.Log("gameActionHistroy not available " + e.Message);
}
ServiceFactory.Resolve<SolPlayWebSocketService>().SubscribeToPubKeyData(PlayerDataPDA, result =>
{
var playerData = PlayerData.Deserialize(Convert.FromBase64String(result.result.value.data[0]));
Debug.Log("Player data socket " + playerData.Energy + " energy");
CurrentPlayerData = playerData;
OnPlayerDataChanged?.Invoke(playerData);
});
ServiceFactory.Resolve<SolPlayWebSocketService>().SubscribeToPubKeyData(BoardPDA, result =>
{
var boardAccount = BoardAccount.Deserialize(Convert.FromBase64String(result.result.value.data[0]));
Debug.Log("Player data socket " + boardAccount.Wood + " wood");
CurrentBoardAccount = boardAccount;
OnBoardDataChanged?.Invoke(boardAccount);
});
ServiceFactory.Resolve<SolPlayWebSocketService>().SubscribeToPubKeyData(GameActionsPDA, result =>
{
var gameActionHistory = GameActionHistory.Deserialize(Convert.FromBase64String(result.result.value.data[0]));
Debug.Log("GameActions data socket new game action: " + gameActionHistory.GameActions[0].ActionType + " by " + gameActionHistory.GameActions[0].Player + " is collectable: " + IsCollectable(gameActionHistory.GameActions[0].Tile));
CurrentGameActionHistory = gameActionHistory;
OnGameActionHistoryChanged?.Invoke(gameActionHistory);
});
}
public async Task<RequestResult<string>> InitGameDataAccount(bool useSession)
{
var tx = new Transaction()
{
FeePayer = Web3.Account,
Instructions = new List<TransactionInstruction>(),
RecentBlockHash = await Web3.BlockHash()
};
InitPlayerAccounts accounts = new InitPlayerAccounts();
accounts.Player = PlayerDataPDA;
accounts.Board = BoardPDA;
accounts.GameActions = GameActionsPDA;
accounts.Signer = Web3.Account;
accounts.SystemProgram = SystemProgram.ProgramIdKey;
var initTx = LumberjackProgram.InitPlayer(accounts, LumberjackProgramIdPubKey);
tx.Add(initTx);
if (useSession)
{
if (!(await sessionWallet.IsSessionTokenInitialized()))
{
var topUp = true;
var validity = DateTimeOffset.UtcNow.AddHours(23).ToUnixTimeSeconds();
var createSessionIX = sessionWallet.CreateSessionIX(topUp, validity);
accounts.Signer = Web3.Account.PublicKey;
tx.Add(createSessionIX);
Debug.Log("Has no session -> partial sign");
tx.PartialSign(new[] { Web3.Account, sessionWallet.Account });
}
}
var initResult = await Web3.Wallet.SignAndSendTransaction(tx, commitment: Commitment.Confirmed);
Debug.Log(initResult.RawRpcResponse);
await Web3.Rpc.ConfirmTransaction(initResult.Result, Commitment.Confirmed);
await SubscribeToPlayerDataUpdates();
return initResult;
}
public async Task<RequestResult<string>> RestartGame()
{
var tx = new Transaction()
{
FeePayer = Web3.Account,
Instructions = new List<TransactionInstruction>(),
RecentBlockHash = await Web3.BlockHash()
};
RestartGameAccounts accounts = new RestartGameAccounts();
accounts.Board = BoardPDA;
accounts.GameActions = GameActionsPDA;
accounts.Signer = Web3.Account;
accounts.SystemProgram = SystemProgram.ProgramIdKey;
var initTx = LumberjackProgram.RestartGame(accounts, LumberjackProgramIdPubKey);
tx.Add(initTx);
var initResult = await Web3.Wallet.SignAndSendTransaction(tx, commitment: Commitment.Confirmed);
Debug.Log(initResult.RawRpcResponse);
await Web3.Rpc.ConfirmTransaction(initResult.Result, Commitment.Confirmed);
await SubscribeToPlayerDataUpdates();
return initResult;
}
public async Task<SessionWallet> RevokeSession()
{
await sessionWallet.PrepareLogout();
sessionWallet.Logout();
return sessionWallet;
}
public async void ChopTree(bool useSession, byte x, byte y)
{
var tx = new Transaction()
{
FeePayer = Web3.Account,
Instructions = new List<TransactionInstruction>(),
RecentBlockHash = await Web3.BlockHash(maxSeconds:1)
};
ChopTreeAccounts accounts = new ChopTreeAccounts();
accounts.Player = PlayerDataPDA;
accounts.Board = BoardPDA;
accounts.GameActions = GameActionsPDA;
accounts.Avatar = GetAvatar();
if (useSession)
{
if (!(await sessionWallet.IsSessionTokenInitialized()))
{
var topUp = true;
var validity = DateTimeOffset.UtcNow.AddHours(23).ToUnixTimeSeconds();
var createSessionIX = sessionWallet.CreateSessionIX(topUp, validity);
accounts.Signer = Web3.Account.PublicKey;
tx.Add(createSessionIX);
var chopInstruction = LumberjackProgram.ChopTree(accounts, x, y, LumberjackProgramIdPubKey);
tx.Add(chopInstruction);
Debug.Log("Has no session -> partial sign");
tx.PartialSign(new[] { Web3.Account, sessionWallet.Account });
SendAndConfirmTransaction(Web3.Wallet, tx, "Chop Tree and init session");
}
else
{
tx.FeePayer = sessionWallet.Account.PublicKey;
accounts.SessionToken = sessionWallet.SessionTokenPDA;
accounts.Signer = sessionWallet.Account.PublicKey;
Debug.Log("Has session -> sign and send session wallet");
var chopInstruction = LumberjackProgram.ChopTree(accounts, x, y, LumberjackProgramIdPubKey);
tx.Add(chopInstruction);
SendAndConfirmTransaction(sessionWallet, tx, "Chop Tree");
}
}
else
{
tx.FeePayer = Web3.Account.PublicKey;
accounts.Signer = Web3.Account.PublicKey;
var chopInstruction = LumberjackProgram.ChopTree(accounts, x, y, LumberjackProgramIdPubKey);
tx.Add(chopInstruction);
Debug.Log("Sign without session");
SendAndConfirmTransaction(Web3.Wallet, tx, "Chop Tree without session");
}
}
public async void Build(bool useSession, byte x, byte y, byte buildingType)
{
var tx = new Transaction()
{
FeePayer = Web3.Account,
Instructions = new List<TransactionInstruction>(),
RecentBlockHash = await Web3.BlockHash(maxSeconds:1)
};
BuildAccounts accounts = new BuildAccounts();
accounts.Player = PlayerDataPDA;
accounts.Board = BoardPDA;
accounts.GameActions = GameActionsPDA;
accounts.Avatar = GetAvatar();
if (useSession)
{
if (!(await sessionWallet.IsSessionTokenInitialized()))
{
var topUp = true;
var validity = DateTimeOffset.UtcNow.AddHours(23).ToUnixTimeSeconds();
var createSessionIX = sessionWallet.CreateSessionIX(topUp, validity);
accounts.Signer = Web3.Account.PublicKey;
tx.Add(createSessionIX);
var chopInstruction = LumberjackProgram.Build(accounts, x, y, buildingType, LumberjackProgramIdPubKey);
tx.Add(chopInstruction);
Debug.Log("Has no session -> partial sign");
tx.PartialSign(new[] { Web3.Account, sessionWallet.Account });
SendAndConfirmTransaction(Web3.Wallet, tx, "Build and init session");
}
else
{
tx.FeePayer = sessionWallet.Account.PublicKey;
accounts.SessionToken = sessionWallet.SessionTokenPDA;
accounts.Signer = sessionWallet.Account.PublicKey;
Debug.Log("Has session -> sign and send session wallet");
var chopInstruction = LumberjackProgram.Build(accounts, x, y, buildingType, LumberjackProgramIdPubKey);
tx.Add(chopInstruction);
SendAndConfirmTransaction(sessionWallet, tx, "Build");
}
}
else
{
tx.FeePayer = Web3.Account.PublicKey;
accounts.Signer = Web3.Account.PublicKey;
var chopInstruction = LumberjackProgram.Build(accounts, x, y, buildingType, LumberjackProgramIdPubKey);
tx.Add(chopInstruction);
Debug.Log("Sign without session");
SendAndConfirmTransaction(Web3.Wallet, tx, "Build without session");
}
}
public async void Upgrade(bool useSession, byte x, byte y)
{
var tx = new Transaction()
{
FeePayer = Web3.Account,
Instructions = new List<TransactionInstruction>(),
RecentBlockHash = await Web3.BlockHash(maxSeconds:1)
};
UpgradeAccounts accounts = new UpgradeAccounts();
accounts.Player = PlayerDataPDA;
accounts.Board = BoardPDA;
accounts.GameActions = GameActionsPDA;
accounts.Avatar = GetAvatar();
if (useSession)
{
if (!(await sessionWallet.IsSessionTokenInitialized()))
{
var topUp = true;
var validity = DateTimeOffset.UtcNow.AddHours(23).ToUnixTimeSeconds();
var createSessionIX = sessionWallet.CreateSessionIX(topUp, validity);
accounts.Signer = Web3.Account.PublicKey;
tx.Add(createSessionIX);
var chopInstruction = LumberjackProgram.Upgrade(accounts, x, y, LumberjackProgramIdPubKey);
tx.Add(chopInstruction);
Debug.Log("Has no session -> partial sign");
tx.PartialSign(new[] { Web3.Account, sessionWallet.Account });
SendAndConfirmTransaction(Web3.Wallet, tx, "Upgrade and init session");
}
else
{
tx.FeePayer = sessionWallet.Account.PublicKey;
accounts.SessionToken = sessionWallet.SessionTokenPDA;
accounts.Signer = sessionWallet.Account.PublicKey;
Debug.Log("Has session -> sign and send session wallet");
var chopInstruction = LumberjackProgram.Upgrade(accounts, x, y, LumberjackProgramIdPubKey);
tx.Add(chopInstruction);
SendAndConfirmTransaction(sessionWallet, tx, "Upgrade");
}
}
else
{
tx.FeePayer = Web3.Account.PublicKey;
accounts.Signer = Web3.Account.PublicKey;
var chopInstruction = LumberjackProgram.Upgrade(accounts, x, y, LumberjackProgramIdPubKey);
tx.Add(chopInstruction);
Debug.Log("Sign without session");
SendAndConfirmTransaction(Web3.Wallet, tx, "Upgrade without session");
}
}
private PublicKey GetAvatar()
{
var nftService = ServiceFactory.Resolve<NftService>();
if (nftService.SelectedNft != null)
{
return new PublicKey(nftService.SelectedNft.metaplexData.data.mint);
}
return Web3.Account.PublicKey;
}
public async void Collect(bool useSession, byte x, byte y)
{
var tx = new Transaction()
{
FeePayer = Web3.Account,
Instructions = new List<TransactionInstruction>(),
RecentBlockHash = await Web3.BlockHash(maxSeconds:1)
};
CollectAccounts accounts = new CollectAccounts();
accounts.Player = PlayerDataPDA;
accounts.Board = BoardPDA;
accounts.GameActions = GameActionsPDA;
accounts.Avatar = GetAvatar();
if (useSession)
{
if (!(await sessionWallet.IsSessionTokenInitialized()))
{
var topUp = true;
var validity = DateTimeOffset.UtcNow.AddHours(23).ToUnixTimeSeconds();
var createSessionIX = sessionWallet.CreateSessionIX(topUp, validity);
accounts.Signer = Web3.Account.PublicKey;
tx.Add(createSessionIX);
var chopInstruction = LumberjackProgram.Collect(accounts, x, y, LumberjackProgramIdPubKey);
tx.Add(chopInstruction);
Debug.Log("Has no session -> partial sign");
tx.PartialSign(new[] { Web3.Account, sessionWallet.Account });
SendAndConfirmTransaction(Web3.Wallet, tx, "Collect and init session");
}
else
{
tx.FeePayer = sessionWallet.Account.PublicKey;
accounts.SessionToken = sessionWallet.SessionTokenPDA;
accounts.Signer = sessionWallet.Account.PublicKey;
Debug.Log("Has session -> sign and send session wallet");
var chopInstruction = LumberjackProgram.Collect(accounts, x, y, LumberjackProgramIdPubKey);
tx.Add(chopInstruction);
SendAndConfirmTransaction(sessionWallet, tx, "Collect");
}
}
else
{
tx.FeePayer = Web3.Account.PublicKey;
accounts.Signer = Web3.Account.PublicKey;
var chopInstruction = LumberjackProgram.Collect(accounts, x, y, LumberjackProgramIdPubKey);
tx.Add(chopInstruction);
Debug.Log("Sign without session");
SendAndConfirmTransaction(Web3.Wallet, tx, "Collect without session");
}
}
private async void SendAndConfirmTransaction(WalletBase wallet, Transaction transaction, string label = "")
{
transactionsInProgress++;
var res= await wallet.SignAndSendTransaction(transaction, commitment: Commitment.Confirmed);
if (res.WasSuccessful && res.Result != null)
{
await Web3.Rpc.ConfirmTransaction(res.Result, Commitment.Confirmed);
}
Debug.Log($"Send tranaction {label} with response: {res.RawRpcResponse}");
transactionsInProgress--;
}
public static bool IsCollectable(TileData tileData)
{
long unixTime = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds();
var tileDataBuildingStartCollectTime = tileData.BuildingStartCollectTime + new TimeSpan(0,0,61).TotalSeconds;
//Debug.Log("Time: " + tileDataBuildingStartCollectTime + " current time " + unixTime + " diff " + (unixTime - tileDataBuildingStartCollectTime));
return tileDataBuildingStartCollectTime < unixTime;
}
public static string GetName(TileData tileData)
{
switch (tileData.BuildingType)
{
case BUILDING_TYPE_MINE:
return "Stone mine";
case BUILDING_TYPE_TREE:
return "Tree";
case BUILDING_TYPE_EMPTY:
return "empty";
case BUILDING_TYPE_SAWMILL:
return "Sawmill";
}
return "NaN";
}
public void OnCellClicked(byte x, byte y)
{
var cell = ServiceFactory.Resolve<BoardManager>().GetCell(x, y);
var tileData = CurrentBoardAccount.Data[x][y];
if (tileData.BuildingType == BUILDING_TYPE_EVIL || tileData.BuildingType == BUILDING_TYPE_GOOD)
{
var uiData = new UpgradeBuildingPopupUiData(Web3.Wallet, () =>
{
Upgrade(!Web3.Rpc.NodeAddress.AbsoluteUri.Contains("localhost"), x, y);
}, tileData);
ServiceFactory.Resolve<UiService>().OpenPopup(UiService.ScreenType.UpgradeBuildingPopup, uiData);
}else if (tileData.BuildingType == BUILDING_TYPE_EMPTY)
{
if (!CheckForEnergy(1))
{
return;
}
// Build
var uiData = new BuildBuildingPopupUiData(Web3.Wallet, config =>
{
Build(!Web3.Rpc.NodeAddress.AbsoluteUri.Contains("localhost"), x, y, config.building_type);
}, tileData);
ServiceFactory.Resolve<UiService>().OpenPopup(UiService.ScreenType.BuildBuildingPopup, uiData);
} else if (tileData.BuildingType == BUILDING_TYPE_TREE)
{
if (!CheckForEnergy(3))
{
return;
}
var uiData = new ChopTreePopupUiData(Web3.Wallet, () =>
{
ChopTree(!Web3.Rpc.NodeAddress.AbsoluteUri.Contains("localhost"), x, y);
});
ServiceFactory.Resolve<UiService>().OpenPopup(UiService.ScreenType.ChopTreePopup, uiData);
} else if (tileData.BuildingType == BUILDING_TYPE_MINE ||
tileData.BuildingType == BUILDING_TYPE_SAWMILL)
{
if (!CheckForEnergy(1))
{
return;
}
if (IsCollectable(tileData))
{
// Collect
Collect(!Web3.Rpc.NodeAddress.AbsoluteUri.Contains("localhost"), x, y);
}
else
{
var uiData = new UpgradeBuildingPopupUiData(Web3.Wallet, () =>
{
Upgrade(!Web3.Rpc.NodeAddress.AbsoluteUri.Contains("localhost"), x, y);
}, tileData);
ServiceFactory.Resolve<UiService>().OpenPopup(UiService.ScreenType.UpgradeBuildingPopup, uiData);
}
}
}
private bool CheckForEnergy(ulong amountNeeded)
{
if (CurrentPlayerData.Energy < amountNeeded)
{
ServiceFactory.Resolve<UiService>().OpenPopup(UiService.ScreenType.RefillEnergyPopup, new RefillEnergyPopupUiData(Web3.Wallet));
return false;
}
return true;
}
public async Task RefillEnergy()
{
var tx = new Transaction()
{
FeePayer = Web3.Account,
Instructions = new List<TransactionInstruction>(),
RecentBlockHash = await Web3.BlockHash(maxSeconds:1)
};
RefillEnergyAccounts accounts = new RefillEnergyAccounts();
accounts.Player = PlayerDataPDA;
accounts.SystemProgram = SystemProgram.ProgramIdKey;
accounts.Treasury = new PublicKey("CYg2vSJdujzEC1E7kHMzB9QhjiPLRdsAa4Js7MkuXfYq");
tx.FeePayer = Web3.Account.PublicKey;
accounts.Signer = Web3.Account.PublicKey;
var ix = LumberjackProgram.RefillEnergy(accounts, LumberjackProgramIdPubKey);
tx.Add(ix);
SendAndConfirmTransaction(Web3.Wallet, tx, "Refill energy");
var res= await Web3.Wallet.SignAndSendTransaction(tx, commitment: Commitment.Confirmed);
if (res.WasSuccessful && res.Result != null)
{
await Web3.Rpc.ConfirmTransaction(res.Result, Commitment.Confirmed);
}
}
public static bool HasEnoughResources(BalancingService.Cost cost)
{
var hasEnoughWood = cost.Wood <= Instance.CurrentBoardAccount.Wood;
var hasEnoughStone = cost.Stone <= Instance.CurrentBoardAccount.Stone;
return hasEnoughWood && hasEnoughStone;
}
public static bool HasEnoughResources(ulong woodCost, ulong stoneCost)
{
var hasEnoughWood = woodCost <= Instance.CurrentBoardAccount.Wood;
var hasEnoughStone = stoneCost <= Instance.CurrentBoardAccount.Stone;
return hasEnoughWood && hasEnoughStone;
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftItemListView.cs
|
using System;
using System.Collections.Generic;
using Frictionless;
using Solana.Unity.SDK.Nft;
using SolPlay.Scripts.Services;
using SolPlay.Scripts.Ui;
using UnityEngine;
public class NftItemListView : MonoBehaviour
{
public GameObject ItemRoot;
public NftItemView itemPrefab;
public string FilterSymbol;
public string BlackList;
private List<NftItemView> allNftItemViews = new List<NftItemView>();
private Action<Nft> onNftSelected;
public void OnEnable()
{
UpdateContent();
}
public void Start()
{
MessageRouter.AddHandler<NftSelectedMessage>(OnNFtSelectedMessage);
}
public void SetData(Action<Nft> onNftSelected)
{
this.onNftSelected = onNftSelected;
}
private void OnNFtSelectedMessage(NftSelectedMessage message)
{
UpdateContent();
}
public void UpdateContent()
{
var nftService = ServiceFactory.Resolve<NftService>();
if (nftService == null)
{
return;
}
foreach (Nft nft in nftService.LoadedNfts)
{
AddNFt(nft);
}
List<NftItemView> notExistingNfts = new List<NftItemView>();
foreach (NftItemView nftItemView in allNftItemViews)
{
bool existsInWallet = false;
foreach (Nft walletNft in nftService.LoadedNfts)
{
if (nftItemView.CurrentSolPlayNft.metaplexData.data.mint == walletNft.metaplexData.data.mint)
{
existsInWallet = true;
break;
}
}
if (!existsInWallet)
{
notExistingNfts.Add(nftItemView);
}
}
for (var index = notExistingNfts.Count - 1; index >= 0; index--)
{
var nftView = notExistingNfts[index];
allNftItemViews.Remove(nftView);
Destroy(nftView.gameObject);
}
}
public void AddNFt(Nft newSolPlayNft)
{
foreach (var nft in allNftItemViews)
{
if (nft.CurrentSolPlayNft.metaplexData.data.mint == newSolPlayNft.metaplexData.data.mint)
{
// already exists
return;
}
}
InstantiateListNftItem(newSolPlayNft);
}
private void InstantiateListNftItem(Nft solPlayNft)
{
if (string.IsNullOrEmpty(solPlayNft.metaplexData.data.mint))
{
return;
}
if (!string.IsNullOrEmpty(FilterSymbol) && solPlayNft.metaplexData.data.offchainData.symbol != FilterSymbol)
{
return;
}
if (!string.IsNullOrEmpty(BlackList) && solPlayNft.metaplexData.data.offchainData.symbol == BlackList)
{
return;
}
NftItemView nftItemView = Instantiate(itemPrefab, ItemRoot.transform);
nftItemView.SetData(solPlayNft, OnItemClicked);
allNftItemViews.Add(nftItemView);
}
private void OnItemClicked(NftItemView itemView)
{
//Debug.Log("Item Clicked: " + itemView.CurrentSolPlayNft.metaplexData.data.offchainData.name);
ServiceFactory.Resolve<NftContextMenu>().Open(itemView, onNftSelected);
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/SafeArea.cs
|
using UnityEngine;
namespace SolPlay.Scripts.Ui
{
/// <summary>
/// Safe area implementation for notched mobile devices. Usage:
/// (1) Add this component to the top level of any GUI panel.
/// (2) If the panel uses a full screen background image, then create an immediate child and put the component on that instead, with all other elements childed below it.
/// This will allow the background image to stretch to the full extents of the screen behind the notch, which looks nicer.
/// (3) For other cases that use a mixture of full horizontal and vertical background stripes, use the Conform X & Y controls on separate elements as needed.
/// </summary>
public class SafeArea : MonoBehaviour
{
#region Simulations
/// <summary>
/// Simulation device that uses safe area due to a physical notch or software home bar. For use in Editor only.
/// </summary>
public enum SimDevice
{
/// <summary>
/// Don't use a simulated safe area - GUI will be full screen as normal.
/// </summary>
None,
/// <summary>
/// Simulate the iPhone X and Xs (identical safe areas).
/// </summary>
iPhoneX,
/// <summary>
/// Simulate the iPhone Xs Max and XR (identical safe areas).
/// </summary>
iPhoneXsMax,
/// <summary>
/// Simulate the Google Pixel 3 XL using landscape left.
/// </summary>
Pixel3XL_LSL,
/// <summary>
/// Simulate the Google Pixel 3 XL using landscape right.
/// </summary>
Pixel3XL_LSR
}
/// <summary>
/// Simulation mode for use in editor only. This can be edited at runtime to toggle between different safe areas.
/// </summary>
public static SimDevice Sim = SimDevice.None;
/// <summary>
/// Normalised safe areas for iPhone X with Home indicator (ratios are identical to Xs, 11 Pro). Absolute values:
/// PortraitU x=0, y=102, w=1125, h=2202 on full extents w=1125, h=2436;
/// PortraitD x=0, y=102, w=1125, h=2202 on full extents w=1125, h=2436 (not supported, remains in Portrait Up);
/// LandscapeL x=132, y=63, w=2172, h=1062 on full extents w=2436, h=1125;
/// LandscapeR x=132, y=63, w=2172, h=1062 on full extents w=2436, h=1125.
/// Aspect Ratio: ~19.5:9.
/// </summary>
Rect[] NSA_iPhoneX = new Rect[]
{
new Rect(0f, 102f / 2436f, 1f, 2202f / 2436f), // Portrait
new Rect(132f / 2436f, 63f / 1125f, 2172f / 2436f, 1062f / 1125f) // Landscape
};
/// <summary>
/// Normalised safe areas for iPhone Xs Max with Home indicator (ratios are identical to XR, 11, 11 Pro Max). Absolute values:
/// PortraitU x=0, y=102, w=1242, h=2454 on full extents w=1242, h=2688;
/// PortraitD x=0, y=102, w=1242, h=2454 on full extents w=1242, h=2688 (not supported, remains in Portrait Up);
/// LandscapeL x=132, y=63, w=2424, h=1179 on full extents w=2688, h=1242;
/// LandscapeR x=132, y=63, w=2424, h=1179 on full extents w=2688, h=1242.
/// Aspect Ratio: ~19.5:9.
/// </summary>
Rect[] NSA_iPhoneXsMax = new Rect[]
{
new Rect(0f, 102f / 2688f, 1f, 2454f / 2688f), // Portrait
new Rect(132f / 2688f, 63f / 1242f, 2424f / 2688f, 1179f / 1242f) // Landscape
};
/// <summary>
/// Normalised safe areas for Pixel 3 XL using landscape left. Absolute values:
/// PortraitU x=0, y=0, w=1440, h=2789 on full extents w=1440, h=2960;
/// PortraitD x=0, y=0, w=1440, h=2789 on full extents w=1440, h=2960;
/// LandscapeL x=171, y=0, w=2789, h=1440 on full extents w=2960, h=1440;
/// LandscapeR x=0, y=0, w=2789, h=1440 on full extents w=2960, h=1440.
/// Aspect Ratio: 18.5:9.
/// </summary>
Rect[] NSA_Pixel3XL_LSL = new Rect[]
{
new Rect(0f, 0f, 1f, 2789f / 2960f), // Portrait
new Rect(0f, 0f, 2789f / 2960f, 1f) // Landscape
};
/// <summary>
/// Normalised safe areas for Pixel 3 XL using landscape right. Absolute values and aspect ratio same as above.
/// </summary>
Rect[] NSA_Pixel3XL_LSR = new Rect[]
{
new Rect(0f, 0f, 1f, 2789f / 2960f), // Portrait
new Rect(171f / 2960f, 0f, 2789f / 2960f, 1f) // Landscape
};
#endregion
RectTransform Panel;
Rect LastSafeArea = new Rect(0, 0, 0, 0);
Vector2Int LastScreenSize = new Vector2Int(0, 0);
ScreenOrientation LastOrientation = ScreenOrientation.AutoRotation;
[SerializeField]
bool ConformX = true; // Conform to screen safe area on X-axis (default true, disable to ignore)
[SerializeField]
bool ConformY = true; // Conform to screen safe area on Y-axis (default true, disable to ignore)
[SerializeField]
bool Logging = false; // Conform to screen safe area on Y-axis (default true, disable to ignore)
void Awake()
{
Panel = GetComponent<RectTransform>();
if (Panel == null)
{
Debug.LogError("Cannot apply safe area - no RectTransform found on " + name);
Destroy(gameObject);
}
Refresh();
}
void Update()
{
Refresh();
}
void Refresh()
{
Rect safeArea = GetSafeArea();
if (safeArea != LastSafeArea
|| Screen.width != LastScreenSize.x
|| Screen.height != LastScreenSize.y
|| Screen.orientation != LastOrientation)
{
// Fix for having auto-rotate off and manually forcing a screen orientation.
// See https://forum.unity.com/threads/569236/#post-4473253 and https://forum.unity.com/threads/569236/page-2#post-5166467
LastScreenSize.x = Screen.width;
LastScreenSize.y = Screen.height;
LastOrientation = Screen.orientation;
ApplySafeArea(safeArea);
}
}
Rect GetSafeArea()
{
Rect safeArea = Screen.safeArea;
if (Application.isEditor && Sim != SimDevice.None)
{
Rect nsa = new Rect(0, 0, Screen.width, Screen.height);
switch (Sim)
{
case SimDevice.iPhoneX:
if (Screen.height > Screen.width) // Portrait
nsa = NSA_iPhoneX[0];
else // Landscape
nsa = NSA_iPhoneX[1];
break;
case SimDevice.iPhoneXsMax:
if (Screen.height > Screen.width) // Portrait
nsa = NSA_iPhoneXsMax[0];
else // Landscape
nsa = NSA_iPhoneXsMax[1];
break;
case SimDevice.Pixel3XL_LSL:
if (Screen.height > Screen.width) // Portrait
nsa = NSA_Pixel3XL_LSL[0];
else // Landscape
nsa = NSA_Pixel3XL_LSL[1];
break;
case SimDevice.Pixel3XL_LSR:
if (Screen.height > Screen.width) // Portrait
nsa = NSA_Pixel3XL_LSR[0];
else // Landscape
nsa = NSA_Pixel3XL_LSR[1];
break;
default:
break;
}
safeArea = new Rect(Screen.width * nsa.x, Screen.height * nsa.y, Screen.width * nsa.width,
Screen.height * nsa.height);
}
return safeArea;
}
void ApplySafeArea(Rect r)
{
LastSafeArea = r;
// Ignore x-axis?
if (!ConformX)
{
r.x = 0;
r.width = Screen.width;
}
// Ignore y-axis?
if (!ConformY)
{
r.y = 0;
r.height = Screen.height;
}
// Check for invalid screen startup state on some Samsung devices (see below)
if (Screen.width > 0 && Screen.height > 0)
{
// Convert safe area rectangle from absolute pixels to normalised anchor coordinates
Vector2 anchorMin = r.position;
Vector2 anchorMax = r.position + r.size;
anchorMin.x /= Screen.width;
anchorMin.y /= Screen.height;
anchorMax.x /= Screen.width;
anchorMax.y /= Screen.height;
// Fix for some Samsung devices (e.g. Note 10+, A71, S20) where Refresh gets called twice and the first time returns NaN anchor coordinates
// See https://forum.unity.com/threads/569236/page-2#post-6199352
if (anchorMin.x >= 0 && anchorMin.y >= 0 && anchorMax.x >= 0 && anchorMax.y >= 0)
{
Panel.anchorMin = anchorMin;
Panel.anchorMax = anchorMax;
}
}
if (Logging)
{
Debug.LogFormat("New safe area applied to {0}: x={1}, y={2}, w={3}, h={4} on full extents w={5}, h={6}",
name, r.x, r.y, r.width, r.height, Screen.width, Screen.height);
}
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/SimpleRotate.cs.meta
|
fileFormatVersion: 2
guid: 00d0d495a78b84f76a46e0b54b02d6d9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/BuildBuildingListItemView.cs.meta
|
fileFormatVersion: 2
guid: 3663352a1c5b42dba90802287cb7b1bc
timeCreated: 1690658338
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftListPopup.cs.meta
|
fileFormatVersion: 2
guid: bda8f1b024824e39a4b5ee376ae1b15b
timeCreated: 1670795422
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Lumberjack.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Threading.Tasks;
using Solana.Unity;
using Solana.Unity.Programs.Abstract;
using Solana.Unity.Programs.Utilities;
using Solana.Unity.Rpc;
using Solana.Unity.Rpc.Builders;
using Solana.Unity.Rpc.Core.Http;
using Solana.Unity.Rpc.Core.Sockets;
using Solana.Unity.Rpc.Types;
using Solana.Unity.Wallet;
using Lumberjack;
using Lumberjack.Program;
using Lumberjack.Errors;
using Lumberjack.Accounts;
using Lumberjack.Types;
namespace Lumberjack
{
namespace Accounts
{
public partial class BoardAccount
{
public static ulong ACCOUNT_DISCRIMINATOR => 17376089564643394824UL;
public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{8, 5, 241, 133, 101, 69, 36, 241};
public static string ACCOUNT_DISCRIMINATOR_B58 => "2LqSnViaMd2";
public TileData[][] Data { get; set; }
public ulong ActionId { get; set; }
public ulong Wood { get; set; }
public ulong Stone { get; set; }
public ulong DammLevel { get; set; }
public bool Initialized { get; set; }
public bool EvilWon { get; set; }
public bool GoodWon { get; set; }
public static BoardAccount Deserialize(ReadOnlySpan<byte> _data)
{
int offset = 0;
ulong accountHashValue = _data.GetU64(offset);
offset += 8;
if (accountHashValue != ACCOUNT_DISCRIMINATOR)
{
return null;
}
BoardAccount result = new BoardAccount();
result.Data = new TileData[10][];
for (uint resultDataIdx = 0; resultDataIdx < 10; resultDataIdx++)
{
result.Data[resultDataIdx] = new TileData[10];
for (uint resultDataresultDataIdxIdx = 0; resultDataresultDataIdxIdx < 10; resultDataresultDataIdxIdx++)
{
offset += TileData.Deserialize(_data, offset, out var resultDataresultDataIdxresultDataresultDataIdxIdx);
result.Data[resultDataIdx][resultDataresultDataIdxIdx] = resultDataresultDataIdxresultDataresultDataIdxIdx;
}
}
result.ActionId = _data.GetU64(offset);
offset += 8;
result.Wood = _data.GetU64(offset);
offset += 8;
result.Stone = _data.GetU64(offset);
offset += 8;
result.DammLevel = _data.GetU64(offset);
offset += 8;
result.Initialized = _data.GetBool(offset);
offset += 1;
result.EvilWon = _data.GetBool(offset);
offset += 1;
result.GoodWon = _data.GetBool(offset);
offset += 1;
return result;
}
}
public partial class GameActionHistory
{
public static ulong ACCOUNT_DISCRIMINATOR => 8873408368832920456UL;
public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{136, 187, 67, 235, 229, 173, 36, 123};
public static string ACCOUNT_DISCRIMINATOR_B58 => "PsU5aGMBQbU";
public ulong IdCounter { get; set; }
public ulong ActionIndex { get; set; }
public GameAction[] GameActions { get; set; }
public static GameActionHistory Deserialize(ReadOnlySpan<byte> _data)
{
int offset = 0;
ulong accountHashValue = _data.GetU64(offset);
offset += 8;
if (accountHashValue != ACCOUNT_DISCRIMINATOR)
{
return null;
}
GameActionHistory result = new GameActionHistory();
result.IdCounter = _data.GetU64(offset);
offset += 8;
result.ActionIndex = _data.GetU64(offset);
offset += 8;
result.GameActions = new GameAction[30];
for (uint resultGameActionsIdx = 0; resultGameActionsIdx < 30; resultGameActionsIdx++)
{
offset += GameAction.Deserialize(_data, offset, out var resultGameActionsresultGameActionsIdx);
result.GameActions[resultGameActionsIdx] = resultGameActionsresultGameActionsIdx;
}
return result;
}
}
public partial class PlayerData
{
public static ulong ACCOUNT_DISCRIMINATOR => 9264901878634267077UL;
public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{197, 65, 216, 202, 43, 139, 147, 128};
public static string ACCOUNT_DISCRIMINATOR_B58 => "ZzeEvyxXcpF";
public PublicKey Authority { get; set; }
public PublicKey Avatar { get; set; }
public string Name { get; set; }
public byte Level { get; set; }
public ulong Xp { get; set; }
public ulong Energy { get; set; }
public long LastLogin { get; set; }
public static PlayerData Deserialize(ReadOnlySpan<byte> _data)
{
int offset = 0;
ulong accountHashValue = _data.GetU64(offset);
offset += 8;
if (accountHashValue != ACCOUNT_DISCRIMINATOR)
{
return null;
}
PlayerData result = new PlayerData();
result.Authority = _data.GetPubKey(offset);
offset += 32;
result.Avatar = _data.GetPubKey(offset);
offset += 32;
offset += _data.GetBorshString(offset, out var resultName);
result.Name = resultName;
result.Level = _data.GetU8(offset);
offset += 1;
result.Xp = _data.GetU64(offset);
offset += 8;
result.Energy = _data.GetU64(offset);
offset += 8;
result.LastLogin = _data.GetS64(offset);
offset += 8;
return result;
}
}
}
namespace Errors
{
public enum LumberjackErrorKind : uint
{
NotEnoughEnergy = 6000U,
TileAlreadyOccupied = 6001U,
TileCantBeUpgraded = 6002U,
TileHasNoTree = 6003U,
WrongAuthority = 6004U,
TileCantBeCollected = 6005U,
ProductionNotReadyYet = 6006U,
BuildingTypeNotCollectable = 6007U,
NotEnoughStone = 6008U,
NotEnoughWood = 6009U
}
}
namespace Types
{
public partial class TileData
{
public byte BuildingType { get; set; }
public uint BuildingLevel { get; set; }
public PublicKey BuildingOwner { get; set; }
public long BuildingStartTime { get; set; }
public long BuildingStartUpgradeTime { get; set; }
public long BuildingStartCollectTime { get; set; }
public long BuildingHealth { get; set; }
public int Serialize(byte[] _data, int initialOffset)
{
int offset = initialOffset;
_data.WriteU8(BuildingType, offset);
offset += 1;
_data.WriteU32(BuildingLevel, offset);
offset += 4;
_data.WritePubKey(BuildingOwner, offset);
offset += 32;
_data.WriteS64(BuildingStartTime, offset);
offset += 8;
_data.WriteS64(BuildingStartUpgradeTime, offset);
offset += 8;
_data.WriteS64(BuildingStartCollectTime, offset);
offset += 8;
_data.WriteS64(BuildingHealth, offset);
offset += 8;
return offset - initialOffset;
}
public static int Deserialize(ReadOnlySpan<byte> _data, int initialOffset, out TileData result)
{
int offset = initialOffset;
result = new TileData();
result.BuildingType = _data.GetU8(offset);
offset += 1;
result.BuildingLevel = _data.GetU32(offset);
offset += 4;
result.BuildingOwner = _data.GetPubKey(offset);
offset += 32;
result.BuildingStartTime = _data.GetS64(offset);
offset += 8;
result.BuildingStartUpgradeTime = _data.GetS64(offset);
offset += 8;
result.BuildingStartCollectTime = _data.GetS64(offset);
offset += 8;
result.BuildingHealth = _data.GetS64(offset);
offset += 8;
return offset - initialOffset;
}
}
public partial class GameAction
{
public ulong ActionId { get; set; }
public byte ActionType { get; set; }
public byte X { get; set; }
public byte Y { get; set; }
public TileData Tile { get; set; }
public PublicKey Player { get; set; }
public PublicKey Avatar { get; set; }
public ulong Amount { get; set; }
public int Serialize(byte[] _data, int initialOffset)
{
int offset = initialOffset;
_data.WriteU64(ActionId, offset);
offset += 8;
_data.WriteU8(ActionType, offset);
offset += 1;
_data.WriteU8(X, offset);
offset += 1;
_data.WriteU8(Y, offset);
offset += 1;
offset += Tile.Serialize(_data, offset);
_data.WritePubKey(Player, offset);
offset += 32;
_data.WritePubKey(Avatar, offset);
offset += 32;
_data.WriteU64(Amount, offset);
offset += 8;
return offset - initialOffset;
}
public static int Deserialize(ReadOnlySpan<byte> _data, int initialOffset, out GameAction result)
{
int offset = initialOffset;
result = new GameAction();
result.ActionId = _data.GetU64(offset);
offset += 8;
result.ActionType = _data.GetU8(offset);
offset += 1;
result.X = _data.GetU8(offset);
offset += 1;
result.Y = _data.GetU8(offset);
offset += 1;
offset += TileData.Deserialize(_data, offset, out var resultTile);
result.Tile = resultTile;
result.Player = _data.GetPubKey(offset);
offset += 32;
result.Avatar = _data.GetPubKey(offset);
offset += 32;
result.Amount = _data.GetU64(offset);
offset += 8;
return offset - initialOffset;
}
}
}
public partial class LumberjackClient : TransactionalBaseClient<LumberjackErrorKind>
{
public LumberjackClient(IRpcClient rpcClient, IStreamingRpcClient streamingRpcClient, PublicKey programId) : base(rpcClient, streamingRpcClient, programId)
{
}
public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<BoardAccount>>> GetBoardAccountsAsync(string programAddress, Commitment commitment = Commitment.Finalized)
{
var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = BoardAccount.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
if (!res.WasSuccessful || !(res.Result?.Count > 0))
return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<BoardAccount>>(res);
List<BoardAccount> resultingAccounts = new List<BoardAccount>(res.Result.Count);
resultingAccounts.AddRange(res.Result.Select(result => BoardAccount.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<BoardAccount>>(res, resultingAccounts);
}
public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<GameActionHistory>>> GetGameActionHistorysAsync(string programAddress, Commitment commitment = Commitment.Finalized)
{
var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = GameActionHistory.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
if (!res.WasSuccessful || !(res.Result?.Count > 0))
return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<GameActionHistory>>(res);
List<GameActionHistory> resultingAccounts = new List<GameActionHistory>(res.Result.Count);
resultingAccounts.AddRange(res.Result.Select(result => GameActionHistory.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<GameActionHistory>>(res, resultingAccounts);
}
public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<PlayerData>>> GetPlayerDatasAsync(string programAddress, Commitment commitment = Commitment.Finalized)
{
var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = PlayerData.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
if (!res.WasSuccessful || !(res.Result?.Count > 0))
return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<PlayerData>>(res);
List<PlayerData> resultingAccounts = new List<PlayerData>(res.Result.Count);
resultingAccounts.AddRange(res.Result.Select(result => PlayerData.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<PlayerData>>(res, resultingAccounts);
}
public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<BoardAccount>> GetBoardAccountAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
{
var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
if (!res.WasSuccessful)
return new Solana.Unity.Programs.Models.AccountResultWrapper<BoardAccount>(res);
var resultingAccount = BoardAccount.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
return new Solana.Unity.Programs.Models.AccountResultWrapper<BoardAccount>(res, resultingAccount);
}
public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<GameActionHistory>> GetGameActionHistoryAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
{
var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
if (!res.WasSuccessful)
return new Solana.Unity.Programs.Models.AccountResultWrapper<GameActionHistory>(res);
var resultingAccount = GameActionHistory.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
return new Solana.Unity.Programs.Models.AccountResultWrapper<GameActionHistory>(res, resultingAccount);
}
public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<PlayerData>> GetPlayerDataAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
{
var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
if (!res.WasSuccessful)
return new Solana.Unity.Programs.Models.AccountResultWrapper<PlayerData>(res);
var resultingAccount = PlayerData.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
return new Solana.Unity.Programs.Models.AccountResultWrapper<PlayerData>(res, resultingAccount);
}
public async Task<SubscriptionState> SubscribeBoardAccountAsync(string accountAddress, Action<SubscriptionState, Solana.Unity.Rpc.Messages.ResponseValue<Solana.Unity.Rpc.Models.AccountInfo>, BoardAccount> callback, Commitment commitment = Commitment.Finalized)
{
SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
{
BoardAccount parsingResult = null;
if (e.Value?.Data?.Count > 0)
parsingResult = BoardAccount.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
callback(s, e, parsingResult);
}, commitment);
return res;
}
public async Task<SubscriptionState> SubscribeGameActionHistoryAsync(string accountAddress, Action<SubscriptionState, Solana.Unity.Rpc.Messages.ResponseValue<Solana.Unity.Rpc.Models.AccountInfo>, GameActionHistory> callback, Commitment commitment = Commitment.Finalized)
{
SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
{
GameActionHistory parsingResult = null;
if (e.Value?.Data?.Count > 0)
parsingResult = GameActionHistory.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
callback(s, e, parsingResult);
}, commitment);
return res;
}
public async Task<SubscriptionState> SubscribePlayerDataAsync(string accountAddress, Action<SubscriptionState, Solana.Unity.Rpc.Messages.ResponseValue<Solana.Unity.Rpc.Models.AccountInfo>, PlayerData> callback, Commitment commitment = Commitment.Finalized)
{
SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
{
PlayerData parsingResult = null;
if (e.Value?.Data?.Count > 0)
parsingResult = PlayerData.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
callback(s, e, parsingResult);
}, commitment);
return res;
}
public async Task<RequestResult<string>> SendInitPlayerAsync(InitPlayerAccounts accounts, PublicKey feePayer, Func<byte[], PublicKey, byte[]> signingCallback, PublicKey programId)
{
Solana.Unity.Rpc.Models.TransactionInstruction instr = Program.LumberjackProgram.InitPlayer(accounts, programId);
return await SignAndSendTransaction(instr, feePayer, signingCallback);
}
public async Task<RequestResult<string>> SendRestartGameAsync(RestartGameAccounts accounts, PublicKey feePayer, Func<byte[], PublicKey, byte[]> signingCallback, PublicKey programId)
{
Solana.Unity.Rpc.Models.TransactionInstruction instr = Program.LumberjackProgram.RestartGame(accounts, programId);
return await SignAndSendTransaction(instr, feePayer, signingCallback);
}
public async Task<RequestResult<string>> SendChopTreeAsync(ChopTreeAccounts accounts, byte x, byte y, PublicKey feePayer, Func<byte[], PublicKey, byte[]> signingCallback, PublicKey programId)
{
Solana.Unity.Rpc.Models.TransactionInstruction instr = Program.LumberjackProgram.ChopTree(accounts, x, y, programId);
return await SignAndSendTransaction(instr, feePayer, signingCallback);
}
public async Task<RequestResult<string>> SendBuildAsync(BuildAccounts accounts, byte x, byte y, byte buildingType, PublicKey feePayer, Func<byte[], PublicKey, byte[]> signingCallback, PublicKey programId)
{
Solana.Unity.Rpc.Models.TransactionInstruction instr = Program.LumberjackProgram.Build(accounts, x, y, buildingType, programId);
return await SignAndSendTransaction(instr, feePayer, signingCallback);
}
public async Task<RequestResult<string>> SendUpgradeAsync(UpgradeAccounts accounts, byte x, byte y, PublicKey feePayer, Func<byte[], PublicKey, byte[]> signingCallback, PublicKey programId)
{
Solana.Unity.Rpc.Models.TransactionInstruction instr = Program.LumberjackProgram.Upgrade(accounts, x, y, programId);
return await SignAndSendTransaction(instr, feePayer, signingCallback);
}
public async Task<RequestResult<string>> SendCollectAsync(CollectAccounts accounts, byte x, byte y, PublicKey feePayer, Func<byte[], PublicKey, byte[]> signingCallback, PublicKey programId)
{
Solana.Unity.Rpc.Models.TransactionInstruction instr = Program.LumberjackProgram.Collect(accounts, x, y, programId);
return await SignAndSendTransaction(instr, feePayer, signingCallback);
}
public async Task<RequestResult<string>> SendUpdateAsync(UpdateAccounts accounts, PublicKey feePayer, Func<byte[], PublicKey, byte[]> signingCallback, PublicKey programId)
{
Solana.Unity.Rpc.Models.TransactionInstruction instr = Program.LumberjackProgram.Update(accounts, programId);
return await SignAndSendTransaction(instr, feePayer, signingCallback);
}
public async Task<RequestResult<string>> SendRefillEnergyAsync(RefillEnergyAccounts accounts, PublicKey feePayer, Func<byte[], PublicKey, byte[]> signingCallback, PublicKey programId)
{
Solana.Unity.Rpc.Models.TransactionInstruction instr = Program.LumberjackProgram.RefillEnergy(accounts, programId);
return await SignAndSendTransaction(instr, feePayer, signingCallback);
}
protected override Dictionary<uint, ProgramError<LumberjackErrorKind>> BuildErrorsDictionary()
{
return new Dictionary<uint, ProgramError<LumberjackErrorKind>>{{6000U, new ProgramError<LumberjackErrorKind>(LumberjackErrorKind.NotEnoughEnergy, "Not enough energy")}, {6001U, new ProgramError<LumberjackErrorKind>(LumberjackErrorKind.TileAlreadyOccupied, "Tile Already Occupied")}, {6002U, new ProgramError<LumberjackErrorKind>(LumberjackErrorKind.TileCantBeUpgraded, "Tile cant be upgraded")}, {6003U, new ProgramError<LumberjackErrorKind>(LumberjackErrorKind.TileHasNoTree, "Tile has no tree")}, {6004U, new ProgramError<LumberjackErrorKind>(LumberjackErrorKind.WrongAuthority, "Wrong Authority")}, {6005U, new ProgramError<LumberjackErrorKind>(LumberjackErrorKind.TileCantBeCollected, "Tile cant be collected")}, {6006U, new ProgramError<LumberjackErrorKind>(LumberjackErrorKind.ProductionNotReadyYet, "Production not ready yet")}, {6007U, new ProgramError<LumberjackErrorKind>(LumberjackErrorKind.BuildingTypeNotCollectable, "Building type not collectable")}, {6008U, new ProgramError<LumberjackErrorKind>(LumberjackErrorKind.NotEnoughStone, "Not enough stone")}, {6009U, new ProgramError<LumberjackErrorKind>(LumberjackErrorKind.NotEnoughWood, "Not enough wood")}, };
}
}
namespace Program
{
public class InitPlayerAccounts
{
public PublicKey Player { get; set; }
public PublicKey Board { get; set; }
public PublicKey GameActions { get; set; }
public PublicKey Signer { get; set; }
public PublicKey SystemProgram { get; set; }
}
public class RestartGameAccounts
{
public PublicKey Board { get; set; }
public PublicKey GameActions { get; set; }
public PublicKey Signer { get; set; }
public PublicKey SystemProgram { get; set; }
}
public class ChopTreeAccounts
{
public PublicKey SessionToken { get; set; }
public PublicKey Board { get; set; }
public PublicKey GameActions { get; set; }
public PublicKey Avatar { get; set; }
public PublicKey Player { get; set; }
public PublicKey Signer { get; set; }
}
public class BuildAccounts
{
public PublicKey SessionToken { get; set; }
public PublicKey Board { get; set; }
public PublicKey GameActions { get; set; }
public PublicKey Avatar { get; set; }
public PublicKey Player { get; set; }
public PublicKey Signer { get; set; }
}
public class UpgradeAccounts
{
public PublicKey SessionToken { get; set; }
public PublicKey Board { get; set; }
public PublicKey GameActions { get; set; }
public PublicKey Avatar { get; set; }
public PublicKey Player { get; set; }
public PublicKey Signer { get; set; }
}
public class CollectAccounts
{
public PublicKey SessionToken { get; set; }
public PublicKey Board { get; set; }
public PublicKey GameActions { get; set; }
public PublicKey Avatar { get; set; }
public PublicKey Player { get; set; }
public PublicKey Signer { get; set; }
}
public class UpdateAccounts
{
public PublicKey SessionToken { get; set; }
public PublicKey Board { get; set; }
public PublicKey GameActions { get; set; }
public PublicKey Avatar { get; set; }
public PublicKey Player { get; set; }
public PublicKey Signer { get; set; }
}
public class RefillEnergyAccounts
{
public PublicKey Player { get; set; }
public PublicKey Signer { get; set; }
public PublicKey Treasury { get; set; }
public PublicKey SystemProgram { get; set; }
}
public static class LumberjackProgram
{
public static Solana.Unity.Rpc.Models.TransactionInstruction InitPlayer(InitPlayerAccounts accounts, PublicKey programId)
{
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
{Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Player, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Board, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.GameActions, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Signer, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(4819994211046333298UL, offset);
offset += 8;
byte[] resultData = new byte[offset];
Array.Copy(_data, resultData, offset);
return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
}
public static Solana.Unity.Rpc.Models.TransactionInstruction RestartGame(RestartGameAccounts accounts, PublicKey programId)
{
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
{Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Board, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.GameActions, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Signer, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(10140096924326872336UL, offset);
offset += 8;
byte[] resultData = new byte[offset];
Array.Copy(_data, resultData, offset);
return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
}
public static Solana.Unity.Rpc.Models.TransactionInstruction ChopTree(ChopTreeAccounts accounts, byte x, byte y, PublicKey programId)
{
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
{Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SessionToken == null ? programId : accounts.SessionToken, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Board, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.GameActions, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Avatar, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Player, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Signer, true)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(2027946759707441272UL, offset);
offset += 8;
_data.WriteU8(x, offset);
offset += 1;
_data.WriteU8(y, offset);
offset += 1;
byte[] resultData = new byte[offset];
Array.Copy(_data, resultData, offset);
return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
}
public static Solana.Unity.Rpc.Models.TransactionInstruction Build(BuildAccounts accounts, byte x, byte y, byte buildingType, PublicKey programId)
{
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
{Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SessionToken == null ? programId : accounts.SessionToken, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Board, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.GameActions, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Avatar, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Player, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Signer, true)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(1817356094846029497UL, offset);
offset += 8;
_data.WriteU8(x, offset);
offset += 1;
_data.WriteU8(y, offset);
offset += 1;
_data.WriteU8(buildingType, offset);
offset += 1;
byte[] resultData = new byte[offset];
Array.Copy(_data, resultData, offset);
return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
}
public static Solana.Unity.Rpc.Models.TransactionInstruction Upgrade(UpgradeAccounts accounts, byte x, byte y, PublicKey programId)
{
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
{Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SessionToken == null ? programId : accounts.SessionToken, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Board, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.GameActions, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Avatar, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Player, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Signer, true)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(1920037355368607471UL, offset);
offset += 8;
_data.WriteU8(x, offset);
offset += 1;
_data.WriteU8(y, offset);
offset += 1;
byte[] resultData = new byte[offset];
Array.Copy(_data, resultData, offset);
return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
}
public static Solana.Unity.Rpc.Models.TransactionInstruction Collect(CollectAccounts accounts, byte x, byte y, PublicKey programId)
{
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
{Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SessionToken == null ? programId : accounts.SessionToken, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Board, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.GameActions, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Avatar, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Player, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Signer, true)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(17028780968808427472UL, offset);
offset += 8;
_data.WriteU8(x, offset);
offset += 1;
_data.WriteU8(y, offset);
offset += 1;
byte[] resultData = new byte[offset];
Array.Copy(_data, resultData, offset);
return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
}
public static Solana.Unity.Rpc.Models.TransactionInstruction Update(UpdateAccounts accounts, PublicKey programId)
{
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
{Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SessionToken == null ? programId : accounts.SessionToken, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Board, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.GameActions, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Avatar, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Player, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Signer, true)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(9222597562720635099UL, offset);
offset += 8;
byte[] resultData = new byte[offset];
Array.Copy(_data, resultData, offset);
return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
}
public static Solana.Unity.Rpc.Models.TransactionInstruction RefillEnergy(RefillEnergyAccounts accounts, PublicKey programId)
{
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
{Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Player, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Signer, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Treasury, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(12683479030383825657UL, offset);
offset += 8;
byte[] resultData = new byte[offset];
Array.Copy(_data, resultData, offset);
return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
}
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/BoardManager.cs.meta
|
fileFormatVersion: 2
guid: f72ef354baa1417d8fad26263ef33c9a
timeCreated: 1690449869
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/LumberjackService.cs.meta
|
fileFormatVersion: 2
guid: e361c4e484a844369b54c5fd3b90def7
timeCreated: 1688224689
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftItemView.cs.meta
|
fileFormatVersion: 2
guid: 4c804afde22164dbf8f244573e9ac776
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/BuildBuildingListItemView.cs
|
using System;
using DefaultNamespace;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class BuildBuildingListItemView : MonoBehaviour
{
public CostWidget CostWidget;
public TextMeshProUGUI Name;
public Button Button;
public TileConfig CurrentTileConfig;
private Action<BuildBuildingListItemView> onClick;
private void Awake()
{
Button.onClick.AddListener(OnClick);
}
private void OnClick()
{
onClick.Invoke(this);
}
public void SetData(TileConfig tileConfig, Action<BuildBuildingListItemView> onClick)
{
CurrentTileConfig = tileConfig;
this.onClick = onClick;
CostWidget.SetDataBuildCost(tileConfig);
Name.text = tileConfig.BuildingName;
}
private void Update()
{
if (CurrentTileConfig == null)
{
return;
}
CostWidget.SetDataBuildCost(CurrentTileConfig);
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/TextBlimp3D.cs.meta
|
fileFormatVersion: 2
guid: 880c30a9334e453b8b2eb80c838e57f0
timeCreated: 1690460086
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/icon_solana.png.meta
|
fileFormatVersion: 2
guid: c8663869476f9414a94374f096f61c57
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Lumberjack.cs.meta
|
fileFormatVersion: 2
guid: 69fdfaf02ce7e4bbd9e468d88775e2c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/BuildBuildingPopup.cs.meta
|
fileFormatVersion: 2
guid: bc810c17d5344b839d6cae8b910d9a88
timeCreated: 1690568968
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/RefillEnergyPopupUiData.cs.meta
|
fileFormatVersion: 2
guid: e7506bb9d0364bf6a8a8f1b160eac89b
timeCreated: 1690497494
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/ChopTreePopup.cs.meta
|
fileFormatVersion: 2
guid: 1e8c9776e45f4059ac78e5031effabd9
timeCreated: 1690568980
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/LumberjackScreen.cs
|
using System;
using System.Collections;
using Frictionless;
using Lumberjack.Accounts;
using Solana.Unity.SDK;
using Solana.Unity.Wallet.Bip39;
using SolPlay.Scripts.Services;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class LumberjackScreen : MonoBehaviour
{
public Button LoginButton;
public Button LoginWalletAdapterButton;
public Button ChuckWoodButton;
public Button ChuckWoodSessionButton;
public Button RevokeSessionButton;
public Button NftsButton;
public Button InitGameDataButton;
public Button RestartButton;
public TextMeshProUGUI EnergyAmountText;
public TextMeshProUGUI WoodAmountText;
public TextMeshProUGUI StoneAmountText;
public TextMeshProUGUI NextEnergyInText;
public TextMeshProUGUI GameOverText;
public GameObject LoadingSpinner;
public GameObject LoggedInRoot;
public GameObject NotInitializedRoot;
public GameObject InitializedRoot;
public GameObject NotLoggedInRoot;
public GameObject GameOverRoot;
public GameObject EvilWonRoot;
public GameObject GoodWonRoot;
void Start()
{
LoggedInRoot.SetActive(false);
NotLoggedInRoot.SetActive(true);
LoginButton.onClick.AddListener(OnEditorLoginClicked);
LoginWalletAdapterButton.onClick.AddListener(OnLoginWalletAdapterButtonClicked);
ChuckWoodButton.onClick.AddListener(OnChuckWoodButtonClicked);
ChuckWoodSessionButton.onClick.AddListener(OnChuckWoodSessionButtonClicked);
RevokeSessionButton.onClick.AddListener(OnRevokeSessionButtonClicked);
NftsButton.onClick.AddListener(OnNftsButtonnClicked);
InitGameDataButton.onClick.AddListener(OnInitGameDataButtonClicked);
RestartButton.onClick.AddListener(OnRestartGameClicked);
LumberjackService.OnPlayerDataChanged += OnPlayerDataChanged;
StartCoroutine(UpdateNextEnergy());
LumberjackService.OnInitialDataLoaded += UpdateContent;
}
private void Update()
{
LoadingSpinner.gameObject.SetActive(LumberjackService.Instance.IsAnyTransactionInProgress);
}
private async void OnInitGameDataButtonClicked()
{
await LumberjackService.Instance.InitGameDataAccount(!Web3.Rpc.NodeAddress.AbsoluteUri.Contains("localhost"));
}
private async void OnRestartGameClicked()
{
await LumberjackService.Instance.RestartGame();
}
private void OnNftsButtonnClicked()
{
ServiceFactory.Resolve<UiService>().OpenPopup(UiService.ScreenType.NftListPopup, new NftListPopupUiData(false, Web3.Wallet));
}
private async void OnRevokeSessionButtonClicked()
{
var res = await LumberjackService.Instance.RevokeSession();
Debug.Log("Revoked Session: " + res.Account);
}
private async void OnLoginWalletAdapterButtonClicked()
{
Web3.Instance.customRpc = "https://light-red-uranium.solana-mainnet.quiknode.pro/9d63f34cfe3e6e00543a34ff3f19855e537f0a99/";
Web3.Instance.webSocketsRpc = "https://light-red-uranium.solana-mainnet.quiknode.pro/9d63f34cfe3e6e00543a34ff3f19855e537f0a99/";
await Web3.Instance.LoginWalletAdapter();
}
private IEnumerator UpdateNextEnergy()
{
while (true)
{
yield return new WaitForSeconds(1);
UpdateContent();
}
}
private void OnPlayerDataChanged(PlayerData playerData)
{
UpdateContent();
}
private void UpdateContent()
{
var isInitialized = LumberjackService.Instance.IsInitialized();
LoggedInRoot.SetActive(Web3.Account != null);
NotInitializedRoot.SetActive(!isInitialized);
InitGameDataButton.gameObject.SetActive(!isInitialized && LumberjackService.Instance.CurrentPlayerData == null);
InitializedRoot.SetActive(isInitialized);
NotLoggedInRoot.SetActive(Web3.Account == null);
if (LumberjackService.Instance.CurrentBoardAccount != null)
{
GameOverRoot.SetActive(LumberjackService.Instance.CurrentBoardAccount.EvilWon || LumberjackService.Instance.CurrentBoardAccount.GoodWon);
if (LumberjackService.Instance.CurrentBoardAccount.EvilWon)
{
GameOverText.text = "Game Over! Evil Won!";
EvilWonRoot.gameObject.SetActive(true);
GoodWonRoot.gameObject.SetActive(false);
} else if (LumberjackService.Instance.CurrentBoardAccount.GoodWon)
{
GameOverText.text = "Game Over! Good Won!";
EvilWonRoot.gameObject.SetActive(false);
GoodWonRoot.gameObject.SetActive(true);
}
}
if (LumberjackService.Instance.CurrentPlayerData == null)
{
return;
}
var lastLoginTime = LumberjackService.Instance.CurrentPlayerData.LastLogin;
var timePassed = DateTimeOffset.UtcNow.ToUnixTimeSeconds() - lastLoginTime;
while (
timePassed >= LumberjackService.TIME_TO_REFILL_ENERGY &&
LumberjackService.Instance.CurrentPlayerData.Energy < LumberjackService.MAX_ENERGY
) {
LumberjackService.Instance.CurrentPlayerData.Energy += 1;
LumberjackService.Instance.CurrentPlayerData.LastLogin += LumberjackService.TIME_TO_REFILL_ENERGY;
timePassed -= LumberjackService.TIME_TO_REFILL_ENERGY;
}
var timeUntilNextRefill = LumberjackService.TIME_TO_REFILL_ENERGY - timePassed;
if (timeUntilNextRefill > 0)
{
NextEnergyInText.text = timeUntilNextRefill.ToString();
}
else
{
NextEnergyInText.text = "";
}
EnergyAmountText.text = LumberjackService.Instance.CurrentPlayerData.Energy.ToString();
if (LumberjackService.Instance.CurrentBoardAccount != null)
{
WoodAmountText.text = LumberjackService.Instance.CurrentBoardAccount.Wood.ToString();
StoneAmountText.text = LumberjackService.Instance.CurrentBoardAccount.Stone.ToString();
}
}
private void OnChuckWoodSessionButtonClicked()
{
LumberjackService.Instance.ChopTree(!Web3.Rpc.NodeAddress.AbsoluteUri.Contains("localhost"), 1 ,0);
}
private void OnChuckWoodButtonClicked()
{
LumberjackService.Instance.OnCellClicked(0 ,1);
}
private async void OnEditorLoginClicked()
{
// Dont use this one for production.
var newMnemonic = new Mnemonic(WordList.English, WordCount.Twelve);
// Dont use this one for production. Its only ment for editor login
var account = await Web3.Instance.LoginInGameWallet("1234") ??
await Web3.Instance.CreateAccount(newMnemonic.ToString(), "1234");
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftListPopupUiData.cs.meta
|
fileFormatVersion: 2
guid: 73f7cfe92c3e4891a7c7009b03f84c06
timeCreated: 1670851110
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/UpgradeBuildingPopupUiData.cs
|
using System;
using Lumberjack.Types;
using Solana.Unity.SDK;
using SolPlay.Scripts.Services;
public class UpgradeBuildingPopupUiData : UiService.UiData
{
public WalletBase Wallet;
public Action OnClick;
public TileData TileData;
public UpgradeBuildingPopupUiData(WalletBase wallet, Action onClick, TileData tileData)
{
Wallet = wallet;
OnClick = onClick;
TileData = tileData;
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/BoardManager.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using Cysharp.Threading.Tasks;
using Frictionless;
using Lumberjack.Accounts;
using Lumberjack.Types;
using Solana.Unity.SDK;
using Solana.Unity.SDK.Nft;
using SolPlay.Scripts.Services;
using SolPlay.Scripts.Ui;
using Unity.VisualScripting;
using UnityEngine;
namespace DefaultNamespace
{
public class BoardManager : MonoBehaviour
{
public const int WIDTH = 10;
public const int HEIGHT = 10;
public const int ACTION_TYPE_CHOP = 0;
public const int ACTION_TYPE_BUILD = 1;
public const int ACTION_TYPE_UPGRADE = 2;
public const int ACTION_TYPE_COLLECT = 3;
public const int ACTION_TYPE_FIGHT = 4;
public const int ACTION_TYPE_RESET = 5;
public Tile TilePrefab;
public Cell CellPrefab;
public Cell[,] AllCells = new Cell[WIDTH, HEIGHT];
public List<Tile> tiles = new List<Tile>();
public TileConfig[] tileConfigs;
public TextBlimp3D CoinBlimpPrefab;
public TextBlimp3D FightBlimp;
public bool IsWaiting;
private bool isInitialized;
private Dictionary<ulong, GameAction> alreadyPrerformedGameActions = new Dictionary<ulong, GameAction>();
private bool HasPlayedInitialAnimations = false;
private BoardAccount CurrentBaordAccount;
private void Awake()
{
ServiceFactory.RegisterSingleton(this);
}
private void Start()
{
LumberjackService.OnPlayerDataChanged += OnPlayerDataChange;
LumberjackService.OnBoardDataChanged += OnBoardDataChange;
LumberjackService.OnGameActionHistoryChanged += OnGameActionHistoryChange;
// Crete Cells
for (int i = 0; i < WIDTH; i++)
{
for (int j = 0; j < HEIGHT; j++)
{
Cell cellInstance = Instantiate(CellPrefab, transform);
cellInstance.transform.position = new Vector3(1.1f * i, 0, -1.1f * j);
cellInstance.Init(i, j, null);
AllCells[i,j] = cellInstance;
}
}
}
private void OnDestroy()
{
LumberjackService.OnBoardDataChanged -= OnBoardDataChange;
}
private void OnPlayerDataChange(PlayerData obj)
{
// Nothing to do here? O.O
}
private void OnGameReset()
{
isInitialized = false;
foreach (Tile tile in tiles)
{
Destroy(tile.gameObject);
}
tiles.Clear();
alreadyPrerformedGameActions.Clear();
for (int i = 0; i < WIDTH; i++)
{
for (int j = 0; j < HEIGHT; j++)
{
AllCells[i, j].Tile = null;
}
}
}
private void OnBoardDataChange(BoardAccount boardAccount)
{
bool wasGameOver = CurrentBaordAccount != null && (CurrentBaordAccount.EvilWon || CurrentBaordAccount.GoodWon);
CurrentBaordAccount = boardAccount;
bool isGameOver = CurrentBaordAccount.EvilWon || CurrentBaordAccount.GoodWon;
if (wasGameOver && !isGameOver)
{
OnGameReset();
CreateStartingTiles(CurrentBaordAccount);
isInitialized = false;
}
SetData(boardAccount);
}
private async void OnGameActionHistoryChange(GameActionHistory gameActionHistory)
{
if (!HasPlayedInitialAnimations)
{
foreach (GameAction gameAction in gameActionHistory.GameActions)
{
if (gameAction.ActionId == 0)
{
continue;
}
alreadyPrerformedGameActions.Add(gameAction.ActionId, gameAction);
}
HasPlayedInitialAnimations = true;
return;
}
foreach (GameAction gameAction in gameActionHistory.GameActions)
{
if (!alreadyPrerformedGameActions.ContainsKey(gameAction.ActionId))
{
var targetCell = GetCell(gameAction.X, gameAction.Y);
if (gameAction.ActionType == ACTION_TYPE_CHOP)
{
var tileConfig = FindTileConfigByTileData(gameAction.Tile);
targetCell.Tile.Init(tileConfig, gameAction.Tile, true);
}
if (gameAction.ActionType == ACTION_TYPE_BUILD)
{
var tileConfig = FindTileConfigByTileData(gameAction.Tile);
targetCell.Tile.Init(tileConfig, gameAction.Tile, true);
}
if (gameAction.ActionType == ACTION_TYPE_UPGRADE)
{
var tileConfig = FindTileConfigByTileData(gameAction.Tile);
targetCell.Tile.Init(tileConfig, gameAction.Tile, true);
}
if (gameAction.ActionType == ACTION_TYPE_COLLECT)
{
var blimp = Instantiate(CoinBlimpPrefab);
var tileConfig = FindTileConfigByTileData(gameAction.Tile);
blimp.SetData(gameAction.Amount.ToString(), null, tileConfig);
targetCell.Tile.Init(tileConfig, gameAction.Tile, true);
blimp.transform.position = targetCell.transform.position;
Nft nft = null;
try
{
var rpc = Web3.Wallet.ActiveRpcClient;
nft = await Nft.TryGetNftData(gameAction.Avatar, rpc).AsUniTask();
}
catch (Exception e)
{
Debug.LogError("Could not load nft" + e);
}
if (nft == null)
{
nft = ServiceFactory.Resolve<NftService>().CreateDummyLocalNft(gameAction.Avatar);
}
blimp.SetData(gameAction.Amount.ToString(), nft, tileConfig);
blimp.AddComponent<DestroyDelayed>();
Debug.Log("Is collectable: " + LumberjackService.IsCollectable(gameAction.Tile));
}
if (gameAction.ActionType == ACTION_TYPE_FIGHT)
{
PerformFightAction(gameAction, targetCell);
}
if (gameAction.ActionType == ACTION_TYPE_RESET)
{
if (CurrentBaordAccount.EvilWon || CurrentBaordAccount.GoodWon)
{
OnGameReset();
CreateStartingTiles(CurrentBaordAccount);
isInitialized = false;
}
}
alreadyPrerformedGameActions.Add(gameAction.ActionId, gameAction);
}
}
}
private async UniTask PerformFightAction(GameAction gameAction, Cell targetCell)
{
var tileConfig = FindTileConfigByTileData(gameAction.Tile);
var text = "-" + gameAction.Amount;
targetCell.Tile.Init(tileConfig, gameAction.Tile, true);
targetCell.Tile.GetComponentInChildren<Animator>().Play("Attack");
await UniTask.Delay(800);
Nft nft = null;
try
{
var rpc = Web3.Wallet.ActiveRpcClient;
nft = await Nft.TryGetNftData(gameAction.Avatar, rpc).AsUniTask();
}
catch (Exception e)
{
Debug.LogError("Could not load nft" + e);
}
if (nft == null)
{
nft = ServiceFactory.Resolve<NftService>().CreateDummyLocalNft(gameAction.Avatar);
}
var blimp = Instantiate(FightBlimp);
//blimp.SetData(text, null, tileConfig);
blimp.transform.position = targetCell.transform.position + new Vector3(0, 1.89f, -1.88f);
blimp.SetData(text, nft, tileConfig);
blimp.AddComponent<DestroyDelayed>();
Debug.Log("Is collectable: " + LumberjackService.IsCollectable(gameAction.Tile));
}
public void SetData(BoardAccount boardAccount)
{
if (!isInitialized)
{
OnGameReset();
CreateStartingTiles(boardAccount);
isInitialized = true;
}
else
{
//SpawnNewTile(playerData.NewTileX, playerData.NewTileY, playerData.NewTileLevel);
}
bool anyTileOutOfSync = false;
// Compare tiles:
for (int i = 0; i < WIDTH; i++)
{
for (int j = 0; j < HEIGHT; j++)
{
if (boardAccount.Data[j][i].BuildingType != 0 && GetCell(i, j).Tile == null)
{
anyTileOutOfSync = true;
Debug.LogWarning("Tiles out of sync.");
}else
if (boardAccount.Data[j][i].BuildingType != GetCell(i, j).Tile.currentConfig.building_type)
{
anyTileOutOfSync = true;
Debug.LogWarning($"Tiles out of sync. x {i} y {j} from socket: {boardAccount.Data[j][i]} board: {GetCell(i, j).Tile.currentConfig.Number} ");
}
}
}
if (anyTileOutOfSync)
{
//RefreshFromPlayerdata(playerData);
return;
}
IsWaiting = false;
}
public void RefreshFromPlayerdata(BoardAccount baordAccount)
{
OnGameReset();
CreateStartingTiles(baordAccount);
isInitialized = true;
IsWaiting = false;
}
public Cell GetCell(int x, int y)
{
if (x >= 0 && x < WIDTH && y >= 0 && y < HEIGHT) {
return AllCells[x, y];
}
return null;
}
public Cell GetAdjacentCell(Cell cell, Vector2Int direction)
{
int adjecentX = cell.X + direction.x;
int adjecentY = cell.Y - direction.y;
return GetCell(adjecentX, adjecentY);
}
private IEnumerator DestroyAfterSeconds(TextBlimp3D blimp)
{
yield return new WaitForSeconds(2);
Destroy(blimp.gameObject);
}
private int IndexOf(TileConfig state)
{
for (int i = 0; i < tileConfigs.Length; i++)
{
if (state == tileConfigs[i]) {
return i;
}
}
return -1;
}
private void CreateStartingTiles(BoardAccount playerData)
{
for (int x = 0; x < WIDTH; x++)
{
for (int y = 0; y < HEIGHT; y++)
{
SpawnNewTile(x, y, playerData.Data[x][y]);
}
}
}
private void SpawnNewTile(int i, int j, TileData tileData, Color? overrideColor = null)
{
var targetCell = GetCell(i, j);
if (targetCell.Tile != null)
{
// TODO: Refresh only the tiles that changed
//Debug.LogError("Target cell already full: " + targetCell.Tile.currentConfig.Number);
return;
}
// TODO: do we need sounds?
/*if (SoundToggle.IsSoundEnabled())
{
SpawnAudioSource.PlayOneShot(SpawnClip);
}*/
Tile tileInstance = Instantiate(TilePrefab, transform);
tileInstance.transform.position = targetCell.transform.position;
TileConfig newConfig = FindTileConfigByTileData(tileData);
if (overrideColor != null)
{
newConfig.MaterialColor = overrideColor.Value;
//EditorUtility.SetDirty(newConfig);
}
tileInstance.Init(newConfig, tileData);
tileInstance.Spawn(targetCell);
tiles.Add(tileInstance);
}
public TileConfig FindTileConfigByTileData(TileData tileData)
{
foreach (var tileConfig in tileConfigs)
{
if (tileConfig.building_type == tileData.BuildingType)
{
return tileConfig;
}
}
return tileConfigs[tileConfigs.Length - 1];
}
public TileConfig FindTileConfigByName(string name)
{
foreach (var tileConfig in tileConfigs)
{
if (tileConfig.BuildingName == name)
{
return tileConfig;
}
}
return tileConfigs[tileConfigs.Length - 1];
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/TextBlimp3D.cs
|
using DefaultNamespace;
using Solana.Unity.SDK.Nft;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace SolPlay.Scripts.Ui
{
/// <summary>
/// A little animated text on the screen, that disappears after some time.
/// </summary>
public class TextBlimp3D : MonoBehaviour
{
public TextMeshProUGUI Text;
public NftItemView NftItemView;
public Image Icon;
public void SetData(string text, Nft nft, TileConfig tileConfig)
{
Text.text = text;
if (nft != null)
{
NftItemView.SetData(nft, view => {});
}
Icon.sprite = tileConfig.Icon;
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftContextMenu.cs
|
using System;
using Frictionless;
using Solana.Unity.SDK.Nft;
using SolPlay.Scripts.Services;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace SolPlay.Scripts.Ui
{
/// <summary>
/// When clicking a Nft this context menu opens and shows some information about the Nft
/// </summary>
public class NftContextMenu : MonoBehaviour
{
public GameObject Root;
public Button CloseButton;
public TextMeshProUGUI NftNameText;
public Button SelectButton;
public Button TransferButton;
public Nft currentNft;
private Action<Nft> onNftSelected;
private void Awake()
{
ServiceFactory.RegisterSingleton(this);
Root.gameObject.SetActive(false);
CloseButton.onClick.AddListener(OnCloseButtonClicked);
SelectButton.onClick.AddListener(OnSelectClicked);
TransferButton.onClick.AddListener(OnTransferClicked);
}
private void OnTransferClicked()
{
//ServiceFactory.Resolve<UiService>().OpenPopup(UiService.ScreenType.TransferNftPopup, new TransferNftPopupUiData(currentNft));
Close();
}
private void OnSelectClicked()
{
ServiceFactory.Resolve<NftService>().SelectNft(currentNft);
Debug.Log($"{currentNft.metaplexData.data.offchainData.name} selected");
onNftSelected?.Invoke(currentNft);
Close();
}
private void OnCloseButtonClicked()
{
Close();
}
private void Close()
{
Root.gameObject.SetActive(false);
}
public void Open(NftItemView nftItemView, Action<Nft> onNftSelected)
{
this.onNftSelected = onNftSelected;
currentNft = nftItemView.CurrentSolPlayNft;
Root.gameObject.SetActive(true);
NftNameText.text = nftItemView.CurrentSolPlayNft.metaplexData.data.offchainData.name;
transform.position = nftItemView.transform.position;
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Cell.cs.meta
|
fileFormatVersion: 2
guid: b0b5285fe1a74db991f13e7b0f655cf8
timeCreated: 1690459918
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftService.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using Frictionless;
using Solana.Unity.Metaplex.NFT.Library;
using Solana.Unity.Metaplex.Utilities.Json;
using Solana.Unity.SDK;
using Solana.Unity.SDK.Nft;
using Solana.Unity.Wallet;
using UnityEngine;
namespace SolPlay.Scripts.Services
{
/// <summary>
/// Handles all logic related to NFTs and calculating their power level or whatever you like to do with the NFTs
/// </summary>
public class NftService : MonoBehaviour, IMultiSceneSingleton
{
public List<Nft> LoadedNfts = new ();
public bool IsLoadingTokenAccounts { get; private set; }
public const string NftMintAuthority = "GsfNSuZFrT2r4xzSndnCSs9tTXwt47etPqU8yFVnDcXd";
public Nft SelectedNft { get; private set; }
public Texture2D LocalDummyNft;
public bool LoadNftsOnStartUp = true;
public bool AddDummyNft = true;
public void Awake()
{
if (ServiceFactory.Resolve<NftService>() != null)
{
Destroy(gameObject);
return;
}
ServiceFactory.RegisterSingleton(this);
Web3.OnLogin += OnLogin;
}
private void OnLogin(Account obj)
{
if (!LoadNftsOnStartUp)
{
return;
}
LoadNfts();
}
public void LoadNfts()
{
LoadedNfts.Clear();
Web3.AutoLoadNfts = false;
Web3.LoadNFTs();
IsLoadingTokenAccounts = true;
Web3.OnNFTsUpdate += (nfts, totalAmount) =>
{
foreach (var newNft in nfts)
{
bool wasAlreadyLoaded = false;
foreach (var oldNft in LoadedNfts)
{
if (newNft.metaplexData.data.mint == oldNft.metaplexData.data.mint)
{
wasAlreadyLoaded = true;
}
}
if (!wasAlreadyLoaded)
{
MessageRouter.RaiseMessage(new NftLoadedMessage(newNft));
LoadedNfts.Add(newNft);
}
}
IsLoadingTokenAccounts = nfts.Count != totalAmount;
};
if (AddDummyNft)
{
var dummyLocalNft = CreateDummyLocalNft(Web3.Account.PublicKey);
LoadedNfts.Add(dummyLocalNft);
MessageRouter.RaiseMessage(new NftLoadedMessage(dummyLocalNft));
}
}
public Nft CreateDummyLocalNft(string publicKey)
{
Nft dummyLocalNft = new Nft();
var constructor = typeof(MetadataAccount).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance,
null, new Type[0], null);
MetadataAccount metaPlexData = (MetadataAccount) constructor.Invoke(null);
metaPlexData.offchainData = new MetaplexTokenStandard();
metaPlexData.offchainData.symbol = "dummy";
metaPlexData.offchainData.name = "Dummy Nft";
metaPlexData.offchainData.description = "A dummy nft which uses the wallet puy key";
metaPlexData.mint = publicKey;
dummyLocalNft.metaplexData = new Metaplex(metaPlexData);
dummyLocalNft.metaplexData.nftImage = new NftImage()
{
name = "DummyNft",
file = LocalDummyNft
};
return dummyLocalNft;
}
public bool IsNftSelected(Nft nft)
{
return nft.metaplexData.data.mint == GetSelectedNftPubKey();
}
private string GetSelectedNftPubKey()
{
return PlayerPrefs.GetString("SelectedNft");
}
public bool OwnsNftOfMintAuthority(string authority)
{
foreach (var nft in LoadedNfts)
{
if (nft.metaplexData.data.updateAuthority != null && nft.metaplexData.data.updateAuthority == authority)
{
return true;
}
}
return false;
}
public void SelectNft(Nft nft)
{
if (nft == null)
{
return;
}
SelectedNft = nft;
PlayerPrefs.SetString("SelectedNft", SelectedNft.metaplexData.data.mint);
MessageRouter.RaiseMessage(new NftSelectedMessage(SelectedNft));
}
public void ResetSelectedNft()
{
SelectedNft = null;
PlayerPrefs.DeleteKey("SelectedNft");
MessageRouter.RaiseMessage(new NftSelectedMessage(SelectedNft));
}
public IEnumerator HandleNewSceneLoaded()
{
yield return null;
}
}
public class NftLoadedMessage
{
public Nft Nft;
public NftLoadedMessage(Nft nft)
{
Nft = nft;
}
}
public class NftSelectedMessage
{
public Nft NewNFt;
public NftSelectedMessage(Nft newNFt)
{
NewNFt = newNFt;
}
}
public class NftLoadingStartedMessage
{
}
public class NftLoadingFinishedMessage
{
}
public class NftMintFinishedMessage
{
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/TokenPanel.cs
|
using Solana.Unity.Programs;
using Solana.Unity.Rpc.Types;
using Solana.Unity.SDK;
using Solana.Unity.Wallet;
using TMPro;
using UnityEngine;
namespace SolPlay.Scripts.Ui
{
/// <summary>
/// Shows the amount of the token "TokenMintAddress" from the connected Wallet.
/// </summary>
public class TokenPanel : MonoBehaviour
{
public TextMeshProUGUI TokenAmount;
public string
TokenMintAdress =
"PLAyKbtrwQWgWkpsEaMHPMeDLDourWEWVrx824kQN8P"; // Replace with whatever token you like.
private PublicKey _associatedTokenAddress;
void Start()
{
if (Web3.Instance.WalletBase.Account != null)
{
UpdateTokenAmount();
}
}
private async void UpdateTokenAmount()
{
if (Web3.Instance.WalletBase.Account == null)
{
return;
}
var wallet = Web3.Instance.WalletBase;
if (wallet != null && wallet.Account.PublicKey != null)
{
_associatedTokenAddress =
AssociatedTokenAccountProgram.DeriveAssociatedTokenAccount(wallet.Account.PublicKey, new PublicKey(TokenMintAdress));
}
if (_associatedTokenAddress == null)
{
return;
}
var tokenBalance = await wallet.ActiveRpcClient.GetTokenAccountBalanceAsync(_associatedTokenAddress, Commitment.Confirmed);
if (tokenBalance.Result == null || tokenBalance.Result.Value == null)
{
TokenAmount.text = "0";
return;
}
TokenAmount.text = tokenBalance.Result.Value.UiAmountString;
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/BasePopup.cs
|
using SolPlay.Scripts.Services;
using UnityEngine;
using UnityEngine.UI;
namespace SolPlay.Scripts.Ui
{
public class BasePopup : MonoBehaviour
{
public GameObject Root;
public Button CloseButton;
protected UiService.UiData uiData;
protected void Awake()
{
Root.gameObject.SetActive(false);
}
public virtual void Open(UiService.UiData uiData)
{
this.uiData = uiData;
if (CloseButton != null)
{
CloseButton.onClick.RemoveAllListeners();
CloseButton.onClick.AddListener(OnCloseButtonClicked);
}
Root.gameObject.SetActive(true);
}
public virtual void Close()
{
Root.gameObject.SetActive(false);
}
private void OnCloseButtonClicked()
{
Close();
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/LumberjackScreen.cs.meta
|
fileFormatVersion: 2
guid: 491b56013424d44229b52bf874eeb95c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Socket.meta
|
fileFormatVersion: 2
guid: 62dc6594b4eea4d42ab98f8477ea9da6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/TileConfig.cs
|
using UnityEngine;
namespace DefaultNamespace
{
[CreateAssetMenu(menuName = "Tile Config")]
public class TileConfig : ScriptableObject
{
public uint Number;
public GameObject Prefab;
public GameObject MergeFx;
public Material Material;
public float ShakeStrength = 0.3f;
public Color MaterialColor;
public Material BackgroundMaterial;
public int Index;
public byte building_type;
public string BuildingName;
public Sprite Icon;
public bool IsBuildable;
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/RefillEnergyPopup.cs
|
using SolPlay.Scripts.Services;
using SolPlay.Scripts.Ui;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// Screen that lets you refill energy for sol
/// </summary>
public class RefillEnergyPopup : BasePopup
{
public Button RefillEnergyButton;
public GameObject LoadingSpinner;
void Start()
{
RefillEnergyButton.onClick.AddListener(OnRefillEnergyButtonClicked);
}
public override void Open(UiService.UiData uiData)
{
var refillUiData = (uiData as RefillEnergyPopupUiData);
if (refillUiData == null)
{
Debug.LogError("Wrong ui data for nft list popup");
return;
}
base.Open(uiData);
}
private async void OnRefillEnergyButtonClicked()
{
LoadingSpinner.gameObject.SetActive(true);
await LumberjackService.Instance.RefillEnergy();
LoadingSpinner.gameObject.SetActive(false);
Close();
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/SelectedNft.cs.meta
|
fileFormatVersion: 2
guid: c2741eec8497b40ad885aeebd3b801fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/BalancingService.cs.meta
|
fileFormatVersion: 2
guid: a7db521f7a124d2fa1e0c48144c3d5fb
timeCreated: 1690645779
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/RefillEnergyPopupUiData.cs
|
using Solana.Unity.SDK;
using SolPlay.Scripts.Services;
public class RefillEnergyPopupUiData : UiService.UiData
{
public WalletBase Wallet;
public RefillEnergyPopupUiData(WalletBase wallet)
{
Wallet = wallet;
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/SolanaUtils.cs
|
using System;
namespace SolPlay.DeeplinksNftExample.Utils
{
public class SolanaUtils
{
public const long SolToLamports = 1000000000;
}
public static class ArrayUtils
{
public static T[] Slice<T>(this T[] arr, uint indexFrom, uint indexTo) {
if (indexFrom > indexTo) {
throw new ArgumentOutOfRangeException("indexFrom is bigger than indexTo!");
}
uint length = indexTo - indexFrom;
T[] result = new T[length];
Array.Copy(arr, indexFrom, result, 0, length);
return result;
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/TileConfig.cs.meta
|
fileFormatVersion: 2
guid: ef6d93e4c8904031a8a9b76b4acb032c
timeCreated: 1690459945
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/d_loading@2x.png.meta
|
fileFormatVersion: 2
guid: b014f412cd6014750ae1db453f634d63
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/RefillEnergyPopup.cs.meta
|
fileFormatVersion: 2
guid: c83a3c6701fc44feb06b602fe8882c3f
timeCreated: 1690491799
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/UpgradeBuildingPopup.cs
|
using System;
using DefaultNamespace;
using Frictionless;
using SolPlay.Scripts.Services;
using SolPlay.Scripts.Ui;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class UpgradeBuildingPopup : BasePopup
{
public Button Button;
public GameObject LoadingSpinner;
public CostWidget CostWidget;
public TextMeshProUGUI BuildingNameText;
void Start()
{
Button.onClick.AddListener(ButtonClicked);
}
public override void Open(UiService.UiData uiData)
{
var upgradeBuildingUiData = (uiData as UpgradeBuildingPopupUiData);
Update();
var tileConfig = ServiceFactory.Resolve<BoardManager>().FindTileConfigByTileData(upgradeBuildingUiData.TileData);
BuildingNameText.text = tileConfig.BuildingName;
if (upgradeBuildingUiData == null)
{
Debug.LogError("Wrong ui data for nft list popup");
return;
}
base.Open(uiData);
}
private void Update()
{
var upgradeBuildingUiData = (uiData as UpgradeBuildingPopupUiData);
if (upgradeBuildingUiData != null)
{
CostWidget.SetDataUpgradeCost(upgradeBuildingUiData.TileData);
}
}
private async void ButtonClicked()
{
var refillUiData = (uiData as UpgradeBuildingPopupUiData);
if (LumberjackService.HasEnoughResources(BalancingService.GetUpgradeCost(refillUiData.TileData)))
{
(uiData as UpgradeBuildingPopupUiData).OnClick?.Invoke();
Close();
}else
{
Debug.LogError("Not enough resources");
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/DestroyDelayed.cs.meta
|
fileFormatVersion: 2
guid: 669cba288e5443858961169dd99491a4
timeCreated: 1690558070
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/SelectedNft.cs
|
using Frictionless;
using SolPlay.Scripts.Services;
using SolPlay.Scripts.Ui;
using UnityEngine;
public class SelectedNft : MonoBehaviour
{
public NftItemView NftItemView;
private void Awake()
{
NftItemView.gameObject.SetActive(false);
}
void Start()
{
MessageRouter.AddHandler<NftSelectedMessage>(OnNftSelectedMessage);
UpdateContent();
}
private void OnNftSelectedMessage(NftSelectedMessage message)
{
UpdateContent();
}
private void UpdateContent()
{
var nftService = ServiceFactory.Resolve<NftService>();
if (nftService != null && nftService.SelectedNft != null)
{
NftItemView.gameObject.SetActive(true);
NftItemView.SetData(nftService.SelectedNft, view => { Debug.Log("Selected Nft clicked."); });
}
else
{
NftItemView.gameObject.SetActive(false);
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/DestroyDelayed.cs
|
using System;
using System.Collections;
using UnityEngine;
namespace DefaultNamespace
{
public class DestroyDelayed : MonoBehaviour
{
private void Awake()
{
StartCoroutine(DestroyGoDelayed());
}
private IEnumerator DestroyGoDelayed()
{
yield return new WaitForSeconds(5);
Destroy(gameObject);
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/SolanaUtils.cs.meta
|
fileFormatVersion: 2
guid: d6fd84b061c1a48119369888e1fb5e09
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftItemView.cs
|
using System;
using Frictionless;
using Solana.Unity.SDK.Nft;
using SolPlay.Scripts.Services;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace SolPlay.Scripts.Ui
{
/// <summary>
/// Show the image of a given Nft and can have a click handler
/// </summary>
public class NftItemView : MonoBehaviour
{
public Nft CurrentSolPlayNft;
public RawImage Icon;
public TextMeshProUGUI Headline;
public TextMeshProUGUI Description;
public TextMeshProUGUI ErrorText;
public Button Button;
public GameObject SelectionGameObject;
public GameObject IsLoadingDataRoot;
public GameObject LoadingErrorRoot;
private Action<NftItemView> onButtonClickedAction;
public void SetData(Nft nft, Action<NftItemView> onButtonClicked)
{
if (nft == null)
{
return;
}
CurrentSolPlayNft = nft;
Icon.gameObject.SetActive(false);
LoadingErrorRoot.gameObject.SetActive(false);
IsLoadingDataRoot.gameObject.SetActive(true);
IsLoadingDataRoot.gameObject.SetActive(false);
if (nft.metaplexData.nftImage != null)
{
Icon.gameObject.SetActive(true);
Icon.texture = nft.metaplexData.nftImage.file;
}
var nftService = ServiceFactory.Resolve<NftService>();
SelectionGameObject.gameObject.SetActive(nftService.IsNftSelected(nft));
if (nft.metaplexData.data.offchainData != null)
{
Description.text = nft.metaplexData.data.offchainData.description;
Headline.text = nft.metaplexData.data.offchainData.name;
}
Button.onClick.AddListener(OnButtonClicked);
onButtonClickedAction = onButtonClicked;
}
private void OnButtonClicked()
{
onButtonClickedAction?.Invoke(this);
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/ChopTreePopup.cs
|
using DefaultNamespace;
using SolPlay.Scripts.Services;
using SolPlay.Scripts.Ui;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// Screen that lets you refill energy for sol
/// </summary>
public class ChopTreePopup : BasePopup
{
public Button Button;
public GameObject LoadingSpinner;
public TextMeshProUGUI EnergyText;
void Start()
{
Button.onClick.AddListener(OnRefillEnergyButtonClicked);
}
public override void Open(UiService.UiData uiData)
{
var refillUiData = (uiData as ChopTreePopupUiData);
EnergyText.text = BalancingService.RefillEnergyCost.ToString();
EnergyText.color = LumberjackService.Instance.CurrentPlayerData.Energy < BalancingService.RefillEnergyCost ? Color.red : Color.white;
if (refillUiData == null)
{
Debug.LogError("Wrong ui data for nft list popup");
return;
}
base.Open(uiData);
}
private void Update()
{
EnergyText.color = LumberjackService.Instance.CurrentPlayerData.Energy < BalancingService.RefillEnergyCost ? Color.red : Color.white;
}
private async void OnRefillEnergyButtonClicked()
{
(uiData as ChopTreePopupUiData).OnClick?.Invoke();
Close();
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/NftService.cs.meta
|
fileFormatVersion: 2
guid: 99c40baead10843899efb994349f11cd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/SolBalanceWidget.cs.meta
|
fileFormatVersion: 2
guid: bae9859e31324a0eb501c37ee3ff3e82
timeCreated: 1660074869
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/SolBalanceWidget.cs
|
using System;
using System.Collections;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using codebase.utility;
using Solana.Unity.SDK;
using SolPlay.DeeplinksNftExample.Utils;
namespace SolPlay.Scripts.Ui
{
/// <summary>
/// Shows the sol balance of the connected wallet. Should be updated at certain points, after transactions for example.
/// </summary>
public class SolBalanceWidget : MonoBehaviour
{
public TextMeshProUGUI SolBalance;
public TextMeshProUGUI SolChangeText;
public TextMeshProUGUI PublicKey;
public Button CopyAddressButton;
private double lamportsChange;
private Coroutine disableSolChangeCoroutine;
private double currentLamports;
private void Awake()
{
if (CopyAddressButton)
{
CopyAddressButton.onClick.AddListener(OnCopyClicked);
}
}
private void OnCopyClicked()
{
Clipboard.Copy(Web3.Account.PublicKey);
}
private void OnEnable()
{
Web3.OnBalanceChange += OnSolBalanceChangedMessage;
}
private void OnDisable()
{
Web3.OnBalanceChange -= OnSolBalanceChangedMessage;
}
private void UpdateContent()
{
SolBalance.text = currentLamports.ToString("F2") + " sol";
if (PublicKey != null)
{
PublicKey.text = Web3.Account.PublicKey;
}
}
private void OnSolBalanceChangedMessage(double newLamports)
{
double balanceChange = newLamports - currentLamports;
if (balanceChange != 0 && Math.Abs(currentLamports - newLamports) > 0.00000001)
{
lamportsChange += balanceChange;
if (balanceChange > 0)
{
if (disableSolChangeCoroutine != null)
{
StopCoroutine(disableSolChangeCoroutine);
}
SolChangeText.text = "<color=green>+" + lamportsChange.ToString("F2") + "</color> ";
disableSolChangeCoroutine = StartCoroutine(DisableSolChangeDelayed());
}
else
{
if (balanceChange < -0.0001)
{
if (disableSolChangeCoroutine != null)
{
StopCoroutine(disableSolChangeCoroutine);
}
SolChangeText.text = "<color=red>" + lamportsChange.ToString("F2") + "</color> ";
disableSolChangeCoroutine = StartCoroutine(DisableSolChangeDelayed());
}
}
currentLamports = newLamports;
UpdateContent();
}
else
{
currentLamports = newLamports;
UpdateContent();
}
}
private IEnumerator DisableSolChangeDelayed()
{
SolChangeText.gameObject.SetActive(true);
yield return new WaitForSeconds(3);
lamportsChange = 0;
SolChangeText.gameObject.SetActive(false);
disableSolChangeCoroutine = null;
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/UpgradeBuildingPopup.cs.meta
|
fileFormatVersion: 2
guid: dbf7d64b3b744685a6459408e6662460
timeCreated: 1690568480
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/UiService.cs.meta
|
fileFormatVersion: 2
guid: 97c3b89c03d0642b4ba9d5d17d794ee1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/SafeArea.cs.meta
|
fileFormatVersion: 2
guid: db21dccead92d48f9a566e9132089246
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Socket/UnityMainThreadDispatcher.cs
|
namespace NativeWebSocket
{
/*
Copyright 2015 Pim de Witte All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Threading.Tasks;
/// Author: Pim de Witte (pimdewitte.com) and contributors, https://github.com/PimDeWitte/UnityMainThreadDispatcher
/// <summary>
/// A thread-safe class which holds a queue with actions to execute on the next Update() method. It can be used to make calls to the main thread for
/// things such as UI Manipulation in Unity. It was developed for use in combination with the Firebase Unity plugin, which uses separate threads for event handling
/// </summary>
public class UnityMainThreadDispatcher : MonoBehaviour
{
private static readonly Queue<Action> _executionQueue = new Queue<Action>();
public void Update()
{
lock (_executionQueue)
{
while (_executionQueue.Count > 0)
{
_executionQueue.Dequeue().Invoke();
}
}
}
/// <summary>
/// Locks the queue and adds the IEnumerator to the queue
/// </summary>
/// <param name="action">IEnumerator function that will be executed from the main thread.</param>
public void Enqueue(IEnumerator action)
{
lock (_executionQueue)
{
_executionQueue.Enqueue(() => { StartCoroutine(action); });
}
}
/// <summary>
/// Locks the queue and adds the Action to the queue
/// </summary>
/// <param name="action">function that will be executed from the main thread.</param>
public void Enqueue(Action action)
{
Enqueue(ActionWrapper(action));
}
/// <summary>
/// Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes
/// </summary>
/// <param name="action">function that will be executed from the main thread.</param>
/// <returns>A Task that can be awaited until the action completes</returns>
public Task EnqueueAsync(Action action)
{
var tcs = new TaskCompletionSource<bool>();
void WrappedAction()
{
try
{
action();
tcs.TrySetResult(true);
}
catch (Exception ex)
{
tcs.TrySetException(ex);
}
}
Enqueue(ActionWrapper(WrappedAction));
return tcs.Task;
}
IEnumerator ActionWrapper(Action a)
{
a();
yield return null;
}
private static UnityMainThreadDispatcher _instance = null;
public static bool Exists()
{
return _instance != null;
}
public static UnityMainThreadDispatcher Instance()
{
if (!Exists())
{
throw new Exception(
"UnityMainThreadDispatcher could not find the UnityMainThreadDispatcher object. Please ensure you have added the MainThreadExecutor Prefab to your scene.");
}
return _instance;
}
void Awake()
{
if (_instance == null)
{
_instance = this;
DontDestroyOnLoad(this.gameObject);
}
}
void OnDestroy()
{
_instance = null;
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Socket/SharpWebSockets.cs.meta
|
fileFormatVersion: 2
guid: e7b7a62c4d06f450fb76c052eb386f25
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Socket/UnityMainThreadDispatcher.cs.meta
|
fileFormatVersion: 2
guid: c686df1024ebb44a5ae8ff9b59323e18
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Socket/SolPlayWebSocketService.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using Frictionless;
using UnityEngine;
using NativeWebSocket;
using Newtonsoft.Json;
using Socket;
using Solana.Unity.Wallet;
using WebSocketState = NativeWebSocket.WebSocketState;
namespace SolPlay.Scripts.Services
{
// This is just a workaround since the UnitySDK websocket is not reconnecting properly in webgl currently.
public class SolPlayWebSocketService : MonoBehaviour
{
IWebSocket websocket;
private Dictionary<PublicKey, SocketSubscription> subscriptions =
new Dictionary<PublicKey, SocketSubscription>();
private int reconnectTries;
private int subcriptionCounter;
public string socketUrl;
public WebSocketState WebSocketState;
private class SocketSubscription
{
public long Id;
public long SubscriptionId;
public Action<MethodResult> ResultCallback;
public PublicKey PublicKey;
}
[Serializable]
public class WebSocketErrorResponse
{
public string jsonrpc;
public string error;
public string data;
}
[Serializable]
public class WebSocketResponse
{
public string jsonrpc;
public long result;
public long id;
}
[Serializable]
public class WebSocketMethodResponse
{
public string jsonrpc;
public string method;
public MethodResult @params;
}
[Serializable]
public class MethodResult
{
public AccountInfo result;
public long subscription;
}
[Serializable]
public class AccountInfo
{
public Context context;
public Value value;
}
[Serializable]
public class Context
{
public int slot;
}
[Serializable]
public class Value
{
public long lamports;
public List<string> data;
public string owner;
public bool executable;
public BigInteger rentEpoch;
}
private void Awake()
{
ServiceFactory.RegisterSingleton(this);
}
public WebSocketState GetState()
{
if (websocket == null)
{
return WebSocketState.Closed;
}
return websocket.State;
}
private void SetSocketUrl(string rpcUrl)
{
socketUrl = rpcUrl.Replace("https://", "wss://");
if (socketUrl.Contains("localhost"))
{
socketUrl = "ws://localhost:8900";
}
Debug.Log("Socket url: " + socketUrl);
}
public void Connect(string rpcUrl)
{
System.Net.ServicePointManager.ServerCertificateValidationCallback = (message, cert, chain, sslPolicyErrors) => true;
if (websocket != null)
{
websocket.OnOpen -= websocketOnOnOpen();
websocket.OnError -= websocketOnOnError();
websocket.OnClose -= OnWebSocketClosed;
websocket.OnMessage -= websocketOnOnMessage();
websocket.Close();
}
SetSocketUrl(rpcUrl);
Debug.Log("Connect Socket: " + socketUrl);
#if UNITY_WEBGL && !UNITY_EDITOR
websocket = new WebSocket(socketUrl);
#else
websocket = new SharpWebSockets(socketUrl);
#endif
websocket.OnOpen += websocketOnOnOpen();
websocket.OnError += websocketOnOnError();
websocket.OnClose += OnWebSocketClosed;
websocket.OnMessage += websocketOnOnMessage();
websocket.Connect();
Debug.Log("Socket connect done");
}
private WebSocketMessageEventHandler websocketOnOnMessage()
{
return (bytes) =>
{
var message = System.Text.Encoding.UTF8.GetString(bytes);
//Debug.Log("SocketMessage:" + message);
WebSocketErrorResponse errorResponse = JsonConvert.DeserializeObject<WebSocketErrorResponse>(message);
if (!string.IsNullOrEmpty(errorResponse.error))
{
Debug.LogError(errorResponse.error);
return;
}
if (message.Contains("method"))
{
WebSocketMethodResponse methodResponse =
JsonConvert.DeserializeObject<WebSocketMethodResponse>(message);
foreach (var subscription in subscriptions)
{
if (subscription.Value.SubscriptionId == methodResponse.@params.subscription)
{
subscription.Value.ResultCallback(methodResponse.@params);
}
}
}
else
{
WebSocketResponse response = JsonConvert.DeserializeObject<WebSocketResponse>(message);
foreach (var subscription in subscriptions)
{
if (subscription.Value.Id == response.id)
{
subscription.Value.SubscriptionId = response.result;
}
}
}
};
}
private static WebSocketErrorEventHandler websocketOnOnError()
{
return (e) =>
{
Debug.LogError("Socket Error! " + e + " maybe you need to use a different RPC node. For example helius or quicknode");
};
}
private WebSocketOpenEventHandler websocketOnOnOpen()
{
return () =>
{
reconnectTries = 0;
foreach (var subscription in subscriptions)
{
SubscribeToPubKeyData(subscription.Value.PublicKey, subscription.Value.ResultCallback);
}
Debug.Log("Socket Connection open!");
MessageRouter.RaiseMessage(new SocketServerConnectedMessage());
};
}
private void OnWebSocketClosed(WebSocketCloseCode closecode)
{
Debug.Log("Socket disconnect: " + closecode);
if (this)
{
StartCoroutine(Reconnect());
}
}
public IEnumerator Reconnect()
{
while (true)
{
yield return new WaitForSeconds(reconnectTries * 0.5f + 0.1f);
reconnectTries++;
Debug.Log("Reconnect Socket");
Connect(socketUrl);
while (websocket == null || websocket.State == WebSocketState.Closed)
{
yield return null;
}
while (websocket.State == WebSocketState.Connecting)
{
yield return null;
}
while (websocket.State == WebSocketState.Closed || websocket.State == WebSocketState.Closing)
{
yield break;
}
if (websocket.State == WebSocketState.Open)
{
yield break;
}
}
}
void Update()
{
#if !UNITY_WEBGL || UNITY_EDITOR
if (websocket != null && websocket.State == WebSocketState.Open)
{
websocket.DispatchMessageQueue();
}
#endif
if (websocket != null)
{
WebSocketState = websocket.State;
}
}
public async void SubscribeToBlocks()
{
if (websocket.State == WebSocketState.Open)
{
string accountSubscribeParams ="{ \"jsonrpc\": \"2.0\", \"id\": \"22\", \"method\": \"blockSubscribe\", \"params\": [\"all\"] }";
await websocket.Send(System.Text.Encoding.UTF8.GetBytes(accountSubscribeParams));
}
}
public async void SubscribeToPubKeyData(PublicKey pubkey, Action<MethodResult> onMethodResult)
{
var subscriptionsCount = subcriptionCounter++;
var socketSubscription = new SocketSubscription()
{
Id = subscriptionsCount,
SubscriptionId = 0,
ResultCallback = onMethodResult,
PublicKey = pubkey
};
if (subscriptions.ContainsKey(pubkey))
{
subscriptions[pubkey].Id = subscriptionsCount;
}
else
{
subscriptions.Add(pubkey, socketSubscription);
}
if (websocket.State == WebSocketState.Open)
{
string accountSubscribeParams =
"{\"jsonrpc\":\"2.0\",\"id\":" + subscriptionsCount +
",\"method\":\"accountSubscribe\",\"params\":[\"" + pubkey.Key +
"\",{\"encoding\":\"jsonParsed\",\"commitment\":\"processed\"}]}";
await websocket.Send(System.Text.Encoding.UTF8.GetBytes(accountSubscribeParams));
}
}
async void UnSubscribeFromPubKeyData(PublicKey pubkey, long id)
{
if (websocket.State == WebSocketState.Open)
{
string unsubscribeParameter = "{\"jsonrpc\":\"2.0\", \"id\":" + id +
", \"method\":\"accountUnsubscribe\", \"params\":[" + pubkey.Key + "]}";
await websocket.Send(System.Text.Encoding.UTF8.GetBytes(unsubscribeParameter));
}
}
private async void OnApplicationQuit()
{
if (websocket == null)
{
return;
}
await websocket.Close();
}
}
public class SocketServerConnectedMessage
{
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Socket/SharpWebSockets.cs
|
using System.Collections.Generic;
using System.Threading.Tasks;
using NativeWebSocket;
using UnityEngine;
namespace Socket
{
public class SharpWebSockets : IWebSocket
{
public event WebSocketOpenEventHandler OnOpen;
public event WebSocketMessageEventHandler OnMessage;
public event WebSocketErrorEventHandler OnError;
public event WebSocketCloseEventHandler OnClose;
private WebSocketSharp.WebSocket sharpWebSocket;
private string websocketUrl;
private List<byte[]> m_MessageList = new List<byte[]>();
private readonly object IncomingMessageLock = new object();
public SharpWebSockets(string uri)
{
websocketUrl = uri;
}
public WebSocketState State
{
get
{
switch (sharpWebSocket.ReadyState)
{
case WebSocketSharp.WebSocketState.New:
return WebSocketState.Connecting;
case WebSocketSharp.WebSocketState.Connecting:
return WebSocketState.Connecting;
case WebSocketSharp.WebSocketState.Open:
return WebSocketState.Open;
case WebSocketSharp.WebSocketState.Closing:
return WebSocketState.Closing;
case WebSocketSharp.WebSocketState.Closed:
return WebSocketState.Closed;
default:
return WebSocketState.Closed;
}
}
}
public Task Connect()
{
sharpWebSocket = new WebSocketSharp.WebSocket(websocketUrl);
sharpWebSocket.OnOpen += (sender, args) =>
{
UnityMainThreadDispatcher.Instance().Enqueue(OnOpenMainThread);
Debug.Log("message");
};
sharpWebSocket.OnMessage += (sender, args) =>
{
m_MessageList.Add(args.RawData);
};
sharpWebSocket.OnClose += (sender, args) =>
{
UnityMainThreadDispatcher.Instance().Enqueue(OnCloseMainThread);
};
sharpWebSocket.OnError += (sender, args) =>
{
OnError?.Invoke(args.Message);
Debug.LogError(args.Message);
};
sharpWebSocket.ConnectAsync();
return Task.CompletedTask;
}
private void OnCloseMainThread()
{
OnClose?.Invoke(WebSocketCloseCode.Abnormal);
}
private void OnOpenMainThread()
{
OnOpen?.Invoke();
}
public Task Connect(bool awaitConnection = true)
{
throw new System.NotImplementedException();
}
public Task Close()
{
sharpWebSocket.Close();
return Task.CompletedTask;
}
public Task Send(byte[] bytes)
{
sharpWebSocket.Send(bytes);
return Task.CompletedTask;
}
public Task SendText(string message)
{
throw new System.NotImplementedException();
}
public void DispatchMessageQueue()
{
if (m_MessageList.Count == 0)
{
return;
}
List<byte[]> messageListCopy;
lock (IncomingMessageLock)
{
messageListCopy = new List<byte[]>(m_MessageList);
m_MessageList.Clear();
}
var len = messageListCopy.Count;
for (int i = 0; i < len; i++)
{
OnMessage?.Invoke(messageListCopy[i]);
}
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Socket/SocketStatusWidget.cs.meta
|
fileFormatVersion: 2
guid: dbce47be4af1b404ab5d53d64d83a012
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Socket/SolPlayWebSocketService.cs.meta
|
fileFormatVersion: 2
guid: 342e1b34380784aedb9c1b7ebaea435b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Scripts/Socket/SocketStatusWidget.cs
|
using Frictionless;
using NativeWebSocket;
using SolPlay.Scripts.Services;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class SocketStatusWidget : MonoBehaviour
{
public TextMeshProUGUI StatusText;
public Button ReconnectButton;
private void Awake()
{
ReconnectButton.onClick.AddListener(OnReconnectClicked);
}
private void OnReconnectClicked()
{
var socketService = ServiceFactory.Resolve<SolPlayWebSocketService>();
StartCoroutine(socketService.Reconnect());
}
void Update()
{
var socketService = ServiceFactory.Resolve<SolPlayWebSocketService>();
if (socketService != null)
{
StatusText.text = "Socket: " + socketService.GetState() + $"(?ms)";
ReconnectButton.gameObject.SetActive(socketService.GetState() == WebSocketState.Closed);
}
}
}
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/Logo (1).png.meta
|
fileFormatVersion: 2
guid: 1c0543cbae76540d8b6f30154cb048ee
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/Stone.png.meta
|
fileFormatVersion: 2
guid: c2406e48b75954ed9a5c40c2778c0889
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/Btn-close.png.meta
|
fileFormatVersion: 2
guid: b5e272bed0a334b5abee0232b54d3ce3
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/green_circle.psd.meta
|
fileFormatVersion: 2
guid: dab6d301b94ba4b53b7086246aa5c834
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 1
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/EvilWon.png.meta
|
fileFormatVersion: 2
guid: 35a4b3a8648ab4c9092012d88ce95ed1
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/TextBTN_Big.png.meta
|
fileFormatVersion: 2
guid: 56056600469bb469b9fd768981f72d99
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 118, y: 68, z: 126, w: 52}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 1537655665
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/ui_board_wooden_light.png.meta
|
fileFormatVersion: 2
guid: c58d837adbd3442e19fa464b2a0eb678
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/TitleScreen.png.meta
|
fileFormatVersion: 2
guid: 59bba1f42d8e04d6090d0a2c6700d2fd
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/Beaver.png.meta
|
fileFormatVersion: 2
guid: 88879cf224ccd439294f8383e553d13f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/TitleScreen_2.png.meta
|
fileFormatVersion: 2
guid: bed779ad00712411f845041b39edbe8b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/GoodWon.png.meta
|
fileFormatVersion: 2
guid: 233a5bebf402e4d33a5b7afb3b3b371b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/Wood.png.meta
|
fileFormatVersion: 2
guid: b96f00b241a5646b281bed9ba703b7e1
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/energy.png.meta
|
fileFormatVersion: 2
guid: 9c8ed927acedb446ca8c86e896384617
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets
|
solana_public_repos/solana-game-examples/city-builder/unity/city-builder/Assets/Sprites/bg-menu.png.meta
|
fileFormatVersion: 2
guid: 9527fb3c7db12447f9a520dc1da7dd1b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.