Beispiel #1
0
        private void AddBlueprint(NetIncomingMessage message)
        {
            string compo1Temp = message.ReadString();
            string compo1Name = message.ReadString();
            string compo2Temp = message.ReadString();
            string compo2Name = message.ReadString();
            string resultTemp = message.ReadString();
            string resultName = message.ReadString();

            _craftStatus.Text = "Status: You successfully create '" + resultName + "'";
            _craftStatus.Color = Color.Green;

            foreach (BlueprintButton bpbutt in _blueprints.components)
            {
                var req = new List<string> {compo1Temp, compo2Temp};
                if (req.Exists(x => x.ToLowerInvariant() == bpbutt.Compo1.ToLowerInvariant()))
                    req.Remove(req.First(x => x.ToLowerInvariant() == bpbutt.Compo1.ToLowerInvariant()));
                if (req.Exists(x => x.ToLowerInvariant() == bpbutt.Compo2.ToLowerInvariant()))
                    req.Remove(req.First(x => x.ToLowerInvariant() == bpbutt.Compo2.ToLowerInvariant()));
                if (!req.Any()) return;
            }

            var newBpb = new BlueprintButton(compo1Temp, compo1Name, compo2Temp, compo2Name, resultTemp, resultName,
                                             _resourceManager);
            newBpb.Update(0);

            newBpb.Clicked += BlueprintClicked;

            newBpb.Position = new Point(0, _blueprintsOffset);
            _blueprintsOffset += newBpb.ClientArea.Height;

            _blueprints.components.Add(newBpb);
        }