docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SheetColumn

    Represents a single Google sheet column with its value and note field.

    Inheritance
    object
    SheetColumn
    KeyColumn
    KeyMetadataColumn<TMetadata>
    LocaleColumn
    LocaleMetadataColumn<TMetadata>
    Namespace: UnityEditor.Localization.Plugins.Google.Columns
    Assembly: Unity.Localization.Editor.dll
    Syntax
    [Serializable]
    public abstract class SheetColumn
    Examples

    This is an example of how to synchronize the IsSmart property. Any value in the column causes all values to be marked as smart; leaving the field empty indicates they should not be smart.

    [Serializable]
    public class GlobalSmartStringColumn : SheetColumn
    {
        public override PushFields PushFields => PushFields.Value;
    
        StringTableCollection m_TableCollection;
    
        public override void PullBegin(StringTableCollection collection)
        {
            m_TableCollection = collection;
        }
    
        public override void PullCellData(SharedTableData.SharedTableEntry keyEntry, string cellValue, string cellNote)
        {
            bool enableSmartString = !string.IsNullOrEmpty(cellValue);
    
            // Go through all the entries
            foreach (var table in m_TableCollection.StringTables)
            {
                var entry = table.GetEntry(keyEntry.Id);
                if (entry != null)
                    entry.IsSmart = enableSmartString;
            }
        }
    
        public override void PushBegin(StringTableCollection collection)
        {
            m_TableCollection = collection;
        }
    
        public override void PushCellData(SharedTableData.SharedTableEntry keyEntry, IList<StringTableEntry> tableEntries, out string value, out string note)
        {
            // Use the first table as our source of truth
            var entry = m_TableCollection.StringTables[0].GetEntry(keyEntry.Id);
            value = entry != null && entry.IsSmart ? "x" : string.Empty;
            note = null;
        }
    
        public override void PushHeader(StringTableCollection collection, out string header, out string headerNote)
        {
            header = "Smart String";
            headerNote = null;
        }
    }

    Properties

    Name Description
    Column

    The Id of the column.

    ColumnIndex

    Column as an index where 0 = 'A', 1 = 'B' etc.

    PushFields

    Controls which cell fields to synchronize.

    Methods

    Name Description
    ColumnNameToIndex(string)

    Convert a column name to its id value. E.G 'A' = 0, 'B' = 1, 'AA' = 26, 'AB' = 27

    IndexToColumnName(int)

    Converts a column id value into its name. Column ids start at 0. E.G 0 = 'A', 1 = 'B', 26 = 'AA', 27 = 'AB'

    PullBegin(StringTableCollection)

    Called when starting a pull to allow a column to initialize itself.

    PullCellData(SharedTableEntry, string, string)

    Called to update the StringTableCollection using the provided cell data.

    PullEnd()

    Called after all calls to PullCellData(SharedTableEntry, string, string) to provide an opurtunity to deinitialize, cleanup etc.

    PushBegin(StringTableCollection)

    Called when starting a push to allow a column to initialize itself.

    PushCellData(SharedTableEntry, IList<StringTableEntry>, out string, out string)

    Extracts the data that should populate the columns cell for the row associated with the Key.

    PushEnd()

    Called after all calls to PushCellData(SharedTableEntry, IList<StringTableEntry>, out string, out string) to provide an opurtunity to deinitialize, cleanup etc.

    PushHeader(StringTableCollection, out string, out string)

    Sets the column title and optional note. These values are always set regardless of the value of PushFields.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)