Example #1
0
        public MainPage()
        {
            InitializeComponent();

            this._drawing = false;
            this._tool = new FreeHandTool(this.drawingCanvas);
        }
 public PopupMenuTool(IDrawingEditor editor, IPopupMenuFigure figure, ITool defaultTool, ITool delegateTool, bool mainMenu)
     : base(editor, figure, defaultTool)
 {
     _figure = figure;
     DelegateTool = delegateTool;
     primaryMenu = mainMenu;
 }
Example #3
0
        /// <summary>
        /// The constructor for the ToolDialog
        /// </summary>
        /// <param name="tool">The ITool to create the dialog box for</param>
        /// <param name="modelElements">A list of all model elements</param>
        public ToolDialog(ITool tool, IEnumerable<ModelElement> modelElements)
        {
            // Required by the designer
            InitializeComponent();

            // We store all the element names here and extract the datasets
            foreach (ModelElement me in modelElements)
            {
                if (me as DataElement != null)
                {
                    bool addData = true;
                    foreach (Parameter par in tool.OutputParameters)
                    {
                        if (par.ModelName == (me as DataElement).Parameter.ModelName)
                        {
                            addData = false;
                        }

                        break;
                    }

                    if (addData)
                    {
                        _dataSets.Add(new DataSetArray(me.Name, (me as DataElement).Parameter.Value as IDataSet));
                    }
                }
            }

            Initialize(tool);
        }
		public MultiLineTextTool (IDrawingEditor editor, MultiLineTextFigure fig, ITool dt): base (editor, fig, dt) {	
			_textview = new Gtk.TextView ();
			_textview.Buffer.Changed += new System.EventHandler (ChangedHandler);
			_textview.ModifyFont (fig.PangoLayout.FontDescription.Copy ());
			_textview.RightMargin = 5;
			_textview.Justification = ConvertJustificaton ();
		}
        private void InsertTool(ITool tool)
        {
            // Create the view.
            var view = tool.CreateView();
            if (view.DataContext == null) view.DataContext = tool;
            view.HorizontalAlignment = tool.HorizontalAlignment;
            view.VerticalAlignment = tool.VerticalAlignment;

            // Assign the margin (if the generated view did not arrive with an explicitly set value).
            if (view.Margin == default(Thickness)) view.Margin = tool.Parent.DefaultToolMargin;

            // Get the column (and update it's width if required).
            var columnIndex = tool.Parent.GetColumn(tool);
            if (tool is IGridCellWidth)
            {
                toolContainer.ColumnDefinitions[columnIndex].Width = ((IGridCellWidth) tool).ColumnWidth;
            }

            // Assign Row/Column position.
            Grid.SetRow(view, tool.Parent.GetRow(tool));
            Grid.SetColumn(view, columnIndex);

            // Set spans.
            Grid.SetRowSpan(view, tool.Parent.GetRowSpan(tool));
            Grid.SetColumnSpan(view, tool.Parent.GetColumnSpan(tool));

            // Insert into the visual tree.
            toolContainer.Children.Add(view);
        }
 private IActivityToolSchedulingEventCollection GetOrAddToolSchedule(ITool tool)
 {
     if (!_toolSchedules.ContainsKey(tool))
     {
         _toolSchedules.Add(tool, new ActivityToolSchedulingEventCollection(tool));
     }
     return _toolSchedules[tool];
 }
Example #7
0
 /// <summary>
 /// The constructor for the ToolDialog
 /// </summary>
 /// <param name="tool">The ITool to create the dialog box for</param>
 /// <param name="dataSets">The list of available DataSets available</param>
 /// <param name="mapExtent">Creates a new instance of the tool dialog with map extent.</param>
 public ToolDialog(ITool tool, List<DataSetArray> dataSets, Extent mapExtent)
 {
     // Required by the designer
     InitializeComponent();
     DataSets = dataSets;
     _extent = mapExtent;
     Initialize(tool);
 }
