本文整理汇总了C#中BetterList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# BetterList.Add方法的具体用法?C# BetterList.Add怎么用?C# BetterList.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BetterList
的用法示例。
在下文中一共展示了BetterList.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteToBuffers
public void WriteToBuffers(BetterList<Vector3> v, BetterList<Vector2> u, BetterList<Color32> c, BetterList<Vector3> n, BetterList<Vector4> t)
{
if ((this.mRtpVerts != null) && (this.mRtpVerts.size > 0))
{
if (n == null)
{
for (int i = 0; i < this.mRtpVerts.size; i++)
{
v.Add(this.mRtpVerts.buffer[i]);
u.Add(this.uvs.buffer[i]);
c.Add(this.cols.buffer[i]);
}
}
else
{
for (int j = 0; j < this.mRtpVerts.size; j++)
{
v.Add(this.mRtpVerts.buffer[j]);
u.Add(this.uvs.buffer[j]);
c.Add(this.cols.buffer[j]);
n.Add(this.mRtpNormal);
t.Add(this.mRtpTan);
}
}
}
}
示例2: OnFill
/// <summary>
/// Virtual function called by the UIScreen that fills the buffers.
/// </summary>
public override void OnFill(BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color> cols)
{
verts.Add(new Vector3(1f, 0f, 0f));
verts.Add(new Vector3(1f, -1f, 0f));
verts.Add(new Vector3(0f, -1f, 0f));
verts.Add(new Vector3(0f, 0f, 0f));
uvs.Add(Vector2.one);
uvs.Add(new Vector2(1f, 0f));
uvs.Add(Vector2.zero);
uvs.Add(new Vector2(0f, 1f));
cols.Add(color);
cols.Add(color);
cols.Add(color);
cols.Add(color);
}
示例3: GetListOfSprites
public BetterList<string> GetListOfSprites(string match)
{
if (this.mReplacement != null)
{
return this.mReplacement.GetListOfSprites(match);
}
if (string.IsNullOrEmpty(match))
{
return this.GetListOfSprites();
}
if (this.mSprites.Count == 0)
{
this.Upgrade();
}
BetterList<string> list = new BetterList<string>();
int num = 0;
int count = this.mSprites.Count;
while (num < count)
{
UISpriteData data = this.mSprites[num];
if (((data != null) && !string.IsNullOrEmpty(data.name)) && string.Equals(match, data.name, StringComparison.OrdinalIgnoreCase))
{
list.Add(data.name);
return list;
}
num++;
}
char[] separator = new char[] { ' ' };
string[] strArray = match.Split(separator, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < strArray.Length; i++)
{
strArray[i] = strArray[i].ToLower();
}
int num4 = 0;
int num5 = this.mSprites.Count;
while (num4 < num5)
{
UISpriteData data2 = this.mSprites[num4];
if ((data2 != null) && !string.IsNullOrEmpty(data2.name))
{
string str = data2.name.ToLower();
int num6 = 0;
for (int j = 0; j < strArray.Length; j++)
{
if (str.Contains(strArray[j]))
{
num6++;
}
}
if (num6 == strArray.Length)
{
list.Add(data2.name);
}
}
num4++;
}
return list;
}
示例4: OnFill
public override void OnFill (BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols)
{
base.OnFill (verts, uvs, cols);
Vector2 uv0 = new Vector2(mOuterUV.xMin, mOuterUV.yMin);
Vector2 uv1 = new Vector2(mOuterUV.xMax, mOuterUV.yMax);
verts.Add(new Vector3(1f, 0f, 0f));
verts.Add(new Vector3(1f, 0f, extrusionDepth));
verts.Add(new Vector3(1f, -1f, extrusionDepth));
verts.Add(new Vector3(1f, -1f, 0f));
verts.Add(new Vector3(1f, 0f, 0f));
verts.Add(new Vector3(0f, 0f, 0f));
verts.Add(new Vector3(0f, 0f, extrusionDepth));
verts.Add(new Vector3(1f, 0f, extrusionDepth));
verts.Add(new Vector3(0f, -1f, 0f));
verts.Add(new Vector3(0f, -1f, extrusionDepth));
verts.Add(new Vector3(0f, 0f, extrusionDepth));
verts.Add(new Vector3(0f, 0f, 0f));
verts.Add(new Vector3(1f, -1f, extrusionDepth));
verts.Add(new Vector3(0f, -1f, extrusionDepth));
verts.Add(new Vector3(0f, -1f, 0f));
verts.Add(new Vector3(1f, -1f, 0f));
for( int i = 0 ; i < 4 ; i++ ) {
uvs.Add(uv1);
uvs.Add(new Vector2(uv1.x, uv0.y));
uvs.Add(uv0);
uvs.Add(new Vector2(uv0.x, uv1.y));
}
#if UNITY_3_5_4
Color col = color;
#else
Color32 col = color;
#endif
for( int i = 0 ; i < 16 ; i++ ) {
cols.Add(col);
}
}
示例5: OnFill
public override void OnFill(BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols)
{
Color c = base.color;
c.a *= base.mPanel.finalAlpha;
Color32 item = !this.premultipliedAlpha ? c : NGUITools.ApplyPMA(c);
Vector4 drawingDimensions = this.drawingDimensions;
verts.Add(new Vector3(drawingDimensions.x, drawingDimensions.y));
verts.Add(new Vector3(drawingDimensions.x, drawingDimensions.w));
verts.Add(new Vector3(drawingDimensions.z, drawingDimensions.w));
verts.Add(new Vector3(drawingDimensions.z, drawingDimensions.y));
uvs.Add(new Vector2(this.mRect.xMin, this.mRect.yMin));
uvs.Add(new Vector2(this.mRect.xMin, this.mRect.yMax));
uvs.Add(new Vector2(this.mRect.xMax, this.mRect.yMax));
uvs.Add(new Vector2(this.mRect.xMax, this.mRect.yMin));
cols.Add(item);
cols.Add(item);
cols.Add(item);
cols.Add(item);
}
示例6: OnEnable
void OnEnable ()
{
Dictionary<string, string[]> dict = Localization.dictionary;
if (dict.Count > 0)
{
mKeys = new BetterList<string>();
foreach (KeyValuePair<string, string[]> pair in dict)
{
if (pair.Key == "KEY") continue;
mKeys.Add(pair.Key);
}
mKeys.Sort(delegate (string left, string right) { return left.CompareTo(right); });
}
}
示例7: ApplyShadow
private void ApplyShadow(BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols, int start, int end, float x, float y)
{
Color mEffectColor = this.mEffectColor;
mEffectColor.a *= base.alpha * base.mPanel.finalAlpha;
Color32 color2 = ((this.bitmapFont == null) || !this.bitmapFont.premultipliedAlpha) ? mEffectColor : NGUITools.ApplyPMA(mEffectColor);
for (int i = start; i < end; i++)
{
verts.Add(verts.buffer[i]);
uvs.Add(uvs.buffer[i]);
cols.Add(cols.buffer[i]);
Vector3 vector = verts.buffer[i];
vector.x += x;
vector.y += y;
verts.buffer[i] = vector;
cols.buffer[i] = color2;
}
}
示例8: OnFill
/// <summary>
/// 负责显示内容,它的工作是填写如何显示,显示什么。就是把需要显示的内容存储在UIWidget
/// </summary>
/// <param name="verts"></param>
/// <param name="uvs">显示的多边形形状</param>
/// <param name="cols">颜色调配</param>
public override void OnFill(BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols)
{
// 开始画网格, 顶点, 矩形
Vector3[] arrVerts = localCorners; // 直接由4个角组成矩形吧
for (int i = 0; i < arrVerts.Length; i++)
{
verts.Add(arrVerts[i]);
}
// 贴图点
for (int i = 0; i < arrVerts.Length; i++)
{
uvs.Add(new Vector2(0, 0));
}
// 顶点颜色
Color pmaColor = NGUITools.ApplyPMA(this.color); // NGUI PMA
for (int i = 0; i < arrVerts.Length; i++)
{
cols.Add(pmaColor);
}
}
示例9: GetListOfSprites
/// <summary>
/// Convenience function that retrieves a list of all sprite names.
/// </summary>
public BetterList<string> GetListOfSprites()
{
if (mReplacement != null) return mReplacement.GetListOfSprites();
if (mSprites.Count == 0) Upgrade();
BetterList<string> list = new BetterList<string>();
for (int i = 0, imax = mSprites.Count; i < imax; ++i)
{
UISpriteData s = mSprites[i];
if (s != null && !string.IsNullOrEmpty(s.name)) list.Add(s.name);
}
return list;
}
示例10: OnDisable
/// <summary>
/// It's often useful to be able to tell which keys are used in localization, and which are not.
/// For this to work properly it's advised to play through the entire game and view all localized content before hitting the Stop button.
/// </summary>
void OnDisable ()
{
string final = "";
BetterList<string> full = new BetterList<string>();
// Create a list of all the known keys
foreach (KeyValuePair<string, string> pair in mDictionary) full.Add(pair.Key);
// Sort the full list
full.Sort(delegate(string s1, string s2) { return s1.CompareTo(s2); });
// Create the final string with the localization keys
for (int i = 0; i < full.size; ++i)
{
string key = full[i];
string val = mDictionary[key].Replace("\n", "\\n");
if (mUsed.Contains(key)) final += key + " = " + val + "\n";
else final += "//" + key + " = " + val + "\n";
}
// Show the final report in a format that makes it easy to copy/paste into the original localization file
if (!string.IsNullOrEmpty(final))
Debug.Log("// Localization Report\n\n" + final);
mLocalizationLoaded = false;
mLanguageIndex = -1;
mLocalization.Clear();
mDictionary.Clear();
}
示例11: ApplyShadow
void ApplyShadow (BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols, int start, int end, float x, float y)
#endif
{
#if UNITY_3_5_4
Color c = mEffectColor;
c.a = c.a * color.a;
Color col = c;
#else
Color c = mEffectColor;
c.a = c.a * color.a;
Color32 col = c;
#endif
for (int i = start; i < end; ++i)
{
verts.Add(verts.buffer[i]);
uvs.Add(uvs.buffer[i]);
cols.Add(cols.buffer[i]);
Vector3 v = verts.buffer[i];
v.x += x;
v.y += y;
verts.buffer[i] = v;
cols.buffer[i] = col;
}
}
示例12: SlicedFill
/// <summary>
/// Sliced sprite fill function is more complicated as it generates 9 AutoTargetImages instead of 1.
/// </summary>
protected void SlicedFill(BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols)
{
if (mOuterUV == mInnerUV)
{
SimpleFill(verts, uvs, cols);
return;
}
Vector2[] v = new Vector2[4];
Vector2[] uv = new Vector2[4];
Texture tex = mainTexture;
v[0] = Vector2.zero;
v[1] = Vector2.zero;
v[2] = new Vector2(1f, -1f);
v[3] = new Vector2(1f, -1f);
if (tex != null)
{
float pixelSize = atlas.pixelSize;
float borderLeft = (mInnerUV.xMin - mOuterUV.xMin) * pixelSize;
float borderRight = (mOuterUV.xMax - mInnerUV.xMax) * pixelSize;
float borderTop = (mInnerUV.yMax - mOuterUV.yMax) * pixelSize;
float borderBottom = (mOuterUV.yMin - mInnerUV.yMin) * pixelSize;
Vector3 scale = cachedTransform.localScale;
scale.x = Mathf.Max(0f, scale.x);
scale.y = Mathf.Max(0f, scale.y);
Vector2 sz = new Vector2(scale.x / tex.width, scale.y / tex.height);
Vector2 tl = new Vector2(borderLeft / sz.x, borderTop / sz.y);
Vector2 br = new Vector2(borderRight / sz.x, borderBottom / sz.y);
Pivot pv = pivot;
// We don't want the sliced sprite to become smaller than the summed up border size
if (pv == Pivot.Right || pv == Pivot.TopRight || pv == Pivot.BottomRight)
{
v[0].x = Mathf.Min(0f, 1f - (br.x + tl.x));
v[1].x = v[0].x + tl.x;
v[2].x = v[0].x + Mathf.Max(tl.x, 1f - br.x);
v[3].x = v[0].x + Mathf.Max(tl.x + br.x, 1f);
}
else
{
v[1].x = tl.x;
v[2].x = Mathf.Max(tl.x, 1f - br.x);
v[3].x = Mathf.Max(tl.x + br.x, 1f);
}
if (pv == Pivot.Bottom || pv == Pivot.BottomLeft || pv == Pivot.BottomRight)
{
v[0].y = Mathf.Max(0f, -1f - (br.y + tl.y));
v[1].y = v[0].y + tl.y;
v[2].y = v[0].y + Mathf.Min(tl.y, -1f - br.y);
v[3].y = v[0].y + Mathf.Min(tl.y + br.y, -1f);
}
else
{
v[1].y = tl.y;
v[2].y = Mathf.Min(tl.y, -1f - br.y);
v[3].y = Mathf.Min(tl.y + br.y, -1f);
}
uv[0] = new Vector2(mOuterUV.xMin, mOuterUV.yMax);
uv[1] = new Vector2(mInnerUV.xMin, mInnerUV.yMax);
uv[2] = new Vector2(mInnerUV.xMax, mInnerUV.yMin);
uv[3] = new Vector2(mOuterUV.xMax, mOuterUV.yMin);
}
else
{
// No texture -- just use zeroed out texture coordinates
for (int i = 0; i < 4; ++i) uv[i] = Vector2.zero;
}
Color colF = color;
colF.a *= mPanel.alpha;
Color32 col = atlas.premultipliedAlpha ? NGUITools.ApplyPMA(colF) : colF;
for (int x = 0; x < 3; ++x)
{
int x2 = x + 1;
for (int y = 0; y < 3; ++y)
{
if (!mFillCenter && x == 1 && y == 1) continue;
int y2 = y + 1;
verts.Add(new Vector3(v[x2].x, v[y].y, 0f));
verts.Add(new Vector3(v[x2].x, v[y2].y, 0f));
verts.Add(new Vector3(v[x].x, v[y2].y, 0f));
verts.Add(new Vector3(v[x].x, v[y].y, 0f));
uvs.Add(new Vector2(uv[x2].x, uv[y].y));
uvs.Add(new Vector2(uv[x2].x, uv[y2].y));
//.........这里部分代码省略.........
示例13: ParseSymbol
/// <summary>
/// Parse an embedded symbol, such as [FFAA00] (set color) or [-] (undo color change). Returns whether the index was adjusted.
/// </summary>
static public bool ParseSymbol (string text, ref int index, BetterList<Color> colors, bool premultiply)
{
if (colors == null) return ParseSymbol(text, ref index);
int length = text.Length;
if (index + 2 < length && text[index] == '[')
{
if (text[index + 1] == '-')
{
if (text[index + 2] == ']')
{
if (colors != null && colors.size > 1)
colors.RemoveAt(colors.size - 1);
index += 3;
return true;
}
}
else if (index + 7 < length)
{
if (text[index + 7] == ']')
{
if (colors != null)
{
Color c = ParseColor(text, index + 1);
if (EncodeColor(c) != text.Substring(index + 1, 6).ToUpper())
return false;
c.a = colors[colors.size - 1].a;
if (premultiply && c.a != 1f)
c = Color.Lerp(mInvisible, c, c.a);
colors.Add(c);
}
index += 8;
return true;
}
}
}
return false;
}
示例14: OnFill
override public void OnFill (BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols)
#endif
{
Vector2 uv0 = new Vector2(mOuterUV.xMin, mOuterUV.yMin);
Vector2 uv1 = new Vector2(mOuterUV.xMax, mOuterUV.yMax);
verts.Add(new Vector3(1f, 0f, 0f));
verts.Add(new Vector3(1f, -1f, 0f));
verts.Add(new Vector3(0f, -1f, 0f));
verts.Add(new Vector3(0f, 0f, 0f));
uvs.Add(uv1);
uvs.Add(new Vector2(uv1.x, uv0.y));
uvs.Add(uv0);
uvs.Add(new Vector2(uv0.x, uv1.y));
#if UNITY_3_5_4
Color col = color;
#else
Color32 col = color;
#endif
cols.Add(col);
cols.Add(col);
cols.Add(col);
cols.Add(col);
}
示例15: ApplyShadow
/// <summary>
/// Apply a shadow effect to the buffer.
/// </summary>
void ApplyShadow (BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols, int start, int end, float x, float y)
{
Color c = mEffectColor;
c.a *= alpha * mPanel.alpha;
Color32 col = (font.premultipliedAlpha) ? NGUITools.ApplyPMA(c) : c;
for (int i = start; i < end; ++i)
{
verts.Add(verts.buffer[i]);
uvs.Add(uvs.buffer[i]);
cols.Add(cols.buffer[i]);
Vector3 v = verts.buffer[i];
v.x += x;
v.y += y;
verts.buffer[i] = v;
cols.buffer[i] = col;
}
}