42 lines
762 B
C#
42 lines
762 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace 反射练习库
|
|
{
|
|
class MyCustomAttribute: Attribute
|
|
{
|
|
|
|
}
|
|
public struct Position
|
|
{
|
|
public int x;
|
|
public int y;
|
|
|
|
public Position(int x,int y)
|
|
{
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
}
|
|
public class Player
|
|
{
|
|
[MyCustom()]
|
|
public string name;
|
|
public int hp;
|
|
public int atk;
|
|
public int def;
|
|
public Position position;
|
|
public Player()
|
|
{
|
|
name = "英雄";
|
|
hp = 100;
|
|
atk = 10;
|
|
def = 5;
|
|
position = new Position(0, 0);
|
|
}
|
|
}
|
|
}
|