Example #8
0
 public Pickup(int x, int y, ITool tool, string text)
 {
     Tool = tool;
     this.text = text;
     X = x;
     startY = Y = y;
     Size = new Point(16, 16);
 }
		public SimpleTextTool (IDrawingEditor editor, SimpleTextFigure fig, ITool dt) 
			: base (editor, fig, dt) {
			_entry = new Gtk.Entry ();
			_entry.HasFrame = false;
			_entry.Alignment = 0.5f;
			_entry.Changed += new System.EventHandler (ChangedHandler);
			_entry.ModifyFont (fig.PangoLayout.FontDescription.Copy ());
		}
Example #10
0
 public Inventory(int x, int y, ITool[] tools)
     : this(x, y)
 {
     foreach (ITool tool in tools)
     {
         this.tools.Add(tool);
     }
 }
Example #11
0
        /// <summary>
        /// The constructor for the ToolDialog
        /// </summary>
        /// <param name="Tool">The ITool to create the dialog box for</param>
        /// <param name="DataSets">The list of available DataSets available</param>
        public ToolDialog(ITool Tool, List<DataSetArray> DataSets)
        {
            //Required by the designer
            InitializeializeializeComponent();

            _dataSets = DataSets;

            Initialize(Tool);
        }
Example #12
0
		public void Bind(Map m, TileSet ts, Palette p)
		{
			Map = m;
			TileSet = ts;
			Palette = p;
			PlayerPalettes = null;
			Chunks.Clear();
			Tool = null;
		}
Example #13
0
		public DefaultToolService(DesignContext context)
		{
			_currentTool = this.PointerTool;
			context.Services.RunWhenAvailable<IDesignPanel>(
				delegate(IDesignPanel designPanel) {
					_designPanel = designPanel;
					_currentTool.Activate(designPanel);
				});
		}
 private ToolInstance(int id, ITool definition) : this()
 {
     if (id == -1)
     {
         id = this.NextId();
     }
     ID = id;
     Definition = definition;
 }
Example #15
0
        private void AddPlugin(ITool plugin)
        {
            var tabitem = new TabItem
            {
                Header = plugin.Name,
                Content = plugin.View
            };

            tabControl.Items.Add(tabitem);
        }
        public void TestSetup()
        {
            CompositionInitializer.SatisfyImports(this);

            tool1 = ToolCreator.CreateExport().Value;
            tool1.Id = MyTool.One;

            tool2 = ToolCreator.CreateExport().Value;
            tool2.Id = MyTool.Two;
        }
        public void Show(ITool tool, Action applyCallback, Action cancelCallback)
        {
            this.Content = tool.GetSettingsUI();
            this.Header = tool.ToString().Split('.').Last();

            if (!this.IsOpen && this.Content != null)
            {
              this.Show();
            }
        }
Example #18
0
        public static void SetCurrentTool(ITool tool)
        {
            if (currentTool != null)
            {
                currentTool.OnRemove();
            }

            currentTool = tool;

            currentTool.OnAdd();
        }
Example #19
0
 public TinyDiver(ITool tool1, ITool tool2, int x, int y)
     : base(tool1, tool2, x, y)
 {
     Size = new Point(16, 28);
     StandingGrid = new SpriteGrid("tiny_standing", 2, 1);
     WalkingGrid = new SpriteGrid("tiny_walking", 12, 1);
     JumpingGrid = new SpriteGrid("tiny_jumping", 6, 1);
     ClimbingGrid = new SpriteGrid("tiny_climbing", 2, 1);
     Name = "Tiny";
     originalBoatPosition = new Point(250, 224 - Height);
 }
Example #20
0
 public FattyDiver(ITool tool1, ITool tool2, int x, int y)
     : base(tool1, tool2, x, y)
 {
     Size = new Point(16, 40);
     StandingGrid = new SpriteGrid("tiny_standing", 2, 1);
     WalkingGrid = new SpriteGrid("tiny_walking", 12, 1);
     JumpingGrid = new SpriteGrid("tiny_jumping", 6, 1);
     ClimbingGrid = new SpriteGrid("fatty_climbing", 2, 1);
     Name = "Fatty";
     originalBoatPosition = new Point(200, 224 - Height);
     Strength = 20;
 }
