public async Task <IActionResult> PutUserEquipment([FromRoute] string id, [FromBody] UserEquipment userEquipment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != userEquipment.UserName)
            {
                return(BadRequest());
            }

            _context.Entry(userEquipment).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserEquipmentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PostUserEquipment([FromBody] UserEquipment userEquipment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.UserEquipment.Add(userEquipment);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (UserEquipmentExists(userEquipment.UserName))
                {
                    return(new StatusCodeResult(StatusCodes.Status409Conflict));
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetUserEquipment", new { id = userEquipment.UserName }, userEquipment));
        }
 public void UpdateEquip(UserEquipment us)
 {
     this.equipTitle.text = us.config.title;
     this.equipTitle.Commit();
     this.loadCard.SetEquip(us.config.picId);
     this.fullColor.ShowColorOf(us.config.star);
 }
 public void AddEquipments(UserEquipment equip)
 {
     if (this.userEquips == null)
     {
         this.userEquips = new List<UserEquipment>();
     }
     this.userEquips.Add(equip);
 }
 protected override void SetShipContent(GameObject go, UserEquipment equip)
 {
     EqupForSelectToDestory component = go.GetComponent<EqupForSelectToDestory>();
     if (component != null)
     {
         component.UpdateEquip(equip);
     }
 }
 public void UpdateEquip(UserEquipment euip)
 {
     this.userEquip = euip;
     UpdateOneWeaponInfo component = base.GetComponent<UpdateOneWeaponInfo>();
     if (component != null)
     {
         component.UpdateWeaponInfo(this.userEquip);
     }
 }
예제 #7
0
 public void AddUserEquipmenet(UserEquipment equip)
 {
     if (equip != null)
     {
         if (this._userEquipmentDic == null)
         {
             this._userEquipmentDic = new Dictionary <int, UserEquipment>();
         }
         this._userEquipmentDic[equip.id] = equip;
     }
 }
 public void UpdateEquip(UserEquipment equp)
 {
     if (equp != null)
     {
         this.userEquip = equp;
     }
     this.showShipInfo = base.GetComponent<UpdateOneWeaponInfo>();
     if (this.showShipInfo != null)
     {
         this.showShipInfo.UpdateWeaponInfo(this.userEquip);
     }
 }
예제 #9
0
 private void UpdateEquip()
 {
     if (this.oldEquipId > 0)
     {
         UserEquipment equipmentById = GameData.instance.GetEquipmentById(this.oldEquipId);
         if (equipmentById != null)
         {
             equipmentById.status = 0;
         }
     }
     if (this.newEquipId > 0)
     {
         UserEquipment equipment2 = GameData.instance.GetEquipmentById(this.newEquipId);
         if (equipment2 != null)
         {
             equipment2.status = 1;
         }
     }
 }
 public void ToggleSelection(UserEquipment equip)
 {
     if (this.selectedEquipsDic.ContainsKey(equip.id))
     {
         this.selectedEquipsDic.Remove(equip.id);
         this.selectedEquips.Remove(equip);
     }
     else
     {
         if (this.selectedEquips.Count >= this.maxSelection)
         {
             this.ShowMaxNotice();
             return;
         }
         this.selectedEquipsDic.Add(equip.id, true);
         this.selectedEquips.Add(equip);
     }
     this.UpdateEquipAfterSort();
 }
예제 #11
0
        private static void do_reportBuildWeapon(int dockid, BSLOG bSLOG, GetEquipData getEquipData)
        {
            if (getEquipData == null || getEquipData.equipmentVo == null)
            {
                return;
            }
            var           dic      = new Dictionary <string, string>();
            string        desc     = "";
            UserShip      flagship = GameData.instance.GetShipById(GameData.instance.UserFleets[0].ships[0]);
            UserEquipment us       = getEquipData.equipmentVo;

            {
                desc += bSLOG.oil.ToString() + "|" +
                        bSLOG.ammo.ToString() + "|" +
                        bSLOG.steel.ToString() + "|" +
                        bSLOG.al.ToString() + "|" +
                        bSLOG.timetick.ToString() + "|" +
                        bSLOG.buildreturntype.ToString() +

                        "|" + us.config.cid + "|" + us.config.title + "|" + us.config.star
                        + "|" + ServerTimer.GetNowServerTime()
                        + "|" + z.instance.getServerName()
                        + "|" + flagship.level + "|" + flagship.ship.cid + "|" + flagship.ship.luck + "|" + flagship.ship.star + "|" + flagship.ship.title
                        + "|" + GameData.instance.UserInfo.username
                        + "|" + GameData.instance.UserInfo.level
                        + "\r\n";
            }
            dic["msg"] = desc;
            var c = new System.Net.Http.FormUrlEncodedContent(dic);

            try
            {
                var p = new System.Net.Http.HttpClient();
                var r = p.PostAsync(tools.helper.count_server_addr + "/sssgbsssgb/reportbuildweapon", c).Result;
            }
            catch (Exception)
            {
            }
        }
 private void ShowGetNewShip(UserEquipment us)
 {
     GameObjectUtil.InstantiateItemAsChildOf(this.getNewEquipPrefab, base.gameObject).GetComponent<GetNewEquipUI>().UpdateEquip(us);
 }
예제 #13
0
 public void AddUserEquipmenet(UserEquipment equip)
 {
     if (equip != null)
     {
         if (this._userEquipmentDic == null)
         {
             this._userEquipmentDic = new Dictionary<int, UserEquipment>();
         }
         this._userEquipmentDic[equip.id] = equip;
     }
 }
예제 #14
0
 public void SetUserEquipments(UserEquipment[] equips)
 {
     if (equips != null)
     {
         if (f_am_cache31 == null)
         {
             f_am_cache31 = n => n.id;
         }
         if (f_am_cache32 == null)
         {
             f_am_cache32 = n => n;
         }
         this._userEquipmentDic = equips.ToDictionary<UserEquipment, int, UserEquipment>(f_am_cache31, f_am_cache32);
     }
     else
     {
         this._userEquipmentDic = new Dictionary<int, UserEquipment>();
     }
 }
 public void UpdateWeaponInfo(UserEquipment euip)
 {
     this.userEquip = euip;
     this.config = this.userEquip.config;
 }
 public void RemoveMaterialShip(UserEquipment ship)
 {
     if (this.materialEquips != null)
     {
         this.materialEquips.Remove(ship);
         this.UpdateUIContents();
     }
 }