コード例 #1
0
        private void DrawLayoutSelection(OnNetInstanceCacheContainerXml item, Rect areaRect)
        {
            bool dirtyType = false;

            GUIKlyteCommons.DoInHorizontal(() =>
            {
                GUI.SetNextControlName(f_ModelSelectType);
                var modelType = GUILayout.SelectionGrid(m_currentModelType, m_modelTypesStr, m_modelTypesStr.Length);
                dirtyType     = m_currentModelType != modelType;
                if (dirtyType)
                {
                    item.PropLayoutName = null;
                    item.SimpleProp     = null;
                    m_currentModelType  = modelType;
                    GUI.FocusControl(f_ModelSelect);
                }
            }, GUILayout.Width(areaRect.width));

            bool dirtyInput = false;

            GUIKlyteCommons.DoInHorizontal(() =>
            {
                GUI.SetNextControlName(f_ModelSelect);
                var newInput = GUILayout.TextField(m_lastModelFilterText);
                dirtyInput   = newInput != m_lastModelFilterText;
                if (dirtyInput)
                {
                    m_lastModelFilterText = newInput;
                }
            }, GUILayout.Width(areaRect.width));

            if (dirtyInput || dirtyType)
            {
                RestartLayoutFilterCoroutine();
            }
            GUIKlyteCommons.DoInScroll(ref m_resultViewScroll, false, true, () =>
            {
                var selectLayout = GUILayout.SelectionGrid(-1, m_searchResult.Value, 1, GUILayout.Width(areaRect.width - 25));
                if (selectLayout >= 0)
                {
                    if (m_currentModelType == 0)
                    {
                        item.PropLayoutName   = m_searchResult.Value[selectLayout];
                        item.m_simplePropName = null;
                    }
                    else
                    {
                        item.PropLayoutName = null;
                        PropIndexes.instance.PrefabsLoaded.TryGetValue(m_searchResult.Value[selectLayout], out PropInfo info);
                        item.SimpleProp = info;
                    }
                }
            }, GUILayout.Width(areaRect.width), GUILayout.Height(areaRect.height - 80));

            if (GUILayout.Button("OK", GUILayout.Width(areaRect.width)))
            {
                m_filterSelectionView = false;
                GUI.FocusControl(null);
            }
        }
コード例 #2
0
 private void DrawTargetSegmentSelectionList(OnNetInstanceCacheContainerXml item, Rect areaRect)
 {
     for (int i = 0; i <= 4; i++)
     {
         GUIKlyteCommons.DoInHorizontal(() =>
         {
             GUILayout.Label(string.Format(Locale.Get("K45_WTS_ONNETEDITOR_TARGET"), i), GUILayout.Width(areaRect.width / 4));
             GUI.SetNextControlName(f_Targets + i);
             if (GUILayout.Button(GetSegmentName(item, i)))
             {
                 OnEnterPickTarget(item, i);
             }
         }, GUILayout.Width(areaRect.width));
     }
 }