Example #21
0
        /// <summary>
        /// �R���X�g���N�^
        /// ����new�ł��Ȃ��悤��private�Œ�`�B
        /// </summary>
        private Application()
        {
            _documents = new List<Document>();
            _activeDocument = null;

            //Application�N���X�̒��Ń��C���E�B���h�E�����������
            _mainFrame = new Form1();

            _tool = new PenTool();

            _docSeq = 1;
        }
 /// <summary>
 /// Creates an instance of DLLToolInfo
 /// </summary>
 /// <param name="tool"></param>
 /// <param name="AssemblyFileName"></param>
 /// <param name="ToolClassName"></param>
 /// <param name="DateFileModified">The dane the file was modified</param>
 public DefaultToolProviderToolInfo(ITool tool, string AssemblyFileName, string ToolClassName, DateTime DateFileModified)
 {
     base.Name = tool.Name;
     base.UniqueName = tool.UniqueName;
     base.Description = tool.Description;
     base.ToolTip = tool.ToolTip;
     base.Category = tool.Category;
     base.Icon = tool.Icon;
     _assemblyFileName = AssemblyFileName;
     _toolClassName = ToolClassName;
     _dateFileModified = DateFileModified;
 }
 private IToolInstance GetNextTool(ITool tool)
 {
     foreach (var toolInstanceState in _toolAvailableStates[tool])
     {
         if (toolInstanceState.Value)
         {
             // return first worker that is available
             return _converter.ToolTypes[tool][toolInstanceState.Key];
         }
     }
     return null;
 }
        private void CreateObject(ITool tool)
        {
            using ( var scope = RecordingServices.DefaultRecorder.OpenScope() )
            {
                var newItem = tool.CreateItem( EditingContext );
                newItem.SetPosition( 100, 100 );

                // We name the scope after we created.
                scope.OperationDescriptor = new NamedOperationDescriptor(string.Format("Creating {0}", newItem.Name));

            }
        }
Example #25
0
        public ToolIndex(ITool tool, ToolOptionBase options, string name, Image image, Keys defaultKey)
        {
            Name = name;
            DefaultKeys = defaultKey;

            OptionsPanel = options;
            Tool = tool;
            MenuItem = new ToolStripMenuItem(Name, image);
            MenuItem.Text = name;
            MenuItem.Tag = this;
            Button = new ToolStripButton(image);
            Button.Text = name;
            Button.DisplayStyle = ToolStripItemDisplayStyle.Image;
            Button.Tag = this;
        }
Example #26
0
        public ITool m_Tool; //��������axMapControl��IToolʵ��

        #endregion Fields

        #region Constructors

        /// <summary>
        /// ��ʼ������
        /// </summary>
        /// <param name="type">��������</param>
        /// <param name="ipTool">��������axMapControl��IToolʵ��</param>
        public FormDis(MeasureType type,ITool ipTool)
        {
            InitializeComponent();
            this.m_MeasureType = type;
            this.m_Tool = ipTool;
            this.TopMost = true;
            this.WriteLabelText(null);

            if (this.m_Tool.GetType() == typeof(ToolMeasureLength))
            {
                (this.m_Tool as ToolMeasureLength).MyInit();
            }
            if (this.m_Tool.GetType() == typeof(ToolMeasureArea))
            {
                (this.m_Tool as ToolMeasureArea).MyInit();
            }
        }
        protected AbstractDesigner(int undoBufferSize)
        {
            tool = new SelectionTool (this);
            View = new StandardDrawingView (this);
            UndoBufferSize = undoBufferSize;

            UndoManager = new UndoManager (UndoBufferSize);
            UndoManager.StackChanged += delegate {
                OnStackChanged ();
            };

            CommandList = new List<ICommand> ();
            RebuildCommandList ();

            window = new ScrolledWindow ();
            window.Add ((Widget) View);
            window.ShowAll ();
        }
Example #28
0
        public GPSMainForm()
        {
            InitializeComponent();

            graphContainer.DbContext = db;
            graphObjectEditor.DbContext = db;
            pathConstraintsEditor.DbContext = db;

            toolShowInformation.Tag = new InfoTool(this);
            toolAddNode.Tag = new NodeTool(this);
            toolConnectNodes.Tag = new ArcTool(this);
            toolShortestPath.Tag = new ShortestPathTool(this);

            infoSplit.Panel2Collapsed = true;
            mainSplit.Panel1Collapsed = true;

            toolShowInformation.Checked = true;
            currentTool = toolShowInformation.Tag as ITool;
        }
