void Awake() { submachineguns = this.GetComponent <SubmachineGuns>(); SMGPanel = GameObject.Find(SMGPath); SMGButton = GameObject.Find(SMGButtonPath).GetComponent <Button>(); SMGButton.onClick.AddListener(() => SMGControls()); }
internal static void AddSA(object Item, string SType) { using (var db = new DatabaseContext()) { switch (SType) { case "AntiMaterial": AntiMaterial tempAM = new AntiMaterial(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempAM, x.GetValue(Item)); } db.SmallArms.Add(tempAM); break; case "DMRSniperRifles": DMRSniperRifles tempDSR = new DMRSniperRifles(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempDSR, x.GetValue(Item)); } db.SmallArms.Add(tempDSR); break; case "MachineGuns": MachineGuns tempMG = new MachineGuns(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempMG, x.GetValue(Item)); } db.SmallArms.Add(tempMG); break; case "Pistols": Pistols tempP = new Pistols(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempP, x.GetValue(Item)); } db.SmallArms.Add(tempP); break; case "RiflesAndCarbines": RiflesAndCarbines tempRAC = new RiflesAndCarbines(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempRAC, x.GetValue(Item)); } db.SmallArms.Add(tempRAC); break; case "Shotguns": Shotguns tempSh = new Shotguns(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempSh, x.GetValue(Item)); } db.SmallArms.Add(tempSh); break; case "SubmachineGuns": SubmachineGuns tempSMG = new SubmachineGuns(); foreach (PropertyInfo x in Item.GetType().GetProperties()) { x.SetValue(tempSMG, x.GetValue(Item)); } db.SmallArms.Add(tempSMG); break; } db.SaveChanges(); } }