Skip to content

Commit 7c71ba7

Browse files
author
setchi
committed
Rename variables
1 parent 263e1f3 commit 7c71ba7

3 files changed

Lines changed: 29 additions & 29 deletions

File tree

Assets/Hypertext/Examples/RegexHypertext.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55

66
public class RegexHypertext : HypertextBase
77
{
8-
readonly Dictionary<string, RegexEntry> _regexEntryTable = new Dictionary<string, RegexEntry>();
8+
readonly Dictionary<string, Entry> _entryTable = new Dictionary<string, Entry>();
99

10-
struct RegexEntry
10+
struct Entry
1111
{
12-
public string Pattern;
12+
public string RegexPattern;
1313
public Color Color;
1414
public Action<string> OnClick;
1515

16-
public RegexEntry(string pattern, Color color, Action<string> onClick)
16+
public Entry(string regexPattern, Color color, Action<string> onClick)
1717
{
18-
Pattern = pattern;
18+
RegexPattern = regexPattern;
1919
Color = color;
2020
OnClick = onClick;
2121
}
@@ -44,13 +44,13 @@ public void SetClickableByRegex(string regexPattern, Color color, Action<string>
4444
return;
4545
}
4646

47-
_regexEntryTable[regexPattern] = new RegexEntry(regexPattern, color, onClick);
47+
_entryTable[regexPattern] = new Entry(regexPattern, color, onClick);
4848
}
4949

5050
public override void RemoveClickable()
5151
{
5252
base.RemoveClickable();
53-
_regexEntryTable.Clear();
53+
_entryTable.Clear();
5454
}
5555

5656
/// <summary>
@@ -59,11 +59,11 @@ public override void RemoveClickable()
5959
/// </summary>
6060
protected override void RegisterClickable()
6161
{
62-
foreach (var regexEntry in _regexEntryTable.Values)
62+
foreach (var entry in _entryTable.Values)
6363
{
64-
foreach (Match m in Regex.Matches(text, regexEntry.Pattern))
64+
foreach (Match match in Regex.Matches(text, entry.RegexPattern))
6565
{
66-
RegisterClickable(m.Index, m.Value.Length, regexEntry.Color, regexEntry.OnClick);
66+
RegisterClickable(match.Index, match.Value.Length, entry.Color, entry.OnClick);
6767
}
6868
}
6969
}

Assets/Hypertext/Scripts/HypertextBase.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ void Modify(ref List<UIVertex> vertices)
107107

108108
for (int vertexIndex = 0; vertexIndex < CharVertsNum; vertexIndex++)
109109
{
110-
var uiVertex = vertices[vertexStartIndex + vertexIndex];
111-
uiVertex.color = entry.Color;
112-
vertices[vertexStartIndex + vertexIndex] = uiVertex;
110+
var vertex = vertices[vertexStartIndex + vertexIndex];
111+
vertex.color = entry.Color;
112+
vertices[vertexStartIndex + vertexIndex] = vertex;
113113

114114
var pos = vertices[vertexStartIndex + vertexIndex].position;
115115

@@ -134,17 +134,17 @@ void Modify(ref List<UIVertex> vertices)
134134
}
135135
}
136136

137-
var rect = new Rect();
138-
rect.min = min;
139-
rect.max = max;
140-
entry.Rects.Add(rect);
137+
var charRect = new Rect();
138+
charRect.min = min;
139+
charRect.max = max;
140+
entry.Rects.Add(charRect);
141141
}
142142

143143
// 同じ行で隣り合った矩形をまとめる
144144
var mergedRects = new List<Rect>();
145-
foreach (var rowRects in SplitRectsByRow(entry.Rects))
145+
foreach (var charRects in SplitRectsByRow(entry.Rects))
146146
{
147-
mergedRects.Add(MergeRects(rowRects));
147+
mergedRects.Add(MergeRects(charRects));
148148
}
149149

150150
entry.Rects = mergedRects;

Assets/Hypertext/Scripts/ObjectPool.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ namespace HypertextHelper
77
public class ObjectPool<T> where T : new()
88
{
99
readonly Stack<T> _stack = new Stack<T>();
10-
readonly UnityAction<T> _actionOnGet;
11-
readonly UnityAction<T> _actionOnRelease;
10+
readonly UnityAction<T> _onGet;
11+
readonly UnityAction<T> _onRelease;
1212

1313
public int CountAll { get; set; }
1414
public int CountActive { get { return CountAll - CountInactive; } }
1515
public int CountInactive { get { return _stack.Count; } }
1616

17-
public ObjectPool(UnityAction<T> actionOnGet, UnityAction<T> actionOnRelease)
17+
public ObjectPool(UnityAction<T> onGet, UnityAction<T> onRelease)
1818
{
19-
_actionOnGet = actionOnGet;
20-
_actionOnRelease = actionOnRelease;
19+
_onGet = onGet;
20+
_onRelease = onRelease;
2121
}
2222

2323
public T Get()
@@ -33,9 +33,9 @@ public T Get()
3333
element = _stack.Pop();
3434
}
3535

36-
if (_actionOnGet != null)
36+
if (_onGet != null)
3737
{
38-
_actionOnGet(element);
38+
_onGet(element);
3939
}
4040

4141
return element;
@@ -48,12 +48,12 @@ public void Release(T element)
4848
Debug.LogError("Internal error. Trying to destroy object that is already released to pool.");
4949
}
5050

51-
if (_actionOnRelease != null)
51+
if (_onRelease != null)
5252
{
53-
_actionOnRelease(element);
53+
_onRelease(element);
5454
}
5555

5656
_stack.Push(element);
5757
}
5858
}
59-
}
59+
}

0 commit comments

Comments
 (0)