예제 #1
0
        public void Save(string path, InfoCard card)
        {
            var id = FileUtils.GetSaveFileName(path, Extension);

            card.CardId = id;
            Save(path, id.ToString(), card);
        }
예제 #2
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.IsFullScreen          = true;
            graphics.SupportedOrientations = DisplayOrientation.LandscapeRight;
            Content.RootDirectory          = "Content";

            Statistics.maxMushrooms = 0;
            Statistics.maxBloobs    = 0;
            Statistics.maxSpecials  = 0;
            Statistics.maxCombo     = 0;
            Statistics.maxJumps     = 0;
            Statistics.maxPoints    = 0;


            infoCard      = new InfoCard();
            statisticCard = new StatisticsCard();
            devInfoCard   = new DevelopInfoCard();
            helpCard      = new HelpCard();
            // var wbt = new WebBrowserTask();
            // wbt.URL = "http://stackoverflow.com/";
            // wbt.Show();
            // Facebook.HttpMethod
            // Facebook.FacebookClient face = new Facebook.FacebookClient();
            // face.
        }
예제 #3
0
 public void Save(string path, string fileName, InfoCard card)
 {
     while (true)
     {
         try
         {
             using (var file = new StreamWriter(path + fileName + Extension, false, Encoding.UTF8))
             {
                 file.Write(JsonSerializer.Serialize(card));
             }
             break;
         }
         catch (IOException e)
         {
             //File not available
             if (e.HResult == -2147024864)
             {
                 Thread.Sleep(5);
             }
             else
             {
                 throw e;
             }
         }
     }
 }
        public JsonResult GetInfoCard(int id)
        {
            InfoCard infoCard = infoCardRepository.GetById(id);

            if (infoCard != null)
            {
                InfoCardDTO response = new InfoCardDTO
                {
                    Id          = infoCard.ID,
                    Adress      = infoCard.Adress,
                    BirthDay    = infoCard.BirthDay.HasValue ? infoCard.BirthDay.Value : DateTime.MinValue,
                    CompanyId   = infoCard.CompanyId,
                    Email       = infoCard.Email,
                    GetJobDate  = infoCard.GetJobDate.HasValue ? infoCard.GetJobDate.Value : DateTime.MinValue,
                    Name        = infoCard.Name,
                    Patronymic  = infoCard.Patronymic,
                    Phone       = infoCard.Phone,
                    Post        = infoCard.Post,
                    Surname     = infoCard.Surname,
                    UserId      = infoCard.UserId,
                    CompanyName = companyRepository.GetById(infoCard.CompanyId).CompanyName,
                    DivisionId  = infoCard.DivisionId.HasValue ? infoCard.DivisionId.Value : 0,
                    AvatarUrl   = infoCard.AvatarUrl
                };

                return(Json(ResponseProcessing.Success(response)));
            }
            else
            {
                return(Json(ResponseProcessing.Error("Невозможно извлечь данные о сотруднике. Обновите страницу и повторите попытку.")));
            }
        }
        public ActionResult Index()
        {
            User currentUser = brioContext.CurrentUser;

            if (currentUser.RoleId != (int)Brio.Models.Roles.Admin)
            {
                return(RedirectToAction("Index", "Project"));
            }

            InfoCard        currentUserInfoCard = infoCardRepository.GetUserInfoCard(brioContext.CurrentUser.ID);
            List <Division> divisions           = divisionRepository.GetCompanyDivisions(currentUserInfoCard.CompanyId).ToList();

            SelectList divisions_sel = new SelectList(divisions, "ID", "Name");

            ViewBag.Divisions = divisions_sel;

            ViewBag.Roles = roleRepository.GetAll().ToList();


            ViewBag.Admins         = infoCardRepository.GetInfoCardsByRole(Roles.Admin, brioContext.CurrentUser.CompanyId);
            ViewBag.Clients        = infoCardRepository.GetInfoCardsByRole(Roles.Client, brioContext.CurrentUser.CompanyId);
            ViewBag.Employees      = infoCardRepository.GetInfoCardsByRole(Roles.Employee, brioContext.CurrentUser.CompanyId);
            ViewBag.ProjectManager = infoCardRepository.GetInfoCardsByRole(Roles.ProjectManager, brioContext.CurrentUser.CompanyId);

            ViewBag.IsSuccess     = TempData["IsSuccess"];
            ViewBag.Message       = TempData["Message"];
            ViewBag.UpdateAccount = TempData["UpdateAccount"] != null ? TempData["UpdateAccount"] : new EditPortalAccount();

            if (TempData["Account"] != null)
            {
                return(View(TempData["Account"] as CreatePortalAccount));
            }
            return(View());
        }
