这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
b535637
Revert "automated duplicating imported samples modifications (#595)"
robGG1997 Sep 14, 2023
95fb832
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Sep 14, 2023
e3ab3c2
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Sep 14, 2023
a536df0
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Sep 15, 2023
c12a0de
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Sep 18, 2023
8e1ea0a
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Sep 18, 2023
1318cd7
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Sep 21, 2023
33b8e52
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Sep 22, 2023
0a205bd
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Sep 25, 2023
df4795a
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Sep 29, 2023
abc34f6
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Sep 29, 2023
031e8d3
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Oct 18, 2023
3a4bdd9
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Oct 24, 2023
67d871d
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Oct 25, 2023
3c1d099
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Oct 30, 2023
ed22cb7
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Oct 31, 2023
4c8b282
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 1, 2023
ea609de
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 2, 2023
adcb974
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 2, 2023
77dd93a
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 3, 2023
12af139
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 7, 2023
3080de3
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 8, 2023
87a1dcc
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 8, 2023
f25d202
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 9, 2023
300d906
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 14, 2023
f28d9f4
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 16, 2023
ab26fa3
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 17, 2023
c5c0cb4
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 17, 2023
a1671d7
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 20, 2023
a4755d1
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 21, 2023
6ca4ea7
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 21, 2023
07cee0a
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 22, 2023
f2bb351
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 23, 2023
b064568
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 23, 2023
02606c0
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 23, 2023
6644661
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Nov 27, 2023
93e8fbe
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Dec 6, 2023
5881543
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Dec 7, 2023
a2cdc0e
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Dec 11, 2023
9765f8d
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Dec 11, 2023
fc7269a
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Dec 12, 2023
0fe7628
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Dec 12, 2023
bba537e
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Dec 13, 2023
9930e97
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Dec 13, 2023
1f1d439
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Dec 14, 2023
da2418a
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Dec 15, 2023
8a5be99
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Jan 18, 2024
cea3e2b
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Jan 18, 2024
bbf532a
checkpoint
robGG1997 Jan 25, 2024
d521dfb
pushed changes made
robGG1997 Jan 29, 2024
7e26940
added documentation and removed scene indexers
robGG1997 Jan 29, 2024
718bf99
Merge branch 'main' of https://github.com/ChainSafe/web3.unity
robGG1997 Jan 29, 2024
3a246df
merged from main
robGG1997 Jan 29, 2024
c260c31
Auto-duplicate Packages Samples
robGG1997 Jan 29, 2024
1b8db69
Published Solution Dependencies to Package Libraries as DLLs
robGG1997 Jan 29, 2024
11bc802
ramp adapter added and small merge revert
robGG1997 Jan 29, 2024
f576c70
Merge branch 'rob/single-scene-system-810' of https://github.com/Chai…
robGG1997 Jan 29, 2024
b5ad699
Auto-duplicate Packages Samples
robGG1997 Jan 29, 2024
57527bb
Published Solution Dependencies to Package Libraries as DLLs
robGG1997 Jan 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using ChainSafe.Gaming.Debugging;
using ChainSafe.Gaming.Evm.JsonRpc;
using ChainSafe.Gaming.Lootboxes.Chainlink;
using ChainSafe.Gaming.UnityPackage;
using ChainSafe.Gaming.Wallets;
using ChainSafe.Gaming.Web3;
using ChainSafe.Gaming.Web3.Build;
Expand Down Expand Up @@ -36,8 +37,7 @@ private class Web3Config : ICompleteProjectConfig

