Inheritance: BaseInventoryEditor
Beispiel #1
0
        public void ClearCurrentEditor( )
        {
            if( _currentEditor != null )
            {
                _currentEditor.PreviewEndedReadyForCreation -= ( s, e ) => _whenEntityReadyToBeAdded( ) ;
            }

            _currentEditor = null ;
        }
		protected override void OnInit(EventArgs e)
		{
			base.OnInit(e);

			foreach (var a in Find.EnumerateParents(Selection.SelectedItem, null, true))
			{
				var ie = new ItemEditor();
				phAncestors.Controls.Add(ie);
				ie.ContainerTypeFilter = typeof(RecursiveContainerAttribute);
				ie.CurrentItem = a;
			}
		}
        static void Main(string[] args)
        {
            "Testing ItemEditor Package".title('=');
            WriteLine();
            ItemEditorTest iET =  new ItemEditorTest();
            iET.insertData(db);
            DBEngine<int,DBElement<int,string>> db = new DBEngine<int, DBElement<int, string>>();
            
            ItemEditor<int, DBElement<int,string>> iEditor = new ItemEditor<int, DBElement<int,string>>(db);
            "\n1) Editing metadata".title();
            "\nBefore editing metadata for key 1".title();
            db.showDB();
            "\nAfter editing metadata for key 1".title();
            iEditor = new ItemEditor<int, DBElement<int, string>>(db);
            iEditor.editMetaData(1, "Sachin Tendulkar", "Cricket player");                     //send the values to be edited to the editMetaData() function
            db.showDB();
            WriteLine();

            "\n2) Adding children".title();
            "\nBefore adding relationship(children) for key 1".title();
            db.showDB();
            "\nAfter adding relationship(children) for Key 1".title();
            iEditor.addrelationships(1, new List<int> { 3 });                                //send a new list with children to be added to a key
            db.showDB();
            WriteLine();

            "\n3) Deleting children".title();
            "\nBefore deleting relationship(children) for key 1".title();
            db.showDB();
            WriteLine();
            "\nAfter deleting relationship(children) to Key 1".title();                           //send a new list with children to be deleted from a key
            iEditor.deleteRelationships(1, new List<int> { 3 });
            db.showDB();
            WriteLine();

            "\n4) Replacing value instance".title();
            DBElement<int, string> elem = new DBElement<int, string>();                         //create a new element for replacing value
            elem.name = "Messi";
            elem.payload = "Plays for Argentina";
            elem.descr = "Football player";
            elem.children.AddRange(new List<int> { 2 });
            elem.timeStamp = DateTime.Now;

            "\nBefore replacing the value instance for key 2".title();
            db.showDB();
            WriteLine();
            "\nAfter replacing the value instance for key 2".title();
            iEditor.replaceValueInstance(2, elem);                                              //send value to be replaced for a key
            db.showDB();
        }
 protected override Control AddEditor(Control container)
 {
     var panel = AddPanel(container);
     foreach (var themeDirectory in GetThemeDirectories())
     {
         var themeName = Path.GetFileName(themeDirectory);
         if (string.IsNullOrEmpty(themeName)) continue;
         var tabContainer = new TabContainerAttribute(themeName + "-tab", themeName, 0);
         var tab = tabContainer.AddTo(panel) as TabPanel;
         var editor = new ItemEditor { ID = themeName.ToLower() };
         editor.Init += OnChildEditorInit;
         tab.Controls.Add(editor);
         AddValidator(tab);
     }
     return panel;
 }
Beispiel #5
0
		public void ItemEditor_AddsNewChild()
		{
			var item = new DecoratedItem();
			var definition = new DefinitionMap().GetOrCreateDefinition(item);
			var editable = (EditableItemAttribute)definition.Properties["TheItem"].Editable;

			var page = new Page();
			var enclosingEditor = new ItemEditor();
			var editor = AddEditorAndInit(item, editable, page, enclosingEditor);

			editable.UpdateEditor(item, editor);
			
			ItemUtility.FindInChildren<N2.Web.UI.WebControls.NameEditor>(editor).Single().Text = "Hello child";

			enclosingEditor.UpdateObject(new N2.Edit.Workflow.CommandContext(definition, item, Interfaces.Editing, engine.RequestContext.User));

			item.Children.Single().ShouldBe(item.TheItem);
		}
 private void InitializeAllComponents()
 {
     TablesController       = new System.Windows.Forms.TabControl();
     recipesTable           = new System.Windows.Forms.TabPage();
     createNewRecipeButton  = new System.Windows.Forms.Button();
     TextBoxForSearchRecipe = new System.Windows.Forms.TextBox();
     recipeSearch           = new System.Windows.Forms.Label();
     recipeGrid             = new System.Windows.Forms.DataGridView();
     recipeNameColumn       = new System.Windows.Forms.DataGridViewTextBoxColumn();
     deleteRecipeColumn     = new System.Windows.Forms.DataGridViewButtonColumn();
     recipeIdColumn         = new System.Windows.Forms.DataGridViewTextBoxColumn();
     recipeEditor           = new RecipeBook.Gui.EditRecipe();
     TableOfItems           = new System.Windows.Forms.TabPage();
     itemEditor             = new RecipeBook.Gui.ItemEditor();
     createNewItem          = new System.Windows.Forms.Button();
     TextBoxForSearchItem   = new System.Windows.Forms.TextBox();
     IngredientSearch       = new System.Windows.Forms.Label();
     IngredientTableCreator = new System.Windows.Forms.DataGridView();
     IngredientNameColumn   = new System.Windows.Forms.DataGridViewTextBoxColumn();
     IngredientDeleteColumn = new System.Windows.Forms.DataGridViewButtonColumn();
     IngredientIdColumn     = new System.Windows.Forms.DataGridViewTextBoxColumn();
 }
