示例#1
0
 public bool ThrowGadgetEquipped()
 {
     if (currentGadget)
     {
         if (currentGadget.GetType() == typeof(GadgetThrow))
         {
             return(true);
         }
     }
     return(false);
 }
示例#2
0
    public void Populate(Gadget gadget)
    {
        //Use reflection go copy all of the fields from the Gadget Object to the Gadget2 object
        foreach (var prop in gadget.GetType().GetProperties())
        {
            this.GetType().GetProperty(prop.Name).SetValue(this, prop.GetValue(gadget, null), null);
        }

        //Format date on the Server instead of in the javascript
        this.UpdateDateTimeString = gadget.UpdatedDateTime.ToString();
    }
示例#3
0
    static void Main(string[] args)
    {
        object      x             = new Gadget();
        Type        t             = x.GetType();
        MethodInfo  mi            = t.GetMethod("FizzBuzz");
        object      returnedValue = mi.Invoke(x, new object[] { 10, 101 });
        IList <int> returnedList  = (IList <int>)returnedValue;
        string      msg           = returnedList.Select(n => n.ToString(CultureInfo.InvariantCulture)).Aggregate((s, v) => string.Format("{0}...{1}", s, v));

        Console.WriteLine(msg);
        return;
    }
示例#4
0
文件: World.cs 项目: hsuanhauliu/RuGo
 public void InsertGadget(Gadget gadget)
 {
     gadget.gameObject.name = gadget.GetType().ToString() + gadgetsInWorld.Count.ToString();
     gadgetsInWorld.Add(gadget);
     MarkWorldModified();
 }