예제 #6
0
 public void Insert(InfoCard model)
 {
     if (model == null)
     {
         throw new ArgumentNullException("InfoCard");
     }
     infoCardRepository.Insert(model);
 }
예제 #7
0
 public void Delete(InfoCard model)
 {
     if (model == null)
     {
         throw new ArgumentNullException("InfoCard");
     }
     infoCardRepository.Delete(model);
 }
        public ActionResult EditAccount(EditPortalAccount model, HttpPostedFileBase AvatarUrl)
        {
            if (model != null)
            {
                InfoCard infoCard = infoCardRepository.GetByEmail(model.Email);

                if (infoCard != null)
                {
                    infoCard.Email      = model.Email;
                    infoCard.Post       = model.Post;
                    infoCard.Name       = model.Name;
                    infoCard.Surname    = model.Surname;
                    infoCard.Patronymic = model.Patronymic;
                    infoCard.Phone      = model.Phone;
                    infoCard.DivisionId = model.DivisionId;

                    if (AvatarUrl != null && AvatarUrl.ContentLength > 0)
                    {
                        var fileName = Path.GetFileName(AvatarUrl.FileName);

                        var savingPath = Path.Combine(HttpContext.Server.MapPath(avatarDirectory), fileName);
                        AvatarUrl.SaveAs(savingPath);
                        infoCard.AvatarUrl = VirtualPathUtility.ToAbsolute(Path.Combine(avatarDirectory, fileName));
                    }


                    try
                    {
                        infoCardRepository.Update(infoCard);
                        infoCardRepository.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        TempData["IsSuccess"]     = false;
                        TempData["Message"]       = "Сохранение аккаунта закончилось неудачей. Попробуйте повторить попытку.";
                        TempData["UpdateAccount"] = model;
                        return(RedirectToAction("Index"));
                    }

                    TempData["IsSuccess"] = true;
                    TempData["Message"]   = "Успех.";
                }
                else
                {
                    TempData["IsSuccess"]     = false;
                    TempData["Message"]       = "Сохранение аккаунта закончилось неудачей. Попробуйте повторить попытку.";
                    TempData["UpdateAccount"] = model;
                }
            }
            else
            {
                TempData["IsSuccess"]     = false;
                TempData["Message"]       = "Сохранение аккаунта закончилось неудачей. Попробуйте повторить попытку.";
                TempData["UpdateAccount"] = model;
            }

            return(RedirectToAction("Index"));
        }
예제 #9
0
 public TurnEnd(BattleManager _bm, Stats _plStats, EnemyBattleData _npcData, PlayerHand _plrHnd, NPCHand _npcHnd, bool _isWon)
     : base(_bm, _plStats, _npcData, _plrHnd, _npcHnd)
 {
     name           = Phases.EndTurn;
     isChallengeWon = _isWon;
     table          = battleManager.table;
     pot            = battleManager.pot;
     infoCard       = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.TurnEnd);
 }
예제 #10
0
    public CardPlay(BattleManager _bm, Stats _plStats, EnemyBattleData _npcData, PlayerHand _plrHnd, NPCHand _npcHnd)
        : base(_bm, _plStats, _npcData, _plrHnd, _npcHnd)
    {
        name = Phases.CardPick;

        playerHand.humanCardPlayed += OnHumanCardPlayed;
        npcHand.onCardPlayed       += OnCardPlayed;
        infoCard = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.CardPick);
    }
예제 #11
0
    public CardDeal(BattleManager _bm, Stats _plStats, EnemyBattleData _npcData, PlayerHand _plrHnd, NPCHand _npcHnd)
        : base(_bm, _plStats, _npcData, _plrHnd, _npcHnd)
    {
        name = Phases.CardDeal;

        player = battleManager.playerTurn;

        battleManager.onDealEnded += OnCardDealEnded;
        infoCard = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.CardDeal);
    }