Example #29
0
    public void RemoveTool(ITool tool) {
      if (tool == null)
        return;
      tool.Controller = null;
      registeredTools.Remove(tool);

      IMouseListener mouseTool = tool as IMouseListener;
      if (mouseTool != null)
        mouseListeners.Remove(mouseTool);
      IKeyboardListener keyboardTool = tool as IKeyboardListener;
      if (keyboardTool != null)
        keyboardListeners.Remove(keyboardTool);
      IDragDropListener dragdropTool = tool as IDragDropListener;
      if (dragdropTool != null)
        dragdropListeners.Remove(dragdropTool);

      tool.OnToolActivate -= new EventHandler<ToolEventArgs>(AddedTool_OnToolActivate);
      tool.OnToolDeactivate -= new EventHandler<ToolEventArgs>(AddedTool_OnToolDeactivate);
    }
Example #30
0
 public Flipbook(Color backgroundColor)
 {
     ColorHistory = new Color[]
     {
         Colors.Black, Colors.White, Colors.Gray,
         Colors.Blue, Colors.Green, Colors.Red,
         Colors.Pink, Colors.Orange, Colors.Orchid
     };
     _background = new SolidColorBrush();
     BackgroundColor = backgroundColor;
     _tools = new Dictionary<string, ITool>
     {
         {"Pencil", new Pencil()},
         {"Pen", new Pen()},
         {"Highlighter", new Highlighter()},
         {"Eraser", new Eraser(ref _background)},
     };
     CurrentTool = _tools["Pen"];
     CurrentPage = new Page(this);
     _pages = new List<Page> {CurrentPage};
 }
Example #31
0
 public static void Do(Mobile from, CraftSystem craftSystem, ITool tool)
 {
     from.Target = new InternalTarget(craftSystem, tool);
     from.SendLocalizedMessage(1044276); // Target an item to repair.
 }
Example #32
0
 public InternalTarget(CraftSystem craftSystem, ITool tool)
     : base(10, false, TargetFlags.None)
 {
     m_CraftSystem = craftSystem;
     m_Tool        = tool;
 }
Example #33
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            Quality = (ItemQuality)quality;

            if (!craftItem.ForceNonExceptional)
            {
                if (typeRes == null)
                {
                    typeRes = craftItem.Resources.GetAt(0).ItemType;
                }

                Resource = CraftResources.GetFromType(typeRes);
            }

            return(quality);
        }
