コード例 #1
0
        protected void OnGUI()
        {
            if (score.getMethod() == Completable.Score.ScoreMethod.SINGLE)
            {
                EditorGUILayout.HelpBox("The score subscores you're trying to edit is in SINGLE mode. Select the SUM or AVERAGE modes to edit its subscores.", MessageType.Error);
                return;
            }

            scoresList.SetData(score, s => (s as ScoreDataControl).getScores().Cast <DataControl>().ToList());
            scoresList.DoList(position.height - 15);
        }
コード例 #2
0
        public static void ScoreEditor(Rect rect, ScoreDataControl score)
        {
            var rects = DivideRect(rect, 3);

            score.setMethod((Completable.Score.ScoreMethod)EditorGUI.EnumPopup(rects[0], score.getMethod()));
            switch (score.getMethod())
            {
            case Completable.Score.ScoreMethod.AVERAGE:
            case Completable.Score.ScoreMethod.SUM:
                rects[1].width += rects[2].width;
                if (GUI.Button(rects[1], "SubScores"))
                {
                    CompletableScoreEditorWindow.Create(score);
                }
                break;

            case Completable.Score.ScoreMethod.SINGLE:
                EditorGUI.BeginChangeCheck();
                var newType = (Completable.Score.ScoreType)EditorGUI.EnumPopup(rects[1], score.getType());
                if (EditorGUI.EndChangeCheck())
                {
                    score.setType(newType);
                }

                string[] switchOn = null;
                switch (score.getType())
                {
                case Completable.Score.ScoreType.VARIABLE: switchOn = Controller.Instance.VarFlagSummary.getVars(); break;

                case Completable.Score.ScoreType.COMPLETABLE: switchOn = Controller.Instance.IdentifierSummary.getIds <Completable>(); break;
                }
                EditorGUI.BeginChangeCheck();
                var newSwitchOn = switchOn[EditorGUI.Popup(rects[2], Mathf.Max(0, Array.IndexOf(switchOn, score.getId())), switchOn)];
                if (EditorGUI.EndChangeCheck() || score.getId() == null)
                {
                    score.setId(newSwitchOn);
                }

                break;
            }
        }