Пример #1
0
    void Awake()
    {
        instance = this;

        List<Game> GamePrefabs = new List<Game>(Resources.LoadAll<Game>("Prefabs/Games/Puzzle"));
        GamePrefabs.RemoveAll(game => game.type != Game.GameType.Puzzle);
        GamePrefabs.Sort(delegate(Game a, Game b)
        {
            return a.order.CompareTo(b.order);
        });

        puzzles = new List<Puzzle>();
        foreach (Game game in GamePrefabs)
        {
            Puzzle puzzle = new Puzzle();
            puzzle.name = game.name;
            puzzle.stars = PlayerPrefs.GetInt(puzzle.name + "stars", 0);
            if (puzzles.Count == 0) //first level is always unlocked
                puzzle.unlocked = true;
            else
                puzzle.unlocked = PlayerPrefs.GetInt(puzzle.name + "unlocked", 0) != 0;

            puzzle.prefab = game;
            puzzles.Add(puzzle);
        }
    }
Пример #2
0
 public Character(int hp, int mana, int attackdamage, int abilitypower, Progression progress)
 {
     Hp = hp;
     Mana = mana;
     AttackDamage = attackdamage;
     Xp = 0;
     Level = 1;
     _progress = progress;
 }
Пример #3
0
        private void Fire()
        {
            if (!_isOnCooldown)
            {
                int numBullets = Progression.Instance().CurrentValue(
                    initialBulletCount,
                    finalBulletCount);

                for (int i = 0; i < numBullets; i++)
                {
                    InitializeBullet();
                }

                PlayFiringSound();

                StartCoroutine(Cooldown());
            }
        }
Пример #4
0
    private static Progression LoadFile()
    {
        Progression progression = new Progression();

        if (File.Exists(path))
        {
            string data = File.ReadAllText(path);
            if (data != "")
            {
                progression = JsonConvert.DeserializeObject <Progression>(data);
                return(progression);
            }
        }

        progression.LoadLevels();

        return(progression);
    }
Пример #5
0
        public void RemoveMorph(DAZMorph m)
        {
            for (int i = 0; i < morphs_.Count; ++i)
            {
                if (morphs_[i].Morph == m)
                {
                    var sm = morphs_[i];
                    morphs_.RemoveAt(i);

                    sm.Removed();
                    Progression.MorphRemoved(i);

                    break;
                }
            }

            FireNameChanged();
        }
Пример #6
0
    bool enemyIsDead = false; //Prevent multiple point additions!

    // Start is called before the first frame update
    void Start()
    {
        enemyAnimations       = this.GetComponent <Animator>();
        attackTime            = this.gameObject.GetComponentInChildren <EnemyAttack>().attackSpeed;
        attackSpeed           = attackTime;
        pauseCheck            = GameObject.Find("UIHandler").GetComponent <UIController>();
        progressionController = GameObject.Find("ProgressionHandler").GetComponent <Progression>();
        powerScaleCheck       = GameObject.Find("PowerHandler").GetComponent <PowerBehaviour>();
        i = GetComponent <Rigidbody>();
        startingScaleX = transform.localScale.x;
        startingScaleY = transform.localScale.y;
        startingScaleZ = transform.localScale.z;
        inflatedScaleX = startingScaleX * INFLATED_POWER_SCALE;
        inflatedScaleY = startingScaleY * INFLATED_POWER_SCALE;
        inflatedScaleZ = startingScaleZ * INFLATED_POWER_SCALE;
        animator       = GetComponent <Animator>();
        TutorialStatus = GameObject.FindWithTag("TutorialHandler").GetComponent <TutorialHandler>();
    }