예제 #12
0
    // if NPC player passes on challenging human player
    void PassChallengingHuman()
    {
        isCurrentPlayerChallenged = false;
        //isChallengeComplete = true;
        infoCard = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.NoChallenge);
        InfoCard card = Object.Instantiate(infoCard, battleManager.transform);

        card.descriptionText.text = $"{npcData.enemyName} will not challenge".ToUpper();
        card.onCardDestroyed     += MoveToNextPhase;
        battleManager.nPCDisplay.SetReaction(npcData.passQuotes[Random.Range(0, npcData.passQuotes.Length)], npcData.enemyIdle);
    }
예제 #13
0
    // if NPC player decides to challenge human player
    void ChallengeHuman()
    {
        isCurrentPlayerChallenged = true;
        //isChallengeComplete = true;
        infoCard = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.OpponentChallenge);
        InfoCard card = Object.Instantiate(infoCard, battleManager.transform);

        card.descriptionText.text = $"{npcData.enemyName} challenges your guess".ToUpper();
        card.onCardDestroyed     += MoveToNextPhase;
        battleManager.nPCDisplay.SetReaction(npcData.challengeQuotes[Random.Range(0, npcData.challengeQuotes.Length)], npcData.enemyAngry);
    }
예제 #14
0
 void DisplayCardDetails(InfoCard card)
 {
     if (battleManager.playerTurn == CurrentPlayer.Human)
     {
         card.descriptionText.text = ("player will be dealt").ToUpper();
     }
     else
     {
         card.descriptionText.text = ($"{npcData.enemyName} will be dealt").ToUpper();
     }
 }
예제 #15
0
    void DisplayInfoCard(ChallengeCases challenge)
    {
        //InfoCard card = new InfoCard();

        switch (challenge)
        {
        case ChallengeCases.RightGuess:
            infoCard = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.PlayerGuessRight);
            InfoCard card = Object.Instantiate(infoCard, battleManager.transform);
            if (battleManager.playerTurn == CurrentPlayer.Human)
            {
                card.descriptionText.text = ($"good guess! correct sum is" +
                                             $"\n<color=#0f0f><size=66>{trueSum}</size></color>").ToUpper();
            }
            else
            {
                card.descriptionText.text = ($"{npcData.enemyName} guessed right." +
                                             "\ncorrect sum is" +
                                             $"\n<color=#0f0f><size=66>{trueSum}</size></color>").ToUpper();
            }
            card.onCardDestroyed += MoveToNextPhase;
            break;

        case ChallengeCases.NoChallenge:
            infoCard = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.PlayerGuessWrong);
            card     = Object.Instantiate(infoCard, battleManager.transform);
            card.descriptionText.text = trueSum.ToString();
            card.onCardDestroyed     += MoveToNextPhase;
            break;

        case ChallengeCases.BothWrong:
            infoCard = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.PlayerGuessWrong);
            card     = Object.Instantiate(infoCard, battleManager.transform);
            card.descriptionText.text = trueSum.ToString();
            card.onCardDestroyed     += MoveToNextPhase;
            break;

        case ChallengeCases.ChallengeCorrect:
            if (battleManager.playerTurn == CurrentPlayer.Human)
            {
                infoCard = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.PlayerChallengeWrong);
            }
            else
            {
                infoCard = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.PlayerChallengeRight);
            }
            card = Object.Instantiate(infoCard, battleManager.transform);
            card.descriptionText.text = trueSum.ToString();
            card.onCardDestroyed     += MoveToNextPhase;
            break;
        }
    }
예제 #16
0
    void DisplayInfoCard(int cardType)
    {
        InfoCard card = Object.Instantiate(infoCard, battleManager.transform);

        switch (cardType)
        {
        case 1:         // game over
            card.titleText.text       = "end of battle!".ToUpper();
            card.descriptionText.text = "";
            break;

        case 2:         // challenger won round
            card.titleText.text = "end of round!".ToUpper();

            if (battleManager.playerTurn == CurrentPlayer.NPC)
            {
                card.descriptionText.text = $"{npcData.enemyName} won by challenge".ToUpper();
            }
            else
            {
                card.descriptionText.text = "you won by challenge".ToUpper();
            }
            break;

        case 3:         // target crossed
            card.titleText.text       = "end of round!".ToUpper();
            card.descriptionText.text = "current number skipped the target".ToUpper();
            break;

        case 4:         // target reached
            card.titleText.text       = "end of round!".ToUpper();
            card.descriptionText.text = "target number reached".ToUpper();
            break;

        case 5:         // switch turn
            card.titleText.text = "end of turn!".ToUpper();
            if (battleManager.playerTurn == CurrentPlayer.NPC)
            {
                card.descriptionText.text = $"{npcData.enemyName} goes next".ToUpper();
            }
            else
            {
                card.descriptionText.text = "player goes next".ToUpper();
            }
            break;
        }

        card.onCardDestroyed += MoveToNextPhase;
    }