コード例 #3
0
        private void DrawRegularTab(OnNetInstanceCacheContainerXml item, Rect areaRect)
        {
            GUIKlyteCommons.DoInHorizontal(() =>
            {
                GUILayout.Label(Locale.Get("K45_WTS_ONNETEDITOR_NAME"));
                var newName = GUITextField.TextField(f_SaveName, item.SaveName);
                if (!newName.IsNullOrWhiteSpace() && newName != item.SaveName)
                {
                    item.SaveName = newName;
                }
            });

            GUIKlyteCommons.DoInHorizontal(() =>
            {
                GUILayout.Label(Locale.Get("K45_WTS_BUILDINGEDITOR_MODELLAYOUTSELECT"));
                GUI.SetNextControlName(f_ModelSelect);
                if (GUILayout.Button((m_currentModelType != 1 ? item.PropLayoutName : PropIndexes.GetListName(item.SimpleProp)) ?? "<color=#FF00FF>--NULL--</color>"))
                {
                    m_filterSelectionView = true;
                    m_lastModelFilterText = (m_currentModelType != 1 ? item.PropLayoutName : PropIndexes.GetListName(item.SimpleProp)) ?? "";
                    m_searchResult.Value  = null;
                    RestartLayoutFilterCoroutine();
                }
            });

            GUIKlyteCommons.DoInHorizontal(() =>
            {
                GUI.SetNextControlName(f_InstanceMode);
                item.SegmentPositionRepeating = GUILayout.Toggle(item.SegmentPositionRepeating, Locale.Get("K45_WTS_POSITIONINGMODE_ISMULTIPLE"));
            });

            if (item.SegmentPositionRepeating)
            {
                GUIKlyteCommons.DoInHorizontal(() =>
                {
                    GUILayout.Label(Locale.Get("K45_WTS_ONNETEDITOR_SEGMENTPOSITION_START"));
                    GUILayout.Space(areaRect.width / 3);
                    var rect = GUILayoutUtility.GetLastRect();
                    item.SegmentPositionStart = GUI.HorizontalSlider(new Rect(rect.x, rect.yMin + 7, rect.width, 15), item.SegmentPositionStart, 0, 1);
                    item.SegmentPositionStart = GUIFloatField.FloatField(f_SegmentPathStart, item.SegmentPositionStart, 0, 1);
                });
                GUIKlyteCommons.DoInHorizontal(() =>
                {
                    GUILayout.Label(Locale.Get("K45_WTS_ONNETEDITOR_SEGMENTPOSITION_END"));
                    GUILayout.Space(areaRect.width / 3);
                    var rect = GUILayoutUtility.GetLastRect();
                    item.SegmentPositionEnd = GUI.HorizontalSlider(new Rect(rect.x, rect.yMin + 7, rect.width, 15), item.SegmentPositionEnd, 0, 1);
                    item.SegmentPositionEnd = GUIFloatField.FloatField(f_SegmentPathEnd, item.SegmentPositionEnd, 0, 1);
                });
                GUIKlyteCommons.DoInHorizontal(() =>
                {
                    GUILayout.Label(Locale.Get("K45_WTS_ONNETEDITOR_SEGMENTPOSITION_COUNT"));
                    item.SegmentPositionRepeatCount = (ushort)GUIIntField.IntField(f_SegmentRepeatCount, item.SegmentPositionRepeatCount, 1, ushort.MaxValue);
                });
            }
            else
            {
                GUIKlyteCommons.DoInHorizontal(() =>
                {
                    GUILayout.Label(Locale.Get("K45_WTS_ONNETEDITOR_SEGMENTPOSITION"));
                    GUILayout.Space(areaRect.width / 3);
                    var rect             = GUILayoutUtility.GetLastRect();
                    item.SegmentPosition = GUI.HorizontalSlider(new Rect(rect.x, rect.yMin + 7, rect.width, 15), item.SegmentPosition, 0, 1);
                    item.SegmentPosition = GUIFloatField.FloatField(f_SegmentPathSingle, item.SegmentPosition, 0, 1);
                });
            }
            GUILayout.Space(12);


            GUIKlyteCommons.DoInHorizontal(() =>
            {
                item.InvertSign = GUILayout.Toggle(item.InvertSign, Locale.Get("K45_WTS_INVERT_SIGN_SIDE"));
            });

            GUIKlyteCommons.DoInHorizontal(() => GUILayout.Label(Locale.Get("K45_WTS_ONNETEDITOR_LOCATION_SETTINGS")));

            GUIKlyteCommons.AddVector3Field(item.PropPosition, "K45_WTS_ONNETEDITOR_POSITIONOFFSET", f_SegmentPositionOffset);
            GUIKlyteCommons.AddVector3Field(item.PropRotation, "K45_WTS_ONNETEDITOR_ROTATION", f_SegmentRotationOffset);
            GUIKlyteCommons.AddVector3Field(item.Scale, "K45_WTS_ONNETEDITOR_SCALE", f_SegmentScaleOffset);
        }