Beispiel #7
0
    private void OnEnable()
    {
        m_Target = target as EquipmentItem;
        m_EquippedEffectListProperty = serializedObject.FindProperty(nameof(EquipmentItem.EquippedEffects));

        m_SlotProperty = serializedObject.FindProperty(nameof(EquipmentItem.Slot));

        m_MinimumStrengthProperty = serializedObject.FindProperty(nameof(EquipmentItem.MinimumStrength));
        m_MinimumAgilityProperty  = serializedObject.FindProperty(nameof(EquipmentItem.MinimumAgility));
        m_MinimumDefenseProperty  = serializedObject.FindProperty(nameof(EquipmentItem.MinimumDefense));

        m_ItemEditor = new ItemEditor();
        m_ItemEditor.Init(serializedObject);

        var lookup = typeof(EquipmentItem.EquippedEffect);

        m_AvailableEquipEffectType = System.AppDomain.CurrentDomain.GetAssemblies()
                                     .SelectMany(assembly => assembly.GetTypes())
                                     .Where(x => x.IsClass && !x.IsAbstract && x.IsSubclassOf(lookup))
                                     .Select(type => type.Name)
                                     .ToList();
    }
        protected override Control AddEditor(Control container)
        {
            var panel = AddPanel(container);

            foreach (var themeDirectory in GetThemeDirectories())
            {
                var themeName = Path.GetFileName(themeDirectory);
                if (string.IsNullOrEmpty(themeName))
                {
                    continue;
                }
                var tabContainer = new TabContainerAttribute(themeName + "-tab", themeName, 0);
                var tab          = tabContainer.AddTo(panel) as TabPanel;
                var editor       = new ItemEditor {
                    ID = themeName.ToLower()
                };
                editor.Init += OnChildEditorInit;
                tab.Controls.Add(editor);
                AddValidator(tab);
            }
            return(panel);
        }
        public async Task Suspend(ItemEditor itemEditor)
        {
            var Items = VM.Vm;

            var composite = itemEditor.OnSuspending();

            ApplicationData.Current.LocalSettings.Values[pageName] = composite;

            if (Items.SelectedItem != null)
            {
                ApplicationData.Current.LocalSettings.Values[selected] = Items.Items.IndexOf(Items.SelectedItem);
            }

            byte[]      pixels  = itemEditor.Current.Pixels;
            StorageFile imgFile = await PictureHandler.AsStorageFile(pixels, "Current.jpg");

            if (ExistsImgFile(current))
            {
                StorageApplicationPermissions.FutureAccessList.Remove((string)ApplicationData.Current.LocalSettings.Values[current]);
            }
            ApplicationData.Current.LocalSettings.Values[current] = StorageApplicationPermissions.FutureAccessList.Add(imgFile);
            //TileService.threadPoolTimer.Cancel();
        }
	public void InitWindows()
	{
		Skin = (GUISkin)Resources.Load("GUI/EditorGUI");
		
		//windows init
		npcEditor = new NPCEditor(Skin, this);

		armorEditor = new ArmorEditor(Skin, this);

		arenaEditor = new ArenaEditor(Skin, this);

		enemyEditor = new EnemyEditor(Skin, this);

		currencyEditor = new CurrencyEditor(Skin, this);
		
		conversationEditor = new ConversationEditor(Skin, this);
		
		shopEditor = new ShopEditor(Skin, this);

		questEditor = new QuestEditor(Skin, this);
		
		itemEditor = new  ItemEditor(Skin, this);

		minigameEditor = new MiniGameEditor(Skin, this);

		serviceEditor = new ServiceEditor(Skin, this);

		npcQuestEditor = new NPCQuestEditor(Skin, this);

		townEditor = new TownEditor(Skin, this);

		badgeEditor = new BadgeEditor(Skin, this);
		
		constructionEditor = new ConstructionEditor(Skin, this);

		loadWindows = false;
	}
Beispiel #11
0
    void TestR4(){//support editing of value including the addition and/or deletion of relationships, 
                  //editing text metadata and replacing an existing value's instance with a new instance

            "Demonstrating Requirement #4".title();

        DBElement<int, string> temp = new DBElement<int, string>();
        ItemEditor<int, string> editItem;
		
        if (db.containsKey(2)){
            db.getValue(2, out temp);
			Write("\n\n --- value before modified---\n");
			temp.showElement();
            editItem = new ItemEditor<int, string>(temp);
			editItem.nameEdit("newName!!");//edit the name of the value with key 2
			editItem.descrEdit("new description!!");//edit description
			editItem.dateTimeEdit();//update timeStamp
			editItem.addRelationship(18);//add relationship
			editItem.deleteRelationship(6);//delete relationship
			editItem.payloadEdit("new payload!!");//modify payload
			
			DBElement<int, string> elemNew = new DBElement<int, string>();
			editItem.replaceWithInstance(out elemNew);// replace an existing value's instance with a new instance
			temp = null;
			Write("\n\n --- value after modified---\n");
			elemNew.showElement();
            editItem = null;
        }

        else
			Write("Value not found!");
		
      //Write("\n\n Show key/value pairs in data base:\n");
	  //db.showDB();
      WriteLine();
      WriteLine();
    }
Beispiel #12
0
        public StagePage()
        {
            InitializeComponent();

            _propertyGrid              = new MXPropertyGrid();
            _propertyGrid.Visible      = false;
            _propertyGrid.Dock         = DockStyle.Fill;
            _propertyGrid.PropertySort = PropertySort.Categorized;
            contentPanel.Controls.Add(_propertyGrid);

            _itemEditor         = new ItemEditor();
            _itemEditor.Visible = false;
            _itemEditor.Dock    = DockStyle.Fill;
            contentPanel.Controls.Add(_itemEditor);

            _playListEditor         = new PlaylistEditor();
            _playListEditor.Visible = false;
            _playListEditor.Dock    = DockStyle.Fill;
            contentPanel.Controls.Add(_playListEditor);

            listBoxStage.DataSource = Core.MEX.Stages;

            SelectTab(buttonGeneralTab, null);
        }
Beispiel #13
0
        private static void DownloadAll()
        {
            var downloader = new Action <float>[]
            {
                (p) => Download(typeof(MasterDataItem), p, m => ItemEditor.Load(m.Item), false),
                (p) => Download(typeof(MasterDataCell), p, m => CellEditor.Load(m.Cell), false),
                (p) => Download(typeof(MasterDataCellEvent), p, m => CellEventEditor.Load(m.CellEvent), false),
                (p) => Download(typeof(MasterDataLevelUpCost), p, m => LevelUpCostEditor.Load(m.LevelUpCost), false),
                (p) => Download(typeof(MasterDataHousingLevelParameter), p, m => HousingLevelParameterEditor.Load(m.HousingLevelParameter), false),
                (p) => Download(typeof(MasterDataFacilityLevelParameter), p, m => FacilityLevelParameterEditor.Load(m.FacilityLevelParameter), false),
                (p) => Download(typeof(MasterDataRoadLevelParameter), p, m => RoadLevelParameterEditor.Load(m.RoadLevelParameter), false),
                (p) => Download(typeof(MasterDataUnlockCellEvent), p, m => UnlockCellEventEditor.Load(m.UnlockCellEvent), false),
                (p) => Download(typeof(MasterDataCellBundle), p, m => CellBundleEditor.Load(m.CellBundle), false),
                (p) => Download(typeof(MasterDataUnlockCellBundle), p, m => UnlockCellBundleEditor.Load(m.UnlockCellBundle), false),
            };

            for (var i = 0; i < downloader.Length; i++)
            {
                var progress = (float)i / downloader.Length;
                downloader[i](progress);
            }

            EditorUtility.ClearProgressBar();
        }
Beispiel #14
0
        public void AddEditor( ItemEditor editor )
        {
            var possibleDuplicate = allEditors( ).FirstOrDefault( e => e.Name == editor.Name ) ;

            if (possibleDuplicate!=null)
            {
                throw new InvalidOperationException(
                    @"Cannot add editor '{0}' into layer '{1}' as an editor of the same name exists in layer '{2}'.".FormatWith(
                        editor.Name, editor.ParentLayer.Name, possibleDuplicate.ParentLayer.Name ) ) ;
            }

            if (allEditors().Any(e => e == editor ) )
            {
                throw new InvalidOperationException(
                    @"Cannot add editor '{0}' into layer '{1}' as the same editor has already been added.".FormatWith(
                        editor.Name, editor.ParentLayer.Name ) ) ;
            }

            editor.ParentLayer.AddEditor( editor );

            ActiveLayer = editor.ParentLayer ;
        }
Beispiel #15
0
 protected virtual void AddToContainer(Control container, ItemEditor itemEditor, ContentItem item)
 {
     var fs = new FieldSet();
     fs.Legend = Engine.Definitions.GetDefinition(item).Title;
     container.Controls.Add(fs);
     fs.Controls.Add(itemEditor);
 }