Example #34
0
        private static void Main()
        {
            Console.OutputEncoding = Encoding.UTF8;

            Files        = new Dictionary <ulong, MD5Hash>();
            TrackedFiles = new Dictionary <ushort, HashSet <ulong> >();

            #region Tool Detection
            HashSet <Type> tools = new HashSet <Type>();
            {
                Assembly    asm   = typeof(ITool).Assembly;
                Type        t     = typeof(ITool);
                List <Type> types = asm.GetTypes().Where(tt => tt != t && t.IsAssignableFrom(tt)).ToList();
                foreach (Type tt in types)
                {
                    ToolAttribute attrib = tt.GetCustomAttribute <ToolAttribute>();
                    if (tt.IsInterface || attrib == null)
                    {
                        continue;
                    }
                    tools.Add(tt);

                    if (attrib.TrackTypes == null)
                    {
                        continue;
                    }
                    foreach (ushort type in attrib.TrackTypes)
                    {
                        if (!TrackedFiles.ContainsKey(type))
                        {
                            TrackedFiles[type] = new HashSet <ulong>();
                        }
                    }
                }
            }
            #endregion

            Flags = FlagParser.Parse <ToolFlags>(() => PrintHelp(tools));
            if (Flags == null)
            {
                return;
            }

            Logger.EXIT = !Flags.GracefulExit;

            ITool     targetTool      = null;
            ICLIFlags targetToolFlags = null;

            #region Tool Activation

            foreach (Type type in tools)
            {
                ToolAttribute attrib = type.GetCustomAttribute <ToolAttribute>();

                if (!string.Equals(attrib.Keyword, Flags.Mode, StringComparison.InvariantCultureIgnoreCase))
                {
                    continue;
                }
                targetTool = Activator.CreateInstance(type) as ITool;

                if (attrib.CustomFlags != null)
                {
                    Type flags = attrib.CustomFlags;
                    if (typeof(ICLIFlags).IsAssignableFrom(flags))
                    {
                        targetToolFlags = typeof(FlagParser).GetMethod("Parse", new Type[] { }).MakeGenericMethod(flags).Invoke(null, null) as ICLIFlags;
                    }
                }
                break;
            }

            #endregion

            if (targetTool == null)
            {
                FlagParser.Help <ToolFlags>(false);
                PrintHelp(tools);
                if (Debugger.IsAttached)
                {
                    Debugger.Break();
                }
                return;
            }

            #region Initialize CASC
            Log("{0} v{1}", Assembly.GetExecutingAssembly().GetName().Name, Util.GetVersion());
            Log("Initializing CASC...");
            Log("Set language to {0}", Flags.Language);
            CDNIndexHandler.Cache.Enabled   = Flags.UseCache;
            CDNIndexHandler.Cache.CacheData = Flags.CacheData;
            CDNIndexHandler.Cache.Validate  = Flags.ValidateCache;
            // ngdp:us:pro
            // http:us:pro:us.patch.battle.net:1119
            if (Flags.OverwatchDirectory.ToLowerInvariant().Substring(0, 5) == "ngdp:")
            {
                string   cdn     = Flags.OverwatchDirectory.Substring(5, 4);
                string[] parts   = Flags.OverwatchDirectory.Substring(5).Split(':');
                string   region  = "us";
                string   product = "pro";
                if (parts.Length > 1)
                {
                    region = parts[1];
                }
                if (parts.Length > 2)
                {
                    product = parts[2];
                }
                if (cdn == "bnet")
                {
                    Config = CASCConfig.LoadOnlineStorageConfig(product, region);
                }
                else
                {
                    if (cdn == "http")
                    {
                        string host = string.Join(":", parts.Skip(3));
                        Config = CASCConfig.LoadOnlineStorageConfig(host, product, region, true, true, true);
                    }
                }
            }
            else
            {
                Config = CASCConfig.LoadLocalStorageConfig(Flags.OverwatchDirectory, !Flags.SkipKeys, false);
            }
            Config.Languages = new HashSet <string>(new[] { Flags.Language });
            #endregion

            foreach (Dictionary <string, string> build in Config.BuildInfo)
            {
                if (!build.ContainsKey("Tags"))
                {
                    continue;
                }
                if (build["Tags"].Contains("XX?"))
                {
                    IsPTR = true;
                }
                // us ptr region is known as XX, so just look for it in the tags.
                // this should work... untested for Asia
            }

            BuildVersion = uint.Parse(Config.BuildName.Split('.').Last());

            if (Flags.SkipKeys)
            {
                Log("Disabling Key auto-detection...");
            }

            Log("Using Overwatch Version {0}", Config.BuildName);
            CASC = CASCHandler.OpenStorage(Config);
            Root = CASC.Root as OwRootHandler;
            if (Root == null)
            {
                ErrorLog("Not a valid overwatch installation");
                return;
            }

            // Fail when trying to extract data from a specified language with 2 or less files found.
            if (!Root.APMFiles.Any())
            {
                ErrorLog("Could not find the files for language {0}. Please confirm that you have that language installed, and are using the names from the target language.", Flags.Language);
                if (!Flags.GracefulExit)
                {
                    return;
                }
            }

            Log("Mapping...");
            TrackedFiles[0x90] = new HashSet <ulong>();
            IO.MapCMF();
            IO.LoadGUIDTable();
            Sound.WwiseBank.GetReady();

            #region Key Detection
            if (!Flags.SkipKeys)
            {
                Log("Adding Encryption Keys...");

                foreach (ulong key in TrackedFiles[0x90])
                {
                    if (!ValidKey(key))
                    {
                        continue;
                    }
                    using (Stream stream = IO.OpenFile(Files[key])) {
                        if (stream == null)
                        {
                            continue;
                        }

                        STUEncryptionKey encryptionKey = GetInstance <STUEncryptionKey>(key);
                        if (encryptionKey != null && !KeyService.keys.ContainsKey(encryptionKey.LongRevKey))
                        {
                            KeyService.keys.Add(encryptionKey.LongRevKey, encryptionKey.KeyValue);
                            Log("Added Encryption Key {0}, Value: {1}", encryptionKey.KeyNameProper, encryptionKey.Key);
                        }
                    }
                }
            }
            #endregion

            Log("Tooling...");
            targetTool.Parse(targetToolFlags);
            if (Debugger.IsAttached)
            {
                Debugger.Break();
            }
        }
