// Use this for initialization
 void Start()
 {
     // Get and store a reference to the Rigidbody2D component so that we can
     // access it.
     memComponent    = currentPlayer.GetComponent <MemoryComponent> ();
     chargeComponent = GetComponent <ChargeComponent> ();
 }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     memComponent = GetComponent <MemoryComponent>();
     foreach (Transform child in transform)
     {
         spriteRenderer = child.GetComponent <SpriteRenderer>();
     }
 }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        memComponent   = GetComponent <MemoryComponent> ();
        spriteRenderer = GetComponent <SpriteRenderer>();

        foreach (Transform child in transform)
        {
            if (child.CompareTag("Animator"))
            {
                spriteRenderer = child.GetComponent <SpriteRenderer>();
                animator       = child.GetComponent <Animator>();
            }
        }
    }
    protected override IEnumerator ForcedSolveIEnumerator()
    {
        MemoryComponent mc = ((MemoryComponent)BombComponent);

        while (!BombComponent.IsActive)
        {
            yield return(true);
        }
        while (!BombComponent.IsSolved)
        {
            while (!mc.IsInputValid)
            {
                yield return(true);
            }
            List <Rule> ruleList = RuleManager.Instance.MemoryRuleSet.RulesDictionary[mc.CurrentStage];
            yield return(DoInteractionClick(_buttons[RuleManager.Instance.MemoryRuleSet.ExecuteRuleList(mc, ruleList)]));
        }
    }
    public void willStartWalking()
    {
        GameObject newPlayer = Instantiate(currentPlayer);

        MemoryComponent newMemoryComponent =
            newPlayer.GetComponent <MemoryComponent> ();

        currentPlayer = newPlayer;
        memComponent  = newMemoryComponent;

        foreach (Transform child in currentPlayer.transform)
        {
            if (child.CompareTag("Animator"))
            {
                Renderer rend = child.GetComponent <Renderer>();
                rend.material.SetFloat("_bwBlend", 0);
            }
        }

        lastPressTime = timekeeper.getTime();

        memComponent.state    = Memory.MemoryEvent.appearing;
        memComponent.progress = 0.1f;


        // set inactive state
        // memComponent.SetInactive();
        // currentPlayer.GetComponent<MemorySystem>().ImmediateSave(
        //   timekeeper.getTick() - 1);
        memComponent.firstActiveTick = timekeeper.getTick() - 1;

        memComponent.isSaving = true;
        state = State.transitioning;
        memComponent.state    = Memory.MemoryEvent.appearing;
        memComponent.progress = 0.1f;
        currentPlayer.GetComponent <MovementSystem>().startTransition(transitionTime);
        timekeeper.stopRewind();
    }