Beispiel #16
0
	public int editValue(XDocument message){//method used to do value edition
		DBElement<int, string> temp = new DBElement<int, string>();
        XElement element = message.Element("Message").Element("Key");
        int key = Int32.Parse(element.Value);
		if(db.containsKey(key)){
			db.getValue(key, out temp);
			ItemEditor<int, string> editItem = new ItemEditor<int, string>(temp);
			element = message.Element("Message").Element("EditType");
			switch(element.Value){
				case "nameEdit":
					element = message.Element("Message").Element("NewName");
					editItem.nameEdit(element.Value);
					break;
				case "descrEdit":
					element = message.Element("Message").Element("NewDescr");
					editItem.descrEdit(element.Value);
					break;
				case "timeUpdate":
					editItem.dateTimeEdit();
					break;
				case "addRelationship":
					element = message.Element("Message").Element("ChildKey");
					editItem.addRelationship(Int32.Parse(element.Value));
					break;
				case "deleteRelationship":
					element = message.Element("Message").Element("ChildKey");
					editItem.deleteRelationship(Int32.Parse(element.Value));
					break;
				case "payloadEdit":
					element = message.Element("Message").Element("NewPayload");
					editItem.payloadEdit(element.Value);
					break;
				case "replaceWithInstance":
					DBElement<int, string> elemNew = new DBElement<int, string>();
					editItem.replaceWithInstance(out elemNew);
					temp = null;
					break;
				default:
					Write("Invalid editing type.");
					break;
			}
		}
		else
			key = -1;
		return key;
	}
Beispiel #17
0
        public void Update( )
        {
            //get item under mouse cursor

            var model = ObjectFactory.GetInstance <IModel>( );

            ItemEditor item = _canvas.ItemUnderMouse;

            bool controlButtonPressed = KeyboardStatus.IsKeyDown(Keys.LeftControl);

            if (item != null)
            {
                _mainForm.SetToolStripStatusLabel1(item.ItemProperties.Name);

                item.OnMouseOver(MouseStatus.WorldPosition);

                if (controlButtonPressed)
                {
                    _mainForm.SetCursorForCanvas(_cursorDuplicate);
                }
            }
            else
            {
                _mainForm.SetToolStripStatusLabel1(string.Empty);
            }

            if (item != _lastItem && _lastItem != null)
            {
                _lastItem.OnMouseOut( );
            }

            _lastItem = item;

            IEnumerable <ITreeItem> editors = selectedEditors( ).ToList(  );

            if (MouseStatus.IsNewLeftMouseButtonClick() || KeyboardStatus.IsNewKeyPress(Keys.D1))
            {
                if (item != null)
                {
                    item.OnMouseButtonDown(MouseStatus.WorldPosition);
                }

                if (controlButtonPressed && item != null)
                {
                    _canvas.StartCopyingSelectedItems( );
                }
                else if (KeyboardStatus.IsKeyDown(Keys.LeftShift) && item != null)
                {
                    model.ToggleSelectionOnItem(item);
                }
                else if (editors.Contains(item))
                {
                    _canvas.StartMovingSelectedItems( );
                }
                else if (!selectedEditors().Contains(item))
                {
                    if (item != null)
                    {
                        _model.SelectEditor(item);
                        _canvas.StartMovingSelectedItems(  );
                    }
                    else
                    {
                        _canvas.CreateSelectionRectangle( );
                    }
                }
            }

            //MIDDLE MOUSE BUTTON CLICK
            bool anyEditorsSelected = editors.Any();

            if (MouseStatus.IsNewMiddleMouseButtonClick( ) || KeyboardStatus.IsNewKeyPress(Keys.D2))
            {
                if (item != null)
                {
                    item.OnMouseOut( );
                }

                if (controlButtonPressed)
                {
                    _canvas.StartMovingCamera( );
                }
                else
                {
                    if (anyEditorsSelected)
                    {
                        _canvas.StartRotatingItems( );
                    }
                }
            }

            //RIGHT MOUSE BUTTON CLICK
            if (MouseStatus.IsNewRightMouseButtonClick( ) || KeyboardStatus.IsNewKeyPress(Keys.D3))
            {
                if (item != null)
                {
                    item.OnMouseOut( );
                }

                if (anyEditorsSelected)
                {
                    _canvas.StartScalingSelectedItems( );
                }
            }

            selectedEditors(  ).ForEach(e => e.HandleKeyPressWhenFocused());
        }
Beispiel #18
0
    static void ShowEditWindow()
    {
        ItemEditor myWindow = (ItemEditor)EditorWindow.GetWindow(typeof(ItemEditor), false, "", true); //创建窗口

        myWindow.Show();                                                                               //展示
    }
		protected override Control AddEditor(Control panel)
		{
			ItemEditor editor = new ItemEditor();
			editor.ID = Name;
			editor.ZoneName = DefaultChildZoneName;
			editor.Init += OnChildEditorInit;
			panel.Controls.Add(editor);
			return editor;
		}
Beispiel #20
0
        public void MoveItemToLayer( ItemEditor itemToMove, LayerEditor layer, ItemEditor itemToMoveNewItemUnder )
        {
            int insertPosition = itemToMoveNewItemUnder == null ? 0 : layer.Items.IndexOf( itemToMoveNewItemUnder ) ;

            itemToMove.ParentLayer.Items.Remove( itemToMove ) ;

            layer.Items.Insert( insertPosition, itemToMove ) ;

            itemToMove.ParentLayer = layer ;
        }
Beispiel #21
0
        void addNodeForEditor( TreeNode parentNode, ItemEditor editor )
        {
            ItemProperties itemProperties = editor.ItemProperties ;

            TreeNode itemNode = parentNode.Nodes.Add( itemProperties.Name, itemProperties.Name ) ;

            itemNode.ImageKey = itemNode.SelectedImageKey = editor.Icon.Name ;
            itemNode.Tag = editor ;
            itemNode.Checked = true ;

            itemNode.ContextMenuStrip = _hideContextMenus ? null : uiContextMenuForItem ;

            editor.Behaviours.ForEach(
                b =>
                    {
                        BehaviourProperties behaviourProperties = b.BehaviourProperties ;
                        TreeNode node = itemNode.Nodes.Add( behaviourProperties.Name, behaviourProperties.Name ) ;

                        //node.ImageKey = node.SelectedImageKey = b.Icon.Name ;

                        node.Tag = b ;

                        node.Checked = true ;

                        //node.ContextMenuStrip = _hideContextMenus ? null : uiContextMenuForItem ;
                    } ) ;

            itemNode.Expand(  );
        }