Example #35
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            if (quality == 2)
            {
                UsesRemaining *= 2;
            }

            return(quality);
        }
Example #36
0
 private void buttonChangeColor_Click(object sender, EventArgs e)
 {
     tool = new FillTool();
 }
Example #37
0
        public override int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            if (resHue > 0)
            {
                Hue = resHue;
            }

            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            Resource = CraftResources.GetFromType(resourceType);

            switch (Resource)
            {
            case CraftResource.Bloodwood:
                Attributes.RegenHits = 2;
                break;

            case CraftResource.Heartwood:
                Attributes.Luck = 40;
                break;

            case CraftResource.YewWood:
                Attributes.RegenHits = 1;
                break;
            }

            return(0);
        }
Example #38
0
 private void buttonDrawLine_Click(object sender, EventArgs e)
 {
     tool = new FigureTool(new Figure.Line());
 }
Example #39
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            PlayerConstructed = true;

            Quality = (ItemQuality)quality;

            if (makersMark)
            {
                Crafter = from;
            }

            return(quality);
        }
Example #40
0
        public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            Resource = CraftResources.GetFromType(resourceType);

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }
            else if (Hue == 0)
            {
                Hue = resHue;
            }

            return(quality);
        }
Example #41
0
        public void ShouldReturnAmazingToolImplementation()
        {
            ITool tool = toolController.CreateToolOfType("Amazing Tool");

            Assert.IsTrue(tool is AmazingTool);
        }
Example #42
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            this.ItemID  = 0x14F0;
            this.Faction = Faction.Find(from);

            return(1);
        }
Example #43
0
        public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            Quality = (ItemQuality)quality;

            return(quality);
        }
Example #44
0
        public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            this.Quality = (ItemQuality)quality;

            PlayerConstructed = true;

            if (makersMark)
            {
                this.Crafter = from;
            }

            if (!craftItem.ForceNonExceptional)
            {
                if (typeRes == null)
                {
                    typeRes = craftItem.Resources.GetAt(0).ItemType;
                }

                Resource = CraftResources.GetFromType(typeRes);
            }

            return(quality);
        }
Example #45
0
 public abstract int CanCraft(Mobile from, ITool tool, Type itemType);
 private FrameworkElement PageConverter(ITool tool) => tool.Page;
Example #47
0
 private void buttonEraser_Click(object sender, EventArgs e)
 {
     tool = new EraserTool();
 }
Example #48
0
        private void CombineCloth(Mobile m, CraftItem craftItem, ITool tool)
        {
            PlayCraftEffect(m);

            Timer.DelayCall(TimeSpan.FromSeconds(Delay), () =>
            {
                if (m.Backpack == null)
                {
                    m.SendGump(new CraftGump(m, this, tool, null));
                }

                Container pack = m.Backpack;

                Dictionary <int, int> cloth = new Dictionary <int, int>();
                List <Item> toConsume       = new List <Item>();
                object num = null;

                foreach (Item item in pack.Items)
                {
                    Type t = item.GetType();

                    if (t == typeof(UncutCloth) || t == typeof(Cloth) || t == typeof(CutUpCloth))
                    {
                        if (!cloth.ContainsKey(item.Hue))
                        {
                            toConsume.Add(item);
                            cloth[item.Hue] = item.Amount;
                        }
                        else
                        {
                            toConsume.Add(item);
                            cloth[item.Hue] += item.Amount;
                        }
                    }
                }

                if (cloth.Count == 0)
                {
                    num = 1044253;     // You don't have the components needed to make that.
                }
                else
                {
                    foreach (Item item in toConsume)
                    {
                        item.Delete();
                    }

                    foreach (KeyValuePair <int, int> kvp in cloth)
                    {
                        UncutCloth c = new UncutCloth(kvp.Value);
                        c.Hue        = kvp.Key;

                        DropItem(m, c, tool);
                    }
                }

                if (tool != null)
                {
                    tool.UsesRemaining--;

                    if (tool.UsesRemaining <= 0 && !tool.Deleted)
                    {
                        tool.Delete();
                        m.SendLocalizedMessage(1044038);
                    }
                    else
                    {
                        m.SendGump(new CraftGump(m, this, tool, num));
                    }
                }

                ColUtility.Free(toConsume);
                cloth.Clear();
            });
        }
