本文整理汇总了C#中FastList.EnsureCapacity方法的典型用法代码示例。如果您正苦于以下问题:C# FastList.EnsureCapacity方法的具体用法?C# FastList.EnsureCapacity怎么用?C# FastList.EnsureCapacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FastList
的用法示例。
在下文中一共展示了FastList.EnsureCapacity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UserInterface
public UserInterface()
{
instance = this;
UIView view = GameObject.FindObjectOfType<UIView> ();
if (view == null)
return;
UIComponent bulldozerBar = UIView.Find ("BulldozerBar");
if (bulldozerBar == null)
return;
try {
XmlSerializer serializer = new XmlSerializer (typeof(XmlData));
using (StreamReader reader = new StreamReader("V10Bulldoze.xml")) {
data = (XmlData)serializer.Deserialize (reader);
reader.Close ();
}
} catch (FileNotFoundException) {
// No options file yet
data = new XmlData ();
data.needSave = true;
} catch (Exception e) {
Debug.Log ("V10Bulldoze: " + e.GetType ().Name + " while reading xml file: " + e.Message + "\n" + e.StackTrace + "\n\n");
if (e.InnerException != null)
Debug.Log ("Caused by: " + e.InnerException.GetType ().Name + ": " + e.InnerException.Message + "\n" + e.InnerException.StackTrace);
return;
}
//1.X -> 1.3
if (data.version < 1.3d) {
// Everything has already been setted to its default value, so let's just adjust the version and save.
data.version = 1.3d;
data.needSave = true;
}
abandonedButton = new GameObject ("V10Bulldoze abandoned button");
burnedButton = new GameObject ("V10Bulldoze burned button");
audioButton = new GameObject ("V10Bulldoze audio button");
Transform parent = bulldozerBar.transform;
abandonedButton.transform.parent = parent;
burnedButton.transform.parent = parent;
audioButton.transform.parent = parent;
Shader shader = Shader.Find ("UI/Default UI Shader");
if (shader == null) {
Debug.Log ("V10Bulldoze: Can't find default UI shader.");
shader = new Shader ();
shader.name = "V10Bulldoze dummy shader";
}
UITextureAtlas atlas = ScriptableObject.CreateInstance<UITextureAtlas> ();
atlas.name = "V10Bulldoze Atlas";
atlas.material = new Material (shader);
atlas.material.mainTexture = new Texture2D (0, 0, TextureFormat.DXT5, false);
FastList<Texture2D> list = new FastList<Texture2D> ();
list.EnsureCapacity (18);
UIButton button = abandonedButton.AddComponent<UIButton> ();
button.relativePosition = new Vector3 (7.0f, -57.0f);
initButton ("AbandonedButton", button, list, data.abandoned, "Demolish Abandoned", view);
button.atlas = atlas;
button = burnedButton.AddComponent<UIButton> ();
button.relativePosition = new Vector3 ((float)(7 + buttonSize + 7), -57.0f);
initButton ("BurnedButton", button, list, data.burned, "Demolish Burned", view);
button.atlas = atlas;
button = audioButton.AddComponent<UIButton> ();
button.relativePosition = new Vector3 ((float)(7 + buttonSize + 7 + buttonSize + 7), -57.0f);
initButton ("AudioButton", button, list, !data.disableEffect, "Mute Bulldozing", view);
button.atlas = atlas;
atlas.AddTextures (list.ToArray ());
}