예제 #17
0
    public override void Enter()
    {
        Debug.Log("Entering New Round phase.");

        UpdateRoundCounter();
        GenerateTargetNumber();
        ResetCurrentNumber();
        //counter = Time.timeSinceLevelLoad;
        InfoCard card = Object.Instantiate(infoCard, battleManager.transform);

        card.onCardDestroyed += MoveToNextPhase;
        battleManager.nPCDisplay.SetReaction(npcData.startQuotes[Random.Range(0, npcData.startQuotes.Length)], npcData.enemyAngry);

        base.Enter();
    }
예제 #18
0
        public void XMLSerializationTest()
        {
            foreach (var file in Directory.GetFiles("test/"))
            {
                File.Delete(file);
            }

            var card = new InfoCard(-1, "’олодильник", new byte[] { 1, 2, 3, 4 });

            card.SaveToFile("test/", new XMLSaveLoader(), true);
            var loadedCard = InfoCard.LoadFromFile("test/", "0", new XMLSaveLoader());

            Assert.AreEqual(card.CardId, loadedCard.CardId);
            Assert.AreEqual(card.CardName, loadedCard.CardName);
            Assert.IsTrue(card.Image.SequenceEqual(loadedCard.Image));
        }
예제 #19
0
 public async Task <ActionResult <InfoCard> > Get(int id)
 {
     try
     {
         return(new JsonResult(await Task.Run(() => InfoCard.LoadFromFile(_configuration["ContentPath"], id.ToString(), _loaderFactory.GetNewLoader()))));
     }
     catch (FileNotFoundException)
     {
         return(NotFound());
     }
     catch (Exception e)
     {
         _logger.LogError(e.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
 }
예제 #20
0
    float exitTimer = 2f;   // how long to wait before exiting this phase

    public Start(BattleManager _battleManager, Stats _playerStats, EnemyBattleData _npcData, PlayerHand _plrHnd, NPCHand _npcHnd)
        : base(_battleManager, _playerStats, _npcData, _plrHnd, _npcHnd)
    {
        name = Phases.BattleStart;

        cardDealer = battleManager.dealer;
        //npcCard = battleManager.nPCCardDisplay;
        //npcNameDisplay = battleManager.nPCNameDisplay;
        nPCDisplay = battleManager.nPCDisplay;

        roundNumberDisplay   = battleManager.roundNumberDisplay;
        targetNumberDisplay  = battleManager.targetNumberDisplay;
        currentNumberDisplay = battleManager.currentNumberDisplay;

        infoCard = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.NewBattle);
    }
예제 #21
0
        public async Task <ActionResult> Put([FromBody] InfoCard value)
        {
            try
            {
                await Task.Run(() => value.SaveToFile(_configuration["ContentPath"], _loaderFactory.GetNewLoader(), true));

                return(StatusCode(StatusCodes.Status200OK));
            }
            catch (FileNotFoundException)
            {
                return(NotFound());
            }
            catch (Exception e)
            {
                _logger.LogError(e.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
예제 #22
0
        private async void IsDownloading()
        {
            if (_isDownloading)
            {
                return;
            }

            if (!UpdateHelper.IsDownloading)
            {
                return;
            }

            _isDownloading = true;

            CheckUpdatesButton.IsEnabled = false;

            var expand   = new ThicknessAnimation(new Thickness(10, 0, 10, 5), TimeSpan.FromMilliseconds(250));
            var collapse = new ThicknessAnimation(new Thickness(10, 0, 310, 5), TimeSpan.FromMilliseconds(250));
            var fadeOut  = new DoubleAnimation(1, 0, TimeSpan.FromMilliseconds(400));
            var fadeIn   = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(400));

            InstallUpdateInfo.BeginAnimation(OpacityProperty, fadeOut);
            DownloadUpdateInfo.BeginAnimation(OpacityProperty, fadeIn);

            await Task.Delay(350);

            InfoCard.BeginAnimation(MarginProperty, expand);

            while (UpdateHelper.IsDownloading)
            {
                await Task.Delay(1000);
            }

            InfoCard.BeginAnimation(MarginProperty, collapse);

            await Task.Delay(200);

            InstallUpdateInfo.BeginAnimation(OpacityProperty, fadeIn);
            DownloadUpdateInfo.BeginAnimation(OpacityProperty, fadeOut);

            _isDownloading = false;

            CheckUpdatesButton.IsEnabled = true;
        }
예제 #23
0
파일: Player.cs 프로젝트: sxcem/DescentGame
    public void SetHeroCard(Hero newHero)
    {
        _currentHero = newHero;
        GameObject go = Instantiate(playerInfoPrefab);

        _infoCard = go.GetComponent <InfoCard>();

        _infoCard.heroName.text = _currentHero.GetName();

        _infoCard.heroHealth.text  = "Health : " + _currentHero.GetHealth().ToString();
        _infoCard.heroSpeed.text   = "Speed : " + _currentHero.GetSpeed().ToString();
        _infoCard.heroStamina.text = "Stamina : " + _currentHero.GetStamina().ToString();
        _infoCard.heroDefense.text = "Defense : " + _currentHero.GetDefense().ToString();

        _infoCard.heroMight.text     = "Might : " + _currentHero.GetMight().ToString();
        _infoCard.heroWillpower.text = "Willpower : " + _currentHero.GetWillpower().ToString();
        _infoCard.heroKnowledge.text = "Knowledge : " + _currentHero.GetKnowledge().ToString();
        _infoCard.heroAwareness.text = "Awareness : " + _currentHero.GetAwareness().ToString();
    }
예제 #24
0
    public override void Enter()
    {
        Debug.Log("Entering Start phase");

        //*** set up player stats & display ***
        currentHpPlayer = startingHpPlayer;
        battleManager.playerCurrentHP            = currentHpPlayer;
        battleManager.playerHPDisplay.fillAmount = currentHpPlayer / startingHpPlayer;
        battleManager.playerHealthCards.RefillCards();
        // prevent player from playing cards until CardPick phase
        playerHand.BlockCardInteractions(true);

        //*** set up opponent stats & display ***
        npcHand.data = npcData;
        //npcCard.sprite = npcData.enemyDefault;
        nPCDisplay.SetDefaultSprite(npcData.enemyDefault);
        //npcNameDisplay.text = npcData.enemyName.ToUpper();
        nPCDisplay.SetName(npcData.enemyName.ToUpper());
        currentHpNPC = startingHpNPC;
        battleManager.npcCurrentHP            = currentHpNPC;
        battleManager.nPCHPDisplay.fillAmount = currentHpNPC / startingHpNPC;
        battleManager.npcHealthCards.RefillCards();
        nPCDisplay.SetReaction(npcData.startQuotes[Random.Range(0, npcData.startQuotes.Length)], npcData.enemyAngry);

        //*** set up deck ***
        cardDealer.FillDeck(npcData.difficulty);

        // deal both sides on game start
        DealBothPlayers();

        //*** initialise counters & parameters ***
        //battleManager.playerTurn = CurrentPlayer.Human;       //********** Uncomment when done with testing *************
        roundNumberDisplay.text   = "";
        targetNumberDisplay.text  = "";
        currentNumberDisplay.text = "";

        InfoCard card = Object.Instantiate(infoCard, battleManager.transform);

        card.onCardDestroyed += MoveToNextPhase;
        counter = Time.timeSinceLevelLoad;

        base.Enter();
    }
예제 #25
0
        public ActionResult DeleteAccount(int id)
        {
            if (id > 0)
            {
                InfoCard infoCard = infoCardRepository.GetById(id);
                if (infoCard != null)
                {
                    try
                    {
                        infoCardRepository.Delete(infoCard);
                        infoCardRepository.SaveChanges();

                        userRepository.Delete(userRepository.GetById(infoCard.UserId));
                        userRepository.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        TempData["IsSuccess"] = false;
                        TempData["Message"]   = "Произошла ошибка при сохранении изменений";
                        return(RedirectToAction("Index"));
                    }

                    TempData["IsSuccess"] = true;
                    TempData["Message"]   = "Пользователь успешно удален!";
                }
                else
                {
                    TempData["IsSuccess"] = false;
                    TempData["Message"]   = "Произошла ошибка, данного пользователя не уществует в базе или отправлен неверный идентификатор.";
                }
            }
            else
            {
                TempData["IsSuccess"] = false;
                TempData["Message"]   = "Произошла ошибка, неверный идентификатор пользовтеля";
            }

            return(RedirectToAction("Index"));
        }
예제 #26
0
    public override void Enter()
    {
        Debug.Log("Entering Card Deal phase. It's " + player + " player's turn to be dealt.");

        // deal cards based on who's turn it is
        switch (player)
        {
        case CurrentPlayer.Human:
            battleManager.StartCoroutine(battleManager.DealCards(playerHand));
            break;

        case CurrentPlayer.NPC:
            battleManager.StartCoroutine(battleManager.DealCards(npcHand));
            break;
        }

        //timeEnter = Time.timeSinceLevelLoad;
        InfoCard card = Object.Instantiate(infoCard, battleManager.transform);

        DisplayCardDetails(card);
        card.onCardDestroyed += AllowToProceed;
        base.Enter();
    }
예제 #27
0
    public override void Enter()
    {
        Debug.Log("Entering Card Play phase. It's " + battleManager.playerTurn + " player's turn to play.");
        InfoCard card = Object.Instantiate(infoCard, battleManager.transform);

        // if it's human player's trun allow interaction with cards. else let the npc play
        if (battleManager.playerTurn == CurrentPlayer.Human)
        {
            playerHand.BlockCardInteractions(false);
            card.descriptionText.text = "Player picks a card".ToUpper();
            card.onCardDestroyed     += AllowToProceed;
        }
        else
        {
            // inform npc the latest current number and it's their turn to play
            card.descriptionText.text = (npcData.enemyName + " picks a card").ToUpper();
            npcHand.UpdateCurrentNumber(battleManager.currentNumber);
            battleManager.nPCDisplay.SetReaction(npcData.cardPickQuotes[Random.Range(0, npcData.cardPickQuotes.Length)], npcData.enemyAngry);
            card.onCardDestroyed += NPCPlay;
        }

        //timeEnter = Time.timeSinceLevelLoad;
        base.Enter();
    }
    public static void ReadSet()
    {
        if (!File.Exists (path)) {
            Debug.Log ("need File!");
            return;
        }
        try {
            string _cardSet = File.ReadAllText(path);
            string[] cardSet = _cardSet.Split('\n');
            Dictionary<int, Ability> abilitySet = new Dictionary<int, Ability>();
            Dictionary<int, InfoCard> infoCardSet = new Dictionary<int, InfoCard>();
            Dictionary<int, BattleCard> battleCardSet = new Dictionary<int, BattleCard>();

            string[] tmpNum = cardSet[0].Split(' ');
            Int32.TryParse(tmpNum[0], out GlobalConfig.itemDataVersion);
            int abilityNum; int informationNum; int battleNum;
            Int32.TryParse(tmpNum[1], out abilityNum);
            Int32.TryParse(tmpNum[2], out informationNum);
            Int32.TryParse(tmpNum[3], out battleNum);
            int i = 1;
            for(; i < abilityNum + 1; i++) {
                string[] tmp = cardSet[i].Split('\t');
                Ability _ability = new Ability();
                int number;
                Int32.TryParse(tmp[0], out number);
                if(tmp[1].Equals("뱀파이어")) {
                    _ability.jobClass = PlayerJob.VAMPIRE;
                } else if(tmp[1].Equals("헌터")) {
                    _ability.jobClass = PlayerJob.HUNTER;
                }
                _ability.abilityName = tmp[2];
                float.TryParse(tmp[3], out _ability.effect);
                float.TryParse(tmp[4], out _ability.effectFactor);
                _ability.description = tmp[5];
                abilitySet.Add(number, _ability);
            }
            for(; i < informationNum + abilityNum + 1; i++) {
                string[] tmp = cardSet[i].Split('\t');
                InfoCard _info = new InfoCard();
                int number;
                Int32.TryParse(tmp[0], out number);
                _info.cardName = tmp[1];
                _info.grade = tmp[2];
                float.TryParse(tmp[3], out _info.pickRate);
                float.TryParse(tmp[4], out _info.cuccessRate);
                _info.description = tmp[5];
                infoCardSet.Add(number, _info);
            }
            for(; i < cardSet.Length; i++) {
                string[] tmp = cardSet[i].Split('\t');
                BattleCard _battle = new BattleCard();
                int number;
                Int32.TryParse(tmp[0], out number);
                _battle.cardName = tmp[1];
                _battle.grade = tmp[2];
                float.TryParse(tmp[3], out _battle.effect);
                float.TryParse(tmp[4], out _battle.effectFactor);
                float.TryParse(tmp[5], out _battle.pickRate);
                float.TryParse(tmp[6], out _battle.cuccessRate);
                _battle.description = tmp[7];
                battleCardSet.Add(number, _battle);
            }
            StructManager.itemSet = new Item();
            StructManager.itemSet.SetItem(abilitySet, infoCardSet, battleCardSet);

        } catch(IOException e) {
            Debug.Log (e.StackTrace);
        } catch(Exception e) {
            Debug.Log (e.Message);
            Debug.Log (e.StackTrace);
        }
    }
예제 #29
0
 public NewRound(BattleManager _bm, Stats _plStats, EnemyBattleData _npcData, PlayerHand _plrHnd, NPCHand _npcHnd)
     : base(_bm, _plStats, _npcData, _plrHnd, _npcHnd)
 {
     name     = Phases.NewRound;
     infoCard = System.Array.Find(battleManager.infoCardsPrefabs, c => c.cardType == InfoType.NewRound);
 }
        public ActionResult SignUp(CreatePortalAccount model, HttpPostedFileBase AvatarUrl)
        {
            if (ModelState.IsValid)
            {
                Regex rgx = new Regex("^[a-z0-9_\\+-]+(\\.[a-z0-9_\\+-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2,4})$");
                if (!rgx.IsMatch(model.Email))
                {
                    TempData["IsSuccess"] = false;
                    TempData["Message"]   = "Введен некорректный e-mail.";
                    TempData["Account"]   = model;
                    return(RedirectToAction("Index", "Home"));
                }

                var anyUser = _userRepository.GetAll().Any(p => p.Email.Equals(model.Email)) && _infoCardRepository.GetAll().Any(p => p.Email.Equals(model.Email));
                if (anyUser)
                {
                    TempData["IsSuccess"] = false;
                    TempData["Message"]   = "Аккаунт с этим e-mail уже существует. Аккаунт не был создан.";
                    TempData["Account"]   = model;
                    return(RedirectToAction("Index", "Home"));
                }

                if (!model.Password.Equals(model.ConfirmPassword))
                {
                    TempData["IsSuccess"] = false;
                    TempData["Message"]   = "Пароли не совпадают.";
                    TempData["Account"]   = model;
                    return(RedirectToAction("Index", "Home"));
                }

                int userId = _userRepository.Insert(new User {
                    Email    = model.Email,
                    Password = model.Password,
                    RoleId   = model.RoleId
                });

                InfoCard infoCard = new InfoCard
                {
                    CompanyId  = _brioContext.CurrentUser.CompanyId,
                    Email      = model.Email,
                    Name       = model.Name,
                    Surname    = model.Surname,
                    Patronymic = model.Patronymic,
                    Phone      = model.Phone,
                    UserId     = userId,
                    DivisionId = model.DivisionId,
                };

                if (AvatarUrl != null && AvatarUrl.ContentLength > 0)
                {
                    var fileName = Path.GetFileName(AvatarUrl.FileName);

                    var savingPath = Path.Combine(HttpContext.Server.MapPath(AppSettings.AVATAR_SAVING_PATH), fileName);
                    AvatarUrl.SaveAs(savingPath);
                    infoCard.AvatarUrl = VirtualPathUtility.ToAbsolute(Path.Combine(AppSettings.AVATAR_SAVING_PATH, fileName));
                }
                else
                {
                    infoCard.AvatarUrl = VirtualPathUtility.ToAbsolute(AppSettings.DEFAULT_USER_AVATAR);
                }

                _infoCardRepository.Insert(infoCard);

                _userRepository.SaveChanges();
            }
            else
            {
                TempData["IsSuccess"] = false;
                TempData["Message"]   = "Не заполнены все поля. Пожалуйста повторите попытку заполнив все поля.";
                TempData["Account"]   = model;
                return(RedirectToAction("Index", "Home"));
            }

            TempData["IsSuccess"] = true;
            TempData["Message"]   = "Аккаунт успешно создан!";
            return(RedirectToAction("Index", "Home"));

            if (model.RoleId == (int)Roles.Admin)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(RedirectToAction("Index", "Project"));
            }
        }