Beispiel #22
0
        public static void RenderDebug(JsonValue root)
        {
            if (root.InputInt("Mana Usage", "mana", 0) > 0)
            {
                var b = root["mdr"].Int(0);

                if (ImGui.Combo("Place Mana", ref b, manaDropNames, manaDropNames.Length))
                {
                    root["mdr"] = b;
                }
            }

            if (ImGui.TreeNode("Stats"))
            {
                root.Checkbox("To Cursor", "cursor", false);
                root.Checkbox("To Cloest Target", "tomb", false);
                root.InputFloat("Damage", "damage");
                root.InputInt("Projectile Count", "amount");
                root.InputText("Sound", "sfx", "item_gun_fire");
                root.InputInt("Sound Prefix Number", "sfxn", 0);
                root.Checkbox("Reload Sound", "rsfx", false);
                root.Checkbox("Drop Shells", "shells", true);
                root.Checkbox("Uses Emeralds", "emeralds", false);

                var c = root.InputText("Color", "color");

                if (!string.IsNullOrEmpty(c) && !ProjectileColor.Colors.ContainsKey(c))
                {
                    ImGui.BulletText("Unknown color");
                }

                ImGui.Separator();

                root.InputFloat("Min Speed", "speed", 10);
                root.InputFloat("Max Speed", "speedm", 10);
                root.Checkbox("Disable Boost", "dsb", false);

                ImGui.Separator();

                root.InputFloat("Min Scale", "scale");
                root.InputFloat("Max Scale", "scalem");

                ImGui.Separator();

                var range = (float)root["range"].Number(0);

                if (ImGui.InputFloat("Range", ref range))
                {
                    root["range"] = range;
                }

                var knockback = (float)root["knockback"].Number(1);

                if (ImGui.InputFloat("Knockback", ref knockback))
                {
                    root["knockback"] = knockback;
                }

                root.InputFloat("Additional Angle", "ang", 0);
                var accuracy = (float)root["accuracy"].Number(0);

                if (ImGui.InputFloat("Accuracy", ref accuracy))
                {
                    root["accuracy"] = accuracy;
                }

                var light = root["light"].Bool(true);

                if (ImGui.Checkbox("Light", ref light))
                {
                    root["light"] = light;
                }

                var rect = root["rect"].Bool(false);

                if (ImGui.Checkbox("Rect body", ref rect))
                {
                    root["rect"] = rect;
                }

                var wait = root["wait"].Bool(false);

                if (ImGui.Checkbox("Wait for projectile death", ref wait))
                {
                    root["wait"] = wait;
                }

                var prefab = root["prefab"].String("");

                if (ImGui.InputText("Prefab", ref prefab, 128))
                {
                    root["prefab"] = prefab;
                }

                if (prefab.Length > 0 && ProjectileRegistry.Get(prefab) == null)
                {
                    ImGui.BulletText("Unknown prefab");
                }

                var slice = root["texture"].String("rect");

                if (slice == "default")
                {
                    slice = "rect";
                }

                var region = CommonAse.Projectiles.GetSlice(slice, false);

                if (region != null)
                {
                    ImGui.Image(ImGuiHelper.ProjectilesTexture, new Num.Vector2(region.Width * 3, region.Height * 3),
                                new Num.Vector2(region.X / region.Texture.Width, region.Y / region.Texture.Height),
                                new Num.Vector2((region.X + region.Width) / region.Texture.Width,
                                                (region.Y + region.Height) / region.Texture.Height));
                }

                if (ImGui.InputText("Texture", ref slice, 128))
                {
                    root["texture"] = slice;
                }

                ImGui.TreePop();
            }

            if (ImGui.TreeNode("Modifiers"))
            {
                if (!root["modifiers"].IsJsonArray)
                {
                    root["modifiers"] = new JsonArray();
                }

                ItemEditor.DisplayUse(root, root["modifiers"], "bk:ModifyProjectiles");
                ImGui.TreePop();
            }
        }
Beispiel #23
0
    public void InitWindows()
    {
        Skin = (GUISkin)Resources.Load("GUI/EditorGUI");

        //windows init
        npcEditor = new NPCEditor(Skin, this);

        //weaponEditor = new WeaponEditor(Skin, this);

        //worldObjectEditor = new WorldObjectEditor(Skin, this);

        //questEditor = new QuestEditor(Skin, this);

        //itemCategory = new ItemCategoryEditor(Skin, this);

        //skillEditor = new SkillEditor(Skin, this);

        //attributeEditor = new AttributeEditor(Skin, this);

        armorEditor = new ArmorEditor(Skin, this);

        //equipmentSlotEditor = new EquipmentSlotEditor(Skin, this);

        //teleportEditor = new TeleportEditor(Skin, this);

        //conversationEditor = new ConversationEditor(Skin, this);

        shopEditor = new ShopEditor(Skin, this);

        //spellEditor = new SpellEditor(Skin, this);

        //enemyEditor = new EnemyEditor(Skin, this);

        //containerEditor = new ContainerEditor(Skin, this);

        itemEditor = new  ItemEditor(Skin, this);

        //spellShop = new SpellShopEditor(Skin, this);

        //classEditor = new ClassEditor(Skin, this);
        //
        //raceEditor = new RaceEditor(Skin, this);

        //guildEditor = new GuildEditor(Skin, this);

        //reputationEditor = new ReputationEditor(Skin, this);

        //sceneEditor = new SceneEditor(Skin, this);

        //spawnEditor = new SpawnPointEditor(Skin, this);

        //questCategoryEditor = new QuestCategoryEditor(Skin, this);

        //validate = new Validate();
        loadWindows = false;
    }
Beispiel #24
0
 public AddEditorToSelectionAction(ItemEditor editor)
 {
     _editor = editor;
 }
Beispiel #25
0
 public void NotifyChanged( ItemEditor item )
 {
     tryFire( ( ) => ItemChanged, item ) ;
 }
Beispiel #26
0
        public static unsafe void RenderDebug(string id, JsonValue parent, JsonValue root)
        {
            if (ImGui.TreeNode("Origin"))
            {
                var v      = new System.Numerics.Vector2((float)root["ox"].AsNumber * 3, (float)root["oy"].AsNumber * 3);
                var region = CommonAse.Items.GetSlice(id);
                var m      = ImGui.GetScrollY();
                var pos    = ImGui.GetWindowPos() + ImGui.GetCursorPos() - new System.Numerics.Vector2(0, m);

                if (ImGui.IsMouseDown(1))
                {
                    v = ImGui.GetMousePos() - pos;

                    if (!(v.X < 0) && !(v.Y < 0) && !(v.X > region.Width * 3) && !(v.Y > region.Height * 3))
                    {
                        if (snapGrid)
                        {
                            v.X = (float)(Math.Floor(v.X / 3) * 3);
                            v.Y = (float)(Math.Floor(v.Y / 3) * 3);
                        }

                        v.X = VelcroPhysics.Utilities.MathUtils.Clamp(v.X, 0, region.Width * 3);
                        v.Y = VelcroPhysics.Utilities.MathUtils.Clamp(v.Y, 0, region.Height * 3);

                        root["ox"] = v.X / 3f;
                        root["oy"] = v.Y / 3f;
                    }
                }

                ImGuiNative.ImDrawList_AddRect(ImGui.GetWindowDrawList(), pos - new System.Numerics.Vector2(1, 1),
                                               pos + new System.Numerics.Vector2(region.Width * 3 + 1, region.Height * 3 + 1),
                                               ColorUtils.WhiteColor.PackedValue, 0, 0, 1);

                ItemEditor.DrawItem(region);

                ImGuiNative.ImDrawList_AddCircleFilled(ImGui.GetWindowDrawList(), pos + v, 3, ColorUtils.WhiteColor.PackedValue,
                                                       8);

                v /= 3f;

                ImGui.Checkbox("Snap to grid", ref snapGrid);

                if (ImGui.InputFloat2("Origin", ref v))
                {
                    root["ox"] = v.X;
                    root["oy"] = v.Y;
                }

                if (ImGui.Button("tx"))
                {
                    root["ox"] = 0;
                }

                ImGui.SameLine();

                if (ImGui.Button("ty"))
                {
                    root["oy"] = 0;
                }

                if (ImGui.Button("cx"))
                {
                    root["ox"] = region.Width / 2f;
                }

                ImGui.SameLine();

                if (ImGui.Button("cy"))
                {
                    root["oy"] = region.Height / 2f;
                }

                if (ImGui.Button("bx"))
                {
                    root["ox"] = region.Width;
                }

                ImGui.SameLine();

                if (ImGui.Button("by"))
                {
                    root["oy"] = region.Height;
                }

                ImGui.TreePop();
            }

            if (ImGui.TreeNode("Nozzle"))
            {
                var v      = new System.Numerics.Vector2((float)root["nx"].AsNumber * 3, (float)root["ny"].AsNumber * 3);
                var region = CommonAse.Items.GetSlice(id);
                var m      = ImGui.GetScrollY();
                var pos    = ImGui.GetWindowPos() + ImGui.GetCursorPos() - new System.Numerics.Vector2(0, m);

                if (ImGui.IsMouseDown(1))
                {
                    v = ImGui.GetMousePos() - pos;

                    if (!(v.X < 0) && !(v.Y < 0) && !(v.X > region.Width * 3) && !(v.Y > region.Height * 3))
                    {
                        if (snapGrid)
                        {
                            v.X = (float)(Math.Floor(v.X / 3) * 3);
                            v.Y = (float)(Math.Floor(v.Y / 3) * 3);
                        }

                        v.X = VelcroPhysics.Utilities.MathUtils.Clamp(v.X, 0, region.Width * 3);
                        v.Y = VelcroPhysics.Utilities.MathUtils.Clamp(v.Y, 0, region.Height * 3);

                        root["nx"] = v.X / 3f;
                        root["ny"] = v.Y / 3f;
                    }
                }

                ImGuiNative.ImDrawList_AddRect(ImGui.GetWindowDrawList(), pos - new System.Numerics.Vector2(1, 1),
                                               pos + new System.Numerics.Vector2(region.Width * 3 + 1, region.Height * 3 + 1),
                                               ColorUtils.WhiteColor.PackedValue, 0, 0, 1);

                ItemEditor.DrawItem(region);

                ImGuiNative.ImDrawList_AddCircleFilled(ImGui.GetWindowDrawList(), pos + v, 3, ColorUtils.WhiteColor.PackedValue,
                                                       8);

                v /= 3f;

                ImGui.Checkbox("Snap to grid", ref snapGrid);

                if (ImGui.InputFloat2("Nozzle", ref v))
                {
                    root["nx"] = v.X;
                    root["ny"] = v.Y;
                }

                if (ImGui.Button("tx"))
                {
                    root["nx"] = 0;
                }

                ImGui.SameLine();

                if (ImGui.Button("ty"))
                {
                    root["ny"] = 0;
                }

                if (ImGui.Button("cx"))
                {
                    root["nx"] = region.Width / 2f;
                }

                ImGui.SameLine();

                if (ImGui.Button("cy"))
                {
                    root["ny"] = region.Height / 2f;
                }

                if (ImGui.Button("bx"))
                {
                    root["nx"] = region.Width;
                }

                ImGui.SameLine();

                if (ImGui.Button("by"))
                {
                    root["oy"] = region.Height;
                }

                ImGui.TreePop();
            }
        }
