Esempio n. 1
0
        private NotificationObject CreateResearchNotification(string productUid, DeliveryType contractType, int remainingTime, string buildingKey)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            string displayName = null;
            int    level       = 0;

            if (contractType != DeliveryType.UpgradeTroop)
            {
                if (contractType != DeliveryType.UpgradeStarship)
                {
                    if (contractType == DeliveryType.UpgradeEquipment)
                    {
                        EquipmentVO equipmentVO = staticDataController.Get <EquipmentVO>(productUid);
                        displayName = LangUtils.GetEquipmentDisplayName(equipmentVO);
                        level       = equipmentVO.Lvl;
                    }
                }
                else
                {
                    SpecialAttackTypeVO specialAttackTypeVO = staticDataController.Get <SpecialAttackTypeVO>(productUid);
                    displayName = LangUtils.GetStarshipDisplayName(specialAttackTypeVO);
                    level       = specialAttackTypeVO.Lvl;
                }
            }
            else
            {
                TroopTypeVO troopTypeVO = staticDataController.Get <TroopTypeVO>(productUid);
                displayName = LangUtils.GetTroopDisplayName(troopTypeVO);
                level       = troopTypeVO.Lvl;
            }
            return(this.CreateSupportNotification(productUid, remainingTime, buildingKey, "notif3", displayName, level));
        }
Esempio n. 2
0
 public static string GetEquipmentDisplayName(EquipmentVO vo)
 {
     return(Service.Get <Lang>().Get(string.Format("{0}_name", new object[]
     {
         vo.EquipmentID
     }), new object[0]));
 }
