コード例 #1
0
        public ICEEnergyBarObject(ICEEnergyBarObject _bar)
        {
            if (_bar == null)
            {
                return;
            }

            ReferenceObject = _bar.ReferenceObject;
            Value           = _bar.Value;
            Offset          = _bar.Offset;
            VerticalOffset  = _bar.VerticalOffset;
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            Info.HelpButtonIndex = 0;
            ICECreatureEBTAdapter _adapter = (ICECreatureEBTAdapter)target;

            EditorGUILayout.Separator();
            ICEEditorLayout.BeginHorizontal();
            _adapter.Display = (Canvas)EditorGUILayout.ObjectField("Display", _adapter.Display, typeof(Canvas), true);
            ICEEditorLayout.EndHorizontal();

            EditorGUILayout.Separator();
            ICEEditorLayout.Label("Offsets", false);
            EditorGUI.indentLevel++;
            _adapter.InitialOffset = ICEEditorLayout.DefaultSlider("Initial Offset", "", _adapter.InitialOffset, 0.01f, -10, 10, 0, "");
            _adapter.LineOffset    = ICEEditorLayout.DefaultSlider("Line Offset", "", _adapter.LineOffset, 0.01f, 0, 10, 0, "");
            EditorGUI.indentLevel--;

            EditorGUILayout.Separator();
            ICEEditorLayout.Label("Status Bars", false);
            EditorGUI.indentLevel++;
            for (int _i = 0; _i < _adapter.Bars.Count; _i++)
            {
                ICEEnergyBarObject _bar = _adapter.Bars[_i];

                ICEEditorLayout.BeginHorizontal();
                _bar.Value = (ICEEnergyBarDataType)ICEEditorLayout.EnumPopup("Status Value #" + (_i + 1), "", _bar.Value);

                if (ICEEditorLayout.ButtonUp())
                {
                    ICEEnergyBarObject _obj = _adapter.Bars[_i];
                    _adapter.Bars.RemoveAt(_i);

                    if (_i - 1 < 0)
                    {
                        _adapter.Bars.Add(_obj);
                    }
                    else
                    {
                        _adapter.Bars.Insert(_i - 1, _obj);
                    }

                    return;
                }


                if (ICEEditorLayout.ButtonDown())
                {
                    ICEEnergyBarObject _obj = _adapter.Bars[_i];
                    _adapter.Bars.RemoveAt(_i);

                    if (_i + 1 > _adapter.Bars.Count)
                    {
                        _adapter.Bars.Insert(0, _obj);
                    }
                    else
                    {
                        _adapter.Bars.Insert(_i + 1, _obj);
                    }

                    return;
                }

                if (GUILayout.Button("COPY", ICEEditorStyle.CMDButtonDouble))
                {
                    _adapter.Bars.Add(new ICEEnergyBarObject(_bar));
                }

                if (GUILayout.Button("X", ICEEditorStyle.CMDButton))
                {
                    _adapter.Bars.RemoveAt(_i);
                    --_i;
                }
                ICEEditorLayout.EndHorizontal();

                EditorGUI.indentLevel++;
                ICEEditorLayout.BeginHorizontal();
                _bar.ReferenceObject = (EnergyBar)EditorGUILayout.ObjectField("Reference", _bar.ReferenceObject, typeof(EnergyBar), true);
                ICEEditorLayout.EndHorizontal();

                ICEEditorLayout.BeginHorizontal();
                _bar.Offset = ICEEditorLayout.OffsetGroup("Offset", _bar.Offset);
                ICEEditorLayout.EndHorizontal();

                _bar.VerticalOffset = _adapter.InitialOffset + (_adapter.LineOffset * (_adapter.Bars.Count - _i));


                EditorGUI.indentLevel--;
            }

            EditorGUI.indentLevel--;

            ICEEditorLayout.BeginHorizontal();
            ICEEditorLayout.Label("Add Status Value", false);
            GUILayout.FlexibleSpace();
            if (ICEEditorLayout.Button("ADD", "", ICEEditorStyle.CMDButtonDouble))
            {
                _adapter.Bars.Add(new ICEEnergyBarObject());
            }
            ICEEditorLayout.EndHorizontal();

            EditorGUILayout.Separator();
        }