Пример #1
0
        public void Awake()
        {
            instance = this;
            //Create Main game completable
            var trackerConfigs = Game.Instance.GameState.Data.getObjects <TrackerConfig>();

            PrepareTracker(trackerConfigs.Count == 0 ? new TrackerConfig() : trackerConfigs[0]);

            Completable mainGame = new Completable();

            Completable.Milestone gameStart = new Completable.Milestone();
            gameStart.setType(Completable.Milestone.MilestoneType.SCENE);
            gameStart.setId(Game.Instance.GameState.InitialChapterTarget.getId());
            mainGame.setStart(gameStart);
            mainGame.setId(Game.Instance.GameState.Data.getTitle());
            mainGame.setType(Completable.TYPE_GAME);

            Completable.Milestone gameEnd = new Completable.Milestone();
            gameEnd.setType(Completable.Milestone.MilestoneType.ENDING);
            mainGame.setEnd(gameEnd);

            Completable.Progress gameProgress = new Completable.Progress();
            gameProgress.setType(Completable.Progress.ProgressType.SUM);

            Completable.Score mainScore = new Completable.Score();
            mainScore.setMethod(Completable.Score.ScoreMethod.AVERAGE);

            var completables = Game.Instance.GameState.GetObjects <Completable>();

            foreach (Completable part in completables)
            {
                Completable.Milestone tmpMilestone = new Completable.Milestone();
                tmpMilestone.setType(Completable.Milestone.MilestoneType.COMPLETABLE);
                tmpMilestone.setId(part.getId());
                gameProgress.addMilestone(tmpMilestone);

                Completable.Score tmpScore = new Completable.Score();
                tmpScore.setMethod(Completable.Score.ScoreMethod.SINGLE);
                tmpScore.setType(Completable.Score.ScoreType.COMPLETABLE);
                tmpScore.setId(part.getId());
                mainScore.addSubScore(tmpScore);
            }
            mainGame.setProgress(gameProgress);
            mainGame.setScore(mainScore);

            completables.Insert(0, mainGame);

            SetCompletables(completables);

            Game.Instance.GameState.OnConditionChanged += (_, __) => ConditionChanged();
            Game.Instance.OnTargetChanged     += TargetChanged;
            Game.Instance.OnElementInteracted += ElementInteracted;
        }
Пример #2
0
        public static XmlElement buildProgressDOM(Completable.Progress progress)
        {
            XmlElement progressNode = Writer.GetDoc().CreateElement("progress");

            progressNode.SetAttribute("type", progress.getType().ToString());

            foreach (Completable.Milestone milestone in progress.getMilestones())
            {
                progressNode.AppendChild(CompletableDOMWriter.buildMilestoneDOM(milestone));
            }

            return(progressNode);
        }
Пример #3
0
        // #########################################
        // ############### COMPLETABLES ############
        // #########################################



        private void InitCompletables()
        {
            //Create Main game completabl
            Completable mainGame = new Completable();

            Completable.Milestone gameStart = new Completable.Milestone();
            gameStart.setType(Completable.Milestone.MilestoneType.SCENE);
            gameStart.setId(Game.Instance.GameState.InitialChapterTarget.getId());
            mainGame.setStart(gameStart);
            mainGame.setId(Game.Instance.GameState.Data.getTitle());
            mainGame.setType(Completable.TYPE_GAME);

            Completable.Milestone gameEnd = new Completable.Milestone();
            gameEnd.setType(Completable.Milestone.MilestoneType.ENDING);
            mainGame.setEnd(gameEnd);

            Completable.Progress gameProgress = new Completable.Progress();
            gameProgress.setType(Completable.Progress.ProgressType.SUM);

            Completable.Score mainScore = new Completable.Score();
            mainScore.setMethod(Completable.Score.ScoreMethod.AVERAGE);

            completables = new List <Completable>(Game.Instance.GameState.GetObjects <Completable>());

            foreach (Completable part in completables)
            {
                Completable.Milestone tmpMilestone = new Completable.Milestone();
                tmpMilestone.setType(Completable.Milestone.MilestoneType.COMPLETABLE);
                tmpMilestone.setId(part.getId());
                gameProgress.addMilestone(tmpMilestone);

                Completable.Score tmpScore = new Completable.Score();
                tmpScore.setMethod(Completable.Score.ScoreMethod.SINGLE);
                tmpScore.setType(Completable.Score.ScoreType.COMPLETABLE);
                tmpScore.setId(part.getId());
                mainScore.addSubScore(tmpScore);
            }
            mainGame.setProgress(gameProgress);
            mainGame.setScore(mainScore);

            completables.Insert(0, mainGame);

            SetCompletables(completables);
        }
Пример #4
0
        private Completable.Progress parseProgress(XmlElement element, params object[] parameters)
        {
            Completable.Progress progress = new Completable.Progress();

            string tmpString = "";

            tmpString = element.GetAttribute("type");
            if (!string.IsNullOrEmpty(tmpString))
            {
                progress.setType(ParseEnum <Completable.Progress.ProgressType>(tmpString));
            }

            foreach (XmlElement milestone in element.ChildNodes)
            {
                progress.addMilestone(parseMilestone(milestone, parameters));
            }

            return(progress);
        }
 public ProgressDataControl(Completable.Progress progress)
 {
     this.progress         = progress;
     milestoneDataControls = progress.getMilestones().ConvertAll(m => new MilestoneDataControl(m));
 }