Exemple #1
0
    public static int GetMonsterCoin(int level)
    {
        int coin      = UnityEngine.Random.Range(30, 50) + (int)(50 * level * 0.2f);
        int bonusCoin = (int)(coin * LabSystem.GetAddMoney(User.addMoneyLevel) * 0.01f);

        return(coin + bonusCoin);
    }
Exemple #2
0
    public static int GetHeroExp(int level)
    {
        int exp      = 10 + (int)(10 * level * 0.5f);
        int bonusExp = (int)(exp * LabSystem.GetAddExp(User.addExpLevel) * 0.01f);

        return(exp + bonusExp);
    }
Exemple #3
0
        public async Task <bool> Update(SystemCategories.Category category)
        {
            ILabSystemService service = new LabSystemService(new LabSystemsContextFactory());

            string hostName = GetHostName();

            LabSystem existingEntity = await service.Get(hostName);

            LabSystem entity = new LabSystem()
            {
                Ipaddress = GetIPAddress(),
                HostName  = hostName,
                Osversion = GetOSVersion(),
                Timestamp = GetTimestamp(),
                Category  = category,
            };

            if (existingEntity != null)
            {
                entity.Id = existingEntity.Id;

                if (category == SystemCategories.Category.Unknown)
                {
                    entity.Category = existingEntity.Category;
                }
            }

            entity.DiskDrives?.Clear();
            entity.DiskDrives = await(new UpdateDiskDriveInfo()).Update();

            Task <LabSystem> task = service.CreateOrUpdate(hostName, entity);

            task.Wait();
            return(task.IsCompleted);
        }
Exemple #4
0
 void OnClickLabLevelUp(int type, int needMoney)
 {
     if (Common.PaymentCheck(ref User.coin, needMoney))
     {
         LabSystem.SetLapLevelUp(type);
         RefreshUI();
     }
     else
     {
         //
     }
 }
Exemple #5
0
    void RefreshUI()
    {
        for (int i = 0; i < ScrollContentView.transform.childCount; i++)
        {
            labLevelText    = ScrollContentView.transform.GetChild(i).GetChild(0).GetChild(0).GetComponent <Text>();
            labPowerText    = ScrollContentView.transform.GetChild(i).GetChild(1).GetChild(1).GetComponentInChildren <Text>();
            labLevelButton  = ScrollContentView.transform.GetChild(i).GetComponentInChildren <Button>();
            labNeedCoinText = labLevelButton.GetComponentInChildren <Text>();

            int labTypeLevel = LabSystem.GetLapLevel(i);
            labLevelText.text = string.Format("LEVEL {0}", labTypeLevel);
            if (i == 2 || i == 3)// 뒤에 %가 붙는경우
            {
                labPowerText.text = string.Format("{0}% > <color='yellow'>{1}%</color>", LabSystem.GetLapPower(i, labTypeLevel), LabSystem.GetLapPower(i, labTypeLevel + 1));
            }
            else
            {
                labPowerText.text = string.Format("{0} > <color='yellow'>{1}</color>", LabSystem.GetLapPower(i, labTypeLevel), LabSystem.GetLapPower(i, labTypeLevel + 1));
            }

            int levelupNeedCoin = LabSystem.GetNeedMoney(labTypeLevel);
            if (labTypeLevel >= 40)
            {
                labNeedCoinText.text = "MAX";
            }
            else
            {
                labNeedCoinText.text = Common.GetThousandCommaText(levelupNeedCoin);
            }
            int slotIndex = i;
            labLevelButton.onClick.RemoveAllListeners();
            labLevelButton.onClick.AddListener(delegate
            {
                OnClickLabLevelUp(slotIndex, levelupNeedCoin);
            });
            if (Common.PaymentAbleCheck(ref User.coin, levelupNeedCoin) && labTypeLevel < 40)
            {
                labLevelButton.interactable = true;
            }
            else
            {
                labLevelButton.interactable = false;
            }
        }
    }
        public static EntityEntry <LabSystem> CreateOrUpdate(this DbSet <LabSystem> dbSet, LabSystem entity, DbContext context, Expression <Func <LabSystem, bool> > predicate = null)
        {
            bool exists = predicate != null?dbSet.Any(predicate) : dbSet.Any();

            if (!exists)
            {
                return(dbSet.Add(entity));
            }

            // Get a little weird...
            LabSystem existing = dbSet.First <LabSystem>(predicate);

            entity.Id = existing.Id;
            context.Entry(existing).CurrentValues.SetValues(entity);

            CreateOrUpdateCollection(existing.DiskDrives, entity.DiskDrives, context);

            return(dbSet.Update(existing));
        }
