Ejemplo n.º 1
0
 public override void OnChangeFromBlankValue(int sheetIndex, int rowIndex, int columnIndex,
                                             IEvaluationCell cell, ICacheEntry entry)
 {
     Log("changeFromBlank", rowIndex, columnIndex, entry.GetValue());
     if (entry.GetValue() == null)
     { // hack to tell the difference between formula and plain value
         // perhaps the API could be improved: onChangeFromBlankToValue, onChangeFromBlankToFormula
         if (!_formulaCellsByCacheEntry.ContainsKey(entry))
         {
             _formulaCellsByCacheEntry.Add(entry, cell);
         }
         else
         {
             _formulaCellsByCacheEntry[entry] = cell;
         }
     }
     else
     {
         Loc loc = new Loc(0, sheetIndex, rowIndex, columnIndex);
         if (!_plainCellLocsByCacheEntry.ContainsKey(entry))
         {
             _plainCellLocsByCacheEntry.Add(entry, loc);
         }
         else
         {
             _plainCellLocsByCacheEntry[entry] = loc;
         }
     }
 }
Ejemplo n.º 2
0
            public override void OnReadPlainValue(int sheetIndex, int rowIndex, int columnIndex, ICacheEntry entry)
            {
                Loc loc = new Loc(0, sheetIndex, rowIndex, columnIndex);

                _plainCellLocsByCacheEntry.Add(entry, loc);
                log("value", rowIndex, columnIndex, entry.GetValue());
            }
Ejemplo n.º 3
0
        private void DrawSingleContentEntry(ICacheEntry entry)
        {
            GUILayout.BeginHorizontal((_inspectorRecordHeight));
            {
                GUILayout.Label(entry.TypeName(), (_inspectorTypeWidth));

                var value = entry.GetValue();

                if (entry.CanEnterValue() || value is Exception)
                {
                    DrawVariableNameEnterButton(entry);
                }
                else
                {
                    DrawVariableName(entry);
                }

                if (entry.CanSetValue() &&
                    CanCovert(EditorUtilities.ExtractText(value), entry.Type()))
                {
                    DrawEditableValue(entry, value, GUILayout.ExpandWidth(true));
                }
                else
                {
                    DrawValue(value, GUILayout.ExpandWidth(true));
                }

                if (DnSpyHelper.IsAvailable && GUILayout.Button("^", _dnSpyButtonOptions))
                {
                    DnSpyHelper.OpenInDnSpy(entry);
                }
            }
            GUILayout.EndHorizontal();
        }
 public static void Texture2DFix(ICacheEntry entry)
 {
     cacheTexture = (Texture2D)entry.GetValue();
     if (cacheTexture != null)
     {
         startShowTexture = true;
     }
 }
Ejemplo n.º 5
0
        private static void DrawBoolField(ICacheEntry setting, object o)
        {
            var boolVal = (bool)setting.GetValue();
            var result  = GUILayout.Toggle(boolVal, boolVal ? "True" : "False", GUILayout.ExpandWidth(true));

            if (result != boolVal)
            {
                setting.SetValue(result);
            }
        }
            public static void SpriteFix(ICacheEntry entry)
            {
                Sprite sprite = (Sprite)entry.GetValue();

                if (sprite != null)
                {
                    cacheTexture = sprite.texture;
                    if (cacheTexture != null)
                    {
                        startShowTexture = true;
                    }
                }
            }
