示例#1
0
        public string GetApplyString(TextReplacerValue[] valueList)
        {
            string text = string.Empty;

            foreach (TextReplacerSlot textReplacerSlot in this._slots)
            {
                TextReplacerSlotType type = textReplacerSlot.type;
                if (type != TextReplacerSlotType.PureString)
                {
                    if (type == TextReplacerSlotType.Variable)
                    {
                        if (valueList != null && valueList.Length > textReplacerSlot.variableIndex)
                        {
                            text += valueList[textReplacerSlot.variableIndex].GetValueString(textReplacerSlot.overflowLength, textReplacerSlot.zeroPaddingLength, textReplacerSlot.overflowJoinString);
                        }
                        else
                        {
                            string text2 = text;
                            text = string.Concat(new object[]
                            {
                                text2,
                                "[",
                                textReplacerSlot.variableIndex,
                                "]"
                            });
                        }
                    }
                }
                else
                {
                    text += textReplacerSlot.stringValue;
                }
            }
            return(text);
        }
示例#2
0
 public TextReplacerSlot(int varIndex, int overflowLength, string overflowJoinString)
 {
     this._type               = TextReplacerSlotType.Variable;
     this._stringValue        = string.Empty;
     this._variableIndex      = varIndex;
     this._overflowLength     = Mathf.Clamp(overflowLength, 0, int.MaxValue);
     this._zeroPaddingLength  = TextReplacerSlot.defaulZeroPaddingLength;
     this._overflowJoinString = overflowJoinString;
 }
示例#3
0
 public TextReplacerSlot(int varIndex)
 {
     this._type               = TextReplacerSlotType.Variable;
     this._stringValue        = string.Empty;
     this._variableIndex      = varIndex;
     this._overflowLength     = TextReplacerSlot.defaultOverflowLength;
     this._zeroPaddingLength  = TextReplacerSlot.defaulZeroPaddingLength;
     this._overflowJoinString = "...";
 }
示例#4
0
 public TextReplacerSlot(int varIndex, int overflowLength, int zeroPaddingLength)
 {
     this._type               = TextReplacerSlotType.Variable;
     this._stringValue        = string.Empty;
     this._variableIndex      = varIndex;
     this._overflowLength     = Mathf.Clamp(overflowLength, 0, int.MaxValue);
     this._zeroPaddingLength  = Mathf.Clamp(zeroPaddingLength, 1, int.MaxValue);
     this._overflowJoinString = "...";
 }
示例#5
0
 public TextReplacerSlot(string pureText)
 {
     this._type               = TextReplacerSlotType.PureString;
     this._stringValue        = pureText;
     this._variableIndex      = 0;
     this._overflowLength     = TextReplacerSlot.defaultOverflowLength;
     this._zeroPaddingLength  = TextReplacerSlot.defaulZeroPaddingLength;
     this._overflowJoinString = "...";
 }