本文整理汇总了C#中Character.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# Character.GetName方法的具体用法?C# Character.GetName怎么用?C# Character.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character
的用法示例。
在下文中一共展示了Character.GetName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectCharacter
public void SelectCharacter(Character SelectedCharacter)
{
CharacterName.text = SelectedCharacter.GetName();
ClearActionIcons ();
ShowCharacterActionIcons (SelectedCharacter.GetCharacterActions ());
}
示例2: ShowElement
public void ShowElement(Character c)
{
if(this.showBox)
{
GUI.Box(this.bounds, "");
}
GUIStyle guiStyle = new GUIStyle(GUI.skin.label);
guiStyle.alignment = this.textAnchor;
if(HUDElementType.TEXT.Equals(this.type))
{
if(this.showShadow)
{
guiStyle.normal.textColor = DataHolder.Color(this.shadowColor);
GUI.Label(
new Rect(this.bounds.x + this.shadowOffset.x, this.bounds.y + this.shadowOffset.y,
this.bounds.width, this.bounds.height), this.text[GameHandler.GetLanguage()], guiStyle);
}
guiStyle.normal.textColor = DataHolder.Color(this.textColor);
GUI.Label(this.bounds, this.text[GameHandler.GetLanguage()], guiStyle);
}
else if(HUDElementType.IMAGE.Equals(this.type))
{
GUI.DrawTexture(this.bounds, this.GetImage(), this.scaleMode, this.alphaBlend, this.imageAspect);
}
else if(HUDElementType.NAME.Equals(this.type))
{
GUIContent gc = null;
if(HUDContentType.TEXT.Equals(this.contentType))
{
if(HUDNameType.CHARACTER.Equals(this.nameType)) gc = new GUIContent(c.GetName());
else if(HUDNameType.CLASS.Equals(this.nameType)) gc = new GUIContent(DataHolder.Classes().GetName(c.currentClass));
else if(HUDNameType.STATUS.Equals(this.nameType)) gc = new GUIContent(DataHolder.StatusValues().GetName(this.statusID));
}
else if(HUDContentType.ICON.Equals(this.contentType))
{
if(HUDNameType.CHARACTER.Equals(this.nameType)) gc = new GUIContent(c.GetIcon());
else if(HUDNameType.CLASS.Equals(this.nameType)) gc = new GUIContent(DataHolder.Classes().GetIcon(c.currentClass));
else if(HUDNameType.STATUS.Equals(this.nameType)) gc = new GUIContent(DataHolder.StatusValues().GetIcon(this.statusID));
}
else if(HUDContentType.BOTH.Equals(this.contentType))
{
if(HUDNameType.CHARACTER.Equals(this.nameType)) gc = c.GetContent();
else if(HUDNameType.CLASS.Equals(this.nameType)) gc = DataHolder.Classes().GetContent(c.currentClass);
else if(HUDNameType.STATUS.Equals(this.nameType)) gc = DataHolder.StatusValues().GetContent(this.statusID);
}
if(gc != null)
{
if(this.showShadow)
{
guiStyle.normal.textColor = DataHolder.Color(this.shadowColor);
GUI.Label(
new Rect(this.bounds.x + this.shadowOffset.x, this.bounds.y + this.shadowOffset.y,
this.bounds.width, this.bounds.height), gc, guiStyle);
}
guiStyle.normal.textColor = DataHolder.Color(this.textColor);
GUI.Label(this.bounds, gc, guiStyle);
}
}
else if(HUDElementType.STATUS.Equals(this.type))
{
if(HUDDisplayType.TEXT.Equals(this.displayType))
{
string txt = c.status[this.statusID].GetValue().ToString();
if(c.status[this.statusID].IsConsumable() && this.showMax)
{
txt += this.divider+c.status[c.status[this.statusID].maxStatus].GetValue().ToString();
}
if(this.showShadow)
{
guiStyle.normal.textColor = DataHolder.Color(this.shadowColor);
GUI.Label(
new Rect(this.bounds.x + this.shadowOffset.x, this.bounds.y + this.shadowOffset.y,
this.bounds.width, this.bounds.height), txt, guiStyle);
}
guiStyle.normal.textColor = DataHolder.Color(this.textColor);
GUI.Label(this.bounds, txt, guiStyle);
}
else if(HUDDisplayType.BAR.Equals(this.displayType) && c.status[this.statusID].IsConsumable())
{
float v1 = c.status[this.statusID].GetValue();
float v2 = c.status[c.status[this.statusID].maxStatus].GetValue();
v2 /= 100;
v1 /= v2;
GUI.DrawTexture(new Rect(this.bounds.x, this.bounds.y, this.bounds.width*v1/100, this.bounds.height),
this.GetImage(), this.scaleMode, this.alphaBlend, this.imageAspect);
}
}
else if(HUDElementType.TIMEBAR.Equals(this.type) ||
HUDElementType.USED_TIMEBAR.Equals(this.type) ||
HUDElementType.CASTTIME.Equals(this.type))
{
float v1 = 0;
float v2 = 0;
if(HUDElementType.TIMEBAR.Equals(this.type))
{
v1 = c.timeBar;
v2 = DataHolder.BattleSystem().maxTimebar;
}
//.........这里部分代码省略.........
示例3: AddTexture
public Texture2D AddTexture(Texture2D hudTexture, Character c, Vector2 pos, GUIFont font, int hudID)
{
if(HUDElementType.TEXT.Equals(this.type))
{
hudTexture = font.AddTextTexture(hudTexture, this.text[GameHandler.GetLanguage()],
this.GetAnchoredRect(pos, font.GetTextSize(this.text[GameHandler.GetLanguage()]), this.bounds),
DataHolder.Color(this.textColor), DataHolder.Color(this.shadowColor), 0,
Vector2.zero, this.showShadow, this.shadowOffset, false);
}
else if(HUDElementType.IMAGE.Equals(this.type))
{
this.GetImage();
if(this.texture != null)
{
Vector2 scaledSize = TextureDrawer.GetScaledSize(this.texture, this.bounds, this.scaleMode);
hudTexture = TextureDrawer.AddTexture(hudTexture,
new Rect(this.bounds.x+pos.x, pos.y-this.bounds.y-scaledSize.y, scaledSize.x, scaledSize.y),
TextureDrawer.GetScaledPixels(this.texture, scaledSize, this.bounds, this.scaleMode));
}
}
else if(HUDElementType.NAME.Equals(this.type))
{
GUIContent gc = null;
if(HUDContentType.TEXT.Equals(this.contentType))
{
if(HUDNameType.CHARACTER.Equals(this.nameType)) gc = new GUIContent(c.GetName());
else if(HUDNameType.CLASS.Equals(this.nameType)) gc = new GUIContent(DataHolder.Classes().GetName(c.currentClass));
else if(HUDNameType.STATUS.Equals(this.nameType)) gc = new GUIContent(DataHolder.StatusValues().GetName(this.statusID));
}
else if(HUDContentType.ICON.Equals(this.contentType))
{
if(HUDNameType.CHARACTER.Equals(this.nameType)) gc = new GUIContent(c.GetIcon());
else if(HUDNameType.CLASS.Equals(this.nameType)) gc = new GUIContent(DataHolder.Classes().GetIcon(c.currentClass));
else if(HUDNameType.STATUS.Equals(this.nameType)) gc = new GUIContent(DataHolder.StatusValues().GetIcon(this.statusID));
}
else if(HUDContentType.BOTH.Equals(this.contentType))
{
if(HUDNameType.CHARACTER.Equals(this.nameType)) gc = c.GetContent();
else if(HUDNameType.CLASS.Equals(this.nameType)) gc = DataHolder.Classes().GetContent(c.currentClass);
else if(HUDNameType.STATUS.Equals(this.nameType)) gc = DataHolder.StatusValues().GetContent(this.statusID);
}
if(gc != null)
{
Vector2 size = Vector2.zero;
float gap = 0;
if("" != gc.text)
{
size = font.GetTextSize(gc.text);
if(gc.image != null)
{
gap = font.GetTextSize(" ").x;
size.x += gap;
}
}
if(gc.image != null)
{
size.x += gc.image.width;
if(size.y < gc.image.height) size.y = gc.image.height;
}
Rect rect = this.GetAnchoredRect(pos, size, this.bounds);
if(gc.image != null)
{
Texture2D tex = gc.image as Texture2D;
hudTexture = TextureDrawer.AddTexture(hudTexture,
new Rect(rect.x, rect.y, gc.image.width, gc.image.height),
tex.GetPixels());
rect.x += gc.image.width+gap;
rect.width -= gc.image.width+gap;
}
if("" != gc.text)
{
hudTexture = font.AddTextTexture(hudTexture, gc.text, rect,
DataHolder.Color(this.textColor), DataHolder.Color(this.shadowColor), 0,
Vector2.zero, this.showShadow, this.shadowOffset, false);
}
}
}
else if(HUDElementType.STATUS.Equals(this.type))
{
c.status[this.statusID].lastValueHUD[hudID] = c.status[this.statusID].GetValue();
if(HUDDisplayType.TEXT.Equals(this.displayType))
{
string txt = c.status[this.statusID].GetValue().ToString();
if(c.status[this.statusID].IsConsumable() && this.showMax)
{
txt += this.divider+c.status[c.status[this.statusID].maxStatus].GetValue().ToString();
}
hudTexture = font.AddTextTexture(hudTexture, txt,
this.GetAnchoredRect(pos, font.GetTextSize(txt), this.bounds),
DataHolder.Color(this.textColor), DataHolder.Color(this.shadowColor), 0,
Vector2.zero, this.showShadow, this.shadowOffset, false);
}
else if(HUDDisplayType.BAR.Equals(this.displayType) && c.status[this.statusID].IsConsumable())
{
float v1 = c.status[this.statusID].GetValue();
float v2 = c.status[c.status[this.statusID].maxStatus].GetValue();
v2 /= 100;
v1 /= v2;
//.........这里部分代码省略.........
示例4: AssignCharacter
public void AssignCharacter(Character newChar)
{
assignedCharacter = newChar;
//CAUTION - Enemy char graphics do not have this button in their prefab, so trying to call this on a non-merc char graphic
//will result in an exception
if (newChar.GetType() == typeof(PartyMember))
{
portrait.GetComponent<Button>().onClick.AddListener(
() => InventoryScreenHandler.mainISHandler.ToggleSelectedMember(assignedCharacter as PartyMember));
}
nameText.text = newChar.GetName();
healthText.text = newChar.GetHealth().ToString();
portrait.sprite = newChar.GetPortrait();
SetStartStamina();
SetStartAmmo();
SetStartArmor();
//currentCharacterDeck = assignedCharacter.GetCombatDeck();
}
示例5: StealFromEnemy
public void StealFromEnemy(Character user, Enemy target)
{
ItemDropType t = ItemDropType.ITEM;
int id = -1;
int m = -1;
// steal item
if(this.stealItem && target.stealItem && !target.itemStolen &&
DataHolder.GameSettings().GetRandom() <=
(DataHolder.Formula(this.itemChance).Calculate(user, target)+
user.GetItemStealBonus()+this.itemBonus)*target.stealItemFactor)
{
if(this.fixItem)
{
GameHandler.AddToInventory(this.itemType, this.itemID, 1);
t = this.itemType;
id = this.itemID;
}
else
{
GameHandler.AddToInventory(target.stealItemType, target.stealItemID, 1);
t = target.stealItemType;
id = target.stealItemID;
}
if(target.stealItemOnce) target.itemStolen = true;
if(id >= 0)
{
// TODO: info text display
}
}
// steal money
if(this.stealMoney && target.stealMoney && !target.moneyStolen &&
DataHolder.GameSettings().GetRandom() <=
(DataHolder.Formula(this.moneyChance).Calculate(user, target)+
user.GetMoneyStealBonus()+this.moneyBonus)*target.stealMoneyFactor)
{
if(this.fixMoney)
{
GameHandler.AddMoney(this.money);
m = this.money;
}
else
{
GameHandler.AddMoney(target.stealMoneyAmount);
m = target.stealMoneyAmount;
}
if(target.stealMoneyOnce) target.moneyStolen = true;
}
this.ShowStealInfo(user.GetName(), t, id, m);
}