コード例 #1
0
    public void DisplayOnStart()
    {
        switch (state)
        {
        case StarMenu.MenuItemId.Start_Menu:
            logo.Draw();
            textMenu.Draw();
            break;

        case StarMenu.MenuItemId.Options:
            logo.DrawContext();
            options.Draw();
            break;

        case StarMenu.MenuItemId.Load_Game:
            logo.DrawContext();
            loadZone.Draw();
            load.Draw();
            break;
        }

        if (inputs.Contains(state))
        {
            inputs[state].Draw();
        }
    }
コード例 #2
0
 public void Add(Node node, bool isOutput = false, bool isInput = false)
 {
     if (isOutput && !Outputs.Contains(node))
     {
         Outputs.Add(node);
     }
     if (isInput && !Inputs.Contains(node))
     {
         Inputs.Add(node);
     }
     if (graph.ContainsVertex(node))
     {
         return;
     }
     if (!NodeIndex.ContainsKey(node.Value))
     {
         NodeIndex[node.Value] = node;
     }
     else if (NodeIndex[node.Value] != node)
     {
         NodeIndex[node.Value] = node; //TODO: this could be really bad!!!
         //throw new InvalidOperationException($"a node with the value '{node.Value}' already exists!");
     }
     graph.AddVertex(node);
     node.OnAdd(this);
 }
コード例 #3
0
        public bool RemoveNode(Node node)
        {
            bool removed = false;

            if (Nodes.Contains(node))
            {
                removed = true;
                Nodes.Remove(node);
                if (Outputs.Contains(node))
                {
                    Outputs.Remove((OutputPipeNode)node);
                }
                else if (Inputs.Contains(node))
                {
                    Inputs.Remove((InputPipeNode)node);
                }
                else if (Connectors.Contains(node))
                {
                    Connectors.Remove((ConnectorPipeNode)node);
                }
                else if (node is PPMNode && Invis != null)
                {
                    Invis = null;
                    if (IsPassable)
                    {
                        Deinvisibilize((PPMNode)node);
                    }
                }
            }
            return(removed);
        }
コード例 #4
0
    public void DisplayAbilityMenu()
    {
        DrawBackGround();
        if (spacerTexture != null)
        {
            GUI.DrawTexture(spacer.GetRect(), spacerTexture, ScaleMode.ScaleToFit);
        }

        activeMenu.Draw();
        passiveMenu.Draw();
        activeSelectMenu.Draw();
        passiveSelectMenu.Draw();

        if (passiveMovingTexture != null)
        {
            GUI.DrawTexture(passiveMovingArea.GetRect(), passiveMovingTexture, ScaleMode.ScaleToFit);
        }

        if (inputs.Contains(state))
        {
            inputs[state].Draw();
        }

        details.Draw();
    }
コード例 #5
0
        public bool AddNode(Node node)
        {
            bool added = false;

            if (node.ParentNetwork == this && !Nodes.Contains(node))
            {
                added = true;
                Nodes.Add(node);
                if (node is OutputPipeNode && !Outputs.Contains(node))
                {
                    Outputs.Add((OutputPipeNode)node);
                }
                else if (node is InputPipeNode && !Inputs.Contains(node))
                {
                    Inputs.Add((InputPipeNode)node);
                }
                else if (node is ConnectorPipeNode && !Connectors.Contains(node))
                {
                    Connectors.Add((ConnectorPipeNode)node);
                }
                else if (node is PPMNode && Invis == null)
                {
                    Invis = (PPMNode)node;
                }
            }
            else if (node.ParentNetwork != this)
            {
                //Printer.Info($"Tried to add {node.Print()} to N{ID}, but they dont match.");
            }
            return(added);
        }
コード例 #6
0
 public override void UnregisterInput(IInput input)
 {
     if (Inputs.Contains(input))
     {
         base.UnregisterInput(input);
         UnregisterSomeInput(input);
         UnregisterSomeOtherInput(input);
         UnregisterAppLifetimeInput(input);
     }
 }
コード例 #7
0
 public override void RegisterInput(IInput input)
 {
     if (Inputs.Contains(input) == false)
     {
         base.RegisterInput(input);
         RegisterSomeInput(input);
         RegisterSomeOtherInput(input);
         RegisterAppLifetimeInput(input);
     }
 }
コード例 #8
0
        public ZipCompressOption Include([NotNull] string fileOrDirectory)
        {
            Guard.ArgumentIsNotNull(fileOrDirectory, nameof(fileOrDirectory));

            if (!Inputs.Contains(fileOrDirectory))
            {
                Inputs.Add(fileOrDirectory);
            }

            return(this);
        }
