Skip to content

Commit

Permalink
conf test
Browse files Browse the repository at this point in the history
  • Loading branch information
osamadeep committed Feb 2, 2023
1 parent e6bdfe3 commit 65c48c9
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 26 deletions.
76 changes: 55 additions & 21 deletions nekoyume/Assets/_Scripts/Game/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,8 @@ private IEnumerator CoLogin(Action<bool> callback)

//|||||||||||||| PANDORA START CODE |||||||||||||||||||
//auth is complete
if (string.IsNullOrEmpty(PlayFabSettings.staticSettings.TitleId))
PlayFabSettings.staticSettings.TitleId = "42";
//if (string.IsNullOrEmpty(PlayFabSettings.staticSettings.TitleId))
//PlayFabSettings.staticSettings.TitleId = "42";

Address currentLoginAddress = Widget.Find<LoginSystem>().KeyStore.List().ElementAt(PandoraMaster.LoginIndex).Item2.Address;

Expand All @@ -714,44 +714,78 @@ private IEnumerator CoLogin(Action<bool> callback)
{
if (success.InfoResultPayload.PlayerProfile != null)
{
isAuth = false;
PandoraMaster.PlayFabCurrentPlayer = success.InfoResultPayload.PlayerProfile;
PandoraMaster.PlayFabPlayerProfile = success.InfoResultPayload.PlayerProfile;
//get players
Premium.PANDORA_GetDatabase(currentLoginAddress);
Premium.PANDORA_UpdateDatabasePeriodly().Forget();
GetPlayerConfiguration(callback);
}
},
failed =>
{
if (failed.Error == PlayFabErrorCode.AccountBanned)
PandoraMaster.Instance.ShowError(101);
else
Debug.LogError(failed.GenerateErrorReport());
{
Debug.LogError("Pandora Server Failed: " + failed.GenerateErrorReport());
PandoraMaster.Instance.ShowError(404);
}
});

while (isAuth)
{
yield return new WaitForSeconds(1);
}
//|||||||||||||| PANDORA END CODE |||||||||||||||||||



yield return Agent.Initialize(
_options,
loginPopup.GetPrivateKey(),
callback
);
}



//|||||||||||||| PANDORA START CODE |||||||||||||||||||
bool isAuth = true;
private void OnPlayFabError(PlayFabError error)
private void GetPlayerConfiguration(Action<bool> callback)
{
Debug.LogError(error.GenerateErrorReport());
var loginPopup = Widget.Find<LoginSystem>();

PlayFabClientAPI.GetUserData(new GetUserDataRequest(),
success =>
{
PandoraMaster.PlayFabUserData = success.Data;
PlayFabClientAPI.ExecuteCloudScript(
new ExecuteCloudScriptRequest { FunctionName = "getGameConfiguration" },
success =>
{
//JsonObject jsonResult = (JsonObject)success.FunctionResult;
//object data;
//jsonResult.TryGetValue("data", out data);
//if (success.FunctionResult != null)
{
Debug.LogError("reply from clould: " + success.FunctionResult.ToString());
}
StartCoroutine(Agent.Initialize(_options, loginPopup.GetPrivateKey(), callback));
},
failed =>
{
Debug.LogError("Failed to getGameConfiguration!, " + failed.GenerateErrorReport());
});
//Debug.LogError("9c: " + Widget.Find<VersionSystem>().Scan9cBlock + " premium: " + int.Parse(PandoraMaster.PlayFabUserData["PremiumBlock"].Value));
//if (PandoraMaster.PlayFabUserData.ContainsKey("PremiumBlock")
//&& int.Parse(PandoraMaster.PlayFabUserData["PremiumBlock"].Value) > Widget.Find<VersionSystem>().Scan9cBlock)
//{
// Debug.LogError("Player Premium");
//}
//else
//{
// Debug.LogError("Player Not Premium");
// StartCoroutine(Agent.Initialize(_options, loginPopup.GetPrivateKey(), callback));
//}
},
failed =>
{
Debug.LogError(failed.GenerateErrorReport());
PandoraMaster.Instance.ShowError(401);
});
}
//|||||||||||||| PANDORA END CODE |||||||||||||||||||

Expand Down
3 changes: 2 additions & 1 deletion nekoyume/Assets/_Scripts/PandoraBox/Scripts/PandoraMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public class PandoraMaster : MonoBehaviour
public static GuildPlayer CurrentGuildPlayer; //data for local player since we use it alot

//Playfab
public static PlayerProfileModel PlayFabCurrentPlayer = new PlayerProfileModel();
public static PlayerProfileModel PlayFabPlayerProfile = new PlayerProfileModel();
public static Dictionary<string, UserDataRecord> PlayFabUserData = new Dictionary<string, UserDataRecord>();
public static GetUserInventoryResult PlayFabInventory = new GetUserInventoryResult();

//General
Expand Down
3 changes: 3 additions & 0 deletions nekoyume/Assets/_Scripts/PandoraBox/Scripts/PandoraUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ public static string GetNotificationText(int messageCode)
case 101:
messageText = "This address is Banned, please visit us for more information!";
break;
case 401:
messageText = "Cannot Getting User Data From Server, please visit us for more information!";
break;
case 404:
messageText = "Cannot connect to Pandora Server, please visit us for more information!";
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void RestartGame()

public IEnumerator ShowStartBooster()
{
playerName.text = PandoraMaster.PlayFabCurrentPlayer.DisplayName;
playerName.text = PandoraMaster.PlayFabPlayerProfile.DisplayName;
pcBalance.text = PandoraMaster.PlayFabInventory.VirtualCurrency["PC"].ToString();
pgBalance.text = PandoraMaster.PlayFabInventory.VirtualCurrency["PG"].ToString();
startCounterText.text = "";
Expand Down
4 changes: 2 additions & 2 deletions nekoyume/Assets/_Scripts/UI/Widget/Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,12 @@ public override void Show(bool ignoreShowAnimation = false)

PlayerPrefs.SetString(tmp, States.Instance.CurrentAvatarState.name); //save profile name
//set name to playfab
if (string.IsNullOrEmpty(PandoraMaster.PlayFabCurrentPlayer.DisplayName))
if (string.IsNullOrEmpty(PandoraMaster.PlayFabPlayerProfile.DisplayName))
{
var currentName = States.Instance.CurrentAvatarState.name + " #" + States.Instance.CurrentAvatarState.address.ToHex().Substring(0, 4);
//PlayFabClientAPI.UpdateUserTitleDisplayName(request, OnChangePlayFabNameSuccess, OnChangePlayFabNameError);
PlayFabClientAPI.UpdateUserTitleDisplayName(new UpdateUserTitleDisplayNameRequest { DisplayName = currentName},
success => { PandoraMaster.PlayFabCurrentPlayer.DisplayName = currentName;},failed => { Debug.LogError(failed.GenerateErrorReport()); });
success => { PandoraMaster.PlayFabPlayerProfile.DisplayName = currentName;},failed => { Debug.LogError(failed.GenerateErrorReport()); });
}

//load favorite items
Expand Down
2 changes: 1 addition & 1 deletion nekoyume/Assets/_Scripts/UI/Widget/RunnerTown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public override void Show(bool ignoreShowAnimation = false)

AudioController.instance.PlayMusic(AudioController.MusicCode.RunnerTown);

nameTxt.text = PandoraMaster.PlayFabCurrentPlayer.DisplayName;
nameTxt.text = PandoraMaster.PlayFabPlayerProfile.DisplayName;
pgTxt.text = PandoraUtil.ToLongNumberNotation(PandoraMaster.PlayFabInventory.VirtualCurrency["PG"]).ToString();
pcTxt.text = PandoraUtil.ToLongNumberNotation(PandoraMaster.PlayFabInventory.VirtualCurrency["PC"]).ToString();
prTxt.text = PandoraUtil.ToLongNumberNotation(PandoraMaster.PlayFabInventory.VirtualCurrency["PR"]).ToString();
Expand Down

0 comments on commit 65c48c9

Please sign in to comment.