Esempio n. 3
0
        /// <summary>
        /// 그리드뷰에 셀을클릭할시 수정,삭제 할 수 있는 곤간에 데이터 삽입
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvEquipmentList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                txtDetailName.Text = dgvEquipmentList.Rows[e.RowIndex].Cells[1].Value.ToString();
                txtLocation.Text   = dgvEquipmentList.Rows[e.RowIndex].Cells[2].Value.ToString();
                txtPrice.Text      = dgvEquipmentList.Rows[e.RowIndex].Cells[4].Value.ToString();
                txtNote.Text       = dgvEquipmentList.Rows[e.RowIndex].Cells[6].Value.ToString();
                cbState.Text       = dgvEquipmentList.Rows[e.RowIndex].Cells[3].Value.ToString();
                if (dgvEquipmentList.Rows[e.RowIndex].Cells[5].Value.ToString() != "")
                {
                    dtpPurchaseDate.Value = DateTime.Parse(dgvEquipmentList.Rows[e.RowIndex].Cells[5].Value.ToString());
                }

                tempEquipment = new EquipmentVO()
                {
                    EQUCode       = dgvEquipmentList.Rows[e.RowIndex].Cells[0].Value.ToString(),
                    DetailName    = dgvEquipmentList.Rows[e.RowIndex].Cells[1].Value.ToString(),
                    Location      = dgvEquipmentList.Rows[e.RowIndex].Cells[2].Value.ToString(),
                    State         = dgvEquipmentList.Rows[e.RowIndex].Cells[3].Value.ToString(),
                    PurchasePrice = float.Parse(dgvEquipmentList.Rows[e.RowIndex].Cells[4].Value.ToString()),
                    PurchaseDate  = dtpPurchaseDate.Value = DateTime.Parse(dgvEquipmentList.Rows[e.RowIndex].Cells[5].Value.ToString()),
                    Note          = dgvEquipmentList.Rows[e.RowIndex].Cells[6].Value.ToString()
                };
                btnModification.Enabled = true;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// DB로 저장
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtDetailName.Text == "")
            {
                MessageBox.Show("품목명을 입력해주세요");
                return;
            }
            EquipmentVO equipmentVO = new EquipmentVO()
            {
                DetailName    = txtDetailName.Text,
                Location      = txtLocation.Text,
                PurchasePrice = float.Parse(txtPrice.Text.Replace(",", "")),
                PurchaseDate  = dtpPurchaseDate.Value.Date,
                Note          = txtNote.Text
            };
            EquipmentDAO dAO = new EquipmentDAO();

            try
            {
                DialogResult resurt = MessageBox.Show("저장하시겠습니까?", "비품저장", MessageBoxButtons.YesNo);
                if (resurt == DialogResult.Yes)
                {
                    if (dAO.InsertEquipment(equipmentVO))
                    {
                        MessageBox.Show("성공적으로 저장되었습니다");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("저장실패" + ex.Message);
            }
        }
Esempio n. 5
0
        private void OnCancelButtonClicked(UXButton button)
        {
            UXElement   uXElement = button.Tag as UXElement;
            EquipmentVO equipment = (uXElement.Tag as SortableEquipment).Equipment;

            Service.ArmoryController.DeactivateEquipment(equipment.EquipmentID);
        }
Esempio n. 6
0
 private static void AddEquipmentAssets(List <string> equipment, List <IAssetVO> assets, IDataController dc)
 {
     if (equipment != null)
     {
         int i     = 0;
         int count = equipment.Count;
         while (i < count)
         {
             EquipmentVO equipmentVO = dc.Get <EquipmentVO>(equipment[i]);
             string[]    effectUids  = equipmentVO.EffectUids;
             if (effectUids != null)
             {
                 int j   = 0;
                 int num = effectUids.Length;
                 while (j < num)
                 {
                     EquipmentEffectVO equipmentEffectVO = dc.Get <EquipmentEffectVO>(effectUids[j]);
                     string[]          buffUids          = equipmentEffectVO.BuffUids;
                     if (buffUids != null)
                     {
                         int k    = 0;
                         int num2 = buffUids.Length;
                         while (k < num2)
                         {
                             ProjectileUtils.AddBuffProjectileAssets(buffUids[k], assets, dc);
                             k++;
                         }
                     }
                     j++;
                 }
             }
             i++;
         }
     }
 }
Esempio n. 7
0
        private UXElement CreateActiveCard(UXGrid grid, EquipmentVO equipment, CurrentPlayer player)
        {
            UXElement         uXElement         = this.CreateCommonEquipmentCard(this.activeGrid, equipment, "LabelEquipmentActiveName", "LabelEquipmentActiveLevel", "SpriteEquipmentActiveItemImage", "EquipmentActiveItemCardQ{0}", true, false);
            SortableEquipment sortableEquipment = uXElement.Tag as SortableEquipment;

            sortableEquipment.IncrementingIndex = this.activeCardID++;
            UXLabel subElement = this.activeGrid.GetSubElement <UXLabel>(equipment.Uid, "LabelEquipmentActiveInstructions");

            subElement.Visible = false;
            UXButton subElement2 = this.activeGrid.GetSubElement <UXButton>(equipment.Uid, "BtnEquipmentActiveCancel");

            subElement2.OnClicked = new UXButtonClickedDelegate(this.OnCancelButtonClicked);
            subElement2.Tag       = uXElement;
            UXButton subElement3 = this.activeGrid.GetSubElement <UXButton>(equipment.Uid, "BtnEquipmentActiveItemCard");

            subElement3.Tag       = equipment;
            subElement3.OnClicked = new UXButtonClickedDelegate(this.OnActiveCardButtonClicked);
            UXSprite subElement4 = grid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentActiveImageBkgStroke");
            UXSprite subElement5 = grid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentActiveImageBkgGlow");

            subElement4.Color = ArmoryScreen.qualityColor[equipment.Quality];
            subElement5.Color = ArmoryScreen.qualityColor[equipment.Quality];
            subElement5.Alpha = 0.4f;
            this.activeGrid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentActiveImageEmptySlot").Visible = false;
            return(uXElement);
        }
Esempio n. 8
0
        private float GetSliderProgressValue(EquipmentVO equipment, int currentShards)
        {
            EquipmentVO nextLevel = Service.EquipmentUpgradeCatalog.GetNextLevel(equipment);

            if (nextLevel == null)
            {
                return(1f);
            }
            EquipmentVO equipmentVO;

            if (Service.CurrentPlayer.UnlockedLevels.Equipment.Has(equipment))
            {
                equipmentVO = nextLevel;
            }
            else
            {
                equipmentVO = equipment;
            }
            if (equipmentVO.UpgradeShards == 0)
            {
                Service.Logger.ErrorFormat("CMS Error: Shards required for {0} is zero", new object[]
                {
                    equipment.Uid
                });
                return(0f);
            }
            float num = (float)currentShards / (float)equipmentVO.UpgradeShards;

            return((num <= 1f) ? num : 1f);
        }
Esempio n. 9
0
        /// <summary>
        /// 날짜 별로 비품데이터 찾기
        /// </summary>
        /// <param name="startDate">시작 일</param>
        /// <param name="endDate">종료 일</param>
        /// <returns></returns>
        public List <EquipmentVO> EquipmentByDate(DateTime startDate, DateTime endDate)
        {
            List <EquipmentVO> equipmentLst  = new List <EquipmentVO>();
            DBConnection       dBConnection  = new DBConnection();
            string             procedureName = "dbo.EquipmentBYDate_PROC";

            SqlParameter[] sqlParameters = new SqlParameter[2];
            sqlParameters[0] = new SqlParameter("startDate", startDate);
            sqlParameters[1] = new SqlParameter("endDate", endDate);

            try
            {
                SqlDataReader dataReader = dBConnection.Select(procedureName, sqlParameters);

                while (dataReader.Read())
                {
                    EquipmentVO equipmentVO = new EquipmentVO()
                    {
                        EQUCode       = dataReader["EQUCode"].ToString(),
                        DetailName    = dataReader["detailName"].ToString(),
                        Location      = dataReader["location"].ToString(),
                        State         = dataReader["state"].ToString(),
                        PurchasePrice = float.Parse(dataReader["purchasePrice"].ToString()),
                        PurchaseDate  = DateTime.Parse(dataReader["purchaseDate"].ToString()),
                        Note          = dataReader["note"].ToString()
                    };
                    equipmentLst.Add(equipmentVO);
                }
                return(equipmentLst);
            }
            catch (SqlException)
            {
                throw;
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 모든 비품리스트들을 불러온다
        /// </summary>
        /// <returns></returns>
        public List <EquipmentVO> AllequipmentVOsList()
        {
            List <EquipmentVO> equipmentLst = new List <EquipmentVO>();

            DBConnection dBConnection  = new DBConnection();
            string       procedureName = "dbo.SerchEquipment";

            try
            {
                SqlDataReader dataReader = dBConnection.Select(procedureName, null);

                while (dataReader.Read())
                {
                    EquipmentVO equipmentVO = new EquipmentVO()
                    {
                        EQUCode       = dataReader["EQUCode"].ToString(),
                        DetailName    = dataReader["detailName"].ToString(),
                        Location      = dataReader["location"].ToString(),
                        State         = dataReader["state"].ToString(),
                        PurchasePrice = float.Parse(dataReader["purchasePrice"].ToString()),
                        PurchaseDate  = DateTime.Parse(dataReader["purchaseDate"].ToString()),
                        Note          = dataReader["note"].ToString()
                    };
                    equipmentLst.Add(equipmentVO);
                }
                return(equipmentLst);
            }
            catch (SqlException)
            {
                throw;
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 날짜 별로 구입날짜, 구매 가격 찾기
        /// </summary>
        /// <param name="startDate">시작 일</param>
        /// <param name="endDate">종료 일</param>
        /// <returns></returns>
        public List <EquipmentVO> GroupingDateEquipment(DateTime startDate, DateTime endDate)
        {
            List <EquipmentVO> equipmentLst  = new List <EquipmentVO>();
            DBConnection       dBConnection  = new DBConnection();
            string             procedureName = "dbo.GroupingDateEquipment_PROC";

            SqlParameter[] sqlParameters = new SqlParameter[2];
            sqlParameters[0] = new SqlParameter("startDate", startDate);
            sqlParameters[1] = new SqlParameter("endDate", endDate);

            try
            {
                SqlDataReader dataReader = dBConnection.Select(procedureName, sqlParameters);

                while (dataReader.Read())
                {
                    EquipmentVO equipmentVO = new EquipmentVO()
                    {
                        PurchasePrice = float.Parse(dataReader["purchasePrice"].ToString()),
                        PurchaseDate  = DateTime.Parse(dataReader["purchaseDate"].ToString()),
                    };
                    equipmentLst.Add(equipmentVO);
                }
                return(equipmentLst);
            }
            catch (SqlException)
            {
                throw;
            }
        }
Esempio n. 12
0
 public static string GetEquipmentDescription(EquipmentVO vo)
 {
     return(Service.Get <Lang>().Get(string.Format("{0}_description", new object[]
     {
         vo.EquipmentID
     }), new object[0]));
 }
Esempio n. 13
0
        public static bool IsEquipmentOnValidPlanet(CurrentPlayer player, EquipmentVO equipment)
        {
            if (equipment.PlanetIDs == null)
            {
                StringBuilder stringBuilder = new StringBuilder("CMS ERROR: ");
                stringBuilder.AppendFormat("{0} has no valid planets", new object[]
                {
                    equipment.Uid
                });
                Service.Get <StaRTSLogger>().Error(stringBuilder.ToString());
                return(false);
            }
            int i   = 0;
            int num = equipment.PlanetIDs.Length;

            while (i < num)
            {
                if (player.PlanetId == equipment.PlanetIDs[i])
                {
                    return(true);
                }
                i++;
            }
            return(false);
        }
Esempio n. 14
0
        private NotificationObject CreateResearchNotification(string productUid, DeliveryType contractType, int remainingTime, string buildingKey)
        {
            IDataController dataController = Service.Get <IDataController>();
            string          displayName    = null;
            int             level          = 0;

            switch (contractType)
            {
            case DeliveryType.UpgradeTroop:
            {
                TroopTypeVO troopTypeVO = dataController.Get <TroopTypeVO>(productUid);
                displayName = LangUtils.GetTroopDisplayName(troopTypeVO);
                level       = troopTypeVO.Lvl;
                break;
            }

            case DeliveryType.UpgradeStarship:
            {
                SpecialAttackTypeVO specialAttackTypeVO = dataController.Get <SpecialAttackTypeVO>(productUid);
                displayName = LangUtils.GetStarshipDisplayName(specialAttackTypeVO);
                level       = specialAttackTypeVO.Lvl;
                break;
            }

            case DeliveryType.UpgradeEquipment:
            {
                EquipmentVO equipmentVO = dataController.Get <EquipmentVO>(productUid);
                displayName = LangUtils.GetEquipmentDisplayName(equipmentVO);
                level       = equipmentVO.Lvl;
                break;
            }
            }
            return(this.CreateSupportNotification(productUid, remainingTime, buildingKey, "notif3", displayName, level));
        }
Esempio n. 15
0
        private void UpdateActiveArmoryLevel(EquipmentVO equipmentVO)
        {
            if (equipmentVO == null)
            {
                Service.Logger.Warn("Equipment is null");
                return;
            }
            StaticDataController staticDataController = Service.StaticDataController;
            CurrentPlayer        currentPlayer        = Service.CurrentPlayer;
            List <string>        equipment            = currentPlayer.ActiveArmory.Equipment;
            int i     = 0;
            int count = equipment.Count;

            while (i < count)
            {
                string      text         = equipment[i];
                EquipmentVO equipmentVO2 = staticDataController.Get <EquipmentVO>(text);
                if (equipmentVO2.EquipmentID == equipmentVO.EquipmentID)
                {
                    equipment.Remove(text);
                    equipment.Add(equipmentVO.Uid);
                    break;
                }
                i++;
            }
        }
Esempio n. 16
0
        public static List <string> GetValidEquipment(CurrentPlayer player, IDataController dc, string planetId)
        {
            List <string> list      = null;
            List <string> equipment = player.ActiveArmory.Equipment;

            if (equipment != null)
            {
                int i     = 0;
                int count = equipment.Count;
                while (i < count)
                {
                    EquipmentVO equipmentVO = dc.Get <EquipmentVO>(equipment[i]);
                    if (ArmoryUtils.IsEquipmentValidForPlanet(equipmentVO, planetId))
                    {
                        if (list == null)
                        {
                            list = new List <string>();
                        }
                        list.Add(equipmentVO.Uid);
                    }
                    i++;
                }
            }
            return(list);
        }
Esempio n. 17
0
        public void HandleEarnedShardReward(string equipmentId, int count)
        {
            CurrentPlayer            currentPlayer = Service.CurrentPlayer;
            Dictionary <string, int> shards        = currentPlayer.Shards;
            EquipmentVO equipmentDataByID          = ArmoryUtils.GetEquipmentDataByID(equipmentId, 1);

            if (equipmentDataByID == null)
            {
                return;
            }
            int num = count;

            if (shards.ContainsKey(equipmentId))
            {
                num += shards[equipmentId];
            }
            currentPlayer.ModifyShardAmount(equipmentId, num);
            EquipmentVO nextEquipmentVOUpgrade = this.GetNextEquipmentVOUpgrade(equipmentId);

            if (nextEquipmentVOUpgrade != null && shards[equipmentId] - count < nextEquipmentVOUpgrade.UpgradeShards && nextEquipmentVOUpgrade.UpgradeShards < shards[equipmentId])
            {
                this.AllowShowEquipmentTabBadge = true;
                Service.EventManager.SendEvent(EventId.EquipmentNowUpgradable, equipmentId);
            }
            Service.EventManager.SendEvent(EventId.ShardsEarned, null);
            if (!ArmoryUtils.IsEquipmentOwned(currentPlayer, equipmentDataByID))
            {
                this.TryToUnlockPlayerEquipment(equipmentDataByID);
            }
        }
Esempio n. 18
0
        public static int GetBuildingContractTotalTime(string buildingContractUid, DeliveryType type)
        {
            if (type == DeliveryType.UpgradeTroop)
            {
                TroopTypeVO optional = Service.Get <IDataController>().GetOptional <TroopTypeVO>(buildingContractUid);
                return(optional.UpgradeTime);
            }
            if (type == DeliveryType.UpgradeStarship)
            {
                SpecialAttackTypeVO optional2 = Service.Get <IDataController>().GetOptional <SpecialAttackTypeVO>(buildingContractUid);
                return(optional2.UpgradeTime);
            }
            if (type == DeliveryType.UpgradeEquipment)
            {
                EquipmentVO optional3 = Service.Get <IDataController>().GetOptional <EquipmentVO>(buildingContractUid);
                return(optional3.UpgradeTime);
            }
            BuildingTypeVO buildingTypeVO = Service.Get <IDataController>().Get <BuildingTypeVO>(buildingContractUid);

            switch (type)
            {
            case DeliveryType.Building:
            case DeliveryType.UpgradeBuilding:
            case DeliveryType.ClearClearable:
                return(buildingTypeVO.Time);

            case DeliveryType.SwapBuilding:
                return(buildingTypeVO.SwapTime);
            }
            return(0);
        }
Esempio n. 19
0
        private string GetResearchDisplayName(string uid)
        {
            string result = string.Empty;

            if (!string.IsNullOrEmpty(uid))
            {
                StaticDataController staticDataController = Service.StaticDataController;
                TroopTypeVO          optional             = staticDataController.GetOptional <TroopTypeVO>(uid);
                if (optional != null)
                {
                    result = LangUtils.GetTroopDisplayName(optional);
                }
                else
                {
                    SpecialAttackTypeVO optional2 = staticDataController.GetOptional <SpecialAttackTypeVO>(uid);
                    if (optional2 != null)
                    {
                        result = LangUtils.GetStarshipDisplayName(optional2);
                    }
                    else
                    {
                        EquipmentVO optional3 = staticDataController.GetOptional <EquipmentVO>(uid);
                        if (optional3 != null)
                        {
                            result = LangUtils.GetEquipmentDisplayName(optional3);
                        }
                    }
                }
            }
            return(result);
        }
Esempio n. 20
0
        /// <summary>
        ///     Store an equipment
        /// </summary>
        /// <param name="equipmentVO"></param>
        public void Add(EquipmentVO equipmentVO)
        {
            _unitOfWork.Equipments.Add(new Equipment
            {
                Name            = equipmentVO.Name,
                SerialNumber    = equipmentVO.SerialNumber,
                NextControlDate = equipmentVO.NextControlDate
            });
            _unitOfWork.Pictures.Add(new Picture
            {
                SerialNumber = equipmentVO.SerialNumber,
                Content      = equipmentVO.Picture
            });

            try
            {
                _unitOfWork.Complete();
            }
            catch (DbUpdateException e)
                when
                    (e.InnerException?.InnerException is SqlException sqlEx &&
                    (sqlEx.Number == 2601 || sqlEx.Number == 2627))
                {
                    throw new EquipmentExistException(equipmentVO.SerialNumber);
                }
        }
Esempio n. 21
0
        /// <summary>
        /// 비품 수정(업데이트)
        /// </summary>
        /// <param name="equipment"></param>
        /// <returns></returns>
        public bool UpdateEquipment(EquipmentVO equipment)
        {
            DBConnection dBConnection  = new DBConnection();
            string       procedureName = "dbo.UpdateEquipment_PROC";

            SqlParameter[] sqlParameters = new SqlParameter[6];
            sqlParameters[0] = new SqlParameter("EQUCode", equipment.EQUCode);
            sqlParameters[1] = new SqlParameter("detailName", equipment.DetailName);
            sqlParameters[2] = new SqlParameter("location", equipment.Location);
            sqlParameters[3] = new SqlParameter("state", equipment.State);
            sqlParameters[4] = new SqlParameter("purchasePrice", equipment.PurchasePrice);
            sqlParameters[5] = new SqlParameter("purchaseDate", equipment.PurchaseDate);

            try
            {
                if (dBConnection.Update(procedureName, sqlParameters) != 1)
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(true);
        }
Esempio n. 22
0
        public void ActivateEquipment(string equipmentId)
        {
            CurrentPlayer currentPlayer            = Service.CurrentPlayer;
            EquipmentVO   currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(equipmentId);

            if (currentEquipmentDataByID == null)
            {
                Service.Logger.Warn("Invalid EquipmentID: " + equipmentId);
                return;
            }
            if (currentPlayer.ActiveArmory.Equipment.Contains(currentEquipmentDataByID.Uid))
            {
                return;
            }
            if (ArmoryUtils.GetCurrentActiveEquipmentCapacity(currentPlayer.ActiveArmory) + currentEquipmentDataByID.Size > currentPlayer.ActiveArmory.MaxCapacity)
            {
                string instructions = Service.Lang.Get("ARMORY_FULL", new object[0]);
                Service.UXController.MiscElementsManager.ShowPlayerInstructions(instructions);
                return;
            }
            if (!ArmoryUtils.IsEquipmentOnValidPlanet(currentPlayer, currentEquipmentDataByID))
            {
                string instructions2 = Service.Lang.Get("BASE_ON_INCORRECT_PLANET", new object[0]);
                Service.UXController.MiscElementsManager.ShowPlayerInstructions(instructions2);
                return;
            }
            currentPlayer.ActiveArmory.Equipment.Add(currentEquipmentDataByID.Uid);
            Service.EventManager.SendEvent(EventId.EquipmentActivated, currentEquipmentDataByID);
            EquipmentIdRequest       request = new EquipmentIdRequest(equipmentId);
            ActivateEquipmentCommand activateEquipmentCommand = new ActivateEquipmentCommand(request);

            activateEquipmentCommand.Context = equipmentId;
            activateEquipmentCommand.AddFailureCallback(new AbstractCommand <EquipmentIdRequest, DefaultResponse> .OnFailureCallback(this.OnActivateEquipmentFailure));
            Service.ServerAPI.Enqueue(activateEquipmentCommand);
        }
Esempio n. 23
0
        public ActionResult Edit([Bind(Include = "SerialNumber,Name,Picture,NextControlDate")]
                                 EquipmentModel EquipmentModel)
        {
            if (ModelState.IsValid)
            {
                var picture = new byte[0];
                if (EquipmentModel.Picture != null)
                {
                    var target = new MemoryStream();
                    EquipmentModel.Picture.InputStream.CopyTo(target);
                    picture = target.ToArray();
                }

                var equipmentVO = new EquipmentVO
                {
                    Name            = EquipmentModel.Name,
                    NextControlDate = EquipmentModel.NextControlDate,
                    Picture         = picture,
                    SerialNumber    = EquipmentModel.SerialNumber
                };
                _equipmentService.Update(equipmentVO);
                return(RedirectToAction("Index"));
            }

            return(View(EquipmentModel));
        }
Esempio n. 24
0
        public bool IsEquipmentUpgradeable(EquipmentVO equipmentVO, EquipmentVO nextEquipmentVO)
        {
            CurrentPlayer currentPlayer = Service.CurrentPlayer;
            bool          flag          = ArmoryUtils.IsEquipmentOwned(currentPlayer, equipmentVO);
            bool          flag2         = this.IsEquipmentUnlockableOrUpgradeable(nextEquipmentVO);

            return(flag && flag2);
        }
Esempio n. 25
0
        public bool IsEquipmentUnlockableOrUpgradeable(EquipmentVO equipment)
        {
            CurrentPlayer currentPlayer = Service.CurrentPlayer;
            bool          flag          = ArmoryUtils.CanAffordEquipment(currentPlayer, equipment);
            bool          flag2         = ArmoryUtils.IsBuildingRequirementMet(equipment);

            return(flag && flag2);
        }
Esempio n. 26
0
        public static bool IsUpgradeEquipmentContractValid(Contract contract)
        {
            EquipmentVO             upgradeable             = Service.Get <IDataController>().Get <EquipmentVO>(contract.ProductUid);
            EquipmentUpgradeCatalog equipmentUpgradeCatalog = Service.Get <EquipmentUpgradeCatalog>();
            CurrentPlayer           currentPlayer           = Service.Get <CurrentPlayer>();

            return(equipmentUpgradeCatalog.CanUpgradeTo(currentPlayer.UnlockedLevels.Equipment, upgradeable));
        }
Esempio n. 27
0
        public static ProjectorConfig GenerateEquipmentConfig(EquipmentVO equipmentVO, UXSprite frameSprite, bool closeup)
        {
            IGeometryVO     vo = ProjectorUtils.DetermineVOForEquipment(equipmentVO);
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(vo, frameSprite, closeup);

            projectorConfig.buildingEquipmentShaderName = ProjectorUtils.GetEquipmentBuildingShaderName(equipmentVO);
            return(projectorConfig);
        }
Esempio n. 28
0
        public static ProjectorConfig GenerateEquipmentConfig(EquipmentVO equipmentVO, Action <RenderTexture, ProjectorConfig> callback, float width, float height)
        {
            IGeometryVO     vo = ProjectorUtils.DetermineVOForEquipment(equipmentVO);
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(vo, callback, width, height);

            projectorConfig.buildingEquipmentShaderName = ProjectorUtils.GetEquipmentBuildingShaderName(equipmentVO);
            return(projectorConfig);
        }
Esempio n. 29
0
        public static bool CanAffordEquipment(CurrentPlayer currentPlayer, EquipmentVO equipment)
        {
            string equipmentID = equipment.EquipmentID;
            Dictionary <string, int> shards = currentPlayer.Shards;
            int num = shards.ContainsKey(equipmentID) ? shards[equipmentID] : 0;

            return(num >= equipment.UpgradeShards);
        }
Esempio n. 30
0
        /// <summary>
        /// Applies damage to the defender
        /// </summary>
        private static void ApplyDamage(ref Unit attacker, int atkEqpSlot, ref Unit defender, EncounterData eData)
        {
            Equipment   attackerEquipment = attacker.weapons[atkEqpSlot];
            EquipmentVO equipmentVO       = attackerEquipment.vo;

            eData.AddLog(INDENT + attacker.vo.uid + "(" + attacker.hp + "/" +
                         attacker.vo.hp + ")" + " uses " + equipmentVO.uid + " on " +
                         defender.vo.uid + " (" + defender.hp + "/" + defender.vo.hp + ")");

            // calculate the damage
            int damage = attacker.GetDamage(atkEqpSlot) - defender.GetDamageReduction();

            // Prevent damage from rolling negative and healing the enemy
            if (damage < 0)
            {
                damage = 0;
            }

            int    numShots  = equipmentVO.numShotsPerAttack;
            double hitChance = attacker.GetHitChance(atkEqpSlot);

            // do the num shots
            for (int i = 0; i < numShots; i++)
            {
                // expend some ammo
                int ammoUsed = 1;
                attackerEquipment.remainingAmmo -= ammoUsed;
                if (attackerEquipment.remainingAmmo <= 0)
                {
                    eData.AddLog(INDENT + equipmentVO.uid + " OUT OF AMMO!!");
                    break;
                }

                if (!DoesShotHit(hitChance, 0))
                {
                    eData.AddLog(INDENT + "MISS: AMMO REMAINING: " +
                                 attacker.vo.uid + " " + attackerEquipment.remainingAmmo);
                    continue;
                }

                // apply the damage
                defender.hp -= damage;

                eData.AddLog(INDENT + "DAMAGE: " + defender.vo.uid +
                             " -" + damage + " (" + defender.hp + "/" + defender.vo.hp + " HP)" +
                             " AMMO REMAINING: " + attacker.vo.uid + "(" + attackerEquipment.remainingAmmo +
                             "/" + attackerEquipment.vo.ammoCapacity + ")");

                // prevent it from going negative.
                if (defender.hp <= 0)
                {
                    defender.hp = 0;

                    eData.AddLog(INDENT + defender.vo.uid + " DESTROYED!!");
                    break;
                }
            }
        }
Esempio n. 31
0
    //public void UpdateView(IGoodsVO vo)
    //{

    //}

    #region updateiamge

    public void updateEquipImage(EquipmentVO vo)
    {
        Chip.SetActive(false);
        Full.SetActive(true);

        //TODO:后续统一从资源管理器脚本类加载预设
        //品质外框
        string frame = FullQualityPath(vo.Quality);
        string qualitypath = "ChangeIcon/ImageIcon/qualityframe/" + frame;
        FullFrame.overrideSprite = Resources.Load(qualitypath, typeof(Sprite)) as Sprite;

        //装备图标
        string cardpath = "ChangeIcon/ImageIcon/equip/" + vo.ID;
        fullCardIcon.overrideSprite = Resources.Load(cardpath, typeof(Sprite)) as Sprite;
    }
Esempio n. 32
0
    private void Convert()
    {
        GoodsItemVO mVO = currSelectedVO;
        //todo:暂时写法,后续会对数据读取解析进行不断优化
        switch (mVO.goodsType)
        {
            case GoodsType.Equipment:
                var evo = new EquipmentVO();
                evo.id = mVO.id;
                evo.own = mVO.own;
                evo.price = mVO.totalcost;
                evo.quality = mVO.quality;
                evo.name = mVO.name;
                evo.detail = mVO.description;
                evo.extradetail = mVO.extraDescription;
                goodsCard.updateEquipImage(evo);
                break;

            case GoodsType.Medicine:
                var mvo = new MedicineVO();
                mvo.id = mVO.id;
                mvo.own = mVO.own;
                mvo.price = mVO.totalcost;
                mvo.quality = mVO.quality;
                mvo.name = mVO.name;
                mvo.detail = mVO.description;
                mvo.extradetail = mVO.extraDescription;
                goodsCard.updateMedicineImage(mvo);
                break;

            case GoodsType.Scroll:
                var svo = new ScrollVO();
                svo.id = mVO.id;
                svo.own = mVO.own;
                svo.price = mVO.totalcost;
                svo.quality = mVO.quality;
                svo.name = mVO.name;
                svo.detail = mVO.description;
                svo.extradetail = mVO.extraDescription;
                goodsCard.updateScrollImage(svo);
                break;

            case GoodsType.SoulStone:
                var ssvo = new SoulStoneVO();
                ssvo.id = mVO.id;
                ssvo.own = mVO.own;
                ssvo.price = mVO.totalcost;
                ssvo.quality = mVO.quality;
                ssvo.name = mVO.name;
                ssvo.detail = mVO.description;
                ssvo.extradetail = mVO.extraDescription;
                goodsCard.updateSoulStoneImage(ssvo);
                break;

            case GoodsType.Chip:
                var cvo = new ChipVO();
                cvo.type = mVO.chiptype;
                cvo.id = mVO.id;
                cvo.own = mVO.own;
                cvo.price = mVO.totalcost;
                cvo.quality = mVO.quality;
                cvo.name = mVO.name;
                cvo.detail = mVO.description;
                cvo.extradetail = mVO.extraDescription;
                goodsCard.updateChipImage(cvo);
                break;
        }
    }