Example #49
0
 private void buttonCircle_Click(object sender, EventArgs e)
 {
     tool = new FigureTool(new Figure.Circle());
 }
Example #50
0
 public CustomCraft(Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, ITool tool, int quality)
 {
     m_From        = from;
     m_CraftItem   = craftItem;
     m_CraftSystem = craftSystem;
     m_TypeRes     = typeRes;
     m_Tool        = tool;
     m_Quality     = quality;
 }
Example #51
0
 private void buttonEllipse_Click(object sender, EventArgs e)
 {
     tool = new FigureTool(new Figure.Ellips());
 }
Example #52
0
 public ToolMenuEntry(ITool tool)
 {
     Header  = tool.Header;
     Command = new AsyncCommand <object>(o => tool.LaunchAsync(), o => true);
 }
 //@Converter
 private FrameworkElement IconConverter(ITool tool) => tool.Icon;
Example #54
0
 public void SetTool(ITool tool)
 {
     _layoutTool = (LayoutTool)tool;
     _layoutTool.LayoutChanged += OnLayoutToolLayoutChanged;
 }
Example #55
0
 private void SelectTool(ITool tool)
 {
     SelectedTool = tool;
 }
Example #56
0
        public override int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            Quality = (ItemQuality)quality;

            if (makersMark)
            {
                Crafter = from;
            }

            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            Resource = CraftResources.GetFromType(resourceType);

            PlayerConstructed = true;

            CraftContext context = craftSystem.GetContext(from);

            Hue = CraftResources.GetHue(Resource);

            return(quality);
        }
Example #57
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            PlayerConstructed = true;

            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            if (!craftItem.ForceNonExceptional)
            {
                Resource = CraftResources.GetFromType(resourceType);
            }

            if (1 < craftItem.Resources.Count)
            {
                resourceType = craftItem.Resources.GetAt(1).ItemType;

                if (resourceType == typeof(StarSapphire))
                {
                    GemType = GemType.StarSapphire;
                }
                else if (resourceType == typeof(Emerald))
                {
                    GemType = GemType.Emerald;
                }
                else if (resourceType == typeof(Sapphire))
                {
                    GemType = GemType.Sapphire;
                }
                else if (resourceType == typeof(Ruby))
                {
                    GemType = GemType.Ruby;
                }
                else if (resourceType == typeof(Citrine))
                {
                    GemType = GemType.Citrine;
                }
                else if (resourceType == typeof(Amethyst))
                {
                    GemType = GemType.Amethyst;
                }
                else if (resourceType == typeof(Tourmaline))
                {
                    GemType = GemType.Tourmaline;
                }
                else if (resourceType == typeof(Amber))
                {
                    GemType = GemType.Amber;
                }
                else if (resourceType == typeof(Diamond))
                {
                    GemType = GemType.Diamond;
                }
            }

            #region Mondain's Legacy
            m_Quality = (ItemQuality)quality;

            if (makersMark)
            {
                m_Crafter = from;
            }
            #endregion

            return(1);
        }
Example #58
0
 public FlexWorker(ITool toolToUse)
 {
     _someTool = toolToUse;
 }
Example #59
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            Timer.DelayCall(() => SendTarget(from));

            return(quality);
        }
Example #60
0
 private void buttonDraw_Click(object sender, EventArgs e)
 {
     tool = new PenTool();
 }