예제 #1
0
파일: GUIUtil.cs 프로젝트: jottap/SyncUtil
        static object SliderFuncVector <T>(object v, object min, object max, ref string unparsedStr, string label = "", string[] elemLabels = null)
        {
            var elementNum = AbstractVector.GetElementNum <T>();
            var eLabels    = elemLabels ?? defaultElemLabelsVector;

            using (var h0 = new GUILayout.HorizontalScope())
            {
                if (!string.IsNullOrEmpty(label))
                {
                    GUILayout.Label(label);
                }
                using (var vertical = new GUILayout.VerticalScope())
                {
                    var strs = SplitUnparsedStr(unparsedStr, elementNum);
                    for (var i = 0; i < elementNum; ++i)
                    {
                        using (var h1 = new GUILayout.HorizontalScope())
                        {
                            var elem = Slider(AbstractVector.GetAtIdx <T>(v, i), AbstractVector.GetAtIdx <T>(min, i), AbstractVector.GetAtIdx <T>(max, i), ref strs[i], eLabels[i]);
                            v = AbstractVector.SetAtIdx <T>(v, i, elem);
                        }
                    }
                    unparsedStr = JoinUnparsedStr(strs);
                }
            }

            return(v);
        }
예제 #2
0
파일: GUIUtil.cs 프로젝트: jottap/SyncUtil
        static object FieldFuncVector <T>(object v, ref string unparsedStr, params GUILayoutOption[] options)
        {
            var elementNum = AbstractVector.GetElementNum <T>();
            var strs       = SplitUnparsedStr(unparsedStr, elementNum);

            for (var i = 0; i < elementNum; ++i)
            {
                var elem = Field(AbstractVector.GetAtIdx <T>(v, i), ref strs[i], "", options);
                v = AbstractVector.SetAtIdx <T>(v, i, elem);
            }
            unparsedStr = JoinUnparsedStr(strs);
            return(v);
        }