Пример #7
0
        /*
         * Paint a cell using the progression data
         */
        private void ProgressCellPaint(object sender, DataGridViewCellPaintingEventArgs e)
        {
            if (e.ColumnIndex <= 0 || e.RowIndex < -1)
            {
                e.Handled = false;
                return;
            }

            if (ProgressionData != null)
            {
                if (e.RowIndex == -1)
                {
                    e.PaintBackground(e.CellBounds, false);
                    DrawScale(ProgressionData.StartTime, AgentApplication.Options.VisualiserZoomLevel, e.Graphics, e.CellBounds);
                }
                else
                {
                    string      Machine            = ( string )VisualiserGridView.Rows[e.RowIndex].Cells[0].Value;
                    Progression MachineProgression = null;
                    if (ProgressionData.MachineProgressions.TryGetValue(Machine, out MachineProgression))
                    {
                        BufferedGraphicsContext Current   = BufferedGraphicsManager.Current;
                        BufferedGraphics        Offscreen = Current.Allocate(e.Graphics, e.CellBounds);

                        // Fill the background dependent on whether the machine has finished or not
                        MachineProgression.DrawBackground(Offscreen.Graphics, e.CellBounds);

                        // Draw all the progress bars to the offscreen buffer
                        MachineProgression.Draw(ProgressionData.StartTime, AgentApplication.Options.VisualiserZoomLevel, Offscreen.Graphics, e.CellBounds);

                        // Copy the offscreen buffer to the screen
                        Offscreen.Render();
                        Offscreen.Dispose();
                    }
                }
            }
            else
            {
                // Just clear if there's no progression data
                e.PaintBackground(e.CellBounds, false);
            }

            e.Handled = true;
        }
Пример #8
0
        private void MouseMoveHandler(object sender, MouseEventArgs e)
        {
            Point GridClientPos = this.VisualiserGridView.PointToClient(MousePosition);

            DataGridView.HitTestInfo HitInfo = this.VisualiserGridView.HitTest(GridClientPos.X, GridClientPos.Y);
            bool bShowingToolTip             = false;

            if (HitInfo.Type == DataGridViewHitTestType.ColumnHeader && HitInfo.ColumnIndex == 1)
            {
                float Timestamp = GridClientPos.X - HitInfo.ColumnX;
                Timestamp /= AgentApplication.Options.VisualiserZoomLevel;
                Point  AgentClientPos = PointToClient(MousePosition);
                string ToolTipText    = String.Format("Time: {0:g4} seconds", Timestamp);
                BarToolTip.Show(ToolTipText, this, AgentClientPos.X, AgentClientPos.Y, 60000);
                bShowingToolTip = true;
            }
            else if (HitInfo.Type == DataGridViewHitTestType.Cell && HitInfo.ColumnIndex == 1)
            {
                DataGridViewCell cell               = this.VisualiserGridView.Rows[HitInfo.RowIndex].Cells[1];
                string           Machine            = ( string )VisualiserGridView.Rows[HitInfo.RowIndex].Cells[0].Value;
                Progression      MachineProgression = null;
                if (ProgressionData.MachineProgressions.TryGetValue(Machine, out MachineProgression))
                {
                    for (int BarIndex = 1; BarIndex < MachineProgression.ProgressionSamples.Count; BarIndex++)
                    {
                        ProgressionSample Sample = MachineProgression.ProgressionSamples[BarIndex];
                        if (Sample.Bounds.Contains(GridClientPos))
                        {
                            Point  AgentClientPos = PointToClient(MousePosition);
                            string BarName        = BarNames[Sample.State.ToString()];
                            string ToolTipText    = String.Format("{0} ({1:g4} seconds)", BarName, Sample.Duration);
                            BarToolTip.Show(ToolTipText, this, AgentClientPos.X, AgentClientPos.Y, 60000);
                            bShowingToolTip = true;
                            break;
                        }
                    }
                }
            }

            if (!bShowingToolTip)
            {
                BarToolTip.Hide(this);
            }
        }
