public void OnGUI()
        {
            GUILayout.Label("Progress is given by: ");

            progress.setType((Completable.Progress.ProgressType)EditorGUILayout.Popup((int)progress.getType(), typeoptions));

            GUILayout.Label("Milestones: ");

            //GUILayout.BeginArea(tableRect);
            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical(GUILayout.Width(position.width * 0.9f));
            GUILayout.BeginHorizontal();
            if (progress.getType() == Completable.Progress.ProgressType.SUM)
            {
                GUILayout.Box("Time", GUILayout.Width(position.width * 0.88f));
            }
            else
            {
                GUILayout.Box("Time", GUILayout.Width(position.width * 0.44f));
                GUILayout.Box("Progress", GUILayout.Width(position.width * 0.44f));
            }
            GUILayout.EndHorizontal();

            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            foreach (Completable.Milestone milestone in progress.getMilestones())
            {
                GUILayout.BeginHorizontal();
                if (progress.getType() == Completable.Progress.ProgressType.SUM)
                {
                    if (GUILayout.Button(milestone.ToString(), GUILayout.Width(position.width * 0.88f)))
                    {
                        MilestoneEditorWindow window = ScriptableObject.CreateInstance <MilestoneEditorWindow>();
                        window.Init(milestone);
                    }
                }
                else
                {
                    if (GUILayout.Button(milestone.ToString(), GUILayout.Width(position.width * 0.44f)))
                    {
                        MilestoneEditorWindow window = ScriptableObject.CreateInstance <MilestoneEditorWindow>();
                        window.Init(milestone);
                    }

                    milestone.setProgress(EditorGUILayout.Slider(milestone.getProgress(), 0, 1, GUILayout.Width(position.width * 0.44f)));
                }

                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();
            GUILayout.EndVertical();


            //GUILayout.EndArea();


            //GUILayout.BeginArea(rightPanelRect);
            GUILayout.BeginVertical(GUILayout.Width(0.1f * position.width));
            if (GUILayout.Button(addTexture))
            {
                progress.addMilestone(new Completable.Milestone());
            }
            if (GUILayout.Button(moveUp))
            {
                int pos = progress.getMilestones().IndexOf(selectedMilestone);
                if (pos > 0)
                {
                    Completable.Milestone tmp = progress.getMilestones()[pos - 1];
                    progress.getMilestones()[pos - 1] = progress.getMilestones()[pos];
                    progress.getMilestones()[pos]     = tmp;
                }
            }
            if (GUILayout.Button(moveDown))
            {
                int pos = progress.getMilestones().IndexOf(selectedMilestone);
                if (pos < progress.getMilestones().Count - 1)
                {
                    Completable.Milestone tmp = progress.getMilestones()[pos + 1];
                    progress.getMilestones()[pos + 1] = progress.getMilestones()[pos];
                    progress.getMilestones()[pos]     = tmp;
                }
            }
            if (GUILayout.Button(clearImg))
            {
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }
Exemple #2
0
        public override void Draw(int aID)
        {
            var windowWidth  = Rect.width;
            var windowHeight = Rect.height;

            tableRect      = new Rect(0f, 200, 0.8f * windowWidth, windowHeight * 0.33f);
            rightPanelRect = new Rect(0.85f * windowWidth, 0.1f * windowHeight, 0.08f * windowWidth, 0.33f * windowHeight);

            GUILayout.Label(TC.get("Analytics.GameStart") + Controller.getInstance().getSelectedChapterDataControl().getInitialScene());
            GUILayout.Label(TC.get("Analytics.GameEnd"));

            end = EditorGUILayout.Popup(end, endoptions);

            GUILayout.Label(TC.get("Analytics.GameProgress"));

            progress = EditorGUILayout.Popup(progress, progressoptions);

            if (progress == 1)
            {
                GUILayout.Button(TC.get("Analytics.EditProgress"));
            }

            //GUILayout.BeginArea(tableRect);
            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
            GUILayout.BeginHorizontal();
            GUILayout.Box(TC.get("Analytics.Completable.Id"), GUILayout.Width(windowWidth * col_width));
            GUILayout.Box(TC.get("Analytics.Completable.Start"), GUILayout.Width(windowWidth * col_width));
            GUILayout.Box(TC.get("Analytics.Completable.End"), GUILayout.Width(windowWidth * col_width));
            GUILayout.Box(TC.get("Analytics.Completable.Progress"), GUILayout.Width(windowWidth * col_width));
            GUILayout.Box(TC.get("Analytics.Completable.Score"), GUILayout.Width(windowWidth * col_width));
            GUILayout.EndHorizontal();

            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            foreach (Completable completable in completables)
            {
                GUILayout.BeginHorizontal();
                completable.setId(GUILayout.TextField(completable.getId(), GUILayout.Width(windowWidth * col_width)));

                if (GUILayout.Button(completable.getStart().ToString(), GUILayout.Width(windowWidth * col_width)))
                {
                    MilestoneEditorWindow window = ScriptableObject.CreateInstance <MilestoneEditorWindow>();
                    window.Init(completable.getStart());
                }

                if (GUILayout.Button(completable.getEnd().ToString(), GUILayout.Width(windowWidth * col_width)))
                {
                    MilestoneEditorWindow window = ScriptableObject.CreateInstance <MilestoneEditorWindow>();
                    window.Init(completable.getEnd());
                }

                if (GUILayout.Button(TC.get("Analytics.Completable.Define"), GUILayout.Width(windowWidth * col_width)))
                {
                    ProgressEditorWindow window = ScriptableObject.CreateInstance <ProgressEditorWindow>();
                    window.Init(completable.getProgress());
                }
                selected_variable[completable] = EditorGUILayout.Popup(selected_variable[completable], variables, GUILayout.Width(windowWidth * col_width));
                completable.getScore().setId(variables[selected_variable[completable]]);

                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();
            GUILayout.EndVertical();


            //GUILayout.EndArea();


            //GUILayout.BeginArea(rightPanelRect);
            GUILayout.BeginVertical(GUILayout.Width(0.1f * windowWidth));
            if (GUILayout.Button(addTexture))
            {
                Completable       nc    = new Completable();
                Completable.Score score = new Completable.Score();
                score.setMethod(Completable.Score.ScoreMethod.SINGLE);
                score.setType(Completable.Score.ScoreType.VARIABLE);
                nc.setScore(score);
                completables.Add(nc);
                selected_variable.Add(nc, 0);
            }
            if (GUILayout.Button(moveUp))
            {
                int pos = completables.IndexOf(selectedCompletable);
                if (pos > 0)
                {
                    Completable tmp = completables[pos - 1];
                    completables[pos - 1] = completables[pos];
                    completables[pos]     = tmp;
                }
            }
            if (GUILayout.Button(moveDown))
            {
                int pos = completables.IndexOf(selectedCompletable);
                if (pos < completables.Count - 1)
                {
                    Completable tmp = completables[pos + 1];
                    completables[pos + 1] = completables[pos];
                    completables[pos]     = tmp;
                }
            }
            if (GUILayout.Button(clearImg))
            {
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }