コード例 #1
0
    public void SaveEventually()
    {
        toyx.SaveEventually(delegate(TwinSpriteError error) {
            if (error != null)
            {
                infoMessage = "Error saving: " + error.message + "\nError code: " + error.errorCode;
            }
            else
            {
                infoMessage = "Saved: " + toyx;
            }

            guiEnabled = true;
        });
    }
コード例 #2
0
    public void SaveEventually()
    {
        // If no id, do nothing
        if (toyxId == null || toyxId.Length == 0)
        {
            Debug.Log("No toyxID, playing without toyx.");
            return;
        }


        // No toyx, create session before
        if (toyx == null)
        {
            infoMessage += "Can't fetching, create session before.\n";
            return;
        }

        // Set properties
        toyx.PutInt(EXPERIENCE, experience);
        toyx.PutInt(GOLD, gold);
        toyx.PutInt(LEVEL, level);
        toyx.PutInt(WEAPON, (int)weapon);

        // Save
        toyx.SaveEventually(delegate(TwinSpriteError error) {
            if (error != null)
            {
                if (error.errorCode == TwinSpriteError.TwinSpriteNoDataAvaiable)
                {
                    infoMessage += "No data avaiable, fetch it before.\n";
                }
                else
                {
                    infoMessage += "Error saving: " + error.message + "\nError code: " + error.errorCode + "\n";
                }
            }
            else
            {
                infoMessage += "Saved: " + toyx + "\n";
            }
        });
    }