Exemplo n.º 1
0
    public override void DrawInitValueEditor()
    {
        var _xInit = InitValue.x;
        var _yInit = InitValue.y;
        var _zInit = InitValue.z;
        var _wInit = InitValue.w;

        using (new GUILayout.HorizontalScope())
        {
            GUI.color = Color.yellow;
            GUILayout.Label("Init Value:", GUILayout.Width(120));
            GUI.color = Color.white;

            GUILayout.Label("x:");
            _xInit = GUIFloatField.FloatField(_xInit);
            GUILayout.Label("y:");
            _yInit = GUIFloatField.FloatField(_yInit);
            GUILayout.Label("z:");
            _zInit = GUIFloatField.FloatField(_zInit);
            GUILayout.Label("w:");
            _wInit = GUIFloatField.FloatField(_wInit);
        }

        InitValue = new SerializableQuaternion(_xInit, _yInit, _zInit, _wInit);
    }
Exemplo n.º 2
0
    public override void DrawEditor()
    {
        //var _q = Value;

        var _x = Value.x;
        var _y = Value.y;
        var _z = Value.z;
        var _w = Value.w;


        using (new GUILayout.HorizontalScope())
        {
            GUILayout.Label("x:");
            _x = GUIFloatField.FloatField(_x);
            GUILayout.Label("y:");
            _y = GUIFloatField.FloatField(_y);
            GUILayout.Label("z:");
            _z = GUIFloatField.FloatField(_z);
            GUILayout.Label("w:");
            _w = GUIFloatField.FloatField(_w);
        }

        // convert string to quaternion
        Value = new SerializableQuaternion(_x, _y, _z, _w);
    }
    public override void DrawInitValueEditor()
    {
        GUI.color = Color.yellow;
        GUILayout.Label("Init Value:");
        GUI.color = Color.white;

        InitValue = GUIFloatField.FloatField(InitValue);
    }
Exemplo n.º 4
0
    public override void DrawEditor()
    {
                #if UNITY_EDITOR
        EditorGUI.BeginChangeCheck();
                #endif

        var _intTxt = _originalInt.ToString();
        _intTxt = GUILayout.TextField(_intTxt);

                #if UNITY_EDITOR
        if (EditorGUI.EndChangeCheck())
        {
            int.TryParse(_intTxt, out _originalInt);
        }
                #endif

        using (new GUILayout.VerticalScope("Box"))
        {
                        #if UNITY_EDITOR
            EditorGUILayout.HelpBox("Modifiers can modify the base value based on their operators. Example: Attack base value = 5 -> Modifier: Shield adds +10 -> Result: 15. If a modifier is enabled it will return the modified base value.", MessageType.Info);
                        #endif
            GUILayout.Label("New Modifier:");

            tmpModifierName = GUILayout.TextField(tmpModifierName);
            if (GUILayout.Button("add"))
            {
                modifiers.Add(tmpModifierName, new IntModifiers(0, IntModifiers.Type.add));
            }

            foreach (var key in modifiers.Keys)
            {
                using (new GUILayout.HorizontalScope("Box"))
                {
                    modifiers[key].enabled = GUILayout.Toggle(modifiers[key].enabled, "enabled");
                    GUILayout.Label(key + " : " + _originalInt);

                                        #if UNITY_EDITOR
                    modifiers[key].type = (IntWithModifiersType.IntModifiers.Type)EditorGUILayout.EnumPopup(modifiers[key].type);
                                        #else
                    GUILayout.Label(modifiers[key].type.ToString());
                                        #endif
                    modifiers[key].Value = (int)GUIFloatField.FloatField((float)modifiers[key].Value);



                    if (GUILayout.Button("x"))
                    {
                        modifiers.Remove(key);
                    }
                }
            }
        }
    }
Exemplo n.º 5
0
    public override void DrawEditor()
    {
        var _v2 = Value;

        var _x = _v2.x;
        var _y = _v2.y;

        using (new GUILayout.HorizontalScope())
        {
            //GUILayout.Space(130);
            GUILayout.Label("x:");
            _x = GUIFloatField.FloatField(_x);

            GUILayout.Label("y:");
            _y = GUIFloatField.FloatField(_y);
        }

        Value = new SerializableVector2(_x, _y);
    }
Exemplo n.º 6
0
    public override void DrawEditor()
    {
        var _v4 = Value;

        var _x = _v4.x;
        var _y = _v4.y;
        var _z = _v4.z;
        var _w = _v4.w;

        using (new GUILayout.HorizontalScope())
        {
            //GUILayout.Space(130);
            GUILayout.Label("x:");
            _x = GUIFloatField.FloatField(_x);
            GUILayout.Label("y:");
            _y = GUIFloatField.FloatField(_y);
            GUILayout.Label("z:");
            _z = GUIFloatField.FloatField(_z);
            GUILayout.Label("w:");
            _w = GUIFloatField.FloatField(_w);
        }

        Value = new SerializableVector4(_x, _y, _z, _w);
    }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
 // Draw GUI
 public override void DrawEditor()
 {
     _float = GUIFloatField.FloatField(_float);
 }