Beispiel #27
0
            public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
            {
                ItemEditor editor = ((ItemEditor)context.Instance);

                return(new StandardValuesCollection(GetValues(editor.Item.Dictionary)));
            }
Beispiel #28
0
 public static void NewItem(bool isFavorite = false)
 {
     newItem = new ItemEditor(EditorMode.NewItem);
     newItem.checkBoxFavorite.Checked = isFavorite;
     newItem.ShowDialog();
 }
Beispiel #29
0
 private void mItemIncl_Click(object sender, EventArgs e)
 {
     ItemEditor.Show();
 }
Beispiel #30
0
 private ItemEditor AddItemEditor(ContentItem item, Control container)
 {
     var itemEditor = new ItemEditor();
     itemEditor.ID = ID + "_ie_" + itemEditorIndex;
     container.Controls.Add(itemEditor);
     itemEditor.ZoneName = ZoneName;
     itemEditors.Add(itemEditor);
     itemEditor.CurrentItem = item;
     return itemEditor;
 }
Beispiel #31
0
 public SettlementMarket()
 {
     resizeable = false;
     itemsMenu  = new ItemEditor();
 }
Beispiel #32
0
        public void SelectEditor( ItemEditor editor )
        {
            Level.ClearSelectedEditors( ) ;

            setActiveLayerIfItsDifferent( editor.ParentLayer ) ;

            Level.SelectEditor( editor ) ;

            tryFire( ( ) => SelectionChanged, editor ) ;
        }
Beispiel #33
0
 private void bItemListEditor_Click(object sender, EventArgs e)
 {
     ItemEditor.Show();
 }
Beispiel #34
0
 public ItemController()
 {
     itemEditor = new ItemEditor();
 }
Beispiel #35
0
 internal static void GenerateAll()
 {
     PanelEditor.GeneratePanel();
     ItemEditor.GenerateItem();
 }
Beispiel #36
0
 private static void DownloadItem()
 {
     Download(typeof(MasterDataItem), 1.0f, m => ItemEditor.Load(m.Item));
 }
Beispiel #37
0
        public void AddEditorToSelection( ItemEditor editor )
        {
            Level.SelectEditor( editor ) ;

            tryFire( ( ) => SelectionChanged, Level.SelectedEditors ) ;
        }
Beispiel #38
0
 private void LoadItems(string FileName, ItemEditor IE)
 {
     this.PWD = new PleaseWaitDialog(I18N.GetText("Dialog:LoadItems"));
     Thread T = new Thread(new ThreadStart(delegate() { this.LoadItemsWorker(FileName, IE); }));
       T.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
       T.Start();
       PWD.ShowDialog(this);
       this.Activate();
       this.PWD.Dispose();
       this.PWD = null;
       this.EnableNavigation();
       this.MarkItemChanges();
 }
        private static void FillChildItems(ref int key, int?parent, dynamic configuration, ItemEditor editor,
                                           ICollection <object> treeItems)
        {
            // Контейнер дочерних элементов
            dynamic container = new DynamicWrapper();

            container.Key      = ++key;
            container.Parent   = parent;
            container.Text     = editor.Container;
            container.Image    = editor.Image;
            container.ConfigId = configuration.Name;
            treeItems.Add(container);

            var childItems = configuration[editor.Container] as IEnumerable;

            if (childItems != null)
            {
                var orderedChildItems = childItems.Cast <dynamic>().OrderBy(i => i.Name);

                // Список дочерних элементов контейнера
                foreach (var childItem in orderedChildItems)
                {
                    dynamic treeItem = new DynamicWrapper();
                    treeItem.Key          = ++key;
                    treeItem.Parent       = container.Key;
                    treeItem.Text         = FormatItemText(childItem);
                    treeItem.ItemId       = childItem.Name;
                    treeItem.ConfigId     = configuration.Name;
                    treeItem.MetadataType = editor.MetadataType;
                    treeItems.Add(treeItem);
                }
            }
        }
Beispiel #40
0
 private void LoadItemsWorker(string FileName, ItemEditor IE)
 {
     ThingList<Item> TL = new ThingList<Item>();
       if (TL.Load(FileName)) {
     if (IE == this.ieLeft)
       this.LeftItems = TL;
     else
       this.RightItems = TL;
       }
       this.LeftItemsShown  = null;
       this.RightItemsShown = null;
       if (this.RightItems == null && this.LeftItems == null)
     this.CurrentItem = -1;
       else
     this.CurrentItem = 0;
       // In general, this tool supports comparing heterogenic item sets (as useless as that may be).
       // However, the 2010-09-09 patch prepended a range of 1024 armor pieces to the previous range (so 0x2800-0x4000 instead of 0x2C00-0x4000).
       // So we detect that specific case and cope with it padding the shorter set at the front (with nulls); this also means we should drop leading null entries whenever
       // a new set is loaded.
       while (this.LeftItems != null && this.LeftItems.Count > 0 && this.LeftItems[0] == null)
     this.LeftItems.RemoveAt(0);
       while (this.RightItems != null && this.RightItems.Count > 0 && this.RightItems[0] == null)
     this.RightItems.RemoveAt(0);
       if (this.RightItems != null && this.LeftItems != null) {
     if (this.LeftItems.Count != this.RightItems.Count) {
     uint LID = (uint) this.LeftItems [0].GetFieldValue("id");
     uint RID = (uint) this.RightItems[0].GetFieldValue("id");
       if (LID == 0x2800 && RID == 0x2c00) this.RightItems.InsertRange(0, new Item[0x400]);
       if (LID == 0x2c00 && RID == 0x2800) this.LeftItems .InsertRange(0, new Item[0x400]);
     }
     this.btnRemoveUnchanged.Invoke(new AnonymousMethod(delegate () { this.btnRemoveUnchanged.Enabled = true; }));
       }
       this.PWD.Invoke(new AnonymousMethod(delegate() { this.PWD.Close(); }));
 }
 public AddEditorToSelectionAction( ItemEditor editor )
 {
     _editor = editor ;
 }