Пример #9
0
 public bool DeepEquals(DestinyTalentGridDefinition other)
 {
     return(other != null &&
            ExclusiveSets.DeepEqualsReadOnlyCollections(other.ExclusiveSets) &&
            CalcMaxGridLevel == other.CalcMaxGridLevel &&
            CalcProgressToMaxLevel == other.CalcProgressToMaxLevel &&
            GridLevelPerColumn == other.GridLevelPerColumn &&
            Groups.DeepEqualsReadOnlyDictionaryWithSimpleKeyAndEquatableValue(other.Groups) &&
            IndependentNodeIndexes.DeepEqualsReadOnlySimpleCollection(other.IndependentNodeIndexes) &&
            MaxGridLevel == other.MaxGridLevel &&
            MaximumRandomMaterialRequirements == other.MaximumRandomMaterialRequirements &&
            NodeCategories.DeepEqualsReadOnlyCollections(other.NodeCategories) &&
            Nodes.DeepEqualsReadOnlyCollections(other.Nodes) &&
            Progression.DeepEquals(other.Progression) &&
            Blacklisted == other.Blacklisted &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
Пример #10
0
        public Evaluation ProgressEvaluation(string evaluationId, Progression newProgression)
        {
            Evaluation evaluation = _evaluationService.GetEvaluation(evaluationId);

            Role[] canBePerformedBy = { Role.Facilitator };
            AssertCanPerformMutation(evaluation, canBePerformedBy);

            _evaluationService.ProgressEvaluation(evaluation, newProgression);

            _participantService.ProgressAllParticipants(evaluation, newProgression);

            if (newProgression.Equals(Progression.FollowUp))
            {
                _evaluationService.SetWorkshopCompleteDate(evaluation);
                _answerService.CreateFollowUpAnswers(evaluation);
            }

            return(evaluation);
        }
Пример #11
0
        public async Task Update_Progression(User user, Subject subject, Concept concept, Concept newConcept)
        {
            var context = TestSetup.SetupContext();

            var progression = new Progression
            {
                UserId    = user.Id,
                User      = user,
                SubjectId = subject.Id,
                Subject   = subject,
                ConceptId = concept.Id,
                Concept   = concept
            };

            var expected = new Progression
            {
                UserId    = user.Id,
                User      = user,
                SubjectId = subject.Id,
                Subject   = subject,
                ConceptId = newConcept.Id,
                Concept   = newConcept
            };

            await context.Users.AddAsync(user);

            await context.Subjects.AddAsync(subject);

            await context.Concepts.AddRangeAsync(concept, newConcept);

            await context.Progressions.AddAsync(progression);

            await context.SaveChangesAsync();

            var service = new ProgressionService(context);
            var result  = await service.Update(user, subject, newConcept);

            var storedResult = context.Progressions.FirstOrDefault();

            result.Should().BeTrue();
            storedResult.Should().NotBeNull().And.BeEquivalentTo(expected, TestSetup.IgnoreTimestamps <Progression>());
        }
 public void Update(DestinyVendorComponent?other)
 {
     if (other is null)
     {
         return;
     }
     if (CanPurchase != other.CanPurchase)
     {
         CanPurchase = other.CanPurchase;
         OnPropertyChanged(nameof(CanPurchase));
     }
     if (!Progression.DeepEquals(other.Progression))
     {
         Progression.Update(other.Progression);
         OnPropertyChanged(nameof(Progression));
     }
     if (VendorLocationIndex != other.VendorLocationIndex)
     {
         VendorLocationIndex = other.VendorLocationIndex;
         OnPropertyChanged(nameof(VendorLocationIndex));
     }
     if (SeasonalRank != other.SeasonalRank)
     {
         SeasonalRank = other.SeasonalRank;
         OnPropertyChanged(nameof(SeasonalRank));
     }
     if (VendorHash != other.VendorHash)
     {
         VendorHash = other.VendorHash;
         OnPropertyChanged(nameof(VendorHash));
     }
     if (NextRefreshDate != other.NextRefreshDate)
     {
         NextRefreshDate = other.NextRefreshDate;
         OnPropertyChanged(nameof(NextRefreshDate));
     }
     if (Enabled != other.Enabled)
     {
         Enabled = other.Enabled;
         OnPropertyChanged(nameof(Enabled));
     }
 }
Пример #13
0
    IEnumerator StartSpawning(float delayBetweenWaves = 0.5f)
    {
        // Set next spawn time immediately, so that wave delays dont
        // cause a glitchy enormous spawn scenario
        SetNextSpawnTimestamp();

        int _curWaves = Progression.Instance().CurrentValue(
            initialWavesPerSpawn,
            finalWavesPerSpawn);

        for (int i = 0; i < _curWaves; i++)
        {
            CreateEnemies();

            if (_curWaves > 1)
            {
                yield return(new WaitForSeconds(delayBetweenWaves));
            }
        }
    }
Пример #14
0
        private static void Extract(Stream stream, DirectoryInfo outputDirectory, Progression progress)
        {
            // A GZipStream is not seekable, so copy it first to a MemoryStream
            using var gzip   = new GZipStream(stream, CompressionMode.Decompress);
            using var memStr = new MemoryStream();

            int read;
            var buffer = new byte[ChunkSize];

            do
            {
                read = gzip.Read(buffer, 0, ChunkSize);
                memStr.Write(buffer, 0, read);

                progress.CurrentStepProgress = (double)stream.Position / stream.Length * 0.5d;  // multiply by 0.5 because we also need to extract the tar archive afterwards
            } while (read == ChunkSize);

            memStr.Seek(0, SeekOrigin.Begin);
            ExtractTar(memStr, outputDirectory, progress);
        }
Пример #15
0
        public Answer SetAnswer(string questionId, Severity severity, string text, Progression progression)
        {
            IQueryable <Question> queryableQuestion = _questionService.GetQuestion(questionId);
            Question    question    = queryableQuestion.First();
            Evaluation  evaluation  = queryableQuestion.Select(q => q.Evaluation).First();
            Participant currentUser = CurrentUser(evaluation);
            Answer      answer;

            try
            {
                answer = _answerService.GetAnswer(question, currentUser, progression);
                _answerService.UpdateAnswer(answer, severity, text);
            }
            catch (NotFoundInDBException)
            {
                answer = _answerService.Create(currentUser, question, severity, text, progression);
            }

            return(answer);
        }
Пример #16
0
    void Awake()
    {
        if (singleton)
        {
            Destroy(gameObject);
            return;
        }

        singleton = this;

        Debug.Log("SM AWAKE");

        gameType      = new AnimatorIntWrapper <EGameType>(EGameType.Unselected, animator, "GameType", x => (int)x, x => (EGameType)x);
        _puzzlesCount = new AnimatorIntWrapper <List <Game> >(new List <Game>(), animator, "PuzzleCount", x => x.Count);

        DontDestroyOnLoad(gameObject);
        this.ConfigureAllStateBehaviours(animator);

        Progression.Init(animator);
    }
Пример #17
0
        private Hero GenerateHeroS(Race race, Gender gender, GenerateNamePreference generateNamePreference)
        {
            try
            {
                var physicalAttributes = new PhysicalAttributes(race);

                var progression   = new Progression();
                var vitals        = new Vitals();
                var traits        = new Traits();
                var generatedName = nameGenerator.GenerateName(gender, generateNamePreference);

                var hero = new Hero(generatedName, race, physicalAttributes, vitals, progression, traits);

                return(hero);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
Пример #18
0
    IEnumerator SpawnEnemy()
    {
        _canSpawn = false;

        GameObject spawnPoint = GetRandomSpawnPoint();
        GameObject spawner    = ObjectPoolManager.instance
                                .GetObjectPoolByTag(enemyPrefab.tag)
                                .GetOrCreate();

        spawner.transform.position = spawnPoint.transform.position;
        spawner.transform.rotation = spawnPoint.transform.rotation;
        spawner.GetComponent <IPoolable>().Activate();

        yield return(new WaitForSeconds(
                         Progression.Instance().CurrentValue(
                             initialEnemySpawnDelay,
                             finalEnemySpawnDelay)));

        _canSpawn = true;
    }
Пример #19
0
        public void ProgressAllParticipants()
        {
            ProjectService     projectService     = new ProjectService(_context);
            ParticipantService participantService = new ParticipantService(_context);
            EvaluationService  evaluationService  = new EvaluationService(_context);
            Project            project            = projectService.Create("ProgressAllParticipants");
            Evaluation         evaluation         = evaluationService.Create("ProgressAllParticipants", project);
            Participant        participant1       = participantService.Create("ProgressAllParticipants1", evaluation, Organization.All, Role.Facilitator);
            Participant        participant2       = participantService.Create("ProgressAllParticipants2", evaluation, Organization.Commissioning, Role.OrganizationLead);

            Progression progression1Before = participant1.Progression;

            participantService.ProgressAllParticipants(evaluation, Progression.Individual);
            Progression progression1After = participant1.Progression;
            Progression progression2After = participant2.Progression;

            Assert.Equal(Progression.Nomination, progression1Before);
            Assert.Equal(Progression.Individual, progression1After);
            Assert.Equal(Progression.Individual, progression2After);
        }
Пример #20
0
        private static void Extract(FileInfo source, DirectoryInfo destination, Progression progress)
        {
            if (Directory.Exists(destination.FullName))
            {
                destination.Delete(true);
            }

            destination.Create();

            var archive              = new System.IO.Compression.ZipArchive(File.OpenRead(source.FullName));
            var currentEntryNumber   = 0;
            var totalNumberOfEntries = archive.Entries.Count;

            foreach (var entry in archive.Entries)
            {
                progress.CurrentStepProgress = currentEntryNumber++ / (double)totalNumberOfEntries;

                if (entry == null)
                {
                    continue;
                }

                var entryDestination = Path.Combine(destination.FullName, entry.FullName);
                if (Path.GetFileName(entryDestination).Length < 1)
                {
                    // entry is directory
                    if (entry.Length != 0)
                    {
                        throw new Exception($"Unexpected error while extracting a {nameof(ZipArchive)}! ({nameof(entry)}.{nameof(entry.Length)} != 0)");
                    }

                    Directory.CreateDirectory(entryDestination);
                }
                else
                {
                    // entry is file
                    Directory.CreateDirectory(Path.GetDirectoryName(entryDestination) !);
                    entry.ExtractToFile(entryDestination, true);
                }
            }
        }
Пример #21
0
    public void GameOver()
    {
        game_over = true;

        StopAllCoroutines();

        Destroy(FindObjectOfType <TurnText>().gameObject);
        Highlight highlight = FindObjectOfType <Highlight>();

        if (highlight != null)
        {
            Destroy(highlight.gameObject);
        }
        Transform canvas = GameObject.Find("Canvas").transform;

        Destroy(canvas.Find("End Turn Fade").gameObject);
        Destroy(canvas.Find("Command Window").gameObject);

        GetComponent <AIController>().StopAllCoroutines();

        Utils.DehighlightTiles();
        Utils.DeactivatePlayers();

        bool win = FindObjectOfType <ScoreCounter>().DidPlayerWin();

        FindObjectOfType <MovingUI>().GameOver(win);
        Progression.GameResults(win);

        GetComponent <AudioSource>().Play();
        Camera.main.GetComponentInChildren <SongSelector>().PlayVictoryTheme();

        Progression.level++;
        if (Progression.level == 4)
        {
            Invoke("DisplayOverallResults", 3);
        }
        else
        {
            Invoke("ChangeScene", 5);
        }
    }
Пример #22
0
    private IEnumerator Progress(GameObject interactor, Interaction interaction)
    {
        character = interactor.GetComponent <Character>();

        // If we're holding an object, and there isn't already a job start a new job
        if (progression == null || resetProgress)
        {
            OnBegin(interactor, interaction);
            if (failed)
            {
                yield break;
            }
            progression = CreateJob();
        }

        // If the actor is a character, set them to busy
        if (character != null)
        {
            SetCharacterBusy(character);
        }

        OnStart(interactor, interaction);
        if (failed)
        {
            yield break;
        }

        while (progression.length == -1f || progression.elapsedTime < progression.length)
        {
            if (!completeAutomatically && character != null && character.movementState == Character.MovementState.MOVING)
            {
                OnStop(interactor, interaction);
                yield break;
            }
            progression.elapsedTime += Time.deltaTime;
            OnUpdate(interactor, interaction);
            yield return(0);
        }
        OnFinish(interactor, interaction);
        progression = null;
    }
Пример #23
0
    protected override void OnSignal(ESignalType signalType)
    {
        switch (signalType)
        {
        case ESignalType.PuzzleMode:
            HextwistStateMachine.GameType = HextwistStateMachine.EGameType.Puzzle;
            //SMTransition(signalType);
            SceneManager.LoadScene("Game");
            break;

        case ESignalType.PvPMode:
            HextwistStateMachine.GameType = HextwistStateMachine.EGameType.PvP;
            //SMTransition(signalType);
            SceneManager.LoadScene("Game");
            break;

        case ESignalType.ClearProgression:
            Progression.ClearProgression();
            break;
        }
    }
Пример #24
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        progression = Progression.LoadProgression();

        if (progression.ID != ID)
        {
            DeleteProgression();
            progression = Progression.CreateProgression(ID);
        }
    }
Пример #25
0
 public void MapValues()
 {
     foreach (var groupValue in Groups.Values)
     {
         groupValue.Lore.TryMapValue();
     }
     Progression.TryMapValue();
     foreach (var node in Nodes)
     {
         node.Lore.TryMapValue();
         if (node.RandomActivationRequirement != null)
         {
             foreach (var req in node.RandomActivationRequirement.MaterialRequirements)
             {
                 req.TryMapValue();
             }
         }
         foreach (var nodeStep in node.Steps)
         {
             nodeStep.DamageType.TryMapValue();
             foreach (var req in nodeStep.ActivationRequirement?.MaterialRequirements)
             {
                 req.TryMapValue();
             }
             foreach (var perk in nodeStep.Perks)
             {
                 perk.TryMapValue();
             }
             foreach (var stat in nodeStep.Stats)
             {
                 stat.TryMapValue();
             }
             foreach (var replacement in nodeStep.SocketReplacements)
             {
                 replacement.PlugItem.TryMapValue();
                 replacement.SocketType.TryMapValue();
             }
         }
     }
 }
Пример #26
0
    // Use this for initialization
    public Jazzy()
    {
        //generate scales
        scales = Scale.LoadFromFile(Resources.Load("Texts/scaledata") as TextAsset);
        //generate chords
        chords = Scale.LoadFromFile(Resources.Load("Texts/chorddata") as TextAsset);

        /*
         * string chordnames ="";
         * for (int i=0;i<chords.Count;i++)
         * {
         *      chordnames+=chords[i].name+",";
         * }
         * Debug.Log("chord names:"+chordnames);
         */

        //generate progressions
        progressions = Progression.LoadFromFile(Resources.Load("Texts/progressiondata") as TextAsset, chords);

        // audio stuff

        Object[] obs;
        obs       = Resources.LoadAll("melodic", typeof(AudioClip));
        allsounds = new List <AudioClip>();

        for (int i = 0; i < obs.Length; i++)
        {
            AudioClip ac = obs[i] as AudioClip;
            if (ac != null)
            {
                allsounds.Add(ac);
            }
        }

        //

        //Generate();
    }
Пример #27
0
        public Answer GetAnswer(Question question, Participant participant, Progression progression)
        {
            if (question == null)
            {
                throw new ArgumentNullException(nameof(question));
            }
            if (participant == null)
            {
                throw new ArgumentNullException(nameof(participant));
            }

            Answer Answer = _context.Answers.FirstOrDefault(Answer =>
                                                            Answer.Question.Equals(question) &&
                                                            Answer.AnsweredBy.Equals(participant) &&
                                                            Answer.Progression.Equals(progression)
                                                            );

            if (Answer == null)
            {
                throw new NotFoundInDBException($"Answer not found for question {question.Id} for participant {participant.Id} and progression {progression}");
            }
            return(Answer);
        }
Пример #28
0
 private void Collate()
 {
     foreach (var group in progressions.GroupBy(x => x.stride))
     {
         foreach (var a in group)
         {
             foreach (var b in group)
             {
                 if (a.Last() == b.First())
                 {
                     var collated = new Progression(group.Key);
                     collated.AddRange(a);
                     collated.AddRange(b.Skip(1));
                     collated.Sort();
                     collated.extended = a.extended || b.extended;
                     progressions.Add(collated);
                     progressions.Remove(a);
                     progressions.Remove(b);
                 }
             }
         }
     }
 }
Пример #29
0
            static bool Prefix(Progression __instance, ref int exp, ref string _cvarXPName)
            {
                if (__instance.Level >= Progression.MaxLevel)
                {
                    if (__instance.Level > Progression.MaxLevel)
                    {
                        __instance.Level = Progression.MaxLevel;
                    }

                    // Max level so dont even need to run the original method!
                    return(false);
                }

                var nextLevel  = __instance.Level + 1;
                var xpLeftToGo = __instance.ExpToNextLevel - exp;

                if (nextLevel % 10 == 0 && xpLeftToGo <= 0)
                {
                    __instance.SkillPoints += 4;
                }

                return(true);
            }
        private void CreateItemIndex(Progression progression, StringVersion gameVersion, string staticResourceRootDirectory)
        {
            progression.StartNextStep(LoLStaticResourceCacheResources.CreateItemIndexProgressStepDescription);
            Items.Clear();

            var itemCollectionFile     = Path.Combine(staticResourceRootDirectory, gameVersion.ToString(), "data", "en_US", "item.json");
            var itemCollectionFileText = File.ReadAllText(itemCollectionFile);

            var itemCollection   = JObject.Parse(itemCollectionFileText);
            var numberOfItems    = itemCollection["data"] !.Children().Count();
            var currentItemIndex = 0;

            foreach (var itemJson in itemCollection["data"] !.Children().Cast <JProperty>())
            {
                progression.CurrentStepProgress = currentItemIndex++ / (double)numberOfItems;

                var item = ToItem(itemJson, gameVersion, staticResourceRootDirectory);
                if (!Items.TryAdd(item.Id, item))
                {
                    throw new Exception($"The item id {item.Id} has been defined multiple times!");
                }
            }
        }
        public bool Equals(DestinyVendorComponent input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     CanPurchase == input.CanPurchase ||
                     (CanPurchase != null && CanPurchase.Equals(input.CanPurchase))
                     ) &&
                 (
                     Progression == input.Progression ||
                     (Progression != null && Progression.Equals(input.Progression))
                 ) &&
                 (
                     VendorLocationIndex == input.VendorLocationIndex ||
                     (VendorLocationIndex.Equals(input.VendorLocationIndex))
                 ) &&
                 (
                     SeasonalRank == input.SeasonalRank ||
                     (SeasonalRank.Equals(input.SeasonalRank))
                 ) &&
                 (
                     VendorHash == input.VendorHash ||
                     (VendorHash.Equals(input.VendorHash))
                 ) &&
                 (
                     NextRefreshDate == input.NextRefreshDate ||
                     (NextRefreshDate != null && NextRefreshDate.Equals(input.NextRefreshDate))
                 ) &&
                 (
                     Enabled == input.Enabled ||
                     (Enabled != null && Enabled.Equals(input.Enabled))
                 ));
        }
Пример #32
0
        public static bool UpdateProgress(Progression progress)
        {
            var query = "UPDATE Progression SET [Level] = '@Level'," +
                        "Currentcoin = '@Currentcoin'," +
                        "Alltimecoin = '@Alltimecoin' " +
                        "WHERE AccountID = '" + progress.AccountID + "'";

            query = query.Replace("@Level", Convert.ToString(progress.Level))
                    .Replace("@Currentcoin", Convert.ToString(progress.Currentcoin))
                    .Replace("@Alltimecoin", Convert.ToString(progress.Alltimecoin))
                    .Replace("@AccountID", Convert.ToString(progress.AccountID));

            SqlConnection connection = ConnectionBuilder.getConn();

            try
            {
                connection.Open();
                SqlCommand command = new SqlCommand(query, connection);

                /*command.Parameters.Add("@Level", System.Data.SqlDbType.Int);
                 * command.Parameters.Add("@Currentcoin", System.Data.SqlDbType.Int);
                 * command.Parameters.Add("@Alltimecoin", System.Data.SqlDbType.Int);
                 * command.Parameters["@Level"].Value = Convert.ToString(progress.Level);
                 * command.Parameters["@Currentcoin"].Value = Convert.ToString(progress.Currentcoin);
                 * command.Parameters["@Alltimecoin"].Value = Convert.ToString(progress.Alltimecoin);*/

                command.ExecuteNonQuery();
                command.Dispose();
                connection.Close();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #33
0
 private void webBrowserCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
 {
     var browser = sender as WebBrowser;
     Body = browser.Document.Body.InnerHtml;
     btnLoad.Text = "Continue";
     CurrentStep = Progression.Step2;
 }
Пример #34
0
        private void tlbSave_Click(object sender, EventArgs e)
        {
            //bool IsSuccess;
            string msg;
            int StoreInid;
            int SelectedCount = 0;

            if (dataGridView1.Rows.Count == 0)
            {
                return;
            }

            if (!HashListSeleted())
            {
                MessageBox.Show("Please select rows in grid.", "Please try agian.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }

            if (!HashArticleSelected(out SelectedCount))
            {
                MessageBox.Show("Please select rows in grid.", "Please try agian.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }

            if (SelectedCount > 0)
            {
                DialogResult dialogResult = MessageBox.Show("Are you sure to save store in. \rAfter your save, you can't modify it.", "Please Confirm.", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    int iRow = dataGridView1.CurrentRow.Index;
                    List<StoreInDetail> selectedList = new List<StoreInDetail>();

                    for (int i = 0; (this.dataGridView2.Rows.Count) > i; i++)
                    {
                        if ((bool)dataGridView2[0, i].EditedFormattedValue && string.IsNullOrEmpty(dataGridView2.Rows[i].Cells["stock"].Value.GetString()))
                        {
                            dataGridView2.CurrentCell = dataGridView2[0, i];

                            var item = new StoreInDetail();
                            item = _repo.GetArticleListToSave(Convert.ToInt32(dataGridView2.Rows[i].Cells["lineid"].Value));
                            item.Location = dataGridView2.Rows[i].Cells["Place"].Value.GetString();
                            item.NGStatus = Convert.ToInt32(dataGridView2.Rows[i].Cells["ngflag"].Value.GetBoolean());
                            item.NGRemark = dataGridView2.Rows[i].Cells["ngRemark"].Value.GetString();
                            HeadContent.PONum = item.PONum;
                            HeadContent.PONumber = item.PONumber;
                            selectedList.Add(item);
                        }
                    }

                    if (selectedList != null)
                    {
                        HeadContent.StoreInDate = DateTime.Now;
                        HeadContent = _repo.InsertStoreIn(HeadContent, epiSession);
                        _repo.InsertStoreInLine(selectedList, epiSession, HeadContent.StoreInID, HeadContent.TransactionID, out msg);
                    }
                    SetHeaderContent(HeadContent);
                    MessageBox.Show("Save Store In completed. And then will be create Part in Epicor.", "Progression.", MessageBoxButtons.OK);
                    Progression frm1 = new Progression("NEWPART", HeadContent.TransactionID, epiSession, HeadContent.Possession);
                    frm1.ShowDialog();

                    tlbSave.Enabled = false;
                    SetHeaderContent(HeadContent, true);
                    var result = _repo.GetDetailArticle(HeadContent.StoreInPlanId, HeadContent.TransactionID);
                    SetDetailArticle(result, true);
                }
            }
        }