Beispiel #1
0
    protected void EditMode()
    {
        StartTopBox();
        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Save " + EditorName.ToLower(), GUILayout.Width(300)))
        {
            SaveButtonEvent();
        }

        if (GUILayout.Button("Back to list", GUILayout.Width(300)))
        {
            MenuMode = MenuModeEnum.List;
        }

        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        //main area
        StartMainBox();

        EditorUtils.IItemEditor(currentItem);

        EditPart();

        SaveButton();
    }
Beispiel #2
0
 void SaveButtonEvent()
 {
     if (!updateMode)
     {
         items.Add(currentItem);
     }
     SaveCollection();
     loadData = true;
     MenuMode = MenuModeEnum.List;
 }
Beispiel #3
0
 public void SelectItemBYID(int ID)
 {
     MenuMode      = MenuModeEnum.List;
     outsideID     = ID;
     updateOutside = true;
 }
Beispiel #4
0
    private void ListMode()
    {
        //add button area
        StartTopBox();

        if (GUILayout.Button("Add new " + EditorName.ToLower(), GUILayout.Width(300)))
        {
            MenuMode   = MenuModeEnum.Edit;
            updateMode = false;
            StartNewIItem();
            DetermineID();
            currentItem.Name              = string.Empty;
            currentItem.Description       = string.Empty;
            currentItem.SystemDescription = string.Empty;
        }
        string temp = searchedString;

        temp = EditorUtils.TextField(temp, "Search", 200, FieldTypeEnum.BeginningOnly);

        if (temp != searchedString)
        {
            searchedString = temp;
            PrepareSearch();
        }

        temp = searchedID;
        temp = EditorUtils.TextField(temp, "ID", 80, FieldTypeEnum.Middle);
        if (temp != searchedID)
        {
            searchedID = temp;
            PrepareSearch();
        }

        if (GUILayout.Button("Clear", GUILayout.Width(150)))
        {
            Clear();
        }

        GUILayout.EndArea();

        StartMainBox();

        foreach (IItem item in displayedItems)
        {
            GUILayout.BeginHorizontal();
            string buttonLabel = "ID: " + item.ID + " - ";

            if (!string.IsNullOrEmpty(item.Name))
            {
                buttonLabel += item.Name;
            }
            if (!string.IsNullOrEmpty(item.SystemDescription))
            {
                buttonLabel += "(" + item.SystemDescription + ")";
            }
            if ((outsideID == item.ID && updateOutside) || GUILayout.Button(buttonLabel, GUILayout.Width(position.width - 120)))
            {
                MenuMode      = MenuModeEnum.Edit;
                updateMode    = true;
                updateOutside = false;
                outsideID     = 0;
                currentItem   = item;
            }

            if (GUILayout.Button("Delete", GUILayout.Width(80)))
            {
                items.Remove(item);
                SaveCollection();
                Data.InitWindows();
                return;
            }

            GUILayout.EndHorizontal();
        }

        EditorGUILayout.EndScrollView();

        GUILayout.EndArea();
    }
	protected void EditMode()
	{
		StartTopBox();
		GUILayout.BeginHorizontal();
		
		if (GUILayout.Button("Save " + EditorName.ToLower(), GUILayout.Width(300)))
		{
			SaveButtonEvent();
		}
		
		if (GUILayout.Button("Back to list", GUILayout.Width(300)))
		{
			MenuMode = MenuModeEnum.List;
		}
		
		GUILayout.EndHorizontal();
		GUILayout.EndArea();
		
		//main area
		StartMainBox();
		
		EditorUtils.IItemEditor(currentItem); 
		
		EditPart();
		
		SaveButton();
	}
	void SaveButtonEvent()
	{
		if (!updateMode)
			items.Add(currentItem);	
		SaveCollection();
		loadData = true;
		MenuMode = MenuModeEnum.List;
	}
	public void SelectItemBYID(int ID)
	{
		MenuMode = MenuModeEnum.List;
		outsideID = ID;
		updateOutside = true;
	}
	private void ListMode()
	{
		//add button area
		StartTopBox();
		
		if (GUILayout.Button("Add new " + EditorName.ToLower(), GUILayout.Width(300)))
		{
			MenuMode = MenuModeEnum.Edit;
			updateMode = false;
			StartNewIItem();
			DetermineID();
			currentItem.Name = string.Empty;
			currentItem.Description = string.Empty;
			currentItem.SystemDescription = string.Empty;
		}
		string temp = searchedString;
		temp = EditorUtils.TextField(temp, "Search", 200, FieldTypeEnum.BeginningOnly);
		
		if (temp != searchedString)
		{
			searchedString = temp;
			PrepareSearch();
		}
		
		temp = searchedID;
		temp = EditorUtils.TextField(temp, "ID", 80, FieldTypeEnum.Middle);
		if (temp != searchedID)
		{
			searchedID = temp;
			PrepareSearch();
		}
		
		if (GUILayout.Button("Clear", GUILayout.Width(150)))
		{
			Clear();
		}
		
		GUILayout.EndArea();
		
		StartMainBox();
		
		foreach(IItem item in displayedItems)
		{
			GUILayout.BeginHorizontal();
			string buttonLabel = "ID: " + item.ID + " - ";
			
			if (!string.IsNullOrEmpty(item.Name))
			{
				buttonLabel += item.Name;
			}
			if (!string.IsNullOrEmpty(item.SystemDescription))
			{
				buttonLabel += "(" + item.SystemDescription + ")";
			}
			if ((outsideID == item.ID && updateOutside) || GUILayout.Button(buttonLabel, GUILayout.Width(position.width - 120)))
			{
				MenuMode = MenuModeEnum.Edit;
				updateMode = true;
				updateOutside = false;
				outsideID = 0;
				currentItem = item;
			}
			
			if (GUILayout.Button("Delete", GUILayout.Width(80)))
			{
				items.Remove(item);
				SaveCollection();
				Data.InitWindows();
				return;
			}
			
			GUILayout.EndHorizontal();
		}
		
		EditorGUILayout.EndScrollView();
		
		GUILayout.EndArea();
	}