Exemple #7
0
        /// <summary>
        /// Cria o novo ambiente de Lab
        /// </summary>
        /// <param name="labService"></param>
        /// <param name="runAsInteractive"></param>
        /// <param name="environmentName"></param>
        /// <param name="testController"></param>
        /// <param name="tfsProjectName"></param>
        /// <param name="envMachineName"></param>
        /// <param name="envMachineRoles"></param>
        /// <param name="credentials"></param>
        private void CreateNewLabEnvironment(LabService labService, bool runAsInteractive, string environmentName, string testController, string tfsProjectName,
                                             string envMachineName, string envMachineRoles, System.Net.NetworkCredential credentials)
        {
            Console.WriteLine("Criando o novo ambiente lab '" + environmentName + "'.");

            #region Parametrização e Criação do ambiente de Lab

            LabSystemDefinition      labSystemDefinition      = new LabSystemDefinition(envMachineName, envMachineName, envMachineRoles);
            LabEnvironmentDefinition labEnvironmentDefinition = new LabEnvironmentDefinition(environmentName, environmentName, new List <LabSystemDefinition>()
            {
                labSystemDefinition
            });

            if (runAsInteractive)
            {
                labEnvironmentDefinition.CodedUIRole     = envMachineRoles;
                labEnvironmentDefinition.CodedUIUserName = String.Format("{0}\\{1}", credentials.Domain, credentials.UserName);
            }

            labEnvironmentDefinition.TestControllerName = testController;

            LabEnvironment newEnvironment = labService.CreateLabEnvironment(tfsProjectName, labEnvironmentDefinition, null, null);

            AccountInformation admin   = new AccountInformation(credentials.Domain, credentials.UserName, credentials.SecurePassword);
            AccountInformation process = null;

            if (runAsInteractive)
            {
                process = new AccountInformation(credentials.Domain, credentials.UserName, credentials.SecurePassword);
            }
            #endregion

            #region Instalação do test agent
            // Primeira Máquina virtual. para efeito de Demo usando apenas uma máquina.
            // deve-se alterar para procesar várias máquinas
            LabSystem themachine = newEnvironment.LabSystems[0];

            //Instala o agente
            themachine.InstallTestAgent(admin, process);
            #endregion

            #region Aguarda o ambiente ficar em estado PRONTO
            while (newEnvironment.StatusInfo.State != LabEnvironmentState.Ready && newEnvironment.StatusInfo.FailureReason == null)
            {
                Console.WriteLine(String.Format("Status da criação: {0}", newEnvironment.StatusInfo.State));

                foreach (var sm in themachine.StatusMessages)
                {
                    Console.WriteLine(sm.Message);
                }

                System.Threading.Thread.Sleep(9000);

                newEnvironment = labService.QueryLabEnvironments(new LabEnvironmentQuerySpec()
                {
                    Project = tfsProjectName
                }).First(f => f.Name == environmentName);
                themachine = newEnvironment.LabSystems[0];
            }
            #endregion
        }