private async void Awake()
{
web3 = await new Web3Builder(new Web3Config())
.Configure(services =>
web3 = Web3Accessor.TryWeb3 ?? await new Web3Builder(new Web3Config()).Configure(services =>
{
services.UseUnityEnvironment();
services.UseRpcProvider();
Expand Down

Large diffs are not rendered by default.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using ChainSafe.Gaming.UnityPackage.Common;
using ChainSafe.Gaming.Web3.Build;
using UnityEngine;

namespace ChainSafe.Gaming.Exchangers.Ramp
{
/// <summary>
/// Add Ramp service when building a Web3 instance.
/// </summary>
public class RampServiceAdapter : MonoBehaviour, IWeb3BuilderServiceAdapter
{
[SerializeField] private RampExchangerConfigSO rampConfig;

public Web3Builder ConfigureServices(Web3Builder web3Builder)
{
return web3Builder.Configure(services =>
{
services.UseRampExchanger(rampConfig);
});
}
}
}

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

Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 337558421}
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: Scenes.ErrorPopup, Assembly-CSharp
m_MethodName: Close
m_Mode: 1
Expand Down Expand Up @@ -574,7 +574,7 @@ MonoBehaviour:
m_GameObject: {fileID: 337558419}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c001d0d5433b4215b8abba94194881bd, type: 3}
m_Script: {fileID: 11500000, guid: 9df78976caa7771429cfe2b9b96e1491, type: 3}
m_Name:
m_EditorClassIdentifier:
MessageLabel: {fileID: 804898217}
Expand Down Expand Up @@ -1184,7 +1184,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 337558421}
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: Scenes.ErrorPopup, Assembly-CSharp
m_MethodName: Close
m_Mode: 1
Expand Down Expand Up @@ -1362,6 +1362,7 @@ GameObject:
m_Component:
- component: {fileID: 1679801099}
- component: {fileID: 1679801100}
- component: {fileID: 1679801101}
m_Layer: 0
m_Name: Logic - Login - Web3Auth
m_TagString: Untagged
Expand Down Expand Up @@ -1396,10 +1397,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7b6902e441950fa4bb5cefdd2263164a, type: 3}
m_Name:
m_EditorClassIdentifier:
<SceneToLoad>k__BackingField: SampleRampIntegration
gelatoApiKey: 7MFQqyGS1Iui_e_MgmFW1BfbFeJ06g8nnL2oUTlIJug_
errorPopup: {fileID: 337558421}
rampConfig: {fileID: 11400000, guid: d1f58846e4fc71d4e90f287a86f328f9, type: 2}
clientId: BCc0wTmuXureEzgawhUSZOWu4bgWo56sZPrxLiHQCpg5OHcNrfa44esdTS8Dm77VtmaIyjhbthdWfbLhSwf7jtU
redirectUri: torusapp://io.chainsafe.gamingsdk.sdkdemoscene/auth
network: 1
Expand All @@ -1416,6 +1415,19 @@ MonoBehaviour:
Provider: 3
- Button: {fileID: 7400892925769233044}
Provider: 4
--- !u!114 &1679801101
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1679801098}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3d2237df0314604419146b916b88d158, type: 3}
m_Name:
m_EditorClassIdentifier:
sceneToLoad: SampleMain
--- !u!1 &1799608969
GameObject:
m_ObjectHideFlags: 0
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;
using ChainSafe.Gaming.Exchangers.Ramp;
using ChainSafe.Gaming.UnityPackage;
using ChainSafe.Gaming.UnityPackage.Common;
using ChainSafe.Gaming.Web3;
using ChainSafe.Gaming.Web3.Analytics;
using ChainSafe.Gaming.Web3.Build;
Expand All @@ -16,11 +17,11 @@
/// <summary>
/// Login using Web3Auth.
/// </summary>
public class Web3AuthLogin : Login
public class Web3AuthLoginProvider : LoginProvider, IWeb3BuilderServiceAdapter
{
/// <summary>
/// Struct used for pairing login buttons to Web3 auth providers.
/// Used when adding <see cref="Web3AuthLogin.LoginWithWeb3Auth"/> as listeners to the buttons.
/// Used when adding <see cref="Web3AuthLoginProvider.LoginWithWeb3Auth"/> as listeners to the buttons.
/// </summary>
[Serializable]
public struct ProviderAndButtonPair
Expand All @@ -35,7 +36,7 @@ public struct ProviderAndButtonPair
[SerializeField] private Network network;
[Header("UI")]
[SerializeField] private List<ProviderAndButtonPair> providerAndButtonPairs;

private bool useProvider;

private Provider selectedProvider;
Expand All @@ -47,13 +48,13 @@ public void SetRememberMe(bool rememberMe)
this.rememberMe = rememberMe;
}

protected override IEnumerator Initialize()
protected override async void Initialize()
{
base.Initialize();

//Always first add listeners.
providerAndButtonPairs.ForEach(p =>
p.Button.onClick.AddListener(delegate { LoginWithWeb3Auth(p.Provider); }));

yield return null;

#if UNITY_WEBGL && !UNITY_EDITOR
Uri uri = new Uri(Application.absoluteURL);
Expand All @@ -63,25 +64,18 @@ protected override IEnumerator Initialize()
{
useProvider = false;

Task loginTask = TryLogin();

yield return new WaitUntil(() => loginTask.IsCompleted);
await TryLogin();

}
#else
if (!string.IsNullOrEmpty(KeyStoreManagerUtils.getPreferencesData(KeyStoreManagerUtils.SESSION_ID)))
{
useProvider = false;
rememberMe = true;
Task loginTask = TryLogin();
await TryLogin();
Debug.Log("Restoring existing Web3Auth session (Remember Me");
yield return new WaitUntil(() => loginTask.IsCompleted);
}
#endif

// add provider buttons listeners


}

private async void LoginWithWeb3Auth(Provider provider)
Expand All @@ -91,8 +85,7 @@ private async void LoginWithWeb3Auth(Provider provider)
useProvider = true;
}
selectedProvider = provider;



await TryLogin();
LogAnalytics(provider);
}
Expand All @@ -111,7 +104,7 @@ private void LogAnalytics(Provider provider)
});
}

protected override Web3Builder ConfigureWeb3Services(Web3Builder web3Builder)
public Web3Builder ConfigureServices(Web3Builder web3Builder)
{
return web3Builder.Configure(services =>
{
Expand Down Expand Up @@ -140,7 +133,7 @@ protected override Web3Builder ConfigureWeb3Services(Web3Builder web3Builder)
};
}

services.UseWeb3AuthWallet(web3AuthConfig);
services.UseWeb3AuthWallet(web3AuthConfig);
});
}
}
8 changes: 8 additions & 0 deletions Packages/io.chainsafe.web3-unity/Runtime/Common.meta

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

8 changes: 8 additions & 0 deletions Packages/io.chainsafe.web3-unity/Runtime/Common/Scripts.meta

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

Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
using UnityEngine;
using UnityEngine.UI;

namespace Scenes
namespace ChainSafe.Gaming.UnityPackage.Common
{
public class ErrorPopup : MonoBehaviour
{
public Text MessageLabel;

/// <summary>
/// Display error pop up when Login fails.
/// </summary>
/// <param name="message">Error message to be displayed.</param>
public void ShowError(string message)
{
gameObject.SetActive(true);
MessageLabel.text = message;
}

/// <summary>
/// Close error popup.
/// </summary>
public void Close()
{
gameObject.SetActive(false);
Expand Down

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

Loading