Beispiel #42
0
        private static void OnCreateItem(object parameter)
        {
            var editor = new ItemEditor(new ItemWrapper());

            editor.Show();
        }
Beispiel #43
0
        public void SelectEditor( ItemEditor editor )
        {
            LayerEditor parentLayer = editor.ParentLayer ;

            editor.IsSelected = true ;

            ActiveLayer = parentLayer ;
        }
Beispiel #44
0
        private void OnCreateWeapon(object parameter)
        {
            var editor = new ItemEditor(new WeaponWrapper());

            editor.Show();
        }
Beispiel #45
0
 private ItemEditor AddItemEditor(ContentItem item)
 {
     var itemEditor = new ItemEditor();
     itemEditor.ID = ID + "_ie_" + itemEditorIndex;
     AddToContainer(itemEditorsContainer, itemEditor, item);
     itemEditor.ZoneName = ZoneName;
     itemEditors.Add(itemEditor);
     itemEditor.CurrentItem = item;
     return itemEditor;
 }
Beispiel #46
0
 public static void Init()
 {
     window = (ItemEditor)EditorWindow.GetWindow(typeof(ItemEditor));
     window.InitTable();
 }
        public frmItems()
        {
            InitializeComponent();

            this.Text = this.Text + CommonTools.Gui.LoginData.ApplicationVersion;

            listEditors       = new System.Collections.Generic.Dictionary <EditorType, IEditor>();
            listSearchDialogs = new Dictionary <SearchDialog, ISearchDialog>();
            listSearchDialogs.Add(SearchDialog.Item, m_itemSearch);

            Restrictions.setRestrictions(chkTerranRest, chkJenquaiRest, chkProjenRest, raceRestrictionsLbl,
                                         chkWarriorRest, chkTraderRest, chkExplorerRest, professionRestrictionsLbl);

            TableIO itemsTableIO         = initializeItems();
            TableIO ammoTableIO          = initializeItemAmmo();
            TableIO beamTableIO          = initializeItemBeam();
            TableIO projectileTableIO    = initializeProjectile();
            TableIO missileTableIO       = initializeMissile();
            TableIO deviceTableIO        = initializeDevice();
            TableIO engineTableIO        = initializeEngine();
            TableIO reactorTableIO       = initializeReactor();
            TableIO shieldTableIO        = initializeShield();
            TableIO manufacturingTableIO = initializeItemManufacturing(m_itemSearch);

            manufacturingTableIO.setRecordOptional();

            // Ungrouped tables
            m_tableEditor.add(SingleTableEditor.Manufacturing, manufacturingTableIO);

            // Ammo
            ItemEditor itemEditor = new ItemEditor(m_itemSearch);

            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabAmmo, ammoTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Ammo, itemEditor);

            // Beam
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabBeam, beamTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Beam, itemEditor);

            // Projectile
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabProjectile, projectileTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Projectile, itemEditor);

            // Missile
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabMissile, missileTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Missile, itemEditor);

            // Device
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabDevice, deviceTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Device, itemEditor);

            // Engine
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabEngine, engineTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Engine, itemEditor);

            // Reactor
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabRS, reactorTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Reactor, itemEditor);

            // Shield
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(tabRS, shieldTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items_Shield, itemEditor);

            // Component
            itemEditor = new ItemEditor(m_itemSearch);
            itemEditor.addTableHandler(tabBase, itemsTableIO);
            itemEditor.addTableHandler(null, manufacturingTableIO);
            listEditors.Add(EditorType.Items, itemEditor);

            // Select the default editor
            setEditor(EditorType.Items, true);
        }
Beispiel #48
0
        /// <summary>
        ///
        /// </summary>
        public FighterPage()
        {
            InitializeComponent();

            _propertyGrid              = new MXPropertyGrid();
            _propertyGrid.Visible      = false;
            _propertyGrid.Dock         = DockStyle.Fill;
            _propertyGrid.PropertySort = PropertySort.Categorized;
            panel1.Controls.Add(_propertyGrid);

            _itemEditor         = new ItemEditor();
            _itemEditor.Visible = false;
            _itemEditor.Dock    = DockStyle.Fill;
            panel1.Controls.Add(_itemEditor);

            _costumeEditor         = new MXCostumeEditor();
            _costumeEditor.Visible = false;
            _costumeEditor.Dock    = DockStyle.Fill;
            panel1.Controls.Add(_costumeEditor);

            _copyMoveLogic           = new MXButton();
            _copyMoveLogic.Text      = "Copy Move Logic Struct to Clipboard";
            _copyMoveLogic.ForeColor = Color.White;
            _copyMoveLogic.Height    = 24;
            _copyMoveLogic.Visible   = false;
            _copyMoveLogic.Dock      = DockStyle.Top;
            _copyMoveLogic.Click    += CopyMoveLogic;
            _copyMoveLogic.Font      = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular);
            panel1.Controls.Add(_copyMoveLogic);



            _importBoneYml           = new MXButton();
            _importBoneYml.Text      = "Import Bone YAML";
            _importBoneYml.ForeColor = Color.White;
            _importBoneYml.Height    = 24;
            _importBoneYml.Visible   = false;
            _importBoneYml.Dock      = DockStyle.Top;
            _importBoneYml.Click    += (sender, args) =>
            {
                if (fighterListBox.SelectedItem is MEXFighter fighter &&
                    _propertyGrid.SelectedObject is SBM_BoneLookupTable bones)
                {
                    using (OpenFileDialog d = new OpenFileDialog())
                    {
                        d.Filter = ApplicationSettings.YAMLFilter;
                        if (d.ShowDialog() == DialogResult.OK)
                        {
                            var serializer = new DeserializerBuilder()
                                             .WithNamingConvention(CamelCaseNamingConvention.Instance)
                                             .WithTypeInspector(inspector => new MEXTypeInspector(inspector))
                                             .Build();

                            using (StreamReader r = new StreamReader(d.FileName))
                            {
                                fighter.BoneTable            = serializer.Deserialize <SBM_BoneLookupTable>(r.ReadToEnd());
                                _propertyGrid.SelectedObject = fighter.BoneTable;
                            }
                        }
                    }
                }
            };
            _importBoneYml.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular);
            panel1.Controls.Add(_importBoneYml);

            _exportBoneYml           = new MXButton();
            _exportBoneYml.Text      = "Export Bone YAML";
            _exportBoneYml.ForeColor = Color.White;
            _exportBoneYml.Height    = 24;
            _exportBoneYml.Visible   = false;
            _exportBoneYml.Dock      = DockStyle.Top;
            _exportBoneYml.Click    += (sender, args) =>
            {
                if (_propertyGrid.SelectedObject is SBM_BoneLookupTable bones)
                {
                    using (SaveFileDialog d = new SaveFileDialog())
                    {
                        d.Filter = ApplicationSettings.YAMLFilter;
                        if (d.ShowDialog() == DialogResult.OK)
                        {
                            var serializer = new SerializerBuilder()
                                             .WithNamingConvention(CamelCaseNamingConvention.Instance)
                                             .WithTypeInspector(inspector => new MEXTypeInspector(inspector))
                                             .Build();

                            File.WriteAllText(d.FileName, serializer.Serialize(bones));
                        }
                    }
                }
            };
            _exportBoneYml.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular);
            panel1.Controls.Add(_exportBoneYml);


            fighterListBox.DataSource = MEX.Fighters;
            buttonGeneralTab.PerformClick();
        }
