本文整理汇总了C#中Utility.Up方法的典型用法代码示例。如果您正苦于以下问题:C# Utility.Up方法的具体用法?C# Utility.Up怎么用?C# Utility.Up使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility.Up方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public override void Update(Utility.Key key)
{
if(selectbox == null){
int x = target.x;
int y = target.y;
if(key.Up()) y -= 1;
if(key.Down()) y += 1;
if(key.Left()) x -= 1;
if(key.Right()) x += 1;
if(x != target.x || y != target.y){
if(field[x][y] != 1){
var cc = CharacterByCoord(x, y);
if(cc != null){
message.buffer.Add(string.Format("{0} hits {1} !", target.id, cc.id));
cc.hp -= target.atk;
}else{
target.x = x;
target.y = y;
}
foreach(var c in characters){
int xnextc = c.x;
int ynextc = c.y;
if(target.x - c.x != 0) xnextc += (target.x - c.x)/(Math.Abs(target.x - c.x));
if(target.y - c.y != 0) ynextc += (target.y - c.y)/(Math.Abs(target.y - c.y));
var ccc = CharacterByCoord(xnextc, ynextc);
if(ccc != null){
message.buffer.Add(string.Format("{0} hits {1} !", c.id, ccc.id));
ccc.hp -= c.atk;
}else{
c.x = xnextc;
c.y = ynextc;
}
}
}
}
xcamera = target.x*64 - 288;
ycamera = target.y*64 - 208;
if(key.X()){
selectbox = new UI.SelectBox(352, 240, 256, new string[]{"Save XD", "Back to the Opening", "Exit :("});
}
}else{
selectbox.Update(key);
if(key.A()){
if(selectbox.cursor == 0){
var serializer = new System.Xml.Serialization.XmlSerializer(typeof(DungeonData));
var fs = new System.IO.FileStream("savedata.xml", System.IO.FileMode.Create);
serializer.Serialize(fs, GetSaveData());
fs.Close();
}else if(selectbox.cursor == 1){
sdata.scene_next = new Opening(sdata);
}else{
sdata.endgame = true;
}
}else if(key.B()){
selectbox = null;
}
}
}
示例2: Update
public void Update(Utility.Key key)
{
if(key.Up()) cursor = (cursor - 1 + lines.Length)%lines.Length;
if(key.Down()) cursor = (cursor + 1 + lines.Length)%lines.Length;
}