Example #1
0
        //TODO: Make this less horrible
        public override void Draw(CutsceneEditor editor, CutscenePlayer player, Cutscene cutscene, Rect rect,
                                  int tokenIndex, GUIContent name, Reference <T> value, Type valueType, FieldInfo fieldInfo, Setter setter)
        {
            if (value == null)
            {
                value = new Reference <T>();
            }
            GUIContent label;
            var        found = player == null ? null : value.Resolve(player);

            switch (value.Type)
            {
            case Reference.ReferenceType.Future:
                label = name;
                break;

            case Reference.ReferenceType.Exposed:
                label = ExposedReferenceDrawer <T> .GetLabel(found, value.PropertyName, new GUIContent(name));

                break;

            default:
                return;
            }
            var labelWidth = GUIStyle.none.CalcSize(new GUIContent(label)).x;
            var r2         = rect.SubRect(TypeWidth, rect.height, labelWidth + LabelOffset);

            value.Type = (Reference.ReferenceType)EditorGUI.EnumPopup(r2, value.Type);
            switch (value.Type)
            {
            case Reference.ReferenceType.Exposed:
                value.Id = DrawExposed(value, player, rect, name);
                break;

            case Reference.ReferenceType.Future:
                value.Id = DrawFuture(value, cutscene, rect, name, tokenIndex);
                break;
            }
            setter(value);
        }
Example #2
0
 private int DrawExposed(Reference <T> value, CutscenePlayer cutscene, Rect rect, GUIContent name)
 {
     return(ExposedReferenceDrawer <T> .DrawExposed(cutscene, value, name, rect).exposedName.GetHashCode());
 }