Beispiel #49
0
        private static Control AddEditorAndInit(DecoratedItem item, EditableItemAttribute editable, Page page, ItemEditor enclosingEditor)
        {
            page.Controls.Add(enclosingEditor);
            enclosingEditor.Page        = page;
            enclosingEditor.CurrentItem = item;
            var editor = editable.AddTo(enclosingEditor);

            page.InitRecursive();
            return(editor);
        }
Beispiel #50
0
		private static Control AddEditorAndInit(DecoratedItem item, EditableItemAttribute editable, Page page, ItemEditor enclosingEditor)
		{
			page.Controls.Add(enclosingEditor);
			enclosingEditor.Page = page;
			enclosingEditor.CurrentItem = item;
			var editor = editable.AddTo(enclosingEditor);
			page.InitRecursive();
			return editor;
		}
Beispiel #51
0
        /// <inheritdoc/>
        /// <summary>
        /// Initializes a new VillagerControl object.
        /// </summary>
        /// <param name="mainFormReference">The main form reference, which is used by the item editor subcontrols.</param>
        /// <param name="index">The index of the control.</param>
        /// <param name="saveFile">The currently open <see cref="T:ACSE.Save" />.</param>
        /// <param name="villager">The <see cref="T:ACSE.Villager" /> that is being edited.</param>
        /// <param name="villagers">A dictionary of <see cref="T:ACSE.SimpleVillager" />s and their villager ids.</param>
        /// <param name="villagerNames">An array of villager names.</param>
        /// <param name="personalityTypes">An array of personality names.</param>
        public VillagerControl(MainForm mainFormReference, int index, Save saveFile, Villager villager,
                               Dictionary <ushort, SimpleVillager> villagers,
                               string[] villagerNames, string[] personalityTypes)
        {
            Index             = index;
            _saveFile         = saveFile;
            _villager         = villager;
            _villagers        = villagers;
            _villagerNames    = villagerNames;
            _personalityTypes = personalityTypes;

            FlowDirection = FlowDirection.LeftToRight;
            AutoSize      = true;
            Margin        = new Padding(0);
            MaximumSize   = new Size(0, 66);

            // Set up controls that are always used

            _indexLabel = new Label
            {
                AutoSize  = false,
                Size      = new Size(45, 32),
                TextAlign = ContentAlignment.MiddleCenter,
                Text      = index == 16 ? "Islander" : (index + 1).ToString()
            };

            var margin = CalculateControlVerticalMargin(_indexLabel);

            _indexLabel.Margin = new Padding(0, margin, 0, margin);

            _villagerSelectionBox = new ComboBox
            {
                Size          = new Size(120, 32),
                DropDownStyle = ComboBoxStyle.DropDownList
            };

            margin = CalculateControlVerticalMargin(_villagerSelectionBox);
            _villagerSelectionBox.Margin = new Padding(0, margin, 10, margin);
            _villagerSelectionBox.Items.AddRange(_villagerNames);

            for (var i = 0; i < _villagers.Count; i++)
            {
                if (villagers.ElementAt(i).Key != _villager.Data.VillagerId)
                {
                    continue;
                }
                _villagerSelectionBox.SelectedIndex = i;
                break;
            }

            _villagerSelectionBox.SelectedIndexChanged += (s, e) => VillagerSelectionBoxChanged();

            _personalityBox = new ComboBox
            {
                Size          = new Size(80, 32),
                DropDownStyle = ComboBoxStyle.DropDownList
            };

            margin = CalculateControlVerticalMargin(_personalityBox);
            _personalityBox.Margin = new Padding(0, margin, 10, margin);
            _personalityBox.Items.AddRange(_personalityTypes);
            _personalityBox.SelectedIndex         = _villager.Data.Personality % _personalityTypes.Length;
            _personalityBox.SelectedIndexChanged += (o, e) => PersonalityChanged();

            _catchphraseBox = new TextBox
            {
                Size      = new Size(100, 32),
                MaxLength = _villager.Offsets.CatchphraseSize,
                Text      = _villager.Data.Catchphrase
            };

            margin = CalculateControlVerticalMargin(_catchphraseBox);
            _catchphraseBox.Margin       = new Padding(0, margin, 10, margin);
            _catchphraseBox.TextChanged += (s, e) => CatchphraseChanged();

            _shirtEditor              = new SingleItemEditor(mainFormReference, _villager.Data.Shirt, 16);
            margin                    = CalculateControlVerticalMargin(_shirtEditor);
            _shirtEditor.Margin       = new Padding(0, margin, 10, margin);
            _shirtEditor.ItemChanged += delegate(object sender, ItemChangedEventArgs e)
            {
                _villager.Data.Shirt = e.NewItem;
            };

            if (_villager.Data.Umbrella != null)
            {
                _umbrellaEditor        = new SingleItemEditor(mainFormReference, _villager.Data.Umbrella, 16);
                margin                 = CalculateControlVerticalMargin(_umbrellaEditor);
                _umbrellaEditor.Margin = new Padding(0, margin, 10, margin);
            }

            // Add controls to flow panel

            Controls.Add(_indexLabel);
            Controls.Add(_villagerSelectionBox);
            Controls.Add(_personalityBox);
            Controls.Add(_catchphraseBox);
            Controls.Add(_shirtEditor);
            Controls.Add(_umbrellaEditor);

            // Set up controls that are used on a per-save generation basis

            switch (_saveFile.SaveGeneration)
            {
            case SaveGeneration.N64:
            case SaveGeneration.GCN:
            case SaveGeneration.iQue:
                // e+ exclusive controls TODO: These will probably be used in City Folk as well.
                if (_saveFile.SaveType == SaveType.DoubutsuNoMoriEPlus || _saveFile.SaveType == SaveType.AnimalForestEPlus)
                {
                    _nameBox = new TextBox
                    {
                        Size      = new Size(60, 32),
                        Text      = _villager.Name,
                        MaxLength = _saveFile.SaveType == SaveType.AnimalForestEPlus ? 8 : 6
                    };

                    margin                = CalculateControlVerticalMargin(_nameBox);
                    _nameBox.Margin       = new Padding(0, margin, 10, margin);
                    _nameBox.TextChanged += (s, e) => NameTextChanged();

                    _importDlcButton = new Button
                    {
                        Text     = "Import DLC Data",
                        AutoSize = true
                    };

                    margin = CalculateControlVerticalMargin(_importDlcButton);
                    _importDlcButton.Margin = new Padding(0, margin, 10, margin);
                    _importDlcButton.Click += (s, e) => ImportDlcVillager();

                    Controls.Add(_nameBox);
                    Controls.Add(_importDlcButton);
                }

                _villagerPreviewBox = new OffsetablePictureBox
                {
                    Size   = new Size(64, 64),
                    Image  = Properties.Resources.Villagers,
                    Offset = (_villager.Data.VillagerId < 0xE000 || _villager.Data.VillagerId > 0xE0EB) ? new Point(64 * 6, 64 * 23)
                            : new Point(64 * ((_villager.Data.VillagerId & 0xFF) % 10), 64 * ((_villager.Data.VillagerId & 0xFF) / 10))
                };
                Controls.Add(_villagerPreviewBox);

                break;

            case SaveGeneration.NDS:
            case SaveGeneration.Wii:
            case SaveGeneration.N3DS:
                _carpetWallpaperEditor = new ItemEditor(mainFormReference,
                                                        new[] { _villager.Data.Carpet, _villager.Data.Wallpaper }, 2, 16);
                margin = CalculateControlVerticalMargin(_carpetWallpaperEditor);
                _carpetWallpaperEditor.Margin = new Padding(0, margin, 10, margin);

                _musicEditor        = new SingleItemEditor(mainFormReference, _villager.Data.Song, 16);
                margin              = CalculateControlVerticalMargin(_musicEditor);
                _musicEditor.Margin = new Padding(0, margin, 10, margin);

                _furnitureEditor = new ItemEditor(mainFormReference, _villager.Data.Furniture,
                                                  _villager.Data.Furniture.Length, 16);
                margin = CalculateControlVerticalMargin(_furnitureEditor);
                _furnitureEditor.Margin = new Padding(0, margin, 10, margin);

                Controls.Add(_carpetWallpaperEditor);
                Controls.Add(_musicEditor);
                Controls.Add(_furnitureEditor);

                if (_saveFile.SaveGeneration == SaveGeneration.N3DS)
                {
                    _boxedCheckBox = new CheckBox
                    {
                        Text    = "Boxed",
                        Checked = _villager.Boxed()
                    };

                    margin = CalculateControlVerticalMargin(_boxedCheckBox);
                    _boxedCheckBox.Margin          = new Padding(0, margin, 10, margin);
                    _boxedCheckBox.CheckedChanged += (o, e) => BoxedCheckBoxChanged();

                    Controls.Add(_boxedCheckBox);
                }

                break;

            case SaveGeneration.Unknown:
                break;

            default:
                Console.Write($"Unhandled save generation {_saveFile.SaveGeneration}!");
                break;
            }
        }