Ejemplo n.º 7
0
            public override void OnReadPlainValue(int sheetIndex, int rowIndex, int columnIndex, ICacheEntry entry)
            {
                Loc loc = new Loc(0, sheetIndex, rowIndex, columnIndex);

                if (!_plainCellLocsByCacheEntry.ContainsKey(entry))
                {
                    _plainCellLocsByCacheEntry.Add(entry, loc);
                }
                else
                {
                    _plainCellLocsByCacheEntry[entry] = loc;
                }
                Log("value", rowIndex, columnIndex, entry.GetValue());
            }
        private void DrawRow(ICacheEntry entry, PinnedVariable pinnedVariable)
        {
            if (IsEditorOpen())
            {
                pinnedVariable.Name = GUILayout.TextField(pinnedVariable.Name, GUI.skin.textField, _nameWidth);
            }
            else
            {
                GUILayout.TextArea(pinnedVariable.Name, GUI.skin.label, _nameWidth);
            }

            GUILayout.TextArea(ToStringConverter.ObjectToString(entry.GetValue()), GUI.skin.label, GUILayout.ExpandWidth(true));
            if (IsEditorOpen() && GUILayout.Button("Unpin", _unPinWidth))
            {
                RuntimeUnityEditorCore.INSTANCE.PinnedVariablesData.Untrack(entry);
            }
        }
Ejemplo n.º 9
0
        private void DrawSingleContentEntry(ICacheEntry entry)
        {
            GUILayout.BeginHorizontal(_inspectorRecordHeight);
            {
                try
                {
                    GUILayout.Label(entry.TypeName(), _inspectorTypeWidth);

                    var value = entry.GetValue();

                    if (entry.CanEnterValue() || value is Exception)
                    {
                        DrawVariableNameEnterButton(entry);
                    }
                    else
                    {
                        GUILayout.TextArea(entry.Name(), GUI.skin.label, _inspectorNameWidth);
                    }

                    if (entry.CanSetValue() && ToStringConverter.CanEditValue(entry, value))
                    {
                        DrawEditableValue(entry, value, GUILayout.ExpandWidth(true));
                    }
                    else
                    {
                        GUILayout.TextArea(ToStringConverter.ObjectToString(value), GUI.skin.label, GUILayout.ExpandWidth(true));
                    }

                    if (DnSpyHelper.IsAvailable && GUILayout.Button("^", _dnSpyButtonOptions))
                    {
                        DnSpyHelper.OpenInDnSpy(entry);
                    }
                }
                catch (Exception ex)
                {
                    RuntimeUnityEditorCore.Logger.Log(LogLevel.Error, $"Failed to draw setting {entry?.Name()} - {ex.Message}");
                    GUILayout.TextArea(ex.Message, GUI.skin.label, GUILayout.ExpandWidth(true));
                }
            }
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 10
0
            public override void OnClearCachedValue(ICacheEntry entry)
            {
                int            rowIndex;
                int            columnIndex;
                EvaluationCell cell = (EvaluationCell)_formulaCellsByCacheEntry[entry];

                if (cell == null)
                {
                    Loc loc = (Loc)_plainCellLocsByCacheEntry[entry];
                    if (loc == null)
                    {
                        throw new InvalidOperationException("can't find cell or location");
                    }
                    rowIndex    = loc.RowIndex;
                    columnIndex = loc.ColumnIndex;
                }
                else
                {
                    rowIndex    = cell.RowIndex;
                    columnIndex = cell.ColumnIndex;
                }
                log("Clear", rowIndex, columnIndex, entry.GetValue());
            }
Ejemplo n.º 11
0
            public override void OnClearDependentCachedValue(ICacheEntry entry, int depth)
            {
                EvaluationCell cell = (EvaluationCell)_formulaCellsByCacheEntry[entry];

                log("Clear" + depth, cell.RowIndex, cell.ColumnIndex, entry.GetValue());
            }
Ejemplo n.º 12
0
            public override void OnClearDependentCachedValue(ICacheEntry entry, int depth)
            {
                IEvaluationCell cell = _formulaCellsByCacheEntry.ContainsKey(entry) ? _formulaCellsByCacheEntry[(entry)] : null;

                Log("clear" + depth, cell.RowIndex, cell.ColumnIndex, entry.GetValue());
            }
 public static void ColorFix(ICacheEntry entry)
 {
     cacheColor     = (Color)entry.GetValue();
     backColor      = GUI.contentColor;
     startShowColor = true;
 }