本文整理汇总了C#中Element.getName方法的典型用法代码示例。如果您正苦于以下问题:C# Element.getName方法的具体用法?C# Element.getName怎么用?C# Element.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Element
的用法示例。
在下文中一共展示了Element.getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setElement
//sets the element the panel is displaying
public void setElement(Element e)
{
currentElement = e;
whatAmI.text = Utility.UppercaseWords(e.getName());
transform.FindChild("ElementName").gameObject.SetActive(true);
setName();
transform.FindChild("ElementName").gameObject.SetActive(false);
togglePanelLock (!e.isElementUnlocked ());
if (e.isElementUnlocked()) {
updatePanel ();
}
if (PlayerPrefs.GetInt (e.getName ().ToLower () + "Hint") == 1) {
//Debug.Log("showing hint for "+e.getName());
transform.FindChild("ElementName").gameObject.SetActive(true);
setName();
}
}
示例2: addCombination
//adds a recipe given two elements
public void addCombination(Element p1, Element p2)
{
Combination r = (new Combination(p1.getName(), p2.getName(), this));
GlobalVars.RECIPES.Add(r);
myCombinations.Add(r);
}
示例3: Awake
// runs earlier than to guarantee the game doesn't try to load in the gameobjects before they've been read in by the game
void Awake()
{
if (!GlobalVars.CSV_READ) { //check's if it's already been read
//to see whether you've unlocked the tier yet
GlobalVars.TIER_UNLOCKED = new bool [GlobalVars.TIER_COUNT];
GlobalVars.TIER_UNLOCKED[0] = true;
GlobalVars.TIER_UNLOCKED[1] = true;
//reads one element per line
string [] elementsFromCSV = techTreeCSV.text.Split('\n');
//process to read and create the elements
foreach (string line in elementsFromCSV) {
string p1;
string p2;
string[]temp;
string[]recipe;
Element newElem;
//element info is divided by commas
temp = line.Split(new char[] {','});
newElem = new Element(temp[0].ToLower());
//cheat script
//newElem.unlock();
//PlayerPrefs.SetInt(newElem.getName()+GlobalVars.UNLOCK_STRING, 1);
if (!GlobalVars.ELEMENTS_BY_NAME.ContainsKey(newElem.getName ())) {
//adds to the list/dictionary of elements
GlobalVars.ELEMENTS.Add(newElem);
GlobalVars.ELEMENTS_BY_NAME.Add (newElem.getName(), newElem);
}
//reads in the combinations
for (int i = 1; i < temp.Length; i++) {
//marker for a base/tier 1 element
if (temp[i].Contains("*")) {
newElem.unlock();
//cheat scripts
PlayerPrefs.SetInt(temp[1]+GlobalVars.UNLOCK_STRING, 1);
newElem.isBaseElement = true;
continue;
} else if (string.IsNullOrEmpty(temp[i]) || temp[i].Contains("(")|| (int)temp[i][0]==13) { //if the recipe is the empty string, or a note to the artists
continue;
}
//parses the recipe string
recipe = temp[i].Split(new char[]{'+'});
p1 = recipe[0].Substring(0, recipe[0].Length-1);
p2 = recipe[1].Substring(1);
newElem.addCombination(new Combination(p1, p2, newElem));
if (!GlobalVars.RECIPES_BY_NAME.ContainsKey(p1+p2)) {
//dictionary lookup by a string of the combined element names that equal the new element
GlobalVars.RECIPES_BY_NAME.Add(p1+p2, newElem);
if (p1 != p2) { //adds the recipe in reverse, unless the element is created by combining two of the same
GlobalVars.RECIPES_BY_NAME.Add(p2+p1, newElem);
}
}
//unlocks the element if it's already unlocked in memory
if (PlayerPrefs.GetInt(temp[0].ToLower()+GlobalVars.UNLOCK_STRING)==1) {
newElem.unlock();
GlobalVars.TIER_UNLOCKED[newElem.queryTier()-1] = true;
}
}
}
//initiates the TIERS by ELEMENT
for (int i = 0; i < GlobalVars.TIER_COUNT; i++) {
GlobalVars.ELEMENTS_BY_TIER[i] = new List<Element>();
}
//calculates the tiers for each element
foreach (Element e in GlobalVars.ELEMENTS) {
GlobalVars.ELEMENTS_BY_TIER[e.queryTier()-1].Add(e);
if (e.isElementUnlocked()) {
GlobalVars.NUMBER_ELEMENTS_UNLOCKED++;
}
}
//flag set to true for optimization
GlobalVars.CSV_READ = true;
}
}