Beispiel #52
0
        public void MoveEditorUp( ItemEditor i )
        {
            _memento.Record(@"Move editor up '{0}'".FormatWith(i.Name), () =>
                {
                    int index = i.ParentLayer.Items.IndexOf( i ) ;
                    i.ParentLayer.Items[ index ] = i.ParentLayer.Items[ index - 1 ] ;
                    i.ParentLayer.Items[ index - 1 ] = i ;
                });

            SelectEditor( i ) ;

            tryFire( ( ) => ItemsRearrangedInLayer, i ) ;
        }
        public void Update( )
        {
            //get item under mouse cursor

            var model = ObjectFactory.GetInstance<IModel>( ) ;

            ItemEditor item = _canvas.ItemUnderMouse ;

            bool controlButtonPressed = KeyboardStatus.IsKeyDown( Keys.LeftControl ) ;

            if (KeyboardStatus.IsKeyDown( Keys.Space ) && MouseStatus.IsNewLeftMouseButtonClick())
            {
                _canvas.StartMovingCamera();
                return;
            }

            if( item != null )
            {
                _mainForm.SetToolStripStatusLabel1( item.ItemProperties.Name ) ;

                item.OnMouseOver( MouseStatus.WorldPosition ) ;

                if( controlButtonPressed )
                {
                    _mainForm.SetCursorForCanvas( _cursorDuplicate ) ;
                }
            }
            else
            {
                _mainForm.SetToolStripStatusLabel1( string.Empty ) ;
            }

            if( item != _lastItem && _lastItem != null )
            {
                _lastItem.OnMouseOut( ) ;
            }

            _lastItem = item ;

            IEnumerable<ITreeItem> editors = selectedEditors( ).ToList(  ) ;

            if ( MouseStatus.IsNewLeftMouseButtonClick() || KeyboardStatus.IsNewKeyPress(Keys.D1))
            {
                if( item != null )
                {
                    item.OnMouseButtonDown( MouseStatus.WorldPosition ) ;
                }

                if( controlButtonPressed && item != null )
                {
                    _canvas.StartCopyingSelectedItems( ) ;
                }
                else if( KeyboardStatus.IsKeyDown( Keys.LeftShift ) && item!=null )
                {
                    model.ToggleSelectionOnItem( item ) ;
                }
                else if( editors.Contains( item ) )
                {
                    _canvas.StartMovingSelectedItems( ) ;
                }
                else if (!selectedEditors().Contains(item))
                {
                    if( item != null )
                    {
                        _model.SelectEditor( item ) ;
                        _canvas.StartMovingSelectedItems(  );
                    }
                    else
                    {
                        _canvas.CreateSelectionRectangle( ) ;
                    }
                }
            }

            //MIDDLE MOUSE BUTTON CLICK
            bool anyEditorsSelected = editors.Any() ;

            if( MouseStatus.IsNewMiddleMouseButtonClick( ) || KeyboardStatus.IsNewKeyPress( Keys.D2 ) )
            {
                if( item != null )
                {
                    item.OnMouseOut( ) ;
                }

                if( controlButtonPressed )
                {
                    _canvas.StartMovingCamera( ) ;
                }
                else
                {
                    if( anyEditorsSelected  )
                    {
                        _canvas.StartRotatingItems( ) ;
                    }
                }
            }

            //RIGHT MOUSE BUTTON CLICK
            if( MouseStatus.IsNewRightMouseButtonClick( ) || KeyboardStatus.IsNewKeyPress( Keys.D3 ) )
            {
                if( item != null )
                {
                    item.OnMouseOut( ) ;
                }

                if( anyEditorsSelected )
                {
                    _canvas.StartScalingSelectedItems( ) ;
                }
            }

            selectedEditors(  ).ForEach( e=>e.HandleKeyPressWhenFocused() );
        }
Beispiel #54
0
		public void NewChild_IsSaved()
		{
			var item = new DecoratedItem();
			var definition = new DefinitionMap().GetOrCreateDefinition(item);
			var editable = (EditableItemAttribute)definition.Properties["TheItem"].Editable;

			var page = new Page();
			var enclosingEditor = new ItemEditor();
			var editor = AddEditorAndInit(item, editable, page, enclosingEditor);

			editable.UpdateEditor(item, editor);

			var ctx = new N2.Edit.Workflow.CommandContext(definition, item, Interfaces.Editing, engine.RequestContext.User);
			enclosingEditor.UpdateObject(ctx);

			ctx.GetItemsToSave().ShouldContain(item.TheItem);
		}
Beispiel #55
0
 public SelectEditorAction( ItemEditor item )
 {
     _item = item ;
 }
Beispiel #56
0
        public void MoveEditorDown( ItemEditor editor )
        {
            _memento.Record(@"Move editor down'{0}'".FormatWith(editor.Name), () =>
                {
                    int index = editor.ParentLayer.Items.IndexOf( editor ) ;
                    editor.ParentLayer.Items[ index ] = editor.ParentLayer.Items[ index + 1 ] ;
                    editor.ParentLayer.Items[ index + 1 ] = editor ;
                });

            SelectEditor( editor ) ;

            tryFire( ( ) => ItemsRearrangedInLayer, editor ) ;
        }
Beispiel #57
0
 private void tCustomItemList_TextChanged(object sender, EventArgs e)
 {
     ItemEditor.UpdateChecks(tCustomItemList.Text);
     UpdateCustomItemAmountLabel();
 }
Beispiel #58
0
            GetStandardValues(ITypeDescriptorContext context)
            {
                ItemEditor editor = (ItemEditor)context.Instance;

                return(GetValues(editor.Item));
            }
 public SelectEditorAction(ItemEditor item)
 {
     _item = item;
 }
Beispiel #60
0
        public void ToggleSelectionOnItem( ItemEditor item )
        {
            item.ToggleSelection( ) ;

            tryFire( ( ) => SelectionChanged, Level.SelectedEditors ) ;
        }