Ejemplo n.º 6
0
        public async Task<string> ScrapeFromProductPageAsync(string productUrl)
        {
            if (productUrl.Contains("Combo"))
            {
                var message = "Invalid Product.";
                this.logger.LogWarning(message);
                return message;
            }

            var document = await this.Context.OpenAsync(productUrl);
            var ssdDataTableRows = this.GetAllTablesRows(document);
            var ssdDataTables = this.GetAllTables(document);
            var ssd = new SSD
            {
                Price = this.GetPrice(document),
                ImageUrl = this.GetImageUrl(document),
                Category = this.GetCategoryFromUrl(productUrl),
            };

            this.logger.LogInformation(productUrl);

            foreach (var tableRow in ssdDataTableRows)
            {
                var rowName = tableRow.FirstChild.TextContent.Trim();
                var rowValue = tableRow.LastElementChild.InnerHtml.Replace("<br><br>", "{n}").Replace("<br>", "{n}").Trim();

                switch (rowName)
                {
                    case "Model":
                        if (this.ssdRepo.AllAsNoTracking().Any(x => x.Model == rowValue))
                        {
                            var message = "Already exists.";
                            this.logger.LogWarning(message);
                            return message;
                        }

                        ssd.Model = rowValue;
                        break;
                    case "Brand":
                        ssd.Brand = this.GetOrCreateBrand(this.brandRepo, rowValue);
                        break;
                    case "Series":
                        ssd.Series = this.GetOrCreateSeries(this.seriesRepo, rowValue);
                        break;
                    case "Used For":
                        var usage = this.usageRepo.All().FirstOrDefault(x => x.Name == rowValue);
                        if (usage == null)
                        {
                            usage = new DiskForUsage
                            {
                                Name = rowValue,
                            };
                        }

                        ssd.Usage = usage;
                        break;
                    case "Form Factor":
                        var formFactor = this.formFactorRepo.All().FirstOrDefault(x => x.Name == rowValue);
                        if (formFactor == null)
                        {
                            formFactor = new FormFactor
                            {
                                Name = rowValue,
                            };
                        }

                        ssd.FormFactor = formFactor;
                        break;
                    case "Capacity":
                        var capacityMatch = this.MatchOneOrMoreDigits.Match(rowValue);
                        if (!capacityMatch.Success)
                        {
                            continue;
                        }

                        var capacity = short.Parse(capacityMatch.Value);
                        if (rowValue.ToLower().Contains("tb"))
                        {
                            capacity *= 1024;
                        }

                        ssd.CapacityGb = capacity;
                        break;
                    case "Memory Components":
                        var memoryComponent = this.memoryComponentRepo.All().FirstOrDefault(x => x.Name == rowValue);
                        if (memoryComponent == null)
                        {
                            memoryComponent = new MemoryComponent
                            {
                                Name = rowValue,
                            };
                        }

                        ssd.MemoryComponent = memoryComponent;
                        break;
                    case "Interface":
                        var ssdInterface = this.interfaceRepo.All().FirstOrDefault(x => x.Name == rowValue);
                        if (ssdInterface == null)
                        {
                            ssdInterface = new Interface
                            {
                                Name = rowValue,
                            };
                        }

                        ssd.Interface = ssdInterface;
                        break;
                    case "Cache":
                        var cacheMatch = this.MatchOneOrMoreDigits.Match(rowValue);
                        if (!cacheMatch.Success)
                        {
                            continue;
                        }

                        var cache = int.Parse(cacheMatch.Value);
                        if (rowValue.ToLower().Contains("mb"))
                        {
                            cache *= 1024;
                        }
                        else if (rowValue.ToLower().Contains("gb"))
                        {
                            cache *= 1024 * 1024;
                        }

                        ssd.CacheKb = cache;
                        break;
                    case "Max Sequential Read":
                        var seqReadMatch = this.MatchOneOrMoreDigits.Match(rowValue);
                        if (!seqReadMatch.Success)
                        {
                            continue;
                        }

                        ssd.MaxSequentialReadMBps = short.Parse(seqReadMatch.Value);
                        break;
                    case "Max Sequential Write":
                        var seqWriteMatch = this.MatchOneOrMoreDigits.Match(rowValue);
                        if (!seqWriteMatch.Success)
                        {
                            continue;
                        }

                        ssd.MaxSequentialWriteMBps = short.Parse(seqWriteMatch.Value);
                        break;
                    case "4KB Random Read":
                        ssd.FourKBRandomRead = rowValue;
                        break;
                    case "4KB Random Write":
                        ssd.FourKBRandomWrite = rowValue;
                        break;
                    case "MTBF":
                        var mtbfMatch = this.MatchOneOrMoreDigits.Match(rowValue.Replace(",", string.Empty));
                        if (!mtbfMatch.Success)
                        {
                            continue;
                        }

                        ssd.MeanTimeBetweenFailures = int.Parse(mtbfMatch.Value);
                        break;
                    case "Features":
                        ssd.Features = rowValue;
                        break;
                    case "Height":
                        ssd.Height = this.MatchAndParseFloat(rowValue);
                        break;
                    case "Width":
                        ssd.Width = this.MatchAndParseFloat(rowValue);
                        break;
                    case "Depth":
                        ssd.Length = this.MatchAndParseFloat(rowValue);
                        break;
                    case "Date First Available":
                        ssd.FirstAvailable = DateTime.Parse(rowValue);
                        break;
                }
            }

            if (ssd.Model == null)
            {
                var message = "Invalid Model.";
                this.logger.LogWarning(message);
                return message;
            }

            await this.ssdRepo.AddAsync(ssd);
            await this.ssdRepo.SaveChangesAsync();
            var successMessage = $"Successfully added {ssd.Model}.";
            this.logger.LogInformation(successMessage);
            return successMessage;
        }
 public MemoryComponentSolver(BombCommander bombCommander, MemoryComponent bombComponent) :
     base(bombCommander, bombComponent)
 {
     _buttons = bombComponent.Buttons;
     modInfo  = ComponentSolverFactory.GetModuleInfo("MemoryComponentSolver", "!{0} position 2, !{0} pos 2, !{0} p 2 [2nd position] | !{0} label 3, !{0} lab 3, !{0} l 3 [label 3]");
 }
 public MemoryComponentSolver(BombCommander bombCommander, MemoryComponent bombComponent, IRCConnection ircConnection, CoroutineCanceller canceller) :
     base(bombCommander, bombComponent, ircConnection, canceller)
 {
     _buttons = bombComponent.Buttons;
     modInfo  = ComponentSolverFactory.GetModuleInfo("MemoryComponentSolver");
 }
 void Start()
 {
     memComponent          = GetComponent <MemoryComponent>();
     memComponent.isSaving = false;
     generatePath();
 }
Ejemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     memComponent = GetComponent <MemoryComponent> ();
 }