コード例 #9
0
ファイル: MacroDefiner.cs プロジェクト: ondrej11/o106
 protected void AddIntermediateResults(IFigure figure)
 {
     if (Inputs.Contains(figure))
     {
         return;
     }
     if (!Results.Contains(figure))
     {
         Results.Insert(0, figure);
     }
     foreach (var dependency in figure.Dependencies)
     {
         AddIntermediateResults(dependency);
     }
 }
コード例 #10
0
 /// <summary>
 /// Gets an input by its name.
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public ZoneProgramInput GetInput(string name, bool silent = false)
 {
     if (Inputs.Contains(name))
     {
         return(Inputs[name]);
     }
     else
     {
         if (!silent)
         {
             throw new Exception("No input with the name '" + name + "' found in this program.");
         }
         return(null);
     }
 }
コード例 #11
0
ファイル: Node.cs プロジェクト: nickpirrottina/MyNetSensors
        public void RemoveInput(Input input)
        {
            if (input == null || !Inputs.Contains(input))
            {
                LogError("Can`t remove input. Does not exist.");
                return;
            }

            var link = engine.GetLinkForInput(input);

            if (link != null)
            {
                engine.RemoveLink(link, true);
            }

            Inputs.Remove(input);
        }
コード例 #12
0
        // Remove references to culled inputs
        public override void CullInputs()
        {
            base.CullInputs();

            if (!Inputs.Contains(ReferenceVideo))
            {
                ReferenceVideo = null;
            }

            foreach (DiagramGraph graph in Graphs.ToArray())
            {
                if (!Inputs.Contains(graph.Video))
                {
                    Graphs.Remove(graph);
                }
            }
        }
コード例 #13
0
        public void AddRandomLink(Random rnd)
        {
            List <Node> allNodes = new List <Node>();

            allNodes.AddRange(Inputs);
            allNodes.AddRange(Hidden);
            allNodes.AddRange(Outputs);
            Node input = allNodes[rnd.Next(allNodes.Count)];

            allNodes.RemoveAll(n => Inputs.Contains(n));
            Node output = allNodes[rnd.Next(allNodes.Count)];

            if (input.Equals(output))
            {
                return;
            }

            double weight = rnd.NextDouble() * 2 - 1;

            AddLink(input, output, weight);
        }
コード例 #14
0
        public SuggestData AddInput(string input, bool addOccurance = false)
        {
            if (Inputs == null)
            {
                Inputs = new string[] { input };
            }
            else if (!Inputs.Contains(input))
            {
                int size = Inputs.Length;
                var @new = new string[size + 1];
                Array.Copy(Inputs, @new, size);
                @new[size] = input;
                Inputs     = @new;
            }

            if (addOccurance)
            {
                AddOccurance();
            }

            return(this);
        }
コード例 #15
0
        public void CalculateIsSampleActive(TelemetryManifestRule rule, TelemetrySession session)
        {
            IsCalculateCalled = true;
            if (Rate <= 0.0)
            {
                IsSampleActive = false;
                IsRateTooLow   = true;
                return;
            }
            if (Rate >= 1.0)
            {
                IsSampleActive = true;
                IsRateTooHigh  = true;
                return;
            }
            string text = StringExtensions.Join(from t in new Tuple <HashInput, string>[5]
            {
                Tuple.Create(HashInput.MachineId, session.MachineId.ToString()),
                Tuple.Create(HashInput.UserId, session.UserId.ToString()),
                Tuple.Create(HashInput.RuleId, rule.Name),
                Tuple.Create(HashInput.SamplingId, GetFullName(rule)),
                Tuple.Create(HashInput.SessionId, session.SessionId)
            }
                                                where Inputs.Contains(t.Item1)
                                                select t.Item2, ".");

            if (string.IsNullOrEmpty(text))
            {
                IsSampleActive     = false;
                IsInputStringEmpty = true;
                return;
            }
            InputString = text;
            byte[] bytes = Encoding.UTF8.GetBytes(text);
            ulong  num2  = Hash = BitConverter.ToUInt64(FipsCompliantSha.Sha256.ComputeHash(bytes), 0);

            IsSampleActive = ((double)num2 <= Rate * 1.8446744073709552E+19);
        }
コード例 #16
0
 public Boolean RemoveInput(CreateRawTransactionInput input)
 {
     return(Inputs.Contains(input) && Inputs.Remove(input));
 }
コード例 #17
0
 public bool Contains(Input input) => Inputs.Contains(input);
コード例 #18
0
 public bool InputExists(ITransmitter input)
 {
     return(Inputs.Contains(input));
 }
コード例 #19
0
 public bool InputExists(Input input)
 {
     return(Inputs.Contains(input));
 }