Exemplo n.º 1
0
        public static void ShowProgressEditor(Rect rect, ProgressDataControl progress)
        {
            var window = ProgressEditorWindow.Create(progress);

            rect.position = GUIUtility.GUIToScreenPoint(rect.position);
            window.ShowAsDropDown(rect, new Vector2(Mathf.Max(rect.width, 250), 300));
        }
        public void Init(Completable.Progress progress)
        {
            editor = EditorWindow.GetWindow <ProgressEditorWindow>();

            clearImg   = (Texture2D)Resources.Load("EAdventureData/img/icons/deleteContent", typeof(Texture2D));
            addTexture = (Texture2D)Resources.Load("EAdventureData/img/icons/addNode", typeof(Texture2D));
            moveUp     = (Texture2D)Resources.Load("EAdventureData/img/icons/moveNodeUp", typeof(Texture2D));
            moveDown   = (Texture2D)Resources.Load("EAdventureData/img/icons/moveNodeDown", typeof(Texture2D));

            this.progress = progress;
        }
Exemplo n.º 3
0
        public CompletablesWindow(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, params GUILayoutOption[] aOptions)
            : base(aStartPos, aContent, aStyle, aOptions)
        {
            completablesList = new DataControlList()
            {
                RequestRepaint = Repaint,
                Columns        = new List <ColumnList.Column>()
                {
                    new ColumnList.Column()
                    {
                        Text = TC.get("Analytics.Completable.Id")
                    },
                    new ColumnList.Column()
                    {
                        Text = TC.get("Analytics.Completable.Start")
                    },
                    new ColumnList.Column()
                    {
                        Text = TC.get("Analytics.Completable.End")
                    },
                    new ColumnList.Column()
                    {
                        Text = TC.get("Analytics.Completable.Progress")
                    },
                    new ColumnList.Column()
                    {
                        Text = TC.get("Analytics.Completable.Score")
                    },
                    new ColumnList.Column()
                    {
                        Text        = TC.get("Repeatable"),
                        SizeOptions = new GUILayoutOption[] { GUILayout.Width(70) }
                    }
                },
                drawCell = (rect, row, column, isActive, isFocused) =>
                {
                    var completable = completablesList.list[row] as CompletableDataControl;
                    switch (column)
                    {
                    case 0:
                        completable.renameElement(EditorGUI.TextField(rect, completable.getId()));
                        break;

                    case 1:
                        if (GUI.Button(rect, completable.getStart().getContent().ToString()))
                        {
                            MilestoneEditorWindow.ShowMilestoneEditor(rect, completable.getStart());
                        }
                        break;

                    case 2:
                        if (GUI.Button(rect, completable.getEnd().getContent().ToString()))
                        {
                            MilestoneEditorWindow.ShowMilestoneEditor(rect, completable.getEnd());
                        }
                        break;

                    case 3:
                        if (GUI.Button(rect, TC.get("Analytics.Completable.Define")))
                        {
                            ProgressEditorWindow.ShowProgressEditor(rect, completable.getProgress());
                        }
                        break;

                    case 4:
                    {
                        if (Available)
                        {
                            ScoreEditor(rect, completable.getScore());
                        }
                        else
                        {
                            EditorGUI.HelpBox(rect, TC.get("Condition.Var.Warning"), MessageType.Error);
                        }
                    }
                    break;

                    case 5:
                        completable.setRepeatable(GUI.Toggle(rect, completable.getRepeatable(), "?"));
                        break;
                    }
                }
            };
        }
Exemplo n.º 4
0
 public static ProgressEditorWindow Create(ProgressDataControl progress)
 {
     editor = ScriptableObject.CreateInstance <ProgressEditorWindow>();
     editor.Init(progress);
     return(editor);
 }
Exemplo n.º 5
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();
        }