コード例 #1
0
    private void InitToyx(string toyxId)
    {
        // Show spinner
        loadingBackground.SetActive(true);


        // Create sessión
        toyxManager.CreateSession(toyxId, delegate(TwinSpriteError error) {
            if (error != null)
            {
                ShowPopup("Error creating session: " + error.message + "\nError code: " + error.errorCode + "\n");

                // Fetch
            }
            else
            {
                toyxManager.Fetch(delegate(TwinSpriteError fetchError) {
                    if (fetchError != null)
                    {
                        ShowPopup("Error fetching: " + error.message + "\nError code: " + error.errorCode + "\n");

                        // No error, go to game
                    }
                    else
                    {
                        loadLevel = true;
                    }
                });
            }
        });
    }
コード例 #2
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        ToyxManager toyxManager = (ToyxManager)target;

        // Create session button
        if (GUILayout.Button("Create Session"))
        {
            toyxManager.CreateSession(null);
        }

        // Fetch if needed button
        if (GUILayout.Button("Fetch If Needed"))
        {
            toyxManager.FetchIfNeeded(null);
        }

        // Fetch button
        if (GUILayout.Button("Fetch"))
        {
            toyxManager.Fetch(null);
        }

        // Save button
        if (GUILayout.Button("Save"))
        {
            toyxManager.Save(null);
        }

        // SaveEventually button
        if (GUILayout.Button("Save Eventually"))
        {
            toyxManager.SaveEventually();
        }

        // Show Console button
        if (showConsole)
        {
            if (GUILayout.Button("Hide Console"))
            {
                showConsole = false;
            }
        }
        else
        {
            if (GUILayout.Button("Show Console"))
            {
                showConsole = true;
            }
        }

        // Clear console
        if (GUILayout.Button("Clear Console"))
        {
            toyxManager.infoMessage = "";
        }

        // Console
        if (showConsole && toyxManager.infoMessage != null)
        {
            GUILayout.Label(toyxManager.infoMessage);
        }
    }