コード例 #1
0
        public static RegistrationProfile Load(string userName)
        {
            RegistrationProfile registrationProfile = OfflineDatabase.Read <RegistrationProfile>(Id(userName));

            if (string.IsNullOrEmpty(registrationProfile.userName))
            {
                registrationProfile.userName = userName;
                OfflineDatabase.Write(registrationProfile, Id(userName));
            }
            return(registrationProfile);
        }
コード例 #2
0
        public static void ImportData(string userName)
        {
            JsonService jsonService = Service.Get <JsonService>();
            TextEditor  textEditor  = new TextEditor();

            textEditor.Paste();
            OfflineDataExport offlineDataExport = jsonService.Deserialize <OfflineDataExport>(textEditor.text);

            if (string.IsNullOrEmpty(userName))
            {
                userName = offlineDataExport.UserName;
            }
            else
            {
                RegistrationProfile registrationProfile = OfflineDatabase.Read <RegistrationProfile>(RegistrationProfile.Id(userName));
                if (!string.IsNullOrEmpty(registrationProfile.userName))
                {
                    offlineDataExport.RegistrationProfile.displayName = registrationProfile.displayName;
                    offlineDataExport.RegistrationProfile.firstName   = registrationProfile.firstName;
                    offlineDataExport.RegistrationProfile.parentEmail = registrationProfile.parentEmail;
                }
                else
                {
                    offlineDataExport.RegistrationProfile.displayName = userName;
                }
            }
            string token = RegistrationProfile.Id(userName);

            offlineDataExport.RegistrationProfile.userName = userName;
            OfflineDatabase.Write(offlineDataExport.BreadCrumbs, token);
            OfflineDatabase.Write(offlineDataExport.ClaimableRewards, token);
            OfflineDatabase.Write(offlineDataExport.ConsumableInventory, token);
            OfflineDatabase.Write(offlineDataExport.Equipment, token);
            OfflineDatabase.Write(offlineDataExport.DailySpinData, token);
            OfflineDatabase.Write(offlineDataExport.IglooData, token);
            OfflineDatabase.Write(offlineDataExport.RoomRewards, token);
            OfflineDatabase.Write(offlineDataExport.Assets, token);
            OfflineDatabase.Write(offlineDataExport.Outfit, token);
            OfflineDatabase.Write(offlineDataExport.Profile, token);
            OfflineDatabase.Write(offlineDataExport.QuestStates, token);
            OfflineDatabase.Write(offlineDataExport.RegistrationProfile, token);
            OfflineDatabase.Write(offlineDataExport.IglooLayouts, token);
            OfflineDatabase.Write(offlineDataExport.Tube, token);
            OfflineDatabase.Write(offlineDataExport.Tutorials, token);
        }