Esempio n. 1
0
        void Assign(ChoiceStop choiceStop, ChoiceStopResource choiceStopResource)
        {
            choiceStop.Id = choiceStopResource.Id;

            if (choiceStopResource.IfUnlocked != null)
            {
                choiceStop.IfUnlocked = choiceStopResource.IfUnlocked;
            }

            if (choiceStopResource.IfUnvisible != null)
            {
                choiceStop.IfUnvisible = choiceStopResource.IfUnvisible;
            }

            if (choiceStopResource.IfVisible != null)
            {
                choiceStop.IfVisible = choiceStopResource.IfVisible;
            }

            if (choiceStopResource.Value != null)
            {
                choiceStop.Value = choiceStopResource.Value;
            }

            if ((choiceStopResource.ChoiceOpensThis != null) && choiceStop.ChoiceOpensThis == null)
            {
                Choice newChoice = Convert(choiceStopResource.ChoiceOpensThis);
                choiceStop.ChoiceOpensThis = newChoice;
                if (newChoice.OpensStops == null)
                {
                    newChoice.OpensStops = new List <ChoiceStop>();
                }
                newChoice.OpensStops.Add(choiceStop);
            }
        }
Esempio n. 2
0
        public ChoiceStop Convert(ChoiceStopResource choiceStopResource)
        {
            var existingChoiceStop = CreatedChoiceStops.Where(obj => obj.Id == choiceStopResource.Id).FirstOrDefault();

            if (existingChoiceStop != null)
            {
                Assign(existingChoiceStop, choiceStopResource);
                return(existingChoiceStop);
            }
            else
            {
                var newChoiceStop = new ChoiceStop();
                CreatedChoiceStops.Add(newChoiceStop);
                Assign(newChoiceStop, choiceStopResource);
                return(newChoiceStop);
            }
        }
Esempio n. 3
0
        void Assign(Stop stop, StopResource StopResource)
        {
            stop.Id = StopResource.Id;

            if (StopResource.IsFinal != null)
            {
                stop.IsFinal = StopResource.IsFinal;
            }

            if (StopResource.IsInitial != null)
            {
                stop.IsInitial = StopResource.IsInitial;
            }

            if (StopResource.Name != null)
            {
                stop.Name = StopResource.Name;
            }

            if (StopResource.State1Requirement != null)
            {
                stop.State1Requirement = (short)StopResource.State1Requirement;
            }

            if (StopResource.State2Requirement != null)
            {
                stop.State2Requirement = (short)StopResource.State2Requirement;
            }

            if (StopResource.State3Requirement != null)
            {
                stop.State3Requirement = (short)StopResource.State3Requirement;
            }

            if (StopResource.State4Requirement != null)
            {
                stop.State4Requirement = (short)StopResource.State4Requirement;
            }

            if ((StopResource.Position != null) && stop.Position == null)
            {
                MapPosition newMapPosition = Convert(StopResource.Position);
                stop.Position = newMapPosition;
                newMapPosition.PositionOfStop = stop;
            }

            if ((StopResource.Passwords != null) && stop.Passwords == null)
            {
                stop.Passwords = new List <PasswordGameRequirement>();

                foreach (PasswordGameRequirementResource passwordResource in StopResource.Passwords)
                {
                    PasswordGameRequirement newPassword = Convert(passwordResource);
                    stop.Passwords.Add(newPassword);
                    newPassword.Stop = stop;
                }
            }

            if ((StopResource.Questions != null) && stop.Questions == null)
            {
                stop.Questions = new List <Question>();

                foreach (QuestionResource questionResource in StopResource.Questions)
                {
                    Question newQuestion = Convert(questionResource);
                    stop.Questions.Add(newQuestion);
                    if (newQuestion.StopsThatOpenThis == null)
                    {
                        newQuestion.StopsThatOpenThis = new List <Stop>();
                    }
                    newQuestion.StopsThatOpenThis.Add(stop);
                }
            }

            if ((StopResource.PositionsDisplayAfterDisplay != null) && stop.PositionsDisplayAfterDisplay == null)
            {
                stop.PositionsDisplayAfterDisplay = new List <MapPosition>();

                foreach (MapPositionResource positionResource in StopResource.PositionsDisplayAfterDisplay)
                {
                    MapPosition newPosition = Convert(positionResource);
                    stop.PositionsDisplayAfterDisplay.Add(newPosition);
                    if (newPosition.StopDisplayAfterDisplay == null)
                    {
                        newPosition.StopDisplayAfterDisplay = new List <Stop>();
                    }
                    newPosition.StopDisplayAfterDisplay.Add(stop);
                }
            }

            if ((StopResource.PositionsDisplayAfterUnlock != null) && stop.PositionsDisplayAfterUnlock == null)
            {
                stop.PositionsDisplayAfterUnlock = new List <MapPosition>();

                foreach (MapPositionResource positionResource in StopResource.PositionsDisplayAfterUnlock)
                {
                    MapPosition newPosition = Convert(positionResource);
                    stop.PositionsDisplayAfterUnlock.Add(newPosition);
                    if (newPosition.StopDisplayAfterUnlock == null)
                    {
                        newPosition.StopDisplayAfterUnlock = new List <Stop>();
                    }
                    newPosition.StopDisplayAfterUnlock.Add(stop);
                }
            }

            if ((StopResource.Opens != null) && stop.Opens == null)
            {
                stop.Opens = new List <StopStop>();

                foreach (StopStopResource stopStopResource in StopResource.Opens)
                {
                    StopStop newStopStop = Convert(stopStopResource);
                    stop.Opens.Add(newStopStop);
                    newStopStop.StopOpensThis = stop;
                }
            }

            if ((StopResource.ChoicesOpenThis != null) && stop.ChoicesOpenThis == null)
            {
                stop.ChoicesOpenThis = new List <ChoiceStop>();

                foreach (ChoiceStopResource choiceOpenThis in StopResource.ChoicesOpenThis)
                {
                    ChoiceStop newChoiceStop = Convert(choiceOpenThis);
                    stop.ChoicesOpenThis.Add(newChoiceStop);
                    newChoiceStop.Opens = stop;
                }
            }

            if ((StopResource.DisplayObjectsHints != null) && stop.DisplayObjectsHints == null)
            {
                stop.DisplayObjectsHints = new List <DisplayObjectStopDisplayAfterDisplay>();

                foreach (DisplayObjectStopDisplayAfterDisplayResource hint in StopResource.DisplayObjectsHints)
                {
                    DisplayObjectStopDisplayAfterDisplay newHint = Convert(hint);
                    stop.DisplayObjectsHints.Add(newHint);
                    newHint.Stop = stop;
                }
            }

            if ((StopResource.DisplayObjectsRewards != null) && stop.DisplayObjectsRewards == null)
            {
                stop.DisplayObjectsRewards = new List <DisplayObjectStopDisplayAfterUnlock>();

                foreach (DisplayObjectStopDisplayAfterUnlockResource reward in StopResource.DisplayObjectsRewards)
                {
                    DisplayObjectStopDisplayAfterUnlock newReward = Convert(reward);
                    stop.DisplayObjectsRewards.Add(newReward);
                    newReward.Stop = stop;
                }
            }
        }