Exemple #8
0
    public void RefreshHeroStatusEquipmentPanel()
    {
        //Status 정보
        if (heroStatusInfoPanel != null)
        {
            heroStatusInfoPanel.transform.GetChild(0).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusAttack(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(0) + ItemSystem.GetHeroEquipmentItemAttack(ref targetHeroData) + LabSystem.GetAddAttack(User.addAttackLevel));
            heroStatusInfoPanel.transform.GetChild(1).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusDefence(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(1) + ItemSystem.GetHeroEquipmentItemDefence(ref targetHeroData) + LabSystem.GetAddDefence(User.addDefenceLevel));
            heroStatusInfoPanel.transform.GetChild(2).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusMaxHp(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(2) + ItemSystem.GetHeroEquipmentItemHp(ref targetHeroData));
            heroStatusInfoPanel.transform.GetChild(3).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusCriticalPercent(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>%", AbilitySystem.GetAbilityStats(3) + ItemSystem.GetHeroEquipmentItemCritical(ref targetHeroData));
            heroStatusInfoPanel.transform.GetChild(4).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusAttackSpeed(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(4) + ItemSystem.GetHeroEquipmentItemAttackSpeed(ref targetHeroData));
            heroStatusInfoPanel.transform.GetChild(5).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusMoveSpeed(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(5) + ItemSystem.GetHeroEquipmentItemMoveSpeed(ref targetHeroData));
            heroStatusInfoPanel.transform.GetChild(6).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusKnockbackResist(ref targetHeroData).ToString("N1");
            heroStatusInfoPanel.transform.GetChild(7).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusSkillEnergy(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(6) + ItemSystem.GetHeroEquipmentItemSkillEnergy(ref targetHeroData));
        }

        if (heroStatPanel != null)
        {
            for (int i = 0; i < heroStatPanel.transform.childCount; i++)
            {
                if (heroStatPanel.transform.GetComponentInChildren <Button>() != null)
                {
                    heroStatPanel.transform.GetComponentInChildren <Button>().gameObject.SetActive(false);
                }
            }
            heroStatPanel.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = targetHeroData.strength.ToString();
            heroStatPanel.transform.GetChild(1).GetChild(0).GetComponent <Text>().text = targetHeroData.intelligent.ToString();
            heroStatPanel.transform.GetChild(2).GetChild(0).GetComponent <Text>().text = targetHeroData.physical.ToString();
            heroStatPanel.transform.GetChild(3).GetChild(0).GetComponent <Text>().text = targetHeroData.agility.ToString();
        }

        // Equipment 장비 정보
        if (heroEquimentItemSlots != null && heroEquimentItemSlots.transform.childCount > 0)
        {
            int[] equipmentItemsId = HeroSystem.GetHeroEquipmentItems(targetHeroData.id);
            for (int i = 0; i < equipmentItemsId.Length; i++)
            {
                if (equipmentItemsId[i] != 0)
                {
                    heroEquimentItemSlots.transform.GetChild(i).GetChild(0).GetComponent <Image>().sprite             = ItemSystem.GetItemClassImage(equipmentItemsId[i], true);
                    heroEquimentItemSlots.transform.GetChild(i).GetChild(0).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemImage(equipmentItemsId[i], true);
                    heroEquimentItemSlots.transform.GetChild(i).GetChild(1).GetComponent <Image>().color = ItemColor.GetItemColor(ItemSystem.GetUserEquipmentItem(equipmentItemsId[i]).itemClass);
                }
                else
                {
                    heroEquimentItemSlots.transform.GetChild(i).GetChild(0).GetComponent <Image>().sprite             = ItemSystem.GetItemNoneImage();
                    heroEquimentItemSlots.transform.GetChild(i).GetChild(0).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemNoneImage();
                    heroEquimentItemSlots.transform.GetChild(i).GetChild(1).GetComponent <Image>().color = ItemColor.D;
                }
                int buttonIndex = i;
                heroEquimentItemSlots.transform.GetChild(buttonIndex).GetComponent <Button>().onClick.RemoveAllListeners();
                heroEquimentItemSlots.transform.GetChild(buttonIndex).GetComponent <Button>().onClick.AddListener(delegate
                {
                    OnEquipmentItemClick(buttonIndex, equipmentItemsId[buttonIndex]);
                });
            }
        }

        // 스킬정보
        Skill heroSkill = SkillSystem.GetSkill(targetHeroData.skill);

        if (heroSkillSlot != null && heroSkill != null)
        {
            skillImage        = heroSkillSlot.transform.GetChild(0).GetChild(0).GetComponent <Image>();
            skillImage.sprite = SkillSystem.GetSkillImage(heroSkill.id);
            heroSkillSlot.transform.GetComponentInChildren <Text>().text = string.Format("<size='27'>{0} : {1}</size>\r\n<color='grey'>{2}</color>", LocalizationManager.GetText("SkillLevel"), SkillSystem.GetUserSkillLevel(heroSkill.id), SkillSystem.GetUserSkillDescription(heroSkill, targetHeroData));
            // 스킬강화버튼
            skillLevelUpButton = heroSkillSlot.GetComponentInChildren <Button>();
            int needMoney = SkillSystem.GetUserSkillLevelUpNeedCoin(heroSkill.id);
            skillLevelUpButton.transform.GetChild(0).GetComponentInChildren <Text>().text = Common.GetThousandCommaText(needMoney);

            if (Common.PaymentAbleCheck(ref User.coin, needMoney))
            {
                skillLevelUpButton.interactable = true;
            }
            else
            {
                skillLevelUpButton.interactable = false;
            }
            skillLevelUpButton.onClick.RemoveAllListeners();
            skillLevelUpButton.onClick.AddListener(delegate
            {
                OnSkillLevelUpClick(heroSkill.id, needMoney);
            });

            if (SkillSystem.isHeroSkillUpgradeAble(heroSkill.id, targetHeroData))
            {
                skillLevelUpButton.interactable = true;
                skillLevelUpButton.transform.GetChild(2).gameObject.SetActive(false);
            }
            else
            {
                skillLevelUpButton.interactable = false;
                skillLevelUpButton.transform.GetChild(2).GetComponentInChildren <Text>().text = string.Format("! {0} : {1}", LocalizationManager.GetText("HeroLevel"), SkillSystem.GetUserSkillLevel(heroSkill.id) + 1);
                skillLevelUpButton.transform.GetChild(2).gameObject.SetActive(true);
            }
        }
    }
Exemple #9
0
 public static int GetHeroStatusDefence(ref HeroData data)
 {
     if (data.type == 0)
     {
         return((data.physical * 5) + (data.agility) + AbilitySystem.GetAbilityStats(1) + ItemSystem.GetHeroEquipmentItemDefence(ref data) + LabSystem.GetAddDefence(User.addDefenceLevel));
     }
     else
     {
         return((data.physical * 5) + (data.agility));
     }
 }
Exemple #10
0
 public static int GetHeroStatusAttack(ref HeroData data)
 {
     if (data.type == 0)
     {
         return((10) + (data.strength * 5) + (data.intelligent * 4) + (data.agility * 2) + AbilitySystem.GetAbilityStats(0) + ItemSystem.GetHeroEquipmentItemAttack(ref data) + LabSystem.GetAddAttack(User.addAttackLevel));
     }
     else
     {
         return((10) + (data.strength * 5) + (data.intelligent * 4) + (data.agility * 2));
     }
 }