Пример #1
0
        public static StatusSave SaveProfileWithNewName(Profiles profiles, Profile profile, string newProfileName)
        {
            var result = new StatusSave();

            // does an profile with the same name already exist
            var existingProfile = GetProfileByName(profiles, profile.Name);

            if (existingProfile != null)
            {
                // a profile with the same name already existed and we're allowed overwrite it
                profiles = DeleteProfile(profiles, existingProfile, true);

                profile.Name = newProfileName;
                profiles.Items.Add(profile);

                result.Profiles = SaveProfiles(profiles);
            }

            // finish setting the status
            if (result.Profiles == null)
            {
                if (result.Message == string.Empty)
                {
                    result.Message = "There was an problem saving the profile.";
                }
            }
            else
            {
                result.Successful = true;
                result.Message    = "The profile was saved successfully.";
            }

            return(result);
        }
Пример #2
0
    public StatusBlockSave getStatusBlockSave()
    {
        StatusBlockSave.Builder builder = StatusBlockSave.CreateBuilder();

        foreach (StatusCheckable s in statuses)
        {
            StatusSave.Builder sBuilder = StatusSave.CreateBuilder();
            sBuilder.SetAlreadyMet(s.isStatusMet());
            s.setBuilderWithData(ref sBuilder);
            builder.AddStats(sBuilder.Build());
        }

        return(builder.Build());
    }
Пример #3
0
        /**
         * Sets teh given quest save data protobuf with this step information
         */
        public void setQuestWithStepInformation(ref QuestSave.Builder builder)
        {
            foreach (KeyValuePair <StatusCheckable, bool> pair in statuses)
            {
                StatusSave.Builder sBuilder = StatusSave.CreateBuilder();
                sBuilder.SetAlreadyMet(pair.Value);
                pair.Key.setBuilderWithData(ref sBuilder);
                builder.AddCurrentStepData(sBuilder.Build());
            }

            foreach (Point p in spawnLocations)
            {
                PointProto.Builder pBuilder = PointProto.CreateBuilder();
                pBuilder.SetX(p.x);
                pBuilder.SetY(p.y);
                builder.AddCurrentStepSpawnLocations(pBuilder.Build());
            }
        }
Пример #4
0
        public AlternativeSave getAlternativeSave()
        {
            AlternativeSave.Builder builder = AlternativeSave.CreateBuilder();
            builder.SetUid(uid);

            foreach (List <StatusCheckable> l in alternativeRequirment)
            {
                StatusBlockSave.Builder bBuilder = StatusBlockSave.CreateBuilder();
                foreach (StatusCheckable s in l)
                {
                    StatusSave.Builder sBuilder = StatusSave.CreateBuilder();
                    sBuilder.SetAlreadyMet(s.isStatusMet());
                    s.setBuilderWithData(ref sBuilder);
                    bBuilder.AddStats(sBuilder.Build());
                }
                builder.AddStats(bBuilder.Build());
            }

            return(builder.Build());
        }
Пример #5
0
 /**
  * Set this status checkable with the given saveData
  */
 public void setFromData(StatusSave saveData)
 {
 }
Пример #6
0
 public void setFromData(StatusSave saveData)
 {
     currentAmount = saveData.Count;
 }